Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6379 → Rev 6385

/programs/media/animage/trunk/animage.asm
43,6 → 43,7
include '../../../dll.inc'
include '../../../libio.inc'
;include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
;include '../../../debug.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
 
261,6 → 262,7
 
MouseX rd 1
MouseY rd 1
MouseBut rd 1 ;ᮡëâ¨ï ®â ª­®¯®ª ¬ëè¨
Window_SizeX rd 1
Window_SizeY rd 1
Window_CordinatX rd 1
322,17 → 324,17
 
used_OldX rd 1 ;for draw hard contour
used_OldY rd 1
rectangular_shade_x rd 1 ;ª®®à¤¨­ â  x ®¡« á⨠¤«ï ª®¯¨à®¢ ­¨ï
rectangular_shade_y rd 1
paste_img_w rd 1 ;è¨à¨­  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
paste_img_h rd 1 ;¢ëá®â  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
crossing_old_x rd 1
crossing_old_y rd 1
crossing rd 1
finishing_crossing rd 1
crossing_old_x rd 1 ;­ ç «ì­ ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ­¨ï
crossing_old_y rd 1 ;­ ç «ì­ ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ­¨ï
rectangular_shade_x rd 1 ;ª®­¥ç­ ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ­¨ï
rectangular_shade_y rd 1 ;ª®­¥ç­ ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ­¨ï
crossing rd 1 ;0 - ¢ë¤¥«¥­¨ï ­¥â, 1 - ¨¤¥â ¯à®æ¥á ¢ë¤¥«¥­¨ï,
;2 - ¢ë¤¥«¥­¨¥ § ¢¥à襭®, 3 - ®¡« áâì ¢ë¤¥«¥­¨ï ¯¥à¥¬¥é ¥âáï
number_undo rd 1
SpriteSizeX rd 1
SpriteSizeY rd 1
SpriteSizeX rd 1 ;???
SpriteSizeY rd 1 ;???
SpriteCoordinatX rd 1
SpriteCoordinatY rd 1
SpriteOldCoordinatX rd 1
340,7 → 342,8
 
CursorsID rd 10
 
Activate_instrument rb 1
Activate_instrument rb 1 ;¥á«¨ à ¢­® 0 - â® ª®¯¨à®¢ ­¨¥ ⥪ã饣® ¡ãä¥à 
;¤«ï ¥£® । ªâ¨à®¢ ­¨ï, ¥á«¨ 1 - ⥪ã騩 ¡ãä¥à ­¥ ª®¯¨àã¥âáï
save_flag rb 1
exit_from_work_arrea rb 1
lastik_is_active rb 1
/programs/media/animage/trunk/events_of_buttons.inc
9,9 → 9,7
jne @f
cmp [Activate_instrument],0
jne @f
cmp [crossing],1
jne @f
mov [finishing_crossing],1
;mov [crossing],2
call TakeButtonInstruments
jmp still
@@:
35,12 → 33,10
 
;save instrumnets 10-40
cmp eax,40
jae no_save_last_instrument
 
jae @f
mov [Last_instrument],eax
@@:
 
no_save_last_instrument:
 
cmp eax,10
je still
 
57,31 → 53,22
je still
 
cmp eax,51
jne no_palette_
 
jne @f
call TakeButtonInstruments
jmp still
@@:
 
no_palette_:
 
cmp eax,17
je still
 
cmp eax,21
jne no_allocation__
je still
 
and [Activate_instrument],0
jmp still
 
no_allocation__:
 
cmp eax,20
jne no_kontur__
 
jne @f
and [instrument_used],0
jmp still
@@:
 
no_kontur__:
 
call TakeButtonInstruments
jmp still
/programs/media/animage/trunk/events_of_mouse.inc
11,6 → 11,8
test eax,100b
jne still
call GetMouseClick
 
call GetMouseCoordinats
mov eax,[MouseX]
mov ebx,[MouseY]
29,11 → 31,10
mouse_scroll:
mov [exit_from_work_arrea],1 ;mouse situated after work arrea
;scrollers
call GetMouseClick
cmp eax,1
jne still
cmp [MouseBut],0
je still
 
call GetMouseCoordinats
;call GetMouseCoordinats
;interraction with horizontal scroller
mov eax,[Scroll1CoordinatX]
mov ebx,[Scroll1CoordinatY]
179,12 → 180,11
mov ebx,[Current_instrument]
call set_cursor
 
