Subversion Repositories Kolibri OS

Rev

Rev 280 | Rev 617 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 280 Rev 297
Line 1... Line 1...
1
func check_mouse_in_edit_area
1
func check_mouse_in_edit_area
2
	mcall	37,1
2
	mcall	37,1
3
	mov	ebx,eax
3
	mov	ebx,eax
4
	and	ebx,0x0000FFFF
4
	and	ebx,0x0000FFFF
5
	shr	eax,16
5
	shr	eax,16
6
	mov	ecx,[cur_editor.Bounds.Top] ; ecx,[top_ofs]
6
	mov	ecx,[cur_editor.Bounds.Top]
7
	inc	ecx
7
	inc	ecx
8
	pushd	[cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx ; [left_ofs] ATOPH [p_info.client_box.width] ATOPH
8
	pushd	[cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx
9
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
9
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
10
	sub	[__rc+0x8],SCRLW+6
10
	sub	[__rc+0x8],SCRLW+6
11
	mov	ecx,[cur_editor.Gutter.Width]
11
	mov	ecx,[cur_editor.Gutter.Width]
12
	add	[__rc+0x0],ecx
12
	add	[__rc+0x0],ecx
13
	imul	ecx,[lines.scr],LINEH
13
	imul	ecx,[lines.scr],LINEH
Line 67... Line 67...
67
	mcall	9,p_info,-1
67
	mcall	9,p_info,-1
68
	cmp	ax,[p_info.window_stack_position]
68
	cmp	ax,[p_info.window_stack_position]
69
	pop	eax
69
	pop	eax
70
	jne	still.skip_write
70
	jne	still.skip_write
71
    @@:
71
    @@:
72
	cmp	[just_from_popup],0
72
;!!!        cmp     [just_from_popup],0
73
	je	@f
73
;!!!        je      @f
74
	cmp	al,MEV_LUP
74
;!!!        cmp     al,MEV_LUP
75
	jne	still.skip_write
75
;!!!        jne     still.skip_write
76
    @@: mov	[mev],al
76
    @@: mov	[mev],al
77
	jmp	[mouse_ev+eax*4-4]
77
	jmp	[mouse_ev+eax*4-4]
Line 78... Line 78...
78
 
78
 
79
  .move:
79
  .move:
Line 99... Line 99...
99
	mov	[mi_cur],eax
99
	mov	[mi_cur],eax
100
    @@: call	draw_main_menu
100
    @@: call	draw_main_menu
101
	pop	[mi_cur]
101
	pop	[mi_cur]
102
	cmp	[popup_active],0
102
	cmp	[popup_active],0
103
	je	still.skip_write
103
	je	still.skip_write
104
;        mcall   18,2,[h_popup]
-
 
105
	mov	ecx,[mi_cur]
104
	mov	ecx,[mi_cur]
106
	or	ecx,ecx
105
	or	ecx,ecx
107
	js	still.skip_write
106
	js	still.skip_write
108
	mov	eax,[main_menu.popups+ecx*4-4]
107
	mov	eax,[main_menu.popups+ecx*4-4]
109
	mov	edx,main_menu
108
	mov	edx,main_menu
110
	call	dword[main_menu.onshow+ecx*4-4]
109
	call	dword[main_menu.onshow+ecx*4-4]
111
	call	setup_main_menu_popup
110
	call	setup_main_menu_popup
112
	mcall	60,2,[h_popup],POPUP_STACK,4
111
	mcall	60,2,[h_popup],POPUP_STACK,4
113
;       mcall   51,1,popup_thread_start,POPUP_STACK
-
 
Line 114... Line 112...
114
 
112
 
Line 115... Line 113...
115
	jmp	still.skip_write
113
	jmp	still.skip_write
Line 148... Line 146...
148
	mov	[body_capt],1
146
	mov	[body_capt],1
Line 149... Line 147...
149
 
147
 
Line 150... Line 148...
150
	call	clear_selection
148
	call	clear_selection
151
 
149
 
152
  .check_body.2:
150
  .check_body.2:
153
	sub	eax,[cur_editor.Bounds.Left] ; eax,[left_ofs]
151
	sub	eax,[cur_editor.Bounds.Left]
154
	sub	ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs]
152
	sub	ebx,[cur_editor.Bounds.Top]
155
	sub	eax,[cur_editor.Gutter.Width]
153
	sub	eax,[cur_editor.Gutter.Width]
156
	sub	eax,LCHGW
-
 
157
	sub	ebx,2
154
	sub	eax,LCHGW
158
;       sub     ebx,[__rc+0x4]
155
	sub	ebx,2
159
	push	eax
156
	push	eax
160
	mov	eax,ebx
157
	mov	eax,ebx
161
	cdq;xor     edx,edx
158
	cdq
162
	mov	ecx,LINEH
159
	mov	ecx,LINEH
163
	idiv	ecx
160
	idiv	ecx
164
    @@: add	eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
161
    @@: add	eax,[cur_editor.TopLeft.Y]
165
	mov	ebx,eax
162
	mov	ebx,eax
166
	pop	eax
163
	pop	eax
167
	cdq;xor     edx,edx
164
	cdq
168
	mov	ecx,6
165
	mov	ecx,6
Line 169... Line 166...
169
	idiv	ecx
166
	idiv	ecx
170
    @@: add	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
167
    @@: add	eax,[cur_editor.TopLeft.X]
171
 
168
 
172
	cmp	eax,[cur_editor.Columns.Count] ;! eax,[columns]
169
	cmp	eax,[cur_editor.Columns.Count]
173
	jl	@f
170
	jl	@f
174
	mov	eax,[cur_editor.Columns.Count] ;! eax,[columns]
171
	mov	eax,[cur_editor.Columns.Count]
175
    @@: cmp	ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
172
    @@: cmp	ebx,[cur_editor.Lines.Count]
176
	jl	@f
173
	jl	@f
177
	mov	ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
174
	mov	ebx,[cur_editor.Lines.Count]
178
	dec	ebx
175
	dec	ebx
179
    @@:
176
    @@:
-
 
177
	cmp	[cur_editor.Caret.X],eax
-
 
178
	jne	.change_cur_pos
180
	cmp	[cur_editor.Caret.X],eax ;! [pos.x],eax
179
	cmp	[cur_editor.Caret.Y],ebx
Line 181... Line 180...
181
	jne	.change_cur_pos
180
	jne	.change_cur_pos
182
	cmp	[cur_editor.Caret.Y],ebx ;! [pos.y],ebx
181
	call	editor_check_for_changes
183
	je	still.skip_write
-
 
184
 
182
	jmp	still.skip_write
185
  .change_cur_pos:
183
 
186
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
-
 
187
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
-
 
188
	mov	[cur_editor.Caret.Y],ebx ;! [pos.y],ebx
-
 
189
	call	check_cur_vis_inv
-
 
190
	jc	.check_ldown
-
 
191
;        cmp     eax,ebx
-
 
192
;        je      @f
-
 
193
;        push    ebx
-
 
194
;        mov     ebx,eax
-
 
195
;        call    drawfile.ex
-
 
196
;        pop     eax
184
  .change_cur_pos:
Line 197... Line 185...
197
;    @@: mov     ebx,eax
185
	mov	[cur_editor.Caret.X],eax
198
	call	draw_file.ex
-
 
199
  .check_ldown:
186
	mov	[cur_editor.Caret.Y],ebx
200
	jmp	still
187
	call	editor_check_for_changes
201
 
188
	jmp	still
202
  .check_vscroll:
189
 
203
	;mov     ecx,[p_info.client_box.width]
190
  .check_vscroll:
204
	mov	ecx,[cur_editor.Bounds.Right]
191
	mov	ecx,[cur_editor.Bounds.Right]
205
	sub	ecx,SCRLW-1;2
192
	sub	ecx,SCRLW-1
206
	pushd	ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom] ;ecx [top_ofs] ecx [bot_ofs]
