Box_Lib - Scrollbar type 2

git-svn-id: svn://kolibrios.org@2354 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-02-18 23:28:34 +00:00
parent a2109c90b2
commit a86930f3da
3 changed files with 1187 additions and 984 deletions

View File

@ -1,6 +1,6 @@
;************************************************************** ;**************************************************************
; ScrollBar Macro for Kolibri OS ; 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. ; All rights reserved.
; ;
; Redistribution and use in source and binary forms, with or without ; 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 ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;***************************************************************************** ;*****************************************************************************
; 15.11.2011 add scroll type 1 by IgorA
;*****************************************************************************
macro scroll_bar_exit macro scroll_bar_exit
{ {
popa popa
@ -68,6 +70,42 @@ macro draw_up_arrow_vertical
pop ebx 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 macro draw_down_arrow_vertical
{ {
push ebx push ebx
@ -106,6 +144,44 @@ macro draw_down_arrow_vertical
pop ebx 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 macro draw_runner_center_vertical
{ {
push ebx push ebx
@ -179,6 +255,42 @@ macro draw_up_arrow_horizontal
pop ecx 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 macro draw_down_arrow_horizontal
{ {
push ecx push ecx
@ -217,6 +329,44 @@ macro draw_down_arrow_horizontal
pop ecx 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 macro draw_runner_center_horizontal
{ {
push ebx push ebx
@ -312,7 +462,6 @@ scroll_bar_exit
mov ebx,sb_max_area mov ebx,sb_max_area
cmp ebx,sb_cur_area cmp ebx,sb_cur_area
ja @f ja @f
jmp .no_size jmp .no_size
@@: @@:
@ -388,12 +537,21 @@ scroll_bar_exit
sub ecx,2 sub ecx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je .no_draw_top_button
int 0x40 ; top button filling 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 draw_up_arrow_vertical
;********************************* ;*********************************
@@: .no_draw_top_button:
pop ecx pop ecx
ror ecx,16 ror ecx,16
@ -402,7 +560,7 @@ draw_up_arrow_vertical
mov edx,sb_line_col mov edx,sb_line_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je @f
int 0x40 ; top button - bottom line mcall 13 ; top button - bottom line
@@: @@:
pop ecx pop ecx
;********************************* ;*********************************
@ -439,9 +597,16 @@ draw_up_arrow_vertical
sub ecx,2 sub ecx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
int 0x40 ; runner filling int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;********************************* ;*********************************
draw_runner_center_vertical draw_runner_center_vertical
;********************************* ;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1 cmp word sb_type,1
jne @f jne @f
push eax ebx ecx edx push eax ebx ecx edx
@ -452,10 +617,11 @@ draw_runner_center_vertical
movzx ecx,word sb_size_x movzx ecx,word sb_size_x
mov edx,sb_run_size mov edx,sb_run_size
dec edx 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 stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col
pop edx ecx ebx eax pop edx ecx ebx eax
@@: @@:
;-----------------------------------------------------------------------------
shr ecx,16 shr ecx,16
add ecx,sb_run_size add ecx,sb_run_size
sub ecx,2 sub ecx,2
@ -498,12 +664,21 @@ draw_runner_center_vertical
sub ecx,2 sub ecx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je .no_draw_bottom_button
int 0x40 ; bottom button filling 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 draw_down_arrow_vertical
;********************************* ;*********************************
@@: .no_draw_bottom_button:
pop ecx pop ecx
ror ecx,16 ror ecx,16
@ -514,23 +689,25 @@ draw_down_arrow_vertical
mov cx,1 mov cx,1
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je @f
int 0x40 ; bottom button - extreme line mcall 13 ; bottom button - extreme line
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1 cmp word sb_type,1
jne @f jne @f
movzx eax,word sb_start_x movzx eax,word sb_start_x
movzx ebx,word sb_start_y movzx ebx,word sb_start_y
movzx ecx,word sb_size_x movzx ecx,word sb_size_x
;à¨á®¢ ­¨¥ á⨫쭮© à ¬ª¨ ­  ¢¥àå­¥© ª­®¯ª¥ ; drawing a stylish frame on the top button
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
sb_bckg_col,sb_frnt_col,sb_line_col sb_bckg_col,sb_frnt_col,sb_line_col
add bx,sb_size_y add bx,sb_size_y
sub ebx,sb_btn_high sub ebx,sb_btn_high
dec ebx dec ebx
;à¨á®¢ ­¨¥ á⨫쭮© à ¬ª¨ ­  ­¨¦­¥© ª­®¯ª¥ ; drawing a stylish frame on the bottom button
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\ stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
sb_bckg_col,sb_frnt_col,sb_line_col sb_bckg_col,sb_frnt_col,sb_line_col
@@: @@:
;-----------------------------------------------------------------------------
popa popa
ret ret
;***************************************************************************** ;*****************************************************************************
@ -555,13 +732,10 @@ draw_down_arrow_vertical
je @f je @f
mov sb_m_keys,eax mov sb_m_keys,eax
mov sb_delta,dword 0 mov sb_delta,dword 0
mov eax,sb_m_pos mov eax,sb_m_pos
mov sb_m_pos_2,eax mov sb_m_pos_2,eax
jmp .continue_2 jmp .continue_2
@@: @@:
cmp dword sb_m_keys,0 cmp dword sb_m_keys,0
jne @f jne @f
@ -941,12 +1115,21 @@ scroll_bar_exit
sub ebx,2 sub ebx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je .no_draw_top_button
int 0x40 ; left button filling 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 draw_up_arrow_horizontal
;********************************* ;*********************************
@@: .no_draw_top_button:
pop ebx pop ebx
ror ebx,16 ror ebx,16
@ -955,7 +1138,7 @@ draw_up_arrow_horizontal
mov edx,sb_line_col mov edx,sb_line_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je @f
int 0x40 ; left button - right line mcall 13 ; left button - right line
@@: @@:
pop ebx pop ebx
;********************************* ;*********************************
@ -992,9 +1175,16 @@ draw_up_arrow_horizontal
sub ebx,2 sub ebx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
int 0x40 ; runner filling int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;********************************* ;*********************************
draw_runner_center_horizontal draw_runner_center_horizontal
;********************************* ;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1 cmp word sb_type,1
jne @f jne @f
push eax ebx ecx edx push eax ebx ecx edx
@ -1005,12 +1195,12 @@ draw_runner_center_horizontal
mov ecx,sb_run_size mov ecx,sb_run_size
dec ecx dec ecx
movzx edx,word sb_size_y movzx edx,word sb_size_y
;à¨á®¢ ­¨¥ á⨫쭮© à ¬ª¨ ­  ¯®«§ã­ª¥ ; drawing a stylish frame on the slider
stdcall draw_edge,eax,ebx,ecx,edx,\ stdcall draw_edge,eax,ebx,ecx,edx,\
sb_bckg_col,sb_frnt_col,sb_line_col sb_bckg_col,sb_frnt_col,sb_line_col
pop edx ecx ebx eax pop edx ecx ebx eax
@@: @@:
;-----------------------------------------------------------------------------
shr ebx,16 shr ebx,16
add ebx,sb_run_size add ebx,sb_run_size
sub ebx,2 sub ebx,2
@ -1053,12 +1243,21 @@ draw_runner_center_horizontal
sub ebx,2 sub ebx,2
mov edx,sb_frnt_col mov edx,sb_frnt_col
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je .no_draw_bottom_button
int 0x40 ; bottom button filling 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 draw_down_arrow_horizontal
;********************************* ;*********************************
@@: .no_draw_bottom_button:
pop ebx pop ebx
ror ebx,16 ror ebx,16
@ -1069,10 +1268,12 @@ draw_down_arrow_horizontal
mov bx,1 mov bx,1
cmp dword sb_all_redraw,0 cmp dword sb_all_redraw,0
je @f je @f
int 0x40 ; bottom button - extreme line mcall 13 ; bottom button - extreme line
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1 cmp word sb_type,1
jne @f jne @f
;à¨á®¢ ­¨¥ á⨫쭮© à ¬ª¨ ­  «¥¢®© ª­®¯ª¥ ; drawing a stylish frame on the left button
movzx eax,word sb_start_x movzx eax,word sb_start_x
movzx ebx,word sb_start_y movzx ebx,word sb_start_y
movzx edx,word sb_size_y movzx edx,word sb_size_y
@ -1083,10 +1284,11 @@ draw_down_arrow_horizontal
add ax,sb_size_x add ax,sb_size_x
sub eax,sb_btn_high sub eax,sb_btn_high
dec eax dec eax
;à¨á®¢ ­¨¥ á⨫쭮© à ¬ª¨ ­  ¯à ¢®© ª­®¯ª¥ ; drawing a stylish frame on the right button
stdcall draw_edge,eax,ebx,sb_btn_high,edx,\ stdcall draw_edge,eax,ebx,sb_btn_high,edx,\
sb_bckg_col,sb_frnt_col,sb_line_col sb_bckg_col,sb_frnt_col,sb_line_col
@@: @@:
;-----------------------------------------------------------------------------
popa popa
ret ret
;***************************************************************************** ;*****************************************************************************
@ -1390,6 +1592,7 @@ draw_down_arrow_horizontal
sub eax,sb_run_size sub eax,sb_run_size
mov sb_position2,eax mov sb_position2,eax
jmp .all_sb jmp .all_sb
;*****************************************************************************
.exit_sb: .exit_sb:
scroll_bar_exit scroll_bar_exit
} }

View File

@ -2803,7 +2803,7 @@ scroll_bar_data_vertical:
.size_y dw 300 ;+4 .size_y dw 300 ;+4
.start_y dw 45 ;+6 .start_y dw 45 ;+6
.btn_high dd 15 ;+8 .btn_high dd 15 ;+8
.type dd 1 ;+12 .type dd 0 ;+12
.max_area dd 10 ;+16 .max_area dd 10 ;+16
.cur_area dd 2 ;+20 .cur_area dd 2 ;+20
.position dd 0 ;+24 .position dd 0 ;+24

View File

@ -974,7 +974,7 @@ scroll_bar_data_vertical:
.size_y dw 300 ;+4 .size_y dw 300 ;+4
.start_y dw 30 ;+6 .start_y dw 30 ;+6
.btn_high dd 15 ;+8 .btn_high dd 15 ;+8
.type dd 1 ;+12 .type dd 2 ;+12
.max_area dd 10 ;+16 .max_area dd 10 ;+16
.cur_area dd 2 ;+20 .cur_area dd 2 ;+20
.position dd 0 ;+24 .position dd 0 ;+24
@ -1008,7 +1008,7 @@ scroll_bar_data_horizontal:
.size_y dw 15 ;0 ;+4 .size_y dw 15 ;0 ;+4
.start_y dw 300 ;0 ;+6 .start_y dw 300 ;0 ;+6
.btn_high dd 15 ;+8 .btn_high dd 15 ;+8
.type dd 1 ;+12 .type dd 2 ;+12
.max_area dd 10 ;+16 .max_area dd 10 ;+16
.cur_area dd 2 ;+20 .cur_area dd 2 ;+20
.position dd 0 ;+24 .position dd 0 ;+24