Subversion Repositories Kolibri OS

Rev

Rev 6364 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6364 Rev 6371
1
;---------------------------------------------
1
;---------------------------------------------
2
;-------------interraction MOUSE--------------
2
;-------------interraction MOUSE--------------
3
;---------------------------------------------
3
;---------------------------------------------
4
mouse:
4
mouse:
5
	stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
5
	stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
6
 
6
 
7
	or ecx,-1
7
	or ecx,-1
8
	mcall SF_THREAD_INFO,procinfo
8
	mcall SF_THREAD_INFO,procinfo
9
	
9
	
10
	mov	eax,[procinfo+70] ;staus of window
10
	mov	eax,[procinfo+70] ;staus of window
11
	test eax,100b
11
	test eax,100b
12
	jne	still
12
	jne	still
13
	
13
	
14
	call GetMouseCoordinats
14
	call GetMouseCoordinats
15
	mov	eax,[MouseX]
15
	mov	eax,[MouseX]
16
	mov	ebx,[MouseY]
16
	mov	ebx,[MouseY]
17
	mov	ecx,[WorkScreen_SizeX]
17
	mov	ecx,[WorkScreen_SizeX]
18
	mov	edx,[WorkScreen_SizeY]
18
	mov	edx,[WorkScreen_SizeY]
19
	add	ecx,ci_scrollh_coord_x_min
19
	add	ecx,ci_scrollh_coord_x_min
20
	add	edx,ci_scrollv_coord_y_min
20
	add	edx,ci_scrollv_coord_y_min
21
 
21
 
22
	cmp	eax,ecx
22
	cmp	eax,ecx
23
	jae	mouse_scroll
23
	jae	mouse_scroll
24
 
24
 
25
	cmp	ebx,edx
25
	cmp	ebx,edx
26
	jae	mouse_scroll
26
	jae	mouse_scroll
27
	jmp	no_scrollers
27
	jmp	no_scrollers
28
 
28
 
29
mouse_scroll:
29
mouse_scroll:
30
	mov	[exit_from_work_arrea],1 ;mouse situated after work arrea
30
	mov	[exit_from_work_arrea],1 ;mouse situated after work arrea
31
;scrollers
31
;scrollers
32
	call GetMouseClick
32
	call GetMouseClick
33
	cmp	eax,1
33
	cmp	eax,1
34
	jne	still
34
	jne	still
35
 
35
 
36
	call	GetMouseCoordinats
36
	call	GetMouseCoordinats
37
;interraction with horizontal scroller
37
;interraction with horizontal scroller
38
	mov	eax,[Scroll1CoordinatX]
38
	mov	eax,[Scroll1CoordinatX]
39
	mov	ebx,[Scroll1CoordinatY]
39
	mov	ebx,[Scroll1CoordinatY]
40
	mov	ecx,[MouseX]
40
	mov	ecx,[MouseX]
41
	mov	edx,[MouseY]
41
	mov	edx,[MouseY]
42
	mov	esi,[Scroll1MaxSizeX]
42
	mov	esi,[Scroll1MaxSizeX]
43
	mov	edi,[Scroll1MaxSizeY]
43
	mov	edi,[Scroll1MaxSizeY]
44
	call	columnus
44
	call	columnus
45
	test	eax,eax
45
	test	eax,eax
46
	jz	no_horizontal
46
	jz	no_horizontal
47
 
47
 
48
	mov	eax,ci_scrollh_coord_x_min
48
	mov	eax,ci_scrollh_coord_x_min
49
	mov	ebx,[Scroll1CoordinatY]
49
	mov	ebx,[Scroll1CoordinatY]
50
	mov	ecx,[Scroll1MaxSizeX]
50
	mov	ecx,[Scroll1MaxSizeX]
51
	inc ecx
51
	inc ecx
52
	mov	edx,ci_scroll_dim-6
52
	mov	edx,ci_scroll_dim-6
53
	mov	esi,7
53
	mov	esi,7
54
	call draw_volume_rectangle ; horizontal scrollbar clear
54
	call draw_volume_rectangle ; horizontal scrollbar clear
55
 
55
 
56
	mov	eax,[MouseX]
56
	mov	eax,[MouseX]
57
	mov	ebx,[Scroll1SizeX]
57
	mov	ebx,[Scroll1SizeX]
58
	shr	ebx,1
