Rev 258 | Go to most recent revision | Details | 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 |
||
6 | mov ecx,[top_ofs] |
||
7 | inc ecx |
||
8 | pushd [left_ofs] ATOPH [p_info.client_box.width] ATOPH |
||
9 | popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
||
10 | sub [__rc+0x8],SCRLW+6 |
||
11 | imul ecx,[lines.scr],LINEH |
||
12 | dec ecx |
||
13 | add [__rc+0xC],ecx |
||
14 | mov ecx,__rc |
||
15 | call pt_in_rect |
||
16 | ret |
||
17 | endf |
||
18 | |||
19 | func get_mouse_event |
||
20 | mcall 37,2 |
||
21 | and al,3 |
||
22 | mov bl,[ecx] |
||
23 | cmp [ecx],al |
||
24 | mov [ecx],al |
||
25 | jne @f |
||
26 | mov eax,MEV_MOVE |
||
27 | ret |
||
28 | @@: mov bh,al |
||
29 | and ebx,0x0101 |
||
30 | cmp bl,bh |
||
31 | je .rb |
||
32 | test al,1 |
||
33 | jz @f |
||
34 | mov eax,MEV_LDOWN |
||
35 | ret |
||
36 | @@: mov eax,MEV_LUP |
||
37 | ret |
||
38 | .rb: test al,2 |
||
39 | jz @f |
||
40 | mov eax,MEV_RDOWN |
||
41 | ret |
||
42 | @@: mov eax,MEV_RUP |
||
43 | ret |
||
44 | endf |
||
45 | |||
46 | mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.move |
||
47 | |||
48 | mouse: |
||
49 | mov ecx,mst |
||
50 | call get_mouse_event |
||
51 | cmp [bot_mode],0 |
||
52 | je @f |
||
53 | mov ah,al |
||
54 | mov al,4 |
||
55 | call [bot_dlg_handler] |
||
56 | jmp still |
||
57 | @@: cmp al,MEV_MOVE |
||
58 | jne .no_move |
||
59 | cmp [popup_active],1 |
||
60 | je @f |
||
61 | .no_move: |
||
62 | mov [s_status],0 |
||
63 | |||
64 | push eax |
||
65 | mcall 9,p_info,-1 |
||
66 | cmp ax,[p_info.window_stack_position] |
||
67 | pop eax |
||
68 | jne still.skip_write |
||
69 | @@: |
||
70 | cmp [just_from_popup],0 |
||
71 | je @f |
||
72 | cmp al,MEV_LUP |
||
73 | jne still.skip_write |
||
74 | @@: mov [mev],al |
||
75 | jmp [mouse_ev+eax*4-4] |
||
76 | |||
77 | .move: |
||
78 | mcall 37,1 |
||
79 | movsx ebx,ax |
||
80 | sar eax,16 |
||
81 | cmp [body_capt],0 |
||
82 | jge .check_body.2 |
||
83 | cmp [vscrl_capt],0 |
||
84 | jge .check_vscroll.2 |
||
85 | cmp [hscrl_capt],0 |
||
86 | jge .check_hscroll.2 |
||
87 | |||
88 | cmp [do_not_draw],0 |
||
89 | jne still.skip_write |
||
90 | mov eax,[mi_cur] |
||
91 | call get_active_menu_item |
||
92 | cmp eax,[mi_cur] |
||
93 | je still.skip_write |
||
94 | push [mi_cur] |
||
95 | cmp [popup_active],0 |
||
96 | je @f |
||
97 | mov [mi_cur],eax |
||
98 | @@: call draw_main_menu |
||
99 | pop [mi_cur] |
||
100 | cmp [popup_active],0 |
||
101 | je still.skip_write |
||
102 | ; mcall 18,2,[h_popup] |
||
103 | mov ecx,[mi_cur] |
||
104 | or ecx,ecx |
||
105 | js still.skip_write |
||
106 | mov eax,[main_menu.popups+ecx*4-4] |
||
107 | mov edx,main_menu |
||
108 | call dword[main_menu.onshow+ecx*4-4] |
||
109 | call setup_main_menu_popup |
||
110 | mcall 60,2,[h_popup],POPUP_STACK,4 |
||
111 | ; mcall 51,1,popup_thread_start,POPUP_STACK |
||
112 | |||
113 | jmp still.skip_write |
||
114 | |||
115 | |||
116 | .r_down: |
||
117 | @@: cmp [popup_active],0 |
||
118 | je @f |
||
119 | mcall 5,1 |
||
120 | jmp @b |
||
121 | @@: cmp [mouse_captured],0 |
||
122 | jne still.skip_write |
||
123 | call check_mouse_in_edit_area |
||
124 | jnc still.skip_write |
||
125 | mcall 37,0 |
||
126 | mov [popup_edit+POPUP.pos],eax |
||
127 | @@: mcall 37,2 |
||
128 | cmp eax,ebx |
||
129 | jnz @f |
||
130 | mcall 5,1 |
||
131 | jmp @b |
||
132 | @@: and [mst],0xFD |
||
133 | call onshow.edit |
||
134 | mov dword[POPUP_STACK],popup_edit |
||
135 | mcall 51,1,popup_thread_start,POPUP_STACK |
||
136 | mov [h_popup],eax |
||
137 | jmp still.skip_write |
||
138 | |||
139 | .r_up: |
||
140 | jmp still.skip_write |
||
141 | |||
142 | .l_down: |
||
143 | call check_mouse_in_edit_area |
||
144 | jnc .check_vscroll |
||
145 | mov [mouse_captured],1 |
||
146 | mov [body_capt],1 |
||
147 | |||
148 | call clear_selection |
||
149 | |||
150 | .check_body.2: |
||
151 | sub eax,[left_ofs] |
||
152 | sub ebx,[top_ofs] |
||
153 | dec ebx |
||
154 | ; sub ebx,[__rc+0x4] |
||
155 | push eax |
||
156 | mov eax,ebx |
||
157 | cdq;xor edx,edx |
||
158 | mov ecx,LINEH |
||
159 | idiv ecx |
||
160 | @@: add eax,[top_line] |
||
161 | mov ebx,eax |
||
162 | pop eax |
||
163 | cdq;xor edx,edx |
||
164 | mov ecx,6 |
||
165 | idiv ecx |
||
166 | @@: add eax,[left_col] |
||
167 | |||
168 | cmp eax,[columns] |
||
169 | jl @f |
||
170 | mov eax,[columns] |
||
171 | @@: cmp ebx,[lines] |
||
172 | jl @f |
||
173 | mov ebx,[lines] |
||
174 | dec ebx |
||
175 | @@: |
||
176 | cmp [pos.x],eax |
||
177 | jne .change_cur_pos |
||
178 | cmp [pos.y],ebx |
||
179 | je still.skip_write |
||
180 | |||
181 | .change_cur_pos: |
||
182 | mov [pos.x],eax |
||
183 | mov eax,[pos.y] |
||
184 | mov [pos.y],ebx |
||
185 | call check_cur_vis_inv |
||
186 | jc .check_ldown |
||
187 | ; cmp eax,ebx |
||
188 | ; je @f |
||
189 | ; push ebx |
||
190 | ; mov ebx,eax |
||
191 | ; call drawfile.ex |
||
192 | ; pop eax |
||
193 | ; @@: mov ebx,eax |
||
194 | call draw_file.ex |
||
195 | .check_ldown: |
||
196 | jmp still |
||
197 | |||
198 | .check_vscroll: |
||
199 | mov ecx,[p_info.client_box.width] |
||
200 | sub ecx,SCRLW-2 |
||
201 | pushd ecx [top_ofs] ecx [bot_ofs] |
||
202 | popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
||
203 | add [__rc+0x8],SCRLW-1;!!!!!!!!!!!!!!-2 |
||
204 | add [__rc+0x4],SCRLW;!!!!!!!!!!!!!!+1 |
||
205 | sub [__rc+0xC],SCRLW*2+3 |
||
206 | mov ecx,__rc |
||
207 | call pt_in_rect |
||
208 | jnc .check_hscroll |
||
209 | |||
210 | .check_vscroll.2: |
||
211 | sub ebx,[top_ofs] |
||
212 | sub ebx,SCRLW;!!!!!!!!!!!!!!+1 |
||
213 | ; sub ebx,[__rc+0x4] |
||
214 | cmp [vscrl_capt],0 |
||
215 | jge .vcaptured |
||
216 | mov eax,[vscrl_top] |
||
217 | cmp ebx,eax |
||
218 | jb .center_vcapture |
||
219 | add eax,[vscrl_size] |
||
220 | cmp ebx,eax |
||
221 | jae .center_vcapture |
||
222 | mov eax,ebx |
||
223 | sub eax,[vscrl_top] |
||
224 | dec eax |
||
225 | mov [vscrl_capt],eax |
||
226 | dec ebx |
||
227 | jmp .vcaptured |
||
228 | .center_vcapture: |
||
229 | mov eax,[vscrl_size] |
||
230 | shr eax,1 |
||
231 | mov [vscrl_capt],eax |
||
232 | .vcaptured: |
||
233 | sub ebx,[vscrl_capt] |
||
234 | jns @f |
||
235 | xor ebx,ebx |
||
236 | @@: mov [mouse_captured],1 |
||
237 | mov eax,[bot_ofs] |
||
238 | sub eax,[top_ofs] |
||
239 | sub eax,[vscrl_size] |
||
240 | sub eax,SCRLW*3-2 |
||
241 | cmp eax,ebx |
||
242 | jge @f |
||
243 | mov ebx,eax |
||
244 | @@: |
||
245 | mov [vscrl_top],ebx |
||
246 | mov eax,[lines] |
||
247 | sub eax,[lines.scr] |
||
248 | imul ebx |
||
249 | mov ebx,[bot_ofs] |
||
250 | sub ebx,[top_ofs] |
||
251 | sub ebx,SCRLW*3-2 ;** |
||
252 | sub ebx,[vscrl_size] |
||
253 | idiv ebx |
||
254 | cmp eax,[top_line] |
||
255 | je still.skip_write |
||
256 | mov [top_line],eax |
||
257 | call check_bottom_right |
||
258 | call draw_file |
||
259 | jmp still.skip_write |
||
260 | |||
261 | .check_hscroll: |
||
262 | pushd (5+SCRLW+1) [bot_ofs] [p_info.box.width] [bot_ofs] |
||
263 | popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
||
264 | add [__rc+0x8],-SCRLW*2-10-1 |
||
265 | add [__rc+0x4],-SCRLW |
||
266 | add [__rc+0xC],-2 |
||
267 | mov ecx,__rc |
||
268 | call pt_in_rect |
||
269 | jnc .check_main_menu |
||
270 | |||
271 | .check_hscroll.2: |
||
272 | mov ebx,eax |
||
273 | sub ebx,(5+SCRLW+1) |
||
274 | ; sub ebx,[__rc+0x0] |
||
275 | cmp [hscrl_capt],0 |
||
276 | jge .hcaptured |
||
277 | mov eax,[hscrl_top] |
||
278 | cmp ebx,eax |
||
279 | jl .center_hcapture |
||
280 | add eax,[hscrl_size] |
||
281 | cmp ebx,eax |
||
282 | jge .center_hcapture |
||
283 | mov eax,ebx |
||
284 | sub eax,[hscrl_top] |
||
285 | dec eax |
||
286 | mov [hscrl_capt],eax |
||
287 | dec ebx |
||
288 | jmp .hcaptured |
||
289 | .center_hcapture: |
||
290 | mov eax,[hscrl_size] |
||
291 | shr eax,1 |
||
292 | mov [hscrl_capt],eax |
||
293 | .hcaptured: |
||
294 | sub ebx,[hscrl_capt] |
||
295 | jns @f |
||
296 | xor ebx,ebx |
||
297 | @@: mov [mouse_captured],1 |
||
298 | mov eax,[p_info.box.width] |
||
299 | sub eax,[hscrl_size] |
||
300 | sub eax,SCRLW*3+10+1 |
||
301 | cmp eax,ebx |
||
302 | jge @f |
||
303 | mov ebx,eax |
||
304 | @@: |
||
305 | mov [hscrl_top],ebx |
||
306 | mov eax,[columns] |
||
307 | sub eax,[columns.scr] |
||
308 | imul ebx |
||
309 | mov ebx,[p_info.box.width] |
||
310 | sub ebx,SCRLW*3+10+1 ;** |
||
311 | sub ebx,[hscrl_size] |
||
312 | idiv ebx |
||
313 | cmp eax,[left_col] |
||
314 | je still.skip_write |
||
315 | mov [left_col],eax |
||
316 | call check_bottom_right |
||
317 | call draw_file |
||
318 | jmp still.skip_write |
||
319 | |||
320 | .check_main_menu: |
||
321 | cmp [do_not_draw],0 |
||
322 | jne .capture_off |
||
323 | |||
324 | @@: mcall 37,2 |
||
325 | test eax,0x01 |
||
326 | jz @f |
||
327 | mcall 5,1 |
||
328 | jmp @b |
||
329 | @@: and [mst],0xFE |
||
330 | |||
331 | cmp [mi_cur],0 |
||
332 | jle .capture_off |
||
333 | mov ecx,[mi_cur] |
||
334 | mov eax,[main_menu.popups+ecx*4-4] |
||
335 | mov edx,main_menu |
||
336 | call dword[main_menu.onshow+ecx*4-4] |
||
337 | call setup_main_menu_popup |
||
338 | mcall 51,1,popup_thread_start,POPUP_STACK |
||
339 | mov [h_popup],eax |
||
340 | |||
341 | .l_up: |
||
342 | .capture_off: |
||
343 | or eax,-1 |
||
344 | mov [vscrl_capt],eax |
||
345 | mov [hscrl_capt],eax |
||
346 | mov [body_capt],eax |
||
347 | mov [mouse_captured],0 |
||
348 | mov [just_from_popup],0 |
||
349 | jmp still.skip_write |
||
350 | |||
351 | |||
352 | func setup_main_menu_popup |
||
353 | mov ebx,[p_info.box.left] |
||
354 | add ebx,[p_info.client_box.left] |
||
355 | @@: dec ecx |
||
356 | jz @f |
||
357 | add edx,8+1 |
||
358 | movzx esi,byte[edx-1] |
||
359 | add edx,esi |
||
360 | jmp @b |
||
361 | @@: movzx ecx,word[edx+2] |
||
362 | add ebx,ecx |
||
363 | |||
364 | mov [eax+POPUP.x],bx |
||
365 | mov ebx,[p_info.box.top] |
||
366 | add ebx,[p_info.client_box.top] |
||
367 | add ebx,ATOPH-1 |
||
368 | mov [eax+POPUP.y],bx |
||
369 | mov [POPUP_STACK],eax |
||
370 | ret |
||
371 | endf |
||
372 | |||
373 | onshow: |
||
374 | |||
375 | .file: |
||
376 | or byte[popup_file+3],0x01 |
||
377 | cmp [f_info.length],0 |
||
378 | jne @f |
||
379 | and byte[popup_file+3],0xFE |
||
380 | @@: ret |
||
381 | |||
382 | .edit: |
||
383 | or byte[popup_edit+2],0x01 |
||
384 | cmp [copy_size],0 |
||
385 | jne @f |
||
386 | and byte[popup_edit+2],0xFE |
||
387 | @@: or dword[popup_edit+0],0x01000101 |
||
388 | cmp [sel.selected],0 |
||
389 | jne @f |
||
390 | and dword[popup_edit+0],0xFEFFFEFE |
||
391 | @@: ret |
||
392 | |||
393 | .search: |
||
394 | mov byte[popup_search+0],0 |
||
395 | ;mov byte[popup_search+4],0 |
||
396 | ret |
||
397 | .run: |
||
398 | ret |
||
399 | .options: |
||
400 | mov word[popup_options+0],0 |
||
401 | mov byte[popup_options+5],0 |
||
402 | or byte[popup_options+2],0x02 |
||
403 | test [options],OPTS_SECURESEL |
||
404 | jnz @f |
||
405 | and byte[popup_options+2],0xFD |
||
406 | @@: or byte[popup_options+3],0x02 |
||
407 | test [options],OPTS_AUTOBRACES |
||
408 | jnz @f |
||
409 | and byte[popup_options+3],0xFD |
||
410 | @@: or byte[popup_options+4],0x02 |
||
411 | test [options],OPTS_AUTOINDENT |
||
412 | jnz @f |
||
413 | and byte[popup_options+4],0xFD |
||
414 | @@: or byte[popup_options+6],0x02 |
||
415 | test [options],OPTS_OPTIMSAVE |
||
416 | jnz @f |
||
417 | and byte[popup_options+6],0xFD |
||
418 | @@: or byte[popup_options+8],0x02 |
||
419 | test [options],OPTS_LINENUMS |
||
420 | jnz @f |
||
421 | and byte[popup_options+8],0xFD |
||
422 | @@: ret |