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