* gui/window.inc refactoring

git-svn-id: svn://kolibrios.org@1362 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2010-01-05 01:28:11 +00:00
parent 05c7a5c29f
commit 892d2df51e
7 changed files with 1904 additions and 1934 deletions

View File

@ -597,13 +597,13 @@ term9:
shl esi,5
add esi,window_data
mov eax,[esi+WDATA.box.left]
mov [dlx],eax
mov [draw_limits.left],eax
add eax,[esi+WDATA.box.width]
mov [dlxe],eax
mov [draw_limits.right],eax
mov eax,[esi+WDATA.box.top]
mov [dly],eax
mov [draw_limits.top],eax
add eax,[esi+WDATA.box.height]
mov [dlye],eax
mov [draw_limits.bottom],eax
xor eax, eax
mov [esi+WDATA.box.left],eax
@ -807,10 +807,10 @@ term9:
; call systest
sti ; .. and life goes on
mov eax, [dlx]
mov ebx, [dly]
mov ecx, [dlxe]
mov edx, [dlye]
mov eax, [draw_limits.left]
mov ebx, [draw_limits.top]
mov ecx, [draw_limits.right]
mov edx, [draw_limits.bottom]
call calculatescreen
xor eax, eax
xor esi, esi

View File

@ -152,7 +152,7 @@ iglobal
dd display_number ; 47-WriteNum
dd 0 ; 48-SetRedrawType and SetButtonType
dd 0 ; 49-Advanced Power Management (APM)
dd random_shaped_window ; 50-Window shape & scale
dd syscall_set_window_shape ; 50-Window shape & scale
dd syscall_threads ; 51-Threads
dd stack_driver_stat ; 52-Stack driver status
dd socket ; 53-Socket interface
@ -229,7 +229,7 @@ iglobal
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
dd cross_order ; 47-WriteNum
dd display_settings ; 48-SetRedrawType and SetButtonType
dd syscall_display_settings ; 48-SetRedrawType and SetButtonType
dd sys_apm ; 49-Advanced Power Management (APM)
dd cross_order ; 50-Window shape & scale
dd cross_order ; 51-Threads

View File

@ -42,22 +42,22 @@ align 4
;------------------------------------------------------------------------------
syscall_button: ;///// system function 8 //////////////////////////////////////
;------------------------------------------------------------------------------
; Define/undefine GUI button object
;? Define/undefine GUI button object
;------------------------------------------------------------------------------
; Define button arguments:
; ebx = pack[16(x), 16(width)]
; ecx = pack[16(y), 16(height)]
; edx = pack[8(flags), 24(button identifier)]
; flags bits:
; 7 (31) = 0
; 6 (30) = don't draw button
; 5 (29) = don't draw button frame when pressed
; esi = button color
;; Define button:
;> ebx = pack[16(x), 16(width)]
;> ecx = pack[16(y), 16(height)]
;> edx = pack[8(flags), 24(button identifier)]
;> flags bits:
;> 7 (31) = 0
;> 6 (30) = don't draw button
;> 5 (29) = don't draw button frame when pressed
;> esi = button color
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Undefine button arguments:
; edx = pack[8(flags), 24(button identifier)]
; flags bits:
; 7 (31) = 1
;; Undefine button:
;> edx = pack[8(flags), 24(button identifier)]
;> flags bits:
;> 7 (31) = 1
;------------------------------------------------------------------------------
; do we actually need to undefine the button?
test edx, 0x80000000
@ -264,7 +264,7 @@ align 4
;------------------------------------------------------------------------------
check_buttons: ;///////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
cmp byte[BTN_DOWN], 0 ; mouse buttons pressed
jnz @f
@ -460,7 +460,7 @@ check_buttons: ;///////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
button._.dececx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
sub cl, 0x20
jnc @f
@ -478,7 +478,7 @@ button._.dececx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
button._.incecx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
add cl, 0x20
jnc @f
@ -496,7 +496,7 @@ button._.incecx: ;/////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
button._.incecx2: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
add cl, 0x14
jnc @f
@ -514,7 +514,7 @@ button._.incecx2: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
button._.button_dececx: ;//////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
cmp [buttontype], 1
jne .finish
@ -545,76 +545,35 @@ button._.button_dececx: ;//////////////////////////////////////////////////////
;------------------------------------------------------------------------------
button._.negative_button: ;////////////////////////////////////////////////////
;------------------------------------------------------------------------------
; <description>
;? <description>
;------------------------------------------------------------------------------
; If requested, do not display button border on press.
; if requested, do not display button border on press.
test ebx, 0x20000000
jz .draw_negative_button
ret
jnz .exit
.draw_negative_button:
pushad
mov ebx, dword[eax + SYS_BUTTON.left]
mov ecx, dword[eax + SYS_BUTTON.top]
xchg esi, eax
movzx ecx, [esi + SYS_BUTTON.pslot]
shl ecx, 5
add ecx, window_data
mov eax, dword[esi + SYS_BUTTON.left]
mov ebx, dword[esi + SYS_BUTTON.top]
add eax, [ecx + WDATA.box.left]
add ebx, [ecx + WDATA.box.top]
push eax ebx
pop edx ecx
rol eax, 16
rol ebx, 16
rol ecx, 16
push ebx ecx
add ax, cx
add bx, dx
; calculate window-relative coordinates
shr ebx, 16
shr ecx, 16
movzx eax, word[eax + SYS_BUTTON.pslot]
shl eax, 5
add eax, window_data
add ebx, [eax + WDATA.box.left]
add ecx, [eax + WDATA.box.top]
xor edi, edi
inc edi
; top border
mov eax, ebx
shl eax, 16
mov ax, bx
add ax, [esp + 4]
mov ebx, ecx
shl ebx, 16
mov bx, cx
push ebx
mov ecx, 0x01000000
call [draw_line]
; bottom border
movzx edx, word[esp + 4 + 0]
add ebx, edx
shl edx, 16
add ebx, edx
call [draw_line]
; left border
pop ebx
push edx
mov edx, eax
shr edx, 16
mov ax, dx
mov edx, ebx
shr edx, 16
mov bx, dx
add bx, [esp + 4 + 0]
pop edx
add ebx, 0x00010000
dec bx
call [draw_line]
; right border
mov dx, [esp + 4]
add ax, dx
shl edx, 16
add eax, edx
call [draw_line]
pop ecx ebx
mov esi, 0x01000000
call draw_rectangle.forced
popad
.exit:
ret

