Subversion Repositories Kolibri OS

Rev

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

Rev 2065 Rev 4665
1
diff16 'tp-mouse.asm',0,$
1
diff16 'tp-mouse.asm',0,$
2
 
2
 
3
proc check_mouse_in_edit_area
3
proc check_mouse_in_edit_area
4
	mcall	37,1
4
	mcall	37,1
5
	mov	ebx,eax
5
	mov	ebx,eax
6
	and	ebx,0x0000FFFF
6
	and	ebx,0x0000FFFF
7
	shr	eax,16
7
	shr	eax,16
8
	mov	ecx,[cur_editor.Bounds.Top]
8
	mov	ecx,[cur_editor.Bounds.Top]
9
	inc	ecx
9
	inc	ecx
10
	pushd	[cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx
10
	pushd	[cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx
11
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
11
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
12
	sub	[__rc+0x8],SCRLW+6
12
	sub	[__rc+0x8],SCRLW+6
13
	mov	ecx,[cur_editor.Gutter.Width]
13
	mov	ecx,[cur_editor.Gutter.Width]
14
	add	[__rc+0x0],ecx
14
	add	[__rc+0x0],ecx
15
	imul	ecx,[lines.scr],LINEH
15
	imul	ecx,[lines.scr],LINEH
16
	dec	ecx
16
	dec	ecx
17
	add	[__rc+0xC],ecx
17
	add	[__rc+0xC],ecx
18
	mov	ecx,__rc
18
	mov	ecx,__rc
19
	call	pt_in_rect
19
	call	pt_in_rect
20
	ret
20
	ret
21
endp
21
endp
22
 
22
 
23
proc get_mouse_event
23
proc get_mouse_event
24
	mcall	37,2
24
	mcall	37,2
25
	and	al,3
25
	and	al,3
26
	mov	bl,[ecx]
26
	mov	bl,[ecx]
27
	cmp	[ecx],al
27
	cmp	[ecx],al
28
	mov	[ecx],al
28
	mov	[ecx],al
29
	jne	@f
29
	jne	@f
30
	mcall	37,7
30
	mcall	37,7
31
	or	eax,eax
31
	or	eax,eax
32
	jz	.mv
32
	jz	.mv
33
	add	[ecx+6],ax
33
	add	[ecx+6],ax
34
	shr	eax,16
34
	shr	eax,16
35
	add	[ecx+4],ax
35
	add	[ecx+4],ax
36
	mov	eax,MEV_WHEEL
36
	mov	eax,MEV_WHEEL
37
	ret
37
	ret
38
  .mv:	mov	eax,MEV_MOVE
38
  .mv:	mov	eax,MEV_MOVE
39
	ret
39
	ret
40
    @@: mov	bh,al
40
    @@: mov	bh,al
41
	and	ebx,0x0101
41
	and	ebx,0x0101
42
	cmp	bl,bh
42
	cmp	bl,bh
43
	je	.rb
43
	je	.rb
44
	test	al,1
44
	test	al,1
45
	jz	@f
45
	jz	@f
46
	mov	eax,MEV_LDOWN
46
	mov	eax,MEV_LDOWN
47
	ret
47
	ret
48
    @@: mov	eax,MEV_LUP
48
    @@: mov	eax,MEV_LUP
49
	ret
49
	ret
50
  .rb:	test	al,2
50
  .rb:	test	al,2
51
	jz	@f
51
	jz	@f
52
	mov	eax,MEV_RDOWN
52
	mov	eax,MEV_RDOWN
53
	ret
53
	ret
54
    @@: mov	eax,MEV_RUP
54
    @@: mov	eax,MEV_RUP
55
	ret
55
	ret
56
endp
56
endp
57
 
57
 
58
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.wheel,mouse.move
58
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.wheel,mouse.move
59
 
59
 
60
mouse:
60
mouse:
61
 
61
 
62
	mcall	9,p_info,-1
62
	mcall	9,p_info,-1
63
	
63
	
64
	mov	eax,[p_info+70] ;status of window
64
	mov	eax,[p_info+70] ;status of window
65
	test	eax,100b
65
	test	eax,100b
66
	jne	still.skip_write	
66
	jne	still.skip_write	
67
	
67
	
68
	mov	ecx,mst
68
	mov	ecx,mst
69
	call	get_mouse_event
69
	call	get_mouse_event
70
	cmp	[bot_mode],0
70
	cmp	[bot_mode],0
71
	je	@f
71
	je	@f
72
	mov	ah,al
72
	mov	ah,al
73
	mov	al,4
73
	mov	al,4
74
	call	[bot_dlg_handler]
74
	call	[bot_dlg_handler]
75
	jmp	still.skip_write
75
	jmp	still.skip_write
76
    @@: cmp	al,MEV_MOVE
76
    @@: cmp	al,MEV_MOVE
77
	jne	.no_move
77
	jne	.no_move
78
	cmp	[popup_active],1
78
	cmp	[popup_active],1
79
	je	@f
79
	je	@f
80
  .no_move:
80
  .no_move:
81
	mov	[s_status],0
81
	mov	[s_status],0
82
 
82
 
83
	push	eax
83
	push	eax
84
	mcall	9,p_info,-1
84
	mcall	9,p_info,-1
85
	cmp	ax,[p_info.window_stack_position]
85
	cmp	ax,[p_info.window_stack_position]
86
	pop	eax
86
	pop	eax
87
	jne	still.skip_write
87
	jne	still.skip_write
88
    @@:
88
    @@:
89
;!!!        cmp     [just_from_popup],0
89
;!!!        cmp     [just_from_popup],0
90
;!!!        je      @f
90
;!!!        je      @f
91
;!!!        cmp     al,MEV_LUP
91
;!!!        cmp     al,MEV_LUP
92
;!!!        jne     still.skip_write
92
;!!!        jne     still.skip_write
93
    @@: mov	[mev],al
93
    @@: mov	[mev],al
94
	jmp	[mouse_ev+eax*4-4]
94
	jmp	[mouse_ev+eax*4-4]
95
 
95
 
96
  .wheel:
96
  .wheel:
97
	movsx	eax,word[mst+4]
97
	movsx	eax,word[mst+4]
98
	lea	eax,[eax*3]
98
	lea	eax,[eax*3]
99
	add	[cur_editor.TopLeft.X],eax
99
	add	[cur_editor.TopLeft.X],eax
100
	movsx	eax,word[mst+6]
100
	movsx	eax,word[mst+6]
101
	lea	eax,[eax*3]
101
	lea	eax,[eax*3]
102
	add	[cur_editor.TopLeft.Y],eax
102
	add	[cur_editor.TopLeft.Y],eax
103
	xor	eax,eax
103
	xor	eax,eax
104
	mov	[mst+4],eax
104
	mov	[mst+4],eax
105
	call	check_bottom_right
105
	call	check_bottom_right
106
	call	draw_editor
106
	call	draw_editor
107
	jmp	still.skip_write
107
	jmp	still.skip_write
108
 
108
 
109
  .move:
109
  .move:
110
	mcall	37,1
110
	mcall	37,1
111
	movsx	ebx,ax
111
	movsx	ebx,ax
112
	sar	eax,16
112
	sar	eax,16
113
	cmp	[body_capt],0
113
	cmp	[body_capt],0
114
	jge	.check_body.2
114
	jge	.check_body.2
115
	cmp	[vscrl_capt],0
115
	cmp	[vscrl_capt],0
116
	jge	.check_vscroll.2
116
	jge	.check_vscroll.2
117
	cmp	[hscrl_capt],0
117
	cmp	[hscrl_capt],0
118
	jge	.check_hscroll.2
118
	jge	.check_hscroll.2
119
 
119
 
120
	cmp	[do_not_draw],0
120
	cmp	[do_not_draw],0
121
	jne	still.skip_write
121
	jne	still.skip_write
122
	mov	eax,[mi_cur]
122
	mov	eax,[mi_cur]
123
	call	get_active_menu_item
123
	call	get_active_menu_item
124
	cmp	eax,[mi_cur]
124
	cmp	eax,[mi_cur]
125
	je	still.skip_write
125
	je	still.skip_write
126
	push	[mi_cur]
126
	push	[mi_cur]
127
	cmp	[popup_active],0
127
	cmp	[popup_active],0
128
	je	@f
128
	je	@f
129
	mov	[mi_cur],eax
129
	mov	[mi_cur],eax
130
    @@: call	draw_main_menu
130
    @@: call	draw_main_menu
131
	pop	[mi_cur]
131
	pop	[mi_cur]
132
	cmp	[popup_active],0
132
	cmp	[popup_active],0
133
	je	still.skip_write
133
	je	still.skip_write
134
	mov	ecx,[mi_cur]
134
	mov	ecx,[mi_cur]
135
	or	ecx,ecx
135
	or	ecx,ecx
136
	js	still.skip_write
136
	js	still.skip_write
137
	mov	eax,[main_menu.popups+ecx*4-4]
137
	mov	eax,[main_menu.popups+ecx*4-4]
138
	mov	edx,main_menu
138
	mov	edx,main_menu
139
	call	dword[main_menu.onshow+ecx*4-4]
139
	call	dword[main_menu.onshow+ecx*4-4]
140
	call	setup_main_menu_popup
140
	call	setup_main_menu_popup
141
	mcall	60,2,[h_popup],POPUP_STACK,4
141
	mcall	60,2,[h_popup],POPUP_STACK,4
-
 
142
	
-
 
143
	call draw_main_menu
142
 
144
 
143
	jmp	still.skip_write
145
	jmp	still.skip_write
144
 
146
 
145
 
147
 
146
  .r_down:
148
  .r_down:
147
    @@: cmp	[popup_active],0
149
    @@: cmp	[popup_active],0
148
	je	@f
150
	je	@f
149
	mcall	5,1
151
	mcall	5,1
150
	jmp	@b
152
	jmp	@b
151
    @@: cmp	[mouse_captured],0
153
    @@: cmp	[mouse_captured],0
152
	jne	still.skip_write
154
	jne	still.skip_write
153
	call	check_mouse_in_edit_area
155
	call	check_mouse_in_edit_area
154
	jnc	still.skip_write
156
	jnc	still.skip_write
155
	mcall	37,0
157
	mcall	37,0
156
	mov	[mm.Edit+POPUP.pos],eax
158
	mov	[mm.Edit+POPUP.pos],eax
157
    @@: mcall	37,2
159
    @@: mcall	37,2
158
	cmp	eax,ebx
160
	cmp	eax,ebx
159
	jnz	@f
161
	jnz	@f
160
	mcall	5,1
162
	mcall	5,1
161
	jmp	@b
163
	jmp	@b
162
    @@: and	[mst],0xFD
164
    @@: and	[mst],0xFD
163
	call	onshow.edit
165
	call	onshow.edit
164
	mov	dword[POPUP_STACK],mm.Edit
166
	mov	dword[POPUP_STACK],mm.Edit
165
	mcall	51,1,popup_thread_start,POPUP_STACK
167
	mcall	51,1,popup_thread_start,POPUP_STACK
166
	mov	[h_popup],eax
168
	mov	[h_popup],eax
167
	jmp	still.skip_write
169
	jmp	still.skip_write
168
 
170
 
169
  .r_up:
171
  .r_up:
170
	jmp	still.skip_write
172
	jmp	still.skip_write
171
 
173
 
172
  .l_down:
174
  .l_down:
173
	call	check_mouse_in_edit_area
175
	call	check_mouse_in_edit_area
174
	jnc	.check_vscroll
176
	jnc	.check_vscroll
175
	mov	[mouse_captured],1
177
	mov	[mouse_captured],1
176
	mov	[body_capt],1
178
	mov	[body_capt],1
177
 
179
 
178
	call	clear_selection
180
	call	clear_selection
179
 
181
 
180
  .check_body.2:
182
  .check_body.2:
181
	sub	eax,[cur_editor.Bounds.Left]
183
	sub	eax,[cur_editor.Bounds.Left]
182
	sub	ebx,[cur_editor.Bounds.Top]
184
	sub	ebx,[cur_editor.Bounds.Top]
183
	sub	eax,[cur_editor.Gutter.Width]
185
	sub	eax,[cur_editor.Gutter.Width]
184
	sub	eax,LCHGW
186
	sub	eax,LCHGW
185
	sub	ebx,2
187
	sub	ebx,2
186
	push	eax
188
	push	eax
187
	mov	eax,ebx
189
	mov	eax,ebx
188
	cdq
190
	cdq
189
	mov	ecx,LINEH
191
	mov	ecx,LINEH
190
	idiv	ecx
192
	idiv	ecx
191
    @@: add	eax,[cur_editor.TopLeft.Y]
193
    @@: add	eax,[cur_editor.TopLeft.Y]
192
	mov	ebx,eax
194
	mov	ebx,eax
193
	pop	eax
195
	pop	eax
194
	cdq
196
	cdq
195
	mov	ecx,6
197
	mov	ecx,6
196
	idiv	ecx
198
	idiv	ecx
197
    @@: add	eax,[cur_editor.TopLeft.X]
199
    @@: add	eax,[cur_editor.TopLeft.X]
198
 
200
 
199
	cmp	eax,[cur_editor.Columns.Count]
201
	cmp	eax,[cur_editor.Columns.Count]
200
	jl	@f
202
	jl	@f
201
	mov	eax,[cur_editor.Columns.Count]
203
	mov	eax,[cur_editor.Columns.Count]
202
    @@: cmp	ebx,[cur_editor.Lines.Count]
204
    @@: cmp	ebx,[cur_editor.Lines.Count]
203
	jl	@f
205
	jl	@f
204
	mov	ebx,[cur_editor.Lines.Count]
206
	mov	ebx,[cur_editor.Lines.Count]
205
	dec	ebx
207
	dec	ebx
206
    @@:
208
    @@:
207
	cmp	[cur_editor.Caret.X],eax
209
	cmp	[cur_editor.Caret.X],eax
208
	jne	.change_cur_pos
210
	jne	.change_cur_pos
209
	cmp	[cur_editor.Caret.Y],ebx
211
	cmp	[cur_editor.Caret.Y],ebx
210
	jne	.change_cur_pos
212
	jne	.change_cur_pos
211
	call	editor_check_for_changes
213
	call	editor_check_for_changes
212
	jmp	still.skip_write
214
	jmp	still.skip_write
213
 
215
 
214
  .change_cur_pos:
216
  .change_cur_pos:
215
	mov	[cur_editor.Caret.X],eax
217
	mov	[cur_editor.Caret.X],eax
216
	mov	[cur_editor.Caret.Y],ebx
218
	mov	[cur_editor.Caret.Y],ebx
217
	call	editor_check_for_changes
219
	call	editor_check_for_changes
218
	jmp	still
220
	jmp	still
219
 
221
 
220
  .check_vscroll:
222
  .check_vscroll:
221
	mov	ecx,[cur_editor.Bounds.Right]
223
	mov	ecx,[cur_editor.Bounds.Right]
222
	sub	ecx,SCRLW-1
224
	sub	ecx,SCRLW-1
223
	pushd	ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom]
225
	pushd	ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom]
