Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2353 → Rev 2354

/programs/develop/libraries/box_lib/trunk/scrollbar.mac
1,6 → 1,6
;**************************************************************
; ScrollBar Macro for Kolibri OS
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
25,6 → 25,8
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; 15.11.2011 add scroll type 1 by IgorA
;*****************************************************************************
macro scroll_bar_exit
{
popa
68,6 → 70,42
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
}
;*****************************************************************************
macro draw_down_arrow_vertical
{
push ebx
106,6 → 144,44
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
}
;*****************************************************************************
macro draw_runner_center_vertical
{
push ebx
179,6 → 255,42
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
}
;*****************************************************************************
macro draw_down_arrow_horizontal
{
push ecx
217,6 → 329,44
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
}
;*****************************************************************************
macro draw_runner_center_horizontal
{
push ebx
312,7 → 462,6
mov ebx,sb_max_area
cmp ebx,sb_cur_area
ja @f
 
jmp .no_size
 
@@:
388,12 → 537,21
sub ecx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je @f
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:
;*********************************
draw_up_arrow_vertical
;*********************************
@@:
.no_draw_top_button:
pop ecx
ror ecx,16
402,7 → 560,7
mov edx,sb_line_col
cmp dword sb_all_redraw,0
je @f
int 0x40 ; top button - bottom line
mcall 13 ; top button - bottom line
@@:
pop ecx
;*********************************
439,9 → 597,16
sub ecx,2
mov edx,sb_frnt_col
int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;*********************************
draw_runner_center_vertical
;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
push eax ebx ecx edx
452,10 → 617,11
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
498,12 → 664,21
sub ecx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je @f
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:
;*********************************
draw_down_arrow_vertical
;*********************************
@@:
.no_draw_bottom_button:
pop ecx
ror ecx,16
514,23 → 689,25
mov cx,1
cmp dword sb_all_redraw,0
je @f
int 0x40 ; bottom button - extreme line
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
@@:
;-----------------------------------------------------------------------------
popa
ret
;*****************************************************************************
555,13 → 732,10
je @f
mov sb_m_keys,eax
mov sb_delta,dword 0
 
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .continue_2
@@:
cmp dword sb_m_keys,0
jne @f
941,12 → 1115,21
sub ebx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je @f
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:
;*********************************
draw_up_arrow_horizontal
;*********************************
@@:
.no_draw_top_button:
pop ebx
ror ebx,16
955,7 → 1138,7
mov edx,sb_line_col
cmp dword sb_all_redraw,0
je @f
int 0x40 ; left button - right line
mcall 13 ; left button - right line
@@:
pop ebx
;*********************************
992,9 → 1175,16
sub ebx,2
mov edx,sb_frnt_col
int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;*********************************
draw_runner_center_horizontal
;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
push eax ebx ecx edx
1005,12 → 1195,12
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
@@:
 
;-----------------------------------------------------------------------------
shr ebx,16
add ebx,sb_run_size
sub ebx,2
1053,12 → 1243,21
sub ebx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je @f
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:
;*********************************
draw_down_arrow_horizontal
;*********************************
@@:
.no_draw_bottom_button:
pop ebx
ror ebx,16
1069,10 → 1268,12
mov bx,1
cmp dword sb_all_redraw,0
je @f
int 0x40 ; bottom button - extreme line
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
1083,10 → 1284,11
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
@@:
;-----------------------------------------------------------------------------
popa
ret
;*****************************************************************************
1390,6 → 1592,7
sub eax,sb_run_size
mov sb_position2,eax
jmp .all_sb
;*****************************************************************************
.exit_sb:
scroll_bar_exit
}