Rev 431 | Rev 684 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 431 | Rev 465 | ||
---|---|---|---|
1 | $Revision: 431 $ |
1 | $Revision: 465 $ |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
3 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
6 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; Distributed under terms of the GNU General Public License ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
8 | 8 | ||
9 | max_buttons=4095 |
9 | max_buttons=4095 |
10 | dececx: |
10 | dececx: |
11 | push edx |
11 | push edx |
12 | push ecx |
12 | push ecx |
13 | 13 | ||
14 | mov edx,2 |
14 | mov edx,2 |
15 | .loop: |
15 | .loop: |
16 | 16 | ||
17 | cmp byte [esp+edx],0x20 |
17 | cmp byte [esp+edx],0x20 |
18 | jae @f |
18 | jae @f |
19 | mov [esp+edx],byte 0x20 |
19 | mov [esp+edx],byte 0x20 |
20 | @@: |
20 | @@: |
21 | sub [esp+edx],byte 0x20 |
21 | sub [esp+edx],byte 0x20 |
22 | 22 | ||
23 | dec edx |
23 | dec edx |
24 | jns .loop |
24 | jns .loop |
25 | 25 | ||
26 | pop ecx |
26 | pop ecx |
27 | pop edx |
27 | pop edx |
28 | ret |
28 | ret |
29 | 29 | ||
30 | incecx: |
30 | incecx: |
31 | push edx |
31 | push edx |
32 | push ecx |
32 | push ecx |
33 | 33 | ||
34 | mov edx,2 |
34 | mov edx,2 |
35 | .loop: |
35 | .loop: |
36 | 36 | ||
37 | cmp byte [esp+edx],0xdf |
37 | cmp byte [esp+edx],0xdf |
38 | jbe @f |
38 | jbe @f |
39 | mov [esp+edx],byte 0xdf |
39 | mov [esp+edx],byte 0xdf |
40 | @@: |
40 | @@: |
41 | add [esp+edx],byte 0x20 |
41 | add [esp+edx],byte 0x20 |
42 | 42 | ||
43 | dec edx |
43 | dec edx |
44 | jns .loop |
44 | jns .loop |
45 | pop ecx |
45 | pop ecx |
46 | pop edx |
46 | pop edx |
47 | ret |
47 | ret |
48 | 48 | ||
49 | incecx2: |
49 | incecx2: |
50 | push edx |
50 | push edx |
51 | push ecx |
51 | push ecx |
52 | 52 | ||
53 | mov edx,2 |
53 | mov edx,2 |
54 | .loop: |
54 | .loop: |
55 | 55 | ||
56 | cmp byte [esp+edx],0xeb |
56 | cmp byte [esp+edx],0xeb |
57 | jbe @f |
57 | jbe @f |
58 | mov [esp+edx],byte 0xeb |
58 | mov [esp+edx],byte 0xeb |
59 | @@: |
59 | @@: |
60 | add [esp+edx],byte 0x14 |
60 | add [esp+edx],byte 0x14 |
61 | 61 | ||
62 | dec edx |
62 | dec edx |
63 | jns .loop |
63 | jns .loop |
64 | pop ecx |
64 | pop ecx |
65 | pop edx |
65 | pop edx |
66 | ret |
66 | ret |
67 | 67 | ||
68 | drawbuttonframes: |
68 | drawbuttonframes: |
69 | 69 | ||
70 | push esi |
70 | push esi |
71 | push edi |
71 | push edi |
72 | push eax |
72 | push eax |
73 | push ebx |
73 | push ebx |
74 | push ecx |
74 | push ecx |
75 | push edx |
75 | push edx |
76 | 76 | ||
77 | shr eax,16 |
77 | shr eax,16 |
78 | shr ebx,16 |
78 | shr ebx,16 |
79 | mov edx,[TASK_BASE] |
79 | mov edx,[TASK_BASE] |
80 | 80 | ||
81 | add eax,[edx-twdw + WDATA.box.left] |
81 | add eax,[edx-twdw + WDATA.box.left] |
82 | add ebx,[edx-twdw + WDATA.box.top] |
82 | add ebx,[edx-twdw + WDATA.box.top] |
83 | mov cx,ax |
83 | mov cx,ax |
84 | mov dx,bx |
84 | mov dx,bx |
85 | shl eax,16 |
85 | shl eax,16 |
86 | shl ebx,16 |
86 | shl ebx,16 |
87 | mov ax,cx |
87 | mov ax,cx |
88 | mov bx,dx |
88 | mov bx,dx |
89 | add ax,word [esp+12] |
89 | add ax,word [esp+12] |
90 | mov esi,ebx |
90 | mov esi,ebx |
91 | mov edi,0 |
91 | mov edi,0 |
92 | mov ecx,[esp+0] |
92 | mov ecx,[esp+0] |
93 | call incecx |
93 | call incecx |
94 | call [draw_line] |
94 | call [draw_line] |
95 | 95 | ||
96 | movzx edx,word [esp+8] |
96 | movzx edx,word [esp+8] |
97 | add ebx,edx |
97 | add ebx,edx |
98 | shl edx,16 |
98 | shl edx,16 |
99 | add ebx,edx |
99 | add ebx,edx |
100 | mov ecx,[esp+0] |
100 | mov ecx,[esp+0] |
101 | call dececx |
101 | call dececx |
102 | call [draw_line] |
102 | call [draw_line] |
103 | 103 | ||
104 | mov ebx,esi |
104 | mov ebx,esi |
105 | push edx |
105 | push edx |
106 | mov edx,eax |
106 | mov edx,eax |
107 | shr edx,16 |
107 | shr edx,16 |
108 | mov ax,dx |
108 | mov ax,dx |
109 | mov edx,ebx |
109 | mov edx,ebx |
110 | shr edx,16 |
110 | shr edx,16 |
111 | mov bx,dx |
111 | mov bx,dx |
112 | mov dx,[esp+8+4] |
112 | mov dx,[esp+8+4] |
113 | add bx,dx |
113 | add bx,dx |
114 | pop edx |
114 | pop edx |
115 | mov edi,0 |
115 | mov edi,0 |
116 | mov ecx,[esp+0] |
116 | mov ecx,[esp+0] |
117 | call incecx |
117 | call incecx |
118 | call [draw_line] |
118 | call [draw_line] |
119 | 119 | ||
120 | mov esi,edx |
120 | mov esi,edx |
121 | mov dx,[esp+12] |
121 | mov dx,[esp+12] |
122 | add ax,dx |
122 | add ax,dx |
123 | shl edx,16 |
123 | shl edx,16 |
124 | add eax,edx |
124 | add eax,edx |
125 | add ebx,1*65536 |
125 | add ebx,1*65536 |
126 | mov edx,esi |
126 | mov edx,esi |
127 | mov ecx,[esp+0] |
127 | mov ecx,[esp+0] |
128 | call dececx |
128 | call dececx |
129 | call [draw_line] |
129 | call [draw_line] |
130 | 130 | ||
131 | pop edx |
131 | pop edx |
132 | pop ecx |
132 | pop ecx |
133 | pop ebx |
133 | pop ebx |
134 | pop eax |
134 | pop eax |
135 | pop edi |
135 | pop edi |
136 | pop esi |
136 | pop esi |
137 | 137 | ||
138 | ret |
138 | ret |
139 | 139 | ||
140 | button_dececx: |
140 | button_dececx: |
141 | 141 | ||
142 | cmp [buttontype],dword 1 |
142 | cmp [buttontype],dword 1 |
143 | jne .finish |
143 | jne .finish |
144 | ; je bdece |
144 | ; je bdece |
145 | ; ret |
145 | ; ret |
146 | ; bdece: |
146 | ; bdece: |
147 | push eax |
147 | push eax |
148 | mov eax,0x01 |
148 | mov eax,0x01 |
149 | cmp edi,20 |
149 | cmp edi,20 |
150 | jg @f |
150 | jg @f |
151 | mov eax,0x02 |
151 | mov eax,0x02 |
152 | @@: |
152 | @@: |
153 | test ecx,0xff |
153 | test ecx,0xff |
154 | jz @f |
154 | jz @f |
155 | sub ecx,eax |
155 | sub ecx,eax |
156 | @@: |
156 | @@: |
157 | shl eax,8 |
157 | shl eax,8 |
158 | test ecx,0xff00 |
158 | test ecx,0xff00 |
159 | jz @f |
159 | jz @f |
160 | sub ecx,eax |
160 | sub ecx,eax |
161 | @@: |
161 | @@: |
162 | shl eax,8 |
162 | shl eax,8 |
163 | test ecx,0xff0000 |
163 | test ecx,0xff0000 |
164 | jz @f |
164 | jz @f |
165 | sub ecx,eax |
165 | sub ecx,eax |
166 | @@: |
166 | @@: |
167 | pop eax |
167 | pop eax |
168 | .finish: |
168 | .finish: |
169 | ret |
169 | ret |
170 | 170 | ||
171 | 171 | ||
172 | sys_button: |
172 | sys_button: |
173 | 173 | ||
174 | push edi |
174 | push edi |
175 | mov edi,[CURRENT_TASK] |
175 | mov edi,[current_slot] |
176 | shl edi,8 |
- | |
177 | rol eax,16 |
176 | rol eax,16 |
178 | add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left] |
177 | add ax,word[edi+APPDATA.wnd_clientbox.left] |
179 | rol eax,16 |
178 | rol eax,16 |
180 | rol ebx,16 |
179 | rol ebx,16 |
181 | add bx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top] |
180 | add bx,word[edi+APPDATA.wnd_clientbox.top] |
182 | rol ebx,16 |
181 | rol ebx,16 |
183 | pop edi |
182 | pop edi |
184 | .forced: |
183 | .forced: |
185 | 184 | ||
186 | test ecx,0x80000000 |
185 | test ecx,0x80000000 |
187 | jnz remove_button |
186 | jnz remove_button |
188 | 187 | ||
189 | push esi |
188 | push esi |
190 | push edi |
189 | push edi |
191 | push eax ; |
190 | push eax ; |
192 | push ebx ; |
191 | push ebx ; |
193 | push ecx ; |
192 | push ecx ; |
194 | push edx |
193 | push edx |
195 | 194 | ||
196 | or ax,ax |
195 | or ax,ax |
197 | jle noaddbutt |
196 | jle noaddbutt |
198 | or bx,bx |
197 | or bx,bx |
199 | jle noaddbutt |
198 | jle noaddbutt |
200 | 199 | ||
201 | test ecx,0x40000000 |
200 | test ecx,0x40000000 |
202 | jnz button_no_draw |
201 | jnz button_no_draw |
203 | 202 | ||
204 | pushad ; button body |
203 | pushad ; button body |
205 | push ebx |
204 | push ebx |
206 | shr eax,16 |
205 | shr eax,16 |
207 | shr ebx,16 |
206 | shr ebx,16 |
208 | mov edx,[TASK_BASE] |
207 | mov edx,[TASK_BASE] |
209 | mov esi,[edx-twdw + WDATA.box.left] |
208 | mov esi,[edx-twdw + WDATA.box.left] |
210 | mov edi,[edx-twdw + WDATA.box.top] |
209 | mov edi,[edx-twdw + WDATA.box.top] |
211 | add eax,esi |
210 | add eax,esi |
212 | add ebx,edi |
211 | add ebx,edi |
213 | mov cx,ax |
212 | mov cx,ax |
214 | mov dx,bx |
213 | mov dx,bx |
215 | shl eax,16 |
214 | shl eax,16 |
216 | shl ebx,16 |
215 | shl ebx,16 |
217 | mov ax,cx |
216 | mov ax,cx |
218 | mov bx,dx |
217 | mov bx,dx |
219 | movzx ecx,word [4+32+esp+12] |
218 | movzx ecx,word [4+32+esp+12] |
220 | add eax,ecx |
219 | add eax,ecx |
221 | mov ecx,[4+32+esp+0] |
220 | mov ecx,[4+32+esp+0] |
222 | cmp [buttontype],dword 0 |
221 | cmp [buttontype],dword 0 |
223 | je @f |
222 | je @f |
224 | call incecx2 |
223 | call incecx2 |
225 | @@: |
224 | @@: |
226 | movzx edi,word [esp] |
225 | movzx edi,word [esp] |
227 | 226 | ||
228 | pop edx |
227 | pop edx |
229 | and edx, 0xFFFF |
228 | and edx, 0xFFFF |
230 | 229 | ||
231 | .newline: |
230 | .newline: |
232 | call button_dececx |
231 | call button_dececx |
233 | push edi |
232 | push edi |
234 | xor edi, edi |
233 | xor edi, edi |
235 | call [draw_line] |
234 | call [draw_line] |
236 | pop edi |
235 | pop edi |
237 | add ebx,1*65536+1 ; [ y start | y end ] |
236 | add ebx,1*65536+1 ; [ y start | y end ] |
238 | dec edx |
237 | dec edx |
239 | jnz .newline |
238 | jnz .newline |
240 | popad |
239 | popad |
241 | 240 | ||
242 | call drawbuttonframes |
241 | call drawbuttonframes |
243 | 242 | ||
244 | button_no_draw: |
243 | button_no_draw: |
245 | 244 | ||
246 | and ecx,0xffff |
245 | and ecx,0xffff |
247 | 246 | ||
248 | mov edi,[BTN_ADDR] |
247 | mov edi,[BTN_ADDR] |
249 | movzx eax,word [edi] |
248 | movzx eax,word [edi] |
250 | cmp eax,max_buttons |
249 | cmp eax,max_buttons |
251 | jge noaddbutt |
250 | jge noaddbutt |
252 | inc eax |
251 | inc eax |
253 | mov [edi],ax |
252 | mov [edi],ax |
254 | 253 | ||
255 | shl eax,4 |
254 | shl eax,4 |
256 | add eax,edi |
255 | add eax,edi |
257 | 256 | ||
258 | mov bx,[CURRENT_TASK] |
257 | mov bx,[CURRENT_TASK] |
259 | mov [eax],bx |
258 | mov [eax],bx |
260 | 259 | ||
261 | add eax,2 ; save button id number |
260 | add eax,2 ; save button id number |
262 | mov ebx,[esp+4] |
261 | mov ebx,[esp+4] |
263 | mov [eax],bx ; bits 0-15 |
262 | mov [eax],bx ; bits 0-15 |
264 | shr ebx,16 |
263 | shr ebx,16 |
265 | mov [eax-2+0xc],bx; bits 16-31 |
264 | mov [eax-2+0xc],bx; bits 16-31 |
266 | add eax,2 ; x start |
265 | add eax,2 ; x start |
267 | mov bx,[esp+12+2] |
266 | mov bx,[esp+12+2] |
268 | mov [eax],bx |
267 | mov [eax],bx |
269 | add eax,2 ; x size |
268 | add eax,2 ; x size |
270 | mov bx,[esp+12+0] |
269 | mov bx,[esp+12+0] |
271 | mov [eax],bx |
270 | mov [eax],bx |
272 | add eax,2 ; y start |
271 | add eax,2 ; y start |
273 | mov bx,[esp+8+2] |
272 | mov bx,[esp+8+2] |
274 | mov [eax],bx |
273 | mov [eax],bx |
275 | add eax,2 ; y size |
274 | add eax,2 ; y size |
276 | mov bx,[esp+8+0] |
275 | mov bx,[esp+8+0] |
277 | mov [eax],bx |
276 | mov [eax],bx |
278 | 277 | ||
279 | noaddbutt: |
278 | noaddbutt: |
280 | 279 | ||
281 | pop edx |
280 | pop edx |
282 | pop ecx |
281 | pop ecx |
283 | pop ebx |
282 | pop ebx |
284 | pop eax |
283 | pop eax |
285 | pop edi |
284 | pop edi |
286 | pop esi |
285 | pop esi |
287 | 286 | ||
288 | ret |
287 | ret |
289 | 288 | ||
290 | 289 | ||
291 | remove_button: |
290 | remove_button: |
292 | 291 | ||
293 | and ecx,0x7fffffff |
292 | and ecx,0x7fffffff |
294 | 293 | ||
295 | rnewba2: |
294 | rnewba2: |
296 | 295 | ||
297 | mov edi,[BTN_ADDR] |
296 | mov edi,[BTN_ADDR] |
298 | mov eax,edi |
297 | mov eax,edi |
299 | movzx ebx,word [edi] |
298 | movzx ebx,word [edi] |
300 | inc bx |
299 | inc bx |
301 | 300 | ||
302 | rnewba: |
301 | rnewba: |
303 | 302 | ||
304 | dec bx |
303 | dec bx |
305 | jz rnmba |
304 | jz rnmba |
306 | 305 | ||
307 | add eax,0x10 |
306 | add eax,0x10 |
308 | 307 | ||
309 | mov dx,[CURRENT_TASK] |
308 | mov dx,[CURRENT_TASK] |
310 | cmp dx,[eax] |
309 | cmp dx,[eax] |
311 | jnz rnewba |
310 | jnz rnewba |
312 | 311 | ||
313 | cmp cx,[eax+2] |
312 | cmp cx,[eax+2] |
314 | jnz rnewba |
313 | jnz rnewba |
315 | 314 | ||
316 | pushad |
315 | pushad |
317 | mov ecx,ebx |
316 | mov ecx,ebx |
318 | inc ecx |
317 | inc ecx |
319 | shl ecx,4 |
318 | shl ecx,4 |
320 | mov ebx,eax |
319 | mov ebx,eax |
321 | add eax,0x10 |
320 | add eax,0x10 |
322 | call memmove |
321 | call memmove |
323 | dec dword [edi] |
322 | dec dword [edi] |
324 | popad |
323 | popad |
325 | 324 | ||
326 | jmp rnewba2 |
325 | jmp rnewba2 |
327 | 326 | ||
328 | rnmba: |
327 | rnmba: |
329 | 328 | ||
330 | ret |
329 | ret |
331 | 330 | ||
332 | find_pressed_button_frames: |
331 | find_pressed_button_frames: |
333 | 332 | ||
334 | pushad |
333 | pushad |
335 | 334 | ||
336 | movzx ebx,word [eax+0] |
335 | movzx ebx,word [eax+0] |
337 | shl ebx,5 |
336 | shl ebx,5 |
338 | add ebx,window_data |
337 | add ebx,window_data |
339 | mov ecx, [ebx+ WDATA.box.left] ; window x start |
338 | mov ecx, [ebx+ WDATA.box.left] ; window x start |
340 | movzx edx,word [eax+4] ; button x start |
339 | movzx edx,word [eax+4] ; button x start |
341 | add ecx,edx |
340 | add ecx,edx |
342 | push ecx |
341 | push ecx |
343 | 342 | ||
344 | mov dx,[eax+6] ; button x size |
343 | mov dx,[eax+6] ; button x size |
345 | add cx,dx |
344 | add cx,dx |
346 | mov esi,ecx |
345 | mov esi,ecx |
347 | inc esi |
346 | inc esi |
348 | mov ecx, [ebx+WDATA.box.top] ; window y start |
347 | mov ecx, [ebx+WDATA.box.top] ; window y start |
349 | mov dx,[eax+8] ; button y start |
348 | mov dx,[eax+8] ; button y start |
350 | add ecx,edx |
349 | add ecx,edx |
351 | mov ebx,ecx |
350 | mov ebx,ecx |
352 | mov dx,[eax+10] ; button y size |
351 | mov dx,[eax+10] ; button y size |
353 | add dx,cx |
352 | add dx,cx |
354 | inc dx |
353 | inc dx |
355 | 354 | ||
356 | pop eax |
355 | pop eax |
357 | 356 | ||
358 | ; eax x beginning |
357 | ; eax x beginning |
359 | ; ebx y beginning |
358 | ; ebx y beginning |
360 | ; esi x end |
359 | ; esi x end |
361 | ; edx y end |
360 | ; edx y end |
362 | ; ecx color |
361 | ; ecx color |
363 | 362 | ||
364 | mov [pressed_button_eax],eax |
363 | mov [pressed_button_eax],eax |
365 | mov [pressed_button_ebx],ebx |
364 | mov [pressed_button_ebx],ebx |
366 | mov [pressed_button_ecx],ecx |
365 | mov [pressed_button_ecx],ecx |
367 | mov [pressed_button_edx],edx |
366 | mov [pressed_button_edx],edx |
368 | mov [pressed_button_esi],esi |
367 | mov [pressed_button_esi],esi |
369 | 368 | ||
370 | popad |
369 | popad |
371 | ret |
370 | ret |
372 | 371 | ||
373 | uglobal |
372 | uglobal |
374 | pressed_button_eax dd 0 |
373 | pressed_button_eax dd 0 |
375 | pressed_button_ebx dd 0 |
374 | pressed_button_ebx dd 0 |
376 | pressed_button_ecx dd 0 |
375 | pressed_button_ecx dd 0 |
377 | pressed_button_edx dd 0 |
376 | pressed_button_edx dd 0 |
378 | pressed_button_esi dd 0 |
377 | pressed_button_esi dd 0 |
379 | endg |
378 | endg |
380 | 379 | ||
381 | ; negative button image |
380 | ; negative button image |
382 | 381 | ||
383 | negativebutton: |
382 | negativebutton: |
384 | ; If requested, do not display button |
383 | ; If requested, do not display button |
385 | ; boarder on press. |
384 | ; boarder on press. |
386 | test ebx,0x20000000 |
385 | test ebx,0x20000000 |
387 | jz draw_negative_button |
386 | jz draw_negative_button |
388 | ret |
387 | ret |
389 | draw_negative_button: |
388 | draw_negative_button: |
390 | 389 | ||
391 | pushad |
390 | pushad |
392 | 391 | ||
393 | mov eax,[pressed_button_eax] |
392 | mov eax,[pressed_button_eax] |
394 | mov ebx,[pressed_button_ebx] |
393 | mov ebx,[pressed_button_ebx] |
395 | mov ecx,[pressed_button_ecx] |
394 | mov ecx,[pressed_button_ecx] |
396 | mov edx,[pressed_button_edx] |
395 | mov edx,[pressed_button_edx] |
397 | mov esi,[pressed_button_esi] |
396 | mov esi,[pressed_button_esi] |
398 | mov ecx,0x01000000 |
397 | mov ecx,0x01000000 |
399 | 398 | ||
400 | dec edx |
399 | dec edx |
401 | push edx |
400 | push edx |
402 | inc edx |
401 | inc edx |
403 | dec esi |
402 | dec esi |
404 | push esi |
403 | push esi |
405 | inc esi |
404 | inc esi |
406 | 405 | ||
407 | push eax |
406 | push eax |
408 | push ebx |
407 | push ebx |
409 | push ecx |
408 | push ecx |
410 | push edx |
409 | push edx |
411 | push edi |
410 | push edi |
412 | 411 | ||
413 | call [disable_mouse] |
412 | call [disable_mouse] |
414 | 413 | ||
415 | bdbnewline: |
414 | bdbnewline: |
416 | mov edi,1 ; force |
415 | mov edi,1 ; force |
417 | cmp eax,[esp+16] |
416 | cmp eax,[esp+16] |
418 | jz bneg |
417 | jz bneg |
419 | cmp eax,[esp+20] |
418 | cmp eax,[esp+20] |
420 | jz bneg |
419 | jz bneg |
421 | cmp ebx,[esp+12] |
420 | cmp ebx,[esp+12] |
422 | jz bneg |
421 | jz bneg |
423 | cmp ebx,[esp+24] |
422 | cmp ebx,[esp+24] |
424 | jnz nbneg |
423 | jnz nbneg |
425 | ; jz bneg |
424 | ; jz bneg |
426 | ; jmp nbneg |
425 | ; jmp nbneg |
427 | 426 | ||
428 | bneg: |
427 | bneg: |
429 | 428 | ||
430 | ;;;call [disable_mouse] |
429 | ;;;call [disable_mouse] |
431 | call [putpixel] |
430 | call [putpixel] |
432 | 431 | ||
433 | nbneg: |
432 | nbneg: |
434 | 433 | ||
435 | inc eax |
434 | inc eax |
436 | cmp eax,esi |
435 | cmp eax,esi |
437 | jnz bdbnewline |
436 | jnz bdbnewline |
438 | mov eax,[esp+16] |
437 | mov eax,[esp+16] |
439 | inc ebx |
438 | inc ebx |
440 | cmp ebx,edx |
439 | cmp ebx,edx |
441 | jnz bdbnewline |
440 | jnz bdbnewline |
442 | 441 | ||
443 | add esp,28 |
442 | add esp,28 |
444 | 443 | ||
445 | popad |
444 | popad |
446 | 445 | ||
447 | ret |
446 | ret |
448 | 447 | ||
449 | ; check buttons |
448 | ; check buttons |
450 | 449 | ||
451 | 450 | ||
452 | ; 0000 word process number |
451 | ; 0000 word process number |
453 | ; 0002 word button id number : bits 0-15 |
452 | ; 0002 word button id number : bits 0-15 |
454 | ; 0004 word x start |
453 | ; 0004 word x start |
455 | ; 0006 word x size |
454 | ; 0006 word x size |
456 | ; 0008 word y start |
455 | ; 0008 word y start |
457 | ; 000A word y size |
456 | ; 000A word y size |
458 | ; 000C word button id number : bits 16-31 |
457 | ; 000C word button id number : bits 16-31 |
459 | ; |
458 | ; |
460 | ; button table in 0x10 increments |
459 | ; button table in 0x10 increments |
461 | ; |
460 | ; |
462 | ; first at 0x10 |
461 | ; first at 0x10 |
463 | 462 | ||
464 | 463 | ||
465 | checkbuttons: |
464 | checkbuttons: |
466 | 465 | ||
467 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
466 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
468 | jnz @f |
467 | jnz @f |
469 | ;..................................... start 1/5 : modified by vhanla ............................. |
468 | ;..................................... start 1/5 : modified by vhanla ............................. |
470 | mov [bPressedMouseXY_B],0 |
469 | mov [bPressedMouseXY_B],0 |
471 | ;..................................... end 1/5 : modified by vhanla ............................. |
470 | ;..................................... end 1/5 : modified by vhanla ............................. |
472 | ret |
471 | ret |
473 | @@: |
472 | @@: |
474 | pushad |
473 | pushad |
475 | 474 | ||
476 | xor esi, esi |
475 | xor esi, esi |
477 | mov edi, [BTN_ADDR] |
476 | mov edi, [BTN_ADDR] |
478 | movzx edx, word [edi] |
477 | movzx edx, word [edi] |
479 | test edx, edx |
478 | test edx, edx |
480 | jne @f |
479 | jne @f |
481 | popad |
480 | popad |
482 | ret |
481 | ret |
483 | 482 | ||
484 | @@: |
483 | @@: |
485 | ;..................................... start 2/5 : modified by vhanla ............................. |
484 | ;..................................... start 2/5 : modified by vhanla ............................. |
486 | ;here i catch the coordinates when the mouse's button is clicked |
485 | ;here i catch the coordinates when the mouse's button is clicked |
487 | push ax |
486 | push ax |
488 | cmp [bPressedMouseXY_B],0;FALSE |
487 | cmp [bPressedMouseXY_B],0;FALSE |
489 | jnz @f |
488 | jnz @f |
490 | mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
489 | mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
491 | mov ax,[MOUSE_X] |
490 | mov ax,[MOUSE_X] |
492 | mov [mx],ax |
491 | mov [mx],ax |
493 | mov ax,[MOUSE_Y] |
492 | mov ax,[MOUSE_Y] |
494 | mov [my],ax |
493 | mov [my],ax |
495 | @@: |
494 | @@: |
496 | pop ax |
495 | pop ax |
497 | ;and it is only refreshed after the mouse's button release |
496 | ;and it is only refreshed after the mouse's button release |
498 | ;..................................... end 2/5 : modified by vhanla ............................. |
497 | ;..................................... end 2/5 : modified by vhanla ............................. |
499 | 498 | ||
500 | push esi |
499 | push esi |
501 | inc edx |
500 | inc edx |
502 | push edx |
501 | push edx |
503 | 502 | ||
504 | buttonnewcheck: |
503 | buttonnewcheck: |
505 | 504 | ||
506 | pop edx |
505 | pop edx |
507 | pop esi |
506 | pop esi |
508 | inc esi |
507 | inc esi |
509 | cmp edx,esi |
508 | cmp edx,esi |
510 | jge bch |
509 | jge bch |
511 | 510 | ||
512 | popad ; no button pressed |
511 | popad ; no button pressed |
513 | ret |
512 | ret |
514 | 513 | ||
515 | bch: |
514 | bch: |
516 | 515 | ||
517 | push esi |
516 | push esi |
518 | push edx |
517 | push edx |
519 | mov eax,esi |
518 | mov eax,esi |
520 | shl eax,4 |
519 | shl eax,4 |
521 | add eax,edi |
520 | add eax,edi |
522 | 521 | ||
523 | ; check that button is at top of windowing stack |
522 | ; check that button is at top of windowing stack |
524 | 523 | ||
525 | movzx ebx,word [eax] |
524 | movzx ebx,word [eax] |
526 | movzx ecx,word [WIN_STACK + ebx * 2] |
525 | movzx ecx,word [WIN_STACK + ebx * 2] |
527 | cmp ecx,[TASK_COUNT] |
526 | cmp ecx,[TASK_COUNT] |
528 | jne buttonnewcheck |
527 | jne buttonnewcheck |
529 | 528 | ||
530 | ; check that button start is inside window x/y end |
529 | ; check that button start is inside window x/y end |
531 | 530 | ||
532 | movzx ebx,word [eax+0] |
531 | movzx ebx,word [eax+0] |
533 | shl ebx,5 |
532 | shl ebx,5 |
534 | 533 | ||
535 | test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
534 | test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
536 | jnz buttonnewcheck |
535 | jnz buttonnewcheck |
537 | 536 | ||
538 | ; add ebx,window_data |
537 | ; add ebx,window_data |
539 | ; mov ecx,[window_data+ebx+8] ; window end X |
538 | ; mov ecx,[window_data+ebx+8] ; window end X |
540 | movzx edx,word [eax+4] ; button start X |
539 | movzx edx,word [eax+4] ; button start X |
541 | cmp edx, [window_data+ebx+WDATA.box.width] ;ecx |
540 | cmp edx, [window_data+ebx+WDATA.box.width] ;ecx |
542 | jge buttonnewcheck |
541 | jge buttonnewcheck |
543 | 542 | ||
544 | ; mov ecx,[window_data+ebx+12] ; window end Y |
543 | ; mov ecx,[window_data+ebx+12] ; window end Y |
545 | movzx edx, word [eax+8] ; button start Y |
544 | movzx edx, word [eax+8] ; button start Y |
546 | cmp edx, [window_data+ebx+WDATA.box.height] ;ecx |
545 | cmp edx, [window_data+ebx+WDATA.box.height] ;ecx |
547 | jge buttonnewcheck |
546 | jge buttonnewcheck |
548 | 547 | ||
549 | ; check coordinates |
548 | ; check coordinates |
550 | ; mouse x >= button x ? |
549 | ; mouse x >= button x ? |
551 | movzx ebx,word [eax+0] |
550 | movzx ebx,word [eax+0] |
552 | shl ebx,5 |
551 | shl ebx,5 |
553 | add ebx,window_data |
552 | add ebx,window_data |
554 | mov ecx, [ebx+WDATA.box.left] ; window x start |
553 | mov ecx, [ebx+WDATA.box.left] ; window x start |
555 | movzx edx,word [eax+4] ; button x start |
554 | movzx edx,word [eax+4] ; button x start |
556 | add edx,ecx |
555 | add edx,ecx |
557 | ;..................................... start 3/5 : modified by vhanla ............................. |
556 | ;..................................... start 3/5 : modified by vhanla ............................. |
558 | mov cx,[mx] ;mov cx,[MOUSE_X] |
557 | mov cx,[mx] ;mov cx,[MOUSE_X] |
559 | ;..................................... end 3/5 : modified by vhanla ............................. |
558 | ;..................................... end 3/5 : modified by vhanla ............................. |
560 | cmp edx,ecx |
559 | cmp edx,ecx |
561 | jg buttonnewcheck |
560 | jg buttonnewcheck |
562 | 561 | ||
563 | movzx ebx,word [eax+6] ; button x size |
562 | movzx ebx,word [eax+6] ; button x size |
564 | add edx,ebx |
563 | add edx,ebx |
565 | cmp ecx,edx |
564 | cmp ecx,edx |
566 | jg buttonnewcheck |
565 | jg buttonnewcheck |
567 | 566 | ||
568 | ; mouse y >= button y ? |
567 | ; mouse y >= button y ? |
569 | movzx ebx,word [eax+0] |
568 | movzx ebx,word [eax+0] |
570 | shl ebx,5 |
569 | shl ebx,5 |
571 | add ebx,window_data |
570 | add ebx,window_data |
572 | mov ecx, [ebx+WDATA.box.top] ; window y start |
571 | mov ecx, [ebx+WDATA.box.top] ; window y start |
573 | movzx edx,word [eax+8] ; button y start |
572 | movzx edx,word [eax+8] ; button y start |
574 | add edx,ecx |
573 | add edx,ecx |
575 | ;..................................... start 4/5 : modified by vhanla ............................. |
574 | ;..................................... start 4/5 : modified by vhanla ............................. |
576 | mov cx,[my] ;mov cx,[MOUSE_Y] |
575 | mov cx,[my] ;mov cx,[MOUSE_Y] |
577 | ;..................................... start 4/5 : modified by vhanla ............................. |
576 | ;..................................... start 4/5 : modified by vhanla ............................. |
578 | cmp edx,ecx |
577 | cmp edx,ecx |
579 | jg buttonnewcheck |
578 | jg buttonnewcheck |
580 | 579 | ||
581 | movzx ebx,word [eax+10] ; button y size |
580 | movzx ebx,word [eax+10] ; button y size |
582 | add edx,ebx |
581 | add edx,ebx |
583 | cmp ecx,edx |
582 | cmp ecx,edx |
584 | jg buttonnewcheck |
583 | jg buttonnewcheck |
585 | 584 | ||
586 | ; mouse on button |
585 | ; mouse on button |
587 | 586 | ||
588 | pop edx |
587 | pop edx |
589 | pop esi |
588 | pop esi |
590 | 589 | ||
591 | mov bx,[eax+0xc] ; button id : bits 16-31 |
590 | mov bx,[eax+0xc] ; button id : bits 16-31 |
592 | shl ebx,16 |
591 | shl ebx,16 |
593 | mov bx,[eax+2] ; button id : bits 00-16 |
592 | mov bx,[eax+2] ; button id : bits 00-16 |
594 | push ebx |
593 | push ebx |
595 | 594 | ||
596 | mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
595 | mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
597 | call find_pressed_button_frames |
596 | call find_pressed_button_frames |
598 | call negativebutton |
597 | call negativebutton |
599 | 598 | ||
600 | pushad |
599 | pushad |
601 | cbwaitmouseup: |
600 | cbwaitmouseup: |
602 | 601 | ||
603 | call checkidle |
602 | call checkidle |
604 | 603 | ||
605 | call [draw_pointer] |
604 | call [draw_pointer] |
606 | 605 | ||
607 | pushad |
606 | pushad |
608 | call stack_handler |
607 | call stack_handler |
609 | popad |
608 | popad |
610 | 609 | ||
611 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
610 | cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
612 | jnz cbwaitmouseup |
611 | jnz cbwaitmouseup |
613 | popad |
612 | popad |
614 | 613 | ||
615 | call negativebutton |
614 | call negativebutton |
616 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
615 | mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
617 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
616 | mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
618 | ;..................................... start 5/5 : modified by vhanla ............................. |
617 | ;..................................... start 5/5 : modified by vhanla ............................. |
619 | ; check coordinates |
618 | ; check coordinates |
620 | jmp @f |
619 | jmp @f |
621 | mx dw 0x0 ; keeps the x mouse's position when it was clicked |
620 | mx dw 0x0 ; keeps the x mouse's position when it was clicked |
622 | my dw 0x0 ; keeps the y mouse's position when it was clicked |
621 | my dw 0x0 ; keeps the y mouse's position when it was clicked |
623 | bPressedMouseXY_B db 0x0 |
622 | bPressedMouseXY_B db 0x0 |
624 | @@: |
623 | @@: |
625 | 624 | ||
626 | pusha |
625 | pusha |
627 | ; mouse x >= button x ? |
626 | ; mouse x >= button x ? |
628 | movzx ebx,word [eax+0] |
627 | movzx ebx,word [eax+0] |
629 | shl ebx,5 |
628 | shl ebx,5 |
630 | add ebx,window_data |
629 | add ebx,window_data |
631 | mov ecx, [ebx+WDATA.box.left] ; window x start |
630 | mov ecx, [ebx+WDATA.box.left] ; window x start |
632 | movzx edx,word [eax+4] ; button x start |
631 | movzx edx,word [eax+4] ; button x start |
633 | add edx,ecx |
632 | add edx,ecx |
634 | mov cx,[MOUSE_X] |
633 | mov cx,[MOUSE_X] |
635 | cmp edx,ecx |
634 | cmp edx,ecx |
636 | jg no_on_button ;if we release the pointer out of the button area |
635 | jg no_on_button ;if we release the pointer out of the button area |
637 | 636 | ||
638 | movzx ebx,word [eax+6] ; button x size |
637 | movzx ebx,word [eax+6] ; button x size |
639 | add edx,ebx |
638 | add edx,ebx |
640 | cmp ecx,edx |
639 | cmp ecx,edx |
641 | jg no_on_button |
640 | jg no_on_button |
642 | 641 | ||
643 | ; mouse y >= button y ? |
642 | ; mouse y >= button y ? |
644 | movzx ebx,word [eax+0] |
643 | movzx ebx,word [eax+0] |
645 | shl ebx,5 |
644 | shl ebx,5 |
646 | add ebx,window_data |
645 | add ebx,window_data |
647 | mov ecx, [ebx+WDATA.box.top] ; window y start |
646 | mov ecx, [ebx+WDATA.box.top] ; window y start |
648 | movzx edx,word [eax+8] ; button y start |
647 | movzx edx,word [eax+8] ; button y start |
649 | add edx,ecx |
648 | add edx,ecx |
650 | mov cx,[MOUSE_Y] |
649 | mov cx,[MOUSE_Y] |
651 | cmp edx,ecx |
650 | cmp edx,ecx |
652 | jg no_on_button |
651 | jg no_on_button |
653 | 652 | ||
654 | movzx ebx,word [eax+10] ; button y size |
653 | movzx ebx,word [eax+10] ; button y size |
655 | add edx,ebx |
654 | add edx,ebx |
656 | cmp ecx,edx |
655 | cmp ecx,edx |
657 | jg no_on_button |
656 | jg no_on_button |
658 | popa |
657 | popa |
659 | mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
658 | mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
660 | pop ebx |
659 | pop ebx |
661 | mov [BTN_BUFF],ebx ; lets put the button id in buffer |
660 | mov [BTN_BUFF],ebx ; lets put the button id in buffer |
662 | push ebx |
661 | push ebx |
663 | pusha |
662 | pusha |
664 | jmp yes_on_button |
663 | jmp yes_on_button |
665 | no_on_button: |
664 | no_on_button: |
666 | mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
665 | mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
667 | yes_on_button: |
666 | yes_on_button: |
668 | mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
667 | mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
669 | popa |
668 | popa |
670 | pop ebx |
669 | pop ebx |
671 | popa |
670 | popa |
672 | ret |
671 | ret |
673 | 672 | ||
674 | ;..................................... end 5/5 : modified by vhanla ................................ |
673 | ;..................................... end 5/5 : modified by vhanla ................................ |