Details | 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 |
||
3353 | mario79 | 471 | shl edx,1 |
472 | cmp edx,ebx |
||
473 | jb @f |
||
474 | |||
475 | inc eax |
||
476 | |||
477 | @@: |
||
2354 | mario79 | 478 | cmp eax,10 |
479 | jae @f |
||
480 | mov eax,10 |
||
1037 | mario79 | 481 | @@: |
482 | .no_size: |
||
2354 | mario79 | 483 | mov sb_run_size,eax |
1037 | mario79 | 484 | ;********************************* |
2354 | mario79 | 485 | cmp word sb_delta,1 |
1041 | mario79 | 486 | je .@@_3 |
2354 | mario79 | 487 | mov eax,sb_work_size |
488 | sub eax,sb_run_size |
||
489 | mov ebx,sb_max_area |
||
490 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 491 | ja @f |
2354 | mario79 | 492 | xor eax,eax |
493 | jmp .@@_1 |
||
1037 | mario79 | 494 | @@: |
2354 | mario79 | 495 | sub ebx,sb_cur_area |
496 | imul eax,sb_position |
||
497 | xor edx,edx |
||
498 | div ebx |
||
3353 | mario79 | 499 | shl edx,1 |
500 | cmp edx,ebx |
||
501 | jb @f |
||
502 | |||
503 | inc eax |
||
504 | |||
505 | @@: |
||
1037 | mario79 | 506 | .@@_1: |
2354 | mario79 | 507 | mov sb_position2,eax |
508 | xor edx,edx |
||
509 | mov dx,sb_size_y |
||
510 | sub edx,sb_btn_high |
||
511 | sub edx,sb_btn_high |
||
512 | sub edx,sb_run_size |
||
513 | cmp sb_position2,edx |
||
514 | jbe .@@_3 |
||
515 | mov sb_position2,edx |
||
1037 | mario79 | 516 | .@@_3: |
517 | ;********************************* |
||
2354 | mario79 | 518 | mov ebx,sb_start_x |
519 | shl ebx,16 |
||
520 | inc ebx |
||
521 | mov ecx,sb_size_y |
||
522 | mov edx,sb_line_col |
||
523 | mov eax,13 |
||
524 | cmp dword sb_all_redraw,0 |
||
525 | je @f |
||
526 | int 0x40 ; left extreme line |
||
1037 | mario79 | 527 | @@: |
2354 | mario79 | 528 | push ebx |
529 | ror ebx,16 |
||
530 | add bx,sb_size_x |
||
531 | rol ebx,16 |
||
532 | cmp dword sb_all_redraw,0 |
||
533 | je @f |
||
534 | int 0x40 ; right extreme line |
||
1037 | mario79 | 535 | @@: |
2354 | mario79 | 536 | pop ebx |
1037 | mario79 | 537 | |
2354 | mario79 | 538 | push ecx |
1037 | mario79 | 539 | |
2354 | mario79 | 540 | add ebx,1 shl 16 |
541 | mov bx,sb_size_x |
||
542 | dec ebx |
||
543 | mov cx,1 |
||
544 | cmp dword sb_all_redraw,0 |
||
545 | je @f |
||
546 | int 0x40 ; top button - extreme line |
||
1037 | mario79 | 547 | @@: |
2354 | mario79 | 548 | push ecx |
549 | add ecx,1 shl 16 |
||
550 | add ecx,sb_btn_high |
||
551 | sub ecx,2 |
||
552 | mov edx,sb_frnt_col |
||
553 | cmp dword sb_all_redraw,0 |
||
554 | je .no_draw_top_button |
||
555 | int 0x40 ; top button filling |
||
556 | ;----------------------------------------------------------------------------- |
||
557 | ; scrollbar type 2 |
||
558 | cmp word sb_type,2 |
||
559 | jne .no_type2 |
||
560 | ;********************************* |
||
561 | draw_up_arrow_vertical_type2 |
||
562 | ;********************************* |
||
563 | jmp .no_draw_top_button |
||
564 | .no_type2: |
||
565 | ;********************************* |
||
1037 | mario79 | 566 | draw_up_arrow_vertical |
2354 | mario79 | 567 | ;********************************* |
568 | .no_draw_top_button: |
||
569 | pop ecx |
||
1037 | mario79 | 570 | |
2354 | mario79 | 571 | ror ecx,16 |
572 | add ecx,sb_btn_high ;14 shl 16 |
||
573 | rol ecx,16 |
||
574 | mov edx,sb_line_col |
||
575 | cmp dword sb_all_redraw,0 |
||
576 | je @f |
||
577 | mcall 13 ; top button - bottom line |
||
1037 | mario79 | 578 | @@: |
2354 | mario79 | 579 | pop ecx |
1037 | mario79 | 580 | ;********************************* |
2354 | mario79 | 581 | ror ecx,16 |
582 | add ecx,sb_btn_high ;15 shl 16 |
||
583 | inc ecx |
||
584 | rol ecx,16 |
||
585 | sub ecx,sb_btn_high ;30 |
||
586 | sub ecx,sb_btn_high |
||
587 | push ecx |
||
588 | mov cx,0 |
||
589 | add ecx,sb_position2 |
||
590 | dec cx |
||
591 | mov eax,13 |
||
592 | test cx,0x8000 |
||
593 | jnz @f |
||
594 | mov edx,sb_bckg_col |
||
595 | int 0x40 ; top interval |
||
1037 | mario79 | 596 | @@: |
597 | ;********************************* |
||
2354 | mario79 | 598 | shr ecx,16 |
599 | add ecx,sb_position2 |
||
600 | dec ecx |
||
601 | shl ecx,16 |
||
602 | inc ecx |
||
603 | mov edx,sb_line_col |
||
604 | int 0x40 ; runner - top extreme line |
||
1037 | mario79 | 605 | |
2354 | mario79 | 606 | add ecx,1 shl 16 |
607 | mov cx,0 |
||
608 | add ecx,sb_run_size |
||
609 | mov sb_r_size_x,ebx |
||
610 | mov sb_r_size_y,ecx |
||
611 | sub ecx,2 |
||
612 | mov edx,sb_frnt_col |
||
613 | int 0x40 ; runner filling |
||
614 | ;----------------------------------------------------------------------------- |
||
615 | ; scrollbar type 2 |
||
616 | cmp word sb_type,2 |
||
617 | je @f |
||
618 | ;********************************* |
||
1037 | mario79 | 619 | draw_runner_center_vertical |
620 | ;********************************* |
||
2354 | mario79 | 621 | @@: |
622 | ;----------------------------------------------------------------------------- |
||
623 | ; scrollbar type 1 - stylish frame |
||
624 | cmp word sb_type,1 |
||
625 | jne @f |
||
626 | push eax ebx ecx edx |
||
627 | movzx eax,word sb_start_x |
||
628 | xor ebx,ebx |
||
629 | add bx,sb_r_start_y |
||
630 | dec ebx |
||
631 | movzx ecx,word sb_size_x |
||
632 | mov edx,sb_run_size |
||
633 | dec edx |
||
634 | ; drawing a stylish frame on the slider |
||
635 | stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col |
||
636 | pop edx ecx ebx eax |
||
637 | @@: |
||
638 | ;----------------------------------------------------------------------------- |
||
639 | shr ecx,16 |
||
640 | add ecx,sb_run_size |
||
641 | sub ecx,2 |
||
642 | shl ecx,16 |
||
643 | inc ecx |
||
644 | mov edx,sb_line_col |
||
645 | int 0x40 ; runner - bottom extreme line |
||
1037 | mario79 | 646 | |
2354 | mario79 | 647 | add ecx,1 shl 16 |
648 | mov cx,sb_start_y |
||
649 | add cx,sb_size_y |
||
650 | sub ecx,sb_btn_high |
||
651 | dec ecx |
||
652 | mov eax,ecx |
||
653 | shr eax,16 |
||
654 | sub cx,ax |
||
655 | test cx,0x8000 |
||
656 | jnz @f |
||
657 | mov edx,sb_bckg_col |
||
658 | mov eax,13 |
||
659 | int 0x40 ; bottom interval |
||
1037 | mario79 | 660 | @@: |
2354 | mario79 | 661 | pop ecx |
1037 | mario79 | 662 | ;********************************* |
2354 | mario79 | 663 | mov ax,cx |
664 | shr ecx,16 |
||
665 | add cx,ax |
||
666 | sub ecx,2 |
||
667 | shl ecx,16 |
||
668 | inc ecx |
||
669 | mov edx,sb_line_col |
||
670 | mov eax,13 |
||
671 | cmp dword sb_all_redraw,0 |
||
672 | je @f |
||
673 | int 0x40 ; bottom button - top line |
||
1037 | mario79 | 674 | @@: |
2354 | mario79 | 675 | push ecx |
676 | add ecx,1 shl 16 |
||
677 | add cx,sb_btn_high |
||
678 | sub ecx,2 |
||
679 | mov edx,sb_frnt_col |
||
680 | cmp dword sb_all_redraw,0 |
||
681 | je .no_draw_bottom_button |
||
682 | int 0x40 ; bottom button filling |
||
683 | ;----------------------------------------------------------------------------- |
||
684 | ; scrollbar type 2 |
||
685 | cmp word sb_type,2 |
||
686 | jne .no_type2_1 |
||
687 | ;********************************* |
||
688 | draw_down_arrow_vertical_type2 |
||
689 | ;********************************* |
||
690 | jmp .no_draw_bottom_button |
||
691 | .no_type2_1: |
||
1037 | mario79 | 692 | ;********************************* |
693 | draw_down_arrow_vertical |
||
694 | ;********************************* |
||
2354 | mario79 | 695 | .no_draw_bottom_button: |
696 | pop ecx |
||
1037 | mario79 | 697 | |
2354 | mario79 | 698 | ror ecx,16 |
699 | add ecx,sb_btn_high |
||
700 | rol ecx,16 |
||
1037 | mario79 | 701 | |
2354 | mario79 | 702 | mov edx,sb_line_col |
703 | mov cx,1 |
||
704 | cmp dword sb_all_redraw,0 |
||
705 | je @f |
||
706 | mcall 13 ; bottom button - extreme line |
||
707 | ;----------------------------------------------------------------------------- |
||
708 | ; scrollbar type 1 - stylish frame |
||
709 | cmp word sb_type,1 |
||
710 | jne @f |
||
711 | movzx eax,word sb_start_x |
||
712 | movzx ebx,word sb_start_y |
||
713 | movzx ecx,word sb_size_x |
||
714 | ; drawing a stylish frame on the top button |
||
715 | stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ |
||
716 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
717 | add bx,sb_size_y |
||
718 | sub ebx,sb_btn_high |
||
719 | dec ebx |
||
720 | ; drawing a stylish frame on the bottom button |
||
721 | stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ |
||
722 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1037 | mario79 | 723 | @@: |
2354 | mario79 | 724 | ;----------------------------------------------------------------------------- |
1037 | mario79 | 725 | popa |
726 | ret |
||
727 | ;***************************************************************************** |
||
728 | ;***************************************************************************** |
||
729 | ; mouse event |
||
730 | ;***************************************************************************** |
||
731 | ;***************************************************************************** |
||
732 | .mouse: |
||
733 | pusha |
||
2354 | mario79 | 734 | mov edi,dword [esp+36] |
735 | mcall 37,1 |
||
736 | mov sb_m_pos,eax |
||
737 | cmp dword sb_m_pos_2,0 |
||
738 | jne @f |
||
1037 | mario79 | 739 | |
2354 | mario79 | 740 | mov sb_m_pos_2,eax |
1037 | mario79 | 741 | @@: |
2354 | mario79 | 742 | mcall 37,2 |
743 | mov sb_m_keys,eax |
||
1037 | mario79 | 744 | |
2354 | mario79 | 745 | cmp sb_m_keys,eax |
746 | je @f |
||
1037 | mario79 | 747 | |
2354 | mario79 | 748 | mov sb_m_keys,eax |
749 | mov sb_delta,dword 0 |
||
750 | mov eax,sb_m_pos |
||
751 | mov sb_m_pos_2,eax |
||
752 | jmp .continue_2 |
||
1037 | mario79 | 753 | @@: |
2354 | mario79 | 754 | cmp dword sb_m_keys,0 |
1199 | mario79 | 755 | jne @f |
2354 | mario79 | 756 | mov eax,sb_m_pos |
757 | mov sb_m_pos_2,eax |
||
758 | jmp .correct_1 ;.exit_sb |
||
1037 | mario79 | 759 | @@: |
2354 | mario79 | 760 | mov sb_delta,word 1 |
1037 | mario79 | 761 | |
762 | .continue_2: |
||
2354 | mario79 | 763 | mov eax,sb_m_pos |
764 | test eax,0x80000000 |
||
765 | jnz .exit_sb |
||
1037 | mario79 | 766 | |
2354 | mario79 | 767 | test eax,0x8000 |
768 | jnz .exit_sb |
||
1037 | mario79 | 769 | |
2354 | mario79 | 770 | mov ebx,eax |
771 | shr ebx,16 ; x position |
||
772 | shl eax,16 |
||
773 | shr eax,16 ; y position |
||
1037 | mario79 | 774 | |
2354 | mario79 | 775 | mov cx,sb_start_y |
776 | cmp ax,cx |
||
1041 | mario79 | 777 | jb .exit_sb |
1037 | mario79 | 778 | |
2354 | mario79 | 779 | cmp word sb_delta2,0 |
1041 | mario79 | 780 | je @f |
2354 | mario79 | 781 | push ecx |
782 | add cx,sb_btn_high |
||
783 | cmp ax,cx |
||
784 | pop ecx |
||
1041 | mario79 | 785 | jb .exit_sb |
1037 | mario79 | 786 | |
787 | @@: |
||
2354 | mario79 | 788 | add cx,sb_size_y |
789 | cmp ax,cx |
||
1041 | mario79 | 790 | ja .exit_sb |
1037 | mario79 | 791 | |
2354 | mario79 | 792 | cmp word sb_delta2,0 |
1041 | mario79 | 793 | je @f |
2354 | mario79 | 794 | sub cx,sb_btn_high |
795 | cmp ax,cx |
||
1041 | mario79 | 796 | ja .exit_sb |
1037 | mario79 | 797 | |
798 | @@: |
||
2354 | mario79 | 799 | cmp word sb_delta2,1 |
1041 | mario79 | 800 | je @f |
1037 | mario79 | 801 | |
2354 | mario79 | 802 | cmp dword sb_m_keys,0 |
1041 | mario79 | 803 | je .exit_sb |
804 | |||
2354 | mario79 | 805 | mov cx,sb_start_x |
806 | cmp bx,cx |
||
1041 | mario79 | 807 | jb .exit_sb |
1037 | mario79 | 808 | |
2354 | mario79 | 809 | add cx,sb_size_x |
810 | cmp bx,cx |
||
1041 | mario79 | 811 | ja .exit_sb |
1037 | mario79 | 812 | |
2354 | mario79 | 813 | mov cx,sb_r_start_y |
814 | cmp ax,cx |
||
1041 | mario79 | 815 | jb .no_runner |
1037 | mario79 | 816 | |
2354 | mario79 | 817 | add cx,sb_r_size_y |
818 | cmp ax,cx |
||
1041 | mario79 | 819 | ja .no_runner |
1037 | mario79 | 820 | |
2354 | mario79 | 821 | mov sb_delta2,word 1 |
1037 | mario79 | 822 | @@: |
2354 | mario79 | 823 | push eax |
824 | mov ax,sb_m_pos |
||
825 | cmp ax,sb_m_pos_2 |
||
1199 | mario79 | 826 | je .correct |
1037 | mario79 | 827 | |
2354 | mario79 | 828 | shl eax,16 |
829 | shr eax,16 |
||
830 | mov ebx,sb_m_pos_2 |
||
831 | shl ebx,16 |
||
832 | shr ebx,16 |
||
833 | cmp eax,ebx |
||
834 | jb .sub |
||
1037 | mario79 | 835 | |
2354 | mario79 | 836 | sub eax,ebx |
837 | mov ebx,eax |
||
838 | add sb_position2,ebx |
||
839 | xor eax,eax |
||
840 | mov ax,sb_size_y |
||
841 | sub eax,sb_btn_high |
||
842 | sub eax,sb_btn_high |
||
843 | sub eax,sb_run_size |
||
844 | cmp sb_position2,eax |
||
845 | jbe @f |
||
1037 | mario79 | 846 | |
2354 | mario79 | 847 | mov sb_position2,eax |
1037 | mario79 | 848 | @@: |
2354 | mario79 | 849 | mov eax,sb_m_pos |
850 | mov sb_m_pos_2,eax |
||
851 | pop eax |
||
852 | call .draw_1 |
||
853 | jmp .no_runner_1 |
||
1037 | mario79 | 854 | |
855 | .correct: |
||
2354 | mario79 | 856 | pop eax |
857 | jmp .exit_sb |
||
1037 | mario79 | 858 | .correct_1: |
2354 | mario79 | 859 | mov sb_delta,dword 0 |
860 | jmp .exit_sb |
||
1037 | mario79 | 861 | |
862 | .sub: |
||
2354 | mario79 | 863 | sub ebx,eax |
864 | sub sb_position2,ebx |
||
865 | test sb_position2,dword 0x80000000 |
||
866 | jz @f |
||
1037 | mario79 | 867 | |
2354 | mario79 | 868 | mov sb_position2,dword 0 |
1037 | mario79 | 869 | @@: |
2354 | mario79 | 870 | mov eax,sb_m_pos |
871 | mov sb_m_pos_2,eax |
||
872 | pop eax |
||
873 | call .draw_1 |
||
874 | jmp .no_runner_1 |
||
1037 | mario79 | 875 | |
876 | ;***************************************************************************** |
||
877 | .no_runner: |
||
2354 | mario79 | 878 | mov sb_delta,dword 0 |
1037 | mario79 | 879 | .no_runner_1: |
2354 | mario79 | 880 | xor ecx,ecx |
881 | mov cx,sb_start_y |
||
882 | add cx,sb_btn_high ;15 |
||
883 | cmp word sb_delta,1 |
||
1041 | mario79 | 884 | je .scroll_sb |
1037 | mario79 | 885 | |
2354 | mario79 | 886 | cmp ax,cx |
1041 | mario79 | 887 | ja .scroll_sb |
1037 | mario79 | 888 | |
2354 | mario79 | 889 | cmp dword sb_m_keys,0 |
890 | je .exit_sb |
||
1037 | mario79 | 891 | |
2354 | mario79 | 892 | mov eax,sb_ar_offset |
893 | cmp sb_position,eax ;dword 0 |
||
894 | jbe @f |
||
1037 | mario79 | 895 | |
2354 | mario79 | 896 | sub sb_position,eax |
897 | jmp .all_sb |
||
1037 | mario79 | 898 | @@: |
2354 | mario79 | 899 | xor eax,eax |
900 | mov sb_position,eax ;dword 0 |
||
901 | mov sb_position2,eax ;dword 0 |
||
902 | jmp .all_sb |
||
1037 | mario79 | 903 | ;***************************************************************************** |
904 | .scroll_sb: |
||
2354 | mario79 | 905 | add cx,sb_size_y |
906 | sub cx,sb_btn_high |
||
907 | sub cx,sb_btn_high |
||
908 | cmp word sb_delta,1 |
||
1041 | mario79 | 909 | je @f |
1037 | mario79 | 910 | |
2354 | mario79 | 911 | cmp ax,cx |
1041 | mario79 | 912 | ja .down_sb |
1037 | mario79 | 913 | |
914 | @@: |
||
2354 | mario79 | 915 | mov ebx,sb_btn_high ;16 ;15 |
916 | add bx,sb_start_y |
||
917 | sub cx,bx |
||
918 | sub ax,bx |
||
1037 | mario79 | 919 | |
920 | .scroll_sb_1: |
||
2354 | mario79 | 921 | mov ebx,sb_run_size |
1037 | mario79 | 922 | ;***************************************************************************** |
2354 | mario79 | 923 | cmp word sb_delta,1 |
1041 | mario79 | 924 | je .continue |
1037 | mario79 | 925 | |
926 | @@: |
||
2354 | mario79 | 927 | mov edx,eax |
928 | push ebx |
||
929 | shr ebx,1 |
||
930 | sub edx,ebx |
||
931 | pop ebx |
||
932 | mov sb_position2,edx |
||
933 | test sb_position2,dword 0x80000000 |
||
934 | jz .test_1 |
||
1037 | mario79 | 935 | |
2354 | mario79 | 936 | mov sb_position2,dword 0 |
937 | jmp .continue |
||
1037 | mario79 | 938 | |
939 | .test_1: |
||
2354 | mario79 | 940 | xor edx,edx |
941 | mov dx,sb_size_y |
||
942 | sub edx,sb_btn_high |
||
943 | sub edx,sb_btn_high |
||
944 | sub edx,sb_run_size |
||
945 | cmp sb_position2,edx |
||
946 | jbe .continue |
||
1037 | mario79 | 947 | |
2354 | mario79 | 948 | mov sb_position2,edx |
1199 | mario79 | 949 | |
2354 | mario79 | 950 | .continue: |
951 | mov eax,sb_position2 |
||
952 | sub ecx,ebx |
||
1037 | mario79 | 953 | .continue_1: |
954 | ;***************************************************************************** |
||
2354 | mario79 | 955 | mov ebx,eax |
1037 | mario79 | 956 | |
2354 | mario79 | 957 | mov eax,sb_max_area |
958 | cmp eax,sb_cur_area |
||
1041 | mario79 | 959 | ja @f |
1037 | mario79 | 960 | |
2354 | mario79 | 961 | xor eax,eax |
962 | inc eax |
||
963 | mov sb_position2,eax |
||
964 | jmp .all_sb |
||
1037 | mario79 | 965 | @@: |
2354 | mario79 | 966 | sub eax,sb_cur_area |
967 | inc eax |
||
968 | shl eax,10 |
||
969 | xor edx,edx |
||
970 | div ecx |
||
971 | shl edx,1 |
||
972 | cmp edx,ecx |
||
1041 | mario79 | 973 | jb @f |
1037 | mario79 | 974 | |
2354 | mario79 | 975 | inc eax |
1037 | mario79 | 976 | |
977 | @@: |
||
2354 | mario79 | 978 | imul eax,ebx |
979 | shr eax,10 |
||
1037 | mario79 | 980 | |
2354 | mario79 | 981 | cmp sb_position,eax |
1041 | mario79 | 982 | je .exit_sb |
1037 | mario79 | 983 | |
2354 | mario79 | 984 | cmp eax,0 |
1041 | mario79 | 985 | ja @f |
1037 | mario79 | 986 | |
2354 | mario79 | 987 | xor eax,eax |
1037 | mario79 | 988 | |
989 | @@: |
||
990 | .store_position: |
||
3353 | mario79 | 991 | mov edx,sb_max_area |
992 | sub edx,sb_cur_area |
||
993 | cmp edx,eax |
||
994 | ja @f |
||
995 | |||
996 | mov sb_position,edx |
||
997 | jmp .all_sb |
||
998 | |||
999 | @@: |
||
2354 | mario79 | 1000 | mov sb_position,eax |
1037 | mario79 | 1001 | .all_sb: |
2354 | mario79 | 1002 | mov sb_redraw,dword 1 |
1003 | call .draw_1 |
||
1004 | mov eax,sb_m_pos |
||
1005 | mov sb_m_pos_2,eax |
||
1006 | jmp .exit_sb |
||
1037 | mario79 | 1007 | ;***************************************************************************** |
1008 | .down_sb: |
||
2354 | mario79 | 1009 | cmp dword sb_m_keys,0 |
1010 | je .exit_sb |
||
1037 | mario79 | 1011 | |
2354 | mario79 | 1012 | mov eax,sb_max_area |
1013 | mov ebx,sb_ar_offset |
||
1014 | sub eax,sb_cur_area |
||
1015 | push eax |
||
1016 | sub eax,ebx |
||
1017 | cmp sb_position,eax |
||
1018 | pop eax |
||
1019 | jae @f |
||
1037 | mario79 | 1020 | |
2354 | mario79 | 1021 | add sb_position,ebx |
1022 | jmp .all_sb |
||
1037 | mario79 | 1023 | @@: |
2354 | mario79 | 1024 | mov sb_position,eax |
1025 | xor eax,eax |
||
1026 | mov ax,sb_size_y |
||
1027 | sub eax,sb_btn_high |
||
1028 | sub eax,sb_btn_high |
||
1029 | sub eax,sb_run_size |
||
1030 | mov sb_position2,eax |
||
1031 | jmp .all_sb |
||
1041 | mario79 | 1032 | .exit_sb: |
1037 | mario79 | 1033 | scroll_bar_exit |
1034 | } |
||
1035 | |||
1036 | ;***************************************************************************** |
||
1037 | ;***************************************************************************** |
||
1038 | ;***************************************************************************** |
||
1039 | ;***************************************************************************** |
||
1040 | ;***************************************************************************** |
||
1041 | macro use_scroll_bar_horizontal |
||
1042 | { |
||
1043 | scroll_bar_horizontal: |
||
1044 | .draw: |
||
1045 | pusha |
||
2354 | mario79 | 1046 | mov edi,dword [esp+36] |
1047 | mov sb_delta,word 0 |
||
1048 | call .draw_1 |
||
1049 | mov sb_all_redraw,dword 0 |
||
1037 | mario79 | 1050 | scroll_bar_exit |
1051 | .draw_1: |
||
1052 | pusha |
||
1053 | ;********************************* |
||
2354 | mario79 | 1054 | xor eax,eax |
1055 | mov ax,sb_size_x ;sb_size_y |
||
1056 | mov edx,sb_btn_high |
||
1057 | shl edx,1 |
||
1058 | sub eax,edx |
||
1059 | mov sb_work_size,eax |
||
1037 | mario79 | 1060 | ;********************************* |
2354 | mario79 | 1061 | mov eax,sb_work_size ;sb_max_area |
1062 | mov ebx,sb_max_area |
||
1063 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 1064 | ja @f |
1037 | mario79 | 1065 | |
2354 | mario79 | 1066 | jmp .no_size |
1037 | mario79 | 1067 | |
1068 | @@: |
||
2354 | mario79 | 1069 | imul eax,sb_cur_area |
1070 | xor edx,edx |
||
1071 | div ebx |
||
3353 | mario79 | 1072 | shl edx,1 |
1073 | cmp edx,ebx |
||
1074 | jb @f |
||
1075 | |||
1076 | inc eax |
||
1077 | |||
1078 | @@: |
||
2354 | mario79 | 1079 | cmp eax,10 |
1080 | jae @f |
||
1081 | mov eax,10 |
||
1037 | mario79 | 1082 | @@: |
1083 | .no_size: |
||
2354 | mario79 | 1084 | mov sb_run_size,eax |
1037 | mario79 | 1085 | ;********************************* |
2354 | mario79 | 1086 | cmp word sb_delta,1 |
1041 | mario79 | 1087 | je .@@_3 |
2354 | mario79 | 1088 | mov eax,sb_work_size |
1089 | sub eax,sb_run_size |
||
1090 | mov ebx,sb_max_area |
||
1091 | cmp ebx,sb_cur_area |
||
1041 | mario79 | 1092 | ja @f |
2354 | mario79 | 1093 | xor eax,eax |
1094 | jmp .@@_1 |
||
1037 | mario79 | 1095 | @@: |
2354 | mario79 | 1096 | sub ebx,sb_cur_area |
1097 | imul eax,sb_position |
||
1098 | xor edx,edx |
||
1099 | div ebx |
||
3353 | mario79 | 1100 | shl edx,1 |
1101 | cmp edx,ebx |
||
1102 | jb @f |
||
1103 | |||
1104 | inc eax |
||
1105 | |||
1106 | @@: |
||
1037 | mario79 | 1107 | .@@_1: |
2354 | mario79 | 1108 | mov sb_position2,eax |
1109 | xor edx,edx |
||
1110 | mov dx,sb_size_x |
||
1111 | sub edx,sb_btn_high |
||
1112 | sub edx,sb_btn_high |
||
1113 | sub edx,sb_run_size |
||
1114 | cmp sb_position2,edx |
||
1115 | jbe .@@_3 |
||
1116 | mov sb_position2,edx |
||
1037 | mario79 | 1117 | .@@_3: |
1118 | ;********************************* |
||
2354 | mario79 | 1119 | mov ebx,sb_size_x |
1120 | mov ecx,sb_start_y |
||
1121 | shl ecx,16 |
||
1122 | inc ecx |
||
1123 | mov edx,sb_line_col |
||
1124 | mov eax,13 |
||
1125 | cmp dword sb_all_redraw,0 |
||
1126 | je @f |
||
1127 | int 0x40 ; top extreme line |
||
1037 | mario79 | 1128 | @@: |
2354 | mario79 | 1129 | push ecx |
1130 | ror ecx,16 |
||
1131 | add cx,sb_size_y |
||
1132 | rol ecx,16 |
||
1133 | cmp dword sb_all_redraw,0 |
||
1134 | je @f |
||
1135 | int 0x40 ; bottom extreme line |
||
1037 | mario79 | 1136 | @@: |
2354 | mario79 | 1137 | pop ecx |
1037 | mario79 | 1138 | |
2354 | mario79 | 1139 | push ebx |
1037 | mario79 | 1140 | |
2354 | mario79 | 1141 | add ecx,1 shl 16 |
1142 | mov cx,sb_size_y |
||
1143 | dec ecx |
||
1144 | mov bx,1 |
||
1145 | cmp dword sb_all_redraw,0 |
||
1146 | je @f |
||
1147 | int 0x40 ; left button - extreme line |
||
1037 | mario79 | 1148 | @@: |
2354 | mario79 | 1149 | push ebx |
1150 | add ebx,1 shl 16 |
||
1151 | add ebx,sb_btn_high |
||
1152 | sub ebx,2 |
||
1153 | mov edx,sb_frnt_col |
||
1154 | cmp dword sb_all_redraw,0 |
||
1155 | je .no_draw_top_button |
||
1156 | int 0x40 ; left button filling |
||
1157 | ;----------------------------------------------------------------------------- |
||
1158 | ; scrollbar type 2 |
||
1159 | cmp word sb_type,2 |
||
1160 | jne .no_type2 |
||
1161 | ;********************************* |
||
1162 | draw_up_arrow_horizontal_type2 |
||
1163 | ;********************************* |
||
1164 | jmp .no_draw_top_button |
||
1165 | .no_type2: |
||
1037 | mario79 | 1166 | ;********************************* |
1167 | draw_up_arrow_horizontal |
||
1168 | ;********************************* |
||
2354 | mario79 | 1169 | .no_draw_top_button: |
1170 | pop ebx |
||
1037 | mario79 | 1171 | |
2354 | mario79 | 1172 | ror ebx,16 |
1173 | add ebx,sb_btn_high ;14 shl 16 |
||
1174 | rol ebx,16 |
||
1175 | mov edx,sb_line_col |
||
1176 | cmp dword sb_all_redraw,0 |
||
1177 | je @f |
||
1178 | mcall 13 ; left button - right line |
||
1037 | mario79 | 1179 | @@: |
2354 | mario79 | 1180 | pop ebx |
1037 | mario79 | 1181 | ;********************************* |
2354 | mario79 | 1182 | ror ebx,16 |
1183 | add ebx,sb_btn_high ;15 shl 16 |
||
1184 | inc ebx |
||
1185 | rol ebx,16 |
||
1186 | sub ebx,sb_btn_high ;30 |
||
1187 | sub ebx,sb_btn_high |
||
1188 | push ebx |
||
1189 | mov bx,0 |
||
1190 | add ebx,sb_position2 |
||
1191 | dec bx |
||
1192 | mov eax,13 |
||
1193 | test bx,0x8000 |
||
1194 | jnz @f |
||
1195 | mov edx,sb_bckg_col |
||
1196 | int 0x40 ; left interval |
||
1037 | mario79 | 1197 | @@: |
1198 | ;********************************* |
||
2354 | mario79 | 1199 | shr ebx,16 |
1200 | add ebx,sb_position2 |
||
1201 | dec ebx |
||
1202 | shl ebx,16 |
||
1203 | inc ebx |
||
1204 | mov edx,sb_line_col |
||
1205 | int 0x40 ; runner - left extreme line |
||
1037 | mario79 | 1206 | |
2354 | mario79 | 1207 | add ebx,1 shl 16 |
1208 | mov bx,0 |
||
1209 | add ebx,sb_run_size |
||
1210 | mov sb_r_size_x,ebx |
||
1211 | mov sb_r_size_y,ecx |
||
1212 | sub ebx,2 |
||
1213 | mov edx,sb_frnt_col |
||
1214 | int 0x40 ; runner filling |
||
1215 | ;----------------------------------------------------------------------------- |
||
1216 | ; scrollbar type 2 |
||
1217 | cmp word sb_type,2 |
||
1218 | je @f |
||
1219 | ;********************************* |
||
1037 | mario79 | 1220 | draw_runner_center_horizontal |
1221 | ;********************************* |
||
2354 | mario79 | 1222 | @@: |
1223 | ;----------------------------------------------------------------------------- |
||
1224 | ; scrollbar type 1 - stylish frame |
||
1225 | cmp word sb_type,1 |
||
1226 | jne @f |
||
1227 | push eax ebx ecx edx |
||
1228 | xor eax,eax |
||
1229 | add ax,sb_r_start_x |
||
1230 | dec eax |
||
1231 | movzx ebx,word sb_start_y |
||
1232 | mov ecx,sb_run_size |
||
1233 | dec ecx |
||
1234 | movzx edx,word sb_size_y |
||
1235 | ; drawing a stylish frame on the slider |
||
1236 | stdcall draw_edge,eax,ebx,ecx,edx,\ |
||
1237 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1238 | pop edx ecx ebx eax |
||
1239 | @@: |
||
1240 | ;----------------------------------------------------------------------------- |
||
1241 | shr ebx,16 |
||
1242 | add ebx,sb_run_size |
||
1243 | sub ebx,2 |
||
1244 | shl ebx,16 |
||
1245 | inc ebx |
||
1246 | mov edx,sb_line_col |
||
1247 | int 0x40 ; runner - bottom extreme line |
||
1037 | mario79 | 1248 | |
2354 | mario79 | 1249 | add ebx,1 shl 16 |
1250 | mov bx,sb_start_x |
||
1251 | add bx,sb_size_x |
||
1252 | sub ebx,sb_btn_high |
||
1253 | dec ebx |
||
1254 | mov eax,ebx |
||
1255 | shr eax,16 |
||
1256 | sub bx,ax |
||
1257 | test bx,0x8000 |
||
1258 | jnz @f |
||
1259 | mov edx,sb_bckg_col |
||
1260 | mov eax,13 |
||
1261 | int 0x40 ; bottom interval |
||
1037 | mario79 | 1262 | @@: |
2354 | mario79 | 1263 | pop ebx |
1037 | mario79 | 1264 | ;********************************* |
2354 | mario79 | 1265 | mov ax,bx |
1266 | shr ebx,16 |
||
1267 | add bx,ax |
||
1268 | sub ebx,2 |
||
1269 | shl ebx,16 |
||
1270 | inc ebx |
||
1271 | mov edx,sb_line_col |
||
1272 | mov eax,13 |
||
1273 | cmp dword sb_all_redraw,0 |
||
1274 | je @f |
||
1275 | int 0x40 ; bottom button - top line |
||
1037 | mario79 | 1276 | @@: |
2354 | mario79 | 1277 | push ebx |
1278 | add ebx,1 shl 16 |
||
1279 | add bx,sb_btn_high |
||
1280 | sub ebx,2 |
||
1281 | mov edx,sb_frnt_col |
||
1282 | cmp dword sb_all_redraw,0 |
||
1283 | je .no_draw_bottom_button |
||
1284 | int 0x40 ; bottom button filling |
||
1285 | ;----------------------------------------------------------------------------- |
||
1286 | ; scrollbar type 2 |
||
1287 | cmp word sb_type,2 |
||
1288 | jne .no_type2_1 |
||
1289 | ;********************************* |
||
1290 | draw_down_arrow_horizontal_type2 |
||
1291 | ;********************************* |
||
1292 | jmp .no_draw_bottom_button |
||
1293 | .no_type2_1: |
||
1037 | mario79 | 1294 | ;********************************* |
1295 | draw_down_arrow_horizontal |
||
1296 | ;********************************* |
||
2354 | mario79 | 1297 | .no_draw_bottom_button: |
1298 | pop ebx |
||
1037 | mario79 | 1299 | |
2354 | mario79 | 1300 | ror ebx,16 |
1301 | add ebx,sb_btn_high ;14 shl 16 |
||
1302 | rol ebx,16 |
||
1037 | mario79 | 1303 | |
2354 | mario79 | 1304 | mov edx,sb_line_col |
1305 | mov bx,1 |
||
1306 | cmp dword sb_all_redraw,0 |
||
1307 | je @f |
||
1308 | mcall 13 ; bottom button - extreme line |
||
1309 | ;----------------------------------------------------------------------------- |
||
1310 | ; scrollbar type 1 - stylish frame |
||
1311 | cmp word sb_type,1 |
||
1312 | jne @f |
||
1313 | ; drawing a stylish frame on the left button |
||
1314 | movzx eax,word sb_start_x |
||
1315 | movzx ebx,word sb_start_y |
||
1316 | movzx edx,word sb_size_y |
||
1317 | stdcall draw_edge,eax,ebx,sb_btn_high,edx,\ |
||
1318 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1319 | |||
1320 | movzx eax,word sb_start_x |
||
1321 | add ax,sb_size_x |
||
1322 | sub eax,sb_btn_high |
||
1323 | dec eax |
||
1324 | ; drawing a stylish frame on the right button |
||
1325 | stdcall draw_edge,eax,ebx,sb_btn_high,edx,\ |
||
1326 | sb_bckg_col,sb_frnt_col,sb_line_col |
||
1037 | mario79 | 1327 | @@: |
2354 | mario79 | 1328 | ;----------------------------------------------------------------------------- |
1037 | mario79 | 1329 | popa |
1330 | ret |
||
1331 | ;***************************************************************************** |
||
1332 | ; mouse event |
||
1333 | ;***************************************************************************** |
||
1334 | .mouse: |
||
1335 | pusha |
||
1041 | mario79 | 1336 | mov edi,dword [esp+36] |
2354 | mario79 | 1337 | mcall 37,1 |
1338 | mov sb_m_pos,eax |
||
1339 | cmp dword sb_m_pos_2,0 |
||
1340 | jne @f |
||
1037 | mario79 | 1341 | |
2354 | mario79 | 1342 | mov sb_m_pos_2,eax |
1037 | mario79 | 1343 | @@: |
2354 | mario79 | 1344 | mcall 37,2 |
1345 | mov sb_m_keys,eax |
||
1037 | mario79 | 1346 | |
2354 | mario79 | 1347 | cmp sb_m_keys,eax |
1348 | je @f |
||
1037 | mario79 | 1349 | |
2354 | mario79 | 1350 | mov sb_m_keys,eax |
1037 | mario79 | 1351 | |
2354 | mario79 | 1352 | mov sb_delta,dword 0 |
1037 | mario79 | 1353 | |
2354 | mario79 | 1354 | mov eax,sb_m_pos |
1355 | mov sb_m_pos_2,eax |
||
1356 | jmp .continue_2 |
||
1037 | mario79 | 1357 | |
1358 | @@: |
||
2354 | mario79 | 1359 | cmp dword sb_m_keys,0 |
1199 | mario79 | 1360 | jne @f |
2354 | mario79 | 1361 | mov eax,sb_m_pos |
1362 | mov sb_m_pos_2,eax |
||
1363 | jmp .correct_1 ;.exit_sb |
||
1037 | mario79 | 1364 | @@: |
2354 | mario79 | 1365 | mov sb_delta,word 1 |
1037 | mario79 | 1366 | |
1367 | .continue_2: |
||
2354 | mario79 | 1368 | mov eax,sb_m_pos |
1369 | test eax,0x80000000 |
||
1370 | jnz .exit_sb |
||
1037 | mario79 | 1371 | |
2354 | mario79 | 1372 | test eax,0x8000 |
1373 | jnz .exit_sb |
||
1037 | mario79 | 1374 | |
2354 | mario79 | 1375 | mov ebx,eax |
1376 | shr eax,16 ; x position |
||
1377 | shl ebx,16 |
||
1378 | shr ebx,16 ; y position |
||
1037 | mario79 | 1379 | |
2354 | mario79 | 1380 | mov cx,sb_start_x ;y |
1381 | cmp ax,cx |
||
1041 | mario79 | 1382 | jb .exit_sb |
1037 | mario79 | 1383 | |
2354 | mario79 | 1384 | cmp word sb_delta2,0 |
1041 | mario79 | 1385 | je @f |
2354 | mario79 | 1386 | push ecx |
1387 | add cx,sb_btn_high |
||
1388 | cmp ax,cx |
||
1389 | pop ecx |
||
1041 | mario79 | 1390 | jb .exit_sb |
1037 | mario79 | 1391 | |
1392 | @@: |
||
2354 | mario79 | 1393 | add cx,sb_size_x ;y |
1394 | cmp ax,cx |
||
1041 | mario79 | 1395 | ja .exit_sb |
1037 | mario79 | 1396 | |
2354 | mario79 | 1397 | cmp word sb_delta2,0 |
1041 | mario79 | 1398 | je @f |
2354 | mario79 | 1399 | sub cx,sb_btn_high |
1400 | cmp ax,cx |
||
1041 | mario79 | 1401 | ja .exit_sb |
1037 | mario79 | 1402 | |
1403 | @@: |
||
2354 | mario79 | 1404 | cmp word sb_delta2,1 |
1041 | mario79 | 1405 | je @f |
1037 | mario79 | 1406 | |
2354 | mario79 | 1407 | cmp dword sb_m_keys,0 |
1041 | mario79 | 1408 | je .exit_sb |
1409 | |||
2354 | mario79 | 1410 | mov cx,sb_start_y ;x |
1411 | cmp bx,cx |
||
1041 | mario79 | 1412 | jb .exit_sb |
1037 | mario79 | 1413 | |
2354 | mario79 | 1414 | add cx,sb_size_y ;x |
1415 | cmp bx,cx |
||
1041 | mario79 | 1416 | ja .exit_sb |
1037 | mario79 | 1417 | |
2354 | mario79 | 1418 | mov cx,sb_r_start_x |
1419 | cmp ax,cx |
||
1041 | mario79 | 1420 | jb .no_runner |
1037 | mario79 | 1421 | |
2354 | mario79 | 1422 | add cx,sb_r_size_x |
1423 | cmp ax,cx |
||
1041 | mario79 | 1424 | ja .no_runner |
1037 | mario79 | 1425 | |
2354 | mario79 | 1426 | mov sb_delta2,word 1 |
1037 | mario79 | 1427 | @@: |
2354 | mario79 | 1428 | push eax |
1429 | mov eax,sb_m_pos |
||
1430 | mov ebx,sb_m_pos_2 |
||
1431 | shr eax,16 |
||
1432 | shr ebx,16 |
||
1433 | cmp eax,ebx |
||
1199 | mario79 | 1434 | je .correct |
1037 | mario79 | 1435 | |
2354 | mario79 | 1436 | ; shl eax,16 |
1437 | ; shr eax,16 |
||
1438 | ; mov ebx,sb_m_pos_2 |
||
1439 | ; shl ebx,16 |
||
1440 | ; shr ebx,16 |
||
1441 | ; cmp eax,ebx |
||
1442 | jb .sub |
||
1037 | mario79 | 1443 | |
2354 | mario79 | 1444 | sub eax,ebx |
1445 | mov ebx,eax |
||
1446 | add sb_position2,ebx |
||
1447 | xor eax,eax |
||
1448 | mov ax,sb_size_x ;y |
||
1449 | sub eax,sb_btn_high |
||
1450 | sub eax,sb_btn_high |
||
1451 | sub eax,sb_run_size |
||
1452 | cmp sb_position2,eax |
||
1453 | jbe @f |
||
1037 | mario79 | 1454 | |
2354 | mario79 | 1455 | mov sb_position2,eax |
1037 | mario79 | 1456 | @@: |
2354 | mario79 | 1457 | mov eax,sb_m_pos |
1458 | mov sb_m_pos_2,eax |
||
1459 | pop eax |
||
1460 | call .draw_1 |
||
1461 | jmp .no_runner_1 |
||
1037 | mario79 | 1462 | |
1463 | .correct: |
||
2354 | mario79 | 1464 | pop eax |
1465 | jmp .exit_sb |
||
1037 | mario79 | 1466 | .correct_1: |
2354 | mario79 | 1467 | mov sb_delta,dword 0 |
1468 | jmp .exit_sb |
||
1037 | mario79 | 1469 | |
1470 | .sub: |
||
2354 | mario79 | 1471 | sub ebx,eax |
1472 | sub sb_position2,ebx |
||
1473 | test sb_position2,dword 0x80000000 |
||
1474 | jz @f |
||
1037 | mario79 | 1475 | |
2354 | mario79 | 1476 | mov sb_position2,dword 0 |
1037 | mario79 | 1477 | @@: |
2354 | mario79 | 1478 | mov eax,sb_m_pos |
1479 | mov sb_m_pos_2,eax |
||
1480 | pop eax |
||
1481 | call .draw_1 |
||
1482 | jmp .no_runner_1 |
||
1037 | mario79 | 1483 | |
1484 | ;***************************************************************************** |
||
1485 | .no_runner: |
||
2354 | mario79 | 1486 | mov sb_delta,dword 0 |
1037 | mario79 | 1487 | .no_runner_1: |
2354 | mario79 | 1488 | xor ecx,ecx |
1489 | mov cx,sb_start_x ;y |
||
1490 | add cx,sb_btn_high ;15 |
||
1491 | cmp word sb_delta,1 |
||
1041 | mario79 | 1492 | je .scroll_sb |
1037 | mario79 | 1493 | |
2354 | mario79 | 1494 | cmp ax,cx |
1041 | mario79 | 1495 | ja .scroll_sb |
1037 | mario79 | 1496 | |
2354 | mario79 | 1497 | cmp dword sb_m_keys,0 |
1498 | je .exit_sb |
||
1037 | mario79 | 1499 | |
2354 | mario79 | 1500 | mov eax,sb_ar_offset |
1501 | cmp sb_position,eax ;dword 0 |
||
1502 | jbe @f |
||
1037 | mario79 | 1503 | |
2354 | mario79 | 1504 | sub sb_position,eax |
1505 | jmp .all_sb |
||
1037 | mario79 | 1506 | @@: |
2354 | mario79 | 1507 | xor eax,eax |
1508 | mov sb_position,eax ;dword 0 |
||
1509 | mov sb_position2,eax ;dword 0 |
||
1510 | jmp .all_sb |
||
1037 | mario79 | 1511 | ;***************************************************************************** |
1512 | .scroll_sb: |
||
2354 | mario79 | 1513 | add cx,sb_size_x ;y |
1514 | sub cx,sb_btn_high |
||
1515 | sub cx,sb_btn_high |
||
1516 | cmp word sb_delta,1 |
||
1041 | mario79 | 1517 | je @f |
1037 | mario79 | 1518 | |
2354 | mario79 | 1519 | cmp ax,cx |
1041 | mario79 | 1520 | ja .down_sb |
1037 | mario79 | 1521 | |
1522 | @@: |
||
2354 | mario79 | 1523 | mov ebx,sb_btn_high ;16 ;15 |
1524 | add bx,sb_start_x ;y |
||
1525 | sub cx,bx |
||
1526 | sub ax,bx |
||
1037 | mario79 | 1527 | |
1528 | .scroll_sb_1: |
||
2354 | mario79 | 1529 | mov ebx,sb_run_size |
1037 | mario79 | 1530 | ;***************************************************************************** |
2354 | mario79 | 1531 | cmp word sb_delta,1 |
1041 | mario79 | 1532 | je .continue |
1037 | mario79 | 1533 | |
1534 | @@: |
||
2354 | mario79 | 1535 | mov edx,eax |
1199 | mario79 | 1536 | |
2354 | mario79 | 1537 | push ebx |
1538 | shr ebx,1 |
||
1539 | sub edx,ebx |
||
1540 | pop ebx |
||
1541 | mov sb_position2,edx |
||
1542 | test sb_position2,dword 0x80000000 |
||
1037 | mario79 | 1543 | jz .test_1 |
1544 | |||
2354 | mario79 | 1545 | mov sb_position2,dword 0 |
1546 | jmp .continue |
||
1037 | mario79 | 1547 | |
1548 | .test_1: |
||
2354 | mario79 | 1549 | xor edx,edx |
1550 | mov dx,sb_size_x ;y |
||
1551 | sub edx,sb_btn_high |
||
1552 | sub edx,sb_btn_high |
||
1553 | sub edx,sb_run_size |
||
1554 | cmp sb_position2,edx |
||
1555 | jbe .continue |
||
1037 | mario79 | 1556 | |
2354 | mario79 | 1557 | mov sb_position2,edx |
1199 | mario79 | 1558 | |
2354 | mario79 | 1559 | .continue: |
1560 | mov eax,sb_position2 |
||
1561 | sub ecx,ebx |
||
1037 | mario79 | 1562 | .continue_1: |
1563 | ;***************************************************************************** |
||
2354 | mario79 | 1564 | mov ebx,eax |
1037 | mario79 | 1565 | |
2354 | mario79 | 1566 | mov eax,sb_max_area |
1567 | cmp eax,sb_cur_area |
||
1041 | mario79 | 1568 | ja @f |
1037 | mario79 | 1569 | |
2354 | mario79 | 1570 | xor eax,eax |
1571 | inc eax |
||
1572 | mov sb_position2,eax |
||
1573 | jmp .all_sb |
||
1037 | mario79 | 1574 | @@: |
2354 | mario79 | 1575 | sub eax,sb_cur_area |
1576 | inc eax |
||
1577 | shl eax,10 |
||
1578 | xor edx,edx |
||
1579 | div ecx |
||
1580 | shl edx,1 |
||
1581 | cmp edx,ecx |
||
1041 | mario79 | 1582 | jb @f |
1037 | mario79 | 1583 | |
2354 | mario79 | 1584 | inc eax |
1037 | mario79 | 1585 | |
1586 | @@: |
||
1587 | imul eax,ebx |
||
2354 | mario79 | 1588 | shr eax,10 |
1037 | mario79 | 1589 | |
2354 | mario79 | 1590 | cmp sb_position,eax |
1041 | mario79 | 1591 | je .exit_sb |
1037 | mario79 | 1592 | |
2354 | mario79 | 1593 | cmp eax,0 |
1041 | mario79 | 1594 | ja @f |
1037 | mario79 | 1595 | |
2354 | mario79 | 1596 | xor eax,eax |
1037 | mario79 | 1597 | |
1598 | @@: |
||
1599 | .store_position: |
||
3353 | mario79 | 1600 | mov edx,sb_max_area |
1601 | sub edx,sb_cur_area |
||
1602 | cmp edx,eax |
||
1603 | ja @f |
||
1604 | |||
1605 | mov sb_position,edx |
||
1606 | jmp .all_sb |
||
1607 | |||
1608 | @@: |
||
2354 | mario79 | 1609 | mov sb_position,eax |
1037 | mario79 | 1610 | .all_sb: |
2354 | mario79 | 1611 | mov sb_redraw,dword 1 |
1612 | call .draw_1 |
||
1613 | mov eax,sb_m_pos |
||
1614 | mov sb_m_pos_2,eax |
||
1615 | jmp .exit_sb |
||
1037 | mario79 | 1616 | ;***************************************************************************** |
1617 | .down_sb: |
||
2354 | mario79 | 1618 | cmp dword sb_m_keys,0 |
1619 | je .exit_sb |
||
1037 | mario79 | 1620 | |
2354 | mario79 | 1621 | mov eax,sb_max_area |
1622 | mov ebx,sb_ar_offset |
||
1623 | sub eax,sb_cur_area |
||
1624 | push eax |
||
1625 | sub eax,ebx |
||
1626 | cmp sb_position,eax |
||
1627 | pop eax |
||
1628 | jae @f |
||
1037 | mario79 | 1629 | |
2354 | mario79 | 1630 | add sb_position,ebx |
1631 | jmp .all_sb |
||
1037 | mario79 | 1632 | @@: |
2354 | mario79 | 1633 | mov sb_position,eax |
1634 | xor eax,eax |
||
1635 | mov ax,sb_size_x |
||
1636 | sub eax,sb_btn_high |
||
1637 | sub eax,sb_btn_high |
||
1638 | sub eax,sb_run_size |
||
1639 | mov sb_position2,eax |
||
1640 | jmp .all_sb |
||
1641 | ;***************************************************************************** |
||
1037 | mario79 | 1642 | .exit_sb: |
1643 | scroll_bar_exit |
||
1644 | } |