Added border styles(raised, sunken, etched, ridged), possibility to fill frame background.

git-svn-id: svn://kolibrios.org@6586 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
0CodErr 2016-10-10 18:58:07 +00:00
parent e47ae79991
commit 0de6e52a90
2 changed files with 205 additions and 109 deletions

View File

@ -498,4 +498,36 @@ PB_MIN equ +24
PB_MAX equ +28 PB_MAX equ +28
PB_BACK_COLOR equ +32 PB_BACK_COLOR equ +32
PB_PROGRESS_COLOR equ +36 PB_PROGRESS_COLOR equ +36
PB_FRAME_COLOR equ +40 PB_FRAME_COLOR equ +40
; *** Frame constants *** ;
FR_STYLE equ +0 ; Dword
FR_WIDTH equ +4 ; Word
FR_LEFT equ +6 ; Word
FR_HEIGHT equ +8 ; Word
FR_TOP equ +10 ; Word
FR_OUTER_COLOR equ +12 ; Dword
FR_INNER_COLOR equ +16 ; Dword
FR_FLAGS equ +20 ; Dword
FR_TEXT equ +24 ; Dword
FR_TEXT_POSITION equ +28 ; Dword
FR_FONT equ +32 ; Dword
FR_FONT_HEIGHT equ +36 ; Dword
FR_FORE_COLOR equ +40 ; Dword
FR_BACK_COLOR equ +44 ; Dword
; FR_FLAGS = [x][yyy][z]
; z - Caption
; yyy - BorderStyle
; x - BackStyle
FR_CAPTION equ 00001b ; [z]
FR_DOUBLE equ 00000b ; [yyy]
FR_RAISED equ 00010b ; [yyy]
FR_SUNKEN equ 00100b ; [yyy]
FR_ETCHED equ 00110b ; [yyy]
FR_RIDGED equ 01000b ; [yyy]
FR_FILLED equ 10000b ; [x]
; FR_TEXT_POSITION
FR_TEXT_POS_BOTTOM equ 1
FR_TEXT_POS_TOP equ 0

View File

