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