193
	pushd	ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom]
207
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
194
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
208
	add	[__rc+0x8],SCRLW-2;!!!!!!!!!!!!!!-2
195
	add	[__rc+0x8],SCRLW-2
Line 209... Line 196...
209
	add	[__rc+0x4],SCRLW-1;!!!!!!!!!!!!!!+1
196
	add	[__rc+0x4],SCRLW-1
210
	sub	[__rc+0xC],SCRLW*2+1;3
197
	sub	[__rc+0xC],SCRLW*2+1
211
	mov	ecx,__rc
198
	mov	ecx,__rc
212
	call	pt_in_rect
-
 
213
	jnc	.check_hscroll
199
	call	pt_in_rect
214
 
200
	jnc	.check_hscroll
215
  .check_vscroll.2:
201
 
216
	sub	ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs]
202
  .check_vscroll.2:
217
	sub	ebx,SCRLW;!!!!!!!!!!!!!!+1
203
	sub	ebx,[cur_editor.Bounds.Top]
218
;       sub     ebx,[__rc+0x4]
204
	sub	ebx,SCRLW
219
	cmp	[vscrl_capt],0
205
	cmp	[vscrl_capt],0
220
	jge	.vcaptured
206
	jge	.vcaptured
221
	mov	eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
207
	mov	eax,[cur_editor.VScroll.Top]
