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