kolibrios/programs/develop/libraries/box_lib/trunk/optionbox.asm
IgorA ec2d075e74 clean code 'optionbox' and 'treelist'
git-svn-id: svn://kolibrios.org@6972 a494cfbc-eb01-0410-851d-a64ba20cac60
2017-09-12 13:56:36 +00:00

174 lines
4.6 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; í«¥¬¥­â Optionbox ¤«ï ¡¨¡«¨®â¥ª¨ box_lib.obj
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
; ä ©« ᮧ¤ ­ 13.02.2009 <Lrz>
; ¯®á«¥¤­ïï ¬®¤¨ä¨ª æ¨ï 12.09.2017 IgorA
align 16
option_box_draw:
pusha
mov eax,dword[esp+36]
@@:
mov edi,dword[eax]
test edi,edi
je option_check
call option_box_draw_box
add eax,4
jmp @b
option_check:
mov eax,dword[esp+36]
@@:
mov edi,dword[eax]
test edi,edi
je @f
mov ebx,dword[edi]
mov ebx,dword[ebx]
cmp edi,ebx
jne .clear_op
pusha
call option_box_draw_op
popa
add eax,4
jmp @b
.clear_op:
pusha
call option_box_clear_op
popa
add eax,4
jmp @b
@@:
popa
ret 4
align 16
option_box_mouse:
pusha
mcall SF_MOUSE_GET,SSF_BUTTON
test eax,eax
jnz @f
popa
ret 4
@@:
mov eax,dword[esp+36]
@@:
mov edi,dword[eax]
test edi,edi
je option_check
call option_box_mouse_op
add eax,4
jmp @b
align 16
option_box_draw_box:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
movzx ebx,word op_left
shl ebx,16
add ebx,dword op_size
movzx ecx,word op_top
shl ecx,16
add ecx,dword op_size
mcall SF_DRAW_RECT,,,op_border_color ;à¨á㥬 à ¬ªã
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall ,,,op_color ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
; mov eax,dword option_group
; mov eax,[eax]
; cmp eax,edi
; jne @f
; call option_box_draw_op ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
@@:
movzx ebx,word op_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,dword op_size
add ebx,dword op_text_margin ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,word op_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
mov eax,op_size
shr eax,1
add eax,4
add ebx,eax
sub ebx,7 ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+2
mov esi,dword op_text_length
mcall SF_DRAW_TEXT,,op_text_color,op_text_ptr ;‚뢮¤ ­ ¤¯¨á¨ ­  ª ­¢ã
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
option_box_clear_op: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,dword op_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
option_box_draw_op: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,dword op_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
mov eax,dword op_size
mov bp,ax
shr eax,2
push ax
push ax
add ebx,eax
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
pop ax
lea eax,[eax*2]
sub bp,ax ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
mov bx,bp
movzx ecx,word op_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
pop ax
add cx,ax
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
mcall SF_DRAW_RECT ;¢ë¢®¤ ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®â稪 mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
option_box_mouse_op: ;®¡à ¡®âª  ¬ëè¨
pusha
mov esi,dword op_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
imul esi,6 ;¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
add esi,dword op_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word op_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl option_box_mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,dword op_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg option_box_mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word op_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl option_box_mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,dword op_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg option_box_mouse_end ;¥á«¨ ¡®«ìè¥
mov eax,dword option_group
mov [eax],edi
option_box_mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