222
	cmp	ebx,eax
208
	cmp	ebx,eax
223
	jb	.center_vcapture
209
	jb	.center_vcapture
224
	add	eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
210
	add	eax,[cur_editor.VScroll.Size]
225
	cmp	ebx,eax
211
	cmp	ebx,eax
226
	jae	.center_vcapture
212
	jae	.center_vcapture
227
	mov	eax,ebx
213
	mov	eax,ebx
228
	sub	eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
214
	sub	eax,[cur_editor.VScroll.Top]
229
	dec	eax
215
	dec	eax
230
	mov	[vscrl_capt],eax
216
	mov	[vscrl_capt],eax
231
	dec	ebx
217
	dec	ebx
232
	jmp	.vcaptured
218
	jmp	.vcaptured
233
  .center_vcapture:
219
  .center_vcapture:
234
	mov	eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
220
	mov	eax,[cur_editor.VScroll.Size]
235
	shr	eax,1
221
	shr	eax,1
236
	mov	[vscrl_capt],eax
222
	mov	[vscrl_capt],eax
237
  .vcaptured:
223
  .vcaptured:
238
	sub	ebx,[vscrl_capt]
224
	sub	ebx,[vscrl_capt]
239
	jns	@f
225
	jns	@f
240
	xor	ebx,ebx
226
	xor	ebx,ebx
241
    @@: mov	[mouse_captured],1
227
    @@: mov	[mouse_captured],1
242
	mov	eax,[cur_editor.Bounds.Bottom] ; eax,[bot_ofs]
228
	mov	eax,[cur_editor.Bounds.Bottom]
243
	sub	eax,[cur_editor.Bounds.Top] ; eax,[top_ofs]
229
	sub	eax,[cur_editor.Bounds.Top]
244
	sub	eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
230
	sub	eax,[cur_editor.VScroll.Size]
245
	sub	eax,SCRLW*3;-2
231
	sub	eax,SCRLW*3
246
	cmp	eax,ebx
232
	cmp	eax,ebx
247
	jge	@f
233
	jge	@f
248
	mov	ebx,eax
234
	mov	ebx,eax
249
    @@:
235
    @@:
250
	mov	[cur_editor.VScroll.Top],ebx ;! [vscrl_top],ebx
236
	mov	[cur_editor.VScroll.Top],ebx
251
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
237
	mov	eax,[cur_editor.Lines.Count]
252
	sub	eax,[lines.scr]
238
	sub	eax,[lines.scr]
253
	imul	ebx
239
	imul	ebx
254
	mov	ebx,[cur_editor.Bounds.Bottom] ; ebx,[bot_ofs]
240
	mov	ebx,[cur_editor.Bounds.Bottom]
255
	sub	ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs]
241
	sub	ebx,[cur_editor.Bounds.Top]
256
	sub	ebx,SCRLW*3;-2         ;**
242
	sub	ebx,SCRLW*3
257
	sub	ebx,[cur_editor.VScroll.Size] ;! ebx,[vscrl_size]
243
	sub	ebx,[cur_editor.VScroll.Size]
258
	idiv	ebx
244
	idiv	ebx
Line 259... Line 245...
259
	cmp	eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
245
	cmp	eax,[cur_editor.TopLeft.Y]
260
	je	still.skip_write
246
	je	still.skip_write
261
	mov	[cur_editor.TopLeft.Y],eax ;! [top_line],eax
247
	mov	[cur_editor.TopLeft.Y],eax
262
	call	check_bottom_right
248
	call	check_bottom_right
263
	call	draw_file
249
	call	draw_editor
264
	jmp	still.skip_write
250
	jmp	still.skip_write
265
 
251
 
Line 274... Line 260...
274
	call	pt_in_rect
260
	call	pt_in_rect
275
	jnc	.check_main_menu
261
	jnc	.check_main_menu
Line 276... Line 262...
276
 
262
 
277
  .check_hscroll.2:
263
  .check_hscroll.2:
278
	mov	ebx,eax
-
 
279
	;sub     ebx,(5+SCRLW+1)
264
	mov	ebx,eax
280
	sub	ebx,SCRLW+1
265
	sub	ebx,SCRLW+1
281
	sub	ebx,[cur_editor.Bounds.Left]
