Rev 280 | Rev 617 | 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 |
||
297 | mikedld | 6 | mov ecx,[cur_editor.Bounds.Top] |
178 | heavyiron | 7 | inc ecx |
297 | mikedld | 8 | pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx |
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 | @@: |
||
297 | mikedld | 72 | ;!!! cmp [just_from_popup],0 |
73 | ;!!! je @f |
||
74 | ;!!! cmp al,MEV_LUP |
||
75 | ;!!! jne still.skip_write |
||
178 | heavyiron | 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 | mov ecx,[mi_cur] |
||
105 | or ecx,ecx |
||
106 | js still.skip_write |
||
107 | mov eax,[main_menu.popups+ecx*4-4] |
||
108 | mov edx,main_menu |
||
109 | call dword[main_menu.onshow+ecx*4-4] |
||
110 | call setup_main_menu_popup |
||
111 | mcall 60,2,[h_popup],POPUP_STACK,4 |
||
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: |
||
297 | mikedld | 151 | sub eax,[cur_editor.Bounds.Left] |
152 | sub ebx,[cur_editor.Bounds.Top] |
||
280 | mikedld | 153 | sub eax,[cur_editor.Gutter.Width] |
154 | sub eax,LCHGW |
||
155 | sub ebx,2 |
||
178 | heavyiron | 156 | push eax |
157 | mov eax,ebx |
||
297 | mikedld | 158 | cdq |
178 | heavyiron | 159 | mov ecx,LINEH |
160 | idiv ecx |
||
297 | mikedld | 161 | @@: add eax,[cur_editor.TopLeft.Y] |
178 | heavyiron | 162 | mov ebx,eax |
163 | pop eax |
||
297 | mikedld | 164 | cdq |
178 | heavyiron | 165 | mov ecx,6 |
166 | idiv ecx |
||
297 | mikedld | 167 | @@: add eax,[cur_editor.TopLeft.X] |
178 | heavyiron | 168 | |
297 | mikedld | 169 | cmp eax,[cur_editor.Columns.Count] |
178 | heavyiron | 170 | jl @f |
297 | mikedld | 171 | mov eax,[cur_editor.Columns.Count] |
172 | @@: cmp ebx,[cur_editor.Lines.Count] |
||
178 | heavyiron | 173 | jl @f |
297 | mikedld | 174 | mov ebx,[cur_editor.Lines.Count] |
178 | heavyiron | 175 | dec ebx |
176 | @@: |
||
297 | mikedld | 177 | cmp [cur_editor.Caret.X],eax |
178 | heavyiron | 178 | jne .change_cur_pos |
297 | mikedld | 179 | cmp [cur_editor.Caret.Y],ebx |
180 | jne .change_cur_pos |
||
181 | call editor_check_for_changes |
||
182 | jmp still.skip_write |
||
178 | heavyiron | 183 | |
184 | .change_cur_pos: |
||
297 | mikedld | 185 | mov [cur_editor.Caret.X],eax |
186 | mov [cur_editor.Caret.Y],ebx |
||
187 | call editor_check_for_changes |
||
178 | heavyiron | 188 | jmp still |
189 | |||
190 | .check_vscroll: |
||
280 | mikedld | 191 | mov ecx,[cur_editor.Bounds.Right] |
297 | mikedld | 192 | sub ecx,SCRLW-1 |
193 | pushd ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom] |
||
178 | heavyiron | 194 | popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
297 | mikedld | 195 | add [__rc+0x8],SCRLW-2 |
196 | add [__rc+0x4],SCRLW-1 |
||
197 | sub [__rc+0xC],SCRLW*2+1 |
||
178 | heavyiron | 198 | mov ecx,__rc |
199 | call pt_in_rect |
||
200 | jnc .check_hscroll |
||
201 | |||
202 | .check_vscroll.2: |
||
297 | mikedld | 203 | sub ebx,[cur_editor.Bounds.Top] |
204 | sub ebx,SCRLW |
||
178 | heavyiron | 205 | cmp [vscrl_capt],0 |
206 | jge .vcaptured |
||
297 | mikedld | 207 | mov eax,[cur_editor.VScroll.Top] |
178 | heavyiron | 208 | cmp ebx,eax |
209 | jb .center_vcapture |
||
297 | mikedld | 210 | add eax,[cur_editor.VScroll.Size] |
178 | heavyiron | 211 | cmp ebx,eax |
212 | jae .center_vcapture |
||
213 | mov eax,ebx |
||
297 | mikedld | 214 | sub eax,[cur_editor.VScroll.Top] |
178 | heavyiron | 215 | dec eax |
216 | mov [vscrl_capt],eax |
||
217 | dec ebx |
||
218 | jmp .vcaptured |
||
219 | .center_vcapture: |
||
297 | mikedld | 220 | mov eax,[cur_editor.VScroll.Size] |
178 | heavyiron | 221 | shr eax,1 |
222 | mov [vscrl_capt],eax |
||
223 | .vcaptured: |
||
224 | sub ebx,[vscrl_capt] |
||
225 | jns @f |
||
226 | xor ebx,ebx |
||
227 | @@: mov [mouse_captured],1 |
||
297 | mikedld | 228 | mov eax,[cur_editor.Bounds.Bottom] |
229 | sub eax,[cur_editor.Bounds.Top] |
||
230 | sub eax,[cur_editor.VScroll.Size] |
||
231 | sub eax,SCRLW*3 |
||
178 | heavyiron |