224
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
226
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
225
	add	[__rc+0x8],SCRLW-2
227
	add	[__rc+0x8],SCRLW-2
226
	add	[__rc+0x4],SCRLW-1
228
	add	[__rc+0x4],SCRLW-1
227
	sub	[__rc+0xC],SCRLW*2+1
229
	sub	[__rc+0xC],SCRLW*2+1
228
	mov	ecx,__rc
230
	mov	ecx,__rc
229
	call	pt_in_rect
231
	call	pt_in_rect
230
	jnc	.check_hscroll
232
	jnc	.check_hscroll
231
 
233
 
232
  .check_vscroll.2:
234
  .check_vscroll.2:
233
	sub	ebx,[cur_editor.Bounds.Top]
235
	sub	ebx,[cur_editor.Bounds.Top]
234
	sub	ebx,SCRLW
236
	sub	ebx,SCRLW
235
	cmp	[vscrl_capt],0
237
	cmp	[vscrl_capt],0
236
	jge	.vcaptured
238
	jge	.vcaptured
237
	mov	eax,[cur_editor.VScroll.Top]
239
	mov	eax,[cur_editor.VScroll.Top]
238
	cmp	ebx,eax
240
	cmp	ebx,eax
239
	jb	.center_vcapture
241
	jb	.center_vcapture
