Subversion Repositories Kolibri OS

Rev

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

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