58
	shr	ebx,1
59
	sub	eax,ebx
59
	sub	eax,ebx
60
	mov	ecx,[MouseX]
60
	mov	ecx,[MouseX]
61
	add	ecx,ebx
61
	add	ecx,ebx
62
	mov	edx,ci_scrollh_coord_x_min
62
	mov	edx,ci_scrollh_coord_x_min
63
	add	edx,[Scroll1MaxSizeX]
63
	add	edx,[Scroll1MaxSizeX]
64
	mov	[Scroll1CoordinatX],eax
64
	mov	[Scroll1CoordinatX],eax
65
	sub	eax,ci_scrollh_coord_x_min
65
	sub	eax,ci_scrollh_coord_x_min
66
	jns	no_min_scroll
66
	jns	no_min_scroll
67
 
67
 
68
	mov	[Scroll1CoordinatX],ci_scrollh_coord_x_min
68
	mov	[Scroll1CoordinatX],ci_scrollh_coord_x_min
69
 
69
 
70
no_min_scroll:
70
no_min_scroll:
71
	cmp	ecx,edx
71
	cmp	ecx,edx
72
	jl	no_max_scroll
72
	jl	no_max_scroll
73
 
73
 
74
	sub	edx,ebx
74
	sub	edx,ebx
75
	sub	edx,ebx
75
	sub	edx,ebx
76
	mov	[Scroll1CoordinatX],edx
76
	mov	[Scroll1CoordinatX],edx
77
 
77
 
78
no_max_scroll:
78
no_max_scroll:
79
	mov	eax,[Scroll1CoordinatX]
79
	mov	eax,[Scroll1CoordinatX]
80
	sub	eax,ci_scrollh_coord_x_min
80
	sub	eax,ci_scrollh_coord_x_min
81
	mov	ebx,[Picture_SizeX]
81
	mov	ebx,[Picture_SizeX]
82
	imul	eax,ebx
82
	imul	eax,ebx
83
	mov	ebx,[Scroll1MaxSizeX]
83
	mov	ebx,[Scroll1MaxSizeX]
84
	cdq
84
	cdq
85
	idiv	ebx
85
	idiv	ebx
86
	mov	[PosX],eax
86
	mov	[PosX],eax
87
	jmp	no_vertical
87
	jmp	no_vertical
88
 
88
 
89
no_horizontal:
89
no_horizontal:
90
	mov	eax,[Scroll2CoordinatX]
90
	mov	eax,[Scroll2CoordinatX]
91
	mov	ebx,[Scroll2CoordinatY]
91
	mov	ebx,[Scroll2CoordinatY]
92
	mov	ecx,[MouseX]
92
	mov	ecx,[MouseX]
93
	mov	edx,[MouseY]
93
	mov	edx,[MouseY]
94
	mov	esi,[Scroll2MaxSizeX]
94
	mov	esi,[Scroll2MaxSizeX]
95
	mov	edi,[Scroll2MaxSizeY]
95
	mov	edi,[Scroll2MaxSizeY]
96
	call	columnus
96
	call	columnus
97
	test	eax,eax
97
	test	eax,eax
98
	jz	no_vertical
98
	jz	no_vertical
99
 
99
 
100
	mov	eax,[Scroll2CoordinatX]
100
	mov	eax,[Scroll2CoordinatX]
101
	mov	ebx,ci_scrollv_coord_y_min
101
	mov	ebx,ci_scrollv_coord_y_min
102
	mov	ecx,ci_scroll_dim-6
102
	mov	ecx,ci_scroll_dim-6
103
	mov	edx,[Scroll2MaxSizeY]
103
	mov	edx,[Scroll2MaxSizeY]
104
	inc edx
104
	inc edx
105
	mov	esi,7
105
	mov	esi,7
106
	call draw_volume_rectangle ; vertical scrollbar clear
106
	call draw_volume_rectangle ; vertical scrollbar clear
107
 
107
 
108
	mov	eax,[MouseY]
108
	mov	eax,[MouseY]
109
	mov	ebx,[Scroll2SizeY]
109
	mov	ebx,[Scroll2SizeY]
110
	shr	ebx,1
110
	shr	ebx,1
111
	sub	eax,ebx
111
	sub	eax,ebx
112
	mov	ecx,[MouseY]
112
	mov	ecx,[MouseY]
113
	add	ecx,ebx
