From 32feac7b9b4b43c5e25392766715f9c88429f79f Mon Sep 17 00:00:00 2001 From: IgorA Date: Wed, 2 Jul 2014 16:45:48 +0000 Subject: [PATCH] 't_edit': fix exit with program git-svn-id: svn://kolibrios.org@4991 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/other/t_edit/t_button.inc | 88 ++++++++++++++++++++---------- programs/other/t_edit/t_data.inc | 71 ++++++------------------ programs/other/t_edit/t_edit.asm | 11 +++- 3 files changed, 82 insertions(+), 88 deletions(-) diff --git a/programs/other/t_edit/t_button.inc b/programs/other/t_edit/t_button.inc index 6c3f1544dc..636ea5def3 100644 --- a/programs/other/t_edit/t_button.inc +++ b/programs/other/t_edit/t_button.inc @@ -35,41 +35,69 @@ ted_on_init_synt_err: align 4 ted_but_new_file: - push eax ebx - stdcall [ted_can_save], tedit0 - cmp al,1 - jne @f - stdcall [mb_create],msgbox_2,thread ;message: save changes in file? - ;mov eax,5 - ;mov ebx,50 - ;int 0x40 - stdcall [mb_setfunctions],msgbox_2_funct - jmp .ret_f - @@: - call On_NewFile - .ret_f: - pop ebx eax - ret + push eax ebx + stdcall [ted_can_save], tedit0 + cmp al,1 + jne @f + stdcall [mb_create],msgbox_2,thread ;message: save changes in file? + stdcall [mb_setfunctions],msgbox_2N_funct + jmp .ret_f + @@: + call On_NewFile + .ret_f: + pop ebx eax + ret align 4 On_NewFile: - stdcall [ted_clear], tedit0,1 - call draw_but_toolbar - stdcall [ted_draw], tedit0 - ret + stdcall [ted_clear], tedit0,1 + call draw_but_toolbar + stdcall [ted_draw], tedit0 + ret align 4 On_SaveAndNewFile: - push edi - mov edi, tedit0 + push edi + mov edi, tedit0 - call ted_but_save_file - cmp ted_err_save,0 - jne @f - call On_NewFile - @@: - pop edi - ret + call ted_but_save_file + cmp ted_err_save,0 + jne @f + call On_NewFile + @@: + pop edi + ret + +align 4 +On_SaveAndOpenFile: + push edi + mov edi, tedit0 + + call ted_but_save_file + cmp ted_err_save,0 + jne @f + call ted_but_open_file.no_msg + @@: + pop edi + ret + +align 4 +On_SaveAndExit: + push edi + mov edi, tedit0 + + call ted_but_save_file + cmp ted_err_save,0 + jne @f + mov dword[exit_code],1 + @@: + pop edi + ret + +align 4 +On_Exit: + mov dword[exit_code],1 + ret ;description: ; функция открытия файла без окна сообщения @@ -90,8 +118,8 @@ ted_but_open_file: stdcall [ted_can_save], tedit0 cmp al,1 jne @f - stdcall [mb_create],msgbox_5,thread ;message: save changes in file? - stdcall [mb_setfunctions],msgbox_5_funct + stdcall [mb_create],msgbox_2,thread ;message: save changes in file? + stdcall [mb_setfunctions],msgbox_2O_funct jmp .ret_f .no_msg: ;метка для вызова функции через кнопку в сообщении msgbox_5 pushad diff --git a/programs/other/t_edit/t_data.inc b/programs/other/t_edit/t_data.inc index d68f45c5a0..7e2920d7d9 100644 --- a/programs/other/t_edit/t_data.inc +++ b/programs/other/t_edit/t_data.inc @@ -2,6 +2,8 @@ fn_col_option dd def_col_file fn_syntax_dir db 'info/',0 def_col_file db 'default.syn',0 +exit_code dd 0 ;переменная используемая для выхода из программы + ;значения задаваемые по умолчанию, без ini файла ini_def_window_t equ 10 ini_def_window_l equ 10 @@ -68,10 +70,6 @@ import_box_lib: scrollbar_hor_mouse dd aScrollbar_hor_mouse ;version_scrollbar dd aVersion_scrollbar - ;dinamic_button_draw dd aDbutton_draw - ;dinamic_button_mouse dd aDbutton_mouse - ;version_dbutton dd aVersion_dbutton - menu_bar_draw dd aMenu_bar_draw menu_bar_mouse dd aMenu_bar_mouse ;version_menu_bar dd aVersion_menu_bar @@ -140,10 +138,6 @@ dd 0,0 aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 ;aVersion_scrollbar db 'version_scrollbar',0 - ;aDbutton_draw db 'dbutton_draw',0 - ;aDbutton_mouse db 'dbutton_mouse',0 - ;aVersion_dbutton db 'version_dbutton',0 - aMenu_bar_draw db 'menu_bar_draw',0 aMenu_bar_mouse db 'menu_bar_mouse',0 ;aVersion_menu_bar db 'version_menu_bar',0 @@ -494,7 +488,7 @@ tree_file_struct: if lang eq ru -hed db 'Текстовый редактор 28.11.13',0 ;подпись окна +hed db 'Текстовый редактор 02.07.14',0 ;подпись окна menu_text_area: db 'Файл',0 @@ -522,7 +516,6 @@ msgbox_2: db 'Не сохранять',0 db 'Отмена',0 db 0 - msgbox_3: db 1,0 db 'Внимание',0 @@ -533,7 +526,6 @@ msgbox_3: db ')',0 db 'Закрыть',0 db 0 - msgbox_4: db 1,0 db 'Внимание',0 @@ -544,15 +536,6 @@ msgbox_4: db ')',0 db 'Закрыть',0 db 0 - -msgbox_5: - db 3,0 - db 'Внимание',0 - db 'Сохранить изменения в файле?',0 - db 'Не сохранять',0 - db 'Отмена',0 - db 0 - msgbox_6: db 1,0 db 'Внимание',0 @@ -571,14 +554,6 @@ msgbox_7: 'или изменить запрос и повторить поиск.',0 db 'Закрыть',0 db 0 -msgbox_8: - db 3,0 - db 'Внимание',0 - db 'Для выхода завершите работу с файлом.',13,\ - 'Попробуйте сохранить изменения в файле',13,\ - 'или начать новый пустой.',0 - db 'Отмена',0 - db 0 msgbox_9: db 3,0 db 'Внимание',0 @@ -597,7 +572,7 @@ txtFormatApply db ' else -hed db 'Text editor 28.11.13',0 +hed db 'Text editor 02.07.14',0 menu_text_area: db 'File',0 @@ -625,7 +600,6 @@ msgbox_2: db 'Discard',0 db 'Cancel',0 db 0 - msgbox_3: db 1,0 db 'Warning',0 @@ -636,7 +610,6 @@ msgbox_3: db ')',0 db 'Close',0 db 0 - msgbox_4: db 1,0 db 'Warning',0 @@ -647,15 +620,6 @@ msgbox_4: db ')',0 db 'Close',0 db 0 - -msgbox_5: - db 3,0 - db 'Warning',0 - db 'Save changes to the file?',0 - db 'Discard',0 - db 'Cancel',0 - db 0 - msgbox_6: db 1,0 db 'Warning',0 @@ -674,14 +638,6 @@ msgbox_7: 'or change the query and search again.',0 db 'Close',0 db 0 -msgbox_8: - db 3,0 - db 'Warning',0 - db 'To quit, quit the file.',13,\ - 'Try to keep changes to a file',13,\ - 'or start a new blank file.',0 - db 'Cancel',0 - db 0 msgbox_9: db 3,0 db 'Warning',0 @@ -701,13 +657,18 @@ txtFormatApply db 'Apply',0 end if ;функции для кнопок в сообщениях -msgbox_2_funct: - dd On_SaveAndNewFile - dd On_NewFile - dd 0 -msgbox_5_funct: - dd ted_but_open_file.no_msg - dd 0 +msgbox_2N_funct: + dd On_SaveAndNewFile + dd On_NewFile + dd 0 +msgbox_2O_funct: + dd On_SaveAndOpenFile + dd ted_but_open_file.no_msg + dd 0 +msgbox_2E_funct: + dd On_SaveAndExit + dd On_Exit + dd 0 KM_SHIFT equ 0x00010000 KM_CTRL equ 0x00020000 diff --git a/programs/other/t_edit/t_edit.asm b/programs/other/t_edit/t_edit.asm index 4ebd92ff4b..ec89d5c681 100644 --- a/programs/other/t_edit/t_edit.asm +++ b/programs/other/t_edit/t_edit.asm @@ -229,6 +229,8 @@ red_win: align 4 still: mcall 10 + cmp dword[exit_code],1 + je button.exit cmp al,1 ;изменилось положение окна jz red_win @@ -482,10 +484,13 @@ button: cmp ah,1 jne still .exit: + cmp dword[exit_code],1 + je @f stdcall [ted_can_save], tedit0 cmp al,1 jne @f - stdcall [mb_create],msgbox_8,thread ;message: save changes in file? + stdcall [mb_create],msgbox_2,thread ;message: save changes in file? + stdcall [mb_setfunctions],msgbox_2E_funct jmp still @@: stdcall mem.Free,[bmp_icon] @@ -502,9 +507,9 @@ PathShow_data_1: .type dd 0 ;+0 .start_y dw 9 ;+4 .start_x dw 222 ;+6 -.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 +.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 .area_size_x dw 200 ;+10 -.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable +.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable .background_flag dd 1 ;+16 .font_color dd 0x0 ;+20 .background_color dd 0xffffff ;+24