kolibrios-fun/programs/develop/examples/checkbox/trunk/check.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

204 lines
10 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.

;Ž¯â¨¬¨§¨à®¢ ­­ë© ª®¬¯®­¥­â CheckBox (ˆá室­ë© ¢ à¨ ­â ®â Maxxxx32)
;Ž¯â¨¬¨§¨à®¢ ­ ¢ë¢®¤ áâப¨ ­ ¤¯¨á¨ ¤«ï CheckBox'a + ⥯¥àì, ¯à¨ ¯à®¢¥àª¥ ­¥ ¯à®¨á室¨â ¯®¤áç¥â ª®«-¢  ᨬ¢®«®¢ ¢ áâப¥
;Ž¯â¨¬¨§ æ¨ï ª®¬ ­¤ - ®âª § «áï ®â á®åà ­¥­¨ï ॣ¨áâ஢ ¢ á⥪¥.
;21.02.2007 ¤®¡ ¢¨« ª®¤ ®â Heavyiron, ¤®¯¨á « ¬ ªà®áë ¤«ï ¨á¯®«ì§®¢ ­¨ï á¨á⥬­ëå 梥⮢
;19.02.2007 ®¡é¥¥ ã«ãç襭¨¥ ª®¤ , 㬥­ì襭¨¥ à §¬¥à  ¨ ¨á¯®«ì§®¢ ­¨¥ á¨á⥬­ëå 梥⮢ ¤«ï ®â®¡à ¦¥­¨ï checkbox
;17.07.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï, ¯à¨ ãáâ ­®¢ª¥ 祪 ¡®ªá  ¢ ¯®«®¦¥­¨¥ ¢ª«î祭® ¯®á«¥¤ãî騥 祪 ¡®ªáë ¢ â®â ¦¥ ¯à®¬¥¦ã⮪ ¢à¥¬¥­¨ ­¥ ¯à®¢¥àïîâáï
;22.08.2006 ¯à®¨§¢¥¤¥­  ®¯â¨¬¨§ æ¨ï ª®¬ ­¤, ¯à¨­ïâë ¢® ¢­¨¬ ­¨¥ § ¬¥ç ­¨ï DIAMOND' .
;<Lrz> - ’¥¯«®¢ €«¥ªá¥© www.lrz.land.ru
macro version_ch ;¤«ï ᮢ¬¥á⨬®á⨠ᮠáâ à묨 ¢¥àá¨ï¬¨ checkbox ¢á¥ æ¢¥â  § ¤ îâáï àã窠¬¨
{
ch_struc_size=24
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [edi+4]
ch_border_color equ [edi+8] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [edi+12];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+16] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+20] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+22] ;ä« £¨
}
macro version_ch1 ;¯à®¤¢¨­ãâ ï ¢¥àá¨ï, ¨á¯®«ì§ã¥â æ¢¥â  áª¨­ .
{
ch_struc_size=12
ch_left equ [edi] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top equ [edi+2] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_color equ [sc.work] ;
ch_border_color equ [sc.work_graph] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [sc.work_text];[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+4] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_text_length equ [edi+8] ;¤«¨­  ­ ¤¯¨á¨ (2^64 â ª®© ¤«¨­ë ¬®¦¥â ¡ëâì ⥪áâ)
ch_flags equ [edi+10] ;ä« £¨
}
macro use_check_box
{
ch_text_margin=4 ;à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_size=11 ;à §¬¥à ª¢ ¤à â  祪 ¡®ªá 
check_box:
.draw:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mov eax,13
mov ebx,ch_left
shl ebx,16
add ebx,ch_size
mov ecx,ch_top
shl ecx,16
add ecx,ch_size
mov edx,ch_border_color
mcall ;à¨á㥬 à ¬ªã
mov edx,ch_color
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall ;§ ªà è¨¢ ¥¬ ¢­ãâ७­®á⨠祪¡®ªá 
test word ch_flags,2 ;¤®áâ âì §­ ç¥­¨¥ ¡¨â  ¨§ ¯¥à¥¬¥­­®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF
jz @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«­¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨­ ç¥ ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
@@:
;----------------------------
;à áç¥â ªã¤  ¡ã¤¥â ¯à®¨§¢¥¤¥­ ¢ë¢®¤ ⥪áâ 
;----------------------------
movzx ebx,word ch_left ;§ £à㧨âì §­ ç¥­¨¥ å ¤«ï 祪 ¡®ªá 
add ebx,(ch_size+ch_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®­ë ¨ à ááâ®ï­¨¥ ­  ª®â®à®¬ ­ ç­¥âáï ¢ë¢®¤ ⥪áâ 
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,ch_top ;§ £à㧨¬ §­ ç¥­¨¥ ¯® y
add ebx,(ch_size-9+1) ;¤®¡ ¢¨¬ §­ ç¥­¨¥ ¤«¨­ë áâ®à®­ë -9+1
mov ecx,ch_text_color ;§ £à㧨¬ 梥⠭ ¤¯¨á¨
mov edx,ch_text_ptr ;㪠¦¥¬  ¤à¥á ®â ªã¤  ­ã¦­® ¢ë¢®¤¨âì áâபã
movzx esi,word ch_text_length ;‡ £à㧨¬ ¤«¨­ã ­ ¤¯¨á¨ ¢ esi
;¢­¥á¥¬ ¢ eax §­ ç¥­¨¥ ¢ë¢®¤  ­ ¤¯¨á¨ ­  ª ­¢ã
mov eax,4
mcall ;‚뢮¤
popa ;¢®ááâ ­®¢¨âì §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
.clear_ch: ;®ç¨á⪠ 祪 ¡®ªá 
mov edx,ch_color ;梥⠢­ãâਠ祪 ¡®ªá 
jmp @f ;¡¥§ãá«®¢­ë© ¯à릮ª ­  ­¨¦­îî ¬¥âªã @@
.draw_ch: ;­ à¨á®¢ âì ¢ª«î祭­ë© 祪 ¡®ªá
mov edx,ch_border_color ;§ £à㧨âì 梥â
@@:
movzx ebx,word ch_left ;§ £à㧨âì ª®®à¤¨­ âã ¯® å
add ebx,(ch_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ebx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov bx,(ch_size/2) ;§ £à㧨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /2)
mov bp,bx ;á®åà ­¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
;push bx
movzx ecx,word ch_top ;§ £à㧨âì ª®®à¤¨­ âã ¯® ã
mov eax,13 ;¢ eax - §­ ç¥­¨ï ä㭪樨 ¤«ï ¢ë¢®¤  ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì­¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«î祭­ë© ª®¬¯®­¥­â 祪 ¡®ªá
add ecx,(ch_size/3) ;¤®¡ ¢¨âì (áâ®à®­  ¯àאַ㣮«ì­¨ª /3)
shl ecx,16 ;ᤢ¨­¥¬ ­  16 à §à冷¢ ¢ «¥¢® (㬭®¦¨¬ ­  65536)
mov cx,bp ;§ £à㧨¬ §­ ç¥­¨ï ॣ¨áâà  ãª § â¥«ï ¡ §ë ¢ cx
;pop cx
mcall ;¢ë¢®¤
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
.mouse: ;®¡à ¡®âª  ¬ëè¨
pusha
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã ­ á çâ® - ­¨âì ­ ¦ â®
mov ebx,2 ;¢­¥á⨠¢ ॣ¨áâà §­ ç¥­¨¥ 2
mcall ;¯à®¢¥àª  ­¥ ­ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª­®¯ªã ¬ë誨
test eax,eax ;¯à®¢¥àª  ¥á«¨ ã ­ á ¢ eax=0, â® ãáâ ­®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
jnz @f ;¯¥à¥©â¨ ­  ­¨¦­îî ¬¥âªã @@
btr word ch_flags,2 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
popa ;¥á«¨ ­¨ç¥£® ­¥ ¯à®¨§®è«®, â® ¢®ááâ ­®¢¨¬ §­ ç¥­¨ï ॣ¨áâ஢ ¨§ á⥪ 
ret ;¢ë室
@@:
bts word ch_flags,2 ;¯à®¢¥àª  ä« £  â.¥. ¯¥à¥­®á ¢ cf §­ ç¥­¨¥ ¡¨â  ¨ ãáâ ­®¢ª  ¡¨â  ¢ á®áâ®ï­¨¥ ¢ª«î祭®
jc .mouse_end ;¥á«¨ CF=1 â® ¯¥à¥©â¨ ¢ ª®­¥æ â.¥. íâ® ¢ë室
movzx esi,word ch_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
;“¬­®¦¥­¨¥ ­  6 <EFBFBD>ëáâ஥ 㬭®¦¥­¨¥ ¬®¦­® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ­® ­  áâ àëå <EFBFBD>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨­áâàãªæ¨¥© Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; ¨«¨ ¬®¦­® ¨ â ª 㬭®¦¨âì ­  6
add esi,ch_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï­¨¥ ®â 祪 ¡®ªá  ¤® ­ ¤¯¨á¨
mov eax,37 ;¯®«ã稬 ª®®à¤¨­ âë ¬ë誨
mov ebx,1 ;¤®¡ ¢¨âì 1
mcall ;¯®«ãç¨âì ª®®à¤¨­ âë ªãàá®à  ®â­®á¨â¥«ì­® ®ª­ 
movzx ebx,word ch_top ;§ £à㧨âì ¢ bx §­ ç¥­¨¥ ª®®à¤¨­ âë ã
cmp ax,bx ;áà ¢­¨âì á á ª®®à¤¨­ â®© ªãàá®à 
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì à §¬¥à
cmp ax,bx ;áà ¢­¨âì
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
shr eax,16 ;à §¤¥«¨¬ ­  65536 ¨«¨ ¯à®á⮠ᤢ¨­¥¬ ¡¨âë ­  16 §­ ç¥­¨©
movzx ebx,word ch_left ;¯à®¨§¢¥¤¥¬  ­ «®£¨ç­®¥ áà ¢­¥­¨¥
cmp ax,bx ;áà ¢­¨âì ॣ¨áâàë
jl .mouse_end ;¥á«¨ ¬¥­ìè¥
add ebx,ch_size ;¤®¡ ¢¨âì ¤«¨­ã áâ®à®­ë ¯àאַ㣮«ì­¨ª 
add ebx,esi ;“ç¥áâì ¢ §­ ç¥­¨¨ ¯® å ¥é¥ ¨ ¤«¨­ã ­ ¤¯¨á¨ ª 祪¡®ªáã
cmp ax,bx ;áâà ¢­¨âì ॣ¨áâàë
jg .mouse_end ;¥á«¨ ¡®«ìè¥
bts word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  1.
jc @f ;CF=1 â® ¯¥à¥©â¨ ­  ­¨¦­îî @@
call .draw_ch ;®â®¡à §¨âì ¢ª«î祭­ë© 祪 ¡®ªá
mov dword [esp+24],1 ;¤ «ì­¥©è ï ¯à®¢¥àª  祪 ¡®ªá®¢ ¡¥á¬ëá«¥­ , ¯® í⮬㠢 á⥪, £¤¥ à á¯®« £ ¥âáï ecx ¯®¬¥áâ¨â¬ 0
jmp .mouse_end ;¢ë©â¨
@@:
btr word ch_flags,1 ;¨§¢«¥ç¥­¨¥ §­ ç¥­¨ï § ¤ ­­®£® ¡¨â  ¢ ä« £ cf ¨ ¨§¬¥­¥­¨¥ ¥£® §­ ç¥­¨ï ­  ­ã«¥¢®¥.
call .clear_ch ;¢ëª«îç¨âì 祪 ¡®ªá â.¥. ­  ¬¥á⥠§ ªà è¥­­®£® ¯àאַ㣮«ì­¨ª  ®â®¡à §¨âì 梥â ä®­ .
.mouse_end:
popa ;¢®ááâ ­®¢¨âì ॣ¨áâàë ¨§ á⥪ 
ret ;¢ë©â¨
}
struc check_box1 left,top,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ¯®«®¦¥­¨¥ ¯® å
.top: dw top ;+2 ¯®«®¦¥­¨¥ ¯® ã
.text: dd text ;+16  ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâà
.text_length: dw text_length ;+20 ¤«¨­  ⥪áâ 
.flags: dw flags+0 ;+22 ä« £¨
}
struc check_box left,top,color,border_color,text_color,text,text_length,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
.left: dw left ;+0 ;¯®«®¦¥­¨¥ ¯® å
.top: dw top ;¯®«®¦¥­¨¥ ¯® ã
.color: dd color ;梥⠢­ãâਠ祪¡®ªá 
.border_color: dd border_color ;梥â à ¬ª¨
.text_color: dd text_color ;梥⠭ ¤¯¨á¨
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâ
.text_length: dw text_length ;¤«¨­  ⥪áâ 
.flags: dw flags+0 ;+22
}
ch_flag_en=10b
macro draw_check_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
macro mouse_check_boxes start,end ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
mov ecx,((end-start)/ch_struc_size) ;Š®«¨ç¥á⢮ 祪 ¡®ªá®¢
@@:
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
add edi,ch_struc_size ;“ª § â¥«ì ­  ¯®á«¥¤ãî騥 祪 ¡®ªáë
loop @b ;¯à룭ãâì ¥á«¨ ¢ ecx/cx §­ ç¥­¨¥ ­¥ 0 ­  ¢¥àå­îî @@
}
;…᫨ ­ã¦­® ®â®¡à §¨âì ®¤¨­ 祪¥à
macro draw_check_box start ;à¨á®¢ âì 祪 ¡®ªáë
{
mov edi,start ;“ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.draw ;Žâ®¡à §¨âì 祪 ¡®ªá
}
macro mouse_check_box start ;ãáâ ­®¢ª  祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï
{
mov edi,start ; “ª § â¥«ì ­  ­ ç «® ¤ ­­ëå 祪 ¡®ªá®¢ â.¥. ­  ­ ç «® ¤ ­­ëå ¯¥à¢®£® 祪¡®ªá 
call check_box.mouse ;¯à®¢¥àª  ¬ë誨 ¨ ®¡à ¡®âª  ᮡë⨩
}