Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2539 → Rev 2540

/kernel/branches/net/gui/button.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
133,7 → 133,8
call button._.button_dececx
push edi
xor edi, edi
call [draw_line]
; call [draw_line]
call __sys_draw_line
pop edi
add ebx, 0x00010001
dec edx
164,7 → 165,8
xor edi, edi
mov ecx, esi
call button._.incecx
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
; bottom border
movzx edx, word[esp + 4 + 0]
173,7 → 175,8
add ebx, edx
mov ecx, esi
call button._.dececx
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
; left border
pop ebx
188,7 → 191,8
pop edx
mov ecx, esi
call button._.incecx
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
; right border
mov dx, [esp + 4]
198,7 → 202,8
add ebx, 0x00010000
mov ecx, esi
call button._.dececx
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
pop ecx ebx
 
/kernel/branches/net/gui/event.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23,6 → 23,7
EV_SPACE = 512
FreeEvents = event_start-EVENT.fd ; "âèðòóàëüíûé" event, èñïîëüçóþòñÿ òîëüêî ïîëÿ:
; FreeEvents.fd=event_start è FreeEvents.bk=event_end
;-----------------------------------------------------------------------------
align 4
init_events: ;; used from kernel.asm
stdcall kernel_alloc, EV_SPACE*sizeof.EVENT
32,6 → 33,8
mov ecx, EV_SPACE ; current - in allocated space
mov ebx, FreeEvents ; previos - íà÷àëî ñïèñêà
push ebx ; îíî æå è êîíåö ïîòîì áóäåò
;--------------------------------------
align 4
@@:
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx
41,14 → 44,16
pop eax ; âîò îíî êîíöîì è ñòàëî
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk], ebx
;--------------------------------------
align 4
.fail:
ret
 
;-----------------------------------------------------------------------------
EVENT_WATCHED equ 0x10000000 ;áèò 28
EVENT_SIGNALED equ 0x20000000 ;áèò 29
MANUAL_RESET equ 0x40000000 ;áèò 30
MANUAL_DESTROY equ 0x80000000 ;áèò 31
 
;-----------------------------------------------------------------------------
align 4
create_event: ;; EXPORT use
;info:
67,7 → 72,8
mov edx, [edx+TASKDATA.pid]
pushfd
cli
 
;--------------------------------------
align 4
set_event: ;; INTERNAL use !!! don't use for Call
;info:
; Áåðåì íîâûé event èç FreeEvents, çàïîëíÿåì åãî ïîëÿ, êàê óêàçàíî â ecx,edx,esi
89,6 → 95,8
call init_events
popad
jz RemoveEventTo.break ; POPF+RET
;--------------------------------------
align 4
@@:
mov eax, [eax+EVENT.fd]
mov [eax+EVENT.magic], 'EVNT'
103,7 → 111,8
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
 
