2009-02-18 10:19:31 +03:00
|
|
|
;**************************************************************
|
|
|
|
; ScrollBar Macro for Kolibri OS
|
2012-02-19 03:28:34 +04:00
|
|
|
; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario
|
2009-02-18 10:19:31 +03:00
|
|
|
; All rights reserved.
|
|
|
|
;
|
|
|
|
; Redistribution and use in source and binary forms, with or without
|
|
|
|
; modification, are permitted provided that the following conditions are met:
|
2009-02-23 15:26:32 +03:00
|
|
|
; * Redistributions of source code must retain the above copyright
|
2012-02-19 03:28:34 +04:00
|
|
|
; notice, this list of conditions and the following disclaimer.
|
2009-02-23 15:26:32 +03:00
|
|
|
; * Redistributions in binary form must reproduce the above copyright
|
2012-02-19 03:28:34 +04:00
|
|
|
; notice, this list of conditions and the following disclaimer in the
|
|
|
|
; documentation and/or other materials provided with the distribution.
|
2009-02-23 15:26:32 +03:00
|
|
|
; * Neither the name of the <organization> nor the
|
2012-02-19 03:28:34 +04:00
|
|
|
; names of its contributors may be used to endorse or promote products
|
|
|
|
; derived from this software without specific prior written permission.
|
2009-02-18 10:19:31 +03:00
|
|
|
;
|
2009-10-07 22:41:24 +04:00
|
|
|
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
|
2009-02-18 10:19:31 +03:00
|
|
|
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
|
|
|
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
;*****************************************************************************
|
2012-02-19 03:28:34 +04:00
|
|
|
; 15.11.2011 add scroll type 1 by IgorA
|
|
|
|
;*****************************************************************************
|
2009-02-18 10:19:31 +03:00
|
|
|
macro scroll_bar_exit
|
|
|
|
{
|
|
|
|
popa
|
|
|
|
ret 4
|
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_up_arrow_vertical
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ebx,eax
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ebx,4 shl 16
|
|
|
|
mov bx,7
|
|
|
|
mov cx,1
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
sub ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,5
|
|
|
|
int 0x40
|
|
|
|
sub ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,3
|
|
|
|
int 0x40
|
|
|
|
sub ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,1
|
|
|
|
int 0x40
|
|
|
|
pop ebx
|
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_up_arrow_vertical_type2
|
|
|
|
{
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
mov bx,sb_size_x
|
|
|
|
shr bx,1
|
|
|
|
add bx,sb_start_x
|
|
|
|
|
|
|
|
mov cx,sb_btn_high
|
|
|
|
shr cx,1
|
|
|
|
add cx,sb_start_y
|
|
|
|
|
|
|
|
mov ax,bx
|
|
|
|
shl eax,16
|
|
|
|
mov ax,cx
|
|
|
|
|
|
|
|
sub cx,2
|
|
|
|
|
|
|
|
shl ebx,16
|
|
|
|
shl ecx,16
|
|
|
|
|
|
|
|
mov cx,ax
|
|
|
|
shr eax,16
|
|
|
|
mov bx,ax
|
|
|
|
|
|
|
|
add cx,1
|
|
|
|
sub bx,3
|
|
|
|
|
|
|
|
mcall 38,,,sb_line_col
|
|
|
|
|
|
|
|
add bx,6
|
|
|
|
|
|
|
|
mcall
|
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_down_arrow_vertical
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ebx,eax
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ebx,4 shl 16
|
|
|
|
mov bx,7
|
|
|
|
sub ecx,2 shl 16
|
|
|
|
mov cx,1
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,5
|
|
|
|
int 0x40
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,3
|
|
|
|
int 0x40
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,1
|
|
|
|
int 0x40
|
|
|
|
pop ebx
|
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_down_arrow_vertical_type2
|
|
|
|
{
|
|
|
|
push ebx
|
|
|
|
|
|
|
|
mov bx,sb_size_x
|
|
|
|
shr bx,1
|
|
|
|
add bx,sb_start_x
|
|
|
|
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr ax,1
|
|
|
|
mov cx,sb_start_y
|
|
|
|
add cx,sb_size_y
|
|
|
|
sub cx,ax
|
|
|
|
|
|
|
|
mov ax,bx
|
|
|
|
shl eax,16
|
|
|
|
mov ax,cx
|
|
|
|
|
|
|
|
add cx,1
|
|
|
|
|
|
|
|
shl ebx,16
|
|
|
|
shl ecx,16
|
|
|
|
|
|
|
|
mov cx,ax
|
|
|
|
shr eax,16
|
|
|
|
mov bx,ax
|
|
|
|
|
|
|
|
sub cx,2
|
|
|
|
sub bx,3
|
|
|
|
|
|
|
|
mcall 38,,,sb_line_col
|
|
|
|
|
|
|
|
add bx,6
|
|
|
|
|
|
|
|
mcall
|
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_runner_center_vertical
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ebx,eax
|
|
|
|
|
|
|
|
mov edx,sb_run_size
|
|
|
|
shr edx,1
|
|
|
|
shl edx,16
|
|
|
|
add ecx,edx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ecx,8 shl 16
|
|
|
|
sub ebx,5 shl 16
|
|
|
|
mov bx,10
|
|
|
|
add ecx,4 shl 16
|
|
|
|
mov cx,1
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
add ecx,3 shl 16
|
|
|
|
sub ebx,1 shl 16
|
|
|
|
mov bx,12
|
|
|
|
int 0x40
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,10
|
|
|
|
add ecx,3 shl 16
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_up_arrow_horizontal
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ebx,eax
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ecx,4 shl 16
|
|
|
|
mov cx,7
|
|
|
|
mov bx,1
|
|
|
|
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
sub ebx,1 shl 16
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,5
|
|
|
|
int 0x40
|
|
|
|
sub ebx,1 shl 16
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,3
|
|
|
|
int 0x40
|
|
|
|
sub ebx,1 shl 16
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,1
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_up_arrow_horizontal_type2
|
|
|
|
{
|
|
|
|
push ebx ecx
|
|
|
|
|
|
|
|
mov bx,sb_btn_high
|
|
|
|
shr bx,1
|
|
|
|
add bx,sb_start_x
|
|
|
|
|
|
|
|
mov cx,sb_size_y
|
|
|
|
shr cx,1
|
|
|
|
add cx,sb_start_y
|
|
|
|
|
|
|
|
mov ax,bx
|
|
|
|
shl eax,16
|
|
|
|
mov ax,cx
|
|
|
|
|
|
|
|
sub bx,2
|
|
|
|
|
|
|
|
shl ebx,16
|
|
|
|
shl ecx,16
|
|
|
|
|
|
|
|
mov cx,ax
|
|
|
|
shr eax,16
|
|
|
|
mov bx,ax
|
|
|
|
|
|
|
|
add bx,1
|
|
|
|
sub cx,3
|
|
|
|
|
|
|
|
mcall 38,,,sb_line_col
|
|
|
|
|
|
|
|
add cx,6
|
|
|
|
|
|
|
|
mcall
|
|
|
|
pop ecx ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_down_arrow_horizontal
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ebx,eax
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ecx,4 shl 16
|
|
|
|
mov cx,7
|
|
|
|
sub ebx,2 shl 16
|
|
|
|
mov bx,1
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
add ebx,1 shl 16
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,5
|
|
|
|
int 0x40
|
|
|
|
add ebx,1 shl 16
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,3
|
|
|
|
int 0x40
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov cx,1
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_down_arrow_horizontal_type2
|
|
|
|
{
|
|
|
|
push ebx ecx
|
|
|
|
|
|
|
|
mov ax,sb_btn_high
|
|
|
|
shr ax,1
|
|
|
|
mov bx,sb_start_x
|
|
|
|
add bx,sb_size_x
|
|
|
|
sub bx,ax
|
|
|
|
|
|
|
|
mov cx,sb_size_y
|
|
|
|
shr cx,1
|
|
|
|
add cx,sb_start_y
|
|
|
|
|
|
|
|
mov ax,bx
|
|
|
|
shl eax,16
|
|
|
|
mov ax,cx
|
|
|
|
|
|
|
|
add cx,1
|
|
|
|
|
|
|
|
shl ebx,16
|
|
|
|
shl ecx,16
|
|
|
|
|
|
|
|
mov cx,ax
|
|
|
|
shr eax,16
|
|
|
|
mov bx,ax
|
|
|
|
|
|
|
|
sub cx,2
|
|
|
|
sub bx,3
|
|
|
|
|
|
|
|
mcall 38,,,sb_line_col
|
|
|
|
|
|
|
|
add cx,6
|
|
|
|
|
|
|
|
mcall
|
|
|
|
pop ecx ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro draw_runner_center_horizontal
|
|
|
|
{
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
shr eax,1
|
|
|
|
shl eax,16
|
|
|
|
add ecx,eax
|
|
|
|
|
|
|
|
mov edx,sb_run_size
|
|
|
|
shr edx,1
|
|
|
|
shl edx,16
|
|
|
|
add ebx,edx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
sub ebx,8 shl 16
|
|
|
|
sub ecx,5 shl 16
|
|
|
|
mov cx,10
|
|
|
|
add ebx,4 shl 16
|
|
|
|
mov bx,1
|
|
|
|
mov eax,13
|
|
|
|
int 0x40
|
|
|
|
add ebx,3 shl 16
|
|
|
|
sub ecx,1 shl 16
|
|
|
|
mov cx,12
|
|
|
|
int 0x40
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,10
|
|
|
|
add ebx,3 shl 16
|
|
|
|
int 0x40
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
macro use_scroll_bar
|
|
|
|
{
|
|
|
|
scroll_bar:
|
2012-02-19 03:28:34 +04:00
|
|
|
sb_size_x equ [edi]
|
|
|
|
sb_start_x equ [edi+2]
|
|
|
|
sb_size_y equ [edi+4]
|
|
|
|
sb_start_y equ [edi+6]
|
|
|
|
sb_btn_high equ [edi+8]
|
|
|
|
sb_type equ [edi+12]
|
|
|
|
sb_max_area equ [edi+16]
|
|
|
|
sb_cur_area equ [edi+20]
|
|
|
|
sb_position equ [edi+24]
|
|
|
|
sb_bckg_col equ [edi+28]
|
|
|
|
sb_frnt_col equ [edi+32]
|
|
|
|
sb_line_col equ [edi+36]
|
|
|
|
sb_redraw equ [edi+40]
|
|
|
|
sb_delta equ [edi+44]
|
|
|
|
sb_delta2 equ [edi+46]
|
|
|
|
sb_r_size_x equ [edi+48]
|
2009-02-23 15:26:32 +03:00
|
|
|
sb_r_start_x equ [edi+50]
|
2012-02-19 03:28:34 +04:00
|
|
|
sb_r_size_y equ [edi+52]
|
2009-02-23 15:26:32 +03:00
|
|
|
sb_r_start_y equ [edi+54]
|
2012-02-19 03:28:34 +04:00
|
|
|
sb_m_pos equ [edi+56]
|
|
|
|
sb_m_pos_2 equ [edi+60]
|
|
|
|
sb_m_keys equ [edi+64]
|
|
|
|
sb_run_size equ [edi+68]
|
2009-02-23 15:26:32 +03:00
|
|
|
sb_position2 equ [edi+72]
|
|
|
|
sb_work_size equ [edi+76]
|
|
|
|
sb_all_redraw equ [edi+80]
|
|
|
|
sb_ar_offset equ [edi+84]
|
2009-02-18 10:19:31 +03:00
|
|
|
}
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
; draw event
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
macro use_scroll_bar_vertical
|
|
|
|
{
|
|
|
|
scroll_bar_vertical:
|
|
|
|
.draw:
|
|
|
|
pusha
|
2012-02-19 03:28:34 +04:00
|
|
|
mov edi,dword [esp+36]
|
|
|
|
mov sb_delta,word 0
|
|
|
|
call .draw_1
|
|
|
|
mov sb_all_redraw,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
scroll_bar_exit
|
|
|
|
.draw_1:
|
|
|
|
pusha
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
mov edx,sb_btn_high
|
|
|
|
shl edx,1
|
|
|
|
sub eax,edx
|
|
|
|
mov sb_work_size,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_work_size
|
|
|
|
mov ebx,sb_max_area
|
|
|
|
cmp ebx,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2012-02-19 03:28:34 +04:00
|
|
|
jmp .no_size
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
imul eax,sb_cur_area
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
cmp eax,10
|
|
|
|
jae @f
|
|
|
|
mov eax,10
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
|
|
|
.no_size:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_run_size,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .@@_3
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_work_size
|
|
|
|
sub eax,sb_run_size
|
|
|
|
mov ebx,sb_max_area
|
|
|
|
cmp ebx,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
jmp .@@_1
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub ebx,sb_cur_area
|
|
|
|
imul eax,sb_position
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
.@@_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position2,eax
|
|
|
|
xor edx,edx
|
|
|
|
mov dx,sb_size_y
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_run_size
|
|
|
|
cmp sb_position2,edx
|
|
|
|
jbe .@@_3
|
|
|
|
mov sb_position2,edx
|
2009-02-18 10:19:31 +03:00
|
|
|
.@@_3:
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_start_x
|
|
|
|
shl ebx,16
|
|
|
|
inc ebx
|
|
|
|
mov ecx,sb_size_y
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov eax,13
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; left extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
ror ebx,16
|
|
|
|
add bx,sb_size_x
|
|
|
|
rol ebx,16
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; right extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,sb_size_x
|
|
|
|
dec ebx
|
|
|
|
mov cx,1
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; top button - extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add ecx,sb_btn_high
|
|
|
|
sub ecx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je .no_draw_top_button
|
|
|
|
int 0x40 ; top button filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
jne .no_type2
|
|
|
|
;*********************************
|
|
|
|
draw_up_arrow_vertical_type2
|
|
|
|
;*********************************
|
|
|
|
jmp .no_draw_top_button
|
|
|
|
.no_type2:
|
|
|
|
;*********************************
|
2009-02-18 10:19:31 +03:00
|
|
|
draw_up_arrow_vertical
|
2012-02-19 03:28:34 +04:00
|
|
|
;*********************************
|
|
|
|
.no_draw_top_button:
|
|
|
|
pop ecx
|
|
|
|
|
|
|
|
ror ecx,16
|
|
|
|
add ecx,sb_btn_high ;14 shl 16
|
|
|
|
rol ecx,16
|
|
|
|
mov edx,sb_line_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
mcall 13 ; top button - bottom line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop ecx
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
ror ecx,16
|
|
|
|
add ecx,sb_btn_high ;15 shl 16
|
|
|
|
inc ecx
|
|
|
|
rol ecx,16
|
|
|
|
sub ecx,sb_btn_high ;30
|
|
|
|
sub ecx,sb_btn_high
|
|
|
|
push ecx
|
|
|
|
mov cx,0
|
|
|
|
add ecx,sb_position2
|
|
|
|
dec cx
|
|
|
|
mov eax,13
|
|
|
|
test cx,0x8000
|
|
|
|
jnz @f
|
|
|
|
mov edx,sb_bckg_col
|
|
|
|
int 0x40 ; top interval
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
shr ecx,16
|
|
|
|
add ecx,sb_position2
|
|
|
|
dec ecx
|
|
|
|
shl ecx,16
|
|
|
|
inc ecx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
int 0x40 ; runner - top extreme line
|
|
|
|
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,0
|
|
|
|
add ecx,sb_run_size
|
|
|
|
mov sb_r_size_x,ebx
|
|
|
|
mov sb_r_size_y,ecx
|
|
|
|
sub ecx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
int 0x40 ; runner filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
je @f
|
|
|
|
;*********************************
|
2009-02-18 10:19:31 +03:00
|
|
|
draw_runner_center_vertical
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
@@:
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 1 - stylish frame
|
|
|
|
cmp word sb_type,1
|
|
|
|
jne @f
|
|
|
|
push eax ebx ecx edx
|
|
|
|
movzx eax,word sb_start_x
|
|
|
|
xor ebx,ebx
|
|
|
|
add bx,sb_r_start_y
|
|
|
|
dec ebx
|
|
|
|
movzx ecx,word sb_size_x
|
|
|
|
mov edx,sb_run_size
|
|
|
|
dec edx
|
|
|
|
; drawing a stylish frame on the slider
|
|
|
|
stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col
|
|
|
|
pop edx ecx ebx eax
|
|
|
|
@@:
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
shr ecx,16
|
|
|
|
add ecx,sb_run_size
|
|
|
|
sub ecx,2
|
|
|
|
shl ecx,16
|
|
|
|
inc ecx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
int 0x40 ; runner - bottom extreme line
|
|
|
|
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,sb_start_y
|
|
|
|
add cx,sb_size_y
|
|
|
|
sub ecx,sb_btn_high
|
|
|
|
dec ecx
|
|
|
|
mov eax,ecx
|
|
|
|
shr eax,16
|
|
|
|
sub cx,ax
|
|
|
|
test cx,0x8000
|
|
|
|
jnz @f
|
|
|
|
mov edx,sb_bckg_col
|
|
|
|
mov eax,13
|
|
|
|
int 0x40 ; bottom interval
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop ecx
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ax,cx
|
|
|
|
shr ecx,16
|
|
|
|
add cx,ax
|
|
|
|
sub ecx,2
|
|
|
|
shl ecx,16
|
|
|
|
inc ecx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov eax,13
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; bottom button - top line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
add ecx,1 shl 16
|
|
|
|
add cx,sb_btn_high
|
|
|
|
sub ecx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je .no_draw_bottom_button
|
|
|
|
int 0x40 ; bottom button filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
jne .no_type2_1
|
|
|
|
;*********************************
|
|
|
|
draw_down_arrow_vertical_type2
|
|
|
|
;*********************************
|
|
|
|
jmp .no_draw_bottom_button
|
|
|
|
.no_type2_1:
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
|
|
|
draw_down_arrow_vertical
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
.no_draw_bottom_button:
|
|
|
|
pop ecx
|
|
|
|
|
|
|
|
ror ecx,16
|
|
|
|
add ecx,sb_btn_high
|
|
|
|
rol ecx,16
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov cx,1
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
mcall 13 ; bottom button - extreme line
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 1 - stylish frame
|
|
|
|
cmp word sb_type,1
|
|
|
|
jne @f
|
|
|
|
movzx eax,word sb_start_x
|
|
|
|
movzx ebx,word sb_start_y
|
|
|
|
movzx ecx,word sb_size_x
|
|
|
|
; drawing a stylish frame on the top button
|
|
|
|
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
|
|
|
|
sb_bckg_col,sb_frnt_col,sb_line_col
|
|
|
|
add bx,sb_size_y
|
|
|
|
sub ebx,sb_btn_high
|
|
|
|
dec ebx
|
|
|
|
; drawing a stylish frame on the bottom button
|
|
|
|
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
|
|
|
|
sb_bckg_col,sb_frnt_col,sb_line_col
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2009-02-18 10:19:31 +03:00
|
|
|
popa
|
|
|
|
ret
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
; mouse event
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
.mouse:
|
|
|
|
pusha
|
2012-02-19 03:28:34 +04:00
|
|
|
mov edi,dword [esp+36]
|
|
|
|
mcall 37,1
|
|
|
|
mov sb_m_pos,eax
|
|
|
|
cmp dword sb_m_pos_2,0
|
|
|
|
jne @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_m_pos_2,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mcall 37,2
|
|
|
|
mov sb_m_keys,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp sb_m_keys,eax
|
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_m_keys,eax
|
|
|
|
mov sb_delta,dword 0
|
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .continue_2
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
2009-10-07 22:41:24 +04:00
|
|
|
jne @f
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .correct_1 ;.exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,word 1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.continue_2:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
test eax,0x80000000
|
|
|
|
jnz .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
test eax,0x8000
|
|
|
|
jnz .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,eax
|
|
|
|
shr ebx,16 ; x position
|
|
|
|
shl eax,16
|
|
|
|
shr eax,16 ; y position
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_start_y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
add cx,sb_btn_high
|
|
|
|
cmp ax,cx
|
|
|
|
pop ecx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2012-02-19 03:28:34 +04:00
|
|
|
sub cx,sb_btn_high
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je .exit_sb
|
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_start_x
|
|
|
|
cmp bx,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_x
|
|
|
|
cmp bx,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_r_start_y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .no_runner
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_r_size_y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .no_runner
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta2,word 1
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push eax
|
|
|
|
mov ax,sb_m_pos
|
|
|
|
cmp ax,sb_m_pos_2
|
2009-10-07 22:41:24 +04:00
|
|
|
je .correct
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
shl eax,16
|
|
|
|
shr eax,16
|
|
|
|
mov ebx,sb_m_pos_2
|
|
|
|
shl ebx,16
|
|
|
|
shr ebx,16
|
|
|
|
cmp eax,ebx
|
|
|
|
jb .sub
|
|
|
|
|
|
|
|
sub eax,ebx
|
|
|
|
mov ebx,eax
|
|
|
|
add sb_position2,ebx
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_run_size
|
|
|
|
cmp sb_position2,eax
|
|
|
|
jbe @f
|
|
|
|
|
|
|
|
mov sb_position2,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
pop eax
|
|
|
|
call .draw_1
|
|
|
|
jmp .no_runner_1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.correct:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop eax
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
.correct_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,dword 0
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.sub:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub ebx,eax
|
|
|
|
sub sb_position2,ebx
|
|
|
|
test sb_position2,dword 0x80000000
|
|
|
|
jz @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position2,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
pop eax
|
|
|
|
call .draw_1
|
|
|
|
jmp .no_runner_1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
;*****************************************************************************
|
|
|
|
.no_runner:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
.no_runner_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor ecx,ecx
|
|
|
|
mov cx,sb_start_y
|
|
|
|
add cx,sb_btn_high ;15
|
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .scroll_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .scroll_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
|
|
|
je .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_ar_offset
|
|
|
|
cmp sb_position,eax ;dword 0
|
|
|
|
jbe @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
sub sb_position,eax
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
mov sb_position,eax ;dword 0
|
|
|
|
mov sb_position2,eax ;dword 0
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
|
|
|
.scroll_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_y
|
|
|
|
sub cx,sb_btn_high
|
|
|
|
sub cx,sb_btn_high
|
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .down_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_btn_high ;16 ;15
|
|
|
|
add bx,sb_start_y
|
|
|
|
sub cx,bx
|
|
|
|
sub ax,bx
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.scroll_sb_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_run_size
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .continue
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov edx,eax
|
|
|
|
push ebx
|
|
|
|
shr ebx,1
|
|
|
|
sub edx,ebx
|
|
|
|
pop ebx
|
|
|
|
mov sb_position2,edx
|
|
|
|
test sb_position2,dword 0x80000000
|
|
|
|
jz .test_1
|
|
|
|
|
|
|
|
mov sb_position2,dword 0
|
|
|
|
jmp .continue
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.test_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor edx,edx
|
|
|
|
mov dx,sb_size_y
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_run_size
|
|
|
|
cmp sb_position2,edx
|
|
|
|
jbe .continue
|
|
|
|
|
|
|
|
mov sb_position2,edx
|
2009-10-07 22:41:24 +04:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
.continue:
|
|
|
|
mov eax,sb_position2
|
|
|
|
sub ecx,ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
.continue_1:
|
|
|
|
;*****************************************************************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_max_area
|
|
|
|
cmp eax,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
inc eax
|
|
|
|
mov sb_position2,eax
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub eax,sb_cur_area
|
|
|
|
inc eax
|
|
|
|
shl eax,10
|
|
|
|
xor edx,edx
|
|
|
|
div ecx
|
|
|
|
shl edx,1
|
|
|
|
cmp edx,ecx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
inc eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
imul eax,ebx
|
|
|
|
shr eax,10
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp sb_position,eax
|
2009-02-23 15:26:32 +03:00
|
|
|
je .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp eax,0
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
|
|
|
.store_position:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
.all_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_redraw,dword 1
|
|
|
|
call .draw_1
|
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
|
|
|
.down_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
|
|
|
je .exit_sb
|
|
|
|
|
|
|
|
mov eax,sb_max_area
|
|
|
|
mov ebx,sb_ar_offset
|
|
|
|
sub eax,sb_cur_area
|
|
|
|
push eax
|
|
|
|
sub eax,ebx
|
|
|
|
cmp sb_position,eax
|
|
|
|
pop eax
|
|
|
|
jae @f
|
|
|
|
|
|
|
|
add sb_position,ebx
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position,eax
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_y
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_run_size
|
|
|
|
mov sb_position2,eax
|
|
|
|
jmp .all_sb
|
2009-02-23 15:26:32 +03:00
|
|
|
.exit_sb:
|
2009-02-18 10:19:31 +03:00
|
|
|
scroll_bar_exit
|
|
|
|
}
|
|
|
|
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
;*****************************************************************************
|
|
|
|
macro use_scroll_bar_horizontal
|
|
|
|
{
|
|
|
|
scroll_bar_horizontal:
|
|
|
|
.draw:
|
|
|
|
pusha
|
2012-02-19 03:28:34 +04:00
|
|
|
mov edi,dword [esp+36]
|
|
|
|
mov sb_delta,word 0
|
|
|
|
call .draw_1
|
|
|
|
mov sb_all_redraw,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
scroll_bar_exit
|
|
|
|
.draw_1:
|
|
|
|
pusha
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x ;sb_size_y
|
|
|
|
mov edx,sb_btn_high
|
|
|
|
shl edx,1
|
|
|
|
sub eax,edx
|
|
|
|
mov sb_work_size,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_work_size ;sb_max_area
|
|
|
|
mov ebx,sb_max_area
|
|
|
|
cmp ebx,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
jmp .no_size
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
imul eax,sb_cur_area
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
|
|
|
cmp eax,10
|
|
|
|
jae @f
|
|
|
|
mov eax,10
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
|
|
|
.no_size:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_run_size,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .@@_3
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_work_size
|
|
|
|
sub eax,sb_run_size
|
|
|
|
mov ebx,sb_max_area
|
|
|
|
cmp ebx,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
jmp .@@_1
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub ebx,sb_cur_area
|
|
|
|
imul eax,sb_position
|
|
|
|
xor edx,edx
|
|
|
|
div ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
.@@_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position2,eax
|
|
|
|
xor edx,edx
|
|
|
|
mov dx,sb_size_x
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_run_size
|
|
|
|
cmp sb_position2,edx
|
|
|
|
jbe .@@_3
|
|
|
|
mov sb_position2,edx
|
2009-02-18 10:19:31 +03:00
|
|
|
.@@_3:
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_size_x
|
|
|
|
mov ecx,sb_start_y
|
|
|
|
shl ecx,16
|
|
|
|
inc ecx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov eax,13
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; top extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
ror ecx,16
|
|
|
|
add cx,sb_size_y
|
|
|
|
rol ecx,16
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; bottom extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop ecx
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
|
|
|
|
add ecx,1 shl 16
|
|
|
|
mov cx,sb_size_y
|
|
|
|
dec ecx
|
|
|
|
mov bx,1
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; left button - extreme line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
add ebx,1 shl 16
|
|
|
|
add ebx,sb_btn_high
|
|
|
|
sub ebx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je .no_draw_top_button
|
|
|
|
int 0x40 ; left button filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
jne .no_type2
|
|
|
|
;*********************************
|
|
|
|
draw_up_arrow_horizontal_type2
|
|
|
|
;*********************************
|
|
|
|
jmp .no_draw_top_button
|
|
|
|
.no_type2:
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
|
|
|
draw_up_arrow_horizontal
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
.no_draw_top_button:
|
|
|
|
pop ebx
|
|
|
|
|
|
|
|
ror ebx,16
|
|
|
|
add ebx,sb_btn_high ;14 shl 16
|
|
|
|
rol ebx,16
|
|
|
|
mov edx,sb_line_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
mcall 13 ; left button - right line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
ror ebx,16
|
|
|
|
add ebx,sb_btn_high ;15 shl 16
|
|
|
|
inc ebx
|
|
|
|
rol ebx,16
|
|
|
|
sub ebx,sb_btn_high ;30
|
|
|
|
sub ebx,sb_btn_high
|
|
|
|
push ebx
|
|
|
|
mov bx,0
|
|
|
|
add ebx,sb_position2
|
|
|
|
dec bx
|
|
|
|
mov eax,13
|
|
|
|
test bx,0x8000
|
|
|
|
jnz @f
|
|
|
|
mov edx,sb_bckg_col
|
|
|
|
int 0x40 ; left interval
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
shr ebx,16
|
|
|
|
add ebx,sb_position2
|
|
|
|
dec ebx
|
|
|
|
shl ebx,16
|
|
|
|
inc ebx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
int 0x40 ; runner - left extreme line
|
|
|
|
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,0
|
|
|
|
add ebx,sb_run_size
|
|
|
|
mov sb_r_size_x,ebx
|
|
|
|
mov sb_r_size_y,ecx
|
|
|
|
sub ebx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
int 0x40 ; runner filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
je @f
|
|
|
|
;*********************************
|
2009-02-18 10:19:31 +03:00
|
|
|
draw_runner_center_horizontal
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
@@:
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 1 - stylish frame
|
|
|
|
cmp word sb_type,1
|
|
|
|
jne @f
|
|
|
|
push eax ebx ecx edx
|
|
|
|
xor eax,eax
|
|
|
|
add ax,sb_r_start_x
|
|
|
|
dec eax
|
|
|
|
movzx ebx,word sb_start_y
|
|
|
|
mov ecx,sb_run_size
|
|
|
|
dec ecx
|
|
|
|
movzx edx,word sb_size_y
|
|
|
|
; drawing a stylish frame on the slider
|
|
|
|
stdcall draw_edge,eax,ebx,ecx,edx,\
|
|
|
|
sb_bckg_col,sb_frnt_col,sb_line_col
|
|
|
|
pop edx ecx ebx eax
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
shr ebx,16
|
|
|
|
add ebx,sb_run_size
|
|
|
|
sub ebx,2
|
|
|
|
shl ebx,16
|
|
|
|
inc ebx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
int 0x40 ; runner - bottom extreme line
|
|
|
|
|
|
|
|
add ebx,1 shl 16
|
|
|
|
mov bx,sb_start_x
|
|
|
|
add bx,sb_size_x
|
|
|
|
sub ebx,sb_btn_high
|
|
|
|
dec ebx
|
|
|
|
mov eax,ebx
|
|
|
|
shr eax,16
|
|
|
|
sub bx,ax
|
|
|
|
test bx,0x8000
|
|
|
|
jnz @f
|
|
|
|
mov edx,sb_bckg_col
|
|
|
|
mov eax,13
|
|
|
|
int 0x40 ; bottom interval
|
|
|
|
@@:
|
|
|
|
pop ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ax,bx
|
|
|
|
shr ebx,16
|
|
|
|
add bx,ax
|
|
|
|
sub ebx,2
|
|
|
|
shl ebx,16
|
|
|
|
inc ebx
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov eax,13
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
int 0x40 ; bottom button - top line
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
add ebx,1 shl 16
|
|
|
|
add bx,sb_btn_high
|
|
|
|
sub ebx,2
|
|
|
|
mov edx,sb_frnt_col
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je .no_draw_bottom_button
|
|
|
|
int 0x40 ; bottom button filling
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 2
|
|
|
|
cmp word sb_type,2
|
|
|
|
jne .no_type2_1
|
|
|
|
;*********************************
|
|
|
|
draw_down_arrow_horizontal_type2
|
|
|
|
;*********************************
|
|
|
|
jmp .no_draw_bottom_button
|
|
|
|
.no_type2_1:
|
2009-02-18 10:19:31 +03:00
|
|
|
;*********************************
|
|
|
|
draw_down_arrow_horizontal
|
|
|
|
;*********************************
|
2012-02-19 03:28:34 +04:00
|
|
|
.no_draw_bottom_button:
|
|
|
|
pop ebx
|
|
|
|
|
|
|
|
ror ebx,16
|
|
|
|
add ebx,sb_btn_high ;14 shl 16
|
|
|
|
rol ebx,16
|
|
|
|
|
|
|
|
mov edx,sb_line_col
|
|
|
|
mov bx,1
|
|
|
|
cmp dword sb_all_redraw,0
|
|
|
|
je @f
|
|
|
|
mcall 13 ; bottom button - extreme line
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; scrollbar type 1 - stylish frame
|
|
|
|
cmp word sb_type,1
|
|
|
|
jne @f
|
|
|
|
; drawing a stylish frame on the left button
|
|
|
|
movzx eax,word sb_start_x
|
|
|
|
movzx ebx,word sb_start_y
|
|
|
|
movzx edx,word sb_size_y
|
|
|
|
stdcall draw_edge,eax,ebx,sb_btn_high,edx,\
|
|
|
|
sb_bckg_col,sb_frnt_col,sb_line_col
|
|
|
|
|
|
|
|
movzx eax,word sb_start_x
|
|
|
|
add ax,sb_size_x
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
dec eax
|
|
|
|
; drawing a stylish frame on the right button
|
|
|
|
stdcall draw_edge,eax,ebx,sb_btn_high,edx,\
|
|
|
|
sb_bckg_col,sb_frnt_col,sb_line_col
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2009-02-18 10:19:31 +03:00
|
|
|
popa
|
|
|
|
ret
|
|
|
|
;*****************************************************************************
|
|
|
|
; mouse event
|
|
|
|
;*****************************************************************************
|
|
|
|
.mouse:
|
|
|
|
pusha
|
2009-02-23 15:26:32 +03:00
|
|
|
mov edi,dword [esp+36]
|
2012-02-19 03:28:34 +04:00
|
|
|
mcall 37,1
|
|
|
|
mov sb_m_pos,eax
|
|
|
|
cmp dword sb_m_pos_2,0
|
|
|
|
jne @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_m_pos_2,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mcall 37,2
|
|
|
|
mov sb_m_keys,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp sb_m_keys,eax
|
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_m_keys,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .continue_2
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
2009-10-07 22:41:24 +04:00
|
|
|
jne @f
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .correct_1 ;.exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,word 1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.continue_2:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
test eax,0x80000000
|
|
|
|
jnz .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
test eax,0x8000
|
|
|
|
jnz .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,eax
|
|
|
|
shr eax,16 ; x position
|
|
|
|
shl ebx,16
|
|
|
|
shr ebx,16 ; y position
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_start_x ;y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2012-02-19 03:28:34 +04:00
|
|
|
push ecx
|
|
|
|
add cx,sb_btn_high
|
|
|
|
cmp ax,cx
|
|
|
|
pop ecx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_x ;y
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2012-02-19 03:28:34 +04:00
|
|
|
sub cx,sb_btn_high
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta2,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
2009-02-23 15:26:32 +03:00
|
|
|
je .exit_sb
|
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_start_y ;x
|
|
|
|
cmp bx,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_y ;x
|
|
|
|
cmp bx,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov cx,sb_r_start_x
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb .no_runner
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_r_size_x
|
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .no_runner
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta2,word 1
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
push eax
|
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov ebx,sb_m_pos_2
|
|
|
|
shr eax,16
|
|
|
|
shr ebx,16
|
|
|
|
cmp eax,ebx
|
2009-10-07 22:41:24 +04:00
|
|
|
je .correct
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
; shl eax,16
|
|
|
|
; shr eax,16
|
|
|
|
; mov ebx,sb_m_pos_2
|
|
|
|
; shl ebx,16
|
|
|
|
; shr ebx,16
|
|
|
|
; cmp eax,ebx
|
|
|
|
jb .sub
|
|
|
|
|
|
|
|
sub eax,ebx
|
|
|
|
mov ebx,eax
|
|
|
|
add sb_position2,ebx
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x ;y
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_run_size
|
|
|
|
cmp sb_position2,eax
|
|
|
|
jbe @f
|
|
|
|
|
|
|
|
mov sb_position2,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
pop eax
|
|
|
|
call .draw_1
|
|
|
|
jmp .no_runner_1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.correct:
|
2012-02-19 03:28:34 +04:00
|
|
|
pop eax
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
.correct_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,dword 0
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.sub:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub ebx,eax
|
|
|
|
sub sb_position2,ebx
|
|
|
|
test sb_position2,dword 0x80000000
|
|
|
|
jz @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position2,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
pop eax
|
|
|
|
call .draw_1
|
|
|
|
jmp .no_runner_1
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
;*****************************************************************************
|
|
|
|
.no_runner:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_delta,dword 0
|
2009-02-18 10:19:31 +03:00
|
|
|
.no_runner_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor ecx,ecx
|
|
|
|
mov cx,sb_start_x ;y
|
|
|
|
add cx,sb_btn_high ;15
|
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .scroll_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .scroll_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
|
|
|
je .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_ar_offset
|
|
|
|
cmp sb_position,eax ;dword 0
|
|
|
|
jbe @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
sub sb_position,eax
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
mov sb_position,eax ;dword 0
|
|
|
|
mov sb_position2,eax ;dword 0
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
|
|
|
.scroll_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
add cx,sb_size_x ;y
|
|
|
|
sub cx,sb_btn_high
|
|
|
|
sub cx,sb_btn_high
|
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp ax,cx
|
2009-02-23 15:26:32 +03:00
|
|
|
ja .down_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_btn_high ;16 ;15
|
|
|
|
add bx,sb_start_x ;y
|
|
|
|
sub cx,bx
|
|
|
|
sub ax,bx
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.scroll_sb_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,sb_run_size
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp word sb_delta,1
|
2009-02-23 15:26:32 +03:00
|
|
|
je .continue
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov edx,eax
|
2009-10-07 22:41:24 +04:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
push ebx
|
|
|
|
shr ebx,1
|
|
|
|
sub edx,ebx
|
|
|
|
pop ebx
|
|
|
|
mov sb_position2,edx
|
|
|
|
test sb_position2,dword 0x80000000
|
2009-02-18 10:19:31 +03:00
|
|
|
jz .test_1
|
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position2,dword 0
|
|
|
|
jmp .continue
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
.test_1:
|
2012-02-19 03:28:34 +04:00
|
|
|
xor edx,edx
|
|
|
|
mov dx,sb_size_x ;y
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_btn_high
|
|
|
|
sub edx,sb_run_size
|
|
|
|
cmp sb_position2,edx
|
|
|
|
jbe .continue
|
|
|
|
|
|
|
|
mov sb_position2,edx
|
2009-10-07 22:41:24 +04:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
.continue:
|
|
|
|
mov eax,sb_position2
|
|
|
|
sub ecx,ebx
|
2009-02-18 10:19:31 +03:00
|
|
|
.continue_1:
|
|
|
|
;*****************************************************************************
|
2012-02-19 03:28:34 +04:00
|
|
|
mov ebx,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
mov eax,sb_max_area
|
|
|
|
cmp eax,sb_cur_area
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
|
|
|
inc eax
|
|
|
|
mov sb_position2,eax
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
sub eax,sb_cur_area
|
|
|
|
inc eax
|
|
|
|
shl eax,10
|
|
|
|
xor edx,edx
|
|
|
|
div ecx
|
|
|
|
shl edx,1
|
|
|
|
cmp edx,ecx
|
2009-02-23 15:26:32 +03:00
|
|
|
jb @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
inc eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
|
|
|
imul eax,ebx
|
2012-02-19 03:28:34 +04:00
|
|
|
shr eax,10
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp sb_position,eax
|
2009-02-23 15:26:32 +03:00
|
|
|
je .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp eax,0
|
2009-02-23 15:26:32 +03:00
|
|
|
ja @f
|
2009-02-18 10:19:31 +03:00
|
|
|
|
2012-02-19 03:28:34 +04:00
|
|
|
xor eax,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
|
|
|
|
@@:
|
|
|
|
.store_position:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position,eax
|
2009-02-18 10:19:31 +03:00
|
|
|
.all_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_redraw,dword 1
|
|
|
|
call .draw_1
|
|
|
|
mov eax,sb_m_pos
|
|
|
|
mov sb_m_pos_2,eax
|
|
|
|
jmp .exit_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
;*****************************************************************************
|
|
|
|
.down_sb:
|
2012-02-19 03:28:34 +04:00
|
|
|
cmp dword sb_m_keys,0
|
|
|
|
je .exit_sb
|
|
|
|
|
|
|
|
mov eax,sb_max_area
|
|
|
|
mov ebx,sb_ar_offset
|
|
|
|
sub eax,sb_cur_area
|
|
|
|
push eax
|
|
|
|
sub eax,ebx
|
|
|
|
cmp sb_position,eax
|
|
|
|
pop eax
|
|
|
|
jae @f
|
|
|
|
|
|
|
|
add sb_position,ebx
|
|
|
|
jmp .all_sb
|
2009-02-18 10:19:31 +03:00
|
|
|
@@:
|
2012-02-19 03:28:34 +04:00
|
|
|
mov sb_position,eax
|
|
|
|
xor eax,eax
|
|
|
|
mov ax,sb_size_x
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_btn_high
|
|
|
|
sub eax,sb_run_size
|
|
|
|
mov sb_position2,eax
|
|
|
|
jmp .all_sb
|
|
|
|
;*****************************************************************************
|
2009-02-18 10:19:31 +03:00
|
|
|
.exit_sb:
|
|
|
|
scroll_bar_exit
|
|
|
|
}
|