call GetMouseClick
test eax,eax
jz no_use_instruments
cmp [MouseBut],0
je no_use_instruments
 
cmp [Activate_instrument],0
jnz no_undo___
jne no_undo___
;------------begin copy for undo-------------
;copy bufer_0 -> bufer_2
mov edi,[PointerToCopyPicture2]
210,11 → 210,9
;--------------end copy for undo-------------
no_undo___:
call TakeButtonInstruments
 
jmp still
 
no_use_instruments:
mov eax,[Current_instrument]
and [Activate_instrument],0
jmp still
;-----------------------------------------------
232,5 → 230,6
;-------get mouse attributs----------------------
;------------------------------------------------
GetMouseClick:
mcall SF_MOUSE_GET,SSF_BUTTON
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
mov [MouseBut],eax
ret
/programs/media/animage/trunk/icons_instruments.inc
1027,7 → 1027,7
jne no_1_
mov [k],1
call scrollbar_move_00
and [Current_instrument],0
and [Current_instrument],0 ;???
call drawwin
ret
no_1_:
1086,318 → 1086,131
cmp eax,21
jne no_allocation
 
cmp [instrument_used],0
jnz instrument_not_finished_work
 
mov al,[Activate_instrument]
test al,al
jnz no_new_allocation_xy
mov eax,[ScreenX]
mov ebx,[ScreenY]
add eax,[PosX]
add ebx,[PosY]
mov [OldX],eax
mov [OldY],ebx
inc eax
inc ebx
mov [rectangular_shade_x],eax
mov [rectangular_shade_y],ebx
mov [Activate_instrument],1
mov [instrument_used],1
and [crossing],0
and [finishing_crossing],0
xor eax,eax
mov ecx,mem_flood_f/4
mov edi,[ReserveArray]
cld
rep stosd
ret
no_new_allocation_xy:
instrument_not_finished_work:
 
mov al,[instrument_used]
test al,al
jz no_change_coordinats
 
cmp [Activate_instrument],0
jnz no_change_coordinats
 
;save coordinates as old if crossing=0
cmp [crossing],0
jnz no_save_coordinate_of_crossing
 
mov eax,[OldX]
mov ebx,[OldY]
 
cmp eax,[rectangular_shade_x]
jl no_remove_x
mov ecx,[rectangular_shade_x]
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
no_remove_x:
 
cmp ebx,[rectangular_shade_y]
jl no_remove_y
mov ecx,[rectangular_shade_y]
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
no_remove_y:
 
mov eax,[ScreenX]
mov ebx,[ScreenY]
add eax,[PosX]
add ebx,[PosY]
mov [crossing_old_x],eax
mov [crossing_old_y],ebx
mov [crossing],1
 
 
mov eax,[OldX]
mov ebx,[OldY]
inc eax
inc ebx
mov [SpriteCoordinatX],eax
mov [SpriteCoordinatY],ebx
mov [SpriteOldCoordinatX],eax
mov [SpriteOldCoordinatY],ebx
mov esi,[rectangular_shade_x]
mov edi,[rectangular_shade_y]
 
sub esi,eax
jns @f
neg esi ;sign sprite size x
@@:
 
sub edi,ebx
jns @f
neg edi ;sign sprite size y
@@:
 
test esi,esi
jnz @f
mov esi,1 ;null sprite x
@@:
 
test edi,edi
jnz @f
mov edi,1 ;null sprite y
@@:
 
mov [SpriteSizeX],esi
mov [SpriteSizeY],edi
 
call SaveFonForSprite
 
no_save_coordinate_of_crossing:
 
cmp [crossing],0
je no_test_crossing_with_work_arrea
;if mouse situatad after allocation than exit
push [ScreenX]
push [ScreenY]
 
call GetScreenCordinats
 
mov eax,[OldX]
mov ebx,[OldY]
bt [MouseBut],8 ;left button down
jnc .left_but_down
cmp [crossing],2
jne @f
;move old selection
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
mov ecx,[ScreenX]
mov edx,[ScreenY]
mov esi,[SpriteSizeX]
mov edi,[SpriteSizeY]
add ecx,[PosX]
add edx,[PosY]
inc esi
inc edi
mov esi,[rectangular_shade_x]
mov edi,[rectangular_shade_y]
sub esi,eax
sub edi,ebx
call columnus
 