113
	add	ecx,ebx
114
	mov	edx,ci_scrollv_coord_y_min
114
	mov	edx,ci_scrollv_coord_y_min
115
	add	edx,[Scroll2MaxSizeY]
115
	add	edx,[Scroll2MaxSizeY]
116
	mov	[Scroll2CoordinatY],eax
116
	mov	[Scroll2CoordinatY],eax
117
 
117
 
118
	sub	eax,ci_scrollv_coord_y_min
118
	sub	eax,ci_scrollv_coord_y_min
119
	jns	no_min_scroll2
119
	jns	no_min_scroll2
120
 
120
 
121
	mov	[Scroll2CoordinatY],ci_scrollv_coord_y_min
121
	mov	[Scroll2CoordinatY],ci_scrollv_coord_y_min
122
 
122
 
123
no_min_scroll2:
123
no_min_scroll2:
124
	cmp	ecx,edx
124
	cmp	ecx,edx
125
	jl	no_max_scroll2
125
	jl	no_max_scroll2
126
 
126
 
127
	sub	edx,ebx
127
	sub	edx,ebx
128
	sub	edx,ebx
128
	sub	edx,ebx
129
	mov	[Scroll2CoordinatY],edx
129
	mov	[Scroll2CoordinatY],edx
130
 
130
 
131
no_max_scroll2:
131
no_max_scroll2:
132
	mov	eax,[Scroll2CoordinatY]
132
	mov	eax,[Scroll2CoordinatY]
133
	sub	eax,ci_scrollv_coord_y_min
133
	sub	eax,ci_scrollv_coord_y_min
134
	mov	ebx,[Picture_SizeY]
134
	mov	ebx,[Picture_SizeY]
135
	imul	eax,ebx
135
	imul	eax,ebx
136
	mov	ebx,[Scroll2MaxSizeY]
136
	mov	ebx,[Scroll2MaxSizeY]
137
	cdq
137
	cdq
138
	idiv	ebx
138
	idiv	ebx
139
	mov	[PosY],eax
139
	mov	[PosY],eax
140
 
140
 
141
no_vertical:
141
no_vertical:
142
	call	CalculatePositionScreen
142
	call	CalculatePositionScreen
143
	call	draw_scrollers
143
	call	draw_scrollers
144
	call	MovePictureToWorkScreen
144
	call	MovePictureToWorkScreen
145
	jmp	still
145
	jmp	still
146
 
146
 
147
no_scrollers:
147
no_scrollers:
148
	mov	eax,[MouseX]
148
	mov	eax,[MouseX]
149
	mov	ebx,[MouseY]
149
	mov	ebx,[MouseY]
150
	mov	ecx,[Window_SizeX]
150
	mov	ecx,[Window_SizeX]
151
	mov	edx,[Window_SizeY]
151
	mov	edx,[Window_SizeY]
152
	sub	ecx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_w
152
	sub	ecx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_w
153
	sub	edx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_h
153
	sub	edx,ci_scroll_dim+ci_edit_wnd_border+5+ci_offs_skin_h
154
 
154
 
155
	cmp	eax,ci_scrollh_coord_x_min
155
	cmp	eax,ci_scrollh_coord_x_min
156
	jle	not_work_arrea
156
	jle	not_work_arrea
157
 
157
 
158
	cmp	eax,ecx
158
	cmp	eax,ecx
159
	jae	not_work_arrea
159
	jae	not_work_arrea
160
 
160
 
161
	cmp	ebx,ci_scrollv_coord_y_min
161
	cmp	ebx,ci_scrollv_coord_y_min
162
	jle	not_work_arrea
162
	jle	not_work_arrea
163
 
163
 
164
	cmp	ebx,edx
164
	cmp	ebx,edx
165
	jae	not_work_arrea
165
	jae	not_work_arrea
166
	jmp	mouse_in_work_arrea
166
	jmp	mouse_in_work_arrea
167
 
167
 
168
not_work_arrea:
168
not_work_arrea:
169
	mov	[exit_from_work_arrea],1
169
	mov	[exit_from_work_arrea],1
170
	mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor
170
	mcall SF_MOUSE_GET, SSF_SET_CURSOR, 0 ;set standart cursor
171
	jmp	still
171
	jmp	still
172
 
172
 
173
mouse_in_work_arrea:
173
mouse_in_work_arrea:
174
	call	GetScreenCordinats
