kolibrios/programs/develop/examples/radiobutton/trunk/optionbox.inc
heavyiron 4daae89053 *kernel - fixes in 15.2 by Mario79 and 67 by mike.dld
updated sysfunc.txt
*programs 
         new icons and logo for CPUID and ICON
         added new version of @ICON and ICONMNGR
         fixes in iconedit and calendar from DedOK
         new algoritm of fill background in pic4
         all apps (fasm-writen only) rewriten to use common macros.inc for easy recompile in fastcall mode (there is a bug in https; run need rewrite to use common macros.inc)
         small fixes in build_all.bat script
         

git-svn-id: svn://kolibrios.org@485 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-05-10 13:48:35 +00:00

207 lines
8.2 KiB
PHP
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 (Žá­®¢ ­ ­  Checkbox)
;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron, ¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬, ¨ ¨å ¯à®£à ¬¬ ¬, ¡¥§
;ª®â®àëå ï ­¥ ᬮ£ ¡ë ­ ¯¨á âì íâ®â ª®¬¯®­¥­â.
;21.02.2007 ¬®¤¥à­¨§ æ¨ï ¨ ¯®¤¤¥à¦ª  ¤¢ãå à §­ëå ¢ à¨ ­â®¢ á ¨á¯®«ì§®¢ ­¨¥¬ á¨á 梥⮢ ¨ áâ à®© á奬®©
;19.02.2007 ®¡é¥¥ ã«ãç襭¨¥ ª®¤ , 㬥­ì襭¨¥ à §¬¥à  ¨ ¨á¯®«ì§®¢ ­¨¥ á¨á⥬­ëå 梥⮢ ¤«ï ®â®¡à ¦¥­¨ï optionkbox
;16.02.2007 ¤ â  ᮧ¤ ­¨ï ª®¬¯®­¥­â 
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
macro version_op ;¤«ï ᮢ¬¥á⨬®á⨠ᮠáâ à묨 ¢¥àá¨ï¬¨ optionbox ¢á¥ æ¢¥â  § ¤ îâáï àã窠¬¨
{
op_struc_size=26
option_group equ [edi]
op_left equ [edi+4] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
op_top equ [edi+6] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
op_color equ [edi+8]
op_border_color equ [edi+12] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
op_text_color equ [edi+16];[edi+4] ;梥â ⥪áâ 
op_text_ptr equ [edi+20] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
op_text_length equ [edi+24] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
}
macro version_op1 ;¯à®¤¢¨­ãâ ï ¢¥àá¨ï, ¨á¯®«ì§ã¥â æ¢¥â  áª¨­ .
{
op_struc_size=14
option_group equ [edi]
op_left equ [edi+4] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
op_top equ [edi+6] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
op_color equ [sc.work] ;
op_border_color equ [sc.work_graph] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
op_text_color equ [sc.work_text];[edi+4] ;梥â ⥪áâ 
op_text_ptr equ [edi+8] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
op_text_length equ [edi+12] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
}
macro use_option_box
{
option_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
op_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
op_size=11 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
mov eax,13
mov ebx,op_left
shl ebx,16
add ebx,op_size
mov ecx,op_top
shl ecx,16
add ecx,op_size
mov edx,op_border_color
mcall ;à¨á㥬 à ¬ªã
mov edx,op_color
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
mov eax,option_group
mov dword eax,[eax]
cmp eax,edi
jne @f
call .draw_op ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
@@: movzx ebx,word op_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,(op_size+op_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,op_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,(op_size-9+1) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+1
mov ecx,op_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,op_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
movzx esi,word op_text_length ;‡ £à㧨¬ ¤«¨­ã ­ ¤¯¨á¨ ¢ esi
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
mcall ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
.clear_op: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,op_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
.draw_op: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,op_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,(op_size/2) ;§ £à㧨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /2)
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word op_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
add ecx,(op_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
mcall ;¢ë¢®¤
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
.mouse: ;®¡à ¡®âª  ¬ëè¨
pusha
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã ­ á çâ® - ­¨âì ­ ¦ â®
mov ebx,2 ;¢­¥á⨠¢ ॣ¨áâà §­ ç¥­¨¥ 2
mcall ;¯à®¢¥àª  ­¥ ­ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª­®¯ªã ¬ë誨
test eax,eax ;¯à®¢¥àª  ¥á«¨ ã ­ á ¢ eax=0, â® ãáâ ­®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
jnz @f ;¯¥à¥©â¨ ­  ­¨¦­îî ¬¥âªã @@
popa ;¥á«¨ ­¨ç¥£® ­¥ ¯à®¨§®è«®, â® ¢®ááâ ­®¢¨¬ §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë室
@@:
movzx esi,word op_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <EFBFBD>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <EFBFBD>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
xor ebx,ebx
add esi,op_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
inc ebx ;¤®¡ ¢¨âì 1
mcall ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word op_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,op_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word op_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl .mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,op_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg .mouse_end ;¥á«¨ ¡®«ìè¥
mov eax,option_group
mov [eax],edi
.mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}
struc option_box1 point_gr,left,top,text,text_length
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.option_group: dd point_gr ;㪠§ â¥«ì ­  à §¬¥é¥­¨¥ edi - ¨¤¥­â¨ä¨ª â®à  optibox
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ;¯®«®¦¥­¨¥ ¯® ã
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ; +20 ¤«¨­  ⥪áâ 
}
struc option_box point_gr,left,top,color,border_color,text_color,text,text_length
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.option_group: dd point_gr ;㪠§ â¥«ì ­  à §¬¥é¥­¨¥ edi - ¨¤¥­â¨ä¨ª â®à  optibox
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ;¯®«®¦¥­¨¥ ¯® ã
.color: dd color
.border_color: dd border_color; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
.text_color: dd text_color;[edi+4] ;梥â ⥪áâ 
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ; +20 ¤«¨­  ⥪áâ 
}
op_flag_en=10b
macro draw_option_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call option_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
macro mouse_option_boxes start,end ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call option_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/op_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
.home:
mov eax,[edi] ;op_optibox_gr
mov dword eax,[eax]
pusha
cmp eax,edi
jne @f
call option_box.draw_op
jmp .nxtm
@@: call option_box.clear_op
.nxtm: popa
add edi,op_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop .home
}