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