;--------------------------------------
align 4
RemoveEventTo: ;; INTERNAL use !!! don't use for Call
;param:
; eax - óêàçàòåëü íà event, ÊÎÒÎÐÛÉ âñòàâëÿåì
118,10 → 127,12
xchg ecx, [eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight
mov [ebx+EVENT.fd], ecx ; OldLeft.fd=OldRight
mov [ecx+EVENT.bk], ebx ; OldRight.bk=OldLeft
;--------------------------------------
align 4
.break:
popfd
ret
 
;-----------------------------------------------------------------------------
align 4
NotDummyTest: ;; INTERNAL use (not returned for fail !!!)
pop edi
129,6 → 140,8
mov ebx, eax
mov eax, [ebx+EVENT.pid]
push edi
;--------------------------------------
align 4
.small: ; êðèâî êàê-òî...
pop edi
pushfd
137,7 → 150,7
shl eax, 8
jz RemoveEventTo.break ; POPF+RET
jmp edi ; øòàòíûé âîçâðàò
 
;-----------------------------------------------------------------------------
align 4
raise_event: ;; EXPORT use
;info:
158,6 → 171,8
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
;--------------------------------------
align 4
@@:
test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24
jnz RemoveEventTo.break ; POPF+RET
165,12 → 180,14
jnc @f
test byte[ebx+EVENT.state+3], EVENT_WATCHED shr 24
jz RemoveEventTo.break ; POPF+RET
;--------------------------------------
align 4
@@:
or byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24
add eax, SLOT_BASE+APP_EV_OFFSET
xchg eax, ebx
jmp RemoveEventTo
 
;-----------------------------------------------------------------------------
align 4
clear_event: ;; EXPORT use
;info:
184,7 → 201,7
and byte[ebx+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24)
xchg eax, ebx
jmp RemoveEventTo
 
;-----------------------------------------------------------------------------
align 4
send_event: ;; EXPORT use
;info:
207,7 → 224,7
lea ebx, [eax+SLOT_BASE+APP_EV_OFFSET]
mov ecx, EVENT_SIGNALED
jmp set_event
 
;-----------------------------------------------------------------------------
align 4
DummyTest: ;; INTERNAL use (not returned for fail !!!)
;param:
217,16 → 234,21
jne @f
cmp [eax+EVENT.id], ebx
je .ret
;--------------------------------------
align 4
@@:
pop eax
xor eax, eax
;--------------------------------------
align 4
.ret:
ret
 
 
;-----------------------------------------------------------------------------
align 4
Wait_events:
or ebx, -1; infinite timeout
;--------------------------------------
align 4
Wait_events_ex:
;info:
; Îæèäàíèå "àáñòðàêòíîãî" ñîáûòèÿ ÷åðåç ïåðåâîä ñëîòà â 5-þ ïîçèöèþ.
260,9 → 282,11
mov [eax+TASKDATA.state], 5
call change_task
mov eax, [esi+APPDATA.wait_param]
;--------------------------------------
align 4
@@:
ret
 
;-----------------------------------------------------------------------------
align 4
wait_event: ;; EXPORT use
;info:
281,7 → 305,7
mov edx, get_event_alone ; wait_test
call Wait_events ; timeout ignored
jmp wait_finish
 
;-----------------------------------------------------------------------------
align 4
get_event_ex: ;; f68:14
;info:
303,6 → 327,8
cld
rep movsd
mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field
;--------------------------------------
align 4
wait_finish:
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24
jnz get_event_queue.ret ; RET
314,7 → 340,7
pushfd
cli
jmp RemoveEventTo
 
;-----------------------------------------------------------------------------
align 4
destroy_event: ;; EXPORT use
;info:
326,6 → 352,8
; eax - àäðåñ îáúåêòà EVENT (=0 => fail)
;scratched: ebx,ecx
call DummyTest ; not returned for fail !!!
;--------------------------------------
align 4
.internal:
xor ecx, ecx ; clear common header
pushfd
336,7 → 364,7
mov [eax+EVENT.id], ecx
mov ebx, FreeEvents
jmp RemoveEventTo
 
;-----------------------------------------------------------------------------
align 4
get_event_queue:
;info:
353,9 → 381,11
mov eax, [ebx+APPOBJ.bk] ; âûáèðàåì ñ êîíöà, ïî ïðèíöèïó FIFO
cmp eax, ebx ; empty ???
je get_event_alone.ret0
;--------------------------------------
align 4
.ret:
ret
 
;-----------------------------------------------------------------------------
align 4
get_event_alone:
;info:
372,21 → 402,27
test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24
jnz .ret
or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24
;--------------------------------------
align 4
.ret0:
xor eax, eax; NO event!!!
;--------------------------------------
align 4
.ret:
ret
 
;-----------------------------------------------------------------------------
align 4
sys_sendwindowmsg: ;; f72
dec ebx
jnz .ret ;subfunction==1 ?
;pushfd ;à íàôèãà?
pushfd
cli
sub ecx, 2
je .sendkey
dec ecx
jnz .retf
;--------------------------------------
align 4
.sendbtn:
cmp byte[BTN_COUNT], 1
jae .result ;overflow
394,6 → 430,8
shl edx, 8
mov [BTN_BUFF], edx
jmp .result
;--------------------------------------
align 4
.sendkey:
movzx eax, byte[KEY_COUNT]
cmp al, 120
400,12 → 438,19
jae .result ;overflow
inc byte[KEY_COUNT]
mov [KEY_COUNT+1+eax], dl
;--------------------------------------
align 4
.result:
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72
.retf: ;popfd
;--------------------------------------
align 4
.retf:
popfd
;--------------------------------------
align 4
.ret:
ret
 
;-----------------------------------------------------------------------------
align 4
sys_getevent: ;; f11
mov ebx, [current_slot];ïîêà ýòî âîïðîñ, ÷åãî êóäû ñóâàòü..........
415,16 → 460,18
popfd
mov [esp+32], eax
ret
 
;-----------------------------------------------------------------------------
align 4
sys_waitforevent: ;; f10
or ebx, -1; infinite timeout
;--------------------------------------
align 4
sys_wait_event_timeout: ;; f23
mov edx, get_event_for_app; wait_test
call Wait_events_ex ; ebx - timeout
mov [esp+32], eax
ret
 
;-----------------------------------------------------------------------------
align 4
get_event_for_app: ;; used from f10,f11,f23
;info:
441,6 → 488,9
shl edi, 5
add edi, CURRENT_TASK ; edi is assumed as [TASK_BASE]
mov ecx, [edi+TASKDATA.event_mask]
and ecx, 0x7FFFFFFF
;--------------------------------------
align 4
.loop: ; ïîêà íå èñ÷åðïàåì âñå áèòû ìàñêè
bsr eax, ecx ; íàõîäèì íåíóëåâîé áèò ìàñêè (31 -> 0)
jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ???
447,24 → 497,45
btr ecx, eax ; ñáðàñûâàåì ïðîâåðÿåìûé áèò ìàñêè
; ïåðåõîäèì íà îáðàáîò÷èê ýòîãî (eax) áèòà
cmp eax, 9
jae .loop ; eax=[9..31], ignored
jae .loop ; eax=[9..31], ignored (event 10...32)
 
cmp eax, 3
je .loop ; eax=3, ignored
ja .FlagAutoReset ; eax=[4..8], retvals=eax+1
je .loop ; eax=3, ignored (event 4)
 
cmp eax, 4
je .FlagAutoReset ; eax=4, retvals=eax+1 (event 5)
 
cmp eax, 5
je .mouse_check ; eax=5, retvals=eax+1 (event 6)
 
ja .FlagAutoReset ; eax=[6..8], retvals=eax+1 (event 7...9)
 
cmp eax, 1
jae .BtKy ; eax=[1,2], retvals=eax+1
jae .BtKy ; eax=[1,2], retvals=eax+1 (event 2,3)
;--------------------------------------
align 4
.WndRedraw: ; eax=0, retval WndRedraw=1
cmp [edi-twdw+WDATA.fl_redraw], al;al==0
jne .result
jmp .loop
;--------------------------------------
align 4
.no_events:
xor eax, eax
ret
 
.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9
cmp eax, 5; Mouse 5+1=6
jne @f
;--------------------------------------
align 4
.mouse_check: ; Mouse 5+1=6
push eax
mov eax, [TASK_BASE]
mov eax, [eax + TASKDATA.event_mask]
test eax, 0x80000000 ; bit 31: active/inactive filter f.40
jz @f
pop eax
jmp .FlagAutoReset
;--------------------------------------
align 4
@@:
; If the window is captured and moved by the user, then no mouse events!!!
mov al, [mouse.active_sys_window.action]
and al, WINDOW_MOVE_AND_RESIZE_FLAGS
471,16 → 542,24
test al, al
pop eax
jnz .loop
@@:
;--------------------------------------
align 4
.FlagAutoReset: ; retvals: BgrRedraw=5, IPC=7, Stack=8, Debug=9
btr [ebx+APPDATA.event_mask], eax
jnc .loop
;--------------------------------------
align 4
.result: ; retval = eax+1
inc eax
ret
;--------------------------------------
align 4
.BtKy:
movzx edx, bh
movzx edx, word[WIN_STACK+edx*2]
je .Keys ; eax=1, retval Keys=2
;--------------------------------------
align 4
.Buttons: ; eax=2, retval Buttons=3
cmp byte[BTN_COUNT], 0
je .loop ; empty ???
493,13 → 572,19
mov [window_minimize], 1
dec byte[BTN_COUNT]
jmp .loop
;--------------------------------------
align 4
.Keys: ; eax==1
cmp edx, [TASK_COUNT]
jne @f ; not Top ???
cmp [KEY_COUNT], al; al==1
jae .result ; not empty ???
;--------------------------------------
align 4
@@:
mov edx, hotkey_buffer
;--------------------------------------
align 4
@@:
cmp [edx], bh ; bh - slot for testing
je .result
508,3 → 593,4
jb @b
jmp .loop
;end.
;-----------------------------------------------------------------------------
/kernel/branches/net/gui/font.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7,7 → 7,7
 
$Revision$
 
; // Alver 22.06.2008 // {
;------------------------------------------------------------------------------
align 4
dtext_asciiz_esi: ; for skins title out
push eax
14,10 → 14,9
xor eax, eax
inc eax
jmp dtext.1
; } \\ Alver \\
 
;------------------------------------------------------------------------------
align 4
dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
dtext:
; ebx x & y
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB )
; X = ABnnb:
25,37 → 24,43
; A = 0 <=> output esi characters; otherwise output ASCIIZ string
; B = 1 <=> fill background with color eax
; edx start of text
; edi 1 force
 
; // Alver 22.06.2008 // {
; edi 1 force or user area for redirect
push eax
xor eax, eax
;--------------------------------------
align 4
.1:
; } \\ Alver \\
pushad
call [_display.disable_mouse]
 
movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x
xchg eax, ebx ; eax=x, ebx=y
cmp esi, 255
jb .loop
 
mov esi, 255
;--------------------------------------
align 4
.loop:
test ecx, ecx
js .test_asciiz
 
dec esi
js .end
 
jmp @f
;--------------------------------------
align 4
.test_asciiz:
cmp byte [edx], 0
jz .end
; // Alver 22.06.2008 // {
 
cmp byte [esp+28], 1
jne @f
 
dec esi
js .end
; } \\ Alver \\
;--------------------------------------
align 4
@@:
inc edx
pushad
62,27 → 67,63
movzx edx, byte [edx-1]
test ecx, 0x10000000
jnz .font2
 
