/programs/develop/libraries/box_lib/branch/box_lib.mac |
---|
107,6 → 107,9 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ch_struc_size=36 ;ðàçìåð ñòðóêòóðû |
ch_flag_en=10b ;ôëàã óñòàíîâëåííîãî ÷åê áîêñà. |
ch_flag_top=0x0 ;ôëàã ðàñïîëîæåíèÿ òåêñòà ââåðõó ò.å. 3-é áèò |
ch_flag_middle=100b ;ôëàã ðàñïîëîæåíèÿ òåêñòà â öåíòðå ò.å. 4-é áèò. |
ch_flag_bottom=1000b ;ôëàã ðàñïîëîæåíèÿ òåêñòà â íèçó ò.å. ïî óìîë÷àíèþ ïðèíèìàåòñÿ çíà÷åíèå âíèçó ò.å. îòñóñòâèå 3-ãî è 4-ãî áèòà |
ch_left_s equ [ebp] ;êîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî õ |
ch_top_s equ [ebp+4] ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî ó |
131,6 → 134,42 |
.size_of_str: dd 0x0 ;äëèííà ñòðîêè, âû÷èñëÿåòñÿ ïðè èíèöèàëèçàöèè êîìïîíåíòà |
} |
;Ìàêðîñ ïðîâåðêè ùåë÷êà ìûøêè íàä ãðóïïîé checkboxes. |
macro init_checkboxes start,end |
{ |
mov ebp,start |
mov ecx,((end-start)/ch_struc_size) |
@@: |
push ebp ;óêàçàòåëü íà ïåðâûé checkbox |
call [check_box_mouse] ;ìàêðîñ ïðîâåðêè ìûøêè íàä checkbox'îì |
add ebp,ch_struc_size |
loop @b |
} |
;Ìàêðîñ îòðèñîâêè ãðóïïû checkboxes. |
macro checkboxes_draw start,end |
{ |
mov ebp,start |
mov ecx,((end-start)/ch_struc_size) |
@@: |
push ebp ;óêàçàòåëü íà ïåðâûé checkbox |
call [check_box_draw] ;íàðèñîâàòü checkbox |
add ebp,ch_struc_size |
loop @b |
} |
;Ìàêðîñ îòðèñîâêè ãðóïïû checkboxes. |
macro checkboxes_draw start,end |
{ |
mov ebp,start |
mov ecx,((end-start)/ch_struc_size) |
@@: |
push ebp ;óêàçàòåëü íà ïåðâûé checkbox |
call [check_box_draw] ;íàðèñîâàòü checkbox |
add ebp,ch_struc_size |
loop @b |
} |
macro check_boxes_set_sys_color start,end,color_table |
{ |
mov ebp,start |
/programs/develop/libraries/box_lib/branch/checkbox.asm |
---|
68,7 → 68,16 |
push dword check3 |
call [init_checkbox] |
push dword check4 |
call [init_checkbox] |
push dword check5 |
call [init_checkbox] |
push dword check6 |
call [init_checkbox] |
window: |
call draw_window ;ïåðâîíà÷àëüíî íåîáõîäèìî íàðèñîâàòü îêíî |
align 4 |
91,6 → 100,16 |
call [check_box_mouse] |
push dword check4 |
call [check_box_mouse] |
push dword check5 |
call [check_box_mouse] |
push dword check6 |
call [check_box_mouse] |
jmp still ;åñëè íè÷åãî èç ïåðå÷èñëåííîãî òî ñíîâà â öèêë |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
button: |
118,7 → 137,16 |
push dword check3 |
call [check_box_draw] |
push dword check4 |
call [check_box_draw] |
push dword check5 |
call [check_box_draw] |
push dword check6 |
call [check_box_draw] |
mcall 12,2 |
ret |
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
151,16 → 179,22 |
aCheck_box_mouse db 'check_box_mouse',0 |
aVersion_ch db 'version_ch',0 |
;--------------------------------------------------------------------- |
check1 check_box (20 shl 16 + 12),(45 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en |
check2 check_box (20 shl 16 + 22),(60 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2 |
check3 check_box (20 shl 16 + 12),(75 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3 |
check1 check_box (10 shl 16 + 12),(10 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text,ch_flag_en |
check2 check_box (10 shl 16 + 22),(25 shl 16 + 12),6,0xC0AABBCC,0,0x80000000,check_text2 |
check3 check_box (10 shl 16 + 12),(40 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text3 |
check4 check_box (10 shl 16 + 12),(70 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text4,ch_flag_top |
check5 check_box (10 shl 16 + 12),(100 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text5,ch_flag_middle |
check6 check_box (10 shl 16 + 12),(130 shl 16 + 22),6,0xC0AABBCC,0,0x80000000,check_text6,ch_flag_bottom |
;--------------------------------------------------------------------- |
hed db 'CheckBox Exemples <Lrz> date 12.10.2010',0 |
hed db 'CheckBox Exemples <Lrz> date 15.10.2010',0 |
hed_end: |
;--------------------------------------------------------------------- |
check_text db 'First checkbox',0 |
check_text2 db 'Second checkbox',0 |
check_text3 db 'Number 3 checkbox',0 |
check_text db 'First checkbox, set flag ch_flag_en',0 |
check_text2 db 'Second checkbox,not set any flag',0 |
check_text3 db 'Number 3 checkbox, not set any flag',0 |
check_text4 db 'Set flag is ch_flag_top',0 |
check_text5 db 'Set flag is ch_flag_middle',0 |
check_text6 db 'Set flag is ch_flag_bottom',0 |
;--------------------------------------------------------------------- |
MEM_END: |
cur_dir_path rb 1024 |
/programs/develop/libraries/box_lib/branch/checkbox.mac |
---|
58,12 → 58,24 |
; Îïòèìèçàöèÿ äëÿ ÖÏ |
mov ebx,dword ch_left_s ;çàãðóçèòü çíà÷åíèå (õ shl 16 + äëèííà) äëÿ ÷åê áîêñà |
mov eax,dword ch_top_s ;çàãðóçèì çíà÷åíèå ïî (y shl 16 + äëèííà) äëÿ ÷åê áîêñà |
mov ecx,eax |
add ebx,dword ch_text_margin ;äîáàâèì ðàçìåð ñòîðîíû è ðàññòîÿíèå íà êîòîðîì íà÷íåòñÿ âûâîä òåêñòà |
shr eax,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ëåâî (óìíîæèì íà 65536) |
shr eax,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ïðàâî (ðàçäåëèì íà 65536) â ax âåðõíàÿ òî÷êà |
shl ebx,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ëåâî (óìíîæèì íà 65536) |
add eax,dword ch_top_s ;cêîððåêòèðóåì ïîçèöèþ Õ. Ò.å. ñåé÷àñ â âåðõíåé ÷àñòè ebx ó íàñ òî÷êà íà÷àëà âûâîäà òåêñòà ïî Y |
sub ecx,8 ;êîððåòèðîâêà ó÷èòûâàåì âûñîòó øðèôòà |
test dword ch_flags,ch_flag_bottom ;ïðîâåðèì, íóæíî ëè âûâîäèòü ââåðõó íàäïèñü |
jnz .bottom |
test dword ch_flags,ch_flag_middle ;ïðîâåðèì, íóæíî ëè âûâîäèòü â öåíòð íàäïèñü |
jz .top ;îñòàëñÿ òîëüêî top |
shr cx,1 ;ðàçäåëèì íà 2 |
.bottom: |
add ax,cx |
.top: |
add ebx,dword ch_left_s ;cêîððåêòèðóåì ïîçèöèþ Õ. Ò.å. ñåé÷àñ â âåðõíåé ÷àñòè ebx ó íàñ òî÷êà íà÷àëà âûâîäà òåêñòà ïî Õ |
sub ax,7 ;âíåñåì ñìåùåíèå äëÿ y |
mov bx,ax |
;ebx õ shl 16 +y êîîðäèíàòû âûâîäà ñòðî÷êè |