Rev 4970 | Rev 5363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4970 | Rev 5185 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
4 | ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 8... | Line 8... | ||
8 | 8 | ||
Line 9... | Line 9... | ||
9 | $Revision: 4970 $ |
9 | $Revision: 5185 $ |
10 | 10 | ||
11 | ;============================================================================== |
11 | ;============================================================================== |
Line 37... | Line 37... | ||
37 | ;> edx = pack[8(flags), 24(button identifier)] |
37 | ;> edx = pack[8(flags), 24(button identifier)] |
38 | ;> flags bits: |
38 | ;> flags bits: |
39 | ;> 7 (31) = 0 |
39 | ;> 7 (31) = 0 |
40 | ;> 6 (30) = don't draw button |
40 | ;> 6 (30) = don't draw button |
41 | ;> 5 (29) = don't draw button frame when pressed |
41 | ;> 5 (29) = don't draw button frame when pressed |
42 | ;> 4 (28) = don't draw button 3d frame |
- | |
43 | ;> esi = button color |
42 | ;> esi = button color |
44 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
43 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
45 | ;; Undefine button: |
44 | ;; Undefine button: |
46 | ;> edx = pack[8(flags), 24(button identifier)] |
45 | ;> edx = pack[8(flags), 24(button identifier)] |
47 | ;> flags bits: |
46 | ;> flags bits: |
Line 85... | Line 84... | ||
85 | mov ax, [CURRENT_TASK] |
84 | mov ax, [CURRENT_TASK] |
86 | stosw |
85 | stosw |
87 | mov ax, dx |
86 | mov ax, dx |
88 | stosw ; button id number: bits 0-15 |
87 | stosw ; button id number: bits 0-15 |
89 | mov eax, ebx |
88 | mov eax, ebx |
90 | dec eax |
- | |
91 | rol eax, 16 |
89 | rol eax, 16 |
92 | stosd ; x start | x size |
90 | stosd ; x start | x size |
93 | mov eax, ecx |
91 | mov eax, ecx |
94 | dec eax |
- | |
95 | rol eax, 16 |
92 | rol eax, 16 |
96 | stosd ; y start | y size |
93 | stosd ; y start | y size |
97 | mov eax, edx |
94 | mov eax, edx |
98 | shr eax, 16 |
95 | shr eax, 16 |
99 | stosw ; button id number: bits 16-31 |
96 | stosw ; button id number: bits 16-31 |
Line 101... | Line 98... | ||
101 | 98 | ||
102 | ; do we also need to draw the button? |
99 | ; do we also need to draw the button? |
103 | test edx, 0x40000000 |
100 | test edx, 0x40000000 |
Line 104... | Line 101... | ||
104 | jnz .exit |
101 | jnz .exit |
- | 102 | ||
105 | 103 | ; draw button body |
|
- | 104 | ||
106 | ; DRAW BODY ----------------------------- |
105 | pushad |
- | 106 | ||
- | 107 | ; calculate window-relative coordinates |
|
- | 108 | movzx edi, cx |
|
- | 109 | shr ebx, 16 |
|
107 | pushad |
110 | shr ecx, 16 |
- | 111 | mov eax, [TASK_BASE] |
|
- | 112 | add ebx, [eax - twdw + WDATA.box.left] |
|
- | 113 | add ecx, [eax - twdw + WDATA.box.top] |
|
- | 114 | mov eax, ebx |
|
- | 115 | shl eax, 16 |
|
- | 116 | mov ax, bx |
|
- | 117 | add ax, word[esp + 16] |
|
108 | call button._.button_calc_relativ |
118 | mov ebx, ecx |
- | 119 | shl ebx, 16 |
|
- | 120 | mov bx, cx |
|
109 | xor edi, edi ; for __sys_draw_line |
121 | |
110 | ; set color |
- | |
111 | mov ecx, esi |
- | |
112 | ; set coordinate |
- | |
113 | inc edx |
122 | ; calculate initial color |
114 | ; if gradient |
123 | mov ecx, esi |
115 | cmp [buttontype], 0 |
124 | cmp [buttontype], 0 |
- | 125 | je @f |
|
- | 126 | call button._.incecx2 |
|
116 | je .next_line |
127 | |
- | 128 | ; set button height counter |
|
- | 129 | @@: |
|
117 | call button._.incecx |
130 | mov edx, edi |
118 | align 4 |
131 | |
- | 132 | .next_line: |
|
- | 133 | call button._.button_dececx |
|
- | 134 | push edi |
|
119 | .next_line: |
135 | xor edi, edi |
- | 136 | ; call [draw_line] |
|
120 | call button._.button_dececx |
137 | call __sys_draw_line |
121 | call __sys_draw_line |
138 | pop edi |
122 | add ebx, 0x00010001 |
139 | add ebx, 0x00010001 |
123 | dec edx |
- | |
Line 124... | Line -... | ||
124 | jnz .next_line |
- | |
125 | popad |
- | |
126 | - | ||
127 | ; DRAW FRAME ---------------------------- |
- | |
128 | pushad |
- | |
129 | call button._.button_calc_relativ |
- | |
130 | mov esi, common_colours |
- | |
131 | - | ||
132 | mov edi, dword [esi+104] |
- | |
133 | call .top_border |
- | |
134 | mov edi, dword [esi+104] |
- | |
135 | call .bottom_border |
- | |
136 | mov edi, dword [esi+104] |
- | |
137 | call .right_border |
140 | dec edx |
Line 138... | Line -... | ||
138 | mov edi, dword [esi+104] |
- | |
139 | call .left_border |
- | |
140 | popad |
141 | jnz .next_line |
Line 141... | Line -... | ||
141 | - | ||
142 | ; DRAW 3D SHADOW ------------------------ |
- | |
143 | test edx, 0x10000000 |
- | |
144 | jnz .exit |
- | |
145 | - | ||
146 | pushad |
- | |
147 | mov edi, edx |
- | |
148 | call button._.button_calc_relativ |
- | |
149 | ; get color address |
- | |
150 | mov esi, common_colours |
142 | |
151 | test edi, 0x10000000 |
- | |
152 | jnz @f |
- | |
153 | add eax, 0x10000 |
- | |
154 | dec eax |
- | |
155 | inc ecx |
- | |
156 | dec edx |
- | |
157 | dec edx |
- | |
158 | align 4 |
- | |
159 | @@: |
- | |
160 | mov edi, dword [esi+12] |
- | |
161 | call .top_border |
- | |
162 | mov edi, dword [esi+8] |
- | |
163 | call .bottom_border |
- | |
164 | mov edi, dword [esi+8] |
- | |
Line -... | Line 143... | ||
- | 143 | popad |
|
- | 144 | ||
- | 145 | ; draw button frame |
|
- | 146 | ||
- | 147 | push ebx ecx |
|
- | 148 | ||
165 | call .right_border |
149 | ; calculate window-relative coordinates |
166 | mov edi, dword [esi+12] |
150 | shr ebx, 16 |
- | 151 | shr ecx, 16 |
|
- | 152 | mov eax, [TASK_BASE] |
|
- | 153 | add ebx, [eax - twdw + WDATA.box.left] |
|
- | 154 | add ecx, [eax - twdw + WDATA.box.top] |
|
167 | call .left_border |
155 | |
168 | popad |
156 | ; top border |
169 | ret |
157 | mov eax, ebx |
170 | 158 | shl eax, 16 |
|
171 | align 4 |
159 | mov ax, bx |
- | 160 | add ax, [esp + 4] |
|
- | 161 | mov ebx, ecx |
|
- | 162 | shl ebx, 16 |
|
172 | .top_border: |
163 | mov bx, cx |
173 | mov ebx, ecx |
- | |
Line 174... | Line -... | ||
174 | shl ebx, 16 |
- | |
175 | mov bx , cx |
164 | push ebx |
- | 165 | xor edi, edi |
|
176 | mov ecx, edi |
166 | mov ecx, esi |
177 | xor edi, edi |
167 | call button._.incecx |
178 | call __sys_draw_line |
168 | ; call [draw_line] |
179 | ret |
169 | call __sys_draw_line |
- | 170 | ||
180 | 171 | ; bottom border |
|
181 | align 4 |
172 | movzx edx, word[esp + 4 + 0] |
182 | .bottom_border: |
- | |
Line 183... | Line 173... | ||
183 | add bx , dx |
173 | add ebx, edx |
184 | rol ebx, 16 |
174 | shl edx, 16 |
185 | add bx , dx |
175 | add ebx, edx |
- | 176 | mov ecx, esi |
|
- | 177 | call button._.dececx |
|
186 | mov ecx, edi |
178 | ; call [draw_line] |
187 | xor edi, edi |
179 | call __sys_draw_line |
188 | call __sys_draw_line |
180 | |
189 | ret |
181 | ; left border |
- | 182 | pop ebx |
|
190 | 183 | push edx |
|
191 | align 4 |
184 | mov edx, eax |
- | 185 | shr edx, 16 |
|
- | 186 | mov ax, dx |
|
192 | .right_border: |
187 | mov edx, ebx |
193 | push eax |
- | |
194 | sub bx, dx |
- | |
Line 195... | Line -... | ||
195 | mov cx, ax |
- | |
196 | shl eax, 16 |
188 | shr edx, 16 |
197 | mov ax, cx |
189 | mov bx, dx |
198 | mov ecx, edi |
190 | add bx, [esp + 4 + 0] |
199 | xor edi, edi |
191 | pop edx |
200 | call __sys_draw_line |
192 | mov ecx, esi |
- | 193 | call button._.incecx |
|
201 | pop eax |
194 | ; call [draw_line] |
- | 195 | call __sys_draw_line |
|
202 | ret |
196 | |
203 | 197 | ; right border |
|
- | 198 | mov dx, [esp + 4] |
|
204 | align 4 |
199 | add ax, dx |
205 | .left_border: |
200 | shl edx, 16 |
206 | shr eax, 16 |
201 | add eax, edx |
207 | mov cx, ax |
202 | add ebx, 0x00010000 |
Line 208... | Line 203... | ||
208 | shl eax, 16 |
203 | mov ecx, esi |
209 | mov ax, cx |
204 | call button._.dececx |
Line 272... | Line 267... | ||
272 | call button._.find_button |
267 | call button._.find_button |
273 | or eax, eax |
268 | or eax, eax |
274 | jz .exit |
269 | jz .exit |
Line 275... | Line 270... | ||
275 | 270 | ||
276 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
- | |
277 | push edi ; spam |
- | |
278 | xor edi, edi |
271 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
279 | call button._.negative_button |
- | |
- | 272 | call button._.negative_button |
|
280 | pop edi |
273 | |
281 | .exit: |
274 | .exit: |
Line 282... | Line 275... | ||
282 | ret |
275 | ret |
283 | 276 | ||
Line 294... | Line 287... | ||
294 | call button._.find_button |
287 | call button._.find_button |
295 | or eax, eax |
288 | or eax, eax |
296 | jz .exit |
289 | jz .exit |
Line 297... | Line 290... | ||
297 | 290 | ||
298 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
- | |
299 | push edi ; spam |
- | |
300 | xor edi, edi |
- | |
301 | inc edi |
291 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
302 | call button._.negative_button |
- | |
- | 292 | call button._.negative_button |
|
303 | pop edi |
293 | |
304 | .exit: |
294 | .exit: |
Line 305... | Line 295... | ||
305 | ret |
295 | ret |
306 | 296 | ||
Line 382... | Line 372... | ||
382 | .exit: |
372 | .exit: |
383 | pop edi esi edx ecx |
373 | pop edi esi edx ecx |
384 | ret |
374 | ret |
Line 385... | Line 375... | ||
385 | 375 | ||
386 | ;------------------------------------------------------------------------------ |
376 | ;------------------------------------------------------------------------------ |
387 | button._.button_dececx: ;////////////////////////////////////////////////////// |
377 | button._.dececx: ;///////////////////////////////////////////////////////////// |
388 | ;------------------------------------------------------------------------------ |
378 | ;------------------------------------------------------------------------------ |
389 | ;? |
379 | ;? |
390 | ;------------------------------------------------------------------------------ |
- | |
391 | cmp [buttontype], 1 |
- | |
392 | jne .finish |
- | |
393 | - | ||
394 | push eax |
- | |
395 | mov al, 1 |
- | |
396 | ;cmp edi, 20 |
- | |
397 | ;jg @f |
- | |
398 | ;mov al, 2 |
- | |
399 | - | ||
400 | @@: |
380 | ;------------------------------------------------------------------------------ |
401 | sub cl, al |
381 | sub cl, 0x20 |
402 | jnc @f |
382 | jnc @f |
403 | xor cl, cl |
383 | xor cl, cl |
404 | @@: |
384 | @@: |
405 | sub ch, al |
385 | sub ch, 0x20 |
406 | jnc @f |
386 | jnc @f |
407 | xor ch, ch |
387 | xor ch, ch |
408 | @@: |
388 | @@: |
409 | rol ecx, 16 |
389 | rol ecx, 16 |
410 | sub cl, al |
390 | sub cl, 0x20 |
411 | jnc @f |
391 | jnc @f |
412 | xor cl, cl |
392 | xor cl, cl |
413 | @@: |
393 | @@: |
- | 394 | rol ecx, 16 |
|
Line -... | Line 395... | ||
- | 395 | ret |
|
- | 396 | ||
- | 397 | ;------------------------------------------------------------------------------ |
|
- | 398 | button._.incecx: ;///////////////////////////////////////////////////////////// |
|
- | 399 | ;------------------------------------------------------------------------------ |
|
- | 400 | ;? |
|
414 | rol ecx, 16 |
401 | ;------------------------------------------------------------------------------ |
- | 402 | add cl, 0x20 |
|
415 | 403 | jnc @f |
|
- | 404 | or cl, -1 |
|
- | 405 | @@: |
|
- | 406 | add ch, 0x20 |
|
416 | pop eax |
407 | jnc @f |
- | 408 | or ch, -1 |
|
- | 409 | @@: |
|
- | 410 | rol ecx, 16 |
|
- | 411 | add cl, 0x20 |
|
- | 412 | jnc @f |
|
- | 413 | or cl, -1 |
|
417 | 414 | @@: |
|
- | 415 | rol ecx, 16 |
|
418 | .finish: |
416 | ret |
419 | ret |
417 | |
420 | ;------------------------------------------------------------------------------ |
418 | ;------------------------------------------------------------------------------ |
421 | button._.incecx: ;//////////////////////////////////////////////////////////// |
419 | button._.incecx2: ;//////////////////////////////////////////////////////////// |
422 | ;------------------------------------------------------------------------------ |
420 | ;------------------------------------------------------------------------------ |
423 | ;? |
421 | ;? |
424 | ;------------------------------------------------------------------------------ |
422 | ;------------------------------------------------------------------------------ |
Line 435... | Line 433... | ||
435 | jnc @f |
433 | jnc @f |
436 | or cl, -1 |
434 | or cl, -1 |
437 | @@: |
435 | @@: |
438 | rol ecx, 16 |
436 | rol ecx, 16 |
439 | ret |
437 | ret |
- | 438 | ||
440 | ;------------------------------------------------------------------------------ |
439 | ;------------------------------------------------------------------------------ |
441 | button._.button_calc_relativ: ; |
440 | button._.button_dececx: ;////////////////////////////////////////////////////// |
442 | ;------------------------------------------------------------------------------ |
441 | ;------------------------------------------------------------------------------ |
443 | ;? |
442 | ;? |
444 | ;------------------------------------------------------------------------------ |
443 | ;------------------------------------------------------------------------------ |
- | 444 | cmp [buttontype], 1 |
|
445 | movzx edx, cx |
445 | jne .finish |
- | 446 | ||
446 | dec edx ; get height |
447 | push eax |
447 | shr ebx, 16 |
448 | mov al, 1 |
448 | shr ecx, 16 |
449 | cmp edi, 20 |
- | 450 | jg @f |
|
449 | mov eax, [TASK_BASE] |
451 | mov al, 2 |
- | 452 | ||
- | 453 | @@: |
|
450 | add ebx, [eax - twdw + WDATA.box.left] |
454 | sub cl, al |
- | 455 | jnc @f |
|
451 | add ecx, [eax - twdw + WDATA.box.top] |
456 | xor cl, cl |
- | 457 | @@: |
|
452 | mov eax, ebx |
458 | sub ch, al |
- | 459 | jnc @f |
|
453 | shl eax, 16 |
460 | xor ch, ch |
- | 461 | @@: |
|
454 | mov ax, bx |
462 | rol ecx, 16 |
455 | add ax, word[esp + 20] |
463 | sub cl, al |
456 | dec eax |
464 | jnc @f |
457 | mov bx, cx |
465 | xor cl, cl |
- | 466 | @@: |
|
458 | shl ebx, 16 |
467 | rol ecx, 16 |
- | 468 | ||
459 | mov bx, cx |
469 | pop eax |
- | 470 | ||
- | 471 | .finish: |
|
460 | ret |
472 | ret |
Line 461... | Line 473... | ||
461 | 473 | ||
462 | ;------------------------------------------------------------------------------ |
474 | ;------------------------------------------------------------------------------ |
463 | button._.negative_button: ;//////////////////////////////////////////////////// |
475 | button._.negative_button: ;//////////////////////////////////////////////////// |
464 | ;------------------------------------------------------------------------------ |
476 | ;------------------------------------------------------------------------------ |
465 | ;? Invert system button border |
- | |
466 | ; edi - 0 activate, 1 - deactivate |
477 | ;? Invert system button border |
467 | ;------------------------------------------------------------------------------ |
478 | ;------------------------------------------------------------------------------ |
468 | ; if requested, do not display button border on press. |
479 | ; if requested, do not display button border on press. |
469 | test ebx, 0x20000000 |
480 | test ebx, 0x20000000 |
Line 470... | Line 481... | ||
470 | jnz .exit |
481 | jnz .exit |
471 | - | ||
- | 482 | ||
472 | pushad |
483 | pushad |
Line 473... | Line 484... | ||
473 | push ebx |
484 | |
474 | xchg esi, eax |
485 | xchg esi, eax |
475 | 486 | ||
Line 486... | Line 497... | ||
486 | rol eax, 16 |
497 | rol eax, 16 |
487 | rol ebx, 16 |
498 | rol ebx, 16 |
488 | add ax, cx |
499 | add ax, cx |
489 | add bx, dx |
500 | add bx, dx |
Line 490... | Line -... | ||
490 | - | ||
491 | xor edx, edx |
- | |
492 | mov dx, [esi + SYS_BUTTON.id_lo] |
- | |
493 | - | ||
494 | cmp dx, 1 |
- | |
495 | jne .no_close |
- | |
496 | sub eax, 0x00010001 |
- | |
497 | dec ebx |
- | |
498 | mov esi, 0x01000000 |
- | |
499 | call draw_rectangle.forced |
- | |
500 | jmp .fade |
- | |
501 | align 4 |
- | |
502 | .no_close: |
- | |
503 | cmp dx, 65535 |
- | |
504 | jne .no_mini |
- | |
505 | sub eax, 0x00010001 |
- | |
506 | dec ebx |
501 | |
507 | mov esi, 0x01000000 |
502 | mov esi, 0x01000000 |
508 | call draw_rectangle.forced |
- | |
509 | jmp .fade |
- | |
510 | align 4 |
- | |
511 | .no_mini: |
- | |
512 | add eax, 0x00010000 |
- | |
513 | add ebx, 0x00010000 |
- | |
514 | pop edx |
- | |
515 | test edx, 0x10000000 |
- | |
516 | jnz .only_frame |
- | |
517 | mov edx, common_colours |
- | |
518 | mov esi, dword [edx+12] |
- | |
519 | cmp edi, 0 |
- | |
520 | jne .shadow |
- | |
521 | mov esi, dword [edx+8] |
- | |
522 | align 4 |
- | |
523 | .shadow: |
- | |
524 | call draw_rectangle.forced |
- | |
525 | align 4 |
- | |
526 | .only_frame: |
- | |
527 | mov edx, common_colours |
- | |
528 | sub eax, 0x00010000 |
- | |
529 | sub ebx, 0x00010000 |
- | |
530 | mov esi, dword [edx+104] |
- | |
531 | cmp edi, 0 |
- | |
532 | jne .draw |
- | |
533 | mov esi, dword [edx+112] |
- | |
534 | align 4 |
503 | call draw_rectangle.forced |
535 | .draw: |
- | |
536 | call draw_rectangle.forced |
- | |
537 | popad |
- | |
538 | ret |
- | |
539 | align 4 |
- | |
540 | .fade: |
- | |
541 | pop ebx |
504 | |
542 | popad |
505 | popad |
543 | align 4 |
506 | |
544 | .exit: |
507 | .exit: |