-
 
282
;       sub     ebx,[__rc+0x0]
266
	sub	ebx,[cur_editor.Bounds.Left]
283
	cmp	[hscrl_capt],0
267
	cmp	[hscrl_capt],0
284
	jge	.hcaptured
268
	jge	.hcaptured
285
	mov	eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
269
	mov	eax,[cur_editor.HScroll.Top]
286
	cmp	ebx,eax
270
	cmp	ebx,eax
287
	jl	.center_hcapture
271
	jl	.center_hcapture
288
	add	eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
272
	add	eax,[cur_editor.HScroll.Size]
289
	cmp	ebx,eax
273
	cmp	ebx,eax
290
	jge	.center_hcapture
274
	jge	.center_hcapture
291
	mov	eax,ebx
275
	mov	eax,ebx
292
	sub	eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
276
	sub	eax,[cur_editor.HScroll.Top]
293
	dec	eax
277
	dec	eax
294
	mov	[hscrl_capt],eax
278
	mov	[hscrl_capt],eax
295
	dec	ebx
279
	dec	ebx
296
	jmp	.hcaptured
280
	jmp	.hcaptured
297
  .center_hcapture:
281
  .center_hcapture:
298
	mov	eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
282
	mov	eax,[cur_editor.HScroll.Size]
299
	shr	eax,1
283
	shr	eax,1
300
	mov	[hscrl_capt],eax
284
	mov	[hscrl_capt],eax
301
  .hcaptured:
285
  .hcaptured:
302
	sub	ebx,[hscrl_capt]
286
	sub	ebx,[hscrl_capt]
303
	jns	@f
287
	jns	@f
304
	xor	ebx,ebx
288
	xor	ebx,ebx
305
    @@: mov	[mouse_captured],1
289
    @@: mov	[mouse_captured],1
306
	mov	eax,[cur_editor.Bounds.Right] ; eax,[p_info.box.width]
290
	mov	eax,[cur_editor.Bounds.Right]
307
	sub	eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
291
	sub	eax,[cur_editor.HScroll.Size]
308
	sub	eax,SCRLW*3+1 ; eax,SCRLW*3+10+1
292
	sub	eax,SCRLW*3+1
309
	cmp	eax,ebx
293
	cmp	eax,ebx
310
	jge	@f
294
	jge	@f
311
	mov	ebx,eax
295
	mov	ebx,eax
312
    @@:
296
    @@:
313
	mov	[cur_editor.HScroll.Top],ebx ;! [hscrl_top],ebx
297
	mov	[cur_editor.HScroll.Top],ebx
314
	mov	eax,[cur_editor.Columns.Count] ;! eax,[columns]
298
	mov	eax,[cur_editor.Columns.Count]
315
	sub	eax,[columns.scr]
299
	sub	eax,[columns.scr]
316
	imul	ebx
300
	imul	ebx
317
	mov	ebx,[cur_editor.Bounds.Right] ; ebx,[p_info.box.width]
301
	mov	ebx,[cur_editor.Bounds.Right]
318
	sub	ebx,SCRLW*3+1 ; ebx,SCRLW*3+10+1        ;**
302
	sub	ebx,SCRLW*3+1
319
	sub	ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size]
303
	sub	ebx,[cur_editor.HScroll.Size]
320
	idiv	ebx
304
	idiv	ebx
321
	cmp	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
305
	cmp	eax,[cur_editor.TopLeft.X]
322
	je	still.skip_write
306
	je	still.skip_write
323
	mov	[cur_editor.TopLeft.X],eax ;! [left_col],eax
307
	mov	[cur_editor.TopLeft.X],eax
324
	call	check_bottom_right
308
	call	check_bottom_right
325
	call	draw_file
309
	call	draw_editor
Line 326... Line 310...
326
	jmp	still.skip_write
310
	jmp	still.skip_write
327
 
311
 
328
  .check_main_menu:
312
  .check_main_menu:
Line 351... Line 335...
351
	or	eax,-1
335
	or	eax,-1
352
	mov	[vscrl_capt],eax
336
	mov	[vscrl_capt],eax
353
	mov	[hscrl_capt],eax
337
	mov	[hscrl_capt],eax
354
	mov	[body_capt],eax
338
	mov	[body_capt],eax
355
	mov	[mouse_captured],0
339
	mov	[mouse_captured],0
356
	mov	[just_from_popup],0
340
;!!!        mov     [just_from_popup],0
357
	jmp	still.skip_write
341
	jmp	still.skip_write