Subversion Repositories Kolibri OS

Rev

Rev 5838 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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