Rev 5594 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5594 | Rev 6078 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
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 | ||
9 | $Revision: 5594 $ |
- | |
10 | - | ||
11 | ;============================================================================== |
- | |
12 | ;///// public functions /////////////////////////////////////////////////////// |
- | |
Line 13... | Line 9... | ||
13 | ;============================================================================== |
9 | $Revision: 6078 $ |
Line 14... | Line 10... | ||
14 | 10 | ||
15 | button.MAX_BUTTONS = 4095 |
11 | button.MAX_BUTTONS = 4095 |
Line 23... | Line 19... | ||
23 | height dw ? |
19 | height dw ? |
24 | id_hi dw ? |
20 | id_hi dw ? |
25 | dw ? |
21 | dw ? |
26 | ends |
22 | ends |
Line 27... | Line -... | ||
27 | - | ||
28 | align 4 |
23 | |
29 | ;------------------------------------------------------------------------------ |
24 | ;--------------------------------------------------------------- |
30 | syscall_button: ;///// system function 8 ////////////////////////////////////// |
25 | syscall_button: ;////////////// system function 8 ////////////// |
31 | ;------------------------------------------------------------------------------ |
26 | ;--------------------------------------------------------------- |
32 | ;? Define/undefine GUI button object |
27 | ;? Define/undefine GUI button object |
33 | ;------------------------------------------------------------------------------ |
28 | ;--------------------------------------------------------------- |
34 | ;; Define button: |
29 | ;; Define button: |
35 | ;> ebx = pack[16(x), 16(width)] |
30 | ;> ebx = pack[16(x), 16(width)] |
36 | ;> ecx = pack[16(y), 16(height)] |
31 | ;> ecx = pack[16(y), 16(height)] |
37 | ;> edx = pack[8(flags), 24(button identifier)] |
32 | ;> edx = pack[8(flags), 24(button identifier)] |
38 | ;> flags bits: |
33 | ;> flags bits: |
39 | ;> 7 (31) = 0 |
34 | ;> 7 (31) = 0 |
40 | ;> 6 (30) = don't draw button |
35 | ;> 6 (30) = don't draw button |
41 | ;> 5 (29) = don't draw button frame when pressed |
36 | ;> 5 (29) = don't draw button frame when pressed |
42 | ;> esi = button color |
37 | ;> esi = button color |
43 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
38 | ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
44 | ;; Undefine button: |
39 | ;; Undefine button: |
45 | ;> edx = pack[8(flags), 24(button identifier)] |
40 | ;> edx = pack[8(flags), 24(button identifier)] |
46 | ;> flags bits: |
41 | ;> flags bits: |
47 | ;> 7 (31) = 1 |
42 | ;> 7 (31) = 1 |
48 | ;------------------------------------------------------------------------------ |
43 | ;--------------------------------------------------------------- |
49 | ; do we actually need to undefine the button? |
44 | ; do we actually need to undefine the button? |
50 | test edx, 0x80000000 |
45 | test edx, 0x80000000 |
Line 51... | Line 46... | ||
51 | jnz .remove_button |
46 | jnz .remove_button |
Line 72... | Line 67... | ||
72 | add cx, word[eax + APPDATA.wnd_clientbox.top] |
67 | add cx, word[eax + APPDATA.wnd_clientbox.top] |
73 | rol ecx, 16 |
68 | rol ecx, 16 |
74 | pop eax |
69 | pop eax |
Line 75... | Line 70... | ||
75 | 70 | ||
76 | ; basic checks passed, define the button |
- | |
77 | push ebx ecx edx |
71 | ; basic checks passed, define the button |
78 | inc eax |
72 | inc eax |
79 | mov [edi], ax |
73 | mov [edi], ax |
80 | shl eax, 4 |
74 | shl eax, 4 |
81 | add edi, eax |
75 | add edi, eax |
82 | ; NOTE: this code doesn't rely on SYS_BUTTON struct, please revise it |
76 | ; NOTE: this code doesn't rely on SYS_BUTTON struct, |
83 | ; if you change something |
77 | ; please revise it, if you change something. |
84 | mov ax, [CURRENT_TASK] |
78 | mov ax, [CURRENT_TASK] |
85 | stosw |
79 | stosw |
86 | mov ax, dx |
80 | mov ax, dx |
87 | stosw ; button id number: bits 0-15 |
81 | stosw ; button id number: bits 0-15 |
Line 92... | Line 86... | ||
92 | rol eax, 16 |
86 | rol eax, 16 |
93 | stosd ; y start | y size |
87 | stosd ; y start | y size |
94 | mov eax, edx |
88 | mov eax, edx |
95 | shr eax, 16 |
89 | shr eax, 16 |
96 | stosw ; button id number: bits 16-31 |
90 | stosw ; button id number: bits 16-31 |
97 | pop edx ecx ebx |
- | |
Line 98... | Line 91... | ||
98 | 91 | ||
99 | ; do we also need to draw the button? |
92 | ; do we also need to draw the button? |
100 | test edx, 0x40000000 |
93 | test edx, 0x40000000 |
Line 101... | Line -... | ||
101 | jnz .exit |
- | |
102 | - | ||
103 | ; draw button body |
- | |
104 | - | ||
105 | pushad |
- | |
106 | 94 | jnz .exit |
|
107 | ; calculate window-relative coordinates |
95 | |
108 | movzx edi, cx |
96 | and esi, 0xFFFFFF |
109 | shr ebx, 16 |
- | |
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] |
97 | xor edi, edi |
114 | mov eax, ebx |
- | |
115 | inc eax |
- | |
116 | shl eax, 16 |
- | |
117 | mov ax, bx |
98 | push ebx ecx esi |
118 | add ax, word[esp + 16] |
- | |
119 | dec ax |
99 | dec cx |
120 | mov ebx, ecx |
100 | dec cx |
121 | shl ebx, 16 |
- | |
122 | mov bx, cx |
- | |
123 | 101 | cmp [buttontype], 1 |
|
124 | ; calculate initial color |
- | |
125 | mov ecx, esi |
102 | jnz .draw |
126 | cmp [buttontype], 0 |
- | |
Line 127... | Line 103... | ||
127 | je @f |
103 | cmp cx, 65 |
- | 104 | jnc .draw |
|
- | 105 | ||
- | 106 | ; calculate gradient data |
|
- | 107 | mov eax, esi |
|
- | 108 | shl eax, 8 |
|
- | 109 | mov edx, 3 |
|
- | 110 | .calculate: |
|
- | 111 | rol eax, 8 |
|
- | 112 | shl al, 1 |
|
- | 113 | jnc @f |
|
- | 114 | neg al |
|
- | 115 | jnz @f |
|
- | 116 | mov al, 64 |
|
- | 117 | @@: |
|
128 | call button._.incecx2 |
118 | cmp al, 65 |
129 | 119 | jc @f |
|
130 | ; set button height counter |
120 | mov al, 64 |
131 | @@: |
121 | @@: |
132 | mov edx, edi |
- | |
133 | add ebx, 0x00010001 |
- | |
134 | dec edx |
- | |
135 | - | ||
136 | .next_line: |
122 | div cl |
137 | call button._.button_dececx |
- | |
138 | push edi |
- | |
139 | xor edi, edi |
123 | shl ax, 8 |
140 | ; call [draw_line] |
- | |
141 | call __sys_draw_line |
124 | dec edx |
142 | pop edi |
125 | jnz .calculate |
143 | add ebx, 0x00010001 |
- | |
144 | dec edx |
126 | mov dl, cl |
145 | jnz .next_line |
- | |
146 | 127 | dec edx |
|
147 | popad |
- | |
148 | 128 | shr edx, 1 |
|
- | 129 | shr eax, 8 |
|
149 | ; draw button frame |
130 | mov edi, eax |
150 | 131 | mul edx |
|
- | 132 | add esi, eax |
|
- | 133 | ||
151 | push ebx ecx |
134 | .draw: ; calculate window-relative coordinates |
152 | 135 | movzx ebp, cx |
|
153 | ; calculate window-relative coordinates |
136 | dec ebp |
154 | shr ebx, 16 |
137 | shr ebx, 16 |
155 | shr ecx, 16 |
138 | shr ecx, 16 |
156 | mov eax, [TASK_BASE] |
- | |
157 | add ebx, [eax - twdw + WDATA.box.left] |
- | |
158 | add ecx, [eax - twdw + WDATA.box.top] |
139 | mov eax, [TASK_BASE] |
159 | 140 | add ebx, [eax - twdw + WDATA.box.left] |
|
160 | ; top border |
141 | add ecx, [eax - twdw + WDATA.box.top] |
161 | mov eax, ebx |
142 | mov eax, ebx |
- | 143 | inc eax |
|
162 | shl eax, 16 |
144 | mov edx, ebx |
163 | mov ax, bx |
- | |
164 | add ax, [esp + 4] |
- | |
165 | mov ebx, ecx |
- | |
166 | shl ebx, 16 |
- | |
167 | mov bx, cx |
- | |
168 | push ebx |
- | |
169 | xor edi, edi |
- | |
170 | mov ecx, esi |
- | |
171 | call button._.incecx |
- | |
172 | ; call [draw_line] |
- | |
173 | call __sys_draw_line |
- | |
174 | - | ||
175 | ; bottom border |
- | |
176 | movzx edx, word[esp + 4 + 0] |
- | |
177 | add ebx, edx |
145 | add dx, [esp+8] |
- | 146 | dec edx |
|
- | 147 | mov ebx, ecx |
|
- | 148 | mov ecx, esi |
|
- | 149 | shr ecx, 1 |
|
- | 150 | and cx, 7F7Fh |
|
- | 151 | push esi |
|
- | 152 | mov esi, edi |
|
- | 153 | xor edi, edi |
|
- | 154 | call hline ; top border |
|
- | 155 | inc ebx |
|
- | 156 | or ecx, 808080h |
|
- | 157 | call hline ; top light line |
|
178 | shl edx, 16 |
158 | pop ecx |
- | 159 | inc ebx |
|
- | 160 | .next_line: |
|
- | 161 | call hline ; button body |
|
179 | add ebx, edx |
162 | inc ebx |
- | 163 | sub ecx, esi |
|
- | 164 | dec ebp |
|
- | 165 | jnz .next_line |
|
- | 166 | shr ecx, 2 |
|
- | 167 | and cx, 3F3Fh |
|
180 | mov ecx, esi |
168 | mov ebp, ecx |
181 | call button._.dececx |
- | |
182 | ; call [draw_line] |
169 | shl ecx, 1 |
- | 170 | add ecx, ebp |
|
- | 171 | call hline ; bottom dark line |
|
183 | call __sys_draw_line |
172 | inc ebx |
- | 173 | sub ecx, ebp |
|
- | 174 | call hline ; bottom border |
|
184 | 175 | pop ecx |
|
185 | ; left border |
- | |
186 | pop ebx |
- | |
187 | push edx |
- | |
188 | mov edx, eax |
176 | shr ecx, 1 |
- | 177 | inc edx |
|
189 | shr edx, 16 |
178 | push edx |
190 | mov ax, dx |
179 | mov edx, ebx |
191 | mov edx, ebx |
180 | sub bx, [esp+4] |
- | 181 | dec edx |
|
192 | shr edx, 16 |
182 | inc ebx |
193 | mov bx, dx |
183 | cmp [buttontype], 0 |
- | 184 | jnz @f |
|
194 | add bx, [esp + 4 + 0] |
185 | dec edx |
- | 186 | or ecx, 808080h |
|
195 | pop edx |
187 | call vline ; left light line |
196 | mov ecx, esi |
188 | inc edx |
197 | call button._.incecx |
189 | @@: |
198 | ; call [draw_line] |
- | |
- | 190 | and ecx, 7F7F7Fh |
|
199 | dec ebx |
191 | dec eax |
200 | call __sys_draw_line |
192 | call vline ; left border |
201 | 193 | pop eax |
|
202 | ; right border |
194 | call vline ; right border |
203 | mov dx, [esp + 4] |
195 | cmp [buttontype], 0 |
204 | add ax, dx |
196 | jnz @f |
205 | shl edx, 16 |
197 | mov ebp, ecx |
206 | add eax, edx |
198 | shr ecx, 1 |
207 | add ebx, 0x00010000 |
199 | and cx, 7F7Fh |
208 | mov ecx, esi |
200 | add ecx, ebp |
209 | call button._.dececx |
201 | dec eax |
210 | ; call [draw_line] |
202 | inc ebx |
211 | call __sys_draw_line |
- | |
212 | 203 | call vline ; right dark line |
|
213 | pop ecx ebx |
204 | @@: |
Line 214... | Line 205... | ||
214 | 205 | pop ecx ebx |
|
215 | .exit: |
206 | .exit: |
216 | ret |
207 | ret |
217 | 208 | ||
218 | ; FIXME: mutex needed |
209 | ; FIXME: mutex needed |
219 | syscall_button.remove_button: |
210 | .remove_button: |
220 | and edx, 0x00ffffff |
211 | and edx, 0x00ffffff |
Line 254... | Line 245... | ||
254 | dec dword[edi] |
245 | dec dword[edi] |
255 | add ecx, -sizeof.SYS_BUTTON |
246 | add ecx, -sizeof.SYS_BUTTON |
256 | pop ebx |
247 | pop ebx |
257 | jmp .next_button |
248 | jmp .next_button |
Line 258... | Line -... | ||
258 | - | ||
259 | .exit: |
- | |
260 | ret |
- | |
261 | - | ||
262 | align 4 |
249 | |
263 | ;------------------------------------------------------------------------------ |
250 | ;--------------------------------------------------------------- |
264 | sys_button_activate_handler: ;///////////////////////////////////////////////// |
- | |
265 | ;------------------------------------------------------------------------------ |
251 | sys_button_activate_handler: |
266 | ;? |
252 | sys_button_deactivate_handler: |
267 | ;------------------------------------------------------------------------------ |
253 | ;--------------------------------------------------------------- |
268 | ;> eax = pack[8(process slot), 24(button id)] |
254 | ;> eax = pack[8(process slot), 24(button id)] |
269 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
255 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
270 | ;> cl = mouse button mask this system button was pressed with |
- | |
271 | ;------------------------------------------------------------------------------ |
- | |
272 | call button._.find_button |
- | |
273 | or eax, eax |
- | |
274 | jz .exit |
- | |
275 | - | ||
276 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
- | |
277 | call button._.negative_button |
- | |
278 | - | ||
279 | .exit: |
- | |
280 | ret |
- | |
281 | - | ||
282 | align 4 |
- | |
283 | ;------------------------------------------------------------------------------ |
- | |
284 | sys_button_deactivate_handler: ;/////////////////////////////////////////////// |
- | |
285 | ;------------------------------------------------------------------------------ |
- | |
286 | ;? |
- | |
287 | ;------------------------------------------------------------------------------ |
- | |
288 | ;> eax = pack[8(process slot), 24(button id)] |
- | |
289 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
- | |
290 | ;> cl = mouse button mask this system button was pressed with |
- | |
291 | ;------------------------------------------------------------------------------ |
- | |
292 | call button._.find_button |
- | |
293 | or eax, eax |
- | |
294 | jz .exit |
- | |
295 | - | ||
296 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
- | |
297 | call button._.negative_button |
- | |
298 | - | ||
299 | .exit: |
- | |
300 | ret |
- | |
301 | - | ||
302 | align 4 |
- | |
303 | ;------------------------------------------------------------------------------ |
- | |
304 | sys_button_perform_handler: ;////////////////////////////////////////////////// |
- | |
305 | ;------------------------------------------------------------------------------ |
- | |
306 | ;? |
- | |
307 | ;------------------------------------------------------------------------------ |
- | |
308 | ;> eax = pack[8(process slot), 24(button id)] |
- | |
309 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
- | |
310 | ;> cl = mouse button mask this system button was pressed with |
- | |
311 | ;------------------------------------------------------------------------------ |
- | |
312 | shl eax, 8 |
- | |
313 | mov al, cl |
- | |
314 | movzx ebx, byte[BTN_COUNT] |
- | |
315 | mov [BTN_BUFF + ebx * 4], eax |
- | |
316 | inc bl |
- | |
317 | mov [BTN_COUNT], bl |
- | |
318 | ret |
- | |
319 | - | ||
320 | ;============================================================================== |
- | |
321 | ;///// private functions ////////////////////////////////////////////////////// |
- | |
322 | ;============================================================================== |
- | |
323 | - | ||
324 | ;------------------------------------------------------------------------------ |
- | |
325 | button._.find_button: ;//////////////////////////////////////////////////////// |
256 | ;> cl = mouse button mask this system button was pressed with |
326 | ;------------------------------------------------------------------------------ |
257 | ;--------------------------------------------------------------- |
327 | ;? Find system button by specified process slot, id and coordinates |
- | |
328 | ;------------------------------------------------------------------------------ |
- | |
329 | ;> eax = pack[8(process slot), 24(button id)] or 0 |
- | |
330 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
- | |
331 | ;------------------------------------------------------------------------------ |
- | |
332 | ;< eax = pointer to SYS_BUTTON struct or 0 |
- | |
333 | ;------------------------------------------------------------------------------ |
258 | ; find system button by specified process slot, id and coordinates |
334 | push ecx edx esi edi |
- | |
335 | 259 | push ecx edx esi edi |
|
336 | mov edx, eax |
260 | mov edx, eax |
337 | shr edx, 24 |
261 | shr edx, 24 |
338 | and eax, 0x0ffffff |
- | |
339 | 262 | and eax, 0x0ffffff |
|
340 | mov edi, [BTN_ADDR] |
263 | mov edi, [BTN_ADDR] |
341 | mov ecx, [edi] |
264 | mov ecx, [edi] |
342 | imul esi, ecx, sizeof.SYS_BUTTON |
265 | imul esi, ecx, sizeof.SYS_BUTTON |
343 | add esi, edi |
266 | add esi, edi |
344 | inc ecx |
267 | inc ecx |
345 | add esi, sizeof.SYS_BUTTON |
- | |
346 | 268 | add esi, sizeof.SYS_BUTTON |
|
347 | .next_button: |
269 | .next_button: |
348 | dec ecx |
270 | dec ecx |
349 | jz .not_found |
- | |
350 | 271 | jz .popexit |
|
Line 351... | Line 272... | ||
351 | add esi, -sizeof.SYS_BUTTON |
272 | add esi, -sizeof.SYS_BUTTON |
352 | 273 | ||
353 | ; does it belong to our process? |
274 | ; does it belong to our process? |
Line 365... | Line 286... | ||
365 | mov edi, dword[esi + SYS_BUTTON.left - 2] |
286 | mov edi, dword[esi + SYS_BUTTON.left - 2] |
366 | mov di, [esi + SYS_BUTTON.top] |
287 | mov di, [esi + SYS_BUTTON.top] |
367 | cmp ebx, edi |
288 | cmp ebx, edi |
368 | jne .next_button |
289 | jne .next_button |
Line 369... | Line -... | ||
369 | - | ||
370 | ; okay, return it |
290 | |
371 | mov eax, esi |
- | |
372 | jmp .exit |
- | |
373 | - | ||
374 | .not_found: |
- | |
375 | xor eax, eax |
- | |
376 | - | ||
377 | .exit: |
291 | mov eax, esi |
378 | pop edi esi edx ecx |
- | |
379 | ret |
- | |
380 | - | ||
381 | ;------------------------------------------------------------------------------ |
- | |
382 | button._.dececx: ;///////////////////////////////////////////////////////////// |
- | |
383 | ;------------------------------------------------------------------------------ |
- | |
384 | ;? |
- | |
385 | ;------------------------------------------------------------------------------ |
- | |
386 | sub cl, 0x20 |
- | |
387 | jnc @f |
- | |
388 | xor cl, cl |
- | |
389 | @@: |
- | |
390 | sub ch, 0x20 |
- | |
391 | jnc @f |
- | |
392 | xor ch, ch |
- | |
393 | @@: |
- | |
394 | rol ecx, 16 |
- | |
395 | sub cl, 0x20 |
- | |
396 | jnc @f |
- | |
397 | xor cl, cl |
- | |
398 | @@: |
- | |
399 | rol ecx, 16 |
- | |
400 | ret |
- | |
401 | - | ||
402 | ;------------------------------------------------------------------------------ |
- | |
403 | button._.incecx: ;///////////////////////////////////////////////////////////// |
- | |
404 | ;------------------------------------------------------------------------------ |
- | |
405 | ;? |
- | |
406 | ;------------------------------------------------------------------------------ |
- | |
407 | add cl, 0x20 |
- | |
408 | jnc @f |
- | |
409 | or cl, -1 |
- | |
410 | @@: |
- | |
411 | add ch, 0x20 |
- | |
412 | jnc @f |
- | |
413 | or ch, -1 |
- | |
414 | @@: |
- | |
415 | rol ecx, 16 |
- | |
416 | add cl, 0x20 |
- | |
417 | jnc @f |
- | |
418 | or cl, -1 |
- | |
419 | @@: |
- | |
420 | rol ecx, 16 |
- | |
421 | ret |
- | |
422 | - | ||
423 | ;------------------------------------------------------------------------------ |
- | |
424 | button._.incecx2: ;//////////////////////////////////////////////////////////// |
- | |
425 | ;------------------------------------------------------------------------------ |
- | |
426 | ;? |
- | |
427 | ;------------------------------------------------------------------------------ |
- | |
428 | add cl, 0x14 |
- | |
429 | jnc @f |
- | |
430 | or cl, -1 |
- | |
431 | @@: |
- | |
432 | add ch, 0x14 |
- | |
433 | jnc @f |
- | |
434 | or ch, -1 |
- | |
435 | @@: |
- | |
436 | rol ecx, 16 |
- | |
437 | add cl, 0x14 |
- | |
438 | jnc @f |
- | |
439 | or cl, -1 |
- | |
440 | @@: |
- | |
441 | rol ecx, 16 |
- | |
442 | ret |
- | |
443 | - | ||
444 | ;------------------------------------------------------------------------------ |
- | |
445 | button._.button_dececx: ;////////////////////////////////////////////////////// |
- | |
446 | ;------------------------------------------------------------------------------ |
- | |
447 | ;? |
- | |
448 | ;------------------------------------------------------------------------------ |
292 | pop edi esi edx ecx |
449 | cmp [buttontype], 1 |
- | |
450 | jne .finish |
- | |
451 | - | ||
452 | push eax |
- | |
453 | mov al, 1 |
- | |
454 | cmp edi, 20 |
- | |
455 | jg @f |
- | |
456 | mov al, 2 |
- | |
457 | - | ||
458 | @@: |
- | |
459 | sub cl, al |
- | |
460 | jnc @f |
- | |
461 | xor cl, cl |
- | |
462 | @@: |
- | |
463 | sub ch, al |
- | |
464 | jnc @f |
- | |
465 | xor ch, ch |
- | |
466 | @@: |
- | |
467 | rol ecx, 16 |
- | |
468 | sub cl, al |
- | |
469 | jnc @f |
- | |
470 | xor cl, cl |
- | |
471 | @@: |
- | |
472 | rol ecx, 16 |
- | |
473 | - | ||
474 | pop eax |
- | |
475 | - | ||
476 | .finish: |
- | |
Line 477... | Line -... | ||
477 | ret |
- | |
478 | - | ||
479 | ;------------------------------------------------------------------------------ |
- | |
480 | button._.negative_button: ;//////////////////////////////////////////////////// |
- | |
481 | ;------------------------------------------------------------------------------ |
- | |
482 | ;? Invert system button border |
293 | mov ebx, dword[eax + SYS_BUTTON.id_hi - 2] |
483 | ;------------------------------------------------------------------------------ |
294 | |
484 | ; if requested, do not display button border on press. |
295 | ; display button border on press? |
Line -... | Line 296... | ||
- | 296 | bt ebx, 29 |
|
485 | test ebx, 0x20000000 |
297 | jc .exit |
486 | jnz .exit |
- | |
487 | 298 | ||
488 | pushad |
- | |
- | 299 | ; invert system button border |
|
489 | 300 | pushad |
|
490 | xchg esi, eax |
301 | mov esi, eax |
491 | 302 | mov edi, ebx |
|
492 | movzx ecx, [esi + SYS_BUTTON.pslot] |
- | |
493 | shl ecx, 5 |
303 | movzx ecx, [esi + SYS_BUTTON.pslot] |
494 | add ecx, window_data |
304 | shl ecx, 5 |
495 | 305 | add ecx, window_data |
|
496 | mov eax, dword[esi + SYS_BUTTON.left] |
306 | mov eax, dword[esi + SYS_BUTTON.left] |
497 | mov ebx, dword[esi + SYS_BUTTON.top] |
307 | mov ebx, dword[esi + SYS_BUTTON.top] |
498 | add eax, [ecx + WDATA.box.left] |
308 | add eax, [ecx + WDATA.box.left] |
- | 309 | add ebx, [ecx + WDATA.box.top] |
|
- | 310 | mov ecx, eax |
|
- | 311 | mov edx, ebx |
|
- | 312 | bt edi, 30 |
|
- | 313 | jc @f |
|
- | 314 | inc ax |
|
- | 315 | inc bx |
|
499 | add ebx, [ecx + WDATA.box.top] |
316 | dec cx |
500 | push eax ebx |
317 | dec dx |
501 | pop edx ecx |
318 | @@: |
502 | rol eax, 16 |
319 | rol eax, 16 |
503 | rol ebx, 16 |
- | |
504 | add ax, cx |
320 | rol ebx, 16 |
505 | add bx, dx |
321 | add ax, cx |
506 | - | ||
507 | mov esi, 0x01000000 |
322 | add bx, dx |
508 | call draw_rectangle.forced |
- | |
509 | 323 | mov esi, 1000000h |
|
510 | popad |
324 | call draw_rectangle.forced |
- | 325 | popad |
|
- | 326 | .exit: |
|
- | 327 | ret |
|
- | 328 | .popexit: |
|
- | 329 | pop edi esi edx ecx |
|
- | 330 | ret |
|
- | 331 | ||
- | 332 | ;--------------------------------------------------------------- |
|
- | 333 | sys_button_perform_handler: |
|
- | 334 | ;--------------------------------------------------------------- |
|
- | 335 | ;> eax = pack[8(process slot), 24(button id)] |
|
- | 336 | ;> ebx = pack[16(button x coord), 16(button y coord)] |
|
- | 337 | ;> cl = mouse button mask this system button was pressed with |
|
- | 338 | ;--------------------------------------------------------------- |
|
- | 339 | shl eax, 8 |
|
- | 340 | mov al, cl |
|
- | 341 | movzx ebx, byte[BTN_COUNT] |
|
- | 342 | mov [BTN_BUFF + ebx * 4], eax |