mov esi, 9
lea ebp, [FONT_I+8*edx+edx]
;--------------------------------------
align 4
.symloop1:
mov dl, byte [ebp]
or dl, 1 shl 6
;--------------------------------------
align 4
.pixloop1:
shr dl, 1
jz .pixloop1end
 
jnc .nopix
call [putpixel]
 
test ecx, 0x08000000 ; redirect the output to the user area
jz @f
 
call draw_text_to_user_area
jmp .pixloop1cont
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
; call [putpixel]
call __sys_putpixel
jmp .pixloop1cont
;--------------------------------------
align 4
.nopix:
test ecx, 0x40000000
jz .pixloop1cont
 
push ecx
mov ecx, [esp+4+20h+20h]
call [putpixel]
 
test ecx, 0x08000000 ; redirect the output to the user area
jz @f
 
call draw_text_to_user_area
pop ecx
jmp .pixloop1cont
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
; call [putpixel]
call __sys_putpixel
pop ecx
;--------------------------------------
align 4
.pixloop1cont:
inc eax
jmp .pixloop1
;--------------------------------------
align 4
.pixloop1end:
sub eax, 6
inc ebx
89,33 → 130,69
inc ebp
dec esi
jnz .symloop1
 
popad
add eax, 6
jmp .loop
;--------------------------------------
align 4
.font2:
add edx, edx
lea ebp, [FONT_II+4*edx+edx+1]
push 9
movzx esi, byte [ebp-1]
;--------------------------------------
align 4
.symloop2:
mov dl, byte [ebp]
push esi
;--------------------------------------
align 4
.pixloop2:
shr dl, 1
jnc .nopix2
call [putpixel]
 
test ecx, 0x08000000 ; redirect the output to the user area
jz @f
 
call draw_text_to_user_area
jmp .pixloop2cont
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
; call [putpixel]
call __sys_putpixel
jmp .pixloop2cont
;--------------------------------------
align 4
.nopix2:
test ecx, 0x40000000
jz .pixloop2cont
 
push ecx
mov ecx, [esp+12+20h+20h]
call [putpixel]
 
test ecx, 0x08000000 ; redirect the output to the user area
jz @f
 
call draw_text_to_user_area
pop ecx
jmp .pixloop2cont
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
; call [putpixel]
call __sys_putpixel
pop ecx
;--------------------------------------
align 4
.pixloop2cont:
inc eax
dec esi
jnz .pixloop2
 
pop esi
sub eax, esi
inc ebx
122,11 → 199,33
inc ebp
dec dword [esp]
jnz .symloop2
 
pop eax
add dword [esp+28], esi
popad
jmp .loop
;--------------------------------------
align 4
.end:
popad
pop eax ; << // Alver 22.06.2008 // <<
pop eax
ret
;------------------------------------------------------------------------------
; eax = x coordinate
; ebx = y coordinate
; ecx = ?? RR GG BB
; edi = user area
align 4
draw_text_to_user_area:
pushad
imul ebx, [edi+0]
add eax, ebx
shl eax, 2
add eax, edi
add eax, 8
and ecx, 0xffffff
or ecx, 0xff000000 ; not transparent
mov [eax], ecx ; store pixel
popad
ret
;------------------------------------------------------------------------------
/kernel/branches/net/gui/mouse.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2010. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
527,9 → 527,12
;< esi = process slot
;< edi = pointer to WDATA struct
;------------------------------------------------------------------------------
mov esi, [Screen_Max_X]
inc esi
imul esi, [mouse.state.pos.y]
; mov esi, [Screen_Max_X]
; inc esi
; imul esi, [mouse.state.pos.y]
mov esi, [mouse.state.pos.y]
mov esi, [d_width_calc_area + esi*4]
 
add esi, [_WinMapAddress]
add esi, [mouse.state.pos.x]
movzx esi, byte[esi]
/kernel/branches/net/gui/mousepointer.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/kernel/branches/net/gui/skincode.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11,7 → 11,8
include "skindata.inc"
 
;skin_data = 0x00778000
 
;------------------------------------------------------------------------------
align 4
read_skin_file:
stdcall load_file, ebx
test eax, eax
21,6 → 22,8
cmp ebx, 32*1024
jb @f
mov ebx, 32*1024
;--------------------------------------
align 4
@@:
lea ecx, [ebx+3]
shr ecx, 2
32,16 → 35,20
call parse_skin_data
xor eax, eax
ret
;--------------------------------------
align 4
.notfound:
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
.noskin:
stdcall kernel_free, eax
push 2
pop eax
ret
 
;------------------------------------------------------------------------------
struct SKIN_HEADER
ident dd ?
version dd ?
81,13 → 88,15
type dw ?
data dd ?
ends
 
;------------------------------------------------------------------------------
align 4
load_default_skin:
mov [_skinh], 22
mov ebx, _skin_file_default
call read_skin_file
ret
 
;------------------------------------------------------------------------------
align 4
parse_skin_data:
mov ebp, skin_data
cmp [ebp+SKIN_HEADER.ident], 'SKIN'
127,6 → 136,8
 
mov ebx, [ebp+SKIN_HEADER.bitmaps]
add ebx, skin_data
;--------------------------------------
align 4
.lp1:
cmp dword[ebx], 0
je .end_bitmaps
139,8 → 150,12
or ecx, ecx
jnz @f
mov edx, skin_inactive.left.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_left:
dec eax
jnz .not_oper
152,8 → 167,12
or ecx, ecx
jnz @f
mov edx, skin_inactive.oper.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_oper:
dec eax
jnz .not_base
163,11 → 182,17
jnz @f
mov eax, [skin_inactive.left.width]
mov edx, skin_inactive.base.data
;--------------------------------------
align 4
@@:
jmp .next_bitmap
;--------------------------------------
align 4
.not_base:
add ebx, 8
jmp .lp1
;--------------------------------------
align 4
.next_bitmap:
mov ecx, [ebx+SKIN_BITMAPS.data]
add ecx, skin_data
178,10 → 203,13
mov [edx+0], ecx
add ebx, 8
jmp .lp1
;--------------------------------------
align 4
.end_bitmaps:
 
mov ebx, [ebp+SKIN_HEADER.buttons]
add ebx, skin_data
;--------------------------------------
align 4
.lp2:
cmp dword[ebx], 0
je .end_buttons
190,14 → 218,20
jnz .not_close
mov edx, skin_btn_close
jmp .next_button
;--------------------------------------
align 4
.not_close:
dec eax
jnz .not_minimize
mov edx, skin_btn_minimize
jmp .next_button
;--------------------------------------
align 4
.not_minimize:
add ebx, 12
jmp .lp2
;--------------------------------------
align 4
.next_button:
movsx eax, [ebx+SKIN_BUTTONS.left]
mov [edx+SKIN_BUTTON.left], eax
209,18 → 243,13
mov [edx+SKIN_BUTTON.height], eax
add ebx, 12
jmp .lp2
;--------------------------------------
align 4
.end_buttons:
 
.exit:
ret
 
sys_putimage_with_check:
or ebx, ebx
jz @f
call sys_putimage.forced
@@:
ret
 
;------------------------------------------------------------------------------
align 4
drawwindow_IV_caption:
 