240
	add	eax,[cur_editor.VScroll.Size]
242
	add	eax,[cur_editor.VScroll.Size]
241
	cmp	ebx,eax
243
	cmp	ebx,eax
242
	jae	.center_vcapture
244
	jae	.center_vcapture
243
	mov	eax,ebx
245
	mov	eax,ebx
244
	sub	eax,[cur_editor.VScroll.Top]
246
	sub	eax,[cur_editor.VScroll.Top]
245
	dec	eax
247
	dec	eax
246
	mov	[vscrl_capt],eax
248
	mov	[vscrl_capt],eax
247
	dec	ebx
249
	dec	ebx
248
	jmp	.vcaptured
250
	jmp	.vcaptured
249
  .center_vcapture:
251
  .center_vcapture:
250
	mov	eax,[cur_editor.VScroll.Size]
252
	mov	eax,[cur_editor.VScroll.Size]
251
	shr	eax,1
253
	shr	eax,1
252
	mov	[vscrl_capt],eax
254
	mov	[vscrl_capt],eax
253
  .vcaptured:
255
  .vcaptured:
254
	sub	ebx,[vscrl_capt]
256
	sub	ebx,[vscrl_capt]
255
	jns	@f
257
	jns	@f
256
	xor	ebx,ebx
258
	xor	ebx,ebx
