From ccef80df60ab20b884377ad49f79c9703ee00685 Mon Sep 17 00:00:00 2001 From: IgorA Date: Wed, 23 Mar 2016 10:15:41 +0000 Subject: [PATCH] make pencil startup instrument, change cursors on work area git-svn-id: svn://kolibrios.org@6364 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/media/animage/trunk/animage.asm | 45 +++++++------- programs/media/animage/trunk/cursors.inc | 58 ++++--------------- programs/media/animage/trunk/events.inc | 8 --- .../media/animage/trunk/events_of_buttons.inc | 9 --- .../media/animage/trunk/events_of_mouse.inc | 47 ++++----------- .../media/animage/trunk/menu_instruments.inc | 8 +-- programs/media/animage/trunk/panel_engen.inc | 6 -- 7 files changed, 52 insertions(+), 129 deletions(-) diff --git a/programs/media/animage/trunk/animage.asm b/programs/media/animage/trunk/animage.asm index 7116b2e779..d33dc6f11c 100644 --- a/programs/media/animage/trunk/animage.asm +++ b/programs/media/animage/trunk/animage.asm @@ -116,7 +116,7 @@ include 'init_data.inc' call drawwin ;--------------------------------------------------------- -;---------Check loading of file from parameters----------- +;---------check loading of file from parameters----------- ;--------------------------------------------------------- mov eax,file_path cmp [eax],byte 0 @@ -139,14 +139,18 @@ include 'init_data.inc' ;OpenDialog initialisation stdcall [OpenDialog_Init], OpenDialog_data ;--------------------------------------------------------------------- + mov [Current_instrument],10 ;pencil + call TakeButtonInstruments ;set startup instrument + +align 4 red: - call drawwin + call drawwin ;---------------------------------------------------------- -;---------------------MAIN LOOP---------------------------- +;---------------------main loop---------------------------- ;---------------------------------------------------------- align 4 still: - call event + mcall SF_WAIT_EVENT cmp eax,1 je red @@ -201,7 +205,7 @@ include 'brushes.inc' include 'spray.inc' include 'width_lines.inc' ;---------------------------------------------------------- -;-------------------ICON"S picture------------------------- +;-------------------icon's picture------------------------- ;---------------------------------------------------------- align 4 panel_picture: @@ -225,6 +229,7 @@ file 'spray.cur' zoom_cursor: file 'zoom.cur' ;---------------------------------------------------------- +align 4 IM_END: ;----------------------------------------------------------- ;------------variables and data of program------------------ @@ -241,13 +246,12 @@ PointerToEditBufer rd 1 PointerToSpriteBufer rd 1 PointerToPalette rd 1 ;указатель на пилитру (нужен для сохранения в *.bmp) Color rd 1 +SColor rd 1 Number_Brush rd 1 Brush_SizeX rd 1 Brush_SizeY rd 1 Current_instrument rd 1 Last_instrument rd 1 -Activate_instrument rb 1 -SColor rd 1 OldX rd 1 OldY rd 1 @@ -279,7 +283,6 @@ Icon_X rd 1 Icon_Y rd 1 counter rd 1 counter2 rd 1 -Panel_flag rb 1 menu_counter rd 1 counter_11 rd 1 number_panel rd 1 @@ -299,45 +302,45 @@ Scroll2MaxSizeY rd 1 Scroll2SizeY rd 1 Scroll2FreeY rd 1 -;extended_memory rd 1 -type rw 1 x rd 1 y rd 1 -save_flag rb 1 -exit_from_work_arrea rb 1 Radius rd 1 Dx_ rd 1 Dy_ rd 1 line_width rd 1 -lastik_is_active rb 1 a_ellips rd 1 b_ellips rd 1 -instrument_used rb 1 -used_OldX rd 1 + +used_OldX rd 1 ;for draw hard contour used_OldY rd 1 -rectangular_shade_x rd 1 +rectangular_shade_x rd 1 ;координата x области для копирования rectangular_shade_y rd 1 crossing_old_x rd 1 crossing_old_y rd 1 crossing rd 1 finishing_crossing rd 1 number_undo rd 1 -DrawSprite_flag rb 1 -Paste_flag rb 1 SpriteSizeX rd 1 SpriteSizeY rd 1 SpriteCoordinatX rd 1 SpriteCoordinatY rd 1 SpriteOldCoordinatX rd 1 SpriteOldCoordinatY rd 1 + +CursorsID rd 10 + +Activate_instrument rb 1 +save_flag rb 1 +exit_from_work_arrea rb 1 +lastik_is_active rb 1 +instrument_used rb 1 +DrawSprite_flag rb 1 +Paste_flag rb 1 ;--------------------------------------------------------------------- IncludeUGlobals ;--------------------------------------------------------------------- align 4 -CursorsID rd 10 -;--------------------------------------------------------------------- -align 4 file_path rb 4096 filename_area rb 256 temp_dir_pach rb 4096 diff --git a/programs/media/animage/trunk/cursors.inc b/programs/media/animage/trunk/cursors.inc index 98e0426282..fcea305f45 100644 --- a/programs/media/animage/trunk/cursors.inc +++ b/programs/media/animage/trunk/cursors.inc @@ -8,84 +8,49 @@ load_cursors: mov [PointerToCursorsID],eax - mov eax, 37 - mov ebx, 4 - mov ecx,brush_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, brush_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,flood_fill_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, flood_fill_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,lastik_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, lastik_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - - mov eax, 37 - mov ebx, 4 - mov ecx,other_cursor - mov edx,1 - mcall - + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, other_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,pencil_cursor - mov edx,1 - mcall - + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, pencil_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,pipette_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, pipette_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,spray_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, spray_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax add [PointerToCursorsID],4 - mov eax, 37 - mov ebx, 4 - mov ecx,zoom_cursor - mov edx,1 - mcall + mcall SF_MOUSE_GET, SSF_LOAD_CURSOR, zoom_cursor, 1 mov ebx,[PointerToCursorsID] mov [ebx],eax @@ -280,15 +245,16 @@ set_cursor: che: + cmp eax,8 ;cursors count + jg no_change_cursor + dec eax shl eax,2 mov ebx,[PointerToCursorsID] add eax,ebx mov ecx,[eax] - mov eax, 37 - mov ebx, 5 - mcall + mcall SF_MOUSE_GET, SSF_SET_CURSOR no_change_cursor: diff --git a/programs/media/animage/trunk/events.inc b/programs/media/animage/trunk/events.inc index f271d16f67..0344113fdb 100644 --- a/programs/media/animage/trunk/events.inc +++ b/programs/media/animage/trunk/events.inc @@ -1,11 +1,3 @@ -;---------------------------------------------------------- -;---------------------system events------------------------ -;---------------------------------------------------------- -align 4 -event: - mcall SF_WAIT_EVENT - ret - ;---------------------------------------------------------- ;---------------------sound of events---------------------- ;---------------------------------------------------------- diff --git a/programs/media/animage/trunk/events_of_buttons.inc b/programs/media/animage/trunk/events_of_buttons.inc index 1635b3fc2f..528ceeeb11 100644 --- a/programs/media/animage/trunk/events_of_buttons.inc +++ b/programs/media/animage/trunk/events_of_buttons.inc @@ -30,15 +30,6 @@ buttons: mov [Current_instrument],eax call button_handler_main_menu - ; set cursor for current instrument - pushad - - mov eax,CursorsID - mov ebx,[Current_instrument] - - 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 2e58de1109..737c4ef334 100644 --- a/programs/media/animage/trunk/events_of_mouse.inc +++ b/programs/media/animage/trunk/events_of_mouse.inc @@ -12,33 +12,6 @@ mouse: jne still call GetMouseCoordinats -;panel - mov edx,[Window_SizeX] - sub edx,5 - - ;cmp ebx,0 - ;jle no_panel - - cmp ebx,ci_panel_y_pos - jae no_panel - - cmp eax,5 - jle no_panel - - cmp eax,edx - jae no_panel - - call GetMouseCoordinats - jmp panel_interraction - -no_panel: - cmp [Panel_flag],0 - jz no_redraw_panel - - jmp panel_interraction - -no_redraw_panel: - call GetMouseCoordinats mov eax,[MouseX] mov ebx,[MouseY] mov ecx,[WorkScreen_SizeX] @@ -56,9 +29,9 @@ no_redraw_panel: mouse_scroll: mov [exit_from_work_arrea],1 ;mouse situated after work arrea ;scrollers - call GetMouseClick + call GetMouseClick cmp eax,1 - jne no_click + jne still call GetMouseCoordinats ;interraction with horizontal scroller @@ -169,8 +142,6 @@ no_vertical: call CalculatePositionScreen call draw_scrollers call MovePictureToWorkScreen - -no_click: jmp still no_scrollers: @@ -178,8 +149,8 @@ no_scrollers: mov ebx,[MouseY] mov ecx,[Window_SizeX] mov edx,[Window_SizeY] - sub ecx,36 - sub edx,35 + sub ecx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_w + sub edx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_h cmp eax,ci_scrollh_coord_x_min jle not_work_arrea @@ -196,11 +167,18 @@ no_scrollers: not_work_arrea: mov [exit_from_work_arrea],1 + mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor jmp still mouse_in_work_arrea: call GetScreenCordinats call PrintMousePos + + ;set cursor for current instrument + mov eax,CursorsID + mov ebx,[Current_instrument] + call set_cursor + call GetMouseClick test eax,eax jz no_use_instruments @@ -208,7 +186,7 @@ mouse_in_work_arrea: cmp [Activate_instrument],0 jnz no_undo___ ;------------begin copy for undo------------- -;copy bufer number 2 to bufer number 0 +;copy bufer_0 -> bufer_2 mov edi,[PointerToCopyPicture2] mov esi,[PointerToPicture] mov ecx,[Picture_SizeX] @@ -221,7 +199,6 @@ mouse_in_work_arrea: mov ecx,ebx and ecx,3 rep movsb - ;call MovePictureToWorkScreen ;rotate bufers +1 and [number_undo],0 ;erase all undo mov eax,[PointerToPicture] diff --git a/programs/media/animage/trunk/menu_instruments.inc b/programs/media/animage/trunk/menu_instruments.inc index 8d0fad02b8..a4da5d1a31 100644 --- a/programs/media/animage/trunk/menu_instruments.inc +++ b/programs/media/animage/trunk/menu_instruments.inc @@ -218,7 +218,7 @@ no_file: jne no_undo cmp [number_undo],2 ;2 - maximum undo count - jge no_undo + jge end_menu ;rotate bufers -1 inc [number_undo] @@ -238,7 +238,7 @@ no_undo: jne no_redo cmp [number_undo],0 - je no_redo + je end_menu ;rotate bufers +1 dec [number_undo] @@ -258,9 +258,9 @@ no_redo: jne no_copy cmp [instrument_used],1 - jne no_copy + jne end_menu cmp [Activate_instrument],0 - jne no_copy + jne end_menu mov eax,[OldX] mov ebx,[OldY] diff --git a/programs/media/animage/trunk/panel_engen.inc b/programs/media/animage/trunk/panel_engen.inc index f571f54e29..529920457f 100644 --- a/programs/media/animage/trunk/panel_engen.inc +++ b/programs/media/animage/trunk/panel_engen.inc @@ -1,9 +1,3 @@ -;------------------------------------------------- -;-----interraction panel with user---------------- -;------------------------------------------------- -panel_interraction: - and [Panel_flag],0 - jmp still ;--------------------------------------------------------- ;-----draw panel menu(main engin of panel)---------------- ;---------------------------------------------------------