View File

@ -68,10 +68,10 @@ ends
struct SKIN_BUTTONS
.type dd ?
.pos:
.pos:
.left dw ?
.top dw ?
.size:
.size:
.width dw ?
.height dw ?
ends
@ -311,7 +311,6 @@ drawwindow_IV:
; shr esi,1
; and esi,0x007f7f7f
mov esi,[ebp+SKIN_DATA.colors.outer]
or [edi+WDATA.fl_wdrawn], 4
call draw_rectangle
mov ecx,3
_dw3l:
@ -455,12 +454,6 @@ drawwindow_IV:
no_skin_add_button:
pop edi
and [edi+WDATA.fl_wdrawn], not 4
test [edi+WDATA.fl_wdrawn], 2
jz @f
call drawwindowframes2
@@:
popa
ret 4

File diff suppressed because it is too large Load Diff

View File

@ -684,7 +684,7 @@ end if
mov esi,boot_windefs
call boot_log
call setwindowdefaults
call set_window_defaults
; SET BACKGROUND DEFAULTS
@ -3348,10 +3348,10 @@ sys_window_move:
pop eax
add ecx,eax
add edx,ebx
mov [dlx],eax ; save for drawlimits
mov [dly],ebx
mov [dlxe],ecx
mov [dlye],edx
mov [draw_limits.left],eax ; save for drawlimits
mov [draw_limits.top],ebx
mov [draw_limits.right],ecx
mov [draw_limits.bottom],edx
call calculatescreen
mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw
@ -3667,11 +3667,11 @@ redrawscreen:
add ecx,eax
add edx,ebx
mov ecx,[dlye] ; ecx = area y end ebx = window y start
mov ecx,[draw_limits.bottom] ; ecx = area y end ebx = window y start
cmp ecx,ebx
jb ricino
mov ecx,[dlxe] ; ecx = area x end eax = window x start
mov ecx,[draw_limits.right] ; ecx = area x end eax = window x start
cmp ecx,eax
jb ricino
@ -3682,11 +3682,11 @@ redrawscreen:
add ecx, eax
add edx, ebx
mov eax,[dly] ; eax = area y start edx = window y end
mov eax,[draw_limits.top] ; eax = area y start edx = window y end
cmp edx,eax
jb ricino
mov eax,[dlx] ; eax = area x start ecx = window x end
mov eax,[draw_limits.left] ; eax = area x start ecx = window x end
cmp ecx,eax
jb ricino
@ -3700,22 +3700,22 @@ redrawscreen:
test al,al
jz .az
lea eax,[edi+draw_data-window_data]
mov ebx,[dlx]
mov ebx,[draw_limits.left]
cmp ebx,[eax+RECT.left]
jae @f
mov [eax+RECT.left],ebx
@@:
mov ebx,[dly]
mov ebx,[draw_limits.top]
cmp ebx,[eax+RECT.top]
jae @f
mov [eax+RECT.top],ebx
@@:
mov ebx,[dlxe]
mov ebx,[draw_limits.right]
cmp ebx,[eax+RECT.right]
jbe @f
mov [eax+RECT.right],ebx
@@:
mov ebx,[dlye]
mov ebx,[draw_limits.bottom]
cmp ebx,[eax+RECT.bottom]
jbe @f
mov [eax+RECT.bottom],ebx
@ -3726,13 +3726,13 @@ redrawscreen:
mov eax,edi
add eax,draw_data-window_data
mov ebx,[dlx] ; set limits
mov ebx,[draw_limits.left] ; set limits
mov [eax + RECT.left], ebx
mov ebx,[dly]
mov ebx,[draw_limits.top]
mov [eax + RECT.top], ebx
mov ebx,[dlxe]
mov ebx,[draw_limits.right]
mov [eax + RECT.right], ebx
mov ebx,[dlye]
mov ebx,[draw_limits.bottom]
mov [eax + RECT.bottom], ebx
sub eax,draw_data-window_data

View File

@ -98,6 +98,14 @@ struc TASKDATA
virtual at 0
TASKDATA TASKDATA
end virtual
TSTATE_RUNNING = 0
TSTATE_RUN_SUSPENDED = 1
TSTATE_WAIT_SUSPENDED = 2
TSTATE_ZOMBIE = 3
TSTATE_TERMINATING = 4
TSTATE_WAITING = 5
TSTATE_FREE = 9
; structures definition
struc WDATA {
@ -109,11 +117,12 @@ struc WDATA {
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
.sizeof:
}
virtual at 0
WDATA WDATA
end virtual
label WDATA.fl_wstyle byte at 0x13
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
struc APPDATA
{