mov ebp, skin_active
227,8 → 256,9
or al, al
jnz @f
mov ebp, skin_inactive
;--------------------------------------
align 4
@@:
 
mov esi, [esp+4]
mov eax, [esi+WDATA.box.width] ; window width
mov edx, [ebp+SKIN_DATA.left.left]
238,8 → 268,12
add ecx, [_skinh]
 
mov ebx, [ebp+SKIN_DATA.left.data]
call sys_putimage_with_check
 
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
mov esi, [esp+4]
mov eax, [esi+WDATA.box.width]
sub eax, [ebp+SKIN_DATA.left.width]
260,6 → 294,8
mov edx, [ebp+SKIN_DATA.base.left]
sub edx, [ebp+SKIN_DATA.base.width]
shl edx, 16
;--------------------------------------
align 4
.baseskinloop:
shr edx, 16
add edx, [ebp+SKIN_DATA.base.width]
266,11 → 302,19
shl edx, 16
 
push eax ebx ecx edx
call sys_putimage_with_check
 
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
pop edx ecx ebx eax
 
dec eax
jnz .baseskinloop
;--------------------------------------
align 4
.non_base:
 
mov esi, [esp+4]
283,16 → 327,18
mov ecx, [ebp+SKIN_DATA.oper.width]
shl ecx, 16
add ecx, [_skinh]
call sys_putimage_with_check
 
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
ret
 
;//mike.dld, 2006-08-02 ]
 
 
;------------------------------------------------------------------------------
align 4
drawwindow_IV:
;param1 - aw_yes
 
pusha
 
push edx
303,8 → 349,9
cmp byte [esp+32+4+4], 0
jne @f
mov ebp, skin_inactive
;--------------------------------------
align 4
@@:
 
mov eax, [edi+WDATA.box.left]
shl eax, 16
mov ax, word [edi+WDATA.box.left]
313,32 → 360,42
shl ebx, 16
mov bx, word [edi+WDATA.box.top]
add bx, word [edi+WDATA.box.height]
; mov esi,[edi+24]
; shr esi,1
; and esi,0x007f7f7f
mov esi, [ebp+SKIN_DATA.colors.outer]
or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
ror ebx, 16
add ebx, [_skinh]
sub bx, 1
rol ebx, 16
call draw_rectangle
mov ecx, 3
;--------------------------------------
align 4
_dw3l:
add eax, 1*65536-1
add ebx, 1*65536-1
add ebx, 0*65536-1
test ax, ax
js no_skin_add_button
test bx, bx
js no_skin_add_button
mov esi, [ebp+SKIN_DATA.colors.frame];[edi+24]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
call draw_rectangle
dec ecx
jnz _dw3l
mov esi, [ebp+SKIN_DATA.colors.inner]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
add eax, 1*65536-1
add ebx, 1*65536-1
add ebx, 0*65536-1
test ax, ax
js no_skin_add_button
test bx, bx
js no_skin_add_button
test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP
jnz @f
call draw_rectangle
 
;--------------------------------------
align 4
@@:
cmp dword[skin_data], 'SKIN'
je @f
xor eax, eax
348,15 → 405,17
inc ecx
mov edx, [_skinh]
mov edi, [common_colours+4]; standard grab color
call [drawbar]
; call [drawbar]
call vesa20_drawbar
jmp draw_clientbar
;--------------------------------------
align 4
@@:
 
mov al, [esp+32+4+4]
call drawwindow_IV_caption
 
;--------------------------------------
align 4
draw_clientbar:
 
mov esi, [esp]
 
mov edx, [esi+WDATA.box.top] ; WORK AREA
374,12 → 433,13
mov edi, [esi+WDATA.cl_workarea]
test edi, 0x40000000
jnz _noinside2
call [drawbar]
; call [drawbar]
call vesa20_drawbar
;--------------------------------------
align 4
_noinside2:
 
cmp dword[skin_data], 'SKIN'
jne no_skin_add_button
 
;* close button
mov edi, [BTN_ADDR]
movzx eax, word [edi]
404,6 → 464,8
mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width]
inc ebx
;--------------------------------------
align 4
_bCx_at_right:
add ebx, [skin_btn_close.left]
mov [eax], bx
418,7 → 480,6
mov ebx, [skin_btn_close.height]
dec ebx
mov [eax], bx
 
;* minimize button
mov edi, [BTN_ADDR]
movzx eax, word [edi]
443,6 → 504,8
mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width]
inc ebx
;--------------------------------------
align 4
_bMx_at_right:
add ebx, [skin_btn_minimize.left]
mov [eax], bx
457,10 → 520,10
mov ebx, [skin_btn_minimize.height]
dec ebx
mov [eax], bx
 
;--------------------------------------
align 4
no_skin_add_button:
pop edi
popa
 
ret 4
 
;------------------------------------------------------------------------------
/kernel/branches/net/gui/skindata.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/kernel/branches/net/gui/window.inc
1,6 → 1,6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
43,10 → 43,7
jae .exit
 
push eax
inc [mouse_pause]
call [_display.disable_mouse]
call window._.sys_set_window
call [_display.disable_mouse]
pop eax
 
or al, al
55,17 → 52,19
; type I - original style
call drawwindow_I
jmp window._.draw_window_caption.2
 
;--------------------------------------
align 4
@@:
dec al
jnz @f
 
; type II - only reserve area, no draw
call sys_window_mouse
dec [mouse_pause]
call [draw_pointer]
; call sys_window_mouse
; call [draw_pointer]
call __sys_draw_pointer
jmp .exit
 
;--------------------------------------
align 4
@@:
dec al
jnz @f
75,6 → 74,8
jmp window._.draw_window_caption.2
 
; type IV & V - skinned window (resizable & not)
;--------------------------------------
align 4
@@:
mov eax, [TASK_COUNT]
movzx eax, word[WIN_POS + eax * 2]
84,10 → 85,11
push eax
call drawwindow_IV
jmp window._.draw_window_caption.2
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_display_settings: ;///// system function 48 ///////////////////////////
136,10 → 138,11
cmp ebx, .sizeof.ftable / 4
ja @f
jmp [.ftable + ebx * 4]
;--------------------------------------
align 4
@@:
ret
 
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.00:
xor eax, eax
149,10 → 152,11
mov [windowtypechanged], eax
 
jmp syscall_display_settings._.redraw_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.01:
and ecx, 1
160,10 → 164,11
je .exit
mov [buttontype], ecx
mov [windowtypechanged], ebx
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.02:
dec ebx
174,7 → 179,7
rep movsb
mov [windowtypechanged], ebx
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.03:
mov edi, ecx
183,13 → 188,13
mov ecx, edx
rep movsb
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.04:
mov eax, [_skinh]
mov [esp + 32], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.05:
mov eax, [screen_workarea.left - 2]
199,7 → 204,7
mov ax, word[screen_workarea.bottom]
mov [esp + 20], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.06:
xor esi, esi
214,14 → 219,19
or eax, eax
jge @f
xor eax, eax
;--------------------------------------
align 4
@@:
mov [screen_workarea.left], eax
cmp ebx, edi
jle @f
mov ebx, edi
;--------------------------------------
align 4
@@:
mov [screen_workarea.right], ebx
 
