/kernel/branches/Kolibri-acpi/gui/char2_et.mt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/kernel/branches/Kolibri-acpi/gui/char2.mt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/kernel/branches/Kolibri-acpi/gui/char2_sp.mt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/kernel/branches/Kolibri-acpi/gui/char.mt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/kernel/branches/Kolibri-acpi/gui/charUni.mt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/kernel/branches/Kolibri-acpi/gui/font.inc |
---|
7,230 → 7,823 |
$Revision$ |
;------------------------------------------------------------------------------ |
align 4 |
dtext_asciiz_esi: ; for skins title out |
push eax |
xor eax, eax |
inc eax |
jmp dtext.1 |
;------------------------------------------------------------------------------ |
align 4 |
dtext: |
; 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 or user area for redirect |
push eax |
; edx -> string |
; esi = number of characters |
; ebx = output coordinates XXXXYYYY h |
; ecx = char color and flags flRRGGBB h |
; fl = ZBFFRSSS b |
; Z=1: edx -> zero terminated string, esi = ? |
; B=1: fill background with color eax |
; R=1: edi -> user area for redirect |
; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16 |
; FF=1: cp866 8x16, FF=0: cp866 6x9 |
; SSS = (font multiplier)-1 |
; edi=1: force output |
and eax, 0xFFFFFF |
bt ecx, 30 |
jc @f |
xor eax, eax |
;-------------------------------------- |
align 4 |
.1: |
pushad |
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: |
dec eax |
@@: |
pushd 0 0 0 eax |
movsx eax, bx |
sar ebx, 16 |
push eax ebx edi |
bt ecx, 27 |
jc .redirect |
mov ebp, [_display.width] |
xor edi, edi |
jmp @f |
.ret: |
add esp, 28 |
ret |
.redirect: |
mov ebp, [edi] |
add edi, 8 |
@@: |
shl ebp, 2 |
imul eax, ebp |
shl ebx, 2 |
add eax, ebx |
js .ret |
add edi, eax |
mov eax, ecx |
mov ebx, ecx |
test ecx, ecx |
js .test_asciiz |
jns @f |
mov esi, 256 |
@@: |
shr ecx, 24 |
and cl, 7 |
inc ecx |
push ebp ecx esi |
mov esi, edx |
or eax, 0xFF000000 |
bt ebx, 27 |
jc .bufferReady |
mov eax, 9 |
test ebx, 0x30000000 |
jz @f |
add eax, 7 |
@@: |
imul eax, ecx |
mov [esp+32], eax |
imul ebp, eax |
stdcall kernel_alloc, ebp |
mov ecx, ebp |
shr ecx, 2 |
mov [esp+36], eax |
sub edi, eax |
mov edx, eax |
mov eax, [esp+24] |
cmp eax, -1 |
jnz @f |
mov [esp+28], edi |
@@: |
mov edi, edx |
rep stosd |
mov edi, edx |
mov eax, ebx |
and eax, 0xFFFFFF |
.bufferReady: |
mov ebp, eax |
xor edx, edx |
bt ebx, 29 |
jc @f |
bt ebx, 28 |
jc .draw866toUni |
jmp .draw866 |
@@: |
bt ebx, 28 |
jc .drawUTF8 |
dec esi |
js .end |
; ebp = font color |
; esi -> string |
; edi -> buffer |
jmp @f |
;-------------------------------------- |
align 4 |
.test_asciiz: |
cmp byte [edx], 0 |
jz .end |
; Stack map: |
; char counter +0 |
fontMultiplier = 4 |
widthX = 8 |
; edi +12 |
; X +16 |
; Y +20 |
; background +24 |
deltaToScreen = 28 |
; temp buffer height +32 |
; temp buffer pointer +36 |
cmp byte [esp+28], 1 |
jne @f |
.drawUTF16: |
dec dword [esp] |
js .done |
movzx ebx, word [esi] |
test ebx, ebx |
jz .done |
inc esi |
inc esi |
cmp bx, 1419 |
jc @f |
xor ebx, ebx |
@@: |
pushd esi edi 16 |
shl ebx, 4 |
add ebx, fontUni |
mov esi, [esp+12+fontMultiplier] |
call drawChar |
imul esi, 8*4 |
pop edi |
pop edi |
add edi, esi |
pop esi |
jmp .drawUTF16 |
dec esi |
js .end |
;-------------------------------------- |
align 4 |
.drawUTF8: |
dec dword [esp] |
js .done |
@@: |
inc edx |
pushad |
movzx edx, byte [edx-1] |
test ecx, 0x10000000 |
jnz .font2 |
movzx ebx, byte [esi] |
inc esi |
test bl, bl |
jz .done |
jns .valid |
shl bx, 10 |
jnc @b |
mov bl, [esi] |
test bl, bl |
jns @b |
shl bl, 2 |
jc @b |
shr bh, 2 |
shr bx, 2 |
inc esi |
cmp bx, 1419 |
jc .valid |
shl bh, 4 |
jns @f |
.tail: |
mov bl, [esi] |
shl bl, 1 |
jnc @b |
js @b |
inc esi |
shl bh, 1 |
js .tail |
@@: |
xor ebx, ebx |
.valid: |
pushd esi edi 16 |
shl ebx, 4 |
add ebx, fontUni |
mov esi, [esp+12+fontMultiplier] |
call drawChar |
imul esi, 8*4 |
pop edi |
pop edi |
add edi, esi |
pop esi |
jmp .drawUTF8 |
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 |
.draw866: |
dec dword [esp] |
js .done |
movzx ebx, byte [esi] |
test ebx, ebx |
jz .done |
inc esi |
pushd esi edi 9 |
lea ebx, [ebx*8+ebx+font1] |
mov esi, [esp+12+fontMultiplier] |
call drawChar |
imul esi, 6*4 |
pop edi |
pop edi |
add edi, esi |
pop esi |
jmp .draw866 |
jnc .nopix |
.draw866toUni: |
dec dword [esp] |
js .done |
movzx eax, byte [esi] |
test eax, eax |
jz .done |
call ansi2uni_char |
shl eax, 4 |
lea ebx, [eax+fontUni] |
inc esi |
pushd esi edi 16 |
mov esi, [esp+12+fontMultiplier] |
call drawChar |
imul esi, 8*4 |
pop edi |
pop edi |
add edi, esi |
pop esi |
jmp .draw866toUni |
test ecx, 0x08000000 ; redirect the output to the user area |
jz @f |
.done: |
mov ecx, edi |
pop eax eax eax esi edx ebx ebp ebp ebp |
mov edi, [esp] |
test edi, edi |
jnz @f |
pop eax |
ret |
@@: ; redraw from buffer to screen |
push eax |
sub ecx, edi |
shr ecx, 2 |
add edx, ecx |
inc ecx |
push ecx |
push edi |
.drawPicture: |
mov eax, -1 |
repz scasd |
jcxz @f |
mov eax, edx |
sub eax, ecx |
push ecx |
mov ecx, [edi-4] |
xchg esi, edi |
call __sys_putpixel |
xchg esi, edi |
pop ecx |
jmp .drawPicture |
@@: |
pop edi |
mov ecx, [esp] |
add edi, [esp+4] |
inc ebx |
push edi |
dec ebp |
jnz .drawPicture |
add esp, 12 |
call kernel_free |
ret |
call draw_text_to_user_area |
jmp .pixloop1cont |
;-------------------------------------- |
align 4 |
; scaling/smoothing algorithm |
drawChar: |
; ebp = font color |
; esi = font multiplier |
; edi -> buffer |
; ebx -> char data |
mov dl, [ebx] |
.raw: |
bsf eax, edx |
jz .nextRaw |
imul eax, esi |
shl eax, 2 |
push edi |
add edi, eax |
mov ecx, esi |
dec esi |
jnz .square |
mov [edi], ebp |
inc esi |
cmp [fontSmoothing], 0 |
jz .nextPixel |
.checkLeftSM: ; smoothing |
bsf eax, edx |
dec eax |
js .checkRightSM |
bt [ebx], eax |
jc .checkRightSM |
dec eax |
js .checkLeftDownSM |
bt [ebx], eax |
jc .checkRightSM |
.checkLeftDownSM: |
inc eax |
bt [ebx+1], eax |
jnc .checkLeftUpSM |
inc eax |
bt [ebx+1], eax |
jnc @f |
bt [ebx-1], eax |
jc .checkRightSM |
dec eax |
dec eax |
js @f |
bt [ebx+1], eax |
jnc @f |
inc eax |
.checkLeftUpSM: |
bt [ebx-1], eax |
jnc .checkRightSM |
inc eax |
bt [ebx-1], eax |
jnc @f |
bt [ebx+1], eax |
jc .checkRightSM |
dec eax |
dec eax |
js @f |
bt [ebx-1], eax |
jc .checkRightSM |
@@: |
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
; call [putpixel] |
call __sys_putpixel |
jmp .pixloop1cont |
;-------------------------------------- |
align 4 |
.nopix: |
test ecx, 0x40000000 |
jz .pixloop1cont |
mov ecx, [esp+20+deltaToScreen] |
mov eax, [edi-4] |
test ecx, ecx |
jz @f |
pusha |
lea ebx, [edi+ecx-4] |
shr ebx, 2 |
call syscall_getpixel |
popa |
@@: |
push ebx edx |
mov ebx, ebp |
xor ecx, ecx |
cmp [fontSmoothing], 1 |
jnz .subpixelLeft |
call antiAliasing |
jmp @f |
.subpixelLeft: |
mov cl, bl |
lea edx, [ecx*8+ecx] |
lea edx, [ecx*2+edx] |
mov cl, al |
lea ecx, [ecx*4+ecx] |
add edx, ecx |
shr edx, 4 |
mov al, dl |
push ecx |
mov ecx, [esp+4+20h+20h] |
xor ecx, ecx |
mov cl, ah |
lea edx, [ecx*8+ecx] |
lea edx, [ecx*2+edx] |
mov cl, bh |
lea ecx, [ecx*4+ecx] |
add edx, ecx |
shr edx, 4 |
mov ah, dl |
test ecx, 0x08000000 ; redirect the output to the user area |
rol eax, 16 |
rol ebx, 16 |
xor ecx, ecx |
mov cl, al |
mov edx, ecx |
shl ecx, 3 |
sub ecx, edx |
mov dl, bl |
add ecx, edx |
shr ecx, 3 |
mov al, cl |
rol eax, 16 |
@@: |
mov [edi-4], eax |
pop edx ebx |
.checkRightSM: |
bsf eax, edx |
inc eax |
bt [ebx], eax |
jc .nextPixel |
inc eax |
bt [ebx], eax |
jc .nextPixel |
dec eax |
.checkRightDownSM: |
bt [ebx+1], eax |
jnc .checkRightUpSM |
dec eax |
bt [ebx+1], eax |
jnc @f |
bt [ebx-1], eax |
jc .nextPixel |
inc eax |
inc eax |
bt [ebx+1], eax |
jnc @f |
dec eax |
.checkRightUpSM: |
bt [ebx-1], eax |
jnc .nextPixel |
dec eax |
bt [ebx-1], eax |
jnc @f |
bt [ebx+1], eax |
jc .nextPixel |
inc eax |
inc eax |
bt [ebx-1], eax |
jc .nextPixel |
@@: |
mov ecx, [esp+20+deltaToScreen] |
mov eax, [edi+4] |
test ecx, ecx |
jz @f |
pusha |
lea ebx, [edi+ecx+4] |
shr ebx, 2 |
call syscall_getpixel |
popa |
@@: |
push ebx edx |
mov ebx, ebp |
xor ecx, ecx |
cmp [fontSmoothing], 1 |
jnz .subpixelRight |
call antiAliasing |
jmp @f |
.subpixelRight: |
mov cl, al |
mov edx, ecx |
shl ecx, 3 |
sub ecx, edx |
mov dl, bl |
add ecx, edx |
shr ecx, 3 |
mov al, cl |
call draw_text_to_user_area |
pop ecx |
jmp .pixloop1cont |
;-------------------------------------- |
align 4 |
xor ecx, ecx |
mov cl, ah |
lea edx, [ecx*8+ecx] |
lea edx, [ecx*2+edx] |
mov cl, bh |
lea ecx, [ecx*4+ecx] |
add edx, ecx |
shr edx, 4 |
mov ah, dl |
rol ebx, 16 |
rol eax, 16 |
xor ecx, ecx |
mov cl, bl |
lea edx, [ecx*8+ecx] |
lea edx, [ecx*2+edx] |
mov cl, al |
lea ecx, [ecx*4+ecx] |
add edx, ecx |
shr edx, 4 |
mov al, dl |
rol eax, 16 |
@@: |
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
; call [putpixel] |
call __sys_putpixel |
pop ecx |
;-------------------------------------- |
align 4 |
.pixloop1cont: |
mov [edi+4], eax |
pop edx ebx |
jmp .nextPixel |
.square: ; scaling |
mov eax, esi |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
dec ecx |
jnz .square |
inc esi |
mov edi, [esp] |
.checkLeft: |
bsf eax, edx |
dec eax |
js .checkRight |
bt [ebx], eax |
jc .checkRight |
.checkLeftDown: |
bt [ebx+1], eax |
jnc .checkLeftUp |
mov ecx, eax |
inc eax |
jmp .pixloop1 |
;-------------------------------------- |
align 4 |
.pixloop1end: |
sub eax, 6 |
inc ebx |
inc ebp |
bt [ebx+1], eax |
jc @f |
bt [ebx-1], eax |
jnc .downRightLow |
bt [ebx-2], eax |
jc .downRightLow |
dec eax |
bt [ebx-1], eax |
jc .downRightLow |
dec eax |
js .downRightHigh |
bt [ebx-2], eax |
jc .downRightLow |
jmp .downRightHigh |
@@: |
bt [ebx-1], eax |
jc .checkLeftUp |
dec eax |
dec eax |
js .downRightLow |
bt [ebx+1], eax |
jc .checkLeftUp |
.downRightLow: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
dec esi |
jnz .symloop1 |
mov eax, [esp+20+widthX] |
imul eax, esi |
add edi, eax |
add edi, 4 |
mov ecx, esi |
dec ecx |
.drawDownRight: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
add edi, 4 |
dec ecx |
jns .drawDownRight |
inc esi |
mov edi, [esp] |
jmp .checkLeftUp |
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 |
.downRightHigh: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
dec esi |
mov eax, [esp+20+widthX] |
imul eax, esi |
add edi, eax |
add edi, 4 |
mov ecx, esi |
dec ecx |
.drawDownRightHigh: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
add edi, 4 |
dec ecx |
jns .drawDownRightHigh |
inc esi |
mov edi, [esp] |
.checkLeftUp: |
bsf eax, edx |
dec eax |
bt [ebx-1], eax |
jnc .checkRight |
mov ecx, eax |
inc eax |
bt [ebx-1], eax |
jc @f |
bt [ebx+1], eax |
jnc .upRightLow |
bt [ebx+2], eax |
jc .upRightLow |
dec eax |
bt [ebx+1], eax |
jc .upRightLow |
dec eax |
js .upRightHigh |
bt [ebx+2], eax |
jc .upRightLow |
jmp .upRightHigh |
test ecx, 0x08000000 ; redirect the output to the user area |
jz @f |
@@: |
bt [ebx+1], eax |
jc .checkRight |
dec eax |
dec eax |
js .upRightLow |
bt [ebx-1], eax |
jc .checkRight |
.upRightLow: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
add edi, 4 |
mov ecx, esi |
dec ecx |
dec ecx |
.drawUpRight: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
add edi, 4 |
dec ecx |
jns .drawUpRight |
mov edi, [esp] |
jmp .checkRight |
call draw_text_to_user_area |
jmp .pixloop2cont |
;-------------------------------------- |
align 4 |
.upRightHigh: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
add edi, 4 |
mov ecx, esi |
dec ecx |
dec ecx |
.drawUpRightHigh: |
mov eax, ecx |
@@: |
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
; call [putpixel] |
call __sys_putpixel |
jmp .pixloop2cont |
;-------------------------------------- |
align 4 |
.nopix2: |
test ecx, 0x40000000 |
jz .pixloop2cont |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
add edi, 4 |
dec ecx |
jns .drawUpRightHigh |
mov edi, [esp] |
.checkRight: |
bsf eax, edx |
inc eax |
bt [ebx], eax |
jc .nextPixel |
.checkRightDown: |
bt [ebx+1], eax |
jnc .checkRightUp |
mov ecx, eax |
dec eax |
bt [ebx+1], eax |
jc @f |
bt [ebx-1], eax |
jnc .downLeftLow |
bt [ebx-2], eax |
jc .downLeftLow |
inc eax |
bt [ebx-1], eax |
jc .downLeftLow |
inc eax |
bt [ebx-2], eax |
jc .downLeftLow |
jmp .downLeftHigh |
push ecx |
mov ecx, [esp+12+20h+20h] |
@@: |
bt [ebx-1], eax |
jc .checkRightUp |
inc eax |
inc eax |
bt [ebx+1], eax |
jc .checkRightUp |
.downLeftLow: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
dec esi |
mov eax, [esp+20+widthX] |
imul eax, esi |
add edi, eax |
mov ecx, esi |
dec ecx |
.drawDownLeft: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
dec ecx |
jns .drawDownLeft |
inc esi |
mov edi, [esp] |
jmp .checkRightUp |
test ecx, 0x08000000 ; redirect the output to the user area |
jz @f |
.downLeftHigh: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
dec esi |
mov eax, [esp+20+widthX] |
imul eax, esi |
add edi, eax |
mov ecx, esi |
dec ecx |
.drawDownLeftHigh: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
sub edi, [esp+20+widthX] |
dec ecx |
jns .drawDownLeftHigh |
inc esi |
mov edi, [esp] |
.checkRightUp: |
bsf eax, edx |
inc eax |
bt [ebx-1], eax |
jnc .nextPixel |
mov ecx, eax |
dec eax |
bt [ebx-1], eax |
jc @f |
bt [ebx+1], eax |
jnc .upLeftLow |
bt [ebx+2], eax |
jc .upLeftLow |
inc eax |
bt [ebx+1], eax |
jc .upLeftLow |
inc eax |
bt [ebx+2], eax |
jc .upLeftLow |
jmp .upLeftHigh |
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: |
bt [ebx+1], eax |
jc .nextPixel |
inc eax |
dec esi |
jnz .pixloop2 |
inc eax |
bt [ebx-1], eax |
jc .nextPixel |
.upLeftLow: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
mov ecx, esi |
dec ecx |
dec ecx |
.drawUpLeft: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
dec ecx |
jns .drawUpLeft |
jmp .nextPixel |
pop esi |
sub eax, esi |
.upLeftHigh: |
imul ecx, esi |
shl ecx, 2 |
add edi, ecx |
mov ecx, esi |
dec ecx |
dec ecx |
.drawUpLeftHigh: |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
mov eax, ecx |
@@: |
mov [edi+eax*4], ebp |
dec eax |
jns @b |
add edi, [esp+20+widthX] |
dec ecx |
jns .drawUpLeftHigh |
.nextPixel: |
bsf eax, edx |
btr edx, eax |
pop edi |
jmp .raw |
.nextRaw: |
inc ebx |
inc ebp |
dec dword [esp] |
jnz .symloop2 |
mov eax, [esp+16+widthX] |
imul eax, esi |
add edi, eax |
dec dword [esp+4] |
jnz drawChar |
ret |
pop eax |
add dword [esp+28], esi |
popad |
jmp .loop |
;-------------------------------------- |
align 4 |
.end: |
popad |
pop eax |
antiAliasing: |
mov bp, 3 |
@@: |
mov cl, al |
mov dl, bl |
lea ecx, [ecx*2+ecx] |
add ecx, edx |
shr ecx, 2 |
mov al, cl |
ror eax, 8 |
ror ebx, 8 |
dec bp |
jnz @b |
ror eax, 8 |
ror ebx, 8 |
mov ebp, ebx |
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 |
;------------------------------------------------------------------------------ |
align 4 |
FONT_I: |
fontSmoothing db 2 ; = 0, 1 or 2 |
fontSize db 0 ; user mode setting |
font1: |
if lang eq sp |
file 'char_sp.mt' |
else if lang eq et |
238,14 → 831,5 |
else |
file 'char.mt' |
end if |
;------------------------------------------------------------------------------ |
align 4 |
FONT_II: |
if lang eq sp |
file 'char2_sp.mt' |
else if lang eq et |
file 'char2_et.mt' |
else |
file 'char2.mt' |
end if |
;------------------------------------------------------------------------------ |
fontUni: |
file 'charUni.mt' |
/kernel/branches/Kolibri-acpi/gui/mouse.inc |
---|
9,9 → 9,9 |
include 'mousepointer.inc' |
;============================================================================== |
;///// public functions /////////////////////////////////////////////////////// |
;============================================================================== |
;================================ |
;/////// public functions /////// |
;================================ |
mouse.LEFT_BUTTON_FLAG = 0001b |
mouse.RIGHT_BUTTON_FLAG = 0010b |
36,14 → 36,10 |
mouse.WINDOW_RESIZE_E_FLAG |
align 4 |
;------------------------------------------------------------------------------ |
mouse_check_events: ;////////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Check if mouse buttons state or cursor position has changed and call |
;? appropriate handlers |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse_check_events: |
; Check if mouse buttons state or cursor position has changed |
push eax ebx |
mov al, [BTN_DOWN] |
mov bl, [mouse.state.buttons] |
and al, mouse.BUTTONS_MASK |
63,8 → 59,8 |
; yes it is, activate window user is pointing at, if needed |
call mouse._.activate_sys_window_under_cursor |
; NOTE: this code wouldn't be necessary if we knew window did |
; already redraw itself after call above |
; NOTE: this code wouldn't be necessary if we knew |
; that window did already redraw itself after call above |
or eax, eax |
jnz .exit |
162,9 → 158,9 |
jnz mouse._.middle_button_press_handler |
jmp mouse._.middle_button_release_handler |
;============================================================================== |
;///// private functions ////////////////////////////////////////////////////// |
;============================================================================== |
;=============================== |
;////// private functions ////// |
;=============================== |
uglobal |
mouse.state: |
172,7 → 168,7 |
.buttons db ? |
; NOTE: since there's no unique and lifetime-constant button identifiers, |
; we're using two dwords to identify each of them: |
; we are using two dwords to identify each of them: |
; * pbid - process slot (high 8 bits) and button id (low 24 bits) pack |
; * coord - left (high 16 bits) and top (low 16 bits) coordinates pack |
align 4 |
191,12 → 187,25 |
.action db ? |
endg |
iglobal |
fl_moving db 0 |
rb 3 |
endg |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.left_button_press_handler: ;/////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when left mouse button has been pressed down |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.left_button_press_handler: |
; Called when left mouse button has been pressed down |
bts word [BTN_DOWN], 8 |
mov eax, [timer_ticks] |
mov ebx, eax |
xchg ebx, [mouse.active_sys_window.last_ticks] |
sub eax, ebx |
movzx ebx, [mouse_doubleclick_delay] |
cmp eax, ebx |
jg @f |
bts dword [BTN_DOWN], 24 |
@@: |
test [mouse.state.buttons], not mouse.LEFT_BUTTON_FLAG |
jnz .exit |
210,12 → 219,8 |
test dl, mouse.WINDOW_MOVE_FLAG |
jz @f |
mov eax, [timer_ticks] |
mov ebx, eax |
xchg ebx, [mouse.active_sys_window.last_ticks] |
sub eax, ebx |
cmp eax, 50 |
jg @f |
bt dword [BTN_DOWN], 24 |
jnc @f |
mov [mouse.active_sys_window.last_ticks], 0 |
call sys_window_maximize_handler |
254,9 → 259,6 |
call .calculate_e_delta |
.call_window_handler: |
; mov eax, mouse.active_sys_window.old_box |
; call sys_window_start_moving_handler |
.exit: |
ret |
287,11 → 289,10 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.left_button_release_handler: ;///////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when left mouse button has been released |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.left_button_release_handler: |
; Called when left mouse button has been released |
bts dword [BTN_DOWN], 16 |
xor esi, esi |
xchg esi, [mouse.active_sys_window.pslot] |
or esi, esi |
310,60 → 311,38 |
.exit: |
and [mouse.active_sys_window.action], 0 |
mov [fl_moving], 0 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.right_button_press_handler: ;////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when right mouse button has been pressed down |
;------------------------------------------------------------------------------ |
mouse._.right_button_press_handler: |
bts word [BTN_DOWN], 9 |
test [mouse.state.buttons], not mouse.RIGHT_BUTTON_FLAG |
jnz .exit |
jnz @f |
call mouse._.find_sys_window_under_cursor |
call mouse._.check_sys_window_actions |
test al, mouse.WINDOW_MOVE_FLAG |
jz .exit |
jz @f |
jmp sys_window_rollup_handler |
call sys_window_rollup_handler |
.exit: |
mouse._.right_button_release_handler: |
bts dword [BTN_DOWN], 17 |
@@: |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.right_button_release_handler: ;//////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when right mouse button has been released |
;------------------------------------------------------------------------------ |
mouse._.middle_button_press_handler: |
bts word [BTN_DOWN], 10 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.middle_button_press_handler: ;///////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when middle mouse button has been pressed down |
;------------------------------------------------------------------------------ |
mouse._.middle_button_release_handler: |
bts dword [BTN_DOWN], 18 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.middle_button_release_handler: ;/////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when middle mouse button has been released |
;------------------------------------------------------------------------------ |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.move_handler: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Called when cursor has been moved |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.move_handler: |
; Called when cursor has been moved |
;> eax = old x coord |
;> ebx = old y coord |
;------------------------------------------------------------------------------ |
cmp [mouse.active_sys_button.pbid], 0 |
jnz .exit |
507,6 → 486,19 |
pop esi |
je .exit |
test [fl_moving], 1 |
jnz @f |
mov [fl_moving], 1 |
push edi |
mov edi, esi |
shl edi, 5 |
add edi, WDATA.box + window_data |
call window._.draw_negative_box |
pop edi |
@@: |
mov [mouse.active_sys_window.last_ticks], 0 |
call sys_window_moving_handler |
514,15 → 506,12 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.find_sys_window_under_cursor: ;//////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Find system window object which is currently visible on screen and has |
;? mouse cursor within its bounds |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.find_sys_window_under_cursor: |
; Find system window object which is currently visible on screen |
; and has mouse cursor within its bounds |
;< esi = process slot |
;< edi = pointer to WDATA struct |
;------------------------------------------------------------------------------ |
mov esi, [mouse.state.pos.y] |
mov esi, [d_width_calc_area + esi*4] |
535,11 → 524,8 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.activate_sys_window_under_cursor: ;//////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.activate_sys_window_under_cursor: |
; activate and redraw window under cursor (if necessary) |
call mouse._.find_sys_window_under_cursor |
movzx esi, word[WIN_STACK + esi * 2] |
547,15 → 533,12 |
jmp waredraw |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.find_sys_button_under_cursor: ;//////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? Find system button object which is currently visible on screen and has |
;? mouse cursor within its bounds |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.find_sys_button_under_cursor: |
; Find system button object which is currently visible on screen |
; and has mouse cursor within its bounds |
;< eax = pack[8(process slot), 24(button id)] or 0 |
;< ebx = pack[16(button x coord), 16(button y coord)] |
;------------------------------------------------------------------------------ |
push ecx edx esi edi |
call mouse._.find_sys_window_under_cursor |
612,13 → 595,9 |
ret |
align 4 |
;------------------------------------------------------------------------------ |
mouse._.check_sys_window_actions: ;//////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
;----------------------------------------------------------------- |
mouse._.check_sys_window_actions: |
;< eax = action flags or 0 |
;------------------------------------------------------------------------------ |
; is window movable? |
test byte[edi + WDATA.cl_titlebar + 3], 0x01 |
jnz .no_action |
638,7 → 617,7 |
; no there isn't, can it be resized then? |
mov dl, [edi + WDATA.fl_wstyle] |
and dl, 0x0f |
; NOTE: dangerous optimization, revise if window types changed; |
; NOTE: dangerous optimization, revise if window types changed |
; this currently implies only types 2 and 3 could be resized |
test dl, 2 |
jz .no_action |
/kernel/branches/Kolibri-acpi/gui/window.inc |
---|
30,12 → 30,9 |
draw_limits RECT |
endg |
align 4 |
;------------------------------------------------------------------------------ |
syscall_draw_window: ;///// system function 0 ///////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description>. |
;------------------------------------------------------------------------------ |
mov eax, edx |
shr eax, 24 |
and al, 0x0f |
53,18 → 50,14 |
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 |
; call [draw_pointer] |
call __sys_draw_pointer |
jmp .exit |
;-------------------------------------- |
align 4 |
@@: |
dec al |
jnz @f |
72,11 → 65,9 |
; type III - new style |
call drawwindow_III |
jmp window._.draw_window_caption.2 |
; type IV & V - skinned window (resizable & not) |
;-------------------------------------- |
align 4 |
@@: |
; type IV & V - skinned window (resizable & not) |
mov eax, [TASK_COUNT] |
movzx eax, word[WIN_POS + eax * 2] |
cmp eax, [CURRENT_TASK] |
86,12 → 77,9 |
call drawwindow_IV |
jmp window._.draw_window_caption.2 |
;-------------------------------------- |
align 4 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
syscall_display_settings: ;///// system function 48 /////////////////////////// |
;------------------------------------------------------------------------------ |
;; Redraw screen: |
134,42 → 122,44 |
;< ebx = 8 |
;< ecx = pointer to FileInfoBlock struct |
;> eax = FS error code |
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
;; Get font smoothing: |
;< ebx = 9 |
;> eax = 0 — off, 1 — on, 2 — subpixel |
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
;; Set font smoothing: |
;< ebx = 10 |
;< ecx = 0 — off, 1 — on, 2 — subpixel |
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
;; Get font size: |
;< ebx = 11 |
;> eax = height in pixels |
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
;; Set font size: |
;< ebx = 12 |
;< ecx = height in pixels |
;------------------------------------------------------------------------------ |
cmp ebx, .sizeof.ftable / 4 |
ja @f |
jmp [.ftable + ebx * 4] |
;-------------------------------------- |
align 4 |
@@: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.00: |
xor eax, eax |
inc ebx |
cmp [windowtypechanged], ebx |
jne .exit |
jne @f |
mov [windowtypechanged], eax |
jmp syscall_display_settings._.redraw_whole_screen |
;-------------------------------------- |
align 4 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.01: |
and ecx, 1 |
cmp ecx, [buttontype] |
je .exit |
je @f |
mov [buttontype], ecx |
mov [windowtypechanged], ebx |
;-------------------------------------- |
align 4 |
.exit: |
@@: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.02: |
dec ebx |
mov esi, ecx |
183,7 → 173,6 |
mov [windowtypechanged], ebx |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.03: |
mov edi, ecx |
cmp edx, 192 |
195,13 → 184,11 |
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] |
mov ax, word[screen_workarea.right] |
211,10 → 198,8 |
mov [esp + 20], eax |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.06: |
xor esi, esi |
mov edi, [_display.width] |
dec edi |
mov eax, ecx |
226,19 → 211,13 |
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, [_display.height] |
dec edi |
251,54 → 230,58 |
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 |
jz @f |
call repos_windows |
jmp syscall_display_settings._.calculate_whole_screen |
;-------------------------------------- |
align 4 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.07: |
mov eax, [_skinmargins + 0] |
mov [esp + 32], eax |
mov eax, [_skinmargins + 4] |
mov [esp + 20], eax |
@@: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.08: |
mov ebx, ecx |
call read_skin_file |
mov [esp + 32], eax |
test eax, eax |
jnz .exit |
jnz @b |
call syscall_display_settings._.calculate_whole_screen |
jmp syscall_display_settings._.redraw_whole_screen |
;-------------------------------------- |
align 4 |
.exit: |
;------------------------------------------------------------------------------ |
syscall_display_settings.09: |
xor eax, eax |
mov al, [fontSmoothing] |
mov [esp + 32], eax |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings.10: |
mov [fontSmoothing], cl |
ret |
;------------------------------------------------------------------------------ |
syscall_display_settings.11: |
xor eax, eax |
mov al, [fontSize] |
mov [esp + 32], eax |
ret |
;------------------------------------------------------------------------------ |
syscall_display_settings.12: |
mov [fontSize], cl |
ret |
;------------------------------------------------------------------------------ |
syscall_display_settings._.calculate_whole_screen: |
xor eax, eax |
xor ebx, ebx |
308,7 → 291,6 |
dec edx |
jmp calculatescreen |
;------------------------------------------------------------------------------ |
align 4 |
syscall_display_settings._.redraw_whole_screen: |
xor eax, eax |
mov [draw_limits.left], eax |
322,8 → 304,6 |
mov eax, window_data |
jmp redrawscreen |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
syscall_set_window_shape: ;///// system function 50 /////////////////////////// |
;------------------------------------------------------------------------------ |
;; Set window shape address: |
406,59 → 386,20 |
call window._.set_window_box |
add esp, sizeof.BOX |
; NOTE: do we really need this? to be reworked |
; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer |
; mov byte[MOUSE_BACKGROUND], 0 ; no mouse under |
; mov byte[MOUSE_DOWN], 0 ; react to mouse up/down |
; NOTE: do we really need this? to be reworked |
; call [draw_pointer] |
;-------------------------------------- |
align 4 |
.exit: |
ret |
;------------------------------------------------------------------------------ |
align 4 |
syscall_window_settings: ;///// system function 71 //////////////////////////// |
;------------------------------------------------------------------------------ |
syscall_window_settings: ;///// system function 71 ///////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
dec ebx ; subfunction #1 - set window caption |
jnz .exit_fail |
; NOTE: only window owner thread can set its caption, |
; so there's no parameter for PID/TID |
mov edi, [CURRENT_TASK] |
shl edi, 5 |
mov [edi * 8 + SLOT_BASE + APPDATA.wnd_caption], ecx |
or [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION |
call window._.draw_window_caption |
xor eax, eax ; eax = 0 (success) |
ret |
; .get_window_caption: |
; dec eax ; subfunction #2 - get window caption |
; jnz .exit_fail |
; not implemented yet |
;-------------------------------------- |
align 4 |
.exit_fail: |
xor eax, eax |
inc eax ; eax = 1 (fail) |
ret |
jmp window._.draw_window_caption |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
set_window_defaults: ;///////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? <description> |
;------------------------------------------------------------------------------ |
mov byte [window_data + 0x20 + WDATA.cl_titlebar + 3], 1 ; desktop is not movable |
push eax ecx |
xor eax, eax |
477,6 → 418,7 |
pop ecx eax |
ret |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
calculatescreen: ;///////////////////////////////////////////////////////////// |
502,12 → 444,21 |
cmp ebp, 1 |
jbe .exit |
push eax ;for num layout |
push edx ecx ebx eax |
mov dword[esp+10h], ZPOS_DESKTOP |
;-------------------------------------- |
align 4 |
.layout: |
mov esi, 1 ; = num in window stack |
mov ebp, [TASK_COUNT] |
;-------------------------------------- |
align 4 |
.next_window: |
movzx edi, word[WIN_POS + esi * 2] |
shl edi, 5 |
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
je .skip_window |
516,6 → 467,10 |
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_window |
mov eax, [esp+10h] |
cmp [edi + WDATA.z_modif], al |
jne .skip_window |
mov eax, [edi + WDATA.box.left] |
cmp eax, [esp + RECT.right] |
jg .skip_window |
565,8 → 520,18 |
inc esi |
dec ebp |
jnz .next_window |
;--------------------------------------------- |
inc dword[esp+10h] |
cmp dword[esp+10h], ZPOS_ALWAYS_TOP |
jle .layout |
;--------------------------------------------- |
mov esi, [TASK_COUNT] |
movzx edi, word[WIN_POS + esi * 2] |
shl edi, 5 |
add edi, window_data |
pop eax ebx ecx edx |
pop ebp ;del num layout |
;-------------------------------------- |
align 4 |
.exit: |
1019,6 → 984,9 |
mov edi, [TASK_COUNT] |
movzx esi, word[WIN_POS + edi * 2] |
call window._.set_screen |
call window._.set_top_wnd |
inc [_display.mask_seqno] |
popad |
1188,6 → 1156,11 |
add ecx, eax |
add edx, ebx |
call ebp |
cmp ebp, window._.set_screen |
jne @f |
call window._.set_top_wnd |
@@: |
inc [_display.mask_seqno] |
;-------------------------------------- |
align 4 |
1374,6 → 1347,15 |
shl edi, 5 |
add edi, window_data |
test [fl_moving], 1 |
jz @f |
push edi |
mov edi, ebx |
call window._.draw_negative_box |
pop edi |
@@: |
mov eax, ebx |
mov bl, [edi + WDATA.fl_wstate] |
call window._.set_window_box |
1400,7 → 1382,7 |
iglobal |
FuncTable syscall_display_settings, ftable, \ |
00, 01, 02, 03, 04, 05, 06, 07, 08 |
00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12 |
align 4 |
window_topleft dd \ |
1511,7 → 1493,6 |
call memmove |
mov eax, ebx |
mov ebx, esi |
call window._.check_window_position |
call window._.set_window_clientbox |
call window._.invalidate_screen |
1618,30 → 1599,21 |
mov eax, [CURRENT_TASK] |
shl eax, 5 |
add eax, window_data |
; save window colors |
mov [eax + WDATA.cl_workarea], edx |
mov [eax + WDATA.cl_titlebar], esi |
mov [eax + WDATA.cl_frames], edi |
mov edi, eax |
; was it already defined before? |
; Was it already defined before? |
test [edi + WDATA.fl_wdrawn], 1 |
jnz .set_client_box |
; No, it wasn't. 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! Usually, he will be enraged! |
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 |
call wakeup_osloop |
; NOTE: commented out since doesn't provide necessary functionality |
; anyway, to be reworked |
; mov eax, [timer_ticks] ; [0xfdf0] |
; add eax, 100 |
; mov [new_window_starting], eax |
; no it wasn't, performing initial window definition |
; performing initial window definition |
movzx eax, bx |
mov [edi + WDATA.box.width], eax |
movzx eax, cx |
2296,6 → 2268,8 |
or edx, edx |
jz .exit |
mov ebp, [edi + window_data + WDATA.box.left - 2] |
mov bp, word[edi + window_data + WDATA.box.top] |
movzx eax, [edi + window_data + WDATA.fl_wstyle] |
and al, 0x0F |
cmp al, 3 |
2307,30 → 2281,17 |
;-------------------------------------- |
align 4 |
.skinned: |
mov ebp, [edi + window_data + WDATA.box.left - 2] |
mov bp, word[edi + window_data + WDATA.box.top] |
movzx eax, word[edi + window_data + WDATA.box.width] |
sub ax, [_skinmargins.left] |
sub ax, [_skinmargins.right] |
push edx |
cwde |
cdq |
mov ebx, 6 |
idiv ebx |
pop edx |
or eax, eax |
js .exit |
mov esi, eax |
mov ebx, dword[_skinmargins.left - 2] |
mov bx, word[_skinh] |
sub bx, [_skinmargins.bottom] |
sub bx, [_skinmargins.top] |
sar bx, 1 |
adc bx, 0 |
add bx, [_skinmargins.top] |
add bx, -3 |
add ebx, ebp |
sub bx, 8 |
jmp .dodraw |
;-------------------------------------- |
align 4 |
2337,36 → 2298,29 |
.not_skinned: |
cmp al, 1 |
je .exit |
mov ebp, [edi + window_data + WDATA.box.left - 2] |
mov bp, word[edi + window_data + WDATA.box.top] |
movzx eax, word[edi + window_data + WDATA.box.width] |
sub eax, 16 |
push edx |
cwde |
cdq |
mov ebx, 6 |
idiv ebx |
pop edx |
or eax, eax |
js .exit |
mov ebx, 80002h |
.dodraw: |
shr eax, 3 |
mov esi, eax |
mov ebx, 0x00080007 |
add ebx, ebp |
;-------------------------------------- |
align 4 |
.dodraw: |
mov ecx, [common_colours + 16] |
or ecx, 0x80000000 |
mov al, 1 |
cmp byte [edx], 4 |
jnc @f |
mov al, [edx] |
test al, al |
jz .exit |
inc edx |
@@: |
shl eax, 28 |
or ecx, eax |
xor edi, edi |
call dtext_asciiz_esi |
;-------------------------------------- |
align 4 |
call dtext |
.exit: |
; call [draw_pointer] |
call __sys_draw_pointer |
ret |
jmp __sys_draw_pointer |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
2426,3 → 2380,153 |
mov [ecx+RECT.bottom], edx |
ret |
;------------------------------------------------------------------------------ |
align 4 |
;------------------------------------------------------------------------------ |
window._.redraw_top_wnd: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? redraw all windows one above the window |
;------------------------------------------------------------------------------ |
;> eax = left |
;> ebx = top |
;> ecx = right |
;> edx = bottom |
;> esi = process number |
;! corrupted edi |
;------------------------------------------------------------------------------ |
push 0 |
jmp window._.set_top_wnd.go |
align 4 |
;------------------------------------------------------------------------------ |
window._.set_top_wnd: ;//////////////////////////////////////////////////////// |
;------------------------------------------------------------------------------ |
;? call set_screen for all windows one above the window |
;------------------------------------------------------------------------------ |
;> eax = left |
;> ebx = top |
;> ecx = right |
;> edx = bottom |
;> esi = process number |
;! corrupted edi |
;------------------------------------------------------------------------------ |
push 1 |
.go: |
push esi |
pushfd |
cli |
push ebp |
mov ebp, [TASK_COUNT] |
cmp ebp, 1 |
jbe .exit |
shl esi, 5 |
cmp [esi + window_data + WDATA.z_modif], ZPOS_ALWAYS_TOP |
je .exit |
push eax ;for num layout |
push edx ecx ebx eax |
movsx eax, byte [esi + window_data + WDATA.z_modif] |
inc eax |
mov dword[esp+10h], eax |
;-------------------------------------- |
align 4 |
.layout: |
mov esi, 1 ; = num in window stack |
mov ebp, [TASK_COUNT] |
;-------------------------------------- |
align 4 |
.next_window: |
movzx edi, word[WIN_POS + esi * 2] |
shl edi, 5 ;size of TASKDATA and WDATA = 32 bytes |
cmp [CURRENT_TASK + edi + TASKDATA.state], TSTATE_FREE |
je .skip_window |
add edi, window_data |
test [edi + WDATA.fl_wstate], WSTATE_MINIMIZED |
jnz .skip_window |
mov eax, [esp+10h] |
cmp [edi + WDATA.z_modif], al |
jne .skip_window |
mov eax, [edi + WDATA.box.left] |
cmp eax, [esp + RECT.right] |
jg .skip_window |
mov ebx, [edi + WDATA.box.top] |
cmp ebx, [esp + RECT.bottom] |
jg .skip_window |
mov ecx, [edi + WDATA.box.width] |
add ecx, eax |
cmp ecx, [esp + RECT.left] |
jl .skip_window |
mov edx, [edi + WDATA.box.height] |
add edx, ebx |
cmp edx, [esp + RECT.top] |
jl .skip_window |
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 |
@@: |
cmp dword[esp+32], 0 |
je .set_fl_redraw |
push esi |
movzx esi, word[WIN_POS + esi * 2] |
call window._.set_screen |
pop esi |
jmp @f |
.set_fl_redraw: |
mov [edi + WDATA.fl_redraw], 1 ;set redraw flag |
@@: |
;-------------------------------------- |
align 4 |
.skip_window: |
inc esi |
dec ebp |
jnz .next_window |
;-------------------------------------- |
inc dword[esp+10h] |
cmp byte[esp+10h], ZPOS_ALWAYS_TOP |
jle .layout |
;------------------------------------- |
pop eax ebx ecx edx |
pop ebp ;del num layout |
;------------------------------------- |
align 4 |
.exit: |
pop ebp |
popfd |
pop esi |
add esp, 4 ;dword for 0/1 - set_screen/fl_redraw |
ret |