test eax,eax
jnz crossing_with_work_area
mov [finishing_crossing],1
crossing_with_work_area:
jz @f
mov [crossing],3
mov [OldX],ecx
mov [OldY],edx
jmp selection_update
@@:
;start new selection
mov eax,[ScreenX]
add eax,[PosX]
mov [crossing_old_x],eax
mov [rectangular_shade_x],eax
mov eax,[ScreenY]
add eax,[PosY]
mov [crossing_old_y],eax
mov [rectangular_shade_y],eax
mov [crossing],1
jmp selection_update
.left_but_down:
 
pop [ScreenY]
pop [ScreenX]
 
no_test_crossing_with_work_arrea:
 
bt [MouseBut],0 ;left button press
jnc .no_mouse_move
cmp [crossing],3
jne .no_sel_move
;move selection
mov eax,[ScreenX]
mov ebx,[ScreenY]
add eax,[PosX]
add ebx,[PosY]
mov ecx,eax
mov edx,ebx
sub eax,[crossing_old_x] ;dx=(x-oldx)
sub ebx,[crossing_old_y] ;dy=(y-oldy)
mov [crossing_old_x],ecx
mov [crossing_old_y],edx
 
add [OldX],eax ;x1=x1+dx
add [OldY],ebx ;y1=y1+dy
add [rectangular_shade_x],eax ;x2=x2+dx
add [rectangular_shade_y],ebx ;y2+y2+dy
 
mov eax,[OldX]
mov ebx,[OldY]
inc eax
inc ebx
mov [SpriteCoordinatX],eax
mov [SpriteCoordinatY],ebx
 
cmp [SpriteCoordinatX],0
jns @f
mov [SpriteCoordinatX],1 ;null sprite coordinat x
sub eax,[OldX]
add [OldX],eax
mov ebx,[crossing_old_x]
add ebx,eax
cmp ebx,0
jge @f
;exit from left border
sub eax,ebx
@@:
cmp [SpriteCoordinatY],0
jns @f
mov [SpriteCoordinatY],1 ;null sprite coordinat y
add [crossing_old_x],eax
add [rectangular_shade_x],eax
mov eax,[ScreenY]
add eax,[PosY]
sub eax,[OldY]
add [OldY],eax
mov ebx,[crossing_old_y]
add ebx,eax
cmp ebx,0
jge @f
;exit from top border
sub eax,ebx
@@:
add [crossing_old_y],eax
add [rectangular_shade_y],eax
jmp selection_update
.no_sel_move:
;resize selection
mov eax,[ScreenX]
add eax,[PosX]
mov [rectangular_shade_x],eax
mov eax,[ScreenY]
add eax,[PosY]
mov [rectangular_shade_y],eax
jmp selection_update
.no_mouse_move:
 
mov esi,[rectangular_shade_x]
mov edi,[rectangular_shade_y]
 
sub esi,[OldX]
jns @f
neg esi
bt [MouseBut],16 ;left button up
jnc .left_but_up
;finish selection
mov eax,[crossing_old_x]
mov ebx,[rectangular_shade_x]
cmp eax,ebx
jle @f
mov [crossing_old_x],ebx
mov [rectangular_shade_x],eax
@@:
sub edi,[OldY]
jns @f
neg edi
mov eax,[crossing_old_y]
mov ebx,[rectangular_shade_y]
cmp eax,ebx
jle @f
mov [crossing_old_y],ebx
mov [rectangular_shade_y],eax
@@:
mov [crossing],2
ret
.left_but_up:
 
mov ecx,[OldX]
mov edx,[OldY]
bt [MouseBut],9 ;right button down
jnc .right_but_down
;delete select
mov [crossing],0
jmp selection_update
.right_but_down:
 
sub ecx,[PosX]
jns @f
xor ecx,ecx
add ecx,[PosX]
mov [OldX],ecx
add ecx,esi
mov [rectangular_shade_x],ecx
@@:
 
sub edx,[PosY]
jns @f
xor edx,edx
add edx,[PosY]
mov [OldY],edx
add edx,edi
mov [rectangular_shade_y],edx
@@:
 
mov ecx,[Picture_SizeX]
sub ecx,esi
cmp [OldX],ecx
jl @f
dec ecx
mov [OldX],ecx
add ecx,esi
mov [rectangular_shade_x],ecx
@@:
 
