Rev 258 | Rev 267 | 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 |
||
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 |
||
259 | mikedld | 126 | mov [mm.Edit+POPUP.pos],eax |
178 | heavyiron | 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 |
||
259 | mikedld | 134 | mov dword[POPUP_STACK],mm.Edit |
178 | heavyiron | 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 |
||
259 | mikedld | 160 | @@: add eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
178 | heavyiron | 161 | mov ebx,eax |
162 | pop eax |
||
163 | cdq;xor edx,edx |
||
164 | mov ecx,6 |
||
165 | idiv ecx |
||
259 | mikedld | 166 | @@: add eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
178 | heavyiron | 167 | |
259 | mikedld | 168 | cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
178 | heavyiron | 169 | jl @f |
259 | mikedld | 170 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
171 | @@: cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] |
||
178 | heavyiron | 172 | jl @f |
259 | mikedld | 173 | mov ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] |
178 | heavyiron | 174 | dec ebx |
175 | @@: |
||
259 | mikedld | 176 | cmp [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
178 | heavyiron | 177 | jne .change_cur_pos |
259 | mikedld | 178 | cmp [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx |
178 | heavyiron | 179 | je still.skip_write |
180 | |||
181 | .change_cur_pos: |
||
259 | mikedld | 182 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
183 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
||
184 | mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx |
||
178 | heavyiron | 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 |
||
259 | mikedld | 216 | mov eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] |
178 | heavyiron | 217 | cmp ebx,eax |
218 | jb .center_vcapture |
||
259 | mikedld | 219 | add eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] |
178 | heavyiron | 220 | cmp ebx,eax |
221 | jae .center_vcapture |
||
222 | mov eax,ebx |
||
259 | mikedld | 223 | sub eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] |
178 | heavyiron | 224 | dec eax |
225 | mov [vscrl_capt],eax |
||
226 | dec ebx |
||
227 | jmp .vcaptured |
||
228 | .center_vcapture: |
||
259 | mikedld | 229 | mov eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] |
178 | heavyiron | 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] |
||
259 | mikedld | 239 | sub eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] |
178 | heavyiron | 240 | sub eax,SCRLW*3-2 |
241 | cmp eax,ebx |
||
242 | jge @f |
||
243 | mov ebx,eax |
||
244 | @@: |
||
259 | mikedld | 245 | mov [cur_tab.Editor.VScroll.Top],ebx ;! [vscrl_top],ebx |
246 | mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
||
178 | heavyiron | 247 | sub eax,[lines.scr] |
248 | imul ebx |
||
249 | mov ebx,[bot_ofs] |
||
250 | sub ebx,[top_ofs] |
||
251 | sub ebx,SCRLW*3-2 ;** |
||
259 | mikedld | 252 | sub ebx,[cur_tab.Editor.VScroll.Size] ;! ebx,[vscrl_size] |
178 | heavyiron | 253 | idiv ebx |
259 | mikedld | 254 | cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
178 | heavyiron | 255 | je still.skip_write |
259 | mikedld | 256 | mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax |
178 | heavyiron | 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 |
||
259 | mikedld | 277 | mov eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] |
178 | heavyiron | 278 | cmp ebx,eax |
279 | jl .center_hcapture |
||
259 | mikedld | 280 | add eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] |
178 | heavyiron | 281 | cmp ebx,eax |
282 | jge .center_hcapture |
||
283 | mov eax,ebx |
||
259 | mikedld | 284 | sub eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] |
178 | heavyiron | 285 | dec eax |
286 | mov [hscrl_capt],eax |
||
287 | dec ebx |
||
288 | jmp .hcaptured |
||
289 | .center_hcapture: |
||
259 | mikedld | 290 | mov eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] |
178 | heavyiron | 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] |
||
259 | mikedld | 299 | sub eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] |
178 | heavyiron | 300 | sub eax,SCRLW*3+10+1 |
301 | cmp eax,ebx |
||
302 | jge @f |
||
303 | mov ebx,eax |
||
304 | @@: |
||
259 | mikedld | 305 | mov [cur_tab.Editor.HScroll.Top],ebx ;! [hscrl_top],ebx |
306 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
||
178 | heavyiron | 307 | sub eax,[columns.scr] |
308 | imul ebx |
||
309 | mov ebx,[p_info.box.width] |
||
310 | sub ebx,SCRLW*3+10+1 ;** |
||
259 | mikedld | 311 | sub ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size] |
178 | heavyiron | 312 | idiv ebx |
259 | mikedld | 313 | cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
178 | heavyiron | 314 | je still.skip_write |
259 | mikedld | 315 | mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax |
178 | heavyiron | 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: |
||
259 | mikedld | 376 | or byte[mm.File+3],0x01 |
178 | heavyiron | 377 | cmp [f_info.length],0 |
378 | jne @f |
||
259 | mikedld | 379 | and byte[mm.File+3],0xFE |
178 | heavyiron | 380 | @@: ret |
381 | |||
382 | .edit: |
||
259 | mikedld | 383 | or byte[mm.Edit+2],0x01 |
178 | heavyiron | 384 | cmp [copy_size],0 |
385 | jne @f |
||
259 | mikedld | 386 | and byte[mm.Edit+2],0xFE |
387 | @@: or dword[mm.Edit+0],0x01000101 |
||
178 | heavyiron | 388 | cmp [sel.selected],0 |
389 | jne @f |
||
259 | mikedld | 390 | and dword[mm.Edit+0],0xFEFFFEFE |
178 | heavyiron | 391 | @@: ret |
392 | |||
393 | .search: |
||
259 | mikedld | 394 | mov byte[mm.Search+0],0 |
395 | ;mov byte[mm.Search+4],0 |
||
178 | heavyiron | 396 | ret |
397 | .run: |
||
398 | ret |
||
258 | mikedld | 399 | .recode: |
400 | ret |
||
178 | heavyiron | 401 | .options: |
259 | mikedld | 402 | mov word[mm.Options+0],0 |
403 | mov byte[mm.Options+5],0 |
||
404 | or byte[mm.Options+2],0x02 |
||
178 | heavyiron | 405 | test [options],OPTS_SECURESEL |
406 | jnz @f |
||
259 | mikedld | 407 | and byte[mm.Options+2],0xFD |
408 | @@: or byte[mm.Options+3],0x02 |
||
178 | heavyiron | 409 | test [options],OPTS_AUTOBRACES |
410 | jnz @f |
||
259 | mikedld | 411 | and byte[mm.Options+3],0xFD |
412 | @@: or byte[mm.Options+4],0x02 |
||
178 | heavyiron | 413 | test [options],OPTS_AUTOINDENT |
414 | jnz @f |
||
259 | mikedld | 415 | and byte[mm.Options+4],0xFD |
416 | @@: or byte[mm.Options+6],0x02 |
||
178 | heavyiron | 417 | test [options],OPTS_OPTIMSAVE |
418 | jnz @f |
||
259 | mikedld | 419 | and byte[mm.Options+6],0xFD |
420 | @@: or byte[mm.Options+8],0x02 |
||
178 | heavyiron | 421 | test [options],OPTS_LINENUMS |
422 | jnz @f |
||
259 | mikedld | 423 | and byte[mm.Options+8],0xFD |
178 | heavyiron | 424 | @@: ret |