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