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