TextEdit: add new menu kmenu.obj (thanks Veliant), code clean

git-svn-id: svn://kolibrios.org@5649 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-02 14:54:03 +00:00
parent 279cd11187
commit 00eed9be08
4 changed files with 63 additions and 59 deletions

View File

@ -7,7 +7,7 @@ color_wnd_bord dd 0xc0c0c0
color_select dd 0x3E3D32 color_select dd 0x3E3D32
color_cur_text dd 0x808080 color_cur_text dd 0x808080
color_wnd_text: color_wnd_text:
dd 0xF8F8F2 dd 0xD0D0D0 ;F8F8F2
dd 0xffff00 dd 0xffff00
dd 0x00ff00 dd 0x00ff00
dd 0x00ffff dd 0x00ffff

File diff suppressed because one or more lines are too long

View File

@ -4,11 +4,11 @@ draw_but_toolbar: ;
mov edi,tedit0 mov edi,tedit0
mov ecx,0x40000000 mov ecx,0x40000000
mov edx,5*65536+5 mov edx,5*65536+25
call draw_but_icon call draw_but_icon
inc cx inc cx
mov edx,30*65536+5 mov edx,30*65536+25
call draw_but_icon call draw_but_icon
stdcall [ted_can_save],edi stdcall [ted_can_save],edi
@ -17,12 +17,12 @@ je @f
and ecx,0xffff and ecx,0xffff
@@: @@:
inc cx inc cx
mov edx,55*65536+5 mov edx,55*65536+25
call draw_but_icon call draw_but_icon
or ecx,0x40000000 or ecx,0x40000000
inc cx inc cx
mov edx,85*65536+5 mov edx,85*65536+25
call draw_but_icon call draw_but_icon
call [ted_is_select] call [ted_is_select]
@ -31,23 +31,23 @@ jne @f
and ecx,0xffff and ecx,0xffff
@@: @@:
inc cx ; Cut inc cx ; Cut
mov edx,110*65536+5 mov edx,110*65536+25
call draw_but_icon call draw_but_icon
inc cx ; Copy inc cx ; Copy
mov edx,135*65536+5 mov edx,135*65536+25
call draw_but_icon call draw_but_icon
mov cx,10 ; Upper mov cx,10 ; Upper
mov edx,265*65536+5 mov edx,265*65536+25
call draw_but_icon call draw_but_icon
inc cx ; Lower inc cx ; Lower
mov edx,290*65536+5 mov edx,290*65536+25
call draw_but_icon call draw_but_icon
inc cx ; reverse inc cx ; reverse
mov edx,315*65536+5 mov edx,315*65536+25
call draw_but_icon call draw_but_icon
or ecx,0x40000000 or ecx,0x40000000
@ -56,20 +56,20 @@ jne @f
and ecx,0xffff and ecx,0xffff
@@: @@:
mov cx,6 ; Paste mov cx,6 ; Paste
mov edx,160*65536+5 mov edx,160*65536+25
call draw_but_icon call draw_but_icon
or ecx,0x40000000 or ecx,0x40000000
inc cx inc cx
mov edx,185*65536+5 mov edx,185*65536+25
call draw_but_icon call draw_but_icon
inc cx inc cx
mov edx,210*65536+5 mov edx,210*65536+25
call draw_but_icon call draw_but_icon
inc cx inc cx
mov edx,235*65536+5 mov edx,235*65536+25
call draw_but_icon call draw_but_icon
mov ebx,ted_tim_undo mov ebx,ted_tim_undo
@ -78,7 +78,7 @@ jg @f
and ecx,0xffff and ecx,0xffff
@@: @@:
mov cx,13 mov cx,13
mov edx,345*65536+5 mov edx,345*65536+25
call draw_but_icon call draw_but_icon
or ecx,0x40000000 or ecx,0x40000000
@ -87,28 +87,28 @@ jge @f
and ecx,0xffff and ecx,0xffff
@@: @@:
inc cx inc cx
mov edx,370*65536+5 mov edx,370*65536+25
call draw_but_icon call draw_but_icon
or ecx,0x40000000 or ecx,0x40000000
inc cx inc cx
mov edx,400*65536+5 mov edx,400*65536+25
call draw_but_icon call draw_but_icon
inc cx inc cx
mov edx,425*65536+5 mov edx,425*65536+25
call draw_but_icon call draw_but_icon
mov cx,17 ;âûáîð ôàéëà ïîäñâåòêè mov cx,17 ;âûáîð ôàéëà ïîäñâåòêè
mov edx,450*65536+5 mov edx,450*65536+25
call draw_but_icon call draw_but_icon
mov cx,18 ;cp 1251 -> 866 mov cx,18 ;cp 1251 -> 866
mov edx,480*65536+5 mov edx,480*65536+25
call draw_but_icon call draw_but_icon
mov cx,19 ;cp 866 -> 1251 mov cx,19 ;cp 866 -> 1251
mov edx,505*65536+5 mov edx,505*65536+25
call draw_but_icon call draw_but_icon
popad popad
@ -138,7 +138,7 @@ proc draw_panel_find
int 0x40 int 0x40
mov eax,4 ;ðèñîâàíèå òåêñòà mov eax,4 ;ðèñîâàíèå òåêñòà
mov ebx,30*65536+5 mov ebx,30*65536+25
add ebx,ted_wnd_t add ebx,ted_wnd_t
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,0x80000000 or ecx,0x80000000