257
    @@: mov	[mouse_captured],1
259
    @@: mov	[mouse_captured],1
258
	mov	eax,[cur_editor.Bounds.Bottom]
260
	mov	eax,[cur_editor.Bounds.Bottom]
259
	sub	eax,[cur_editor.Bounds.Top]
261
	sub	eax,[cur_editor.Bounds.Top]
260
	sub	eax,[cur_editor.VScroll.Size]
262
	sub	eax,[cur_editor.VScroll.Size]
261
	sub	eax,SCRLW*3
263
	sub	eax,SCRLW*3
262
	cmp	eax,ebx
264
	cmp	eax,ebx
263
	jge	@f
265
	jge	@f
264
	mov	ebx,eax
266
	mov	ebx,eax
265
    @@:
267
    @@:
266
	mov	[cur_editor.VScroll.Top],ebx
268
	mov	[cur_editor.VScroll.Top],ebx
267
	mov	eax,[cur_editor.Lines.Count]
269
	mov	eax,[cur_editor.Lines.Count]
268
	sub	eax,[lines.scr]
270
	sub	eax,[lines.scr]
269
	imul	ebx
271
	imul	ebx
270
	mov	ebx,[cur_editor.Bounds.Bottom]
272
	mov	ebx,[cur_editor.Bounds.Bottom]