174
	call	GetScreenCordinats
175
	call	PrintMousePos
175
	call	PrintMousePos
176
 
176
 
177
	;set cursor for current instrument
177
	;set cursor for current instrument
178
	mov eax,CursorsID
178
	mov eax,CursorsID
179
	mov ebx,[Current_instrument]
179
	mov ebx,[Current_instrument]
180
	call set_cursor
180
	call set_cursor
181
 
181
 
182
	call	GetMouseClick
182
	call	GetMouseClick
183
	test	eax,eax
183
	test	eax,eax
184
	jz	no_use_instruments
184
	jz	no_use_instruments
185
 
185
 
186
	cmp	[Activate_instrument],0
186
	cmp	[Activate_instrument],0
187
	jnz	no_undo___
187
	jnz	no_undo___
188
;------------begin copy for undo-------------
188
;------------begin copy for undo-------------
189
;copy bufer_0 -> bufer_2
189
;copy bufer_0 -> bufer_2
190
	mov edi,[PointerToCopyPicture2]
190
	mov edi,[PointerToCopyPicture2]
191
	mov esi,[PointerToPicture]
191
	mov esi,[PointerToPicture]
192
	mov ecx,[Picture_SizeX]
192
	mov ecx,[Picture_SizeX]
193
	imul ecx,[Picture_SizeY]
193
	imul ecx,[Picture_SizeY]
194
	lea ecx,[ecx+ecx*2]
194
	lea ecx,[ecx+ecx*2]
195
	mov ebx,ecx
195
	mov ebx,ecx
196
	shr ecx,2
196
	shr ecx,2
197
	cld
197
	cld
198
	rep movsd
198
	rep movsd
199
	mov ecx,ebx
199
	mov ecx,ebx
200
	and ecx,3
200
	and ecx,3
201
	rep movsb
201
	rep movsb
202
;rotate bufers +1
202
;rotate bufers +1
203
	and	[number_undo],0 ;erase all undo
203
	and	[number_undo],0 ;erase all undo
204
	mov eax,[PointerToPicture]
204
	mov eax,[PointerToPicture]
205
	mov ebx,[PointerToCopyPicture]
205
	mov ebx,[PointerToCopyPicture]
206
	mov ecx,[PointerToCopyPicture2]
206
	mov ecx,[PointerToCopyPicture2]
207
	mov [PointerToPicture],ecx
207
	mov [PointerToPicture],ecx
208
	mov [PointerToCopyPicture],eax
208
	mov [PointerToCopyPicture],eax
209
	mov [PointerToCopyPicture2],ebx
209
	mov [PointerToCopyPicture2],ebx
210
;--------------end copy for undo-------------
210
;--------------end copy for undo-------------
211
no_undo___:
211
no_undo___:
212
	call TakeButtonInstruments
212
	call TakeButtonInstruments
-
 
213
 
213
	jmp still
214
	jmp still
214
 
215
 
215
no_use_instruments:
216
no_use_instruments:
216
	mov	eax,[Current_instrument]
217
	mov	eax,[Current_instrument]
217
	and	[Activate_instrument],0
218
	and	[Activate_instrument],0
218
	jmp	still
219
	jmp	still
219
;-----------------------------------------------
220
;-----------------------------------------------
220
;---------get mouse cordinats-------------------
221
;---------get mouse cordinats-------------------
221
;-----------------------------------------------
222
;-----------------------------------------------
222
GetMouseCoordinats:
223
GetMouseCoordinats:
223
	mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
224
	mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
224
	mov	ebx,eax
225
	mov	ebx,eax
225
	shr	eax,16
226
	shr	eax,16
226
	and	ebx,0xffff
227
	and	ebx,0xffff
227
	mov	[MouseX],eax
228
	mov	[MouseX],eax
228
	mov	[MouseY],ebx
229
	mov	[MouseY],ebx
229
	ret
230
	ret
230
;------------------------------------------------
231
;------------------------------------------------
231
;-------get mouse attributs----------------------
232
;-------get mouse attributs----------------------
232
;------------------------------------------------
233
;------------------------------------------------
233
GetMouseClick:
234
GetMouseClick:
234
	mcall SF_MOUSE_GET,SSF_BUTTON
235
	mcall SF_MOUSE_GET,SSF_BUTTON
235
	ret
236
	ret