2006-12-29 15:50:24 +01:00
|
|
|
;---------------------------------------------
|
|
|
|
;-------------interraction MOUSE--------------
|
|
|
|
;---------------------------------------------
|
|
|
|
mouse:
|
2016-03-21 18:29:30 +01:00
|
|
|
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
|
|
|
|
|
2016-03-19 20:38:56 +01:00
|
|
|
or ecx,-1
|
2016-03-17 20:03:33 +01:00
|
|
|
mcall SF_THREAD_INFO,procinfo
|
2011-08-11 11:03:51 +02:00
|
|
|
|
|
|
|
mov eax,[procinfo+70] ;staus of window
|
2016-03-19 20:38:56 +01:00
|
|
|
test eax,100b
|
2011-08-11 11:03:51 +02:00
|
|
|
jne still
|
|
|
|
|
2016-03-19 20:38:56 +01:00
|
|
|
call GetMouseCoordinats
|
2010-10-04 22:40:19 +02:00
|
|
|
mov eax,[MouseX]
|
|
|
|
mov ebx,[MouseY]
|
|
|
|
mov ecx,[WorkScreen_SizeX]
|
|
|
|
mov edx,[WorkScreen_SizeY]
|
2016-03-19 10:57:37 +01:00
|
|
|
add ecx,ci_scrollh_coord_x_min
|
|
|
|
add edx,ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
cmp eax,ecx
|
|
|
|
jae mouse_scroll
|
|
|
|
|
|
|
|
cmp ebx,edx
|
|
|
|
jae mouse_scroll
|
|
|
|
jmp no_scrollers
|
|
|
|
|
|
|
|
mouse_scroll:
|
|
|
|
mov [exit_from_work_arrea],1 ;mouse situated after work arrea
|
|
|
|
;scrollers
|
2016-03-23 11:15:41 +01:00
|
|
|
call GetMouseClick
|
2010-10-04 22:40:19 +02:00
|
|
|
cmp eax,1
|
2016-03-23 11:15:41 +01:00
|
|
|
jne still
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
call GetMouseCoordinats
|
|
|
|
;interraction with horizontal scroller
|
|
|
|
mov eax,[Scroll1CoordinatX]
|
|
|
|
mov ebx,[Scroll1CoordinatY]
|
|
|
|
mov ecx,[MouseX]
|
|
|
|
mov edx,[MouseY]
|
|
|
|
mov esi,[Scroll1MaxSizeX]
|
|
|
|
mov edi,[Scroll1MaxSizeY]
|
|
|
|
call columnus
|
|
|
|
test eax,eax
|
|
|
|
jz no_horizontal
|
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
mov eax,ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
mov ebx,[Scroll1CoordinatY]
|
|
|
|
mov ecx,[Scroll1MaxSizeX]
|
2016-03-19 10:57:37 +01:00
|
|
|
inc ecx
|
2016-03-19 20:38:56 +01:00
|
|
|
mov edx,ci_scroll_dim-6
|
2010-10-04 22:40:19 +02:00
|
|
|
mov esi,7
|
2016-03-19 10:57:37 +01:00
|
|
|
call draw_volume_rectangle ; horizontal scrollbar clear
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
mov eax,[MouseX]
|
|
|
|
mov ebx,[Scroll1SizeX]
|
|
|
|
shr ebx,1
|
|
|
|
sub eax,ebx
|
|
|
|
mov ecx,[MouseX]
|
|
|
|
add ecx,ebx
|
2016-03-19 10:57:37 +01:00
|
|
|
mov edx,ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
add edx,[Scroll1MaxSizeX]
|
|
|
|
mov [Scroll1CoordinatX],eax
|
2016-03-19 10:57:37 +01:00
|
|
|
sub eax,ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
jns no_min_scroll
|
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
mov [Scroll1CoordinatX],ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
no_min_scroll:
|
|
|
|
cmp ecx,edx
|
|
|
|
jl no_max_scroll
|
|
|
|
|
|
|
|
sub edx,ebx
|
|
|
|
sub edx,ebx
|
|
|
|
mov [Scroll1CoordinatX],edx
|
|
|
|
|
|
|
|
no_max_scroll:
|
|
|
|
mov eax,[Scroll1CoordinatX]
|
2016-03-19 10:57:37 +01:00
|
|
|
sub eax,ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
mov ebx,[Picture_SizeX]
|
|
|
|
imul eax,ebx
|
|
|
|
mov ebx,[Scroll1MaxSizeX]
|
2006-12-29 15:50:24 +01:00
|
|
|
cdq
|
2010-10-04 22:40:19 +02:00
|
|
|
idiv ebx
|
|
|
|
mov [PosX],eax
|
|
|
|
jmp no_vertical
|
|
|
|
|
|
|
|
no_horizontal:
|
|
|
|
mov eax,[Scroll2CoordinatX]
|
|
|
|
mov ebx,[Scroll2CoordinatY]
|
|
|
|
mov ecx,[MouseX]
|
|
|
|
mov edx,[MouseY]
|
|
|
|
mov esi,[Scroll2MaxSizeX]
|
|
|
|
mov edi,[Scroll2MaxSizeY]
|
|
|
|
call columnus
|
|
|
|
test eax,eax
|
|
|
|
jz no_vertical
|
|
|
|
|
|
|
|
mov eax,[Scroll2CoordinatX]
|
2016-03-19 10:57:37 +01:00
|
|
|
mov ebx,ci_scrollv_coord_y_min
|
2016-03-19 20:38:56 +01:00
|
|
|
mov ecx,ci_scroll_dim-6
|
2010-10-04 22:40:19 +02:00
|
|
|
mov edx,[Scroll2MaxSizeY]
|
2016-03-19 10:57:37 +01:00
|
|
|
inc edx
|
2010-10-04 22:40:19 +02:00
|
|
|
mov esi,7
|
2016-03-19 10:57:37 +01:00
|
|
|
call draw_volume_rectangle ; vertical scrollbar clear
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
mov eax,[MouseY]
|
|
|
|
mov ebx,[Scroll2SizeY]
|
|
|
|
shr ebx,1
|
|
|
|
sub eax,ebx
|
|
|
|
mov ecx,[MouseY]
|
|
|
|
add ecx,ebx
|
2016-03-19 10:57:37 +01:00
|
|
|
mov edx,ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
add edx,[Scroll2MaxSizeY]
|
|
|
|
mov [Scroll2CoordinatY],eax
|
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
sub eax,ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
jns no_min_scroll2
|
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
mov [Scroll2CoordinatY],ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
no_min_scroll2:
|
|
|
|
cmp ecx,edx
|
|
|
|
jl no_max_scroll2
|
|
|
|
|
|
|
|
sub edx,ebx
|
|
|
|
sub edx,ebx
|
|
|
|
mov [Scroll2CoordinatY],edx
|
|
|
|
|
|
|
|
no_max_scroll2:
|
|
|
|
mov eax,[Scroll2CoordinatY]
|
2016-03-19 10:57:37 +01:00
|
|
|
sub eax,ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
mov ebx,[Picture_SizeY]
|
|
|
|
imul eax,ebx
|
|
|
|
mov ebx,[Scroll2MaxSizeY]
|
2006-12-29 15:50:24 +01:00
|
|
|
cdq
|
2010-10-04 22:40:19 +02:00
|
|
|
idiv ebx
|
|
|
|
mov [PosY],eax
|
|
|
|
|
|
|
|
no_vertical:
|
|
|
|
call CalculatePositionScreen
|
|
|
|
call draw_scrollers
|
|
|
|
call MovePictureToWorkScreen
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
no_scrollers:
|
|
|
|
mov eax,[MouseX]
|
|
|
|
mov ebx,[MouseY]
|
|
|
|
mov ecx,[Window_SizeX]
|
|
|
|
mov edx,[Window_SizeY]
|
2016-03-23 11:15:41 +01:00
|
|
|
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
|
2010-10-04 22:40:19 +02:00
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
cmp eax,ci_scrollh_coord_x_min
|
2010-10-04 22:40:19 +02:00
|
|
|
jle not_work_arrea
|
|
|
|
|
|
|
|
cmp eax,ecx
|
|
|
|
jae not_work_arrea
|
|
|
|
|
2016-03-19 10:57:37 +01:00
|
|
|
cmp ebx,ci_scrollv_coord_y_min
|
2010-10-04 22:40:19 +02:00
|
|
|
jle not_work_arrea
|
|
|
|
|
|
|
|
cmp ebx,edx
|
|
|
|
jae not_work_arrea
|
|
|
|
jmp mouse_in_work_arrea
|
|
|
|
|
|
|
|
not_work_arrea:
|
|
|
|
mov [exit_from_work_arrea],1
|
2016-03-23 11:15:41 +01:00
|
|
|
mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor
|
2010-10-04 22:40:19 +02:00
|
|
|
jmp still
|
|
|
|
|
|
|
|
mouse_in_work_arrea:
|
|
|
|
call GetScreenCordinats
|
|
|
|
call PrintMousePos
|
2016-03-23 11:15:41 +01:00
|
|
|
|
|
|
|
;set cursor for current instrument
|
|
|
|
mov eax,CursorsID
|
|
|
|
mov ebx,[Current_instrument]
|
|
|
|
call set_cursor
|
|
|
|
|
2010-10-04 22:40:19 +02:00
|
|
|
call GetMouseClick
|
|
|
|
test eax,eax
|
|
|
|
jz no_use_instruments
|
|
|
|
|
|
|
|
cmp [Activate_instrument],0
|
|
|
|
jnz no_undo___
|
|
|
|
;------------begin copy for undo-------------
|
2016-03-23 11:15:41 +01:00
|
|
|
;copy bufer_0 -> bufer_2
|
2016-03-17 20:03:33 +01:00
|
|
|
mov edi,[PointerToCopyPicture2]
|
|
|
|
mov esi,[PointerToPicture]
|
|
|
|
mov ecx,[Picture_SizeX]
|
|
|
|
imul ecx,[Picture_SizeY]
|
|
|
|
lea ecx,[ecx+ecx*2]
|
|
|
|
mov ebx,ecx
|
|
|
|
shr ecx,2
|
2006-12-29 15:50:24 +01:00
|
|
|
cld
|
2016-03-17 20:03:33 +01:00
|
|
|
rep movsd
|
|
|
|
mov ecx,ebx
|
|
|
|
and ecx,3
|
|
|
|
rep movsb
|
|
|
|
;rotate bufers +1
|
|
|
|
and [number_undo],0 ;erase all undo
|
|
|
|
mov eax,[PointerToPicture]
|
|
|
|
mov ebx,[PointerToCopyPicture]
|
|
|
|
mov ecx,[PointerToCopyPicture2]
|
|
|
|
mov [PointerToPicture],ecx
|
|
|
|
mov [PointerToCopyPicture],eax
|
|
|
|
mov [PointerToCopyPicture2],ebx
|
2010-10-04 22:40:19 +02:00
|
|
|
;--------------end copy for undo-------------
|
|
|
|
no_undo___:
|
2016-03-22 15:12:51 +01:00
|
|
|
call TakeButtonInstruments
|
2016-03-24 16:54:52 +01:00
|
|
|
|
2016-03-22 15:12:51 +01:00
|
|
|
jmp still
|
2010-10-04 22:40:19 +02:00
|
|
|
|
|
|
|
no_use_instruments:
|
|
|
|
mov eax,[Current_instrument]
|
|
|
|
and [Activate_instrument],0
|
|
|
|
jmp still
|
2006-12-29 15:50:24 +01:00
|
|
|
;-----------------------------------------------
|
|
|
|
;---------get mouse cordinats-------------------
|
|
|
|
;-----------------------------------------------
|
|
|
|
GetMouseCoordinats:
|
2016-03-17 20:03:33 +01:00
|
|
|
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
|
2010-10-04 22:40:19 +02:00
|
|
|
mov ebx,eax
|
|
|
|
shr eax,16
|
|
|
|
and ebx,0xffff
|
|
|
|
mov [MouseX],eax
|
|
|
|
mov [MouseY],ebx
|
2006-12-29 15:50:24 +01:00
|
|
|
ret
|
|
|
|
;------------------------------------------------
|
|
|
|
;-------get mouse attributs----------------------
|
|
|
|
;------------------------------------------------
|
|
|
|
GetMouseClick:
|
2016-03-17 20:03:33 +01:00
|
|
|
mcall SF_MOUSE_GET,SSF_BUTTON
|
2010-10-04 22:40:19 +02:00
|
|
|
ret
|