From dfca233dffd2e53a856ade04bbfa7c99449b44fc Mon Sep 17 00:00:00 2001 From: IgorA Date: Fri, 11 Jan 2019 10:59:40 +0000 Subject: [PATCH] fix r 7571, clean code git-svn-id: svn://kolibrios.org@7573 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/other/t_edit/t_button.inc | 194 ++++++++++++++++- programs/other/t_edit/t_draw.inc | 76 ++++--- programs/other/t_edit/t_edit.asm | 324 +++-------------------------- programs/other/t_edit/t_menu.inc | 79 ++++++- 4 files changed, 343 insertions(+), 330 deletions(-) diff --git a/programs/other/t_edit/t_button.inc b/programs/other/t_edit/t_button.inc index 4b3f65efd6..cf39feae3c 100644 --- a/programs/other/t_edit/t_button.inc +++ b/programs/other/t_edit/t_button.inc @@ -7,8 +7,195 @@ struct symbol td dd ? ;+14 врем. удаления ends +ID_BUT_0 equ 3 ;минимальный ID кнопки на панели + +ID_BUT_NEW equ 3 +ID_BUT_OPEN equ 4 +ID_BUT_SAVE equ 5 +ID_BUT_SAVE_AS equ 6 +ID_BUT_SELECT equ 7 +ID_BUT_CUT equ 8 +ID_BUT_COPY equ 9 +ID_BUT_PASTE equ 10 +ID_BUT_FIND equ 11 +ID_BUT_REPLACE equ 12 +ID_BUT_KEY_WORDS equ 13 +ID_BUT_UPPER equ 14 +ID_BUT_LOWER equ 15 +ID_BUT_REVERSE equ 16 +ID_BUT_UNDO equ 17 +ID_BUT_REDO equ 18 +ID_BUT_INVISIBLE equ 19 +ID_BUT_SYNTAX_LIST equ 20 +ID_BUT_SYNTAX_MODE equ 21 +ID_BUT_CONVERT_1251_866 equ 22 +ID_BUT_CONVERT_866_1251 equ 23 + +macro ini_panel b_key,b_id +{ + stdcall [ini_get_int],file_name,ini_sec_window,b_key,1 + mov byte[panel_but+b_id-ID_BUT_0],al +} + bmp_icon dd 0 +align 16 +button: + mcall SF_GET_BUTTON + cmp ah,ID_BUT_NEW + jne @f + call ted_but_new_file + jmp still + @@: + cmp ah,ID_BUT_OPEN + jne @f + call ted_but_open_file + jmp still + @@: + cmp ah,ID_BUT_SAVE + jne @f + xor eax,eax + call ted_but_save_file ;сохранение без диалога + jmp still + @@: + cmp ah,ID_BUT_SAVE_AS + jne @f + xor eax,eax + inc eax + call ted_but_save_file ;сохранение с диалогом + jmp still + @@: + cmp ah,ID_BUT_SELECT + jne @f + stdcall [ted_but_select_word], tedit0 + jmp still + @@: + cmp ah,ID_BUT_CUT + jne @f + stdcall [ted_but_cut], tedit0 + jmp still + @@: + cmp ah,ID_BUT_COPY + jne @f + stdcall [ted_but_copy], tedit0 + jmp still + @@: + cmp ah,ID_BUT_PASTE + jne @f + stdcall [ted_but_paste], tedit0 + jmp still + @@: + cmp ah,ID_BUT_FIND + jne @f + call ted_but_find + jmp still + @@: + cmp ah,ID_BUT_REPLACE + jne @f + call but_replace + jmp still + @@: + cmp ah,ID_BUT_KEY_WORDS + jne @f + call but_find_key_w + jmp still + @@: + cmp ah,ID_BUT_UPPER + jne @f + stdcall [ted_but_sumb_upper], tedit0 + jmp still + @@: + cmp ah,ID_BUT_LOWER + jne @f + stdcall [ted_but_sumb_lover], tedit0 + jmp still + @@: + cmp ah,ID_BUT_REVERSE + jne @f + stdcall [ted_but_reverse], tedit0 + jmp still + @@: + cmp ah,ID_BUT_UNDO + jne @f + stdcall [ted_but_undo], tedit0 + jmp still + @@: + cmp ah,ID_BUT_REDO + jne @f + stdcall [ted_but_redo], tedit0 + jmp still + @@: + cmp ah,ID_BUT_INVISIBLE + jne @f + stdcall but_sumb_invis, tedit0 + jmp still + @@: + cmp ah,ID_BUT_SYNTAX_LIST + jne @f + stdcall but_use_syntax, tedit0 + jmp still + @@: + cmp ah,ID_BUT_SYNTAX_MODE + jne @f + stdcall but_choose_syntax, tedit0 + jmp still + @@: + cmp ah,ID_BUT_CONVERT_1251_866 + jne @f + stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866 + jmp still + @@: + cmp ah,ID_BUT_CONVERT_866_1251 + jne @f + stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251 + jmp still + @@: + + cmp ah,200 + jne @f + stdcall ted_but_open_syntax, tedit0 + jmp still + @@: + cmp ah,201 + jne @f + stdcall [ted_but_find_next], tedit0 + jmp still + @@: + + cmp ah,1 + je .exit + + cmp ah,199 + je .exit + + jmp still +.exit: + cmp dword[wnd_k_words_run],0 + je @f + push ebx ecx + mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID,[wnd_k_words_run] + pop ecx ebx + test eax,eax + jnz still + @@: + cmp dword[exit_code],1 + je @f + stdcall [ted_can_save], tedit0 + cmp al,1 + jne @f + stdcall [mb_create],msgbox_2,thread ;message: save buf in file? + stdcall [mb_setfunctions],msgbox_2E_funct + jmp still + @@: + stdcall mem.Free,[bmp_icon] + cmp dword[unpac_mem],0 + je @f + stdcall mem.Free,[unpac_mem] + @@: + + stdcall [ted_delete], tedit0 + stdcall [tl_data_clear], tree1 + mcall SF_TERMINATE_PROCESS ;выход из программы ;input: ; al = код ошибки @@ -19,7 +206,6 @@ ted_on_init_synt_err: stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file! ret - align 4 ted_but_new_file: push eax ebx @@ -249,8 +435,6 @@ align 4 ted_messages_after_open_file: push ecx edi cmp eax,0 - je @f - cmp eax,6 je @f cmp ax,10 jl .zifra_0_9 @@ -445,7 +629,7 @@ endp ;description: ; выделение/скрытие ключевых слов align 4 -proc but_k_words_show uses edi, edit:dword +proc but_use_syntax uses edi, edit:dword mov edi,dword[edit] xor ted_mode_color,1 @@ -461,7 +645,7 @@ endp ;description: ; вызов/скрытие панели с файлами синтаксиса align 4 -proc but_synt_show uses edi, edit:dword +proc but_choose_syntax uses edi, edit:dword mov edi,[edit] cmp ted_panel_id,TED_PANEL_NULL diff --git a/programs/other/t_edit/t_draw.inc b/programs/other/t_edit/t_draw.inc index f93912e8eb..ca12b4bc88 100644 --- a/programs/other/t_edit/t_draw.inc +++ b/programs/other/t_edit/t_draw.inc @@ -1,16 +1,40 @@ + + +align 16 +draw_window: + mcall SF_REDRAW,SSF_BEGIN_DRAW + + mov edx,[sc.work] + or edx,0x73000000 + mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed + + mcall SF_THREAD_INFO,procinfo,-1 + mov edi,tedit0 ;чэрўхэшх edi эєцэю фы  EvSize ш ted_wnd_t + call EvSize + + movzx ebx,word[procinfo.client_box.width] + inc bx + mcall SF_DRAW_RECT,,ted_wnd_t ;тхЁїэшщ яЁ ьюєуюы№эшъ, фы  юўшёЄъш тхЁїэхщ ярэхыш + call draw_but_toolbar + stdcall [kmainmenu_draw], [main_menu] + stdcall [ted_draw], tedit0 + + mcall SF_REDRAW,SSF_END_DRAW + ret + align 4 draw_but_toolbar: ;ЇєэъЎш  фы  Ёшёютрэш  ярэхыш шэёЄЁєьхэЄют pushad mov edi,tedit0 - mov ecx,0x40000000 + mov ecx,0x40000000+ID_BUT_NEW mov edx,(5 shl 16)+25 bt word[panel_but],0 jnc @f call draw_but_icon ;New @@: - inc cx + mov cx,ID_BUT_OPEN bt word[panel_but+1],0 jnc @f add edx,25 shl 16 @@ -22,7 +46,7 @@ draw_but_toolbar: ; je @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_SAVE bt word[panel_but+2],0 jnc @f add edx,25 shl 16 @@ -30,14 +54,14 @@ draw_but_toolbar: ; @@: or ecx,0x40000000 - inc cx + mov cx,ID_BUT_SAVE_AS bt word[panel_but+3],0 jnc @f add edx,25 shl 16 call draw_but_icon ;Save as @@: - inc cx + mov cx,ID_BUT_SELECT bt word[panel_but+4],0 jnc @f add edx,30 shl 16 @@ -49,14 +73,14 @@ draw_but_toolbar: ; jnz @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_CUT bt word[panel_but+5],0 jnc @f add edx,25 shl 16 call draw_but_icon ;Cut @@: - inc cx + mov cx,ID_BUT_COPY bt word[panel_but+6],0 jnc @f add edx,25 shl 16 @@ -68,7 +92,7 @@ draw_but_toolbar: ; jne @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_PASTE bt word[panel_but+7],0 jnc @f add edx,25 shl 16 @@ -76,21 +100,21 @@ draw_but_toolbar: ; @@: or ecx,0x40000000 - inc cx + mov cx,ID_BUT_FIND bt word[panel_but+8],0 jnc @f add edx,25 shl 16 call draw_but_icon ;Found @@: - inc cx + mov cx,ID_BUT_REPLACE bt word[panel_but+9],0 jnc @f add edx,25 shl 16 call draw_but_icon ;Replace @@: - inc cx + mov cx,ID_BUT_KEY_WORDS bt word[panel_but+10],0 jnc @f add edx,25 shl 16 @@ -102,21 +126,21 @@ draw_but_toolbar: ; jnz @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_UPPER bt word[panel_but+11],0 jnc @f add edx,30 shl 16 call draw_but_icon ;Upper @@: - inc cx + mov cx,ID_BUT_LOWER bt word[panel_but+12],0 jnc @f add edx,25 shl 16 call draw_but_icon ;Lower @@: - inc cx + mov cx,ID_BUT_REVERSE bt word[panel_but+13],0 jnc @f add edx,25 shl 16 @@ -129,7 +153,7 @@ draw_but_toolbar: ; jg @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_UNDO bt word[panel_but+14],0 jnc @f add edx,30 shl 16 @@ -141,7 +165,7 @@ draw_but_toolbar: ; jge @f and ecx,0xffff @@: - inc cx + mov cx,ID_BUT_REDO bt word[panel_but+15],0 jnc @f add edx,25 shl 16 @@ -149,35 +173,35 @@ draw_but_toolbar: ; @@: or ecx,0x40000000 - inc cx + mov cx,ID_BUT_INVISIBLE bt word[panel_but+16],0 jnc @f add edx,30 shl 16 call draw_but_icon ;Invisible on|off @@: - inc cx + mov cx,ID_BUT_SYNTAX_LIST bt word[panel_but+17],0 jnc @f add edx,25 shl 16 call draw_but_icon ;┬√сюЁ Їрщыр яюфётхЄъш @@: - inc cx + mov cx,ID_BUT_SYNTAX_MODE bt word[panel_but+18],0 jnc @f add edx,25 shl 16 call draw_but_icon ;╧юфётхЄър тъы|т√ъы @@: - inc cx + mov cx,ID_BUT_CONVERT_1251_866 bt word[panel_but+19],0 jnc @f add edx,30 shl 16 call draw_but_icon ;cp 1251 -> 866 @@: - inc cx + mov cx,ID_BUT_CONVERT_866_1251 bt word[panel_but+20],0 jnc @f add edx,25 shl 16 @@ -204,7 +228,7 @@ proc draw_panel_find mov cx,20 mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] - mov ebx,30*65536+25 + mov ebx,(30 shl 16)+25 add ebx,ted_wnd_t mov ecx,[sc.work_text] or ecx,0x80000000 @@ -225,9 +249,9 @@ proc draw_panel_find add cx,20+15+5 shl ecx,16 mov cx,20 - mcall SF_DEFINE_BUTTON,5*65536+85,,201,[sc.work_button] ;201 - button id + mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id - mov ebx,15*65536+(20+15+10) + mov ebx,(15 shl 16)+(20+15+10) add ebx,ted_wnd_t mov ecx,[sc.work_text] or ecx,0x80000000 @@ -345,7 +369,7 @@ EvSize: ;input: ; ecx = 0x4000____ -; cx = icon index +; cx = ID button ; edx = x*2^16+y align 4 draw_but_icon: @@ -355,7 +379,6 @@ draw_but_icon: push ecx edx esi mov ebx,edx mov edx,ecx - add edx,3 mov cx,bx shl ecx,16 mov cx,19 ;=20-1 @@ -379,6 +402,7 @@ draw_but_icon: add ebx,TOOLBAR_ICONS_SIZE ;яхЁхьх∙рхьё  эр ёхЁ√х ъэюяъш .gray: push ecx + sub ecx,ID_BUT_0 and ecx,0xffff imul ecx,1200 add ebx,ecx diff --git a/programs/other/t_edit/t_edit.asm b/programs/other/t_edit/t_edit.asm index 0cc4efc0e7..95cad3b6d7 100644 --- a/programs/other/t_edit/t_edit.asm +++ b/programs/other/t_edit/t_edit.asm @@ -9,7 +9,7 @@ MAX_COLOR_WORD_LEN equ 40 maxChars equ 100002 ;(колличество символов в новом документе + 2) BUF_SIZE equ 4096 ;buffer for copy|paste maxSyntaxFileSize equ 410000 -TOOLBAR_ICONS_SIZE equ 1200*20 +TOOLBAR_ICONS_SIZE equ 1200*21 include '../../proc32.inc' include '../../macros.inc' @@ -21,10 +21,10 @@ include '../../system/skincfg/trunk/unpacker.inc' include 'lang.inc' include 't_data.inc' +include 't_button.inc' include 't_menu.inc' include 'strlen.inc' include 't_draw.inc' ;draw main window functions -include 't_button.inc' ;text work functions include 'wnd_k_words.inc' @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @@ -71,80 +71,9 @@ mov ebp,lib0 ; OpenDialog initialisation stdcall [OpenDialog_Init],OpenDialog_data -; kmenu initialisation - stdcall [kmenu_init], sc - - stdcall [ksubmenu_new] - mov [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_New, 3 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Open, 4 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Save, 5 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Save_As, 6 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Exit, 199 - stdcall [ksubmenu_add], [main_menu_file], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_File, [main_menu_file] - stdcall [ksubmenu_add], [main_menu], eax +; kmenu initialisation + call tedit_menu_init - stdcall [ksubmenu_new] - mov [main_menu_changes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Changes_Undo, 16 - stdcall [ksubmenu_add], [main_menu_changes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Changes_Redo, 17 - stdcall [ksubmenu_add], [main_menu_changes], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Changes, [main_menu_changes] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_buf], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Cut, 7 - stdcall [ksubmenu_add], [main_menu_buf], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Copy, 8 - stdcall [ksubmenu_add], [main_menu_buf], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Paste, 9 - stdcall [ksubmenu_add], [main_menu_buf], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Buf, [main_menu_buf] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_search], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Search_Text, 10 - stdcall [ksubmenu_add], [main_menu_search], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Search_Keywords, 12 - stdcall [ksubmenu_add], [main_menu_search], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Search, [main_menu_search] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_UseSyntax, 19 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_ChooseSyntax, 20 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_LineBreak, 18 - stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] - stdcall [ksubmenu_add], [main_menu], eax - - stdcall [ksubmenu_new] - mov [main_menu_encoding], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Encoding_1251to866, 21 - stdcall [ksubmenu_add], [main_menu_encoding], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Encoding_866to1251, 22 - stdcall [ksubmenu_add], [main_menu_encoding], eax - stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Encoding, [main_menu_encoding] - stdcall [ksubmenu_add], [main_menu], eax - ; init toolbar file include_image_file 'te_icon.png', bmp_icon,,,6 ;6 для серых кнопок mov eax,[bmp_icon] @@ -155,7 +84,6 @@ mov ebp,lib0 include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys mov eax,dword[icon_tl_sys] mov dword[tree1.data_img_sys],eax -;--------------------------------------------------------------------- ; внедряем файл с иконками узлов include_image_file 'tl_nod_16.png', icon_tl_sys mov eax,dword[icon_tl_sys] @@ -211,48 +139,27 @@ mov ebp,lib0 shl eax,24 mov dword[tedit0.font_size],eax ;кнопки на панели - stdcall [ini_get_int],file_name,ini_sec_window,key_but_new,1 - mov byte[panel_but],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_open,1 - mov byte[panel_but+1],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_save,1 - mov byte[panel_but+2],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_save_as,1 - mov byte[panel_but+3],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_select,1 - mov byte[panel_but+4],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_cut,1 - mov byte[panel_but+5],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_copy,1 - mov byte[panel_but+6],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_paste,1 - mov byte[panel_but+7],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_find,1 - mov byte[panel_but+8],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_replace,1 - mov byte[panel_but+9],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_key_words,1 - mov byte[panel_but+10],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_upper,1 - mov byte[panel_but+11],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_lower,1 - mov byte[panel_but+12],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_reverse,1 - mov byte[panel_but+13],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_undo,1 - mov byte[panel_but+14],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_redo,1 - mov byte[panel_but+15],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_invisible,1 - mov byte[panel_but+16],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_syntax_list,1 - mov byte[panel_but+17],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_syntax_mode,1 - mov byte[panel_but+18],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_convert_1251_866,1 - mov byte[panel_but+19],al - stdcall [ini_get_int],file_name,ini_sec_window,key_but_convert_866_1251,1 - mov byte[panel_but+20],al + ini_panel key_but_new, ID_BUT_NEW + ini_panel key_but_open, ID_BUT_OPEN + ini_panel key_but_save, ID_BUT_SAVE + ini_panel key_but_save_as,ID_BUT_SAVE_AS + ini_panel key_but_select, ID_BUT_SELECT + ini_panel key_but_cut, ID_BUT_CUT + ini_panel key_but_copy, ID_BUT_COPY + ini_panel key_but_paste, ID_BUT_PASTE + ini_panel key_but_find, ID_BUT_FIND + ini_panel key_but_replace,ID_BUT_REPLACE + ini_panel key_but_key_words,ID_BUT_KEY_WORDS + ini_panel key_but_upper, ID_BUT_UPPER + ini_panel key_but_lower, ID_BUT_LOWER + ini_panel key_but_reverse,ID_BUT_REVERSE + ini_panel key_but_undo, ID_BUT_UNDO + ini_panel key_but_redo, ID_BUT_REDO + ini_panel key_but_invisible,ID_BUT_INVISIBLE + ini_panel key_but_syntax_list,ID_BUT_SYNTAX_LIST + ini_panel key_but_syntax_mode,ID_BUT_SYNTAX_MODE + ini_panel key_but_convert_1251_866,ID_BUT_CONVERT_1251_866 + ini_panel key_but_convert_866_1251,ID_BUT_CONVERT_866_1251 ;файловые расширения xor edx,edx mov ebx,synt_auto_open @@ -307,28 +214,6 @@ still: @@: jmp still -align 16 -draw_window: - mcall SF_REDRAW,SSF_BEGIN_DRAW - - mov edx,[sc.work] - or edx,0x73000000 - mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4],,,hed - - mcall SF_THREAD_INFO,procinfo,-1 - mov edi,tedit0 ;значение edi нужно для EvSize и ted_wnd_t - call EvSize - - movzx ebx,word[procinfo.client_box.width] - inc bx - mcall SF_DRAW_RECT,,ted_wnd_t ;верхний прямоугольник, для очистки верхней панели - call draw_but_toolbar - stdcall [kmainmenu_draw], [main_menu] - stdcall [ted_draw], tedit0 - - mcall SF_REDRAW,SSF_END_DRAW - ret - align 16 mouse: stdcall [kmainmenu_dispatch_cursorevent], [main_menu] @@ -422,164 +307,7 @@ key: stdcall [ted_key], tedit0, conv_tabl,esi jmp still -align 16 -button: - mcall SF_GET_BUTTON - cmp ah,3 - jne @f - call ted_but_new_file - jmp still - @@: - cmp ah,4 - jne @f - call ted_but_open_file - jmp still - @@: - cmp ah,5 - jne @f - xor eax,eax - call ted_but_save_file ;сохранение без диалога - jmp still - @@: - cmp ah,6 - jne @f - xor eax,eax - inc eax - call ted_but_save_file ;сохранение с диалогом - jmp still - @@: - cmp ah,7 - jne @f - stdcall [ted_but_select_word], tedit0 - jmp still - @@: - cmp ah,8 - jne @f - stdcall [ted_but_cut], tedit0 - jmp still - @@: - cmp ah,9 - jne @f - stdcall [ted_but_copy], tedit0 - jmp still - @@: - cmp ah,10 - jne @f - stdcall [ted_but_paste], tedit0 - jmp still - @@: - cmp ah,11 - jne @f - call ted_but_find - jmp still - @@: - cmp ah,12 - jne @f - call but_replace - jmp still - @@: - cmp ah,13 - jne @f - call but_find_key_w - jmp still - @@: - cmp ah,14 - jne @f - stdcall [ted_but_sumb_upper], tedit0 - jmp still - @@: - cmp ah,15 - jne @f - stdcall [ted_but_sumb_lover], tedit0 - jmp still - @@: - cmp ah,16 - jne @f - stdcall [ted_but_reverse], tedit0 - jmp still - @@: - cmp ah,17 - jne @f - stdcall [ted_but_undo], tedit0 - jmp still - @@: - cmp ah,18 - jne @f - stdcall [ted_but_redo], tedit0 - jmp still - @@: - cmp ah,19 - jne @f - stdcall but_sumb_invis, tedit0 - jmp still - @@: - cmp ah,20 - jne @f - stdcall but_k_words_show, tedit0 - jmp still - @@: - cmp ah,21 - jne @f - stdcall but_synt_show, tedit0 - jmp still - @@: - cmp ah,22 - jne @f - stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866 - jmp still - @@: - cmp ah,23 - jne @f - stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251 - jmp still - @@: - - cmp ah,200 - jne @f - stdcall ted_but_open_syntax, tedit0 - jmp still - @@: - cmp ah,201 - jne @f - stdcall [ted_but_find_next], tedit0 - jmp still - @@: - - cmp ah,1 - je .exit - - cmp ah,199 - je .exit - - jmp still -.exit: - cmp dword[wnd_k_words_run],0 - je @f - push ebx ecx - mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID,[wnd_k_words_run] - pop ecx ebx - test eax,eax - jnz still - @@: - cmp dword[exit_code],1 - je @f - stdcall [ted_can_save], tedit0 - cmp al,1 - jne @f - stdcall [mb_create],msgbox_2,thread ;message: save buf in file? - stdcall [mb_setfunctions],msgbox_2E_funct - jmp still - @@: - stdcall mem.Free,[bmp_icon] - cmp dword[unpac_mem],0 - je @f - stdcall mem.Free,[unpac_mem] - @@: - - stdcall [ted_delete], tedit0 - stdcall [tl_data_clear], tree1 - mcall SF_TERMINATE_PROCESS ;выход из программы - +align 4 edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0 unpac_mem dd 0 diff --git a/programs/other/t_edit/t_menu.inc b/programs/other/t_edit/t_menu.inc index d009168a6e..2b23d4b307 100644 --- a/programs/other/t_edit/t_menu.inc +++ b/programs/other/t_edit/t_menu.inc @@ -63,6 +63,7 @@ sz_main_menu_Encoding_866to1251 db 'CP866 ',0x1A,' CP1251', 0 end if +align 4 main_menu dd 0 main_menu_file dd 0 main_menu_changes dd 0 @@ -73,4 +74,80 @@ main_menu_encoding dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 -KMENUITEM_SEPARATOR equ 2 \ No newline at end of file +KMENUITEM_SEPARATOR equ 2 + +align 16 +tedit_menu_init: + stdcall [kmenu_init], sc + + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_New, ID_BUT_NEW + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Open, ID_BUT_OPEN + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Save, ID_BUT_SAVE + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Save_As, ID_BUT_SAVE_AS + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Exit, 199 + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_File, [main_menu_file] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_changes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Changes_Undo, ID_BUT_UNDO + stdcall [ksubmenu_add], [main_menu_changes], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Changes_Redo, ID_BUT_REDO + stdcall [ksubmenu_add], [main_menu_changes], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Changes, [main_menu_changes] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_buf], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Cut, ID_BUT_CUT + stdcall [ksubmenu_add], [main_menu_buf], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Copy, ID_BUT_COPY + stdcall [ksubmenu_add], [main_menu_buf], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Buf_Paste, ID_BUT_PASTE + stdcall [ksubmenu_add], [main_menu_buf], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Buf, [main_menu_buf] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_search], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Search_Text, ID_BUT_FIND + stdcall [ksubmenu_add], [main_menu_search], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Search_Keywords, ID_BUT_KEY_WORDS + stdcall [ksubmenu_add], [main_menu_search], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Search, [main_menu_search] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_UseSyntax, ID_BUT_SYNTAX_LIST + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_ChooseSyntax, ID_BUT_SYNTAX_MODE + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_LineBreak, ID_BUT_INVISIBLE + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] + stdcall [ksubmenu_add], [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_encoding], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Encoding_1251to866, ID_BUT_CONVERT_1251_866 + stdcall [ksubmenu_add], [main_menu_encoding], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Encoding_866to1251, ID_BUT_CONVERT_866_1251 + stdcall [ksubmenu_add], [main_menu_encoding], eax + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Encoding, [main_menu_encoding] + stdcall [ksubmenu_add], [main_menu], eax + ret \ No newline at end of file