;--------------------------------------
align 4
.check_horizontal:
mov edi, [Screen_Max_Y]
mov eax, edx
233,14 → 243,19
or eax, eax
jge @f
xor eax, eax
;--------------------------------------
align 4
@@:
mov [screen_workarea.top], eax
cmp ebx, edi
jle @f
mov ebx, edi
;--------------------------------------
align 4
@@:
mov [screen_workarea.bottom], ebx
 
;--------------------------------------
align 4
.check_if_redraw_needed:
or esi, esi
jz .exit
247,10 → 262,11
 
call repos_windows
jmp syscall_display_settings._.calculate_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.07:
mov eax, [_skinmargins + 0]
258,7 → 274,7
mov eax, [_skinmargins + 4]
mov [esp + 20], eax
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings.08:
mov ebx, ecx
269,10 → 285,12
 
call syscall_display_settings._.calculate_whole_screen
jmp syscall_display_settings._.redraw_whole_screen
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings._.calculate_whole_screen:
xor eax, eax
xor ebx, ebx
279,7 → 297,8
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
jmp calculatescreen
 
;------------------------------------------------------------------------------
align 4
syscall_display_settings._.redraw_whole_screen:
xor eax, eax
mov [draw_limits.left], eax
290,7 → 309,7
mov [draw_limits.bottom], eax
mov eax, window_data
jmp redrawscreen
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_set_window_shape: ;///// system function 50 ///////////////////////////
308,15 → 327,17
test ebx, ebx
jne .shape_scale
mov [edi + APPDATA.wnd_shape], ecx
 
;--------------------------------------
align 4
.shape_scale:
dec ebx
jnz .exit
mov [edi + APPDATA.wnd_shape_scale], ecx
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_move_window: ;///// system function 67 ////////////////////////////////
336,19 → 357,26
cmp ebx, -1
jne @f
mov ebx, [edi + WDATA.box.left]
;--------------------------------------
align 4
@@:
cmp ecx, -1
jne @f
mov ecx, [edi + WDATA.box.top]
;--------------------------------------
align 4
@@:
cmp edx, -1
jne @f
mov edx, [edi + WDATA.box.width]
;--------------------------------------
align 4
@@:
cmp esi, -1
jne @f
mov esi, [edi + WDATA.box.height]
 
;--------------------------------------
align 4
@@:
push esi edx ecx ebx
mov eax, esp
363,10 → 391,11
 
; NOTE: do we really need this? to be reworked
; call [draw_pointer]
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
syscall_window_settings: ;///// system function 71 /////////////////////////////
395,12 → 424,13
; jnz .exit_fail
 
; not implemented yet
 
;--------------------------------------
align 4
.exit_fail:
xor eax, eax
inc eax ; eax = 1 (fail)
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
set_window_defaults: ;/////////////////////////////////////////////////////////
411,6 → 441,8
push eax ecx
xor eax, eax
mov ecx, WIN_STACK
;--------------------------------------
align 4
@@:
inc eax
add ecx, 2
422,7 → 454,7
jne @b
pop ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
calculatescreen: ;/////////////////////////////////////////////////////////////
449,7 → 481,8
jbe .exit
 
push edx ecx ebx eax
 
;--------------------------------------
align 4
.next_window:
movzx edi, word[WIN_POS + esi * 2]
shl edi, 5
479,25 → 512,33
cmp eax, [esp + RECT.left]
jae @f
mov eax, [esp + RECT.left]
;--------------------------------------
align 4
@@:
cmp ebx, [esp + RECT.top]
jae @f
mov ebx, [esp + RECT.top]
;--------------------------------------
align 4
@@:
cmp ecx, [esp + RECT.right]
jbe @f
mov ecx, [esp + RECT.right]
;--------------------------------------
align 4
@@:
cmp edx, [esp + RECT.bottom]
jbe @f
mov edx, [esp + RECT.bottom]
 
;--------------------------------------
align 4
@@:
push esi
movzx esi, word[WIN_POS + esi * 2]
call window._.set_screen
pop esi
 
;--------------------------------------
align 4
.skip_window:
inc esi
dec ebp
504,13 → 545,15
jnz .next_window
 
pop eax ebx ecx edx
 
;--------------------------------------
align 4
.exit:
pop ebp
inc [_display.mask_seqno]
popfd
pop esi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
repos_windows: ;///////////////////////////////////////////////////////////////
522,7 → 565,8
call force_redraw_background
dec ecx
jle .exit
 
;--------------------------------------
align 4
.next_window:
mov [edi + WDATA.fl_redraw], 1
test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
537,10 → 581,13
sub eax, ebx
jle @f
mov [edi + WDATA.box.width], ebx
;--------------------------------------
align 4
@@:
sub ebx, [edi + WDATA.box.width]
mov [edi + WDATA.box.left], ebx
 
;--------------------------------------
align 4
.fix_vertical:
mov eax, [edi + WDATA.box.top]
add eax, [edi + WDATA.box.height]
551,11 → 598,23
sub eax, ebx
jle @f
mov [edi + WDATA.box.height], ebx
;--------------------------------------
align 4
@@:
sub ebx, [edi + WDATA.box.height]
mov [edi + WDATA.box.top], ebx
jmp .fix_client_box
 
;--------------------------------------
align 4
.fix_client_box:
call window._.set_window_clientbox
add edi, sizeof.WDATA
loop .next_window
;--------------------------------------
align 4
.exit:
ret
;--------------------------------------
align 4
.fix_maximized:
mov eax, [screen_workarea.left]
mov [edi + WDATA.box.left], eax
569,20 → 628,12
sub eax, [screen_workarea.bottom]
neg eax
mov [edi + WDATA.box.height], eax
 
.fix_client_box:
call window._.set_window_clientbox
 
add edi, sizeof.WDATA
loop .next_window
 
.exit:
ret
 
align 4
jmp .fix_client_box
;------------------------------------------------------------------------------
sys_window_mouse: ;////////////////////////////////////////////////////////////
;align 4
;------------------------------------------------------------------------------
;sys_window_mouse: ;////////////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
; NOTE: commented out since doesn't provide necessary functionality
600,8 → 651,8
;
; .exit:
; pop eax
ret
 
; ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
draw_rectangle: ;//////////////////////////////////////////////////////////////
609,28 → 660,38
;> eax = pack[16(left), 16(right)]
;> ebx = pack[16(top), 16(bottom)]
;> esi = color
; ?? RR GG BB ; 0x01000000 negation
; ; 0x02000000 used for draw_rectangle without top line
; ; for example drawwindow_III and drawwindow_IV
;------------------------------------------------------------------------------
push eax ebx ecx edi
 
xor edi, edi
 
;--------------------------------------
align 4
.flags_set:
push ebx
 
; set line color
mov ecx, esi
 
; draw top border
rol ebx, 16
push ebx
rol ebx, 16
pop bx
call [draw_line]
 
test ecx, 1 shl 25
jnz @f
sub ecx, 1 shl 25
; call [draw_line]
call __sys_draw_line
;--------------------------------------
align 4
@@:
; draw bottom border
mov ebx, [esp - 2]
pop bx
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
pop ebx
add ebx, 1 * 65536 - 1
640,22 → 701,25
push eax
rol eax, 16
pop ax
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
; draw right border
mov eax, [esp - 2]
pop ax
call [draw_line]
; call [draw_line]
call __sys_draw_line
 
pop edi ecx ebx eax
ret
 
;--------------------------------------
align 4
.forced:
push eax ebx ecx edi
xor edi, edi
inc edi
jmp .flags_set
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_I_caption: ;////////////////////////////////////////////////////////
674,11 → 738,14
cmp ebx, eax
jbe @f
mov ebx, eax
;--------------------------------------
align 4
@@:
push ebx
 
xor edi, edi
 
;--------------------------------------
align 4
.next_line:
mov ebx, edx
shl ebx, 16
694,9 → 761,12
jz @f
sub ecx, 0x00040404
mov [esi + WDATA.cl_titlebar], ecx
;--------------------------------------
align 4
@@:
and ecx, 0x00ffffff
call [draw_line]
; call [draw_line]
call __sys_draw_line
inc edx
cmp edx, [esp]
jb .next_line
704,7 → 774,7
add esp, 4
pop [esi + WDATA.cl_titlebar]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_I: ;////////////////////////////////////////////////////////////////
749,12 → 819,14
mov ebx, 21
mov ecx, [esi + WDATA.box.width]
mov edx, [esi + WDATA.box.height]
call [drawbar]
 
; call [drawbar]
call vesa20_drawbar
;--------------------------------------
align 4
.exit:
popad
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_III_caption: ;/////////////////////////////////////////////////////
774,11 → 846,14
cmp ebx, eax
jb @f
mov ebx, eax
;--------------------------------------
align 4
@@:
push ebx
 
xor edi, edi
 
;--------------------------------------
align 4
.next_line:
mov ebx, edx
shl ebx, 16
792,14 → 867,19
test ecx, 0x40000000
jz @f
add ecx, 0x00040404
;--------------------------------------
align 4
@@:
test ecx, 0x80000000
jz @f
sub ecx, 0x00040404
;--------------------------------------
align 4
@@:
mov [esi + WDATA.cl_titlebar], ecx
and ecx, 0x00ffffff
call [draw_line]
; call [draw_line]
call __sys_draw_line
inc edx
cmp edx, [esp]
jb .next_line
807,7 → 887,7
add esp, 4
pop [esi + WDATA.cl_titlebar]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
drawwindow_III: ;//////////////////////////////////////////////////////////////
833,7 → 913,8
push esi
mov ecx, 3
mov esi, [edx + WDATA.cl_frames]
 
;--------------------------------------
align 4
.next_frame:
add eax, 1 * 65536 - 1
add ebx, 1 * 65536 - 1
872,12 → 953,14
mov edx, [esi + WDATA.box.height]
sub ecx, 4
sub edx, 4
call [drawbar]
 
; call [drawbar]
call vesa20_drawbar
;--------------------------------------
align 4
.exit:
popad
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
waredraw: ;////////////////////////////////////////////////////////////////////
919,6 → 1002,7
mov edi, [TASK_COUNT]
movzx esi, word[WIN_POS + edi * 2]
call window._.set_screen
inc [_display.mask_seqno]
popad
 
; tell application to redraw itself
925,7 → 1009,8
mov [edi + WDATA.fl_redraw], 1
xor eax, eax
jmp .exit
 
;--------------------------------------
align 4
.do_not_draw:
; no it's not, just activate the window
call window._.window_activate
932,13 → 1017,13
xor eax, eax
mov byte[MOUSE_BACKGROUND], al
mov byte[DONT_DRAW_MOUSE], al
 
 
;--------------------------------------
align 4
.exit:
mov byte[MOUSE_DOWN], 0
inc eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
minimize_window: ;/////////////////////////////////////////////////////////////
978,12 → 1063,13
call redrawscreen
 
pop esi edx ecx ebx eax
 
;--------------------------------------
align 4
.exit:
popfd
pop edi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
restore_minimized_window: ;////////////////////////////////////////////////////
1011,6 → 1097,8
cmp eax, [TASK_COUNT]
jz @f
mov ebp, calculatescreen
;--------------------------------------
align 4
@@:
mov eax, [edi + WDATA.box.left]
mov ebx, [edi + WDATA.box.top]
1019,14 → 1107,15
add ecx, eax
add edx, ebx
call ebp
 
inc [_display.mask_seqno]
mov byte[MOUSE_BACKGROUND], 0
 
;--------------------------------------
align 4
.exit:
popfd
popad
ret
 
;------------------------------------------------------------------------------
align 4
; TODO: remove this proc
;------------------------------------------------------------------------------
1046,13 → 1135,15
jnz @f
call minimize_window
jmp .exit
 
;--------------------------------------
align 4
@@:
call restore_minimized_window
 
;--------------------------------------
align 4
.exit:
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_maximize_handler: ;/////////////////////////////////////////////////
1089,7 → 1180,8
sub [esp + BOX.height], ecx
mov eax, esp
jmp .set_box
 
;--------------------------------------
align 4
.restore_size:
mov eax, esi
shl eax, 8
1099,7 → 1191,8
[eax + BOX.top] \
[eax + BOX.left]
mov eax, esp
 
;--------------------------------------
align 4
.set_box:
test bl, WSTATE_ROLLEDUP
jz @f
1108,14 → 1201,17
call window._.get_rolledup_height
mov [ecx + BOX.height], eax
xchg eax, ecx
 
;--------------------------------------
align 4
@@:
call window._.set_window_box
add esp, sizeof.BOX
 
;--------------------------------------
align 4
.exit:
inc [_display.mask_seqno]
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_rollup_handler: ;///////////////////////////////////////////////////
1143,7 → 1239,8
[edi + WDATA.box.left]
mov eax, esp
jmp .set_box
 
;--------------------------------------
align 4
.restore_size:
test bl, WSTATE_MAXIMIZED
jnz @f
1150,7 → 1247,8
add esp, -sizeof.BOX
lea eax, [edx + APPDATA.saved_box]
jmp .set_box
 
;--------------------------------------
align 4
@@:
mov eax, [screen_workarea.top]
push [screen_workarea.bottom] \
1159,13 → 1257,13
[edi + WDATA.box.left]
sub [esp + BOX.height], eax
mov eax, esp
 
;--------------------------------------
align 4
.set_box:
call window._.set_window_box
add esp, sizeof.BOX
 
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_start_moving_handler: ;/////////////////////////////////////////////
1177,9 → 1275,8
;------------------------------------------------------------------------------
mov edi, eax
call window._.draw_negative_box
 
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_end_moving_handler: ;///////////////////////////////////////////////
1201,7 → 1298,7
mov bl, [edi + WDATA.fl_wstate]
call window._.set_window_box
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
sys_window_moving_handler: ;///////////////////////////////////////////////////
1217,7 → 1314,6
mov edi, ebx
call window._.draw_negative_box
ret
 
;==============================================================================
;///// private functions //////////////////////////////////////////////////////
;==============================================================================
1240,7 → 1336,7
; to be reworked
; new_window_starting dd ?
;endg
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.invalidate_screen: ;//////////////////////////////////////////////////
1255,37 → 1351,16
 
; TODO: do we really need `draw_limits`?
; Yes, they are used by background drawing code.
mov ecx, [eax + BOX.left]
mov edx, [ebx + BOX.left]
cmp ecx, edx
jle @f
mov ecx, edx
@@:
 
; we need only to restore the background windows at the old place!
mov ecx, [ebx + BOX.left]
mov [draw_limits.left], ecx
mov ecx, [eax + BOX.left]
add ecx, [eax + BOX.width]
add edx, [ebx + BOX.width]
cmp ecx, edx
jae @f
mov ecx, edx
@@:
add ecx, [ebx + BOX.width]
mov [draw_limits.right], ecx
mov ecx, [eax + BOX.top]
mov edx, [ebx + BOX.top]
cmp ecx, edx
jle @f
mov ecx, edx
@@:
mov ecx, [ebx + BOX.top]
mov [draw_limits.top], ecx
mov ecx, [eax + BOX.top]
add ecx, [eax + BOX.height]
add edx, [ebx + BOX.height]
cmp ecx, edx
jae @f
mov ecx, edx
@@:
add ecx, [ebx + BOX.height]
mov [draw_limits.bottom], ecx
 
; recalculate screen buffer at old position
push ebx
mov edx, [eax + BOX.height]
1296,7 → 1371,6
add edx, ebx
call calculatescreen
pop eax
 
; recalculate screen buffer at new position
mov edx, [eax + BOX.height]
mov ecx, [eax + BOX.width]
1314,7 → 1388,7
 
pop ebx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_window_box: ;/////////////////////////////////////////////////////
1339,10 → 1413,10
repz cmpsd
pop edi
jz .exit
;--------------------------------------
align 4
@@:
 
add esp, -sizeof.BOX
 
mov ebx, esp
if WDATA.box
lea esi, [edi + WDATA.box]
1391,11 → 1465,12
jnz .exit
 
mov [eax + APPDATA.saved_box.height], edx
 
;--------------------------------------
align 4
.exit:
pop esi ebx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_window_clientbox: ;///////////////////////////////////////////////
1436,7 → 1511,8
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
add esp, 4
jmp .exit
 
;--------------------------------------
align 4
.whole_window:
xor eax, eax
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax
1445,11 → 1521,12
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax
mov eax, [ecx + WDATA.box.height]
mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax
 
;--------------------------------------
align 4
.exit:
pop edi ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.sys_set_window: ;/////////////////////////////////////////////////////
1473,7 → 1550,10
test [edi + WDATA.fl_wdrawn], 1
jnz .set_client_box
or [edi + WDATA.fl_wdrawn], 1
 
; After first draw_window we need redraw mouse necessarily!
; Otherwise the user can see cursor specified by f.37.5 from another window.
; He will be really unhappy! He is terrible in rage - usually he throws stones!
mov [redrawmouse_unconditional], 1
; NOTE: commented out since doesn't provide necessary functionality
; anyway, to be reworked
; mov eax, [timer_ticks] ; [0xfdf0]
1508,7 → 1588,8
je @f
 
xor eax, eax
 
;--------------------------------------
align 4
@@:
mov [edi + APPDATA.wnd_caption], eax
 
1536,7 → 1617,8
 
mov byte[KEY_COUNT], 0 ; empty keyboard buffer
mov byte[BTN_COUNT], 0 ; empty button buffer
 
;--------------------------------------
align 4
.set_client_box:
; update window client box coordinates
call window._.set_window_clientbox
1545,7 → 1627,7
mov [edi + WDATA.fl_redraw], 0
mov edx, edi
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.check_window_position: ;//////////////////////////////////////////////
1564,7 → 1646,8
mov esi, [Screen_Max_X]
cmp ecx, esi
ja .fix_width_high
 
;--------------------------------------
align 4
.check_left:
or eax, eax
jl .fix_left_low
1571,12 → 1654,14
add eax, ecx
cmp eax, esi
jg .fix_left_high
 
;--------------------------------------
align 4
.check_height:
mov esi, [Screen_Max_Y]
cmp edx, esi
ja .fix_height_high
 
;--------------------------------------
align 4
.check_top:
or ebx, ebx
jl .fix_top_low
1583,43 → 1668,50
add ebx, edx
cmp ebx, esi
jg .fix_top_high
 
;--------------------------------------
align 4
.exit:
pop esi edx ecx ebx eax
ret
 
;--------------------------------------
align 4
.fix_width_high:
mov ecx, esi
mov [edi + WDATA.box.width], esi
jmp .check_left
 
;--------------------------------------
align 4
.fix_left_low:
xor eax, eax
mov [edi + WDATA.box.left], eax
jmp .check_height
 
;--------------------------------------
align 4
.fix_left_high:
mov eax, esi
sub eax, ecx
mov [edi + WDATA.box.left], eax
jmp .check_height
 
;--------------------------------------
align 4
.fix_height_high:
mov edx, esi
mov [edi + WDATA.box.height], esi
jmp .check_top
 
;--------------------------------------
align 4
.fix_top_low:
xor ebx, ebx
mov [edi + WDATA.box.top], ebx
jmp .exit
 
;--------------------------------------
align 4
.fix_top_high:
mov ebx, esi
sub ebx, edx
mov [edi + WDATA.box.top], ebx
jmp .exit
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_titlebar_height: ;////////////////////////////////////////////////
1634,10 → 1726,12
jne @f
mov eax, [_skinh]
ret
;--------------------------------------
align 4
@@:
mov eax, 21
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_rolledup_height: ;////////////////////////////////////////////////
1653,15 → 1747,19
mov eax, [_skinh]
add eax, 3
ret
;--------------------------------------
align 4
@@:
or al, al
jnz @f
mov eax, 21
ret
;--------------------------------------
align 4
@@:
mov eax, 21 + 2
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.set_screen: ;/////////////////////////////////////////////////////////
1693,7 → 1791,8
jnz .check_for_shaped_window
cmp [window_data + edi + WDATA.box.height], 0
jz .exit
 
;--------------------------------------
align 4
.check_for_shaped_window:
mov edi, esi
shl edi, 8
1709,10 → 1808,14
 
; get WinMap start
push esi
mov edi, [Screen_Max_X]
inc edi
mov esi, edi
imul edi, ebx
; mov edi, [Screen_Max_X]
; inc edi
; mov esi, edi
mov esi, [Screen_Max_X]
inc esi
; imul edi, ebx
mov edi, [d_width_calc_area + ebx*4]
 
add edi, eax
add edi, [_WinMapAddress]
pop eax
1720,7 → 1823,8
push ax
shl eax, 16
pop ax
 
;--------------------------------------
align 4
.next_line:
push ecx
shr ecx, 2
1735,7 → 1839,8
jnz .next_line
 
jmp .exit
 
;--------------------------------------
align 4
.shaped_window:
; for (y=0; y <= x_size; y++)
; for (x=0; x <= x_size; x++)
1751,9 → 1856,11
 
; get WinMap start -> ebp
push eax
mov eax, [Screen_Max_X] ; screen_sx
inc eax
imul eax, ebx
; mov eax, [Screen_Max_X] ; screen_sx
; inc eax
; imul eax, ebx
mov eax, [d_width_calc_area + ebx*4]
 
add eax, [esp]
add eax, [_WinMapAddress]
mov ebp, eax
1783,10 → 1890,12
add [ff_ysz], ebx
 
mov ebx, [ff_y]
 
;--------------------------------------
align 4
.ff_new_y:
mov edx, [ff_x]
 
;--------------------------------------
align 4
.ff_new_x:
; -- body --
mov ecx, [ff_scale]
1806,6 → 1915,8
mov eax, esi
mov [ebp], al
; -- end body --
;--------------------------------------
align 4
@@:
inc ebp
inc edx
1821,11 → 1932,14
jb .ff_new_y
 
add esp, 24
 
;--------------------------------------
align 4
.exit:
popad
inc [_display.mask_seqno]
ret
 
;--------------------------------------
align 4
.read_byte:
; eax - address
; esi - slot
1836,7 → 1950,7
call read_process_memory
pop esi edx ecx eax
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.window_activate: ;////////////////////////////////////////////////////
1861,10 → 1975,12
je .set_window_redraw_flag
cmp al, 0x04
jne .move_others_down
 
;--------------------------------------
align 4
.set_window_redraw_flag:
mov [window_data + ebx + WDATA.fl_redraw], 1
 
;--------------------------------------
align 4
.move_others_down:
; ax <- process no
movzx ebx, word[esi]
1873,7 → 1989,8
 
; drop others
xor eax, eax
 
;--------------------------------------
align 4
.next_stack_window:
cmp eax, [TASK_COUNT]
jae .move_self_up
1889,7 → 2006,8
jbe .next_stack_window
dec word[WIN_STACK + eax * 2]
jmp .next_stack_window
 
;--------------------------------------
align 4
.move_self_up:
movzx ebx, word[esi]
; number of processes
1899,7 → 2017,8
 
; update on screen - window stack
xor eax, eax
 
;--------------------------------------
align 4
.next_window_pos:
cmp eax, [TASK_COUNT]
jae .reset_vars
1907,7 → 2026,8
movzx ebx, word[WIN_STACK + eax * 2]
mov [WIN_POS + ebx * 2], ax
jmp .next_window_pos
 
;--------------------------------------
align 4
.reset_vars:
mov byte[KEY_COUNT], 0
mov byte[BTN_COUNT], 0
1916,7 → 2036,6
 
pop ebx eax
ret
 
;------------------------------------------------------------------------------
window._.window_deactivate: ;////////////////////////////////////////////////////
;------------------------------------------------------------------------------
1925,7 → 2044,8
;> esi = pointer to WIN_POS+ window data
;------------------------------------------------------------------------------
push eax ebx
;------------------------------------------------------------------------------
;--------------------------------------
align 4
.move_others_up:
; ax <- process no
movzx ebx, word[esi]
1933,6 → 2053,8
movzx ebx, word[WIN_STACK + ebx * 2]
; up others
xor eax, eax
;--------------------------------------
align 4
.next_stack_window:
cmp eax, [TASK_COUNT]
jae .move_self_down
1941,7 → 2063,8
jae .next_stack_window
inc word[WIN_STACK + eax * 2]
jmp .next_stack_window
;----------------------------------------------
;--------------------------------------
align 4
.move_self_down:
movzx ebx, word[esi]
; this is the last (and the low)
1948,6 → 2071,8
mov [WIN_STACK + ebx * 2], word 1
; update on screen - window stack
xor eax, eax
;--------------------------------------
align 4
.next_window_pos:
cmp eax, [TASK_COUNT]
jae .reset_vars
1955,7 → 2080,8
movzx ebx, word[WIN_STACK + eax * 2]
mov [WIN_POS + ebx * 2], ax
jmp .next_window_pos
;-----------------------------------------------
;--------------------------------------
align 4
.reset_vars:
mov byte[KEY_COUNT], 0
mov byte[BTN_COUNT], 0
1987,7 → 2113,8
 
movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400
 
;--------------------------------------
align 4
.next_window:
add esi, 2
 
2025,17 → 2152,19
jge .next_window
 
pop esi edx ebx eax
 
;--------------------------------------
align 4
.exit.redraw:
xor ecx, ecx
inc ecx
ret
 
;--------------------------------------
align 4
.exit.no_redraw:
pop esi edx ebx eax
xor ecx, ecx
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.draw_window_caption: ;////////////////////////////////////////////////
2042,9 → 2171,6
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
inc [mouse_pause]
call [_display.disable_mouse]
 
xor eax, eax
mov edx, [TASK_COUNT]
movzx edx, word[WIN_POS + edx * 2]
2051,6 → 2177,8
cmp edx, [CURRENT_TASK]
jne @f
inc eax
;--------------------------------------
align 4
@@:
mov edx, [CURRENT_TASK]
shl edx, 5
2063,13 → 2191,15
je .draw_caption_style_3
 
jmp .not_style_3
 
;--------------------------------------
align 4
.draw_caption_style_3:
push edx
call drawwindow_IV_caption
add esp, 4
jmp .2
 
;--------------------------------------
align 4
.not_style_3:
cmp bl, 2
jne .not_style_2
2076,13 → 2206,15
 
call drawwindow_III_caption
jmp .2
 
;--------------------------------------
align 4
.not_style_2:
cmp bl, 0
jne .2
 
call drawwindow_I_caption
 
;--------------------------------------
align 4
.2:
mov edi, [CURRENT_TASK]
shl edi, 5
2100,7 → 2232,8
je .skinned
 
jmp .not_skinned
 
;--------------------------------------
align 4
.skinned:
mov ebp, [edi + window_data + WDATA.box.left - 2]
mov bp, word[edi + window_data + WDATA.box.top]
2127,7 → 2260,8
add bx, -3
add ebx, ebp
jmp .dodraw
 
;--------------------------------------
align 4
.not_skinned:
cmp al, 1
je .exit
2148,18 → 2282,20
mov esi, eax
mov ebx, 0x00080007
add ebx, ebp
 
;--------------------------------------
align 4
.dodraw:
mov ecx, [common_colours + 16]
or ecx, 0x80000000
xor edi, edi
call dtext_asciiz_esi
 
;--------------------------------------
align 4
.exit:
dec [mouse_pause]
call [draw_pointer]
; call [draw_pointer]
call __sys_draw_pointer
ret
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.draw_negative_box: ;//////////////////////////////////////////////////
2170,6 → 2306,8
;------------------------------------------------------------------------------
push eax ebx esi
mov esi, 0x01000000
;--------------------------------------
align 4
.1:
mov eax, [edi + BOX.left - 2]
mov ax, word[edi + BOX.left]
2181,6 → 2319,8
pop esi ebx eax
ret
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.end_moving__box: ;//////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? Draw positive box
2190,9 → 2330,9
push eax ebx esi
xor esi, esi
jmp window._.draw_negative_box.1
 
 
;------------------------------------------------------------------------------
align 4
;------------------------------------------------------------------------------
window._.get_rect: ;/////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description> void __fastcall get_window_rect(struct RECT* rc);
2212,6 → 2352,5
 
add edx, [eax-twdw + WDATA.box.height]
mov [ecx+RECT.bottom], edx
 
ret
 
;------------------------------------------------------------------------------