Rev 2317 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1037 | mario79 | 1 | ;************************************************************** |
2 | ; ScrollBar Macro for Kolibri OS |
||
2354 | mario79 | 3 | ; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario |
1037 | mario79 | 4 | ; All rights reserved. |
5 | ; |
||
6 | ; Redistribution and use in source and binary forms, with or without |
||
7 | ; modification, are permitted provided that the following conditions are met: |
||
1041 | mario79 | 8 | ; * Redistributions of source code must retain the above copyright |
2354 | mario79 | 9 | ; notice, this list of conditions and the following disclaimer. |
1041 | mario79 | 10 | ; * Redistributions in binary form must reproduce the above copyright |
2354 | mario79 | 11 | ; notice, this list of conditions and the following disclaimer in the |
12 | ; documentation and/or other materials provided with the distribution. |
||
1041 | mario79 | 13 | ; * Neither the name of the |
2354 | mario79 | 14 | ; names of its contributors may be used to endorse or promote products |
15 | ; derived from this software without specific prior written permission. |
||
1037 | mario79 | 16 | ; |
1199 | mario79 | 17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
1037 | mario79 | 18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
20 | ; DISCLAIMED. IN NO EVENT SHALL |
||
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | ;***************************************************************************** |
||
2354 | mario79 | 28 | ; 15.11.2011 add scroll type 1 by IgorA |
29 | ;***************************************************************************** |
||
1037 | mario79 | 30 | macro scroll_bar_exit |
31 | { |
||
32 | popa |
||
33 | ret 4 |
||
34 | } |
||
35 | ;***************************************************************************** |
||
36 | macro draw_up_arrow_vertical |
||
37 | { |
||
2354 | mario79 | 38 | push ebx |
1037 | mario79 | 39 | |
2354 | mario79 | 40 | xor eax,eax |
41 | mov ax,sb_size_x |
||
42 | shr eax,1 |
||
43 | shl eax,16 |
||
44 | add ebx,eax |
||
1037 | mario79 | 45 | |
2354 | mario79 | 46 | xor eax,eax |
47 | mov ax,sb_btn_high |
||
48 | shr eax,1 |
||
49 | shl eax,16 |
||
50 | add ecx,eax |
||
1037 | mario79 | 51 | |
2354 | mario79 | 52 | mov edx,sb_line_col |
53 | sub ebx,4 shl 16 |
||
54 | mov bx,7 |
||
55 | mov cx,1 |
||
56 | mov eax,13 |
||
57 | int 0x40 |
||
58 | sub ecx,1 shl 16 |
||
59 | add ebx,1 shl 16 |
||
60 | mov bx,5 |
||
61 | int 0x40 |
||
62 | sub ecx,1 shl 16 |
||
63 | add ebx,1 shl 16 |
||
64 | mov bx,3 |
||
65 | int 0x40 |
||
66 | sub ecx,1 shl 16 |
||
67 | add ebx,1 shl 16 |
||
68 | mov bx,1 |
||
69 | int 0x40 |
||
70 | pop ebx |
||
1037 | mario79 | 71 | } |
72 | ;***************************************************************************** |
||
2354 | mario79 | 73 | macro draw_up_arrow_vertical_type2 |
74 | { |
||
75 | push ebx |
||
76 | |||
77 | mov bx,sb_size_x |
||
78 | shr bx,1 |
||
79 | add bx,sb_start_x |
||
80 | |||
81 | mov cx,sb_btn_high |
||
82 | shr cx,1 |
||
83 | add cx,sb_start_y |
||
84 | |||
85 | mov ax,bx |
||
86 | shl eax,16 |
||
87 | mov ax,cx |
||
88 | |||
89 | sub cx,2 |
||
90 | |||
91 | shl ebx,16 |
||
92 | shl ecx,16 |
||
93 | |||
94 | mov cx,ax |
||
95 | shr eax,16 |
||
96 | mov bx,ax |
||
97 | |||
98 | add cx,1 |
||
99 | sub bx,3 |
||
100 | |||
101 | mcall 38,,,sb_line_col |
||
102 | |||
103 | add bx,6 |
||
104 | |||
105 | mcall |
||
106 | pop ebx |
||
107 | } |
||
108 | ;***************************************************************************** |
||
1037 | mario79 | 109 | macro draw_down_arrow_vertical |
110 | { |
||
2354 | mario79 | 111 | push ebx |
1037 | mario79 | 112 | |
2354 | mario79 | 113 | xor eax,eax |
114 | mov ax,sb_size_x |
||
115 | shr eax,1 |
||
116 | shl eax,16 |
||
117 | add ebx,eax |
||
1037 | mario79 | 118 | |
2354 | mario79 | 119 | xor eax,eax |
120 | mov ax,sb_btn_high |
||
121 | shr eax,1 |
||
122 | shl eax,16 |
||
123 | add ecx,eax |
||
1037 | mario79 | 124 | |
2354 | mario79 | 125 | mov edx,sb_line_col |
126 | sub ebx,4 shl 16 |
||
127 | mov bx,7 |
||
128 | sub ecx,2 shl 16 |
||
129 | mov cx,1 |
||
130 | mov eax,13 |
||
131 | int 0x40 |
||
132 | add ecx,1 shl 16 |
||
133 | add ebx,1 shl 16 |
||
134 | mov bx,5 |
||
135 | int 0x40 |
||
136 | add ecx,1 shl 16 |
||
137 | add ebx,1 shl 16 |
||
138 | mov bx,3 |
||
139 | int 0x40 |
||
140 | add ecx,1 shl 16 |
||
141 | add ebx,1 shl 16 |
||
142 | mov bx,1 |
||
143 | int 0x40 |
||
144 | pop ebx |
||
1037 | mario79 | 145 | } |
146 | ;***************************************************************************** |
||
2354 | mario79 | 147 | macro draw_down_arrow_vertical_type2 |
148 | { |
||
149 | push ebx |
||
150 | |||
151 | mov bx,sb_size_x |
||
152 | shr bx,1 |
||
153 | add bx,sb_start_x |
||
154 | |||
155 | mov ax,sb_btn_high |
||
156 | shr ax,1 |
||
157 | mov cx,sb_start_y |
||
158 | add cx,sb_size_y |
||
159 | sub cx,ax |
||
160 | |||
161 | mov ax,bx |
||
162 | shl eax,16 |
||
163 | mov ax,cx |
||
164 | |||
165 | add cx,1 |
||
166 | |||
167 | shl ebx,16 |
||
168 | shl ecx,16 |
||
169 | |||
170 | mov cx,ax |
||
171 | shr eax,16 |
||
172 | mov bx,ax |
||
173 | |||
174 | sub cx,2 |
||
175 | sub bx,3 |
||
176 | |||
177 | mcall 38,,,sb_line_col |
||
178 | |||
179 | add bx,6 |
||
180 | |||
181 | mcall |
||
182 | pop ebx |
||
183 | } |
||
184 | ;***************************************************************************** |
||
1037 | mario79 | 185 | macro draw_runner_center_vertical |
186 | { |
||
2354 | mario79 | 187 | push ebx |
188 | push ecx |
||
1037 | mario79 | 189 | |
2354 | mario79 | 190 | xor eax,eax |
191 | mov ax,sb_size_x |
||
192 | shr eax,1 |
||
193 | shl eax,16 |
||
194 | add ebx,eax |
||
1037 | mario79 | 195 | |
2354 | mario79 | 196 | mov edx,sb_run_size |
197 | shr edx,1 |
||
198 | shl edx,16 |
||
199 | add ecx,edx |
||
200 | mov edx,sb_line_col |
||
201 | sub ecx,8 shl 16 |
||
202 | sub ebx,5 shl 16 |
||
203 | mov bx,10 |
||
204 | add ecx,4 shl 16 |
||
205 | mov cx,1 |
||
206 | mov eax,13 |
||
207 | int 0x40 |
||
208 | add ecx,3 shl 16 |
||
209 | sub ebx,1 shl 16 |
||
210 | mov bx,12 |
||
211 | int 0x40 |
||
212 | add ebx,1 shl 16 |
||
213 | mov bx,10 |
||
214 | add ecx,3 shl 16 |
||
215 | int 0x40 |
||
216 | pop ecx |
||
217 | pop ebx |
||
1037 | mario79 | 218 | } |
219 | ;***************************************************************************** |
||
220 | macro draw_up_arrow_horizontal |
||
221 | { |
||
2354 | mario79 | 222 | push ecx |
1037 | mario79 | 223 | |
2354 | mario79 | 224 | xor eax,eax |
225 | mov ax,sb_btn_high |
||
226 | shr eax,1 |
||
227 | shl eax,16 |
||
228 | add ebx,eax |
||
1037 | mario79 | 229 | |
2354 | mario79 | 230 | xor eax,eax |
231 | mov ax,sb_size_y |
||
232 | shr eax,1 |
||
233 | shl eax,16 |
||
234 | add ecx,eax |
||
1037 | mario79 | 235 | |
2354 | mario79 | 236 | mov edx,sb_line_col |
237 | sub ecx,4 shl 16 |
||
238 | mov cx,7 |
||
239 | mov bx,1 |
||
1037 | mario79 | 240 | |
2354 | mario79 | 241 | mov eax,13 |
242 | int 0x40 |
||
243 | sub ebx,1 shl 16 |
||
244 | add ecx,1 shl 16 |
||
245 | mov cx,5 |
||
246 | int 0x40 |
||
247 | sub ebx,1 shl 16 |
||
248 | add ecx,1 shl 16 |
||
249 | mov cx,3 |
||
250 | int 0x40 |
||
251 | sub ebx,1 shl 16 |
||
252 | add ecx,1 shl 16 |
||
253 | mov cx,1 |
||
254 | int 0x40 |
||
255 | pop ecx |
||
1037 | mario79 | 256 | } |
257 | ;***************************************************************************** |
||
2354 | mario79 | 258 | macro draw_up_arrow_horizontal_type2 |
259 | { |
||
260 | push ebx ecx |
||
261 | |||
262 | mov bx,sb_btn_high |
||
263 | shr bx,1 |
||
264 | add bx,sb_start_x |
||
265 | |||
266 | mov cx,sb_size_y |
||
267 | shr cx,1 |
||
268 | add cx,sb_start_y |
||
269 | |||
270 | mov ax,bx |
||
271 | shl eax,16 |
||
272 | mov ax,cx |
||
273 | |||
274 | sub bx,2 |
||
275 | |||
276 | shl ebx,16 |
||
277 | shl ecx,16 |
||
278 | |||
279 | mov cx,ax |
||
280 | shr eax,16 |
||
281 | mov bx,ax |
||
282 | |||
283 | add bx,1 |
||
284 | sub cx,3 |
||
285 | |||
286 | mcall 38,,,sb_line_col |
||
287 | |||
288 | add cx,6 |
||
289 | |||
290 | mcall |
||
291 | pop ecx ebx |
||
292 | } |
||
293 | ;***************************************************************************** |
||
1037 | mario79 | 294 | macro draw_down_arrow_horizontal |
295 | { |
||
2354 | mario79 | 296 | push ecx |
1037 | mario79 | 297 | |
2354 | mario79 | 298 | xor eax,eax |
299 | mov ax,sb_btn_high |
||
300 | shr eax,1 |
||
301 | shl eax,16 |
||
302 | add ebx,eax |
||
1037 | mario79 | 303 | |
2354 | mario79 | 304 | xor eax,eax |
305 | mov ax,sb_size_y |
||
306 | shr eax,1 |
||
307 | shl eax,16 |
||
308 | add ecx,eax |
||
1037 | mario79 | 309 | |
2354 | mario79 | 310 | mov edx,sb_line_col |
311 | sub ecx,4 shl 16 |
||
312 | mov cx,7 |
||
313 | sub ebx,2 shl 16 |
||
314 | mov bx,1 |
||
315 | mov eax,13 |
||
316 | int 0x40 |
||
317 | add ebx,1 shl 16 |
||
318 | add ecx,1 shl 16 |
||
319 | mov cx,5 |
||
320 | int 0x40 |
||
321 | add ebx,1 shl 16 |
||
322 | add ecx,1 shl 16 |
||
323 | mov cx,3 |
||
324 | int 0x40 |
||
325 | add ecx,1 shl 16 |
||
326 | add ebx,1 shl 16 |
||
327 | mov cx,1 |
||
328 | int 0x40 |
||
329 | pop ecx |
||
1037 | mario79 | 330 | } |
331 | ;***************************************************************************** |
||
2354 | mario79 | 332 | macro draw_down_arrow_horizontal_type2 |
333 | { |
||
334 | push ebx ecx |
||
335 | |||
336 | mov ax,sb_btn_high |
||
337 | shr ax,1 |
||
338 | mov bx,sb_start_x |
||
339 | add bx,sb_size_x |
||
340 | sub bx,ax |
||
341 | |||
342 | mov cx,sb_size_y |
||
343 | shr cx,1 |
||
344 | add cx,sb_start_y |
||
345 | |||
346 | mov ax,bx |
||
347 | shl eax,16 |
||
348 | mov ax,cx |
||
349 | |||
350 | add cx,1 |
||
351 | |||
352 | shl ebx,16 |
||
353 | shl ecx,16 |
||
354 | |||
355 | mov cx,ax |
||
356 | shr eax,16 |
||
357 | mov bx,ax |
||
358 | |||
359 | sub cx,2 |
||
360 | sub bx,3 |
||
361 | |||
362 | mcall 38,,,sb_line_col |
||
363 | |||
364 | add cx,6 |
||
365 | |||
366 | mcall |
||
367 | pop ecx ebx |
||
368 | } |
||
369 | ;***************************************************************************** |
||
1037 | mario79 | 370 | macro draw_runner_center_horizontal |
371 | { |
||
2354 | mario79 | 372 | push ebx |
373 | push ecx |
||
1037 | mario79 | 374 | |
2354 | mario79 | 375 | xor eax,eax |
376 | mov ax,sb_size_y |
||
377 | shr eax,1 |
||
378 | shl eax,16 |
||
379 | add ecx,eax |
||
1037 | mario79 | 380 | |
2354 | mario79 | 381 | mov edx,sb_run_size |
382 | shr edx,1 |
||
383 | shl edx,16 |
||
384 | add ebx,edx |
||
385 | mov edx,sb_line_col |
||
386 | sub ebx,8 shl 16 |
||
387 | sub ecx,5 shl 16 |
||
388 | mov cx,10 |
||
389 | add ebx,4 shl 16 |
||
390 | mov bx,1 |
||
391 | mov eax,13 |
||
392 | int 0x40 |
||
393 | add ebx,3 shl 16 |
||
394 | sub ecx,1 shl 16 |
||
395 | mov cx,12 |
||
396 | int 0x40 |
||
397 | add ecx,1 shl 16 |
||
398 | mov cx,10 |
||
399 | add ebx,3 shl 16 |
||
400 | int 0x40 |
||
401 | pop ecx |
||
402 | pop ebx |
||
1037 | mario79 | 403 | } |
404 | ;***************************************************************************** |
||
405 | macro use_scroll_bar |
||
406 | { |
||
407 | scroll_bar: |
||
2354 | mario79 | 408 | sb_size_x equ [edi] |
409 | sb_start_x equ [edi+2] |
||
410 | sb_size_y equ [edi+4] |
||
411 | sb_start_y equ [edi+6] |
||
412 | sb_btn_high equ [edi+8] |
||
413 | sb_type equ [edi+12] |
||
414 | sb_max_area equ [edi+16] |
||
415 | sb_cur_area equ [edi+20] |
||
416 | sb_position equ [edi+24] |
||
417 | sb_bckg_col equ [edi+28] |
||
418 | sb_frnt_col equ [edi+32] |
||
419 | sb_line_col equ [edi+36] |
||
420 | sb_redraw equ [edi+40] |
||
421 | sb_delta equ [edi+44] |
||
422 | sb_delta2 equ [edi+46] |
||
423 | sb_r_size_x equ [edi+48] |
||
1041 | mario79 | 424 | sb_r_start_x equ [edi+50] |
2354 | mario79 | 425 | sb_r_size_y equ [edi+52] |
1041 | mario79 | 426 | sb_r_start_y equ [edi+54] |
2354 | mario79 | 427 | sb_m_pos equ [edi+56] |
428 | sb_m_pos_2 equ [edi+60] |
||
429 | sb_m_keys equ [edi+64] |
||
430 | sb_run_size equ [edi+68] |
||
1041 | mario79 | 431 | sb_position2 equ [edi+72] |
432 | sb_work_size equ [edi+76] |
||
433 | sb_all_redraw equ [edi+80] |
||
434 | sb_ar_offset equ [edi+84] |
||
1037 | mario79 | 435 | } |
436 | ;***************************************************************************** |
||
437 | ;***************************************************************************** |
||
438 | ; draw event |
||
439 | ;***************************************************************************** |
||
440 | ;***************************************************************************** |
||
441 | macro use_scroll_bar_vertical |
||
442 | { |
||
443 | scroll_bar_vertical: |
||
444 | .draw: |
||
445 | pusha |
||
2354 | mario79 | 446 | mov edi,dword [esp+36] |
447 | mov sb_delta,word 0 |
||
448 | call .draw_1 |
||
449 | mov sb_all_redraw,dword 0 |
||
1037 | mario79 | 450 | scroll_bar_exit |
451 | .draw_1: |
||
452 | pusha |
||
453 | ;********************************* |
||
2354 | mario79 | 454 | xor eax,eax |
455 | mov ax,sb_size_y |
||
456 | mov edx,sb_btn_high |
||
457 | shl edx,1 |
||
458 | sub eax,edx |
||
459 | mov sb_work_size,eax |
||
1037 | mario79 | 460 | ;********************************* |
2354 | mario79 | 461 | mov eax,sb_work_size |
462 | mov ebx,sb_max_area |
||
463 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 464 | ja @f |
2354 | mario79 | 465 | jmp .no_size |
1037 | mario79 | 466 | |
467 | @@: |
||
2354 | mario79 | 468 | imul eax,sb_cur_area |
469 | xor edx,edx |
||
470 | div ebx |
||
471 | cmp eax,10 |
||
472 | jae @f |
||
473 | mov eax,10 |
||
1037 | mario79 | 474 | @@: |
475 | .no_size: |
||
2354 | mario79 | 476 | mov sb_run_size,eax |
1037 | mario79 | 477 | ;********************************* |
2354 | mario79 | 478 | cmp word sb_delta,1 |
1041 | mario79 | 479 | je .@@_3 |
2354 | mario79 | 480 | mov eax,sb_work_size |
481 | sub eax,sb_run_size |
||
482 | mov ebx,sb_max_area |
||
483 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 484 | ja @f |
2354 | mario79 | 485 | xor eax,eax |
486 | jmp .@@_1 |
||
1037 | mario79 | 487 | @@: |
2354 | mario79 | 488 | sub ebx,sb_cur_area |
489 | imul eax,sb_position |
||
490 | xor edx,edx |
||
491 | div ebx |
||
1037 | mario79 | 492 | .@@_1: |
2354 | mario79 | 493 | mov sb_position2,eax |
494 | xor edx,edx |
||
495 | mov dx,sb_size_y |
||
496 | sub edx,sb_btn_high |
||
497 | sub edx,sb_btn_high |
||
498 | sub edx,sb_run_size |
||
499 | cmp sb_position2,edx |
||
500 | jbe .@@_3 |
||
501 | mov sb_position2,edx |
||
1037 | mario79 | 502 | .@@_3: |
503 | ;********************************* |
||
2354 | mario79 | 504 | mov ebx,sb_start_x |
505 | shl ebx,16 |
||
506 | inc ebx |
||
507 | mov ecx,sb_size_y |
||
508 | mov edx,sb_line_col |
||
509 | mov eax,13 |
||
510 | cmp dword sb_all_redraw,0 |
||
511 | je @f |
||
512 | int 0x40 ; left extreme line |
||
1037 | mario79 | 513 | @@: |
2354 | mario79 | 514 | push ebx |
515 | ror ebx,16 |
||
516 | add bx,sb_size_x |
||
517 | rol ebx,16 |
||
518 | cmp dword sb_all_redraw,0 |
||
519 | je @f |
||
520 | int 0x40 ; right extreme line |
||
1037 | mario79 | 521 | @@: |
2354 | mario79 | 522 | pop ebx |
1037 | mario79 | 523 | |
2354 | mario79 | 524 | push ecx |
1037 | mario79 | 525 | |
2354 | mario79 | 526 | add ebx,1 shl 16 |
527 | mov bx,sb_size_x |
||
528 | dec ebx |
||
529 | mov cx,1 |
||
530 | cmp dword sb_all_redraw,0 |
||
531 | je @f |
||
532 | int 0x40 ; top button - extreme line |
||
1037 | mario79 | 533 | @@: |
2354 | mario79 | 534 | push ecx |
535 | add ecx,1 shl 16 |
||
536 | add ecx,sb_btn_high |
||
537 | sub ecx,2 |
||
538 | mov edx,sb_frnt_col |
||
539 | cmp dword sb_all_redraw,0 |
||
540 | je .no_draw_top_button |
||
541 | int 0x40 ; top button filling |
||
542 | ;----------------------------------------------------------------------------- |
||
543 | ; scrollbar type 2 |
||
544 | cmp word sb_type,2 |
||
545 | jne .no_type2 |
||
546 | ;********************************* |
||
547 | draw_up_arrow_vertical_type2 |
||
548 | ;********************************* |
||
549 | jmp .no_draw_top_button |
||
550 | .no_type2: |
||
551 | ;********************************* |
||
1037 | mario79 | 552 | draw_up_arrow_vertical |
2354 | mario79 | 553 | ;********************************* |
554 | .no_draw_top_button: |
||
555 | pop ecx |
||
1037 | mario79 | 556 | |
2354 | mario79 | 557 | ror ecx,16 |
558 | add ecx,sb_btn_high ;14 shl 16 |
||
559 | rol ecx,16 |
||
560 | mov edx,sb_line_col |
||
561 | cmp dword sb_all_redraw,0 |
||
562 | je @f |
||
563 | mcall 13 ; top button - bottom line |
||
1037 | mario79 | 564 | @@: |
2354 | mario79 | 565 | pop ecx |
1037 | mario79 | 566 | ;********************************* |
2354 | mario79 | 567 | ror ecx,16 |
568 | add ecx,sb_btn_high ;15 shl 16 |
||
569 | inc ecx |
||
570 | rol ecx,16 |
||
571 | sub ecx,sb_btn_high ;30 |
||
572 | sub ecx,sb_btn_high |
||
573 | push ecx |
||
574 | mov cx,0 |
||
575 | add ecx,sb_position2 |
||
576 | dec cx |
||
577 | mov eax,13 |
||
578 | test cx,0x8000 |
||
579 | jnz @f |
||
580 | mov edx,sb_bckg_col |
||
581 | int 0x40 ; top interval |
||
1037 | mario79 | 582 | @@: |
583 | ;********************************* |
||
2354 | mario79 | 584 | shr ecx,16 |
585 | add ecx,sb_position2 |
||
586 | dec ecx |
||
587 | shl ecx,16 |
||
588 | inc ecx |
||
589 | mov edx,sb_line_col |
||
590 | int 0x40 ; runner - top extreme line |
||
1037 | mario79 | 591 | |
2354 | mario79 | 592 | add ecx,1 shl 16 |
593 | mov cx,0 |
||
594 | add ecx,sb_run_size |
||
595 | mov sb_r_size_x,ebx |
||
596 | mov sb_r_size_y,ecx |
||
597 | sub ecx,2 |
||
598 | mov edx,sb_frnt_col |
||
599 | int 0x40 ; runner filling |
||
600 | ;----------------------------------------------------------------------------- |
||
601 | ; scrollbar type 2 |
||
602 | cmp word sb_type,2 |
||
603 | je @f |
||
604 | ;********************************* |
||
1037 | mario79 | 605 | draw_runner_center_vertical |
606 | ;********************************* |
||
2354 | mario79 | 607 | @@: |
608 | ;----------------------------------------------------------------------------- |
||
609 | ; scrollbar type 1 - stylish frame |
||
610 | cmp word sb_type,1 |
||
611 | jne @f |
||
612 | push eax ebx ecx edx |
||
613 | movzx eax,word sb_start_x |
||
614 | xor ebx,ebx |
||
615 | add bx,sb_r_start_y |
||
616 | dec ebx |
||
617 | movzx ecx,word sb_size_x |
||
618 | mov edx,sb_run_size |
||
619 | dec edx |
||
620 | ; drawing a stylish frame on the slider |
||
621 | stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col |
||
622 | pop edx ecx ebx eax |
||
623 | @@: |
||
624 | ;----------------------------------------------------------------------------- |
||
625 | shr ecx,16 |
||
626 | add ecx,sb_run_size |
||
627 | sub ecx,2 |
||
628 | shl ecx,16 |
||
629 | inc ecx |
||
630 | mov edx,sb_line_col |
||
631 | int 0x40 ; runner - bottom extreme line |
||
1037 | mario79 | 632 | |
2354 | mario79 | 633 | add ecx,1 shl 16 |
634 | mov cx,sb_start_y |
||
635 | add cx,sb_size_y |
||
636 | sub ecx,sb_btn_high |
||
637 | dec ecx |
||
638 | mov eax,ecx |
||
639 | shr eax,16 |
||
640 | sub cx,ax |
||
641 | test cx,0x8000 |
||
642 | jnz @f |
||
643 | mov edx,sb_bckg_col |
||
644 | mov eax,13 |
||
645 | int 0x40 ; bottom interval |
||
1037 | mario79 | 646 | @@: |
2354 | mario79 | 647 | pop ecx |
1037 | mario79 | 648 | ;********************************* |
2354 | mario79 | 649 | mov ax,cx |
650 | shr ecx,16 |
||
651 | add cx,ax |
||
652 | sub ecx,2 |
||
653 | shl ecx,16 |
||
654 | inc ecx |
||
655 | mov edx,sb_line_col |
||
656 | mov eax,13 |
||
657 | cmp dword sb_all_redraw,0 |
||
658 | je @f |
||
659 | int 0x40 ; bottom button - top line |
||
1037 | mario79 | 660 | @@: |
2354 | mario79 | 661 | push ecx |
662 | add ecx,1 shl 16 |
||
663 | add cx,sb_btn_high |
||
664 | sub ecx,2 |
||
665 | mov edx,sb_frnt_col |
||
666 | cmp dword sb_all_redraw,0 |
||
667 | je .no_draw_bottom_button |
||
668 | int 0x40 ; bottom button filling |
||
669 | ;----------------------------------------------------------------------------- |
||
670 | ; scrollbar type 2 |
||
671 | cmp word sb_type,2 |
||
672 | jne .no_type2_1 |
||
673 | ;********************************* |
||
674 | draw_down_arrow_vertical_type2 |
||
675 | ;********************************* |
||
676 | jmp .no_draw_bottom_button |
||
677 | .no_type2_1: |
||
1037 | mario79 | 678 | ;********************************* |
679 | draw_down_arrow_vertical |
||
680 | ;********************************* |
||
2354 | mario79 | 681 | .no_draw_bottom_button: |
682 | pop ecx |
||
1037 | mario79 | 683 | |
2354 | mario79 | 684 | ror ecx,16 |
685 | add ecx,sb_btn_high |
||
686 | rol ecx,16 |
||
1037 | mario79 | 687 | |
2354 | mario79 | 688 | mov edx,sb_line_col |
689 | mov cx,1 |
||
690 | cmp dword sb_all_redraw,0 |
||
691 | je @f |
||
692 | mcall 13 ; bottom button - extreme line |
||
693 | ;----------------------------------------------------------------------------- |
||
694 | ; scrollbar type 1 - stylish frame |
||
695 | cmp word sb_type,1 |
||
696 | jne @f |
||
697 | movzx eax,word sb_start_x |
||
698 | movzx ebx,word sb_start_y |
||
699 | movzx ecx,word sb_size_x |
||
700 | ; drawing a stylish frame on the top button |
||
701 | stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ |
||
702 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
703 | add bx,sb_size_y |
||
704 | sub ebx,sb_btn_high |
||
705 | dec ebx |
||
706 | ; drawing a stylish frame on the bottom button |
||
707 | stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ |
||
708 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1037 | mario79 | 709 | @@: |
2354 | mario79 | 710 | ;----------------------------------------------------------------------------- |
1037 | mario79 | 711 | popa |
712 | ret |
||
713 | ;***************************************************************************** |
||
714 | ;***************************************************************************** |
||
715 | ; mouse event |
||
716 | ;***************************************************************************** |
||
717 | ;***************************************************************************** |
||
718 | .mouse: |
||
719 | pusha |
||
2354 | mario79 | 720 | mov edi,dword [esp+36] |
721 | mcall 37,1 |
||
722 | mov sb_m_pos,eax |
||
723 | cmp dword sb_m_pos_2,0 |
||
724 | jne @f |
||
1037 | mario79 | 725 | |
2354 | mario79 | 726 | mov sb_m_pos_2,eax |
1037 | mario79 | 727 | @@: |
2354 | mario79 | 728 | mcall 37,2 |
729 | mov sb_m_keys,eax |
||
1037 | mario79 | 730 | |
2354 | mario79 | 731 | cmp sb_m_keys,eax |
732 | je @f |
||
1037 | mario79 | 733 | |
2354 | mario79 | 734 | mov sb_m_keys,eax |
735 | mov sb_delta,dword 0 |
||
736 | mov eax,sb_m_pos |
||
737 | mov sb_m_pos_2,eax |
||
738 | jmp .continue_2 |
||
1037 | mario79 | 739 | @@: |
2354 | mario79 | 740 | cmp dword sb_m_keys,0 |
1199 | mario79 | 741 | jne @f |
2354 | mario79 | 742 | mov eax,sb_m_pos |
743 | mov sb_m_pos_2,eax |
||
744 | jmp .correct_1 ;.exit_sb |
||
1037 | mario79 | 745 | @@: |
2354 | mario79 | 746 | mov sb_delta,word 1 |
1037 | mario79 | 747 | |
748 | .continue_2: |
||
2354 | mario79 | 749 | mov eax,sb_m_pos |
750 | test eax,0x80000000 |
||
751 | jnz .exit_sb |
||
1037 | mario79 | 752 | |
2354 | mario79 | 753 | test eax,0x8000 |
754 | jnz .exit_sb |
||
1037 | mario79 | 755 | |
2354 | mario79 | 756 | mov ebx,eax |
757 | shr ebx,16 ; x position |
||
758 | shl eax,16 |
||
759 | shr eax,16 ; y position |
||
1037 | mario79 | 760 | |
2354 | mario79 | 761 | mov cx,sb_start_y |
762 | cmp ax,cx |
||
1041 | mario79 | 763 | jb .exit_sb |
1037 | mario79 | 764 | |
2354 | mario79 | 765 | cmp word sb_delta2,0 |
1041 | mario79 | 766 | je @f |
2354 | mario79 | 767 | push ecx |
768 | add cx,sb_btn_high |
||
769 | cmp ax,cx |
||
770 | pop ecx |
||
1041 | mario79 | 771 | jb .exit_sb |
1037 | mario79 | 772 | |
773 | @@: |
||
2354 | mario79 | 774 | add cx,sb_size_y |
775 | cmp ax,cx |
||
1041 | mario79 | 776 | ja .exit_sb |
1037 | mario79 | 777 | |
2354 | mario79 | 778 | cmp word sb_delta2,0 |
1041 | mario79 | 779 | je @f |
2354 | mario79 | 780 | sub cx,sb_btn_high |
781 | cmp ax,cx |
||
1041 | mario79 | 782 | ja .exit_sb |
1037 | mario79 | 783 | |
784 | @@: |
||
2354 | mario79 | 785 | cmp word sb_delta2,1 |
1041 | mario79 | 786 | je @f |
1037 | mario79 | 787 | |
2354 | mario79 | 788 | cmp dword sb_m_keys,0 |
1041 | mario79 | 789 | je .exit_sb |
790 | |||
2354 | mario79 | 791 | mov cx,sb_start_x |
792 | cmp bx,cx |
||
1041 | mario79 | 793 | jb .exit_sb |
1037 | mario79 | 794 | |
2354 | mario79 | 795 | add cx,sb_size_x |
796 | cmp bx,cx |
||
1041 | mario79 | 797 | ja .exit_sb |
1037 | mario79 | 798 | |
2354 | mario79 | 799 | mov cx,sb_r_start_y |
800 | cmp ax,cx |
||
1041 | mario79 | 801 | jb .no_runner |
1037 | mario79 | 802 | |
2354 | mario79 | 803 | add cx,sb_r_size_y |
804 | cmp ax,cx |
||
1041 | mario79 | 805 | ja .no_runner |
1037 | mario79 | 806 | |
2354 | mario79 | 807 | mov sb_delta2,word 1 |
1037 | mario79 | 808 | @@: |
2354 | mario79 | 809 | push eax |
810 | mov ax,sb_m_pos |
||
811 | cmp ax,sb_m_pos_2 |
||
1199 | mario79 | 812 | je .correct |
1037 | mario79 | 813 | |
2354 | mario79 | 814 | shl eax,16 |
815 | shr eax,16 |
||
816 | mov ebx,sb_m_pos_2 |
||
817 | shl ebx,16 |
||
818 | shr ebx,16 |
||
819 | cmp eax,ebx |
||
820 | jb .sub |
||
1037 | mario79 | 821 | |
2354 | mario79 | 822 | sub eax,ebx |
823 | mov ebx,eax |
||
824 | add sb_position2,ebx |
||
825 | xor eax,eax |
||
826 | mov ax,sb_size_y |
||
827 | sub eax,sb_btn_high |
||
828 | sub eax,sb_btn_high |
||
829 | sub eax,sb_run_size |
||
830 | cmp sb_position2,eax |
||
831 | jbe @f |
||
1037 | mario79 | 832 | |
2354 | mario79 | 833 | mov sb_position2,eax |
1037 | mario79 | 834 | @@: |
2354 | mario79 | 835 | mov eax,sb_m_pos |
836 | mov sb_m_pos_2,eax |
||
837 | pop eax |
||
838 | call .draw_1 |
||
839 | jmp .no_runner_1 |
||
1037 | mario79 | 840 | |
841 | .correct: |
||
2354 | mario79 | 842 | pop eax |
843 | jmp .exit_sb |
||
1037 | mario79 | 844 | .correct_1: |
2354 | mario79 | 845 | mov sb_delta,dword 0 |
846 | jmp .exit_sb |
||
1037 | mario79 | 847 | |
848 | .sub: |
||
2354 | mario79 | 849 | sub ebx,eax |
850 | sub sb_position2,ebx |
||
851 | test sb_position2,dword 0x80000000 |
||
852 | jz @f |
||
1037 | mario79 | 853 | |
2354 | mario79 | 854 | mov sb_position2,dword 0 |
1037 | mario79 | 855 | @@: |
2354 | mario79 | 856 | mov eax,sb_m_pos |
857 | mov sb_m_pos_2,eax |
||
858 | pop eax |
||
859 | call .draw_1 |
||
860 | jmp .no_runner_1 |
||
1037 | mario79 | 861 | |
862 | ;***************************************************************************** |
||
863 | .no_runner: |
||
2354 | mario79 | 864 | mov sb_delta,dword 0 |
1037 | mario79 | 865 | .no_runner_1: |
2354 | mario79 | 866 | xor ecx,ecx |
867 | mov cx,sb_start_y |
||
868 | add cx,sb_btn_high ;15 |
||
869 | cmp word sb_delta,1 |
||
1041 | mario79 | 870 | je .scroll_sb |
1037 | mario79 | 871 | |
2354 | mario79 | 872 | cmp ax,cx |
1041 | mario79 | 873 | ja .scroll_sb |
1037 | mario79 | 874 | |
2354 | mario79 | 875 | cmp dword sb_m_keys,0 |
876 | je .exit_sb |
||
1037 | mario79 | 877 | |
2354 | mario79 | 878 | mov eax,sb_ar_offset |
879 | cmp sb_position,eax ;dword 0 |
||
880 | jbe @f |
||
1037 | mario79 | 881 | |
2354 | mario79 | 882 | sub sb_position,eax |
883 | jmp .all_sb |
||
1037 | mario79 | 884 | @@: |
2354 | mario79 | 885 | xor eax,eax |
886 | mov sb_position,eax ;dword 0 |
||
887 | mov sb_position2,eax ;dword 0 |
||
888 | jmp .all_sb |
||
1037 | mario79 | 889 | ;***************************************************************************** |
890 | .scroll_sb: |
||
2354 | mario79 | 891 | add cx,sb_size_y |
892 | sub cx,sb_btn_high |
||
893 | sub cx,sb_btn_high |
||
894 | cmp word sb_delta,1 |
||
1041 | mario79 | 895 | je @f |
1037 | mario79 | 896 | |
2354 | mario79 | 897 | cmp ax,cx |
1041 | mario79 | 898 | ja .down_sb |
1037 | mario79 | 899 | |
900 | @@: |
||
2354 | mario79 | 901 | mov ebx,sb_btn_high ;16 ;15 |
902 | add bx,sb_start_y |
||
903 | sub cx,bx |
||
904 | sub ax,bx |
||
1037 | mario79 | 905 | |
906 | .scroll_sb_1: |
||
2354 | mario79 | 907 | mov ebx,sb_run_size |
1037 | mario79 | 908 | ;***************************************************************************** |
2354 | mario79 | 909 | cmp word sb_delta,1 |
1041 | mario79 | 910 | je .continue |
1037 | mario79 | 911 | |
912 | @@: |
||
2354 | mario79 | 913 | mov edx,eax |
914 | push ebx |
||
915 | shr ebx,1 |
||
916 | sub edx,ebx |
||
917 | pop ebx |
||
918 | mov sb_position2,edx |
||
919 | test sb_position2,dword 0x80000000 |
||
920 | jz .test_1 |
||
1037 | mario79 | 921 | |
2354 | mario79 | 922 | mov sb_position2,dword 0 |
923 | jmp .continue |
||
1037 | mario79 | 924 | |
925 | .test_1: |
||
2354 | mario79 | 926 | xor edx,edx |
927 | mov dx,sb_size_y |
||
928 | sub edx,sb_btn_high |
||
929 | sub edx,sb_btn_high |
||
930 | sub edx,sb_run_size |
||
931 | cmp sb_position2,edx |
||
932 | jbe .continue |
||
1037 | mario79 | 933 | |
2354 | mario79 | 934 | mov sb_position2,edx |
1199 | mario79 | 935 | |
2354 | mario79 | 936 | .continue: |
937 | mov eax,sb_position2 |
||
938 | sub ecx,ebx |
||
1037 | mario79 | 939 | .continue_1: |
940 | ;***************************************************************************** |
||
2354 | mario79 | 941 | mov ebx,eax |
1037 | mario79 | 942 | |
2354 | mario79 | 943 | mov eax,sb_max_area |
944 | cmp eax,sb_cur_area |
||
1041 | mario79 | 945 | ja @f |
1037 | mario79 | 946 | |
2354 | mario79 | 947 | xor eax,eax |
948 | inc eax |
||
949 | mov sb_position2,eax |
||
950 | jmp .all_sb |
||
1037 | mario79 | 951 | @@: |
2354 | mario79 | 952 | sub eax,sb_cur_area |
953 | inc eax |
||
954 | shl eax,10 |
||
955 | xor edx,edx |
||
956 | div ecx |
||
957 | shl edx,1 |
||
958 | cmp edx,ecx |
||
1041 | mario79 | 959 | jb @f |
1037 | mario79 | 960 | |
2354 | mario79 | 961 | inc eax |
1037 | mario79 | 962 | |
963 | @@: |
||
2354 | mario79 | 964 | imul eax,ebx |
965 | shr eax,10 |
||
1037 | mario79 | 966 | |
2354 | mario79 | 967 | cmp sb_position,eax |
1041 | mario79 | 968 | je .exit_sb |
1037 | mario79 | 969 | |
2354 | mario79 | 970 | cmp eax,0 |
1041 | mario79 | 971 | ja @f |
1037 | mario79 | 972 | |
2354 | mario79 | 973 | xor eax,eax |
1037 | mario79 | 974 | |
975 | @@: |
||
976 | .store_position: |
||
2354 | mario79 | 977 | mov sb_position,eax |
1037 | mario79 | 978 | .all_sb: |
2354 | mario79 | 979 | mov sb_redraw,dword 1 |
980 | call .draw_1 |
||
981 | mov eax,sb_m_pos |
||
982 | mov sb_m_pos_2,eax |
||
983 | jmp .exit_sb |
||
1037 | mario79 | 984 | ;***************************************************************************** |
985 | .down_sb: |
||
2354 | mario79 | 986 | cmp dword sb_m_keys,0 |
987 | je .exit_sb |
||
1037 | mario79 | 988 | |
2354 | mario79 | 989 | mov eax,sb_max_area |
990 | mov ebx,sb_ar_offset |
||
991 | sub eax,sb_cur_area |
||
992 | push eax |
||
993 | sub eax,ebx |
||
994 | cmp sb_position,eax |
||
995 | pop eax |
||
996 | jae @f |
||
1037 | mario79 | 997 | |
2354 | mario79 | 998 | add sb_position,ebx |
999 | jmp .all_sb |
||
1037 | mario79 | 1000 | @@: |
2354 | mario79 | 1001 | mov sb_position,eax |
1002 | xor eax,eax |
||
1003 | mov ax,sb_size_y |
||
1004 | sub eax,sb_btn_high |
||
1005 | sub eax,sb_btn_high |
||
1006 | sub eax,sb_run_size |
||
1007 | mov sb_position2,eax |
||
1008 | jmp .all_sb |
||
1041 | mario79 | 1009 | .exit_sb: |
1037 | mario79 | 1010 | scroll_bar_exit |
1011 | } |
||
1012 | |||
1013 | ;***************************************************************************** |
||
1014 | ;***************************************************************************** |
||
1015 | ;***************************************************************************** |
||
1016 | ;***************************************************************************** |
||
1017 | ;***************************************************************************** |
||
1018 | macro use_scroll_bar_horizontal |
||
1019 | { |
||
1020 | scroll_bar_horizontal: |
||
1021 | .draw: |
||
1022 | pusha |
||
2354 | mario79 | 1023 | mov edi,dword [esp+36] |
1024 | mov sb_delta,word 0 |
||
1025 | call .draw_1 |
||
1026 | mov sb_all_redraw,dword 0 |
||
1037 | mario79 | 1027 | scroll_bar_exit |
1028 | .draw_1: |
||
1029 | pusha |
||
1030 | ;********************************* |
||
2354 | mario79 | 1031 | xor eax,eax |
1032 | mov ax,sb_size_x ;sb_size_y |
||
1033 | mov edx,sb_btn_high |
||
1034 | shl edx,1 |
||
1035 | sub eax,edx |
||
1036 | mov sb_work_size,eax |
||
1037 | mario79 | 1037 | ;********************************* |
2354 | mario79 | 1038 | mov eax,sb_work_size ;sb_max_area |
1039 | mov ebx,sb_max_area |
||
1040 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 1041 | ja @f |
1037 | mario79 | 1042 | |
2354 | mario79 | 1043 | jmp .no_size |
1037 | mario79 | 1044 | |
1045 | @@: |
||
2354 | mario79 | 1046 | imul eax,sb_cur_area |
1047 | xor edx,edx |
||
1048 | div ebx |
||
1049 | cmp eax,10 |
||
1050 | jae @f |
||
1051 | mov eax,10 |
||
1037 | mario79 | 1052 | @@: |
1053 | .no_size: |
||
2354 | mario79 | 1054 | mov sb_run_size,eax |
1037 | mario79 | 1055 | ;********************************* |
2354 | mario79 | 1056 | cmp word sb_delta,1 |
1041 | mario79 | 1057 | je .@@_3 |
2354 | mario79 | 1058 | mov eax,sb_work_size |
1059 | sub eax,sb_run_size |
||
1060 | mov ebx,sb_max_area |
||
1061 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 1062 | ja @f |
2354 | mario79 | 1063 | xor eax,eax |
1064 | jmp .@@_1 |
||
1037 | mario79 | 1065 | @@: |
2354 | mario79 | 1066 | sub ebx,sb_cur_area |
1067 | imul eax,sb_position |
||
1068 | xor edx,edx |
||
1069 | div ebx |
||
1037 | mario79 | 1070 | .@@_1: |
2354 | mario79 | 1071 | mov sb_position2,eax |
1072 | xor edx,edx |
||
1073 | mov dx,sb_size_x |
||
1074 | sub edx,sb_btn_high |
||
1075 | sub edx,sb_btn_high |
||
1076 | sub edx,sb_run_size |
||
1077 | cmp sb_position2,edx |
||
1078 | jbe .@@_3 |
||
1079 | mov sb_position2,edx |
||
1037 | mario79 | 1080 | .@@_3: |
1081 | ;********************************* |
||
2354 | mario79 | 1082 | mov ebx,sb_size_x |
1083 | mov ecx,sb_start_y |
||
1084 | shl ecx,16 |
||
1085 | inc ecx |
||
1086 | mov edx,sb_line_col |
||
1087 | mov eax,13 |
||
1088 | cmp dword sb_all_redraw,0 |
||
1089 | je @f |
||
1090 | int 0x40 ; top extreme line |
||
1037 | mario79 | 1091 | @@: |
2354 | mario79 | 1092 | push ecx |
1093 | ror ecx,16 |
||
1094 | add cx,sb_size_y |
||
1095 | rol ecx,16 |
||
1096 | cmp dword sb_all_redraw,0 |
||
1097 | je @f |
||
1098 | int 0x40 ; bottom extreme line |
||
1037 | mario79 | 1099 | @@: |
2354 | mario79 | 1100 | pop ecx |
1037 | mario79 | 1101 | |
2354 | mario79 | 1102 | push ebx |
1037 | mario79 | 1103 | |
2354 | mario79 | 1104 | add ecx,1 shl 16 |
1105 | mov cx,sb_size_y |
||
1106 | dec ecx |
||
1107 | mov bx,1 |
||
1108 | cmp dword sb_all_redraw,0 |
||
1109 | je @f |
||
1110 | int 0x40 ; left button - extreme line |
||
1037 | mario79 | 1111 | @@: |
2354 | mario79 | 1112 | push ebx |
1113 | add ebx,1 shl 16 |
||
1114 | add ebx,sb_btn_high |
||
1115 | sub ebx,2 |
||
1116 | mov edx,sb_frnt_col |
||
1117 | cmp dword sb_all_redraw,0 |
||
1118 | je .no_draw_top_button |
||
1119 | int 0x40 ; left button filling |
||
1120 | ;----------------------------------------------------------------------------- |
||
1121 | ; scrollbar type 2 |
||
1122 | cmp word sb_type,2 |
||
1123 | jne .no_type2 |
||
1124 | ;********************************* |
||
1125 | draw_up_arrow_horizontal_type2 |
||
1126 | ;********************************* |
||
1127 | jmp .no_draw_top_button |
||
1128 | .no_type2: |
||
1037 | mario79 | 1129 | ;********************************* |
1130 | draw_up_arrow_horizontal |
||
1131 | ;********************************* |
||
2354 | mario79 | 1132 | .no_draw_top_button: |
1133 | pop ebx |
||
1037 | mario79 | 1134 | |
2354 | mario79 | 1135 | ror ebx,16 |
1136 | add ebx,sb_btn_high ;14 shl 16 |
||
1137 | rol ebx,16 |
||
1138 | mov edx,sb_line_col |
||
1139 | cmp dword sb_all_redraw,0 |
||
1140 | je @f |
||
1141 | mcall 13 ; left button - right line |
||
1037 | mario79 | 1142 | @@: |
2354 | mario79 | 1143 | pop ebx |
1037 | mario79 | 1144 | ;********************************* |
2354 | mario79 | 1145 | ror ebx,16 |
1146 | add ebx,sb_btn_high ;15 shl 16 |
||
1147 | inc ebx |
||
1148 | rol ebx,16 |
||
1149 | sub ebx,sb_btn_high ;30 |
||
1150 | sub ebx,sb_btn_high |
||
1151 | push ebx |
||
1152 | mov bx,0 |
||
1153 | add ebx,sb_position2 |
||
1154 | dec bx |
||
1155 | mov eax,13 |
||
1156 | test bx,0x8000 |
||
1157 | jnz @f |
||
1158 | mov edx,sb_bckg_col |
||
1159 | int 0x40 ; left interval |
||
1037 | mario79 | 1160 | @@: |
1161 | ;********************************* |
||
2354 | mario79 | 1162 | shr ebx,16 |
1163 | add ebx,sb_position2 |
||
1164 | dec ebx |
||
1165 | shl ebx,16 |
||
1166 | inc ebx |
||
1167 | mov edx,sb_line_col |
||
1168 | int 0x40 ; runner - left extreme line |
||
1037 | mario79 | 1169 | |
2354 | mario79 | 1170 | add ebx,1 shl 16 |
1171 | mov bx,0 |
||
1172 | add ebx,sb_run_size |
||
1173 | mov sb_r_size_x,ebx |
||
1174 | mov sb_r_size_y,ecx |
||
1175 | sub ebx,2 |
||
1176 | mov edx,sb_frnt_col |
||
1177 | int 0x40 ; runner filling |
||
1178 | ;----------------------------------------------------------------------------- |
||
1179 | ; scrollbar type 2 |
||
1180 | cmp word sb_type,2 |
||
1181 | je @f |
||
1182 | ;********************************* |
||
1037 | mario79 | 1183 | draw_runner_center_horizontal |
1184 | ;********************************* |
||
2354 | mario79 | 1185 | @@: |
1186 | ;----------------------------------------------------------------------------- |
||
1187 | ; scrollbar type 1 - stylish frame |
||
1188 | cmp word sb_type,1 |
||
1189 | jne @f |
||
1190 | push eax ebx ecx edx |
||
1191 | xor eax,eax |
||
1192 | add ax,sb_r_start_x |
||
1193 | dec eax |
||
1194 | movzx ebx,word sb_start_y |
||
1195 | mov ecx,sb_run_size |
||
1196 | dec ecx |
||
1197 | movzx edx,word sb_size_y |
||
1198 | ; drawing a stylish frame on the slider |
||
1199 | stdcall draw_edge,eax,ebx,ecx,edx,\ |
||
1200 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1201 | pop edx ecx ebx eax |
||
1202 | @@: |
||
1203 | ;----------------------------------------------------------------------------- |
||
1204 | shr ebx,16 |
||
1205 | add ebx,sb_run_size |
||
1206 | sub ebx,2 |
||
1207 | shl ebx,16 |
||
1208 | inc ebx |
||
1209 | mov edx,sb_line_col |
||
1210 | int 0x40 ; runner - bottom extreme line |
||
1037 | mario79 | 1211 | |
2354 | mario79 | 1212 | add ebx,1 shl 16 |
1213 | mov bx,sb_start_x |
||
1214 | add bx,sb_size_x |
||
1215 | sub ebx,sb_btn_high |
||
1216 | dec ebx |
||
1217 | mov eax,ebx |
||
1218 | shr eax,16 |
||
1219 | sub bx,ax |
||
1220 | test bx,0x8000 |
||
1221 | jnz @f |
||
1222 | mov edx,sb_bckg_col |
||
1223 | mov eax,13 |
||
1224 | int 0x40 ; bottom interval |
||
1037 | mario79 | 1225 | @@: |
2354 | mario79 | 1226 | pop ebx |
1037 | mario79 | 1227 | ;********************************* |
2354 | mario79 | 1228 | mov ax,bx |
1229 | shr ebx,16 |
||
1230 | add bx,ax |
||
1231 | sub ebx,2 |
||
1232 | shl ebx,16 |
||
1233 | inc ebx |
||
1234 | mov edx,sb_line_col |
||
1235 | mov eax,13 |
||
1236 | cmp dword sb_all_redraw,0 |
||
1237 | je @f |
||
1238 | int 0x40 ; bottom button - top line |
||
1037 | mario79 | 1239 | @@: |
2354 | mario79 | 1240 | push ebx |
1241 | add ebx,1 shl 16 |
||
1242 | add bx,sb_btn_high |
||
1243 | sub ebx,2 |
||
1244 | mov edx,sb_frnt_col |
||
1245 | cmp dword sb_all_redraw,0 |
||
1246 | je .no_draw_bottom_button |
||
1247 | int 0x40 ; bottom button filling |
||
1248 | ;----------------------------------------------------------------------------- |
||
1249 | ; scrollbar type 2 |
||
1250 | cmp word sb_type,2 |
||
1251 | jne .no_type2_1 |
||
1252 | ;********************************* |
||
1253 | draw_down_arrow_horizontal_type2 |
||
1254 | ;********************************* |
||
1255 | jmp .no_draw_bottom_button |
||
1256 | .no_type2_1: |
||
1037 | mario79 | 1257 | ;********************************* |
1258 | draw_down_arrow_horizontal |
||
1259 | ;********************************* |
||
2354 | mario79 | 1260 | .no_draw_bottom_button: |
1261 | pop ebx |
||
1037 | mario79 | 1262 | |
2354 | mario79 | 1263 | ror ebx,16 |
1264 | add ebx,sb_btn_high ;14 shl 16 |
||
1265 | rol ebx,16 |
||
1037 | mario79 | 1266 | |
2354 | mario79 | 1267 | mov edx,sb_line_col |
1268 | mov bx,1 |
||
1269 | cmp dword sb_all_redraw,0 |
||
1270 | je @f |
||
1271 | mcall 13 ; bottom button - extreme line |
||
1272 | ;----------------------------------------------------------------------------- |
||
1273 | ; scrollbar type 1 - stylish frame |
||
1274 | cmp word sb_type,1 |
||
1275 | jne @f |
||
1276 | ; drawing a stylish frame on the left button |
||
1277 | movzx eax,word sb_start_x |
||
1278 | movzx ebx,word sb_start_y |
||
1279 | movzx edx,word sb_size_y |
||
1280 | stdcall draw_edge,eax,ebx,sb_btn_high,edx,\ |
||
1281 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1282 | |||
1283 | movzx eax,word sb_start_x |
||
1284 | add ax,sb_size_x |
||
1285 | sub eax,sb_btn_high |
||
1286 | dec eax |
||
1287 | ; drawing a stylish frame on the right button |
||
1288 | stdcall draw_edge,eax,ebx,sb_btn_high,edx,\ |
||
1289 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1037 | mario79 | 1290 | @@: |
2354 | mario79 | 1291 | ;----------------------------------------------------------------------------- |
1037 | mario79 | 1292 | popa |
1293 | ret |
||
1294 | ;***************************************************************************** |
||
1295 | ; mouse event |
||
1296 | ;***************************************************************************** |
||
1297 | .mouse: |
||
1298 | pusha |
||
1041 | mario79 | 1299 | mov edi,dword [esp+36] |
2354 | mario79 | 1300 | mcall 37,1 |
1301 | mov sb_m_pos,eax |
||
1302 | cmp dword sb_m_pos_2,0 |
||
1303 | jne @f |
||
1037 | mario79 | 1304 | |
2354 | mario79 | 1305 | mov sb_m_pos_2,eax |
1037 | mario79 | 1306 | @@: |
2354 | mario79 | 1307 | mcall 37,2 |
1308 | mov sb_m_keys,eax |
||
1037 | mario79 | 1309 | |
2354 | mario79 | 1310 | cmp sb_m_keys,eax |
1311 | je @f |
||
1037 | mario79 | 1312 | |
2354 | mario79 | 1313 | mov sb_m_keys,eax |
1037 | mario79 | 1314 | |
2354 | mario79 | 1315 | mov sb_delta,dword 0 |
1037 | mario79 | 1316 | |
2354 | mario79 | 1317 | mov eax,sb_m_pos |
1318 | mov sb_m_pos_2,eax |
||
1319 | jmp .continue_2 |
||
1037 | mario79 | 1320 | |
1321 | @@: |
||
2354 | mario79 | 1322 | cmp dword sb_m_keys,0 |
1199 | mario79 | 1323 | jne @f |
2354 | mario79 | 1324 | mov eax,sb_m_pos |
1325 | mov sb_m_pos_2,eax |
||
1326 | jmp .correct_1 ;.exit_sb |
||
1037 | mario79 | 1327 | @@: |
2354 | mario79 | 1328 | mov sb_delta,word 1 |
1037 | mario79 | 1329 | |
1330 | .continue_2: |
||
2354 | mario79 | 1331 | mov eax,sb_m_pos |
1332 | test eax,0x80000000 |
||
1333 | jnz .exit_sb |
||
1037 | mario79 | 1334 | |
2354 | mario79 | 1335 | test eax,0x8000 |
1336 | jnz .exit_sb |
||
1037 | mario79 | 1337 | |
2354 | mario79 | 1338 | mov ebx,eax |
1339 | shr eax,16 ; x position |
||
1340 | shl ebx,16 |
||
1341 | shr ebx,16 ; y position |
||
1037 | mario79 | 1342 | |
2354 | mario79 | 1343 | mov cx,sb_start_x ;y |
1344 | cmp ax,cx |
||
1041 | mario79 | 1345 | jb .exit_sb |
1037 | mario79 | 1346 | |
2354 | mario79 | 1347 | cmp word sb_delta2,0 |
1041 | mario79 | 1348 | je @f |
2354 | mario79 | 1349 | push ecx |
1350 | add cx,sb_btn_high |
||
1351 | cmp ax,cx |
||
1352 | pop ecx |
||
1041 | mario79 | 1353 | jb .exit_sb |
1037 | mario79 | 1354 | |
1355 | @@: |
||
2354 | mario79 | 1356 | add cx,sb_size_x ;y |
1357 | cmp ax,cx |
||
1041 | mario79 | 1358 | ja .exit_sb |
1037 | mario79 | 1359 | |
2354 | mario79 | 1360 | cmp word sb_delta2,0 |
1041 | mario79 | 1361 | je @f |
2354 | mario79 | 1362 | sub cx,sb_btn_high |
1363 | cmp ax,cx |
||
1041 | mario79 | 1364 | ja .exit_sb |
1037 | mario79 | 1365 | |
1366 | @@: |
||
2354 | mario79 | 1367 | cmp word sb_delta2,1 |
1041 | mario79 | 1368 | je @f |
1037 | mario79 | 1369 | |
2354 | mario79 | 1370 | cmp dword sb_m_keys,0 |
1041 | mario79 | 1371 | je .exit_sb |
1372 | |||
2354 | mario79 | 1373 | mov cx,sb_start_y ;x |
1374 | cmp bx,cx |
||
1041 | mario79 | 1375 | jb .exit_sb |
1037 | mario79 | 1376 | |
2354 | mario79 | 1377 | add cx,sb_size_y ;x |
1378 | cmp bx,cx |
||
1041 | mario79 | 1379 | ja .exit_sb |
1037 | mario79 | 1380 | |
2354 | mario79 | 1381 | mov cx,sb_r_start_x |
1382 | cmp ax,cx |
||
1041 | mario79 | 1383 | jb .no_runner |
1037 | mario79 | 1384 | |
2354 | mario79 | 1385 | add cx,sb_r_size_x |
1386 | cmp ax,cx |
||
1041 | mario79 | 1387 | ja .no_runner |
1037 | mario79 | 1388 | |
2354 | mario79 | 1389 | mov sb_delta2,word 1 |
1037 | mario79 | 1390 | @@: |
2354 | mario79 | 1391 | push eax |
1392 | mov eax,sb_m_pos |
||
1393 | mov ebx,sb_m_pos_2 |
||
1394 | shr eax,16 |
||
1395 | shr ebx,16 |
||
1396 | cmp eax,ebx |
||
1199 | mario79 | 1397 | je .correct |
1037 | mario79 | 1398 | |
2354 | mario79 | 1399 | ; shl eax,16 |
1400 | ; shr eax,16 |
||
1401 | ; mov ebx,sb_m_pos_2 |
||
1402 | ; shl ebx,16 |
||
1403 | ; shr ebx,16 |
||
1404 | ; cmp eax,ebx |
||
1405 | jb .sub |
||
1037 | mario79 | 1406 | |
2354 | mario79 | 1407 | sub eax,ebx |
1408 | mov ebx,eax |
||
1409 | add sb_position2,ebx |
||
1410 | xor eax,eax |
||
1411 | mov ax,sb_size_x ;y |
||
1412 | sub eax,sb_btn_high |
||
1413 | sub eax,sb_btn_high |
||
1414 | sub eax,sb_run_size |
||
1415 | cmp sb_position2,eax |
||
1416 | jbe @f |
||
1037 | mario79 | 1417 | |
2354 | mario79 | 1418 | mov sb_position2,eax |
1037 | mario79 | 1419 | @@: |
2354 | mario79 | 1420 | mov eax,sb_m_pos |
1421 | mov sb_m_pos_2,eax |
||
1422 | pop eax |
||
1423 | call .draw_1 |
||
1424 | jmp .no_runner_1 |
||
1037 | mario79 | 1425 | |
1426 | .correct: |
||
2354 | mario79 | 1427 | pop eax |
1428 | jmp .exit_sb |
||
1037 | mario79 | 1429 | .correct_1: |
2354 | mario79 | 1430 | mov sb_delta,dword 0 |
1431 | jmp .exit_sb |
||
1037 | mario79 | 1432 | |
1433 | .sub: |
||
2354 | mario79 | 1434 | sub ebx,eax |
1435 | sub sb_position2,ebx |
||
1436 | test sb_position2,dword 0x80000000 |
||
1437 | jz @f |
||
1037 | mario79 | 1438 | |
2354 | mario79 | 1439 | mov sb_position2,dword 0 |
1037 | mario79 | 1440 | @@: |
2354 | mario79 | 1441 | mov eax,sb_m_pos |
1442 | mov sb_m_pos_2,eax |
||
1443 | pop eax |
||
1444 | call .draw_1 |
||
1445 | jmp .no_runner_1 |
||
1037 | mario79 | 1446 | |
1447 | ;***************************************************************************** |
||
1448 | .no_runner: |
||
2354 | mario79 | 1449 | mov sb_delta,dword 0 |
1037 | mario79 | 1450 | .no_runner_1: |
2354 | mario79 | 1451 | xor ecx,ecx |
1452 | mov cx,sb_start_x ;y |
||
1453 | add cx,sb_btn_high ;15 |
||
1454 | cmp word sb_delta,1 |
||
1041 | mario79 | 1455 | je .scroll_sb |
1037 | mario79 | 1456 | |
2354 | mario79 | 1457 | cmp ax,cx |
1041 | mario79 | 1458 | ja .scroll_sb |
1037 | mario79 | 1459 | |
2354 | mario79 | 1460 | cmp dword sb_m_keys,0 |
1461 | je .exit_sb |
||
1037 | mario79 | 1462 | |
2354 | mario79 | 1463 | mov eax,sb_ar_offset |
1464 | cmp sb_position,eax ;dword 0 |
||
1465 | jbe @f |
||
1037 | mario79 | 1466 | |
2354 | mario79 | 1467 | sub sb_position,eax |
1468 | jmp .all_sb |
||
1037 | mario79 | 1469 | @@: |
2354 | mario79 | 1470 | xor eax,eax |
1471 | mov sb_position,eax ;dword 0 |
||
1472 | mov sb_position2,eax ;dword 0 |
||
1473 | jmp .all_sb |
||
1037 | mario79 | 1474 | ;***************************************************************************** |
1475 | .scroll_sb: |
||
2354 | mario79 | 1476 | add cx,sb_size_x ;y |
1477 | sub cx,sb_btn_high |
||
1478 | sub cx,sb_btn_high |
||
1479 | cmp word sb_delta,1 |
||
1041 | mario79 | 1480 | je @f |
1037 | mario79 | 1481 | |
2354 | mario79 | 1482 | cmp ax,cx |
1041 | mario79 | 1483 | ja .down_sb |
1037 | mario79 | 1484 | |
1485 | @@: |
||
2354 | mario79 | 1486 | mov ebx,sb_btn_high ;16 ;15 |
1487 | add bx,sb_start_x ;y |
||
1488 | sub cx,bx |
||
1489 | sub ax,bx |
||
1037 | mario79 | 1490 | |
1491 | .scroll_sb_1: |
||
2354 | mario79 | 1492 | mov ebx,sb_run_size |
1037 | mario79 | 1493 | ;***************************************************************************** |
2354 | mario79 | 1494 | cmp word sb_delta,1 |
1041 | mario79 | 1495 | je .continue |
1037 | mario79 | 1496 | |
1497 | @@: |
||
2354 | mario79 | 1498 | mov edx,eax |
1199 | mario79 | 1499 | |
2354 | mario79 | 1500 | push ebx |
1501 | shr ebx,1 |
||
1502 | sub edx,ebx |
||
1503 | pop ebx |
||
1504 | mov sb_position2,edx |
||
1505 | test sb_position2,dword 0x80000000 |
||
1037 | mario79 | 1506 | jz .test_1 |
1507 | |||
2354 | mario79 | 1508 | mov sb_position2,dword 0 |
1509 | jmp .continue |
||
1037 | mario79 | 1510 | |
1511 | .test_1: |
||
2354 | mario79 | 1512 | xor edx,edx |
1513 | mov dx,sb_size_x ;y |
||
1514 | sub edx,sb_btn_high |
||
1515 | sub edx,sb_btn_high |
||
1516 | sub edx,sb_run_size |
||
1517 | cmp sb_position2,edx |
||
1518 | jbe .continue |
||
1037 | mario79 | 1519 | |
2354 | mario79 | 1520 | mov sb_position2,edx |
1199 | mario79 | 1521 | |
2354 | mario79 | 1522 | .continue: |
1523 | mov eax,sb_position2 |
||
1524 | sub ecx,ebx |
||
1037 | mario79 | 1525 | .continue_1: |
1526 | ;***************************************************************************** |
||
2354 | mario79 | 1527 | mov ebx,eax |
1037 | mario79 | 1528 | |
2354 | mario79 | 1529 | mov eax,sb_max_area |
1530 | cmp eax,sb_cur_area |
||
1041 | mario79 | 1531 | ja @f |
1037 | mario79 | 1532 | |
2354 | mario79 | 1533 | xor eax,eax |
1534 | inc eax |
||
1535 | mov sb_position2,eax |
||
1536 | jmp .all_sb |
||
1037 | mario79 | 1537 | @@: |
2354 | mario79 | 1538 | sub eax,sb_cur_area |
1539 | inc eax |
||
1540 | shl eax,10 |
||
1541 | xor edx,edx |
||
1542 | div ecx |
||
1543 | shl edx,1 |
||
1544 | cmp edx,ecx |
||
1041 | mario79 | 1545 | jb @f |
1037 | mario79 | 1546 | |
2354 | mario79 | 1547 | inc eax |
1037 | mario79 | 1548 | |
1549 | @@: |
||
1550 | imul eax,ebx |
||
2354 | mario79 | 1551 | shr eax,10 |
1037 | mario79 | 1552 | |
2354 | mario79 | 1553 | cmp sb_position,eax |
1041 | mario79 | 1554 | je .exit_sb |
1037 | mario79 | 1555 | |
2354 | mario79 | 1556 | cmp eax,0 |
1041 | mario79 | 1557 | ja @f |
1037 | mario79 | 1558 | |
2354 | mario79 | 1559 | xor eax,eax |
1037 | mario79 | 1560 | |
1561 | @@: |
||
1562 | .store_position: |
||
2354 | mario79 | 1563 | mov sb_position,eax |
1037 | mario79 | 1564 | .all_sb: |
2354 | mario79 | 1565 | mov sb_redraw,dword 1 |
1566 | call .draw_1 |
||
1567 | mov eax,sb_m_pos |
||
1568 | mov sb_m_pos_2,eax |
||
1569 | jmp .exit_sb |
||
1037 | mario79 | 1570 | ;***************************************************************************** |
1571 | .down_sb: |
||
2354 | mario79 | 1572 | cmp dword sb_m_keys,0 |
1573 | je .exit_sb |
||
1037 | mario79 | 1574 | |
2354 | mario79 | 1575 | mov eax,sb_max_area |
1576 | mov ebx,sb_ar_offset |
||
1577 | sub eax,sb_cur_area |
||
1578 | push eax |
||
1579 | sub eax,ebx |
||
1580 | cmp sb_position,eax |
||
1581 | pop eax |
||
1582 | jae @f |
||
1037 | mario79 | 1583 | |
2354 | mario79 | 1584 | add sb_position,ebx |
1585 | jmp .all_sb |
||
1037 | mario79 | 1586 | @@: |
2354 | mario79 | 1587 | mov sb_position,eax |
1588 | xor eax,eax |
||
1589 | mov ax,sb_size_x |
||
1590 | sub eax,sb_btn_high |
||
1591 | sub eax,sb_btn_high |
||
1592 | sub eax,sb_run_size |
||
1593 | mov sb_position2,eax |
||
1594 | jmp .all_sb |
||
1595 | ;***************************************************************************** |
||
1037 | mario79 | 1596 | .exit_sb: |
1597 | scroll_bar_exit |
||
1598 | } |