@ -1,4 +1,8 @@
;************************************************************** ;**************************************************************
; 2016, 0CodErr
; Added border styles(raised, sunken, etched, ridged).
; Added possibility to fill frame background.
;**************************************************************
; Frame Macro for Kolibri OS ; Frame Macro for Kolibri OS
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario ; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved. ; All rights reserved.
@ -28,7 +32,6 @@
macro frame_start macro frame_start
{ {
pusha pusha
mov edi,dword [esp+36]
} }
;***************************************************************************** ;*****************************************************************************
macro frame_exit macro frame_exit
@ -39,21 +42,22 @@ ret 4
;***************************************************************************** ;*****************************************************************************
macro use_frame macro use_frame
{ {
fr equ [esp + 36]
frame: frame:
fr_type equ [edi] ;dword fr_type equ [eax + FR_STYLE] ; dword
fr_size_x equ [edi+4] ;word fr_size_x equ [eax + FR_WIDTH] ; word
fr_start_x equ [edi+6] ;word fr_start_x equ [eax + FR_LEFT] ; word
fr_size_y equ [edi+8] ;word fr_size_y equ [eax + FR_HEIGHT] ; word
fr_start_y equ [edi+10] ;word fr_start_y equ [eax + FR_TOP] ; word
fr_ext_fr_col equ [edi+12] ;dword fr_ext_fr_col equ [eax + FR_OUTER_COLOR] ; dword
fr_int_fr_col equ [edi+16] ;dword fr_int_fr_col equ [eax + FR_INNER_COLOR] ; dword
fr_draw_text_flag equ [edi+20] ;dword 0-not,1-yes fr_flags equ [eax + FR_FLAGS] ; dword
fr_text_pointer equ [edi+24] ;dword fr_text_pointer equ [eax + FR_TEXT] ; dword
fr_text_position equ [edi+28] ;dword 0-up,1-bottom fr_text_position equ [eax + FR_TEXT_POSITION] ; dword
fr_font_number equ [edi+32] ;dword 0-monospace,1-variable fr_font_number equ [eax + FR_FONT] ; dword
fr_font_size_y equ [edi+36] ;dword fr_font_size_y equ [eax + FR_FONT_HEIGHT] ; dword
fr_font_color equ [edi+40] ;dword fr_font_color equ [eax + FR_FORE_COLOR] ; dword
fr_font_backgr_color equ [edi+44] ;dword fr_font_backgr_color equ [eax + FR_BACK_COLOR] ; dword
;***************************************************************************** ;*****************************************************************************
;***************************************************************************** ;*****************************************************************************
; draw event ; draw event
@ -62,97 +66,156 @@ fr_font_backgr_color equ [edi+44] ;dword
align 4 align 4
.draw: .draw:
frame_start frame_start
;------------------------------------- mov eax, fr
; in mov edx, fr_ext_fr_col
; ebx = [coordinate on axis x]*65536 + [size on axis x] mov edi, fr_int_fr_col
; ecx = [coordinate on axis y]*65536 + [size on axis y] mov esi, edx
;-------------------------------------- mov ebp, edi
; top mov eax, fr_flags
mov bx,fr_start_x and eax, 1110b
shl ebx,16 .raised:
mov bx,fr_start_x cmp eax, FR_RAISED
add bx,fr_size_x je .border_style_selected
dec bx .sunken:
cmp eax, FR_SUNKEN
mov cx,fr_start_y jne .etched
shl ecx,16 xchg edx, edi
mov cx,fr_start_y xchg esi, ebp
jmp .border_style_selected
mcall 38,,,fr_ext_fr_col .etched:
cmp eax, FR_ETCHED
add ecx,1 shl 16 +1 jne .ridged
add ebx,1 shl 16 xchg edx, edi
dec ebx jmp .border_style_selected
.ridged:
mcall ,,,fr_int_fr_col cmp eax, FR_RIDGED
;-------------------------------------- jne .double
; bottom xchg esi, ebp
mov bx,fr_start_x jmp .border_style_selected
shl ebx,16 .double:
mov bx,fr_start_x cmp eax, FR_DOUBLE
add bx,fr_size_x jne .border_style_selected
dec bx mov edi, edx
mov esi, ebp
mov cx,fr_start_y .border_style_selected:
add cx,fr_size_y ; Outer Top Line
dec cx mov eax, fr
shl ecx,16 mov bx, fr_start_x
mov cx,fr_start_y mov cx, fr_start_y
add cx,fr_size_y shl ebx, 16
dec cx shl ecx, 16
mov bx, fr_size_x
mcall ,,,fr_ext_fr_col add bx, fr_start_x
sub ebx, 1
sub ecx,1 shl 16 +1 mov cx, fr_start_y
add ebx,1 shl 16 mov eax, 38
dec ebx int 64
; Outer Left Line
mcall ,,,fr_int_fr_col mov eax, fr
;-------------------------------------- mov bx, fr_start_x
; left add cx, fr_size_y
mov bx,fr_start_x sub ecx, 1
shl ebx,16 mov eax, 38
mov bx,fr_start_x int 64
; Inner Top Line
mov cx,fr_start_y mov eax, fr
shl ecx,16 mov bx, fr_start_x
mov cx,fr_start_y mov cx, fr_start_y
add cx,fr_size_y add ebx, 1
dec cx add ecx, 1
shl ebx, 16
mcall ,,,fr_ext_fr_col shl ecx, 16
mov bx, fr_size_x
add ebx,1 shl 16 +1 mov cx, fr_start_y
add ecx,1 shl 16 add bx, fr_start_x
dec ecx sub ebx, 2
add ecx, 1
mcall ,,,fr_int_fr_col mov edx, esi
mov eax, 38
;-------------------------------------- int 64
; right ; Inner Left Line
mov bx,fr_start_x mov eax, fr
add bx,fr_size_x mov bx, fr_start_x
dec bx add cx, fr_size_y
shl ebx,16 add ebx, 1
mov bx,fr_start_x sub ecx, 3
add bx,fr_size_x mov edx, esi
dec bx mov eax, 38
int 64
mov cx,fr_start_y ; Outer Bottom Line
shl ecx,16 mov eax, fr
mov cx,fr_start_y mov bx, fr_size_x
add cx,fr_size_y mov cx, fr_size_y
dec cx add bx, fr_start_x
add cx, fr_start_y
mcall ,,,fr_ext_fr_col sub ebx, 1
sub ecx, 1
sub ebx,1 shl 16 +1 shl ebx, 16
add ecx,1 shl 16 shl ecx, 16
dec ecx mov bx, fr_start_x
mov cx, fr_size_y
mcall ,,,fr_int_fr_col add cx, fr_start_y
sub ecx, 1
mov edx, edi
mov eax, 38
int 64
; Outer Right Line
mov eax, fr
add bx, fr_size_x
sub ebx, 1
mov cx, fr_start_y
mov edx, edi
mov eax, 38
int 64
; Inner Bottom Line
mov eax, fr
mov bx, fr_size_x
mov cx, fr_size_y
add bx, fr_start_x
add cx, fr_start_y
sub ebx, 2
sub ecx, 2
shl ebx, 16
shl ecx, 16
mov bx, fr_start_x
mov cx, fr_size_y
add cx, fr_start_y
add ebx, 1
sub ecx, 2
mov edx, ebp
mov eax, 38
int 64
; Inner Right Line
mov eax, fr
mov cx, fr_start_y
add bx, fr_size_x
sub ebx, 3
add ecx, 1
mov edx, ebp
mov eax, 38
int 64
;---------------------------------------------------------------------- ;----------------------------------------------------------------------
cmp fr_draw_text_flag,dword 0 mov eax, fr
test dword fr_flags, FR_FILLED
je .fill_exit
mov bx, fr_start_x
mov cx, fr_start_y
add ebx, 2
add ecx, 2
shl ebx, 16
shl ecx, 16
mov bx, fr_size_x
mov cx, fr_size_y
sub ebx, 4
sub ecx, 4
mov edx, fr_font_backgr_color
mov eax, 13
int 64
.fill_exit:
;----------------------------------------------------------------------
mov eax, fr
test dword fr_flags, FR_CAPTION
je .exit je .exit
mov ecx,0xC0000000 mov ecx,0xC0000000
@ -160,6 +223,7 @@ frame_start
and eax,11b and eax,11b
shl eax,28 shl eax,28
add ecx,eax add ecx,eax
mov eax, fr
mov eax,fr_font_color mov eax,fr_font_color
and eax,0xffffff and eax,0xffffff
add ecx,eax add ecx,eax
@ -171,6 +235,7 @@ frame_start
xor esi,esi xor esi,esi
mov eax, fr
mov bx,fr_start_x mov bx,fr_start_x
add bx,10 add bx,10
shl ebx,16 shl ebx,16
@ -194,10 +259,9 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
.draw_1: .draw_1:
push edi mov edx,fr_text_pointer
mov edi,eax mov edi,fr_font_backgr_color
mcall 4 mcall 4
pop edi
;---------------------------------------------------------------------- ;----------------------------------------------------------------------
align 4 align 4
.exit: .exit: