/kernel/branches/kolibri_pe/gui/font.inc |
---|
0,0 → 1,132 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
; // Alver 22.06.2008 // { |
align 4 |
dtext_asciiz_esi: ; for skins title out |
push eax |
xor eax, eax |
inc eax |
jmp dtext.1 |
; } \\ Alver \\ |
align 4 |
dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) |
; ebx x & y |
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB ) |
; X = ABnnb: |
; nn = font |
; 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 // { |
push eax |
xor eax, eax |
.1: |
; } \\ Alver \\ |
pushad |
call [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 |
.loop: |
test ecx, ecx |
js .test_asciiz |
dec esi |
js .end |
jmp @f |
.test_asciiz: |
cmp byte [edx], 0 |
jz .end |
; // Alver 22.06.2008 // { |
cmp byte [esp+28], 1 |
jne @f |
dec esi |
js .end |
; } \\ Alver \\ |
@@: |
inc edx |
pushad |
movzx edx, byte [edx-1] |
test ecx, 0x10000000 |
jnz .font2 |
mov esi, 9 |
lea ebp, [FONT_I+8*edx+edx] |
.symloop1: |
mov dl, byte [ebp] |
or dl, 1 shl 6 |
.pixloop1: |
shr dl, 1 |
jz .pixloop1end |
jnc .nopix |
call [putpixel] |
jmp .pixloop1cont |
.nopix: |
test ecx, 0x40000000 |
jz .pixloop1cont |
push ecx |
mov ecx, [esp+4+20h+20h] |
call [putpixel] |
pop ecx |
.pixloop1cont: |
inc eax |
jmp .pixloop1 |
.pixloop1end: |
sub eax, 6 |
inc ebx |
inc ebp |
dec esi |
jnz .symloop1 |
popad |
add eax, 6 |
jmp .loop |
.font2: |
add edx, edx |
lea ebp, [FONT_II+4*edx+edx+1] |
push 9 |
movzx esi, byte [ebp-1] |
.symloop2: |
mov dl, byte [ebp] |
push esi |
.pixloop2: |
shr dl, 1 |
jnc .nopix2 |
call [putpixel] |
jmp .pixloop2cont |
.nopix2: |
test ecx, 0x40000000 |
jz .pixloop2cont |
push ecx |
mov ecx, [esp+12+20h+20h] |
call [putpixel] |
pop ecx |
.pixloop2cont: |
inc eax |
dec esi |
jnz .pixloop2 |
pop esi |
sub eax, esi |
inc ebx |
inc ebp |
dec dword [esp] |
jnz .symloop2 |
pop eax |
add dword [esp+28], esi |
popad |
jmp .loop |
.end: |
popad |
pop eax ; << // Alver 22.06.2008 // << |
ret |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/button.inc |
---|
0,0 → 1,647 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
max_buttons=4095 |
dececx: |
push edx |
push ecx |
mov edx,2 |
.loop: |
cmp byte [esp+edx],0x20 |
jae @f |
mov [esp+edx],byte 0x20 |
@@: |
sub [esp+edx],byte 0x20 |
dec edx |
jns .loop |
pop ecx |
pop edx |
ret |
incecx: |
push edx |
push ecx |
mov edx,2 |
.loop: |
cmp byte [esp+edx],0xdf |
jbe @f |
mov [esp+edx],byte 0xdf |
@@: |
add [esp+edx],byte 0x20 |
dec edx |
jns .loop |
pop ecx |
pop edx |
ret |
incecx2: |
push edx |
push ecx |
mov edx,2 |
.loop: |
cmp byte [esp+edx],0xeb |
jbe @f |
mov [esp+edx],byte 0xeb |
@@: |
add [esp+edx],byte 0x14 |
dec edx |
jns .loop |
pop ecx |
pop edx |
ret |
drawbuttonframes: |
push esi |
push edi |
push eax |
push ebx |
push ecx |
push edx |
shr ebx,16 |
shr ecx,16 |
mov eax,[TASK_BASE] |
add ebx,[eax-twdw + WDATA.box.left] |
add ecx,[eax-twdw + WDATA.box.top] |
mov eax, ebx |
shl eax, 16 |
mov ax, bx |
add ax, word [esp+8] |
mov ebx, ecx |
shl ebx, 16 |
mov bx, cx |
push ebx |
xor edi, edi |
mov ecx, esi |
call incecx |
call [draw_line] |
movzx edx,word [esp+4+4] |
add ebx,edx |
shl edx,16 |
add ebx,edx |
mov ecx,esi |
call dececx |
call [draw_line] |
pop ebx |
push edx |
mov edx,eax |
shr edx,16 |
mov ax,dx |
mov edx,ebx |
shr edx,16 |
mov bx,dx |
mov dx,[esp+4+4] |
add bx,dx |
pop edx |
mov ecx,esi |
call incecx |
call [draw_line] |
mov dx,[esp+8] |
add ax,dx |
shl edx,16 |
add eax,edx |
add ebx,1*65536 |
mov ecx,esi |
call dececx |
call [draw_line] |
pop edx |
pop ecx |
pop ebx |
pop eax |
pop edi |
pop esi |
ret |
button_dececx: |
cmp [buttontype],dword 1 |
jne .finish |
; je bdece |
; ret |
; bdece: |
push eax |
mov eax,0x01 |
cmp edi,20 |
jg @f |
mov eax,0x02 |
@@: |
test ecx,0xff |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff00 |
jz @f |
sub ecx,eax |
@@: |
shl eax,8 |
test ecx,0xff0000 |
jz @f |
sub ecx,eax |
@@: |
pop eax |
.finish: |
ret |
sys_button: |
mov eax, [current_slot] |
rol ebx, 16 |
add bx, word [eax+APPDATA.wnd_clientbox.left] |
rol ebx, 16 |
rol ecx, 16 |
add cx, word [eax+APPDATA.wnd_clientbox.top] |
rol ecx, 16 |
.forced: |
test edx, 0x80000000 |
jnz remove_button |
or bx, bx |
jle noaddbutt |
or cx, cx |
jle noaddbutt |
test edx, 0x40000000 |
jnz button_no_draw |
pushad ; button body |
movzx edi, cx |
shr ebx, 16 |
shr ecx, 16 |
mov eax, [TASK_BASE] |
add ebx, [eax-twdw + WDATA.box.left] |
add ecx, [eax-twdw + WDATA.box.top] |
mov eax, ebx |
shl eax, 16 |
mov ax, bx |
add ax, word [esp+16] |
mov ebx, ecx |
shl ebx, 16 |
mov bx, cx |
mov ecx, esi |
cmp [buttontype], 0 |
je @f |
call incecx2 |
@@: |
mov edx, edi |
.newline: |
call button_dececx |
push edi |
xor edi, edi |
call [draw_line] |
pop edi |
add ebx, 1*65536+1 ; [ y start | y end ] |
dec edx |
jnz .newline |
popad |
call drawbuttonframes |
button_no_draw: |
push edi |
mov edi, [BTN_ADDR] |
movzx eax, word [edi] |
cmp eax, max_buttons |
jge noaddbutt |
inc eax |
mov [edi], ax |
shl eax, 4 |
add edi, eax |
mov ax, [CURRENT_TASK] |
stosw |
mov ax, dx |
stosw ; button id number: bits 0-15 |
mov eax, ebx |
rol eax, 16 |
stosd ; x start | x size |
mov eax, ecx |
rol eax, 16 |
stosd ; y start | y size |
mov eax, edx |
shr eax, 16 |
stosw ; button id number: bits 16-31 |
pop edi |
noaddbutt: |
ret |
remove_button: |
and edx, 0x7fffffff |
rnewba2: |
mov edi, [BTN_ADDR] |
mov eax, edi |
movzx ebx, word [edi] |
inc ebx |
rnewba: |
dec ebx |
jz rnmba |
add eax, 0x10 |
mov cx, [CURRENT_TASK] |
cmp cx, [eax] |
jnz rnewba |
cmp dx, [eax+2] |
jnz rnewba |
lea ecx, [ebx+1] |
shl ecx, 4 |
mov ebx, eax |
add eax, 0x10 |
call memmove |
dec dword [edi] |
jmp rnewba2 |
rnmba: |
ret |
find_pressed_button_frames: |
pushad |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+ WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add ecx,edx |
push ecx |
mov dx,[eax+6] ; button x size |
add cx,dx |
mov esi,ecx |
inc esi |
mov ecx, [ebx+WDATA.box.top] ; window y start |
mov dx,[eax+8] ; button y start |
add ecx,edx |
mov ebx,ecx |
mov dx,[eax+10] ; button y size |
add dx,cx |
inc dx |
pop eax |
; eax x beginning |
; ebx y beginning |
; esi x end |
; edx y end |
; ecx color |
mov [pressed_button_eax],eax |
mov [pressed_button_ebx],ebx |
mov [pressed_button_ecx],ecx |
mov [pressed_button_edx],edx |
mov [pressed_button_esi],esi |
popad |
ret |
uglobal |
pressed_button_eax dd 0 |
pressed_button_ebx dd 0 |
pressed_button_ecx dd 0 |
pressed_button_edx dd 0 |
pressed_button_esi dd 0 |
endg |
; negative button image |
negativebutton: |
; If requested, do not display button |
; boarder on press. |
test ebx,0x20000000 |
jz draw_negative_button |
ret |
draw_negative_button: |
pushad |
mov eax,[pressed_button_eax] |
mov ebx,[pressed_button_ebx] |
mov ecx,[pressed_button_ecx] |
mov edx,[pressed_button_edx] |
mov esi,[pressed_button_esi] |
mov ecx,0x01000000 |
dec edx |
push edx |
inc edx |
dec esi |
push esi |
inc esi |
push eax |
push ebx |
push ecx |
push edx |
push edi |
call [disable_mouse] |
bdbnewline: |
mov edi,1 ; force |
cmp eax,[esp+16] |
jz bneg |
cmp eax,[esp+20] |
jz bneg |
cmp ebx,[esp+12] |
jz bneg |
cmp ebx,[esp+24] |
jnz nbneg |
; jz bneg |
; jmp nbneg |
bneg: |
;;;call [disable_mouse] |
call [putpixel] |
nbneg: |
inc eax |
cmp eax,esi |
jnz bdbnewline |
mov eax,[esp+16] |
inc ebx |
cmp ebx,edx |
jnz bdbnewline |
add esp,28 |
popad |
ret |
; check buttons |
; 0000 word process number |
; 0002 word button id number : bits 0-15 |
; 0004 word x start |
; 0006 word x size |
; 0008 word y start |
; 000A word y size |
; 000C word button id number : bits 16-31 |
; |
; button table in 0x10 increments |
; |
; first at 0x10 |
checkbuttons: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed |
jnz @f |
;..................................... start 1/5 : modified by vhanla ............................. |
mov [bPressedMouseXY_B],0 |
;..................................... end 1/5 : modified by vhanla ............................. |
ret |
@@: |
pushad |
xor esi, esi |
mov edi, [BTN_ADDR] |
movzx edx, word [edi] |
test edx, edx |
jne @f |
popad |
ret |
@@: |
;..................................... start 2/5 : modified by vhanla ............................. |
;here i catch the coordinates when the mouse's button is clicked |
push ax |
cmp [bPressedMouseXY_B],0;FALSE |
jnz @f |
mov [bPressedMouseXY_B],1;TRUE - it was already clicked |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;and it is only refreshed after the mouse's button release |
;..................................... end 2/5 : modified by vhanla ............................. |
push esi |
inc edx |
push edx |
buttonnewcheck: |
pop edx |
pop esi |
inc esi |
cmp edx,esi |
jge bch |
popad ; no button pressed |
ret |
bch: |
push esi |
push edx |
mov eax,esi |
shl eax,4 |
add eax,edi |
; check that button is at top of windowing stack |
movzx ebx,word [eax] |
movzx ecx,word [WIN_STACK + ebx * 2] |
cmp ecx,[TASK_COUNT] |
jne buttonnewcheck |
; check that button start is inside window x/y end |
movzx ebx,word [eax+0] |
shl ebx,5 |
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz buttonnewcheck |
; add ebx,window_data |
; mov ecx,[window_data+ebx+8] ; window end X |
movzx edx,word [eax+4] ; button start X |
cmp edx, [window_data+ebx+WDATA.box.width] ;ecx |
jge buttonnewcheck |
; mov ecx,[window_data+ebx+12] ; window end Y |
movzx edx, word [eax+8] ; button start Y |
cmp edx, [window_data+ebx+WDATA.box.height] ;ecx |
jge buttonnewcheck |
; check coordinates |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
;..................................... start 3/5 : modified by vhanla ............................. |
mov cx,[mx] ;mov cx,[MOUSE_X] |
;..................................... end 3/5 : modified by vhanla ............................. |
cmp edx,ecx |
jg buttonnewcheck |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
;..................................... start 4/5 : modified by vhanla ............................. |
mov cx,[my] ;mov cx,[MOUSE_Y] |
;..................................... start 4/5 : modified by vhanla ............................. |
cmp edx,ecx |
jg buttonnewcheck |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg buttonnewcheck |
; mouse on button |
pop edx |
pop esi |
mov bx,[eax+0xc] ; button id : bits 16-31 |
shl ebx,16 |
mov bx,[eax+2] ; button id : bits 00-16 |
push ebx |
mov [MOUSE_DOWN],byte 1 ; no mouse down checks |
call find_pressed_button_frames |
call negativebutton |
pushad |
; // Alver 22.06.2008 // { |
push eax |
mov al, byte [BTN_DOWN] |
mov byte [btn_down_determ], al |
pop eax |
; } \\ Alver \\ |
cbwaitmouseup: |
call checkidle |
call [draw_pointer] |
pushad |
call stack_handler |
popad |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jnz cbwaitmouseup |
popad |
call negativebutton |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
;..................................... start 5/5 : modified by vhanla ............................. |
; check coordinates |
iglobal |
mx dw 0x0 ; keeps the x mouse's position when it was clicked |
my dw 0x0 ; keeps the y mouse's position when it was clicked |
bPressedMouseXY_B db 0x0 |
btn_down_determ db 0x0 ; << // Alver 22.06.2008// << |
endg |
pusha |
; mouse x >= button x ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.left] ; window x start |
movzx edx,word [eax+4] ; button x start |
add edx,ecx |
mov cx,[MOUSE_X] |
cmp edx,ecx |
jg no_on_button ;if we release the pointer out of the button area |
movzx ebx,word [eax+6] ; button x size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
; mouse y >= button y ? |
movzx ebx,word [eax+0] |
shl ebx,5 |
add ebx,window_data |
mov ecx, [ebx+WDATA.box.top] ; window y start |
movzx edx,word [eax+8] ; button y start |
add edx,ecx |
mov cx,[MOUSE_Y] |
cmp edx,ecx |
jg no_on_button |
movzx ebx,word [eax+10] ; button y size |
add edx,ebx |
cmp ecx,edx |
jg no_on_button |
popa |
mov [BTN_COUNT],byte 1 ; no of buttons in buffer |
pop ebx |
mov [BTN_BUFF],ebx ; lets put the button id in buffer |
push ebx |
pusha |
jmp yes_on_button |
no_on_button: |
mov [BTN_COUNT],byte 0 ; no of buttons in buffer |
yes_on_button: |
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw |
popa |
pop ebx |
popa |
ret |
;..................................... end 5/5 : modified by vhanla ................................ |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/window.inc |
---|
0,0 → 1,1817 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
get_titlebar_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
ret |
@@: mov eax,21 |
ret |
get_rolledup_height: ; edi = window draw_data pointer |
mov al,[edi+WDATA.fl_wstyle] |
and al,0x0F |
cmp al,0x03 |
jne @f |
mov eax,[_skinh] |
add eax,3 |
ret |
@@: or al,al |
jnz @f |
mov eax,21 |
ret |
@@: mov eax,21+2 |
ret |
setwindowdefaults: |
pushad |
xor eax,eax |
mov ecx,WIN_STACK |
@@: |
inc eax |
add ecx,2 |
mov [ecx+0x000],ax ; process no |
mov [ecx+0x400],ax ; positions in stack |
cmp ecx,WIN_POS-2 ; the more high, the more surface |
jnz @b |
popad |
ret |
; eax = cx |
; ebx = cy |
; ecx = ex |
; edx = ey |
; èäåÿ: ïåðåáðàòü âñå îêíà, íà÷èíàÿ ñ ñàìîãî íèæíåãî, |
; è äëÿ ïîïàâøèõ â çàäàííóþ îáëàñòü |
; ÷àñòåé îêîí âûçâàòü setscreen |
align 4 |
calculatescreen: |
pushad |
pushfd |
cli |
push edx ecx ebx eax |
mov esi, 1 |
call setscreen |
mov ebp, [TASK_COUNT] ; number of processes |
cmp ebp, 1 |
jbe .finish |
align 4 |
.new_wnd: |
movzx edi, word [WIN_POS + esi * 2] |
shl edi, 5 |
cmp [CURRENT_TASK+edi+TASKDATA.state], byte 9 |
je .not_wnd |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .not_wnd |
mov eax,[edi+WDATA.box.left] |
cmp eax, [esp+RECT.right] |
ja .out_of_bounds |
mov ebx,[edi+WDATA.box.top] |
cmp ebx, [esp+RECT.bottom] |
ja .out_of_bounds |
mov ecx,[edi+WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp+RECT.left] |
jb .out_of_bounds |
mov edx,[edi+WDATA.box.height] |
add edx, ebx |
cmp edx, [esp+RECT.top] |
jb .out_of_bounds |
cmp eax, [esp+RECT.left] |
jae @f |
mov eax, [esp+RECT.left] |
@@: |
cmp ebx, [esp+RECT.top] |
jae @f |
mov ebx, [esp+RECT.top] |
@@: |
cmp ecx, [esp+RECT.right] |
jbe @f |
mov ecx, [esp+RECT.right] |
@@: |
cmp edx, [esp+RECT.bottom] |
jbe @f |
mov edx, [esp+RECT.bottom] |
@@: |
push esi |
movzx esi, word [WIN_POS + esi * 2] |
call setscreen |
pop esi |
.not_wnd: |
.out_of_bounds: |
inc esi |
dec ebp |
jnz .new_wnd |
.finish: |
pop eax ebx ecx edx |
popfd |
popad |
ret |
virtual at esp |
ff_x dd ? |
ff_y dd ? |
ff_width dd ? |
ff_xsz dd ? |
ff_ysz dd ? |
ff_scale dd ? |
end virtual |
align 4 |
; ðåçåðâèðóåò ìåñòî ïîä îêíî çàäàííîãî ïðîöåññà |
setscreen: |
; eax x start |
; ebx y start |
; ecx x end |
; edx y end |
; esi process number |
pushad |
; \begin{diamond}[29.08.2006] |
cmp esi, 1 |
jz @f |
mov edi, esi |
shl edi, 5 |
cmp [edi+window_data+WDATA.box.width], 0 |
jnz @f |
cmp [edi+window_data+WDATA.box.height], 0 |
jz .ret |
@@: |
; \end{diamond}[29.08.2006] |
mov edi, esi ;;;word [esi*2+WIN_POS] |
shl edi, 8 |
add edi, SLOT_BASE ; address of random shaped window area |
cmp [edi+APPDATA.wnd_shape], dword 0 |
jne .free_form |
; get x&y size |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
; get WinMap start |
mov edi, [Screen_Max_X] ; screen_sx |
inc edi |
imul edi, ebx |
add edi, eax |
add edi, WinMapAddress |
.new_y: |
push ecx ; sx |
push edx |
mov edx, esi |
align 4 |
.new_x: |
mov byte [edi], dl |
inc edi |
dec ecx |
jnz .new_x |
pop edx |
pop ecx |
add edi, [Screen_Max_X] |
inc edi |
sub edi, ecx |
dec edx |
jnz .new_y |
.ret: |
popad |
ret |
.read_byte: |
;eax - address |
;esi - slot |
push eax |
push ebx |
push ecx |
push edx |
mov edx,eax |
mov eax,esi |
lea ebx,[esp+12] |
mov ecx,1 |
call read_process_memory |
pop edx |
pop ecx |
pop ebx |
pop eax |
ret |
.free_form: |
; for (y=0; y <= x_size; y++) |
; for (x=0; x <= x_size; x++) |
; if (shape[coord(x,y,scale)]==1) |
; set_pixel(x, y, process_number); |
sub ecx, eax |
sub edx, ebx |
inc ecx |
inc edx |
push dword [edi+APPDATA.wnd_shape_scale] ; push scale first -> for loop |
; get WinMap start -> ebp |
push eax |
mov eax, [Screen_Max_X] ; screen_sx |
inc eax |
imul eax, ebx |
add eax, [esp] |
add eax, WinMapAddress |
mov ebp, eax |
mov edi, [edi+APPDATA.wnd_shape] |
pop eax |
; eax = x_start |
; ebx = y_start |
; ecx = x_size |
; edx = y_size |
; esi = process_number |
; edi = &shape |
; [scale] |
push edx ecx ; for loop - x,y size |
mov ecx, esi |
shl ecx, 5 |
mov edx, [window_data+ecx+WDATA.box.top] |
push [window_data+ecx+WDATA.box.width] ; for loop - width |
mov ecx, [window_data+ecx+WDATA.box.left] |
sub ebx, edx |
sub eax, ecx |
push ebx eax ; for loop - x,y |
add [ff_xsz], eax |
add [ff_ysz], ebx |
mov ebx, [ff_y] |
.ff_new_y: |
mov edx, [ff_x] |
.ff_new_x: |
; -- body -- |
mov ecx, [ff_scale] |
mov eax, [ff_width] |
inc eax |
shr eax, cl |
push ebx edx |
shr ebx, cl |
shr edx, cl |
imul eax, ebx |
add eax, edx |
pop edx ebx |
add eax, edi |
call .read_byte |
test al,al |
jz @f |
mov eax, esi |
mov [ebp], al |
@@: |
; -- end body -- |
inc ebp |
inc edx |
cmp edx, [ff_xsz] |
jb .ff_new_x |
sub ebp, [ff_xsz] |
add ebp, [ff_x] |
add ebp, [Screen_Max_X] ; screen.x |
inc ebp |
inc ebx |
cmp ebx, [ff_ysz] |
jb .ff_new_y |
add esp, 24 |
popad |
ret |
display_settings: |
; eax = 0 ; DISPLAY redraw |
; ebx = 0 ; all |
; |
; eax = 1 ; BUTTON type |
; ebx = 0 ; flat |
; ebx = 1 ; 3D |
; eax = 2 ; set WINDOW colours |
; ebx = pointer to table |
; ecx = number of bytes define |
; eax = 3 ; get WINDOW colours |
; ebx = pointer to table |
; ecx = number of bytes wanted |
; eax = 4 ; get skin height |
; input : nothing |
; output : eax = skin height in pixel |
; eax = 5 ; get screen workarea |
; input : nothing |
; output : eax = [left]*65536+[right] |
; ebx = [top]*65536+[bottom] |
; eax = 6 ; set screen workarea |
; input : ecx = [left]*65536+[right] |
; edx = [top]*65536+[bottom] |
; output : nothing |
; eax = 7 ; get skin margins |
; input : nothing |
; output : eax = [left]*65536+[right] |
; ebx = [top]*65536+[bottom] |
; eax = 8 ; set window skin |
; input : ecx = pointer to file info block |
; output : eax = FS error code |
pushad |
test eax, eax ; redraw display |
jnz dspl0 |
test ebx, ebx |
jnz dspl0 |
cmp [windowtypechanged],dword 1 |
jne dspl00 |
mov [windowtypechanged],dword 0 |
redraw_screen_direct: |
mov [dlx],dword 0 |
mov [dly],dword 0 |
mov eax,[Screen_Max_X] |
mov [dlxe],eax |
mov eax,[Screen_Max_Y] |
mov [dlye],eax |
mov eax,window_data |
call redrawscreen |
dspl00: |
popad |
ret |
dspl0: |
cmp eax,1 ; button type |
jne dspl1 |
and ebx,1 |
cmp ebx,[buttontype] |
je dspl9 |
mov [buttontype],ebx |
mov [windowtypechanged],dword 1 |
dspl9: |
popad |
ret |
dspl1: |
cmp eax,2 ; set common window colours |
jne no_com_colours |
mov [windowtypechanged],dword 1 |
mov esi,[TASK_BASE] |
add esi,TASKDATA.mem_start |
add ebx,[esi] |
mov esi,ebx |
mov edi,common_colours |
and ecx,127 |
cld |
rep movsb |
popad |
ret |
no_com_colours: |
cmp eax,3 ; get common window colours |
jne no_get_com |
mov esi,[TASK_BASE] |
add esi,TASKDATA.mem_start |
add ebx,[esi] |
mov edi,ebx |
mov esi,common_colours |
and ecx,127 |
cld |
rep movsb |
popad |
ret |
no_get_com: |
cmp eax,4 ; get skin height |
jne no_skin_height |
popad |
mov eax,[_skinh] |
mov [esp+36],eax |
ret |
no_skin_height: |
cmp eax,5 ; get screen workarea |
jne no_get_workarea |
popad |
mov eax,[screen_workarea.left-2] |
mov ax,word[screen_workarea.right] |
mov [esp+36],eax |
mov eax,[screen_workarea.top-2] |
mov ax,word[screen_workarea.bottom] |
mov [esp+24],eax |
ret |
no_get_workarea: |
cmp eax,6 ; set screen workarea |
jne no_set_workarea |
movsx eax,word[esp+16+2] |
movsx ebx,word[esp+16] |
cmp eax,ebx |
jge .lp1 |
or eax,eax;[Screen_Max_X] |
jl @f |
mov [screen_workarea.left],eax |
@@: cmp ebx,[Screen_Max_X] |
jg .lp1 |
mov [screen_workarea.right],ebx |
.lp1: movsx eax,word[esp+24+2] |
movsx ebx,word[esp+24] |
cmp eax,ebx |
jge .lp2 |
or eax,eax;[0xFE04] |
jl @f |
mov [screen_workarea.top],eax |
@@: cmp ebx,[Screen_Max_Y] |
jg .lp2 |
mov [screen_workarea.bottom],ebx |
.lp2: call repos_windows |
mov eax, 0 |
mov ebx, 0 |
mov ecx, [Screen_Max_X] |
mov edx, [Screen_Max_Y] |
call calculatescreen |
; jmp redraw_screen_direct |
.exit: |
popad |
ret |
no_set_workarea: |
cmp eax,7 ; get skin margins |
jne no_get_skinmargins |
popad |
mov eax,dword[_skinmargins+0] |
mov [esp+36],eax |
mov eax,dword[_skinmargins+4] |
mov [esp+24],eax |
ret |
no_get_skinmargins: |
cmp eax,8 ; set window skin |
jne no_set_skin |
call read_skin_file |
mov [esp+32+36], eax |
test eax, eax |
jnz .ret |
xor eax, eax |
xor ebx, ebx |
mov ecx, [Screen_Max_X] |
mov edx, [Screen_Max_Y] |
call calculatescreen |
jmp redraw_screen_direct |
.ret: |
popad |
ret |
no_set_skin: |
popad |
ret |
repos_windows: |
mov ecx,[TASK_COUNT] |
mov edi, OS_BASE+0x20*2 |
call force_redraw_background |
dec ecx |
jge @f |
ret |
@@: mov [edi+WDATA.fl_redraw],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz .lp2 |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .lp1 |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
.lp1: |
call set_window_clientbox |
add edi,0x20 |
loop @b |
ret |
.lp2: mov eax,[edi+WDATA.box.left] |
add eax,[edi+WDATA.box.width] |
mov ebx,[Screen_Max_X] |
; inc ebx |
cmp eax,ebx |
jle .lp4 |
mov eax,[edi+WDATA.box.width] |
sub eax,ebx |
jle .lp3 |
mov [edi+WDATA.box.width],ebx |
.lp3: sub ebx,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],ebx |
.lp4: mov eax,[edi+WDATA.box.top] |
add eax,[edi+WDATA.box.height] |
mov ebx,[Screen_Max_Y] |
; inc ebx |
cmp eax,ebx |
jle .lp6 |
mov eax,[edi+WDATA.box.height] |
sub eax,ebx |
jle .lp5 |
mov [edi+WDATA.box.height],ebx |
.lp5: sub ebx,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],ebx |
.lp6: jmp .lp1 |
uglobal |
common_colours: |
times 128 db 0x0 |
endg |
check_window_position: |
pushad ; window inside screen ? |
movsx eax,word [edi+WDATA.box.left] |
movsx ebx,word [edi+WDATA.box.top] |
movsx ecx,word [edi+WDATA.box.width] |
movsx edx,word [edi+WDATA.box.height] |
cmp ecx,[Screen_Max_X] ; check x size |
jbe x_size_ok |
mov ecx,[Screen_Max_X] |
mov [edi+WDATA.box.width],ecx |
x_size_ok: |
cmp edx,[Screen_Max_Y] ; check y size |
jbe y_size_ok |
mov edx,[Screen_Max_Y] |
mov [edi+WDATA.box.height],edx |
y_size_ok: |
cmp eax,0 ; check x pos |
jnle @f |
xor eax,eax |
mov [edi+WDATA.box.left],eax |
jmp x_pos_ok |
@@: |
add eax,ecx |
cmp eax,[Screen_Max_X] |
jbe x_pos_ok |
mov eax,[Screen_Max_X] |
sub eax,ecx |
mov [edi+WDATA.box.left],eax |
x_pos_ok: |
cmp ebx,0 ; check x pos |
jnle @f |
xor ebx,ebx |
mov [edi+WDATA.box.top],ebx |
jmp y_pos_ok |
@@: |
add ebx,edx |
cmp ebx,[Screen_Max_Y] |
jbe y_pos_ok |
mov ebx,[Screen_Max_Y] |
sub ebx,edx |
mov [edi+WDATA.box.top],ebx |
y_pos_ok: |
popad |
ret |
uglobal |
new_window_starting dd 0 |
endg |
sys_window_mouse: |
push eax |
mov eax,[timer_ticks] |
cmp [new_window_starting],eax |
jb swml1 |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
mov [new_window_starting],eax |
swml1: |
pop eax |
ret |
drawwindow_I_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; grab bar |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,1 |
mov ebx,[esi+WDATA.box.top] |
add ebx,21 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
inc eax |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
sub eax,1 |
push edx |
mov edx,0x80000000 |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,edx |
cmp ecx,edx |
jnz .nofa |
mov ecx,[esi+WDATA.cl_titlebar] |
sub ecx,0x00040404 |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0x00ffffff |
jmp .faj |
.nofa: |
mov ecx,[esi+WDATA.cl_titlebar] |
and ecx,0x00ffffff |
.faj: |
pop edx |
mov edi,0 |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
drawwindow_I: |
pushad |
or [edx+WDATA.fl_wdrawn], 4 |
mov esi,[edx+WDATA.cl_frames] ; rectangle |
mov eax,[edx+WDATA.box.left] |
shl eax,16 |
add eax,[edx+WDATA.box.left] |
add eax,[edx+WDATA.box.width] |
mov ebx,[edx+WDATA.box.top] |
shl ebx,16 |
add ebx,[edx+WDATA.box.top] |
add ebx,[edx+WDATA.box.height] |
call draw_rectangle |
and [edx+WDATA.fl_wdrawn], not 4 |
test [edx+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
call drawwindow_I_caption |
mov edx,[esi+WDATA.box.top] ; inside work area |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside |
mov eax,1 |
mov ebx,21 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside |
call [drawbar] |
noinside: |
popad |
ret |
draw_rectangle: |
r_eax equ [esp+28] ; x start |
r_ax equ [esp+30] ; x end |
r_ebx equ [esp+16] ; y start |
r_bx equ [esp+18] ; y end |
;esi ; color |
pushad |
mov ecx,esi ; yb,xb -> yb,xe |
mov eax, r_eax |
rol eax, 16 |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_ebx |
xor edi, edi |
call [draw_line] |
mov ebx,r_bx ; ye,xb -> ye,xe |
shl ebx,16 |
mov bx,r_bx |
call [draw_line] |
mov ecx,esi ; ya,xa -> ye,xa |
mov eax,r_eax |
shl eax,16 |
mov ax,r_eax |
mov ebx,r_ebx |
shl ebx,16 |
mov bx,r_bx |
mov edi,0 |
call [draw_line] |
mov eax,r_ax ; ya,xe -> ye,xe |
shl eax,16 |
mov ax,r_ax |
call [draw_line] |
popad |
ret |
drawwindow_III_caption: |
mov ecx,[edx+WDATA.cl_titlebar] ; GRAB BAR |
push ecx |
mov esi,edx |
mov edx,[esi+WDATA.box.top] |
add edx,4 |
mov ebx,[esi+WDATA.box.top] |
add ebx,20 |
mov eax,[esi+WDATA.box.top] |
add eax,[esi+WDATA.box.height] |
cmp ebx,eax |
jb .wdsizeok |
mov ebx,eax |
.wdsizeok: |
push ebx |
.drwi: |
mov ebx,edx |
shl ebx,16 |
add ebx,edx |
mov eax,[esi+WDATA.box.left] |
shl eax,16 |
add eax,[esi+WDATA.box.left] |
add eax,[esi+WDATA.box.width] |
add eax,4*65536-4 |
mov ecx,[esi+WDATA.cl_titlebar] |
test ecx,0x40000000 |
jz .nofa |
add ecx,0x040404 |
.nofa: |
test ecx,0x80000000 |
jz .nofa2 |
sub ecx,0x040404 |
.nofa2: |
mov [esi+WDATA.cl_titlebar],ecx |
and ecx,0xffffff |
xor edi, edi |
call [draw_line] |
inc edx |
cmp edx,[esp] |
jb .drwi |
add esp,4 |
pop ecx |
mov [esi+WDATA.cl_titlebar],ecx |
ret |
drawwindow_III: |
pushad |
mov edi,edx ; RECTANGLE |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov ax, word [edi+WDATA.box.left] |
add ax, word [edi+WDATA.box.width] |
mov ebx,[edi+WDATA.box.top] |
shl ebx,16 |
mov bx, word [edi+WDATA.box.top] |
add bx, word [edi+WDATA.box.height] |
mov esi,[edi+WDATA.cl_frames] |
shr esi,1 |
and esi,0x007f7f7f |
push esi |
or [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
and [edi+WDATA.fl_wdrawn], not 4 |
test [edi+WDATA.fl_wdrawn], 2 |
jz @f |
call drawwindowframes2 |
@@: |
mov ecx,3 |
dw3l: |
add eax,1*65536-1 |
add ebx,1*65536-1 |
mov esi,[edi+WDATA.cl_frames] |
call draw_rectangle |
dec ecx |
jnz dw3l |
pop esi |
add eax,1*65536-1 |
add ebx,1*65536-1 |
call draw_rectangle |
call drawwindow_III_caption |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg noinside2 |
mov eax,5 |
mov ebx,20 |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz noinside2 |
call [drawbar] |
noinside2: |
popad |
ret |
; activate window |
align 4 |
windowactivate: |
; esi = abs mem position in stack 0xC400+ |
pushad |
; if type of current active window is 3, |
; it must be redrawn |
mov eax, [TASK_COUNT] |
movzx eax, word [WIN_POS + eax*2] |
shl eax, 5 |
add eax, window_data |
mov ebx, [eax + WDATA.cl_workarea] |
and ebx, 0x0f000000 |
cmp ebx, 0x03000000 |
je .set_WDATA_fl_redraw ; for 3 and 4 style |
cmp ebx, 0x04000000 |
je .set_WDATA_fl_redraw |
jmp @f |
.set_WDATA_fl_redraw: |
mov [eax + WDATA.fl_redraw], byte 1 |
@@: |
push esi |
movzx eax, word [esi] ; ax <- process no |
movzx eax, word [WIN_STACK+eax*2] ; ax <- position in window stack |
xor esi, esi ; drop others |
waloop: |
cmp esi, dword [TASK_COUNT] |
jae wacont |
inc esi |
lea edi, [WIN_STACK + esi*2] |
mov bx, [edi] ; position of the current process |
cmp bx, ax |
jbe @f |
dec bx ; upper? => drop! |
mov [edi], bx |
@@: |
jmp waloop |
wacont: |
; set to no 1 |
pop esi ; esi = pointer at 0xC400 |
movzx eax, word [esi] |
mov bx, [TASK_COUNT] ; number of processes |
mov [WIN_STACK+eax*2], bx ; this is the last (and the upper) |
; update on screen -window stack |
xor esi, esi |
waloop2: |
mov edi, [TASK_COUNT] |
cmp esi, edi |
jae wacont2 |
inc esi |
movzx ebx, word [esi*2 + WIN_STACK] |
mov [ebx*2 + WIN_POS], si |
jmp waloop2 |
wacont2: |
mov [KEY_COUNT], byte 0 ; empty keyboard buffer |
mov [BTN_COUNT], byte 0 ; empty button buffer |
mov [MOUSE_SCROLL_H], word 0 ; zero mouse z-index |
mov [MOUSE_SCROLL_V], word 0 ; zero mouse z-index |
popad |
ret |
; check if window is necessary to draw |
checkwindowdraw: |
; edi = position in window_data+ |
mov eax, [edi + WDATA.cl_workarea] |
and eax, 0x0f000000 |
cmp eax, 0x03000000 |
je .return_yes ; window type 3 |
cmp eax, 0x04000000 |
je .return_yes ; window type 4 |
mov esi, edi |
sub esi, window_data |
shr esi, 5 |
; esi = process number |
movzx eax, word [WIN_STACK + esi * 2] ; get value of the curr process |
lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 |
push esi |
.new_check: |
pop esi |
add esi, 2 |
push esi |
mov eax, [TASK_COUNT] |
lea eax, word [WIN_POS + eax * 2] ; number of the upper window |
cmp esi, eax |
ja .all_wnds_to_top |
movzx eax, word [esi] |
shl eax, 5 |
cmp [CURRENT_TASK + eax + TASKDATA.state], byte 9 |
je .new_check ; skip dead windows |
lea esi, [eax+window_data] |
mov ebx, [edi+WDATA.box.top] ; y0 |
mov edx, [edi+WDATA.box.height] |
add edx, ebx ; y0e |
mov ecx, [esi+WDATA.box.top] ; y ; y check |
cmp ecx, edx |
jae .new_check ; y < y0e |
mov eax, [esi+WDATA.box.height] |
add ecx, eax ; ye |
cmp ebx, ecx ; y0 >= ye |
ja .new_check |
mov eax, [edi+WDATA.box.left] ; x0 |
mov ecx, [edi+WDATA.box.width] |
add ecx, eax ; x0e |
mov edx, [esi+WDATA.box.left] ; x ; x check |
cmp edx, ecx |
jae .new_check ; x < x0e |
mov ecx, [esi+WDATA.box.width] |
add edx, ecx |
cmp eax, edx |
ja .new_check |
pop esi |
.return_yes: |
mov ecx,1 ; overlap some window |
ret |
.all_wnds_to_top: |
pop esi |
xor ecx, ecx ; passed all windows to top |
ret |
waredraw: ; if redraw necessary at activate |
pushad |
call checkwindowdraw ; draw window on activation ? |
test ecx, ecx |
jz .do_not_draw |
popad |
mov [MOUSE_DOWN], byte 1 ; do draw mouse |
call windowactivate |
; update screen info |
pushad |
mov edi, [TASK_COUNT] ; the last process (number) |
movzx esi, word [WIN_POS + edi * 2] |
shl esi, 5 |
add esi, window_data |
; coordinates of the upper window |
mov eax, [esi + WDATA.box.left] ; cx |
mov ebx, [esi + WDATA.box.top] ; cy |
mov ecx, [esi + WDATA.box.width] ; sx |
mov edx, [esi + WDATA.box.height] ; sy |
add ecx, eax ; ecx = x_end |
add edx, ebx ; edx = y_end |
mov edi, [TASK_COUNT] |
movzx esi, word [WIN_POS + edi * 2] |
call setscreen |
popad |
mov [edi + WDATA.fl_redraw], 1 ; redraw flag for app |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
ret |
.do_not_draw: |
popad |
call windowactivate |
mov [MOUSE_DOWN],byte 0 ; mouse down checks |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse background |
mov [DONT_DRAW_MOUSE],byte 0 ; draw mouse |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
minimize_window: |
movzx eax, word [WIN_POS+eax*2] |
shl eax, 5 |
add eax, window_data |
test [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_redrawings |
pushfd |
cli |
or [eax+WDATA.fl_wstate], WSTATE_MINIMIZED |
mov edi, eax |
;call calculatescreen |
mov eax, [edi+WDATA.box.left] |
mov [dlx], eax |
mov ecx, eax |
add ecx, [edi+WDATA.box.width] |
mov [dlxe], ecx |
mov ebx, [edi+WDATA.box.top] |
mov [dly], ebx |
mov edx, ebx |
add edx, [edi+WDATA.box.height] |
mov [dlye], edx |
call calculatescreen |
xor esi, esi |
xor eax, eax |
call redrawscreen |
popfd |
.skip_redrawings: |
ret |
; eax = window number on screen |
; corrupts registers and [dl*] |
restore_minimized_window: |
pushfd |
cli |
movzx esi, word [WIN_POS+eax*2] |
mov edi, esi |
shl edi, 5 |
add edi, window_data |
test [edi+WDATA.fl_wstate], WSTATE_MINIMIZED |
jz .skip_redrawings |
mov [edi+WDATA.fl_redraw], 1 |
and [edi+WDATA.fl_wstate], not WSTATE_MINIMIZED |
cmp eax, [TASK_COUNT] ; the uppermost window |
jnz .no_uppermost |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call setscreen |
jmp .done |
.no_uppermost: |
mov eax, [edi+WDATA.box.left] |
mov ebx, [edi+WDATA.box.top] |
mov ecx, eax |
mov edx, ebx |
add ecx, [edi+WDATA.box.width] |
add edx, [edi+WDATA.box.height] |
call calculatescreen |
.done: |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
.skip_redrawings: |
popfd |
ret |
iglobal |
window_moving db 'K : Window - move/resize',13,10,0 |
window_moved db 'K : Window - done',13,10,0 |
endg |
; check window touch |
align 4 |
checkwindows: |
pushad |
cmp [window_minimize], 0 |
je .no_minimizing |
mov eax, [TASK_COUNT] ; the uppermost window |
mov bl, 0 |
xchg [window_minimize], bl |
cmp bl, 1 |
jne .restore |
call minimize_window |
jmp .continue |
.restore: |
call restore_minimized_window |
.continue: |
.no_minimizing: |
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed ? |
jne .mouse_buttons_pressed |
;..................................... start 1/4 : modified by vhanla ................. |
mov [bPressedMouseXY_W],0 |
;..................................... end 1/4 : modified by vhanla ................... |
popad |
ret |
.mouse_buttons_pressed: |
;..................................... start 2/4 : modified by vhanla ................. |
jmp @f |
bPressedMouseXY_W db 0x0 |
@@: |
;..................................... end 2/4 : modified by vhanla ................... |
mov esi,[TASK_COUNT] |
inc esi |
;..................................... start 3/4 : modified by vhanla ................. |
push ax |
cmp [bPressedMouseXY_W],0 |
jnz @f |
mov [bPressedMouseXY_W],1 |
mov ax,[MOUSE_X] |
mov [mx],ax |
mov ax,[MOUSE_Y] |
mov [my],ax |
@@: |
pop ax |
;..................................... end 3/4 : modified by vhanla ................... |
cwloop: |
cmp esi,2 |
jb .exit |
dec esi |
movzx edi, word [WIN_POS + esi * 2] ; ebx |
shl edi, 5 |
add edi, window_data |
; mov edi, ebx |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
mov eax,ecx |
mov ebx,edx |
test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED |
jnz cwloop |
;..................................... start 4/4 : modified by vhanla ................. |
movzx eax, word [mx]; movzx eax,word[MOUSE_X] |
movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] |
;..................................... endt 4/4 : modified by vhanla .................. |
cmp ecx, eax |
jae cwloop |
cmp edx, ebx |
jae cwloop |
add ecx, [edi + WDATA.box.width] |
add edx, [edi + WDATA.box.height] |
cmp eax, ecx |
jae cwloop |
cmp ebx, edx |
jae cwloop |
pushad |
mov eax, esi |
mov ebx, [TASK_COUNT] |
cmp eax, ebx ; is this window active? |
jz .move_resize_window |
; eax = position in windowing stack |
; redraw must ? |
lea esi, [WIN_POS + esi * 2] |
call waredraw |
add esp, 32 |
.exit: |
popad |
ret |
.move_resize_window: ; MOVE OR RESIZE WINDOW |
popad |
; Check for user enabled fixed window |
mov edx, [edi + WDATA.cl_titlebar] |
and edx, 0x0f000000 |
cmp edx, 0x01000000 |
jne .window_move_enabled_for_user |
popad |
ret |
.window_move_enabled_for_user: |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz .no_resize_2 |
mov [do_resize_from_corner],byte 0 ; resize for skinned window |
mov edx, [edi + WDATA.cl_workarea] |
and edx, 0x0f000000 |
cmp edx, 0x00000000 ;{test for resized} |
je .no_resize_2 |
cmp edx, 0x01000000 ;{test for resized} |
je .no_resize_2 |
cmp edx, 0x04000000 ;{test for resized} |
je .no_resize_2 |
; jb .no_resize_2 ; not type 2 wnd |
mov edx, [edi + WDATA.box.top] |
add edx, [edi + WDATA.box.height] |
sub edx, 6 ; edx = y_end - 6 |
cmp ebx, edx ; ebx = mouse_y |
jb .no_resize_2 |
mov [do_resize_from_corner],byte 1 |
jmp .continue |
.no_resize_2: |
push eax |
call get_titlebar_height |
add eax,[edi + WDATA.box.top] |
cmp ebx,eax |
pop eax |
jae .exit |
.continue: |
push esi |
mov esi, window_moving |
call sys_msg_board_str |
pop esi |
mov ecx, [timer_ticks] ; double-click ? |
mov edx, ecx |
sub edx, [latest_window_touch] |
mov [latest_window_touch], ecx |
mov [latest_window_touch_delta], edx |
mov cl, [BTN_DOWN] ; save for shade check |
mov [do_resize], cl |
no_emulation_righ_button: |
mov ecx, [edi + WDATA.box.left] |
mov edx, [edi + WDATA.box.top] |
push eax ecx edx |
mov [dlx], ecx ; save for drawlimits |
mov [dly], edx |
mov eax, [edi + WDATA.box.width] |
add ecx, eax |
mov eax, [edi + WDATA.box.height] |
add edx, eax |
mov [dlxe], ecx |
mov [dlye], edx |
pop edx ecx eax |
sub eax, ecx |
sub ebx, edx |
mov esi, [MOUSE_X] |
mov [WIN_TEMP_XY], esi |
pushad ; wait for putimages to finish |
; mov ebx,5 |
; call delay_hs |
mov eax,[edi + WDATA.box.left] |
mov [npx],eax |
mov eax,[edi + WDATA.box.top] |
mov [npy],eax |
popad |
push eax ; save old coordinates |
mov ax, word [edi + WDATA.box.left] |
mov word [oldc+BOX.left],ax |
mov ax, word [edi + WDATA.box.top] |
mov word [oldc+BOX.top],ax |
mov ax, word [edi + WDATA.box.width] |
mov word [oldc+BOX.width],ax |
mov word [npxe],ax |
mov ax, word [edi + WDATA.box.height] |
mov word [oldc+BOX.height],ax |
mov word [npye],ax |
pop eax |
call drawwindowframes |
mov [reposition],0 |
mov [MOUSE_DOWN],byte 1 ; no reaction to mouse up/down |
; move window |
newchm: |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
call checkVga_N13 |
mov [MOUSE_BACKGROUND],byte 0 |
call [draw_pointer] |
pushad |
call stack_handler |
popad |
mov esi,[WIN_TEMP_XY] |
cmp esi,[MOUSE_X] |
je cwb |
mov cx,[MOUSE_X] |
mov dx,[MOUSE_Y] |
sub cx,ax |
sub dx,bx |
push ax |
push bx |
call drawwindowframes |
mov ax,[Screen_Max_X] |
mov bx,[Screen_Max_Y] |
cmp [do_resize_from_corner],1 |
je no_new_position |
mov word [npx],word 0 ; x repos ? |
cmp ax,cx |
jb noreposx |
mov [reposition],1 |
sub ax,word [npxe] |
mov word [npx],ax |
cmp ax,cx |
jb noreposx |
mov word [npx],cx |
noreposx: |
mov word [npy],word 0 ; y repos ? |
cmp bx,dx |
jb noreposy |
mov [reposition],1 |
sub bx,word [npye] |
mov word [npy],bx |
cmp bx,dx |
jb noreposy |
mov word [npy],dx |
noreposy: |
no_new_position: |
cmp [do_resize_from_corner],0 ; resize from right corner |
je norepos_size |
pushad |
mov edx,edi |
sub edx,window_data |
;shr edx,5 |
;shl edx,8 |
;add edx,0x80000 ; process base at 0x80000+ |
lea edx, [SLOT_BASE + edx*8] |
movzx eax,word [MOUSE_X] |
cmp eax,[edi + WDATA.box.left] |
jb nnepx |
sub eax,[edi + WDATA.box.left] |
cmp eax,32 ; [edx+0x90+8] |
jge nnepx2 |
mov eax,32 ; [edx+0x90+8] |
nnepx2: |
mov [npxe],eax |
nnepx: |
call get_rolledup_height |
mov ebx,eax |
movzx eax,word [MOUSE_Y] |
cmp eax,[edi + WDATA.box.top] |
jb nnepy |
sub eax,[edi + WDATA.box.top] |
cmp eax,ebx ; [edx+0x90+12] |
jge nnepy2 |
mov eax,ebx ; [edx+0x90+12] |
nnepy2: |
mov [npye],eax |
nnepy: |
mov [reposition],1 |
popad |
norepos_size: |
pop bx |
pop ax |
call drawwindowframes |
mov esi,[MOUSE_X] |
mov [WIN_TEMP_XY],esi |
cwb: |
cmp [BTN_DOWN],byte 0 |
jne newchm |
; new position done |
mov [DONT_DRAW_MOUSE],byte 1 |
mov cl,0 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz @f |
mov cl,[reposition] |
call drawwindowframes |
mov eax,[npx] |
mov [edi + WDATA.box.left],eax |
mov eax,[npy] |
mov [edi + WDATA.box.top],eax |
mov eax,[npxe] |
mov [edi + WDATA.box.width],eax |
mov eax,[npye] |
mov [edi + WDATA.box.height],eax |
call set_window_clientbox |
@@: mov [reposition],cl |
cmp [reposition],1 ; save new position and size |
jne no_bounds_save |
push esi edi ecx |
mov esi,edi |
mov ecx,2 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED |
jnz @f |
add ecx,2 |
@@: sub edi,window_data |
shr edi,5 |
shl edi,8 |
add edi,SLOT_BASE+APPDATA.saved_box |
cld |
rep movsd |
pop ecx edi esi |
no_bounds_save: |
pushad ; WINDOW SHADE/FULLSCREEN |
;{doule click not worked for 4 type window} |
mov edx, [edi + WDATA.cl_workarea] |
and edx, 0x0f000000 |
cmp edx, 0x00000000 |
je no_fullscreen_restore |
cmp edx, 0x01000000 |
je no_fullscreen_restore |
cmp [reposition],1 |
je no_window_sizing |
mov edx,edi |
sub edx,window_data |
shr edx,5 |
shl edx,8 |
add edx,SLOT_BASE ; process base at 0x80000+ |
cmp [do_resize],2 ; window shade ? |
jne no_window_shade |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz wnd_rolldown |
wnd_rollup: |
or [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
call get_rolledup_height |
jmp @f |
wnd_rolldown: |
and [edi+WDATA.fl_wstate],not WSTATE_ROLLEDUP |
mov eax,[edx + APPDATA.saved_box.height] ; 0x90+BOX.height |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jz @f |
mov eax,[screen_workarea.bottom] |
sub eax,[screen_workarea.top] |
@@: mov [edi+WDATA.box.height],eax |
add eax, [edi+WDATA.box.top] |
cmp eax, [Screen_Max_Y] |
jbe @f |
mov eax, [Screen_Max_Y] |
sub eax, [edi+WDATA.box.height] |
mov [edi+WDATA.box.top], eax |
@@: call check_window_position |
call set_window_clientbox |
no_window_shade: |
push edx |
mov edx, [edi + WDATA.cl_workarea] |
and edx, 0x0f000000 |
cmp edx, 0x04000000 |
pop edx |
je no_fullscreen_restore |
cmp [do_resize],1 ; fullscreen/restore ? |
jne no_fullscreen_restore |
cmp [latest_window_touch_delta],dword 50 |
jg no_fullscreen_restore |
mov [reposition],1 |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz restore_from_fullscreen |
or [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
mov eax,[screen_workarea.left] |
mov [edi+WDATA.box.left],eax |
sub eax,[screen_workarea.right] |
neg eax |
mov [edi+WDATA.box.width],eax |
mov eax,[screen_workarea.top] |
mov [edi+WDATA.box.top],eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jnz @f |
sub eax,[screen_workarea.bottom] |
neg eax |
mov [edi+WDATA.box.height],eax |
@@: |
jmp restore_from_fullscreen.clientbox |
restore_from_fullscreen: |
and [edi+WDATA.fl_wstate],not WSTATE_MAXIMIZED |
push [edi+WDATA.box.height] |
push edi ; restore |
lea esi, [edx + APPDATA.saved_box] |
mov ecx,4 |
cld |
rep movsd |
pop edi |
pop eax |
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP |
jz @f |
mov [edi+WDATA.box.height],eax |
@@: |
.clientbox: |
call set_window_clientbox |
no_fullscreen_restore: |
mov eax,[edi+WDATA.box.top] ; check Y inside screen |
add eax,[edi+WDATA.box.height] |
cmp eax,[Screen_Max_Y] |
jbe no_window_sizing |
mov eax,[edi+WDATA.box.left] ; check X inside screen |
add eax,[edi+WDATA.box.width] |
cmp eax,[Screen_Max_X] |
jbe no_window_sizing |
mov eax,[Screen_Max_X] |
sub eax,[edi+WDATA.box.width] |
mov [edi+WDATA.box.left],eax |
mov eax,[Screen_Max_Y] |
sub eax,[edi+WDATA.box.height] |
mov [edi+WDATA.box.top],eax |
call set_window_clientbox |
no_window_sizing: |
popad |
cmp [reposition],0 |
je retwm |
mov [DONT_DRAW_MOUSE],byte 1 ; no mouse |
push eax ebx ecx edx |
mov eax,[edi+WDATA.box.left] |
mov ebx,[edi+WDATA.box.top] |
mov ecx,[edi+WDATA.box.width] |
mov edx,[edi+WDATA.box.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
mov eax,[oldc+BOX.left] |
mov ebx,[oldc+BOX.top] |
mov ecx,[oldc+BOX.width] |
mov edx,[oldc+BOX.height] |
add ecx,eax |
add edx,ebx |
call calculatescreen |
pop edx ecx ebx eax |
mov eax,edi |
call redrawscreen |
mov [edi+WDATA.fl_redraw],1 |
mov ecx,100 ; wait to avoid mouse residuals |
waitre2: |
mov [DONT_DRAW_MOUSE],byte 1 |
call checkidle |
cmp [edi+WDATA.fl_redraw],0 |
jz retwm |
loop waitre2 |
retwm: |
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer |
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under |
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down |
mov esi,window_moved |
call sys_msg_board_str |
popad |
ret |
uglobal |
add_window_data dd 0 |
do_resize_from_corner db 0x0 |
reposition db 0x0 |
latest_window_touch dd 0x0 |
latest_window_touch_delta dd 0x0 |
do_resize db 0x0 |
oldc dd 0x0,0x0,0x0,0x0 |
dlx dd 0x0 |
dly dd 0x0 |
dlxe dd 0x0 |
dlye dd 0x0 |
npx dd 0x0 |
npy dd 0x0 |
npxe dd 0x0 |
npye dd 0x0 |
mpx dd 0x0 |
mpy dd 0x0 |
endg |
; draw negative window frames |
drawwindowframes2: |
pushad |
cli |
jmp drawwindowframes.do |
drawwindowframes: |
pushad |
cli |
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED |
jnz .ret |
mov eax, [npx] |
cmp eax, [edi+WDATA.box.left] |
jnz .nowndframe |
mov eax, [npxe] |
cmp eax, [edi+WDATA.box.width] |
jnz .nowndframe |
mov eax, [npy] |
cmp eax, [edi+WDATA.box.top] |
jnz .nowndframe |
mov eax, [npye] |
cmp eax, [edi+WDATA.box.height] |
jnz .nowndframe |
xor [edi+WDATA.fl_wdrawn], 2 |
test [edi+WDATA.fl_wdrawn], 4 |
jnz .ret |
.nowndframe: |
.do: |
mov edi, 1 |
mov ecx, 0x01000000 |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
add eax,65536*1-1 |
mov ebx,[npy] |
add ebx,[npye] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
shl eax,16 |
add eax,[npx] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
mov eax,[npx] |
add eax,[npxe] |
shl eax,16 |
add eax,[npx] |
add eax,[npxe] |
mov ebx,[npy] |
shl ebx,16 |
add ebx,[npy] |
add ebx,[npye] |
call [draw_line] |
.ret: |
sti |
popad |
ret |
random_shaped_window: |
; |
; eax = 0 giving address of data area |
; ebx address |
; eax = 1 shape area scale |
; ebx 2^ebx scale |
test eax, eax |
jne rsw_no_address |
mov eax,[current_slot] |
mov [eax+APPDATA.wnd_shape],ebx |
rsw_no_address: |
cmp eax,1 |
jne rsw_no_scale |
mov eax,[current_slot] |
mov byte [eax+APPDATA.wnd_shape_scale], bl |
rsw_no_scale: |
ret |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/event.inc |
---|
0,0 → 1,701 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
align 4 |
init_events: |
stdcall kernel_alloc, 512*EVENT_SIZE |
mov [events], eax |
xor eax, eax |
mov [event_uid], eax |
not eax |
mov edi, event_map |
mov [event_start], edi |
mov ecx, 64/4 |
cld |
rep stosd |
mov [event_end], edi |
ret |
align 4 |
proc alloc_event |
pushfd |
cli |
mov ebx, [event_start] |
mov ecx, [event_end] |
.l1: |
bsf eax,[ebx] |
jnz .found |
add ebx,4 |
cmp ebx, ecx |
jb .l1 |
popfd |
xor eax,eax |
ret |
.found: |
btr [ebx], eax |
mov [event_start],ebx |
inc [event_uid] |
sub ebx, event_map |
lea eax,[eax+ebx*8] |
lea ebx, [eax+eax*4] |
shl eax,5 |
lea eax,[eax+ebx*4] ;eax*=52 (EVENT_SIZE) |
add eax, [events] |
mov ebx, [event_uid] |
popfd |
ret |
endp |
align 4 |
free_event: |
sub eax, [events] |
mov ecx, EVENT_SIZE |
mov ebx, event_map |
cdq |
div ecx |
pushfd |
cli |
bts [ebx], eax |
shr eax, 3 |
and eax, not 3 |
add eax, ebx |
cmp [event_start], eax |
ja @f |
popfd |
ret |
@@: |
mov [event_start], eax |
popfd |
ret |
EVENT_WATCHED equ 0x10000000 |
EVENT_SIGNALED equ 0x20000000 |
MANUAL_RESET equ 0x40000000 |
MANUAL_DESTROY equ 0x80000000 |
; param |
; eax= event data |
; ebx= flags |
; |
; retval |
; eax= event |
; edx= id |
create_event: |
.flags equ esp+4 |
.data equ esp |
push ebx |
push eax |
call alloc_event |
test eax, eax |
jz .fail |
mov [eax+APPOBJ.magic], 'EVNT' |
mov [eax+APPOBJ.destroy], destroy_event.internal |
mov [eax+EVENT.id], ebx |
mov ebx, [CURRENT_TASK] |
shl ebx, 5 |
mov ebx, [CURRENT_TASK+ebx+4] |
mov [eax+APPOBJ.pid], ebx |
mov edx, [.flags] |
mov [eax+EVENT.state], edx |
mov esi, [.data] |
test esi, esi |
jz @F |
lea edi, [eax+EVENT.code] |
mov ecx, 6 |
cld |
rep movsd |
@@: |
mov ecx, [current_slot] |
add ecx, APP_OBJ_OFFSET |
pushfd |
cli |
mov edx, [ecx+APPOBJ.fd] |
mov [eax+APPOBJ.fd], edx |
mov [eax+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], eax |
mov [edx+APPOBJ.bk], eax |
popfd |
mov edx, [eax+EVENT.id] |
.fail: |
add esp, 8 |
ret |
restore .flags |
restore .data |
; param |
; eax= event |
; ebx= id |
destroy_event: |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
.internal: |
mov ebx, [eax+APPOBJ.fd] |
mov ecx, [eax+APPOBJ.bk] |
mov [ebx+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], ebx |
.force: |
xor edx, edx ;clear common header |
mov [eax], edx |
mov [eax+4], edx |
mov [eax+8], edx |
mov [eax+12], edx |
mov [eax+16], edx |
call free_event ;release object memory |
.fail: |
ret |
align 4 |
proc send_event stdcall pid:dword, event:dword |
locals |
slot dd ? |
endl |
mov eax, [pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
shl eax, 8 |
cmp [SLOT_BASE+eax+APPDATA.ev_count], 32 |
ja .fail |
mov [slot], eax |
call alloc_event |
test eax, eax |
jz .fail |
lea edi, [eax+EVENT.code] |
mov ecx, 6 |
mov esi, [event] |
cld |
rep movsd |
mov ecx, [slot] |
add ecx, SLOT_BASE+APP_EV_OFFSET |
mov [eax+APPOBJ.magic], 'EVNT' |
mov [eax+APPOBJ.destroy], destroy_event |
mov ebx, [pid] |
mov [eax+APPOBJ.pid], ebx |
mov [eax+EVENT.state], EVENT_SIGNALED |
pushfd |
cli ;insert event into |
mov edx, [ecx+APPOBJ.fd] ;events list |
mov [eax+APPOBJ.fd], edx ;and set events flag |
mov [eax+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], eax |
mov [edx+APPOBJ.bk], eax |
inc [ecx+APPDATA.ev_count-APP_EV_OFFSET] |
or [ecx+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
popfd |
.fail: |
ret |
endp |
; timeout ignored |
align 4 |
proc get_event_ex stdcall, p_ev:dword, timeout:dword |
.wait: |
mov edx,[current_slot] |
; cmp [SLOT_BASE+edx+APPDATA.ev_count], 0 |
; je .switch |
add edx, APP_EV_OFFSET |
mov eax, [edx+APPOBJ.fd] |
cmp eax, edx |
je .switch |
lea esi, [eax+EVENT.code] |
mov edi, [p_ev] ;copy event data |
mov ecx, 6 |
cld |
rep movsd |
and dword [edi-24], 0xFF00FFFF ;clear priority field |
; |
test [eax+EVENT.state], MANUAL_RESET |
jnz .done |
pushfd |
cli ;remove event from events |
mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
dec [edx+APPDATA.ev_count-APP_EV_OFFSET] |
jnz @F |
and [edx+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
@@: |
popfd |
test [eax+EVENT.state], MANUAL_DESTROY |
jz .destroy |
add edx, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
pushfd |
cli |
mov ebx, [edx+APPOBJ.fd] ;insert event into |
mov [eax+APPOBJ.fd], ebx ;objects list |
mov [eax+APPOBJ.bk], edx |
mov [edx+APPOBJ.fd], eax |
mov [ebx+APPOBJ.bk], eax |
popfd |
.done: |
ret |
.destroy: |
call destroy_event.force |
ret |
.switch: |
mov eax, [TASK_BASE] |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
jmp .wait |
endp |
; param |
; eax= event |
; ebx= id |
align 4 |
wait_event: |
.event equ esp |
push eax |
.wait: |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .done |
cmp [eax+EVENT.id], ebx |
jne .done |
test [eax+EVENT.state], EVENT_SIGNALED |
jz .switch |
test [eax+EVENT.state], MANUAL_RESET |
jnz .done |
mov edx,[current_slot] |
pushfd |
cli ;remove event from events |
mov ebx, [eax+APPOBJ.fd] ;list (reset event) |
mov ecx, [eax+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
dec [edx+APPDATA.ev_count] |
jnz @F |
and [edx+APPDATA.event_mask], not EVENT_EXTENDED |
@@: |
and [eax+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
popfd |
test [eax+EVENT.state], MANUAL_DESTROY |
jz .destroy |
add edx, APP_OBJ_OFFSET |
pushfd |
cli |
mov ecx, [edx+APPOBJ.fd] ;insert event into |
mov [eax+APPOBJ.fd], ecx ;objects list |
mov [eax+APPOBJ.bk], edx |
mov [edx+APPOBJ.fd], eax |
mov [ecx+APPOBJ.bk], eax |
popfd |
.done: |
add esp, 4 |
ret |
.destroy: |
call destroy_event.force |
add esp, 4 |
ret |
.switch: |
or [eax+EVENT.state], EVENT_WATCHED |
mov eax, [TASK_BASE] |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
mov eax, [.event] |
jmp .wait |
restore .event |
; param |
; eax= event |
; ebx= id |
; ecx= flags |
; edx= event data |
raise_event: |
.event equ esp |
push eax |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
mov eax, [eax+APPOBJ.pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
mov esi, edx |
test esi, esi |
mov edx, [.event] |
jz @F |
push ecx |
lea edi, [edx+EVENT.code] |
mov ecx, 6 |
cld |
rep movsd |
pop ecx |
@@: |
test [edx+EVENT.state], EVENT_SIGNALED |
jnz .done |
test ecx, EVENT_WATCHED |
jz @F |
test [edx+EVENT.state], EVENT_WATCHED |
jz .done |
@@: |
shl eax, 8 |
add eax, SLOT_BASE+APP_EV_OFFSET |
pushfd |
cli |
mov ebx, [edx+APPOBJ.fd] |
mov ecx, [edx+APPOBJ.bk] |
mov [ebx+APPOBJ.bk], ecx |
mov [ecx+APPOBJ.fd], ebx |
mov ecx, [eax+APPOBJ.fd] |
mov [edx+APPOBJ.fd], ecx |
mov [edx+APPOBJ.bk], eax |
mov [eax+APPOBJ.fd], edx |
mov [ecx+APPOBJ.bk], edx |
or [edx+EVENT.state], EVENT_SIGNALED |
inc [eax+APPDATA.ev_count-APP_EV_OFFSET] |
or [eax+APPDATA.event_mask-APP_EV_OFFSET], EVENT_EXTENDED |
popfd |
.fail: |
.done: |
add esp, 4 |
ret |
restore .event |
; param |
; eax= event |
; ebx= id |
align 4 |
clear_event: |
.event equ esp |
push eax |
cmp [eax+APPOBJ.magic], 'EVNT' |
jne .fail |
cmp [eax+EVENT.id], ebx |
jne .fail |
mov eax, [eax+APPOBJ.pid] |
call pid_to_slot |
test eax, eax |
jz .fail |
shl eax, 8 |
add eax, SLOT_BASE+APP_EV_OFFSET |
mov edx, [.event] |
pushfd |
cli ;remove event from events |
mov ebx, [edx+APPOBJ.fd] ;list (reset event) |
mov ecx, [edx+APPOBJ.bk] ;and clear events flag |
mov [ebx+APPOBJ.bk], ecx ;if no active events |
mov [ecx+APPOBJ.fd], ebx |
and [edx+EVENT.state], not (EVENT_SIGNALED+EVENT_WATCHED) |
dec [eax+APPDATA.ev_count-APP_EV_OFFSET] |
jnz @F |
and [eax+APPDATA.event_mask-APP_EV_OFFSET], not EVENT_EXTENDED |
@@: |
add eax, (APP_OBJ_OFFSET-APP_EV_OFFSET) |
mov ecx, [eax+APPOBJ.fd] ;insert event into |
mov [edx+APPOBJ.fd], ecx ;objects list |
mov [edx+APPOBJ.bk], eax |
mov [eax+APPOBJ.fd], edx |
mov [ecx+APPOBJ.bk], edx |
popfd |
.fail: |
.done: |
add esp, 4 |
ret |
restore .event |
sys_getevent: |
call get_event_for_app |
mov [esp + 32],eax |
ret |
sys_waitforevent: |
or ebx, 0xFFFFFFFF ; infinite timeout |
jmp @f |
sys_wait_event_timeout: |
add ebx, [timer_ticks] |
@@: |
mov eax, [current_slot] |
mov [eax + APPDATA.wait_timeout], ebx |
call get_event_for_app |
test eax, eax |
jnz eventoccur |
mov eax, [TASK_BASE] |
mov [eax+TASKDATA.state], byte 5 |
call change_task |
mov eax, [event_sched] |
eventoccur: |
mov [esp+32], eax |
ret |
sys_sendwindowmsg: |
dec eax |
jnz .ret |
cmp ebx, 3 |
jz .sendbtn |
cmp ebx, 2 |
jnz .ret |
.sendkey: |
pushf |
cli |
movzx eax, byte [KEY_COUNT] |
cmp al, 120 |
jae .overflow |
inc eax |
mov [KEY_COUNT], al |
mov [KEY_COUNT+eax], cl |
jmp .ok |
.overflow: |
popf |
mov dword [esp+36], 1 |
ret |
.sendbtn: |
pushf |
cli |
cmp byte [BTN_COUNT], 0 |
jnz .overflow |
mov byte [BTN_COUNT], 1 |
mov [BTN_BUFF], ecx |
.ok: |
popf |
and dword [esp+36], 0 |
.ret: |
ret |
get_event_for_app: |
pushad |
mov edi,[TASK_BASE] ; WINDOW REDRAW |
test [edi+TASKDATA.event_mask], 1 |
jz no_eventoccur1 |
;mov edi,[TASK_BASE] |
cmp [edi-twdw+WDATA.fl_redraw],byte 0 |
je no_eventoccur1 |
popad |
mov eax,1 |
ret |
no_eventoccur1: |
;mov edi,[TASK_BASE] ; KEY IN BUFFER |
test [edi+TASKDATA.event_mask],dword 2 |
jz no_eventoccur2 |
mov ecx, [CURRENT_TASK] |
movzx edx,word [WIN_STACK+ecx*2] |
mov eax, [TASK_COUNT] |
cmp eax,edx |
jne no_eventoccur2x |
cmp [KEY_COUNT],byte 0 |
je no_eventoccur2x |
eventoccur2: |
popad |
mov eax,2 |
ret |
no_eventoccur2x: |
mov eax, hotkey_buffer |
@@: |
cmp [eax], ecx |
jz eventoccur2 |
add eax, 8 |
cmp eax, hotkey_buffer+120*8 |
jb @b |
no_eventoccur2: |
;mov edi,[TASK_BASE] ; BUTTON IN BUFFER |
test [edi+TASKDATA.event_mask],dword 4 |
jz no_eventoccur3 |
cmp [BTN_COUNT],byte 0 |
je no_eventoccur3 |
mov ecx, [CURRENT_TASK] |
movzx edx, word [WIN_STACK+ecx*2] |
mov eax, [TASK_COUNT] |
cmp eax,edx |
jnz no_eventoccur3 |
popad |
mov eax,[BTN_BUFF] |
cmp eax,65535 |
je no_event_1 |
mov eax,3 |
ret |
no_event_1: |
mov [window_minimize],1 |
mov [BTN_COUNT],byte 0 |
xor eax, eax |
ret |
no_eventoccur3: |
;mov edi,[TASK_BASE] ; mouse event |
mov eax, [CURRENT_TASK] |
shl eax, 8 |
add eax, SLOT_BASE |
test [edi+TASKDATA.event_mask],dword 00100000b |
jz no_mouse_event |
test [eax+APPDATA.event_mask],dword 00100000b |
jz no_mouse_event |
and [eax+APPDATA.event_mask],dword (not 00100000b) |
popad |
mov eax,6 |
ret |
no_mouse_event: |
;mov edi,[TASK_BASE] ; DESKTOP BACKGROUND REDRAW |
test [edi+TASKDATA.event_mask], 16 |
jz no_eventoccur5 |
; cmp [REDRAW_BACKGROUND],byte 2 |
; jnz no_eventoccur5 |
test [eax+APPDATA.event_mask], 16 |
jz no_eventoccur5 |
and [eax+APPDATA.event_mask], not 16 |
popad |
mov eax,5 |
ret |
no_eventoccur5: |
;mov edi,[TASK_BASE] ; IPC |
test [edi+TASKDATA.event_mask],dword 01000000b |
jz no_ipc |
test [eax+APPDATA.event_mask],dword 01000000b |
jz no_ipc |
and [eax+APPDATA.event_mask],dword 0xffffffff-01000000b |
popad |
mov eax,7 |
ret |
no_ipc: |
;mov edi,[TASK_BASE] ; STACK |
test [edi+TASKDATA.event_mask],dword 10000000b |
jz no_stack_event |
test [eax+APPDATA.event_mask],dword 10000000b |
jz no_stack_event |
and [eax+APPDATA.event_mask],dword 0xffffffff-10000000b |
popad |
mov eax,8 |
ret |
no_stack_event: |
test byte [edi+TASKDATA.event_mask+1], 1 ; DEBUG |
jz .test_IRQ |
test byte [eax+APPDATA.event_mask+1], byte 1 |
jz .test_IRQ |
and byte [eax+APPDATA.event_mask+1], not 1 |
popad |
mov eax, 9 |
ret |
;.test_ext: |
; mov eax, [CURRENT_TASK] |
; shl eax, 8 |
; test dword [eax+SLOT_BASE+APPDATA.event_mask], EVENT_EXTENDED |
; jz .test_IRQ |
; popad |
; mov eax, 10 |
; ret |
.test_IRQ: |
cmp dword [edi+TASKDATA.event_mask], 0xFFFF |
jbe no_events |
mov esi,IRQ_SAVE ; IRQ'S AND DATA |
mov ebx,0x00010000 |
xor ecx, ecx |
irq_event_test: |
mov edi,[TASK_BASE] |
test [edi+TASKDATA.event_mask],ebx |
jz no_irq_event |
mov edi,ecx |
shl edi,2 |
add edi,irq_owner |
mov edx,[edi] |
mov eax,[TASK_BASE] |
mov eax,[eax+TASKDATA.pid] |
cmp edx,eax |
jne no_irq_event |
cmp [esi],dword 0 |
jz no_irq_event |
mov eax,ecx |
add eax,16 |
mov [esp+28],eax |
popad |
ret |
no_irq_event: |
add esi,0x1000 |
shl ebx,1 |
inc ecx |
cmp ecx,16 |
jb irq_event_test |
no_events: |
popad |
xor eax, eax |
ret |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/mouse.inc |
---|
0,0 → 1,250 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; |
;; Distributed under terms of the GNU General Public License ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
iglobal |
align 4 |
mousepointer: |
db 0x00,0x00,0x00,0x74,0x74,0x74,0x6e,0x6e,0x6e,0x6f |
db 0x6f,0x6f,0x71,0x71,0x71,0x75,0x75,0x75,0x79,0x79 |
db 0x79,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63 |
db 0x66,0x66,0x66,0x6c,0x6c,0x6c,0x72,0x72,0x72,0x78 |
db 0x78,0x78,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0 |
db 0xc0,0xc0,0x00,0x00,0x00,0x54,0x54,0x54,0x57,0x57 |
db 0x57,0x5f,0x5f,0x5f,0x68,0x68,0x68,0x71,0x71,0x71 |
db 0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0x00,0x00,0x00,0x47,0x47,0x47,0x50 |
db 0x50,0x50,0x5b,0x5b,0x5b,0x67,0x67,0x67,0x70,0x70 |
db 0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0xff,0xff,0xff,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x3f,0x3f,0x3f |
db 0x4b,0x4b,0x4b,0x59,0x59,0x59,0x66,0x66,0x66,0x70 |
db 0x70,0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e |
db 0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x3a,0x3a |
db 0x3a,0x49,0x49,0x49,0x59,0x59,0x59,0x66,0x66,0x66 |
db 0x70,0x70,0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e |
db 0x7e,0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x39 |
db 0x39,0x39,0x49,0x49,0x49,0x59,0x59,0x59,0x66,0x66 |
db 0x66,0x71,0x71,0x71,0x78,0x78,0x78,0x7c,0x7c,0x7c |
db 0x7e,0x7e,0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00 |
db 0x39,0x39,0x39,0x4a,0x4a,0x4a,0x5a,0x5a,0x5a,0x68 |
db 0x68,0x68,0x72,0x72,0x72,0x79,0x79,0x79,0x7d,0x7d |
db 0x7d,0x7f,0x7f,0x7f,0x80,0x80,0x80,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00 |
db 0x00,0x3c,0x3c,0x3c,0x4e,0x4e,0x4e,0x5e,0x5e,0x5e |
db 0x6b,0x6b,0x6b,0x75,0x75,0x75,0x7a,0x7a,0x7a,0x7e |
db 0x7e,0x7e,0x80,0x80,0x80,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00 |
db 0x00,0x00,0x43,0x43,0x43,0x55,0x55,0x55,0x64,0x64 |
db 0x64,0x70,0x70,0x70,0x78,0x78,0x78,0x7d,0x7d,0x7d |
db 0x80,0x80,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xc0 |
db 0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x4e,0x4e,0x4e,0x5f,0x5f,0x5f,0x6d |
db 0x6d,0x6d,0x76,0x76,0x76,0x7c,0x7c,0x7c,0x80,0x80 |
db 0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00 |
db 0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x14 |
db 0x14,0x14,0x1b,0x1b,0x1b,0x29,0x29,0x29,0x3a,0x3a |
db 0x3a,0x4c,0x4c,0x4c,0x5d,0x5d,0x5d,0x6c,0x6c,0x6c |
db 0x75,0x75,0x75,0x7b,0x7b,0x7b,0x80,0x80,0x80,0xc0 |
db 0xc0,0xc0,0x00,0x00,0x00,0x2f,0x2f,0x2f,0x80,0x80 |
db 0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00 |
db 0x21,0x21,0x21,0x2e,0x2e,0x2e,0x40,0x40,0x40,0x52 |
db 0x52,0x52,0x62,0x62,0x62,0x6f,0x6f,0x6f,0x77,0x77 |
db 0x77,0x7c,0x7c,0x7c,0x80,0x80,0x80,0x00,0x00,0x00 |
db 0x47,0x47,0x47,0x3b,0x3b,0x3b,0x80,0x80,0x80,0xff |
db 0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x25,0x25 |
db 0x25,0x30,0x30,0x30,0x42,0x42,0x42,0x54,0x54,0x54 |
db 0x64,0x64,0x64,0x70,0x70,0x70,0x78,0x78,0x78,0x7d |
db 0x7d,0x7d,0x00,0x00,0x00,0x62,0x62,0x62,0x52,0x52 |
db 0x52,0x4a,0x4a,0x4a,0x43,0x43,0x43,0x80,0x80,0x80 |
db 0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x33 |
db 0x33,0x33,0x42,0x42,0x42,0x54,0x54,0x54,0x64,0x64 |
db 0x64,0x71,0x71,0x71,0x79,0x79,0x79,0x7d,0x7d,0x7d |
db 0x72,0x72,0x72,0x6b,0x6b,0x6b,0x5f,0x5f,0x5f,0x5a |
db 0x5a,0x5a,0x54,0x54,0x54,0x80,0x80,0x80,0xff,0xff |
db 0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x35,0x35,0x35 |
db 0x41,0x41,0x41,0x53,0x53,0x53,0x63,0x63,0x63,0x70 |
db 0x70,0x70,0x78,0x78,0x78,0x7d,0x7d,0x7d,0x77,0x77 |
db 0x77,0x73,0x73,0x73,0x6c,0x6c,0x6c,0x68,0x68,0x68 |
db 0x62,0x62,0x62,0x5a,0x5a,0x5a,0x80,0x80,0x80,0xff |
db 0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x41,0x41 |
db 0x41,0x52,0x52,0x52,0x62,0x62,0x62,0x6f,0x6f,0x6f |
db 0x78,0x78,0x78,0x7d,0x7d,0x7d,0x7b,0x7b,0x7b,0x79 |
db 0x79,0x79,0x74,0x74,0x74,0x72,0x72,0x72,0x6e,0x6e |
db 0x6e,0x66,0x66,0x66,0x80,0x80,0x80,0xc0,0xc0,0xc0 |
db 0xc0,0xc0,0xc0,0x00,0x00,0x00,0x44,0x44,0x44,0x52 |
db 0x52,0x52,0x62,0x62,0x62,0x6e,0x6e,0x6e,0x77,0x77 |
db 0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x7c,0x7c,0x7c |
db 0x7a,0x7a,0x7a,0x79,0x79,0x79,0x75,0x75,0x75,0x6f |
db 0x6f,0x6f,0x65,0x65,0x65,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x48,0x48,0x48,0x4b,0x4b,0x4b,0x56,0x56,0x56 |
db 0x65,0x65,0x65,0x70,0x70,0x70,0x78,0x78,0x78,0x7d |
db 0x7d,0x7d,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7e,0x7e |
db 0x7e,0x7d,0x7d,0x7d,0x7a,0x7a,0x7a,0x76,0x76,0x76 |
db 0x6f,0x6f,0x6f,0x65,0x65,0x65,0x5c,0x5c,0x5c,0x56 |
db 0x56,0x56,0x58,0x58,0x58,0x60,0x60,0x60,0x6b,0x6b |
db 0x6b,0x73,0x73,0x73,0x7a,0x7a,0x7a,0x7d,0x7d,0x7d |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f |
db 0x7f,0x7f,0x7d,0x7d,0x7d,0x7a,0x7a,0x7a,0x76,0x76 |
db 0x76,0x70,0x70,0x70,0x6a,0x6a,0x6a,0x66,0x66,0x66 |
db 0x66,0x66,0x66,0x6c,0x6c,0x6c,0x72,0x72,0x72,0x78 |
db 0x78,0x78,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b,0x7b,0x7b,0x77 |
db 0x77,0x77,0x73,0x73,0x73,0x71,0x71,0x71,0x71,0x71 |
db 0x71,0x74,0x74,0x74,0x78,0x78,0x78,0x7b,0x7b,0x7b |
db 0x7d,0x7d,0x7d,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c |
db 0x7a,0x7a,0x7a,0x78,0x78,0x78,0x78,0x78,0x78,0x7a |
db 0x7a,0x7a,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x7f,0x7f |
db 0x7f,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80 |
db 0x80,0x80,0x7f,0x7f,0x7f,0x7e,0x7e,0x7e,0x7e,0x7e |
db 0x7e,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e |
db 0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80 |
db 0x80,0x80 |
mousepointer1: |
db 0xff,0xff,0xff,0x06,0x06,0x06,0x0a,0x0a |
db 0x0a,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0xff,0xff,0xff,0xff,0xff,0xff,0x19,0x19,0x19,0x16 |
db 0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2e,0x2e,0x2e |
db 0x23,0x23,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f |
db 0x3f,0x29,0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x47 |
db 0x47,0x47,0x2c,0x2c,0x2c,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0x48,0x48,0x48,0x2c,0x2c,0x2c,0x16,0x16,0x16,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x16,0x16,0x16 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0x47,0x47,0x47,0x29,0x29,0x29 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0x40,0x40,0x40,0x23,0x23 |
db 0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xaa,0xaa,0xaa,0x9f,0x9f,0x9f,0x8c,0x8c,0x8c |
db 0x70,0x70,0x70,0x4f,0x4f,0x4f,0x30,0x30,0x30,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x8f,0x8f,0x8f |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0xff,0x9c,0x9c,0x9c,0x87,0x87,0x87,0x6c,0x6c |
db 0x6c,0x4f,0x4f,0x4f,0x32,0x32,0x32,0x19,0x19,0x19 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff |
db 0xff,0xff,0x69,0x69,0x69,0x84,0x84,0x84,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0x92,0x92,0x92,0x79,0x79,0x79,0x59,0x59,0x59,0x3c |
db 0x3c,0x3c,0x24,0x24,0x24,0x11,0x11,0x11,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x37,0x37,0x37 |
db 0x5d,0x5d,0x5d,0x70,0x70,0x70,0x76,0x76,0x76,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0xff,0x75,0x75,0x75,0x51,0x51,0x51,0x31,0x31,0x31 |
db 0x19,0x19,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x16,0x16,0x16,0x2d,0x2d,0x2d,0x49,0x49 |
db 0x49,0x53,0x53,0x53,0x54,0x54,0x54,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x78 |
db 0x78,0x78,0x54,0x54,0x54,0x30,0x30,0x30,0x16,0x16 |
db 0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x0f,0x0f,0x0f,0x1f,0x1f,0x1f,0x30,0x30,0x30,0x33 |
db 0x33,0x33,0x33,0x33,0x33,0x3b,0x3b,0x3b,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff |
db 0x62,0x62,0x62,0x3b,0x3b,0x3b,0x1c,0x1c,0x1c,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08 |
db 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x24,0x24,0x24,0xff,0xff,0xff,0xff |
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6e,0x6e |
db 0x6e,0x48,0x48,0x48,0x25,0x25,0x25,0x0e,0x0e,0x0e |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00 |
db 0x00,0x00,0x0a,0x0a,0x0a,0x09,0x09,0x09,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x29,0x29,0x29,0xff,0xff,0xff |
db 0xff,0xff,0xff,0x7c,0x7c,0x7c,0x71,0x71,0x71,0x50 |
db 0x50,0x50,0x2b,0x2b,0x2b,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x02,0x02,0x02,0x04,0x04,0x04,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x36,0x56,0x56 |
db 0x56,0x69,0x69,0x69,0x64,0x64,0x64,0x4a,0x4a,0x4a |
db 0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x05,0x05,0x05 |
db 0x00,0x00,0x00,0x21,0x21,0x21,0x39,0x39,0x39,0x49 |
db 0x49,0x49,0x48,0x48,0x48,0x35,0x35,0x35,0x1d,0x1d |
db 0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x1d,0x1d,0x1d,0x27,0x27,0x27 |
db 0x27,0x27,0x27,0x1d,0x1d,0x1d,0x0f,0x0f,0x0f,0x06 |
db 0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 |
db 0x00,0x00,0x00,0x00 |
endg |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/skincode.inc |
---|
0,0 → 1,467 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
include "skindata.inc" |
;skin_data = 0x00778000 |
read_skin_file: |
stdcall load_file, ebx |
test eax, eax |
jz .notfound |
cmp dword [eax], 'SKIN' |
jnz .noskin |
cmp ebx, 32*1024 |
jb @f |
mov ebx, 32*1024 |
@@: |
lea ecx, [ebx+3] |
shr ecx, 2 |
mov esi, eax |
mov edi, skin_data |
rep movsd |
stdcall kernel_free, eax |
call parse_skin_data |
xor eax, eax |
ret |
.notfound: |
xor eax, eax |
inc eax |
ret |
.noskin: |
stdcall kernel_free, eax |
push 2 |
pop eax |
ret |
struct SKIN_HEADER |
.ident dd ? |
.version dd ? |
.params dd ? |
.buttons dd ? |
.bitmaps dd ? |
ends |
struct SKIN_PARAMS |
.skin_height dd ? |
.margin.right dw ? |
.margin.left dw ? |
.margin.bottom dw ? |
.margin.top dw ? |
.colors.inner dd ? |
.colors.outer dd ? |
.colors.frame dd ? |
.colors_1.inner dd ? |
.colors_1.outer dd ? |
.colors_1.frame dd ? |
.dtp.size dd ? |
.dtp.data db 40 dup (?) |
ends |
struct SKIN_BUTTONS |
.type dd ? |
.pos: |
.left dw ? |
.top dw ? |
.size: |
.width dw ? |
.height dw ? |
ends |
struct SKIN_BITMAPS |
.kind dw ? |
.type dw ? |
.data dd ? |
ends |
load_default_skin: |
mov [_skinh],22 |
mov ebx,_skin_file_default |
call read_skin_file |
ret |
parse_skin_data: |
mov ebp,skin_data |
cmp [ebp+SKIN_HEADER.ident],'SKIN' |
jne .exit |
mov edi,skin_udata |
mov ecx,(skin_udata.end-skin_udata)/4 |
xor eax,eax |
cld |
rep stosd |
mov ebx,[ebp+SKIN_HEADER.params] |
add ebx,skin_data |
mov eax,[ebx+SKIN_PARAMS.skin_height] |
mov [_skinh],eax |
mov eax,[ebx+SKIN_PARAMS.colors.inner] |
mov [skin_active.colors.inner],eax |
mov eax,[ebx+SKIN_PARAMS.colors.outer] |
mov [skin_active.colors.outer],eax |
mov eax,[ebx+SKIN_PARAMS.colors.frame] |
mov [skin_active.colors.frame],eax |
mov eax,[ebx+SKIN_PARAMS.colors_1.inner] |
mov [skin_inactive.colors.inner],eax |
mov eax,[ebx+SKIN_PARAMS.colors_1.outer] |
mov [skin_inactive.colors.outer],eax |
mov eax,[ebx+SKIN_PARAMS.colors_1.frame] |
mov [skin_inactive.colors.frame],eax |
lea esi,[ebx+SKIN_PARAMS.dtp.data] |
mov edi,common_colours |
mov ecx,[ebx+SKIN_PARAMS.dtp.size] |
and ecx,127 |
rep movsb |
mov eax,dword[ebx+SKIN_PARAMS.margin.right] |
mov dword[_skinmargins+0],eax |
mov eax,dword[ebx+SKIN_PARAMS.margin.bottom] |
mov dword[_skinmargins+4],eax |
mov ebx,[ebp+SKIN_HEADER.bitmaps] |
add ebx,skin_data |
.lp1: cmp dword[ebx],0 |
je .end_bitmaps |
movzx eax,[ebx+SKIN_BITMAPS.kind] |
movzx ecx,[ebx+SKIN_BITMAPS.type] |
dec eax |
jnz .not_left |
xor eax,eax |
mov edx,skin_active.left.data |
or ecx,ecx |
jnz @f |
mov edx,skin_inactive.left.data |
@@: jmp .next_bitmap |
.not_left: |
dec eax |
jnz .not_oper |
mov esi,[ebx+SKIN_BITMAPS.data] |
add esi,skin_data |
mov eax,[esi+0] |
neg eax |
mov edx,skin_active.oper.data |
or ecx,ecx |
jnz @f |
mov edx,skin_inactive.oper.data |
@@: jmp .next_bitmap |
.not_oper: |
dec eax |
jnz .not_base |
mov eax,[skin_active.left.width] |
mov edx,skin_active.base.data |
or ecx,ecx |
jnz @f |
mov eax,[skin_inactive.left.width] |
mov edx,skin_inactive.base.data |
@@: jmp .next_bitmap |
.not_base: |
add ebx,8 |
jmp .lp1 |
.next_bitmap: |
mov ecx,[ebx+SKIN_BITMAPS.data] |
add ecx,skin_data |
mov [edx+4],eax |
mov eax,[ecx+0] |
mov [edx+8],eax |
add ecx,8 |
mov [edx+0],ecx |
add ebx,8 |
jmp .lp1 |
.end_bitmaps: |
mov ebx,[ebp+SKIN_HEADER.buttons] |
add ebx,skin_data |
.lp2: cmp dword[ebx],0 |
je .end_buttons |
mov eax,[ebx+SKIN_BUTTONS.type] |
dec eax |
jnz .not_close |
mov edx,skin_btn_close |
jmp .next_button |
.not_close: |
dec eax |
jnz .not_minimize |
mov edx,skin_btn_minimize |
jmp .next_button |
.not_minimize: |
add ebx,12 |
jmp .lp2 |
.next_button: |
movsx eax,[ebx+SKIN_BUTTONS.left] |
mov [edx+SKIN_BUTTON.left],eax |
movsx eax,[ebx+SKIN_BUTTONS.top] |
mov [edx+SKIN_BUTTON.top],eax |
movsx eax,[ebx+SKIN_BUTTONS.width] |
mov [edx+SKIN_BUTTON.width],eax |
movsx eax,[ebx+SKIN_BUTTONS.height] |
mov [edx+SKIN_BUTTON.height],eax |
add ebx,12 |
jmp .lp2 |
.end_buttons: |
.exit: |
ret |
sys_putimage_with_check: |
or ebx,ebx |
jz @f |
call sys_putimage.forced |
@@: ret |
drawwindow_IV_caption: |
mov ebp,skin_active |
or al,al |
jnz @f |
mov ebp,skin_inactive |
@@: |
mov esi,[esp+4] |
mov eax,[esi+WDATA.box.width] ; window width |
mov edx,[ebp+SKIN_DATA.left.left] |
shl edx,16 |
mov ecx,[ebp+SKIN_DATA.left.width] |
shl ecx,16 |
add ecx,[_skinh] |
mov ebx, [ebp+SKIN_DATA.left.data] |
call sys_putimage_with_check |
mov esi,[esp+4] |
mov eax,[esi+WDATA.box.width] |
sub eax,[ebp+SKIN_DATA.left.width] |
sub eax,[ebp+SKIN_DATA.oper.width] |
cmp eax,[ebp+SKIN_DATA.base.left] |
jng .non_base |
xor edx,edx |
mov ecx,[ebp+SKIN_DATA.base.width] |
jecxz .non_base |
div ecx |
inc eax |
mov ebx,[ebp+SKIN_DATA.base.data] |
mov ecx,[ebp+SKIN_DATA.base.width] |
shl ecx,16 |
add ecx,[_skinh] |
mov edx,[ebp+SKIN_DATA.base.left] |
sub edx,[ebp+SKIN_DATA.base.width] |
shl edx,16 |
.baseskinloop: |
shr edx,16 |
add edx,[ebp+SKIN_DATA.base.width] |
shl edx,16 |
push eax ebx ecx edx |
call sys_putimage_with_check |
pop edx ecx ebx eax |
dec eax |
jnz .baseskinloop |
.non_base: |
mov esi,[esp+4] |
mov edx,[esi+WDATA.box.width] |
sub edx,[ebp+SKIN_DATA.oper.width] |
inc edx |
shl edx,16 |
mov ebx,[ebp+SKIN_DATA.oper.data] |
mov ecx,[ebp+SKIN_DATA.oper.width] |
shl ecx,16 |
add ecx,[_skinh] |
call sys_putimage_with_check |
ret |
;//mike.dld, 2006-08-02 ] |
drawwindow_IV: |
;param1 - aw_yes |
pusha |
push edx |
mov edi,edx |
mov ebp,skin_active |
cmp byte [esp+32+4+4],0 |
jne @f |
mov ebp,skin_inactive |
@@: |
mov eax,[edi+WDATA.box.left] |
shl eax,16 |
mov ax,word [edi+WDATA.box.left] |
add ax,word [edi+WDATA.box.width] |
mov ebx,[edi+WDATA.box.top] |
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 [edi+WDATA.fl_wdrawn], 4 |
call draw_rectangle |
mov ecx,3 |
_dw3l: |
add eax,1*65536-1 |
add ebx,1*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] |
call draw_rectangle |
dec ecx |
jnz _dw3l |
mov esi,[ebp+SKIN_DATA.colors.inner] |
add eax,1*65536-1 |
add ebx,1*65536-1 |
test ax,ax |
js no_skin_add_button |
test bx,bx |
js no_skin_add_button |
call draw_rectangle |
cmp dword[skin_data],'SKIN' |
je @f |
xor eax,eax |
xor ebx,ebx |
mov esi,[esp] |
mov ecx,[esi+WDATA.box.width] |
inc ecx |
mov edx,[_skinh] |
mov edi,[common_colours+4] ; standard grab color |
call [drawbar] |
jmp draw_clientbar |
@@: |
mov al,[esp+32+4+4] |
call drawwindow_IV_caption |
draw_clientbar: |
mov esi,[esp] |
mov edx,[esi+WDATA.box.top] ; WORK AREA |
add edx,21+5 |
mov ebx,[esi+WDATA.box.top] |
add ebx,[esi+WDATA.box.height] |
cmp edx,ebx |
jg _noinside2 |
mov eax,5 |
mov ebx,[_skinh] |
mov ecx,[esi+WDATA.box.width] |
mov edx,[esi+WDATA.box.height] |
sub ecx,4 |
sub edx,4 |
mov edi,[esi+WDATA.cl_workarea] |
test edi,0x40000000 |
jnz _noinside2 |
call [drawbar] |
_noinside2: |
cmp dword[skin_data],'SKIN' |
jne no_skin_add_button |
;* close button |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,1000 |
jge no_skin_add_button |
inc eax |
mov [edi],ax |
shl eax,4 |
add eax,edi |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
add eax,2 ; save button id number |
mov bx,1 |
mov [eax],bx |
add eax,2 ; x start |
xor ebx,ebx |
cmp [skin_btn_close.left],0 |
jge _bCx_at_right |
mov ebx,[esp] |
mov ebx,[ebx+WDATA.box.width] |
inc ebx |
_bCx_at_right: |
add ebx,[skin_btn_close.left] |
mov [eax],bx |
add eax,2 ; x size |
mov ebx,[skin_btn_close.width] |
dec ebx |
mov [eax],bx |
add eax,2 ; y start |
mov ebx,[skin_btn_close.top] |
mov [eax],bx |
add eax,2 ; y size |
mov ebx,[skin_btn_close.height] |
dec ebx |
mov [eax],bx |
;* minimize button |
mov edi,[BTN_ADDR] |
movzx eax,word [edi] |
cmp eax,1000 |
jge no_skin_add_button |
inc eax |
mov [edi],ax |
shl eax,4 |
add eax,edi |
mov bx,[CURRENT_TASK] |
mov [eax],bx |
add eax,2 ; save button id number |
mov bx,65535 ;999 |
mov [eax],bx |
add eax,2 ; x start |
xor ebx,ebx |
cmp [skin_btn_minimize.left],0 |
jge _bMx_at_right |
mov ebx,[esp] |
mov ebx,[ebx+WDATA.box.width] |
inc ebx |
_bMx_at_right: |
add ebx,[skin_btn_minimize.left] |
mov [eax],bx |
add eax,2 ; x size |
mov ebx,[skin_btn_minimize.width] |
dec ebx |
mov [eax],bx |
add eax,2 ; y start |
mov ebx,[skin_btn_minimize.top] |
mov [eax],bx |
add eax,2 ; y size |
mov ebx,[skin_btn_minimize.height] |
dec ebx |
mov [eax],bx |
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 |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/skindata.inc |
---|
0,0 → 1,64 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
$Revision$ |
; |
; WINDOW SKIN DATA |
; |
iglobal |
_skin_file_default db '/sys/DEFAULT.SKN',0 |
endg |
struct SKIN_DATA |
.colors.inner dd ? |
.colors.outer dd ? |
.colors.frame dd ? |
.left.data dd ? |
.left.left dd ? |
.left.width dd ? |
.oper.data dd ? |
.oper.left dd ? |
.oper.width dd ? |
.base.data dd ? |
.base.left dd ? |
.base.width dd ? |
ends |
struct SKIN_BUTTON |
.left dd ? |
.top dd ? |
.width dd ? |
.height dd ? |
ends |
uglobal |
align 4 |
skin_udata: |
_skinh dd ? |
_skinmargins: ; rw 4 |
.right dw ? |
.left dw ? |
.bottom dw ? |
.top dw ? |
skin_btn_close SKIN_BUTTON |
skin_btn_minimize SKIN_BUTTON |
skin_active SKIN_DATA |
skin_inactive SKIN_DATA |
align 4 |
skin_udata.end: |
endg |
Property changes: |
Added: svn:keywords |
+Rev |
\ No newline at end of property |
/kernel/branches/kolibri_pe/gui/. |
---|
Property changes: |
Added: svn:ignore |
+*.mnt |
+lang.inc |
+*.bat |
+out.txt |
+scin* |
+*.obj |