From a4fbf36547db50942fa5e6ad37e2b6845fc653fd Mon Sep 17 00:00:00 2001 From: IgorA Date: Mon, 21 Mar 2016 17:29:30 +0000 Subject: [PATCH] new menu from lib, new command redo, fix panel interface git-svn-id: svn://kolibrios.org@6359 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/media/animage/trunk/animage.asm | 46 +++- programs/media/animage/trunk/design.inc | 24 +- programs/media/animage/trunk/dialog2.inc | 88 +++++- .../media/animage/trunk/events_of_buttons.inc | 36 +-- .../media/animage/trunk/events_of_mouse.inc | 14 +- .../media/animage/trunk/events_of_window.inc | 26 +- programs/media/animage/trunk/icons.inc | 35 ++- .../media/animage/trunk/icons_instruments.inc | 11 +- programs/media/animage/trunk/menu.inc | 169 ++++++++++++ .../media/animage/trunk/menu_instruments.inc | 166 ++++++------ programs/media/animage/trunk/panel_data.inc | 86 +----- programs/media/animage/trunk/panel_engen.inc | 250 ++---------------- programs/media/animage/trunk/screen.inc | 5 +- 13 files changed, 444 insertions(+), 512 deletions(-) create mode 100644 programs/media/animage/trunk/menu.inc diff --git a/programs/media/animage/trunk/animage.asm b/programs/media/animage/trunk/animage.asm index 25b0e9129c..0f578978f9 100644 --- a/programs/media/animage/trunk/animage.asm +++ b/programs/media/animage/trunk/animage.asm @@ -1,24 +1,31 @@ ;******************************************************* ;**************GRAPHICS EDITOR ANIMAGE ***************** ;******************************************************* -; version: 1.4 -; last update: 12/03/2016 -; changes: Use library 'libimg.obj' +; version: 1.5 +; last update: 21.03.2016 +; changes: Use library 'kmenu.obj' +; autors: IgorA, Veliant ;-------------------------------------------------------- -; version: 1.3 -; last update: 05/10/2010 +; version: 1.4 +; last update: 12.03.2016 +; changes: Use library 'libimg.obj' +; autors: IgorA +;-------------------------------------------------------- +; version: 1.3 +; last update: 05.10.2010 ; written by: Marat Zakiyanov aka Mario79, aka Mario ; changes: Fixed window flicker when redrawing, ; Fixed memory leak for stack ;-------------------------------------------------------- -; version: 1.2 -; last update: 30/09/2010 +; version: 1.2 +; last update: 30.09.2010 ; written by: Marat Zakiyanov aka Mario79, aka Mario ; changes: Program used function 68 instead 64 is now, ; select path with OpenDialog ;-------------------------------------------------------- -; version 1.1 year 9.12.2006 -; AUTORS: +; version: 1.1 +; last update: 09.12.2006 +; autors: ; programming by andrew_programmer ; design by golus @@ -48,16 +55,23 @@ include '../../../libio.inc' ; *** constants for interface *** ; корректировки на скин -ci_offs_skin_w equ 0 ; 5 ;корректировка на ширину рамки скина -ci_offs_skin_h equ 0 ;24 ;корректировка на высоту скина +ci_offs_skin_w equ 5 ;корректировка на ширину рамки скина +ci_offs_skin_h equ 24 ;корректировка на высоту скина ; главное окно ci_wnd_min_siz_x equ 585 ;minimum size x ci_wnd_min_siz_y equ 400 ;minimum size y +; панель инструментов +ci_panel_x_pos equ 0 ;координата x для панели +ci_panel_y_pos equ 20 ;координата y для панели +ci_panel_but_y1 equ ci_panel_y_pos +5 ;координата y для 1-го ряда кнопок +ci_panel_but_y2 equ ci_panel_y_pos+30 ;координата y для 2-го ряда кнопок +ci_palete_y_pos equ ci_panel_y_pos+51 ;координата y для палитры цветов + ; окно редактора -ci_edit_wnd_x_pos equ 5 ;координата x для окна редактора -ci_edit_wnd_y_pos equ 87 ;координата y для окна редактора +ci_edit_wnd_x_pos equ 0 ;координата x для окна редактора +ci_edit_wnd_y_pos equ 71 ;координата y для окна редактора ci_edit_wnd_border equ 3 ;рамка вокруг окна редактора ; скроллинги @@ -79,6 +93,7 @@ include 'load_from_parameters.inc' START: mcall SF_SYS_MISC,SSF_HEAP_INIT + mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors load_libraries l_libs_start,end_l_libs @@ -97,6 +112,7 @@ include 'init_data.inc' call GetMemory call cleare_work_arrea call load_icons + call init_main_menu ;load cursors mov eax,CursorsID @@ -177,6 +193,7 @@ include 'string.inc' include 'palette.inc' include 'files.inc' include 'time.inc' +include 'menu.inc' ;----------------------------------------------------------- ;------------variables and data of program------------------ ;----------------------------------------------------------- @@ -337,6 +354,9 @@ temp_dir_pach rb 4096 library_path rb 4096 cur_dir_path rb 4096 procinfo: rb 1024 +align 4 +syscolors rb 192 +syscolors_end: ;--------------------------------------------------------------------- align 4 rb 4096 diff --git a/programs/media/animage/trunk/design.inc b/programs/media/animage/trunk/design.inc index 840f0fa2d9..b8789fae76 100644 --- a/programs/media/animage/trunk/design.inc +++ b/programs/media/animage/trunk/design.inc @@ -13,10 +13,11 @@ draw_volume_rectangle: cmp esi,1 jne no_volume_light_rectangle - mov [color_rectangle],0xc7cbcf + ;mov esi,dword[syscolors+20] + mov [color_rectangle],0xc7cbcf ;esi mov [color_line1],0xaeabae mov [color_line2],0xffffff - mov [color_line3],0xc7cbcf + mov [color_line3],0xc7cbcf ;esi jmp exit_colors ;---------------------------------------------------------- no_volume_light_rectangle: @@ -33,7 +34,8 @@ no_pressed_rectangle: cmp esi,3 jne no_pressed_panel - mov [color_rectangle],0xc7cbcf + mov esi,dword[syscolors+20] + mov [color_rectangle],esi mov [color_line1],0xaeabae mov [color_line2],7000 mov [color_line3],0xffffff @@ -63,20 +65,22 @@ no_light_pressed_rectangle: cmp esi,6 jne no_work_rectangle - mov [color_rectangle],0xc7cbcf + mov esi,dword[syscolors+20] + mov [color_rectangle],esi mov [color_line1],0xaeabae - mov [color_line2],0xc7cbcf - mov [color_line3],0xc7cbcf + mov [color_line2],esi + mov [color_line3],esi jmp exit_colors ;---------------------------------------------------------- no_work_rectangle: cmp esi,7 jne no_work_rectangle_2 - mov [color_rectangle],0xc7cbcf - mov [color_line1],0xc7cbcf - mov [color_line2],0xc7cbcf - mov [color_line3],0xc7cbcf + mov esi,dword[syscolors+20] + mov [color_rectangle],esi + mov [color_line1],esi + mov [color_line2],esi + mov [color_line3],esi jmp exit_colors ;---------------------------------------------------------- no_work_rectangle_2: diff --git a/programs/media/animage/trunk/dialog2.inc b/programs/media/animage/trunk/dialog2.inc index 38e4d94df2..944f1fbc87 100644 --- a/programs/media/animage/trunk/dialog2.inc +++ b/programs/media/animage/trunk/dialog2.inc @@ -14,16 +14,27 @@ dialog_line: call print_line call print_cursor - opros: - mcall SF_WAIT_EVENT +opros: + mcall SF_SLEEP, 5 ;fix cpu use 100% + mcall SF_WAIT_EVENT - cmp eax,1 ;redraw window - je exit_cycle - cmp eax,3 ;press button - je exit_cycle + cmp eax,1 ;redraw window + jne @f + call dialog2_draw - cmp eax,2 ;press key - jne opros + mov ebx,[string_x] + shl ebx,16 + add ebx,[string_y] + mov edx,string_ + mov esi,[MaxSizeString] + mcall SF_DRAW_TEXT,,0 + jmp opros + @@: + cmp eax,3 ;press button + je exit_cycle + + cmp eax,2 ;press key + jne opros mcall SF_GET_KEY shr eax,8 @@ -152,9 +163,13 @@ position dd 0 MaxSizeString dd 0 string_x dd 0 string_y dd 0 -;********************************************************** + ;---------------------------------------------------------- - value: +;input: +; eax - pointer to string +;output: +; eax - value +str_to_int: xor edx,edx cycle_value_: xor ebx,ebx @@ -232,5 +247,58 @@ string_y dd 0 error: mov eax,edx ret + ;---------------------------------------------------------- +align 4 +dialog2_draw: + mov eax,80 + mov ebx,100 + mov ecx,150 + mov edx,90 + mov esi,1 + call draw_volume_rectangle ; dialog 'file new' + + mov eax,177 + mov ebx,115 + mov ecx,40 + mov edx,14 + mov esi,4 + call draw_volume_rectangle + + mov eax,177 + mov ebx,115+24 + mov ecx,40 + mov edx,14 + mov esi,4 + call draw_volume_rectangle + + mov eax,177 + mov ebx,170 + mov ecx,40 + mov edx,15 + mov esi,1 + call draw_volume_rectangle ; button [Ok] + + mov eax,90 + mov ebx,118 + mov ecx,0xffffff + mov edx,new_text1 + mov esi,14 + call print_text + + mov eax,90 + mov ebx,118+24 + mov ecx,0xffffff + mov edx,new_text2 + mov esi,14 + call print_text + + mov eax,185 + mov ebx,175 + mov ecx,0xffffff + mov edx,ok_text + mov esi,2 + call print_text + ret + length_number dd 0 \ No newline at end of file diff --git a/programs/media/animage/trunk/events_of_buttons.inc b/programs/media/animage/trunk/events_of_buttons.inc index 226f460e00..2e1e900ab2 100644 --- a/programs/media/animage/trunk/events_of_buttons.inc +++ b/programs/media/animage/trunk/events_of_buttons.inc @@ -4,40 +4,30 @@ buttons: cmp [Current_instrument],21 - jne no_finish_instrument_button - + jne @f cmp [instrument_used],1 - jne no_finish_instrument_button - + jne @f cmp [Activate_instrument],0 - jne no_finish_instrument_button - + jne @f cmp [crossing],1 - jne no_finish_instrument_button + jne @f + mov [finishing_crossing],1 + call TakeButtonInstruments + @@: - mov [finishing_crossing],1 - call TakeButtonInstruments - - no_finish_instrument_button: - - mov eax,17 - mcall + mcall SF_GET_BUTTON shr eax,8 cmp eax,1 jne no_exit - - mov eax,CursorsID - call delete_cursors - - or eax,-1 - mcall - + mov eax,CursorsID + call delete_cursors + mcall SF_TERMINATE_PROCESS no_exit: - mov [Current_instrument],eax + call button_handler_main_menu ; set cursor for current instrument pushad @@ -48,8 +38,6 @@ buttons: call set_cursor popad - - cmp eax,10 jl still diff --git a/programs/media/animage/trunk/events_of_mouse.inc b/programs/media/animage/trunk/events_of_mouse.inc index 6ee4e214e4..9b688549a6 100644 --- a/programs/media/animage/trunk/events_of_mouse.inc +++ b/programs/media/animage/trunk/events_of_mouse.inc @@ -2,6 +2,8 @@ ;-------------interraction MOUSE-------------- ;--------------------------------------------- mouse: + stdcall [kmainmenu_dispatch_cursorevent], [main_menu] + or ecx,-1 mcall SF_THREAD_INFO,procinfo @@ -14,11 +16,11 @@ mouse: mov edx,[Window_SizeX] sub edx,5 - cmp ebx,20 - jle no_panel + ;cmp ebx,0 + ;jle no_panel - cmp ebx,20+15 - jae no_panel + cmp ebx,ci_panel_y_pos + jae no_panel cmp eax,5 jle no_panel @@ -27,16 +29,12 @@ mouse: jae no_panel call GetMouseCoordinats - mov [counter],7 - mov edi,panel_text jmp panel_interraction no_panel: cmp [Panel_flag],0 jz no_redraw_panel - mov [counter],7 - mov edi,panel_text jmp panel_interraction no_redraw_panel: diff --git a/programs/media/animage/trunk/events_of_window.inc b/programs/media/animage/trunk/events_of_window.inc index 4b987b7e76..9a6c5d70eb 100644 --- a/programs/media/animage/trunk/events_of_window.inc +++ b/programs/media/animage/trunk/events_of_window.inc @@ -51,31 +51,25 @@ no_znak2: shl ecx,16 add ebx, [Window_SizeX] add ecx, [Window_SizeY] - mcall SF_CREATE_WINDOW,,,0x53aabbcc,,name_of_program + mcall SF_CREATE_WINDOW,,,0x73aabbcc,,name_of_program mov eax,[procinfo+70] ;staus of window test eax,100b jne .end ;------------------------------------------------ - mov eax,5 - mov ebx,20 - mov ecx,[Window_SizeX] - mov edx,15 - mov esi,6 - sub ecx,10 - call draw_volume_rectangle ; top menu - file and etc. + mov ebx,[Window_SizeX] + sub ebx,5+ci_panel_x_pos+ci_offs_skin_w-1 + mcall SF_DRAW_RECT,,ci_panel_y_pos,dword[syscolors+20] ; чистка полосы для меню - mov [counter],7 - mov edi,panel_text - call print_panel_text + call put_main_menu ;------------------------------------------------ - mov eax,5 - mov ebx,20+15+1 + mov eax,ci_panel_x_pos + mov ebx,ci_panel_y_pos mov ecx,[Window_SizeX] mov edx,50 mov esi,1 - sub ecx,10 + sub ecx,5+ci_panel_x_pos+ci_offs_skin_w call draw_volume_rectangle ; tools panel call draw_icons call PrintMousePos @@ -97,7 +91,7 @@ no_znak2: shl ecx,16 mov cx,dx ;высота бордюра - mcall SF_DRAW_RECT,,,0xc7cbcf ;бордюр справа от окна перед скроллингом + mcall SF_DRAW_RECT,,,dword[syscolors+20] ;бордюр справа от окна перед скроллингом ;------------------------------------------------ mcall , ;бордюр слева от окна ;------------------------------------------------ @@ -115,7 +109,7 @@ no_znak2: shl ecx,16 mov cx,dx ;высота бордюра - mcall SF_DRAW_RECT,,,0xc7cbcf ;бордюр под окном и над скроллингом + mcall SF_DRAW_RECT,,,dword[syscolors+20] ;бордюр под окном и над скроллингом ;------------------------------------------------ mcall ,, ;бордюр под панелью и над окном ;------------------------------------------------ diff --git a/programs/media/animage/trunk/icons.inc b/programs/media/animage/trunk/icons.inc index bdceea6bd7..11f7e0ddc2 100644 --- a/programs/media/animage/trunk/icons.inc +++ b/programs/media/animage/trunk/icons.inc @@ -11,9 +11,8 @@ load_icons: ret draw_icons: - - mov [Icon_X],7 - mov [Icon_Y],20+15+4 + mov [Icon_X],ci_panel_x_pos+2 + mov [Icon_Y],ci_panel_y_pos+3 ;draw panel picture mov edx,[Icon_X] @@ -28,13 +27,12 @@ draw_icons: ;main buttons of instrumnts and [counter],0 - mov [Icon_X],9 - mov [Icon_Y],21+15+4+1 + mov [Icon_X],ci_panel_x_pos+4 main_buttons: mov ebx,[Icon_X] - mov ecx,[Icon_Y] + mov ecx,ci_panel_but_y1 dec ebx dec ecx shl ebx,16 @@ -57,13 +55,12 @@ draw_icons: ;buttons of brushes(and lines width) and [counter],0 - mov [Icon_X],8+1 - mov [Icon_Y],20+15+4+25+1 + mov [Icon_X],ci_panel_x_pos+4 next_button_brush: mov ebx,[Icon_X] - mov ecx,[Icon_Y] + mov ecx,ci_panel_but_y2 dec ebx dec ecx shl ebx,16 @@ -85,13 +82,12 @@ draw_icons: ;buttons of zoom and [counter],0 - mov [Icon_X],8+155+1 - mov [Icon_Y],20+15+4+25+1 + mov [Icon_X],ci_panel_x_pos+159 next_button_zoom: mov ebx,[Icon_X] - mov ecx,[Icon_Y] + mov ecx,ci_panel_but_y2 dec ebx dec ecx shl ebx,16 @@ -111,11 +107,10 @@ draw_icons: ; button of palette - mov [Icon_X],7+105+1 - mov [Icon_Y],19+15+4+25+1 + mov [Icon_X],ci_panel_x_pos+108 mov ebx,[Icon_X] - mov ecx,[Icon_Y] + mov ecx,ci_panel_but_y2-1 dec ebx dec ecx shl ebx,16 @@ -127,11 +122,10 @@ draw_icons: mcall SF_DEFINE_BUTTON ; button of color - mov [Icon_X],7+128+1 - mov [Icon_Y],19+15+4+25+1 + mov [Icon_X],ci_panel_x_pos+131 mov ebx,[Icon_X] - mov ecx,[Icon_Y] + mov ecx,ci_panel_but_y1-1 dec ebx dec ecx shl ebx,16 @@ -142,6 +136,7 @@ draw_icons: add edx,1000000000000000000000000000000b mcall SF_DEFINE_BUTTON - mcall SF_DRAW_RECT, 136*65536+19,64*65536+19,[Color] + mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\ + ((ci_panel_y_pos+28) shl 16)+21, [Color] - ret + ret diff --git a/programs/media/animage/trunk/icons_instruments.inc b/programs/media/animage/trunk/icons_instruments.inc index 806ba53407..f1d209f52b 100644 --- a/programs/media/animage/trunk/icons_instruments.inc +++ b/programs/media/animage/trunk/icons_instruments.inc @@ -321,7 +321,8 @@ TakeButtonInstruments: and ebx,0xffffff mov [Color],ebx - mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color] + mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\ + ((ci_panel_y_pos+28) shl 16)+21, [Color] jmp still no_pipetka: @@ -618,13 +619,13 @@ TakeButtonInstruments: jne no_palette mov eax,20 - mov ebx,100 + mov ebx,ci_palete_y_pos mov ecx,32*10+32*5+7 - mov edx,8*10+7*10 + mov edx,140 mov esi,1 call draw_volume_rectangle mov [x],20+5 - mov [y],100+10 + mov [y],ci_palete_y_pos+10 mov edi,256 xor esi,esi next_rectangle: @@ -675,7 +676,7 @@ TakeButtonInstruments: jz wait_events call GetMouseCoordinats mov [x],20+5 - mov [y],100+10 + mov [y],ci_palete_y_pos+10 mov [counter],0 next_rectangle_column: mov eax,[x] diff --git a/programs/media/animage/trunk/menu.inc b/programs/media/animage/trunk/menu.inc new file mode 100644 index 0000000000..98573a76af --- /dev/null +++ b/programs/media/animage/trunk/menu.inc @@ -0,0 +1,169 @@ +KMENUITEM_NORMAL equ 0 +KMENUITEM_SUBMENU equ 1 +KMENUITEM_SEPARATOR equ 2 + +init_main_menu: + stdcall [kmenu_init], syscolors + + stdcall [ksubmenu_new] + mov [main_menu], eax + + stdcall [ksubmenu_new] + mov [main_menu_file], eax + stdcall [ksubmenu_new] + mov [main_menu_edit], eax + stdcall [ksubmenu_new] + mov [main_menu_instr], eax + + ; init 'File' menu + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_New, 0x71 + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Open, 0x72 + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_Save, 0x73 + stdcall [ksubmenu_add], [main_menu_file], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_File_SaveAs, 0x74 + 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, 0x75 + stdcall [ksubmenu_add], [main_menu_file], eax + + ; add 'File' menu to main + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_File, [main_menu_file] + stdcall [ksubmenu_add], [main_menu], eax + + ; init 'Edit' menu + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_Undo, 0x61 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_Redo, 0x62 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_Copy, 0x63 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_Paste, 0x64 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_Cut, 0x65 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_edit], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_ClS, 0x66 + stdcall [ksubmenu_add], [main_menu_edit], eax + + ; add 'Edit' menu to main + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Edit, [main_menu_edit] + stdcall [ksubmenu_add], [main_menu], eax + + ; init 'Edit' menu + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Instr_Pencil, 0x51 + stdcall [ksubmenu_add], [main_menu_instr], eax + + ; add 'Instruments' menu to main + stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Instr, [main_menu_instr] + stdcall [ksubmenu_add], [main_menu], eax + + ret + +put_main_menu: + stdcall [kmainmenu_draw], [main_menu] +ret + +button_handler_main_menu: + cmp eax, 0x71 + jne @f + mov [number_panel], 7 + mov [number_menu], 1 + jmp TakeInstruments +@@: + cmp eax, 0x72 + jne @f + mov [number_panel], 7 + mov [number_menu], 2 + jmp TakeInstruments +@@: + cmp eax, 0x73 + jne @f + mov [number_panel], 7 + mov [number_menu], 3 + jmp TakeInstruments +@@: + cmp eax, 0x74 + jne @f + mov [number_panel], 7 + mov [number_menu], 4 + jmp TakeInstruments +@@: + cmp eax, 0x75 + jne @f + mov [number_panel], 7 + mov [number_menu], 5 + jmp TakeInstruments +@@: + cmp eax, 0x61 + jne @f + mov [number_panel], 6 + mov [number_menu], 1 + jmp TakeInstruments +@@: + cmp eax, 0x62 + jne @f + mov [number_panel], 6 + mov [number_menu], 2 + jmp TakeInstruments +@@: + cmp eax, 0x63 + jne @f + mov [number_panel], 6 + mov [number_menu], 3 + jmp TakeInstruments +@@: + cmp eax, 0x64 + jne @f + mov [number_panel], 6 + mov [number_menu], 4 + jmp TakeInstruments +@@: + cmp eax, 0x65 + jne @f + mov [number_panel], 6 + mov [number_menu], 5 + jmp TakeInstruments +@@: + cmp eax, 0x66 + jne @f + mov [number_panel], 6 + mov [number_menu], 6 + jmp TakeInstruments +@@: + cmp eax, 0x51 + jne @f + mov [number_panel], 5 + mov [number_menu], 1 + jmp TakeInstruments +@@: +.end_handler: +ret + +main_menu dd 0 +main_menu_file dd 0 +main_menu_edit dd 0 +main_menu_instr dd 0 + +sz_main_menu_File db 'File', 0 +sz_main_menu_File_New db 'New', 0 +sz_main_menu_File_Open db 'Open', 0 +sz_main_menu_File_Save db 'Save', 0 +sz_main_menu_File_SaveAs db 'Save as', 0 +sz_main_menu_File_Exit db 'Exit', 0 + +sz_main_menu_Edit db 'Edit', 0 +sz_main_menu_Edit_Undo db 'Undo', 0 +sz_main_menu_Edit_Redo db 'Redo', 0 +sz_main_menu_Edit_Copy db 'Copy', 0 +sz_main_menu_Edit_Paste db 'Paste', 0 +sz_main_menu_Edit_Cut db 'Cut', 0 +sz_main_menu_Edit_ClS db 'Clear screen', 0 + +sz_main_menu_Instr db 'Instruments', 0 +sz_main_menu_Instr_Pencil db 'Pencil', 0 \ No newline at end of file diff --git a/programs/media/animage/trunk/menu_instruments.inc b/programs/media/animage/trunk/menu_instruments.inc index bcb81d5f9f..1d1502d9bc 100644 --- a/programs/media/animage/trunk/menu_instruments.inc +++ b/programs/media/animage/trunk/menu_instruments.inc @@ -6,76 +6,33 @@ TakeInstruments: cmp [number_panel],7 jne no_file -;<<<<>>>>>> +; <<< New >>> cmp [number_menu],1 jne no_new - mov eax,80 - mov ebx,100 - mov ecx,150 - mov edx,90 - mov esi,1 - call draw_volume_rectangle - - mov eax,177 - mov ebx,115 - mov ecx,40 - mov edx,14 - mov esi,4 - call draw_volume_rectangle - - mov eax,177 - mov ebx,115+24 - mov ecx,40 - mov edx,14 - mov esi,4 - call draw_volume_rectangle - - mov eax,175 - mov ebx,170 - mov ecx,40 - mov edx,15 - mov esi,1 - call draw_volume_rectangle - - mov eax,90 - mov ebx,118 - mov ecx,0xffffff - mov edx,new_text1 - mov esi,14 - call print_text - - mov eax,90 - mov ebx,118+24 - mov ecx,0xffffff - mov edx,new_text2 - mov esi,14 - call print_text - - mov eax,185 - mov ebx,175 - mov ecx,0xffffff - mov edx,ok_text - mov esi,2 - call print_text + call dialog2_draw mov edx,1000000000000000000000000000000b+1000 mcall SF_DEFINE_BUTTON,<177,40>,<115,14>, mov edx,1000000000000000000000000000000b+1001 - mcall ,,<139,14>, + mcall ,,<139,14>, mov edx,1000000000000000000000000000000b+1002 - mcall ,<175,40>,<170,15> + mcall ,,<170,15> no_activate_space: + mcall SF_SLEEP, 5 ;fix cpu use 100% mcall SF_WAIT_EVENT - cmp eax,1 - je exit_new + cmp eax,1 ;redraw window + jne @f + call dialog2_draw + jmp no_activate_space + @@: - cmp eax,3 - jne no_activate_space + cmp eax,3 ;press button + jne no_activate_space mcall SF_GET_BUTTON shr eax,8 @@ -98,7 +55,7 @@ no_activate_space: dec eax mov [length_number],eax mov eax,string_ - call value + call str_to_int mov [Picture_SizeX],eax jmp no_activate_space @@ -119,7 +76,7 @@ no_picture_size_x: dec eax mov [length_number],eax mov eax,string_ - call value + call str_to_int mov [Picture_SizeY],eax jmp no_activate_space @@ -130,27 +87,27 @@ no_picture_size_y: exit_new: mov edx,11100000000000000000000000000000b+1002 - mcall SF_DEFINE_BUTTON,<175,40>,<170,15> + mcall SF_DEFINE_BUTTON,<177,40>,<170,15> mov edx,11100000000000000000000000000000b+1001 - mcall ,<177,40>,<139,14> + mcall ,,<139,14> mov edx,11100000000000000000000000000000b+1000 mcall ,,<115,14> ;get memory for new picture - call GetMemory + call GetMemory and [save_flag],0 and [number_panel],0 and [number_menu],0 - call cleare_work_arrea - call drawwin + call cleare_work_arrea + call drawwin jmp still ;--------------------------------------------------------------------- no_new: -;<<<<>>>>>> +; <<< Open >>> cmp [number_menu],2 jne no_open @@ -173,7 +130,7 @@ no_new: jmp still ;--------------------------------------------------------------------- no_open: - ;<<<<<<<<<<>>>>>>>>>>> +; <<< Save >>> cmp [number_menu],3 jne no_save_ @@ -188,7 +145,7 @@ no_save_file: jmp still ;--------------------------------------------------------------------- no_save_: - ;<<<<<<<<>>>>>>>>>> +; <<< Save as >>> cmp [number_menu],4 jne no_save @@ -211,9 +168,7 @@ no_save_: pop esi eax ;--------------------------------------------------------------------- mov [OpenDialog_data.type],1 ; save - - push dword OpenDialog_data - call [OpenDialog_Start] + stdcall [OpenDialog_Start],OpenDialog_data cmp [OpenDialog_data.status],1 jne still @@ -222,7 +177,7 @@ save1: save_enter: mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b - call analizing_picture_to_palette + call analizing_picture_to_palette ;eax => number of colors in picture mov ebx,[PointerToPicture] @@ -251,7 +206,7 @@ save_enter: ; jmp still ;--------------------------------------------------------------------- no_save: - ;<<<<<>>>>>> +; <<< Exit >>> cmp [number_menu],5 jne no_exit_program @@ -260,10 +215,10 @@ no_save: no_exit_program: no_file: ;|||||||||||||||||||||||||||||EDIT||||||||||||||||||||||||| -;<<<<<<<<<>>>>>>>>> cmp [number_panel],6 - jne still ;no_edit + jne no_edit +; <<< Undo >>> cmp [number_menu],1 jne no_undo @@ -280,13 +235,35 @@ no_file: mov [PointerToCopyPicture2],eax call MovePictureToWorkScreen - and [number_panel],0 - and [number_menu],0 - jmp still + and [number_panel],0 + and [number_menu],0 + jmp still ;--------------------------------------------------------------------- no_undo: -;<<<<<<<<<>>>>>>>>> - cmp [number_menu],2 +; <<< Redo >>> + cmp [number_menu],2 + jne no_redo + + cmp [number_undo],0 + je no_redo + +;rotate bufers +1 + dec [number_undo] + mov eax,[PointerToPicture] + mov ebx,[PointerToCopyPicture] + mov ecx,[PointerToCopyPicture2] + mov [PointerToPicture],ecx + mov [PointerToCopyPicture],eax + mov [PointerToCopyPicture2],ebx + + call MovePictureToWorkScreen + and [number_panel],0 + and [number_menu],0 + jmp still +;--------------------------------------------------------------------- +no_redo: +; <<< Copy >>> + cmp [number_menu],3 jne no_copy cmp [instrument_used],1 @@ -385,8 +362,8 @@ loop_fill_rectangle_x_copy: jmp still ;--------------------------------------------------------------------- no_copy: -;<<<<<<<<<>>>>>>> - cmp [number_menu],3 +; <<< Paste >>> + cmp [number_menu],4 jne no_paste cmp [instrument_used],1 @@ -480,8 +457,8 @@ loop_fill_rectangle_x_paste: jmp still ;--------------------------------------------------------------------- no_paste: -;<<<<<<<<<>>>>>>>>> - cmp [number_menu],4 +; <<< Cut >>> + cmp [number_menu],5 jne no_cut cmp [instrument_used],1 @@ -573,8 +550,8 @@ loop_fill_rectangle_x: jmp still ;--------------------------------------------------------------------- no_cut: -;<<<<<>>>>> - cmp [number_menu],5 +; <<< Cleare all >>> + cmp [number_menu],6 jne no_cleare_all call cleare_work_arrea @@ -585,9 +562,9 @@ no_cut: jmp still ;--------------------------------------------------------------------- no_cleare_all: -;<<<<<>>>>> - cmp [number_menu],6 - jne still ;no_to_allocate_all +; <<< To allocate all >>> + cmp [number_menu],7 + jne still ;no_to_allocate_all mov [OldX],1 mov [OldY],1 @@ -608,6 +585,19 @@ no_cleare_all: jmp still ;--------------------------------------------------------------------- ;no_to_allocate_all: -;no_edit: -; jmp still +no_edit: +;|||||||||||||||||||||||||INSTRUMENTS|||||||||||||||||||||| + cmp [number_panel],5 + jne no_instruments +; <<< Pencil >>> + cmp [number_menu],1 + jne no_pencil + + ; ... todo ... + + and [number_panel],0 + and [number_menu],0 +no_pencil: +no_instruments: + jmp still ;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/media/animage/trunk/panel_data.inc b/programs/media/animage/trunk/panel_data.inc index 0de1c6a255..7de0ee6591 100644 --- a/programs/media/animage/trunk/panel_data.inc +++ b/programs/media/animage/trunk/panel_data.inc @@ -1,93 +1,9 @@ ;********************************************************** ;------------------TEXT DATA------------------------------- ;********************************************************** -name_of_program db 'ANIMAGE graphics editor v1.4',0 +name_of_program db 'ANIMAGE graphics editor v1.5',0 mouse_pos_x db 'X=' mouse_pos_y db 'Y=' new_text1 db 'PICTURE SIZE X' new_text2 db 'PICTURE SIZE Y' ok_text db 'OK' - -panel_text: dd 15,24,4 - db 'File' - dd 65,24,4 - db 'Edit' - dd 115,24,11 - db 'Instruments' - dd 235,24,7 - db 'Palette' - dd 315,24,7 - db 'Filters' - dd 395,24,9 - db 'Animation' - dd 495,24,5 - db 'Help ' -menu_text_en: - dd menu_text7 - dd menu_text6 - dd menu_text5 - dd menu_text4 - dd menu_text3 - dd menu_text2 - dd menu_text1 - dd 0,0,0 - -menu_rectangles: dd 485,36,120,100 - dd 385,36,120,100 - dd 295,36,120,100 - dd 225,36,120,100 - dd 105,36,120,100 - dd 55,36,120,100;20 - dd 5,36,120,100 - - -menu_text1: - dd 15,43,3 - db 'New' - dd 15,63,4 - db 'Open' - dd 15,83,4 - db 'Save' - dd 15,103,7 - db 'Save as' - dd 15,123,4 - db 'Exit' - -menu_text2: - dd 65,43,4 - db 'Undo' - dd 65,63,4 - db 'Copy' - dd 65,83,5 - db 'Paste' - dd 65,103,3 - db 'Cut' - dd 65,123,13 - db 'Clear screen' - ;dd 95,143,12 - ;db 'Allocate all' -menu_text3: - dd 115,43,3 - db 0,0,0;'Pencil' - dd 115,63,3 - db 0,0,0;'Brushes' - dd 115,83,3 - db 0,0,0;'Colors' - dd 115,103,3 - db 0,0,0;'Pipetka' -menu_text4: - dd 235,43,1 - db 0,0,0 -menu_text5: - dd 315,43,1 - db 0,0,0 -menu_text6: - dd 395,43,1 - db 0,0,0 -menu_text7: - dd 495,43,1 - db 0,0,0,0 - - -menu_counters: - dd 1,1,1,1,1,5,5 diff --git a/programs/media/animage/trunk/panel_engen.inc b/programs/media/animage/trunk/panel_engen.inc index 251a9d5939..f571f54e29 100644 --- a/programs/media/animage/trunk/panel_engen.inc +++ b/programs/media/animage/trunk/panel_engen.inc @@ -2,76 +2,12 @@ ;-----interraction panel with user---------------- ;------------------------------------------------- panel_interraction: -;>>>>>>>>>>>>>>>>>>>>>>>>>> -; mcall 18,14 - and [Panel_flag],0 -;collision with text on panel -next_columnus_text: - mov eax,[edi] - mov ebx,[edi+4] - sub eax,10 - sub ebx,3 - mov [Icon_text_x],eax - mov [Icon_text_y],ebx - - mov esi,[edi+8] - imul esi,10 - mov [button_menu_size_x],esi - mov [button_menu_size_y],dword 13 - - mov esi,[edi+8] - add edi,4*3 - add edi,esi - - mov ecx,[MouseX] - mov edx,[MouseY] - - push edi - mov edi,[button_menu_size_y] - mov esi,[button_menu_size_x] - call columnus - pop edi - - mov esi,7 - test eax,eax - jz no_columnus_text - - mov esi,1 - mov [Panel_flag],1 - call GetMouseClick - test eax,eax - jz no_mouse_pressed - -; mcall 18,14 - - jmp print_panel_menu - -no_mouse_pressed: -no_columnus_text: - mov eax,[Icon_text_x] - mov ebx,[Icon_text_y] - mov ecx,[button_menu_size_x] - mov edx,[button_menu_size_y] - call draw_volume_rectangle - - push [counter] - push edi - mov [counter],7 - mov edi,panel_text - call print_panel_text - pop edi - pop [counter] - - dec [counter] - jnz next_columnus_text - jmp still ;--------------------------------------------------------- ;-----draw panel menu(main engin of panel)---------------- ;--------------------------------------------------------- print_panel_menu: - push [counter] ;delit main buttons(some time) mov [counter],10 @@ -83,7 +19,7 @@ next_icon_delit1: cmp [counter],30 jl next_icon_delit1 - ;delit buttons of brushes + ;delit buttons of brushes mov [counter],40 next_icon_delit2: @@ -94,7 +30,7 @@ next_icon_delit2: cmp [counter],45 jl next_icon_delit2 - ;delit buttons of zoom + ;delit buttons of zoom mov [counter],45 next_icon_delit3: @@ -115,144 +51,18 @@ next_icon_delit3: add edx,11100000000000000000000000000000b mcall SF_DEFINE_BUTTON - pop [counter] - - push esi - mov esi,[counter] - dec esi - shl esi,4 - - mov eax,[menu_rectangles+esi] - mov ebx,[menu_rectangles+esi+4] - mov ecx,[menu_rectangles+esi+8] - mov edx,[menu_rectangles+esi+12] - mov esi,1 - mov [menu_coordinat_x],eax - mov [menu_size_x],ecx - call draw_volume_rectangle - pop esi - -calculate_counter_menu: -;calculate menu counter - mov eax,[counter] - dec eax - shl eax,2 - mov ebx,[menu_counters+eax] - mov [counter_menu],ebx - - call GetMouseCoordinats - - and [menu_counter],0 - - push esi edi -;сглаживание анимации >>>>>>>>>>>>>>>>>> -; mcall 18,4 - -menu_loop: - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[menu_size_x] - mov edi,18 - add ebx,[menu_counter] - add eax,2 - sub esi,3 - inc ebx - call columnus - mov esi,7 - - test eax,eax - jz no_columnus_menu_text - - mov esi,1 - -no_columnus_menu_text: - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[menu_size_x] - mov edx,18 - add ebx,[menu_counter] - add eax,2 - sub ecx,3 - inc ebx - call draw_volume_rectangle - add [menu_counter],20 - - dec [counter_menu] - jnz menu_loop - -;print menu text - push [counter] - mov esi,[counter] - dec esi - shl esi,2 - mov edi,[menu_text_en+esi] - mov eax,[menu_counters+esi] - mov [counter],eax - call print_panel_text - pop [counter] - pop edi esi - - -menu_still: - mcall SF_WAIT_EVENT - mcall SF_GET_KEY - mcall SF_GET_BUTTON - call GetMouseClick - test eax,eax - jz calculate_counter_menu - call GetMouseCoordinats -;calculate menu counter - mov eax,[counter] - dec eax - shl eax,2 - mov ebx,[menu_counters+eax] - mov [counter_menu],ebx and [menu_counter],0 and [counter_11],0 - push esi edi - -menu_loop2: - mov eax,[menu_coordinat_x] - mov ebx,36 - mov ecx,[MouseX] - mov edx,[MouseY] - mov esi,[menu_size_x] - mov edi,18 - add ebx,[menu_counter] - add eax,2 - sub esi,3 - inc ebx - call columnus - - inc [counter_11] - test eax,eax - jz no_columnus_menu_text2 - - mov esi,[counter_11] - mov [number_menu],esi - -no_columnus_menu_text2: - add [menu_counter],20 - dec [counter_menu] - jnz menu_loop2 - - pop edi esi - mcall SF_SLEEP,15 - push [counter] pusha call drawwin popa - pop [counter] - mov eax,[counter] - mov [number_panel],eax + mov [number_panel],0 jmp TakeInstruments @@ -262,80 +72,58 @@ no_columnus_menu_text2: PrintMousePos: pushad mov eax,[Window_SizeX] - sub eax,75 - mov ebx,20+15+6 + sub eax,75+ci_offs_skin_w + mov ebx,ci_panel_y_pos+6 mov ecx,52 mov edx,18 mov esi,4 - call draw_volume_rectangle ; border for mouse x pos + call draw_volume_rectangle ; border for mouse x pos mov eax,[Window_SizeX] - sub eax,75 - mov ebx,20+15+6+18+2 + sub eax,75+ci_offs_skin_w + mov ebx,ci_panel_y_pos+6+18+4 mov ecx,52 mov edx,18 mov esi,4 - call draw_volume_rectangle ; border for mouse y pos + call draw_volume_rectangle ; border for mouse y pos mov eax,[Window_SizeX] - sub eax,70 - mov ebx,20+15+6+6 + sub eax,70+ci_offs_skin_w + mov ebx,ci_panel_y_pos+6+6 and ecx,0 mov edx,mouse_pos_x mov esi,2 - call print_text + call print_text mov eax,[Window_SizeX] - sub eax,70 - mov ebx,20+15+6+6+18+1 + sub eax,70+ci_offs_skin_w + mov ebx,ci_panel_y_pos+6+6+18+4 and ecx,0 mov edx,mouse_pos_y mov esi,2 - call print_text + call print_text mov ecx,[ScreenX] add ecx,[PosX] mov edx,[Window_SizeX] - sub edx,55 + sub edx,55+ci_offs_skin_w shl edx,16 - add edx,20+15+6+6 + add edx,ci_panel_y_pos+6+6 and esi,0 mcall SF_DRAW_NUMBER,<4,0> mov ecx,[ScreenY] add ecx,[PosY] mov edx,[Window_SizeX] - sub edx,55 + sub edx,55+ci_offs_skin_w shl edx,16 - add edx,20+15+6+18+1+6 + add edx,ci_panel_y_pos+6+18+4+6 mcall popad ret ;---------------------------------------------------------- -;----------print text on the panel and menu---------------- -;---------------------------------------------------------- -print_panel_text: -next_panel_text: - mov eax,[edi] - mov ebx,[edi+4] -; xor ecx,ecx - mov ecx,0x10000000 - mov edx,edi - add edx,12 - mov esi,[edi+8] - add edi,esi - add edi,3*4 - - push edi - call print_text - pop edi - - dec [counter] - jnz next_panel_text - ret -;---------------------------------------------------------- ;------------draw lines of scoll--------------------------- ;---------------------------------------------------------- draw_scrollers: diff --git a/programs/media/animage/trunk/screen.inc b/programs/media/animage/trunk/screen.inc index 1873570b13..ab3ab654c4 100644 --- a/programs/media/animage/trunk/screen.inc +++ b/programs/media/animage/trunk/screen.inc @@ -245,9 +245,8 @@ big_pixel_x: fps: mov ebx,[ScreenPointer] mov ecx,[WorkScreen_SizeX] - mov edx,[WorkScreen_SizeY] shl ecx,16 - add ecx,edx + add ecx,[WorkScreen_SizeY] mov edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\ + (ci_edit_wnd_y_pos+ci_edit_wnd_border) mcall SF_PUT_IMAGE @@ -263,6 +262,7 @@ cleare_screen: mov eax,0xffffffff mov ecx,ebx shr ecx,2 + cld rep stosd mov ecx,ebx and ecx,3 @@ -279,6 +279,7 @@ cleare_work_arrea: mov eax,0xffffffff mov ecx,ebx shr ecx,2 + cld rep stosd mov ecx,ebx and ecx,3