271
	sub	ebx,[cur_editor.Bounds.Top]
273
	sub	ebx,[cur_editor.Bounds.Top]
272
	sub	ebx,SCRLW*3
274
	sub	ebx,SCRLW*3
273
	sub	ebx,[cur_editor.VScroll.Size]
275
	sub	ebx,[cur_editor.VScroll.Size]
274
	idiv	ebx
276
	idiv	ebx
275
	cmp	eax,[cur_editor.TopLeft.Y]
277
	cmp	eax,[cur_editor.TopLeft.Y]
276
	je	still.skip_write
278
	je	still.skip_write
277
	mov	[cur_editor.TopLeft.Y],eax
279
	mov	[cur_editor.TopLeft.Y],eax
278
	call	check_bottom_right
280
	call	check_bottom_right
279
	call	draw_editor
281
	call	draw_editor
280
	jmp	still.skip_write
282
	jmp	still.skip_write
281
 
283
 
282
  .check_hscroll:
284
  .check_hscroll:
283
	pushd	[cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom]
285
	pushd	[cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom]
284
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
286
	popd	[__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
285
	add	[__rc+0x8],-SCRLW*2-1
287
	add	[__rc+0x8],-SCRLW*2-1
286
	add	[__rc+0x4],-SCRLW+1
288
	add	[__rc+0x4],-SCRLW+1
287
	add	[__rc+0xC],-1
289
	add	[__rc+0xC],-1
288
	add	[__rc+0x0],SCRLW+1
290
	add	[__rc+0x0],SCRLW+1
289
	mov	ecx,__rc
291
	mov	ecx,__rc
290
	call	pt_in_rect
292
	call	pt_in_rect
291
	jnc	.check_main_menu
293
	jnc	.check_main_menu
292
 
294
 
293
  .check_hscroll.2:
295
  .check_hscroll.2:
294
	mov	ebx,eax
296
	mov	ebx,eax
295
	sub	ebx,SCRLW+1
297
	sub	ebx,SCRLW+1
296
	sub	ebx,[cur_editor.Bounds.Left]
298
	sub	ebx,[cur_editor.Bounds.Left]
297
	cmp	[hscrl_capt],0
299
	cmp	[hscrl_capt],0
298
	jge	.hcaptured
300
	jge	.hcaptured
299
	mov	eax,[cur_editor.HScroll.Top]
301
	mov	eax,[cur_editor.HScroll.Top]
300
	cmp	ebx,eax
302
	cmp	ebx,eax
301
	jl	.center_hcapture
303
	jl	.center_hcapture
302
	add	eax,[cur_editor.HScroll.Size]
304
	add	eax,[cur_editor.HScroll.Size]
303
	cmp	ebx,eax
305
	cmp	ebx,eax
304
	jge	.center_hcapture
306
	jge	.center_hcapture
305
	mov	eax,ebx
307
	mov	eax,ebx
306
	sub	eax,[cur_editor.HScroll.Top]
308
	sub	eax,[cur_editor.HScroll.Top]
307
	dec	eax
309
	dec	eax
308
	mov	[hscrl_capt],eax
310
	mov	[hscrl_capt],eax
309
	dec	ebx
311
	dec	ebx
310
	jmp	.hcaptured
312
	jmp	.hcaptured
311
  .center_hcapture:
313
  .center_hcapture:
312
	mov	eax,[cur_editor.HScroll.Size]
314
	mov	eax,[cur_editor.HScroll.Size]
313
	shr	eax,1
315
	shr	eax,1
314
	mov	[hscrl_capt],eax
316
	mov	[hscrl_capt],eax
315
  .hcaptured:
317
  .hcaptured:
316
	sub	ebx,[hscrl_capt]
318
	sub	ebx,[hscrl_capt]
317
	jns	@f
319
	jns	@f
318
	xor	ebx,ebx
320
	xor	ebx,ebx
319
    @@: mov	[mouse_captured],1
321
    @@: mov	[mouse_captured],1
320
	mov	eax,[cur_editor.Bounds.Right]
322
	mov	eax,[cur_editor.Bounds.Right]
321
	sub	eax,[cur_editor.HScroll.Size]
323
	sub	eax,[cur_editor.HScroll.Size]
322
	sub	eax,SCRLW*3+1
324
	sub	eax,SCRLW*3+1
323
	cmp	eax,ebx
325
	cmp	eax,ebx
324
	jge	@f
326
	jge	@f
325
	mov	ebx,eax
327
	mov	ebx,eax
326
    @@:
328
    @@:
327
	mov	[cur_editor.HScroll.Top],ebx
329
	mov	[cur_editor.HScroll.Top],ebx
328
	mov	eax,[cur_editor.Columns.Count]
330
	mov	eax,[cur_editor.Columns.Count]
329
	sub	eax,[columns.scr]
331
	sub	eax,[columns.scr]
330
	imul	ebx
332
	imul	ebx
331
	mov	ebx,[cur_editor.Bounds.Right]
333
	mov	ebx,[cur_editor.Bounds.Right]
332
	sub	ebx,SCRLW*3+1
334
	sub	ebx,SCRLW*3+1
333
	sub	ebx,[cur_editor.HScroll.Size]
335
	sub	ebx,[cur_editor.HScroll.Size]
334
	idiv	ebx
336
	idiv	ebx
335
	cmp	eax,[cur_editor.TopLeft.X]
337
	cmp	eax,[cur_editor.TopLeft.X]
336
	je	still.skip_write
338
	je	still.skip_write
337
	mov	[cur_editor.TopLeft.X],eax
339
	mov	[cur_editor.TopLeft.X],eax
338
	call	check_bottom_right
340
	call	check_bottom_right
339
	call	draw_editor
341
	call	draw_editor
340
	jmp	still.skip_write
342
	jmp	still.skip_write
341
 
343
 
342
  .check_main_menu:
344
  .check_main_menu:
343
	cmp	[do_not_draw],0
345
	cmp	[do_not_draw],0
344
	jne	.capture_off
346
	jne	.capture_off
345
 
347
 
346
    @@: mcall	37,2
348
    @@: mcall	37,2
347
	test	eax,0x01
349
	test	eax,0x01
348
	jz	@f
350
	jz	@f
349
	mcall	5,1
351
	mcall	5,1
350
	jmp	@b
352
	jmp	@b
351
    @@: and	[mst],0xFE
353
    @@: and	[mst],0xFE
352
 
354
 
353
	cmp	[mi_cur],0
355
	cmp	[mi_cur],0
354
	jle	.capture_off
356
	jle	.capture_off
355
	mov	ecx,[mi_cur]
357
	mov	ecx,[mi_cur]
356
	mov	eax,[main_menu.popups+ecx*4-4]
358
	mov	eax,[main_menu.popups+ecx*4-4]
357
	mov	edx,main_menu
359
	mov	edx,main_menu
358
	call	dword[main_menu.onshow+ecx*4-4]
360
	call	dword[main_menu.onshow+ecx*4-4]
359
	call	setup_main_menu_popup
361
	call	setup_main_menu_popup
360
	mcall	51,1,popup_thread_start,POPUP_STACK
362
	mcall	51,1,popup_thread_start,POPUP_STACK
361
	mov	[h_popup],eax
363
	mov	[h_popup],eax
362
 
364
 
363
  .l_up:
365
  .l_up:
364
  .capture_off:
366
  .capture_off:
365
	or	eax,-1
367
	or	eax,-1
366
	mov	[vscrl_capt],eax
368
	mov	[vscrl_capt],eax
367
	mov	[hscrl_capt],eax
369
	mov	[hscrl_capt],eax
368
	mov	[body_capt],eax
370
	mov	[body_capt],eax
369
	mov	[mouse_captured],0
371
	mov	[mouse_captured],0
370
;!!!        mov     [just_from_popup],0
372
;!!!        mov     [just_from_popup],0
371
	jmp	still.skip_write
373
	jmp	still.skip_write