View File

@ -121,6 +121,29 @@ mov ebp,lib0
; OpenDialog initialisation ; OpenDialog initialisation
stdcall [OpenDialog_Init],OpenDialog_data 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_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
; init toolbar file ; init toolbar file
load_image_file 'te_icon.png', bmp_icon,TOOLBAR_ICONS_SIZE*2 ;㬭®¦¥­¨¥ ­  2 ¤«ï á¥àëå ª­®¯®ª load_image_file 'te_icon.png', bmp_icon,TOOLBAR_ICONS_SIZE*2 ;㬭®¦¥­¨¥ ­  2 ¤«ï á¥àëå ª­®¯®ª
mov eax,[bmp_icon] mov eax,[bmp_icon]
@ -260,15 +283,10 @@ draw_window:
inc bx inc bx
int 0x40 int 0x40
; mov eax,4
; mov ebx,185*65536+9
; mov ecx,[sc.work_text]
; or ecx,0x80000000
; mov edx,txtFile
; int 0x40
call draw_but_toolbar call draw_but_toolbar
stdcall [kmainmenu_draw], [main_menu]
stdcall [ted_draw], tedit0 stdcall [ted_draw], tedit0
mcall 12,2 mcall 12,2
@ -276,6 +294,7 @@ draw_window:
align 4 align 4
mouse: mouse:
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
stdcall [ted_mouse], tedit0 stdcall [ted_mouse], tedit0
cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
@ -283,30 +302,9 @@ mouse:
stdcall [edit_box_mouse], dword edit2 stdcall [edit_box_mouse], dword edit2
@@: @@:
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel
jne @f ;.menu_bar_1 jne .mouse_end
stdcall [tl_mouse], tree1 stdcall [tl_mouse], tree1
;----------------------------------------------- .mouse_end:
.menu_bar_1:
mov [menu_data_1.get_mouse_flag],1
; mouse event for Menu 1
stdcall [menu_bar_mouse],dword menu_data_1
cmp dword[menu_data_1.click],1
jne .mnu_1
cmp dword[menu_data_1.cursor_out],4
je button.exit
cmp dword[menu_data_1.cursor_out],3
jne @f
call ted_but_save_file
@@:
cmp dword[menu_data_1.cursor_out],2
jne @f
call ted_but_open_file
@@:
cmp dword[menu_data_1.cursor_out],1
jne @f
call ted_but_new_file
@@:
.mnu_1:
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -377,11 +375,6 @@ key:
align 4 align 4
button: button:
; cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
; jne @f ;mouse.menu_bar_1
; mov [menu_active],0
; jmp still
; @@:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨ mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,3 cmp ah,3
@ -475,7 +468,12 @@ button:
@@: @@:
cmp ah,1 cmp ah,1
jne still je .exit
cmp ah,199
je .exit
jmp still
.exit: .exit:
cmp dword[exit_code],1 cmp dword[exit_code],1
je @f je @f
@ -513,6 +511,8 @@ if lang eq ru
err_message_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0 err_message_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
err_message_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,0 err_message_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,0
err_message_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini.obj',39,0 err_message_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini.obj',39,0
err_message_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libkmenu.obj',39,0
err_message_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libkmenu.obj',39,0
else else
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db 'System error',0
@ -526,6 +526,8 @@ else
err_message_import_3 db 'Error on load import library ',39,'libimg.obj',39,0 err_message_import_3 db 'Error on load import library ',39,'libimg.obj',39,0
err_message_found_lib_4 db 'Sorry I cannot found library ',39,'libini.obj',39,0 err_message_found_lib_4 db 'Sorry I cannot found library ',39,'libini.obj',39,0
err_message_import_4 db 'Error on load import library ',39,'libini.obj',39,0 err_message_import_4 db 'Error on load import library ',39,'libini.obj',39,0
err_message_found_lib_5 db 'Sorry I cannot found library ',39,'libkmenu.obj',39,0
err_message_import_5 db 'Error on load import library ',39,'libkmenu.obj',39,0
end if end if
;library structures ;library structures
@ -540,6 +542,8 @@ l_libs_start:
err_message_found_lib_3, head_f_l, import_libimg, err_message_import_3, head_f_i err_message_found_lib_3, head_f_l, import_libimg, err_message_import_3, head_f_i
lib4 l_libs lib_name_4, sys_path, file_name, system_dir_4,\ lib4 l_libs lib_name_4, sys_path, file_name, system_dir_4,\
err_message_found_lib_4, head_f_l, import_libini, err_message_import_4, head_f_i err_message_found_lib_4, head_f_l, import_libini, err_message_import_4, head_f_i
lib5 l_libs lib_name_5, sys_path, file_name, system_dir_5,\
err_message_found_lib_5, head_f_l, import_libkmenu, err_message_import_5, head_f_i
load_lib_end: load_lib_end:
IncludeIGlobals IncludeIGlobals