mov edx,[Picture_SizeY]
sub edx,edi
cmp [OldY],edx
jl @f
dec edx
mov [OldY],edx
add edx,edi
mov [rectangular_shade_y],edx
@@:
 
mov eax,[rectangular_shade_x]
mov ebx,[rectangular_shade_y]
sub eax,[PosX]
sub ebx,[PosY]
mov [ScreenX],eax
mov [ScreenY],ebx
no_change_coordinats:
 
;put saved pixels
square_width_put
 
cmp [DrawSprite_flag],1
jne no_activate_put_fon_
 
if 0
cmp [Paste_flag],1
je @f
call PutFonForSprite
@@:
and [Paste_flag],0
no_activate_put_fon_:
 
cmp [finishing_crossing],0
jz not_finish_from_instrument_crossing
and [Activate_instrument],0
and [crossing],0
and [instrument_used],0
and [DrawSprite_flag],0
call MovePictureToWorkScreen
ret
not_finish_from_instrument_crossing:
 
;calculate line
mov ebx,[ReserveArray]
add ebx,4
mov eax,[PointerToPicture]
mov ecx,[Picture_SizeX]
mov edx,[OldX]
shl edx,16
add edx,[OldY]
mov esi,[ScreenX]
mov edi,[ScreenY]
add esi,[PosX]
add edi,[PosY]
 
mov ebp,[Picture_SizeX]
dec ebp
cmp esi,ebp
jl @f
mov esi,ebp ;minimum x allocation
@@:
 
mov ebp,[Picture_SizeY]
dec ebp
cmp edi,ebp
jl @f
mov edi,ebp ;minimum y allocation
@@:
 
call calculate_rectangle
 
;save color pixels in ReserveArray
square_width_save
 
cmp [DrawSprite_flag],1
jne @f
;save current coordinats as old
mov eax,[SpriteCoordinatX]
mov ebx,[SpriteCoordinatY]
mov [SpriteOldCoordinatX],eax
mov [SpriteOldCoordinatY],ebx
 
call SaveFonForSprite
 
@@:
 
cmp [DrawSprite_flag],1
jne @f
call DrawSprite
@@:
end if
 
mov al,[instrument_used]
test al,al
jz no_change_coordinats
cmp [Activate_instrument],0
jz no_save_shades
mov eax,[ScreenX]
mov ebx,[ScreenY]
add eax,[PosX]
add ebx,[PosY]
mov [rectangular_shade_x],eax
mov [rectangular_shade_y],ebx
no_save_shades:
 
selection_update:
call MovePictureToWorkScreen
ret
no_allocation:
/programs/media/animage/trunk/init_data.inc
22,7 → 22,6
mov [line_width],1
mov [lastik_is_active],0
and [crossing],0
and [finishing_crossing],0
and [number_undo],0
and [instrument_used],0
and [DrawSprite_flag],0
/programs/media/animage/trunk/menu.inc
64,6 → 64,8
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
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Edit_SelectAll, 0x67
stdcall [ksubmenu_add], [main_menu_edit], eax
; add 'Edit' menu to main
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Edit, [main_menu_edit]
126,6 → 128,7
menu_set 0x64, 6,4
menu_set 0x65, 6,5
menu_set 0x66, 6,6
menu_set 0x67, 6,7
menu_set 0x51, 5,1
menu_set 0x52, 5,2
menu_set 0x53, 5,3
162,6 → 165,7
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_Edit_SelectAll db 'Select all', 0
 
sz_main_menu_Instr db 'Instruments', 0
sz_main_menu_Instr_Pencil db 'Pencil', 0
/programs/media/animage/trunk/menu_instruments.inc
257,19 → 257,14
cmp [number_menu],3
jne no_copy
 
cmp [instrument_used],1
jne end_menu
cmp [Activate_instrument],0
jne end_menu
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
 
mov eax,[OldX]
mov ebx,[OldY]
 
cmp eax,[rectangular_shade_x]
jl no_remove_x_copy
 
mov ecx,[rectangular_shade_x]
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [crossing_old_x],ecx ; crossing_old_x <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
 
no_remove_x_copy:
277,12 → 272,12
jl no_remove_y_copy
 
mov ecx,[rectangular_shade_y]
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [crossing_old_y],ecx ; crossing_old_y <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
 
no_remove_y_copy:
mov eax,[OldX]
mov ebx,[OldY]
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
mov ecx,[rectangular_shade_x]
mov edx,[rectangular_shade_y]
inc eax
314,10 → 309,10
 
mov edx,[PointerToEditBufer]
mov eax,[rectangular_shade_x]
sub eax,[OldX]
sub eax,[crossing_old_x]
mov [edx],eax ;image.w
mov eax,[rectangular_shade_y]
sub eax,[OldY]
sub eax,[crossing_old_y]
mov [edx+4],eax ;image.h
mov dword[edx+8],24 ;bit in pixel
add edx,12 ;copy image parametrs
365,20 → 360,14
cmp [number_menu],4
jne no_paste
 
cmp [instrument_used],1
jne no_paste
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
 
cmp [Activate_instrument],0
jne no_paste
 
mov eax,[OldX]
mov ebx,[OldY]
 
cmp eax,[rectangular_shade_x]
jl no_remove_x_paste
 
mov ecx,[rectangular_shade_x]
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [crossing_old_x],ecx ; crossing_old_x <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
 
no_remove_x_paste:
386,12 → 375,12
jl no_remove_y_paste
 
mov ecx,[rectangular_shade_y]
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [crossing_old_y],ecx ; crossing_old_y <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
 
no_remove_y_paste:
mov eax,[OldX]
mov ebx,[OldY]
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
mov ecx,[rectangular_shade_x]
mov edx,[rectangular_shade_y]
inc eax
422,10 → 411,10
cmp dword[edx+8],24
jne end_menu
mov eax,[edx]
add eax,[OldX]
add eax,[crossing_old_x]
mov [paste_img_w],eax
mov eax,[edx+4]
add eax,[OldY]
add eax,[crossing_old_y]
mov [paste_img_h],eax
add edx,12 ;copy image parametrs
mov [y],edi
473,20 → 462,14
cmp [number_menu],5
jne no_cut
 
cmp [instrument_used],1
jne no_cut
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
 
cmp [Activate_instrument],0
jne no_cut
 
mov eax,[OldX]
mov ebx,[OldY]
 
cmp eax,[rectangular_shade_x]
jl no_remove_x_cut
 
mov ecx,[rectangular_shade_x]
mov [OldX],ecx ; OldX <-----> rectangulare_shade_x
mov [crossing_old_x],ecx ; crossing_old_x <-----> rectangulare_shade_x
mov [rectangular_shade_x],eax
 
no_remove_x_cut:
494,12 → 477,12
jl no_remove_y_cut
 
mov ecx,[rectangular_shade_y]
mov [OldY],ecx ; OldY <-----> rectangulare_shade_y
mov [crossing_old_y],ecx ; crossing_old_y <-----> rectangulare_shade_y
mov [rectangular_shade_y],ebx
 
no_remove_y_cut:
mov eax,[OldX]
mov ebx,[OldY]
mov eax,[crossing_old_x]
mov ebx,[crossing_old_y]
mov ecx,[rectangular_shade_x]
mov edx,[rectangular_shade_y]
inc eax
570,10 → 553,10
no_cleare_all:
; <<< To allocate all >>>
cmp [number_menu],7
jne end_menu ;no_to_allocate_all
jne end_menu
 
mov [OldX],1
mov [OldY],1
mov [crossing_old_x],0
mov [crossing_old_y],0
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
dec eax
580,15 → 563,11
dec ebx
mov [rectangular_shade_x],eax
mov [rectangular_shade_y],ebx
mov [instrument_used],1
mov [Activate_instrument],1
mov [Current_instrument],30
mov [crossing],0
; call TakeButtonInstruments
mov [crossing],2
; call MovePictureToWorkScreen
jmp end_menu
;---------------------------------------------------------------------
;no_to_allocate_all:
no_edit:
;|||||||||||||||||||||||||INSTRUMENTS||||||||||||||||||||||
cmp [number_panel],5
/programs/media/animage/trunk/screen.inc
236,15 → 236,15
 
fps:
;calculate selection rect
cmp [instrument_used],1
jne .no_selection_rect
cmp [crossing],0
je .no_selection_rect
mov edx,[rectangular_shade_y]
sub edx,[PosY]
mov ecx,[rectangular_shade_x]
sub ecx,[PosX]
mov ebx,[OldY]
mov ebx,[crossing_old_y]
sub ebx,[PosY]
mov eax,[OldX]
mov eax,[crossing_old_x]
sub eax,[PosX]
cmp [k],1
je .zo_1