Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 8344 → Rev 8346

/programs/develop/libraries/box_lib/branch/checkbox.asm
File deleted
/programs/develop/libraries/box_lib/branch/COPYING.TXT
File deleted
/programs/develop/libraries/box_lib/branch/checkbox2.mac
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch/run.bat
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch/bl_sys.mac
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch/readme.txt
File deleted
/programs/develop/libraries/box_lib/branch/checkbox.bat
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch/box_lib.asm
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch/box_lib.mac
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/branch
Property changes:
Deleted: svn:ignore
-*.o
-*.a
Deleted: tsvn:logminsize
-5
\ No newline at end of property
/programs/develop/libraries/box_lib/trunk/bl_sys.mac
File deleted
/programs/develop/libraries/box_lib/trunk/menubar.mac
File deleted
/programs/develop/libraries/box_lib/trunk/pathshow.mac
File deleted
/programs/develop/libraries/box_lib/trunk/filebrowser.mac
File deleted
/programs/develop/libraries/box_lib/trunk/frame.mac
File deleted
/programs/develop/libraries/box_lib/trunk/scrollbar.mac
File deleted
/programs/develop/libraries/box_lib/trunk/progressbar.mac
File deleted
\ No newline at end of file
/programs/develop/libraries/box_lib/trunk/d_button.mac
File deleted
/programs/develop/libraries/box_lib/trunk/box_lib.asm
1,6 → 1,6
;*****************************************************************************
; Box_Lib - library of graphical components
; Copyright (C) KolibriOS team 2008-2016. All rights reserved.
; Copyright (C) KolibriOS team 2008-2020. All rights reserved.
;
; Authors:
; Alexey Teplov aka <Lrz>
19,7 → 19,6
include '../../../../macros.inc'
include '../../../../proc32.inc'
include '../../../../KOSfuncs.inc'
include 'bl_sys.mac'
include 'box_lib.mac' ;macro which should make life easier :)
;include '../../../../debug.inc'
include 'keys.inc'
31,72 → 30,21
dll.load dd ?
 
;----------------------------------------------------
;EditBox
include 'editbox.asm' ;editbox
 
;----------------------------------------------------
;CheckBox
include 'checkbox.asm' ;checkbox
 
;--------------------------------------------------
;radiobutton Group
include 'optionbox.asm' ;optionbox
 
;--------------------------------------------------
;scrollbar Group
;--------------------------------------------------
align 16
use_scroll_bar
align 16
use_scroll_bar_vertical
align 16
use_scroll_bar_horizontal
 
;--------------------------------------------------
;dinamic button Group
;--------------------------------------------------
align 16
use_dinamic_button
 
;--------------------------------------------------
;menubar Group
;--------------------------------------------------
align 16
use_menu_bar
 
;--------------------------------------------------
;filebrowser Group
;--------------------------------------------------
align 16
use_file_browser
 
;--------------------------------------------------
;tree list
include 'scrollbar.asm' ;scrollbar
include 'd_button.asm' ;dinamic_button
include 'menubar.asm' ;menubar
include 'filebrowser.asm' ;filebrowser
include 'tree_list.asm' ;tree_list, list_box
 
;--------------------------------------------------
;PathShow Group
;--------------------------------------------------
align 16
use_path_show
 
;--------------------------------------------------
;text editor
include 'pathshow.asm' ;pathshow
include 't_edit.asm' ;text_editor
 
include 'frame.asm' ;frame
include 'progressbar.asm' ;progressbar
include 'tooltip.asm' ;tooltip
;--------------------------------------------------
;Frame Group
;--------------------------------------------------
align 16
use_frame
;--------------------------------------------------
;ProgressBar
;--------------------------------------------------
use_progressbar
 
;--------------------------------------------------
include 'tooltip.asm' ;tooltip
 
;input:
; eax = óêàçàòåëü íà ôóíêöèþ âûäåëåíèÿ ïàìÿòè
; ebx = ... îñâîáîæäåíèÿ ïàìÿòè
115,18 → 63,18
proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dword, box_h:dword,\
col_0:dword, col_1:dword, col_2:dword
 
mov esi,dword[col_1]
mov esi,[col_1]
and esi,111111101111111011111110b
 
mov eax,SF_DRAW_RECT
;bottom line
mov edx,dword[col_2]
mov ebx,dword[box_l]
mov edx,[col_2]
mov ebx,[box_l]
shl ebx,16
add ebx,dword[box_w]
add ebx,[box_w]
inc ebx ;äëÿ çàëèâêè äèàãîíàëüíûõ ïèêñåëåé
mov ecx,dword[box_t]
add ecx,dword[box_h]
mov ecx,[box_t]
add ecx,[box_h]
shl ecx,16
inc ecx
 
146,14 → 94,14
jnz @b
 
;right line
mov edx,dword[col_2]
mov ebx,dword[box_l]
add ebx,dword[box_w]
mov edx,[col_2]
mov ebx,[box_l]
add ebx,[box_w]
shl ebx,16
inc ebx
mov ecx,dword[box_t]
mov ecx,[box_t]
shl ecx,16
add ecx,dword[box_h]
add ecx,[box_h]
 
mov edi,3 ;for cycle
@@:
171,11 → 119,11
jnz @b
 
;top line
mov edx,dword[col_0]
mov ebx,dword[box_l]
mov edx,[col_0]
mov ebx,[box_l]
shl ebx,16
add ebx,dword[box_w]
mov ecx,dword[box_t]
add ebx,[box_w]
mov ecx,[box_t]
shl ecx,16
inc ecx
 
195,13 → 143,13
jnz @b
 
;left line
mov edx,dword[col_0]
mov ebx,dword[box_l]
mov edx,[col_0]
mov ebx,[box_l]
shl ebx,16
inc ebx
mov ecx,dword[box_t]
mov ecx,[box_t]
shl ecx,16
add ecx,dword[box_h]
add ecx,[box_h]
 
mov edi,3 ;for cycle
@@:
235,9 → 183,9
dd sz_edit_box_set_text, edit_box_set_text
dd szVersion_ed, 0x00000001
 
dd sz_init_checkbox2, init_checkbox2
dd sz_check_box_draw2, check_box_draw2
dd sz_check_box_mouse2, check_box_mouse2
dd sz_init_checkbox, init_checkbox
dd sz_check_box_draw, check_box_draw
dd sz_check_box_mouse, check_box_mouse
dd szVersion_ch2, 0x00000002
 
dd sz_option_box_draw, option_box_draw
349,9 → 297,9
sz_edit_box_set_text db 'edit_box_set_text',0
szVersion_ed db 'version_ed',0
 
sz_init_checkbox2 db 'init_checkbox2',0
sz_check_box_draw2 db 'check_box_draw2',0
sz_check_box_mouse2 db 'check_box_mouse2',0
sz_init_checkbox db 'init_checkbox2',0
sz_check_box_draw db 'check_box_draw2',0
sz_check_box_mouse db 'check_box_mouse2',0
szVersion_ch2 db 'version_ch2',0
 
sz_option_box_draw db 'option_box_draw',0
/programs/develop/libraries/box_lib/trunk/box_lib.mac
108,15 → 108,7
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Basic macros for use CheckBox ;
;Last change 17.01.2013 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ch_text_margin equ [edi+8] ;=4 à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_color equ [edi+12] ;梥⠢­ãâਠcheckbox
ch_border_color equ [edi+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [edi+20] ;[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [edi+24] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_flags equ [edi+28] ;ä« £¨
 
ch_struc_size=36 ;à §¬¥à áâàãªâãàë
ch_flag_en=10b ;ä« £ ãáâ ­®¢«¥­­®£® 祪 ¡®ªá .
ch_flag_top=0x0 ;ä« £ à á¯®«®¦¥­¨ï ⥪áâ  ¢¢¥àåã â.¥. 3-© ¡¨â
123,15 → 115,15
ch_flag_middle=100b ;ä« £ à á¯®«®¦¥­¨ï ⥪áâ  ¢ 業âॠâ.¥. 4-© ¡¨â.
ch_flag_bottom=1000b ;ä« £ à á¯®«®¦¥­¨ï ⥪áâ  ¢ ­¨§ã â.¥. ¯® 㬮«ç ­¨î ¯à¨­¨¬ ¥âáï §­ ç¥­¨¥ ¢­¨§ã â.¥. ®âáãá⢨¥ 3-£® ¨ 4-£® ¡¨â 
 
2ch_left_s equ [ebp] ;ª®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
2ch_top_s equ [ebp+4] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
2ch_text_margin equ [ebp+8] ;=4 à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
2ch_color equ [ebp+12] ;梥⠢­ãâਠcheckbox
2ch_border_color equ [ebp+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
2ch_text_color equ [ebp+20] ;[edi+4] ;梥â ⥪áâ 
2ch_text_ptr equ [ebp+24] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
2ch_flags equ [ebp+28] ;ä« £¨
2ch_sz_str equ [ebp+32] ;¤«¨­­  áâப¨, ¢ëç¨á«ï¥âáï ¯à¨ ¨­¨æ¨ «¨§ æ¨¨ ª®¬¯®­¥­â 
ch_left_s equ [ebp] ;ª®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® å
ch_top_s equ [ebp+4] ;ª®®à¤¨­ â  ­ ç «  à¨á®¢ ­¨ï ¯® ã
ch_text_margin equ [ebp+8] ;=4 à ááâ®ï­¨¥ ®â ¯àאַ㣮«ì­¨ª  祪 ¡®ªá  ¤® ­ ¤¯¨á¨
ch_color equ [ebp+12] ;梥⠢­ãâਠcheckbox
ch_border_color equ [ebp+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦­® § ¤ âì á ¬®áâ®ï⥫쭮
ch_text_color equ [ebp+20] ;[edi+4] ;梥â ⥪áâ 
ch_text_ptr equ [ebp+24] ;㪠§ â¥«ì ­  ­ ç «® ⥪á⮢®© áâப¨
ch_flags equ [ebp+28] ;ä« £¨
ch_sz_str equ [ebp+32] ;¤«¨­­  áâப¨, ¢ëç¨á«ï¥âáï ¯à¨ ¨­¨æ¨ «¨§ æ¨¨ ª®¬¯®­¥­â 
 
struc check_box2 left_s,top_s,ch_text_margin,color,border_color,text_color,text,flags
{ ;áâàãªâãà  ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá 
143,7 → 135,7
.text_color dd text_color ;梥⠭ ¤¯¨á¨
.text dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à á¯®«®¦¥­ ⥪áâ
.flags dd flags+0 ;ä« £¨
.size_of_str dd 0x0 ;¤«¨­­  áâப¨, ¢ëç¨á«ï¥âáï ¯à¨ ¨­¨æ¨ «¨§ æ¨¨ ª®¬¯®­¥­â 
.size_of_str dd 0 ;¤«¨­­  áâப¨, ¢ëç¨á«ï¥âáï ¯à¨ ¨­¨æ¨ «¨§ æ¨¨ ª®¬¯®­¥­â 
}
 
;Œ ªà®á ¯à®¢¥àª¨ 饫窠 ¬ë誨 ­ ¤ £à㯯®© checkboxes.
211,9 → 203,9
@@:
push dword [esi+32] ;梥â ⥪áâ  ¢ à ¡®ç¥© ®¡« á⨠®ª­ 
or dword [esp],0x80000000 ;­¥®¡å®¤¨¬® ¤«ï ¢ë¢®¤  ASCIIZ áâப
pop dword 2ch_text_color
pop dword ch_text_color
push dword [esi+36] ;梥⠣à ä¨ª¨ ¢ ®ª­¥ (à §¤¥«¨â¥«ì­ë¥ «¨­¨¨ ¨ â.¯.)
pop dword 2ch_border_color
pop dword ch_border_color
add ebp,ch_struc_size
loop @b
}
/programs/develop/libraries/box_lib/trunk/checkbox.asm
1,15 → 1,15
;Ïîñëåäíàÿ ìîäèôèêàöèÿ 07.12.2016
;Ïîñëåäíàÿ ìîäèôèêàöèÿ 08.12.2020
;ôàéë ñîçäàí 13.02.2009 <Lrz> Íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
;Checkbox
 
;Èíèöèàëèçàöèÿ checkbox
align 16
init_checkbox2:
init_checkbox:
;ïîäñ÷èòàåì êîë-âî ñèìâîëîâ â äëèííå âûâîäèìîé ñòðîêè.
pushad
mov ebp,dword [esp+36] ;çàãðóæàåì óêàçàòåëü íà ñòðóêòóðó, óêàçàòåëü ìû ïåðåäàåì â ñòåêå
mov ebx,dword 2ch_text_margin ;eax=0
mov esi,dword 2ch_text_ptr ;óêàçàòåëü íà ñòðî÷êó
mov ebx,dword ch_text_margin ;eax=0
mov esi,dword ch_text_ptr ;óêàçàòåëü íà ñòðî÷êó
lodsb ;â al ïåðâûé ñèìâîë èç ñòðîêè
test al,al
jz .ex_loop
20,8 → 20,8
jnz @b
.ex_loop:
 
mov dword 2ch_sz_str,ebx ;çàïèøåì äëèííó ñòðîêè ñ ó÷åòîì îòñòóïà îò êâàäðàòèêà
or dword 2ch_text_color,0x80000000 ;äîáàâëÿåì áèò äëÿ âûâîäà ASCIIZ-ñòðîêè
mov dword ch_sz_str,ebx ;çàïèøåì äëèííó ñòðîêè ñ ó÷åòîì îòñòóïà îò êâàäðàòèêà
or dword ch_text_color,0x80000000 ;äîáàâëÿåì áèò äëÿ âûâîäà ASCIIZ-ñòðîêè
;íà ñëó÷àé åñëè ïîëüçîâàòåëü çàáûë åãî ñàìîñòîÿòåëüíî ïîñòàâèòü â ñòðóêòóðå
popad
ret 4
28,19 → 28,19
 
 
align 16
check_box_draw2:
check_box_draw:
pushad ;ñîõðàíèì âñå ðåãèñòðû
mov ebp,dword [esp+36] ;çàãðóæàåì óêàçàòåëü íà ñòðóêòóðó, óêàçàòåëü ìû ïåðåäàåì â ñòåêå
mcall SF_DRAW_RECT,2ch_left_s,2ch_top_s,2ch_border_color ;ðèñóåì ðàìêó ÷åê áîêñà, ôàêòè÷åñêè ðèñóåì ïðÿìîóãîëüíèê è çàêðàøèâàåì ôîí âíóòðè öâåòîì ðàìêè áîêñà
mcall SF_DRAW_RECT,ch_left_s,ch_top_s,ch_border_color ;ðèñóåì ðàìêó ÷åê áîêñà, ôàêòè÷åñêè ðèñóåì ïðÿìîóãîëüíèê è çàêðàøèâàåì ôîí âíóòðè öâåòîì ðàìêè áîêñà
 
mov edx,dword 2ch_color ;çàãðóæàåì öâåò ôîíà
mov edx,dword ch_color ;çàãðóæàåì öâåò ôîíà
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall ;çàêðàøèâàåì âíóòðåííîñòè ÷åêáîêñà ôîíîì
 
test dword 2ch_flags,2 ;äîñòàòü çíà÷åíèå áèòà èç ïåðåìåííîé è ïîìåñòèòü â ôëàã CF
test dword ch_flags,2 ;äîñòàòü çíà÷åíèå áèòà èç ïåðåìåííîé è ïîìåñòèòü â ôëàã CF
jz @f ;â åñëè CF=1, òî âûïîëíèì ñëåäóþùóþ ïðîöåäóðó èíà÷å ïåðåéòè íà íèæíþþ @@
call check_box_draw_ch2 ;íàðèñîâàòü âêëþ÷åííûé ÷åê áîêñ
call check_box_draw_ch ;íàðèñîâàòü âêëþ÷åííûé ÷åê áîêñ
@@:
;----------------------------
;ðàñ÷åò êóäà áóäåò ïðîèçâåäåí âûâîä òåêñòà
55,19 → 55,19
; add eax,dword ch_top_s ;cêîððåêòèðóåì ïîçèöèþ Õ. Ò.å. ñåé÷àñ â âåðõíåé ÷àñòè ebx ó íàñ òî÷êà íà÷àëà âûâîäà òåêñòà ïî Y
; Îïòèìèçàöèÿ äëÿ ÖÏ
mov ebx,dword 2ch_left_s ;çàãðóçèòü çíà÷åíèå (õ shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov eax,dword 2ch_top_s ;çàãðóçèì çíà÷åíèå ïî (y shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov ebx,dword ch_left_s ;çàãðóçèòü çíà÷åíèå (õ shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov eax,dword ch_top_s ;çàãðóçèì çíà÷åíèå ïî (y shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov ecx,eax
add ebx,dword 2ch_text_margin ;äîáàâèì ðàçìåð ñòîðîíû è ðàññòîÿíèå íà êîòîðîì íà÷íåòñÿ âûâîä òåêñòà
add ebx,dword ch_text_margin ;äîáàâèì ðàçìåð ñòîðîíû è ðàññòîÿíèå íà êîòîðîì íà÷íåòñÿ âûâîä òåêñòà
shr eax,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ïðàâî (ðàçäåëèì íà 65536) â ax âåðõíàÿ òî÷êà
shl ebx,16 ;ñäâèíåì íà 16 ðàçðÿäîâ â ëåâî (óìíîæèì íà 65536)
 
sub ecx,8 ;êîððåòèðîâêà ó÷èòûâàåì âûñîòó øðèôòà
 
test dword 2ch_flags,ch_flag_bottom ;ïðîâåðèì, íóæíî ëè âûâîäèòü ââåðõó íàäïèñü
test dword ch_flags,ch_flag_bottom ;ïðîâåðèì, íóæíî ëè âûâîäèòü ââåðõó íàäïèñü
jnz .bottom
 
test dword 2ch_flags,ch_flag_middle ;ïðîâåðèì, íóæíî ëè âûâîäèòü â öåíòð íàäïèñü
test dword ch_flags,ch_flag_middle ;ïðîâåðèì, íóæíî ëè âûâîäèòü â öåíòð íàäïèñü
jz .top ;îñòàëñÿ òîëüêî top
shr cx,1 ;ðàçäåëèì íà 2
74,25 → 74,25
.bottom:
add ax,cx
.top:
add ebx,dword 2ch_left_s ;cêîððåêòèðóåì ïîçèöèþ Õ. Ò.å. ñåé÷àñ â âåðõíåé ÷àñòè ebx ó íàñ òî÷êà íà÷àëà âûâîäà òåêñòà ïî Õ
add ebx,dword ch_left_s ;cêîððåêòèðóåì ïîçèöèþ Õ. Ò.å. ñåé÷àñ â âåðõíåé ÷àñòè ebx ó íàñ òî÷êà íà÷àëà âûâîäà òåêñòà ïî Õ
mov bx,ax
;ebx õ shl 16 +y êîîðäèíàòû âûâîäà ñòðî÷êè
 
mov ecx,dword 2ch_text_color ;çàãðóçèì öâåò íàäïèñè + flags
mov edx,dword 2ch_text_ptr ;óêàæåì àäðåñ îò êóäà íóæíî âûâîäèòü ñòðîêó
mov ecx,dword ch_text_color ;çàãðóçèì öâåò íàäïèñè + flags
mov edx,dword ch_text_ptr ;óêàæåì àäðåñ îò êóäà íóæíî âûâîäèòü ñòðîêó
mcall SF_DRAW_TEXT
popad ;âîññòàíîâèòü çíà÷åíèÿ ðåãèñòðîâ èç ñòåêà
ret 4 ;âûéäåì èç ïðîöåäóðû è óäàëèì èç ñòåêà óêàçàòåëü íà ñòðóêòóðó (4 áàéòà)
 
check_box_clear_ch2: ;î÷èñòêà ÷åê áîêñà
mov edx,dword 2ch_color ;öâåò âíóòðè ÷åê áîêñà
check_box_clear_ch: ;î÷èñòêà ÷åê áîêñà
mov edx,dword ch_color ;öâåò âíóòðè ÷åê áîêñà
jmp @f ;áåçóñëîâíûé ïðûæîê íà íèæíþþ ìåòêó @@
check_box_draw_ch2: ;íàðèñîâàòü âêëþ÷åííûé ÷åê áîêñ
mov edx,dword 2ch_border_color ;çàãðóçèòü öâåò
check_box_draw_ch: ;íàðèñîâàòü âêëþ÷åííûé ÷åê áîêñ
mov edx,dword ch_border_color ;çàãðóçèòü öâåò
@@:
;Îòîáðàçèòü âêëþ÷åíûé checkbox
mov ebx,dword 2ch_left_s ;çàãðóæàåì õ shl 16 + äëèííà ïî Õ
mov ecx,dword 2ch_top_s ;çàãðóæàåì Y shl 16 + äëèííà ïî Y
mov ebx,dword ch_left_s ;çàãðóæàåì õ shl 16 + äëèííà ïî Õ
mov ecx,dword ch_top_s ;çàãðóæàåì Y shl 16 + äëèííà ïî Y
add ebx,2 shl 16 - 4 ;ïîñëå ýòèõ èçìåíåíèé (X+2) shl 16 +äëèííà ïî (Õ-2)
add ecx,2 shl 16 - 4 ;ïîñëå ýòèõ èçìåíåíèé (Y+2) shl 16 +äëèííà ïî (Y-2)
mcall SF_DRAW_RECT ;îòîáðàçèòü êâàäðàò âíóòðè checkbox
104,7 → 104,7
;Ïðè ïîïàäàíèè ìûøêè + íàæàòà êëàâèøà â îáëàñòü checkbox ñîñòîÿíèå áîêñà äîëæíî ìåíÿòñÿ àêòèâíûé - íå àêòèâíûé.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 16
check_box_mouse2: ;îáðàáîòêà ìûøè
check_box_mouse: ;îáðàáîòêà ìûøè
pushad
mov ebp,dword [esp+36] ;çàãðóæàåì óêàçàòåëü íà ñòðóêòóðó, óêàçàòåëü ìû ïåðåäàåì â ñòåêå
mcall SF_MOUSE_GET,SSF_BUTTON ;ïðîâåðÿåì ñîñòîÿíèå êëàâèø ìûøêè. Áûëî ëè ñîáûòèå íàæàòàÿ êëàâèøà íà ìûøêå.
115,7 → 115,7
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;ïîëó÷èòü êîîðäèíàòû êóðñîðà îòíîñèòåëüíî îêíà
;íà âûõîäå â eax x shl 16 + y
;ñðàâíåíèå âåðõíåé òî÷êè ïî Y
mov ecx,dword 2ch_top_s ;y shl 16 +äëèííà ïî y
mov ecx,dword ch_top_s ;y shl 16 +äëèííà ïî y
mov ebx,ecx
shr ebx,16 ;bx = êîîðäèíàòà ïî y
cmp ax,bx
127,7 → 127,7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
shr eax,16 ;ñìåñòèì êîîðäèíàòó ïî Õ â íèæíóþ ÷àñòü ðåãèñòðà ò.å. â ax
;ñðàâíåíèå ïî íà÷àëüíîé òî÷êå Õ
mov ecx,dword 2ch_left_s ;çàãðóçèòü çíà÷åíèå (õ shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov ecx,dword ch_left_s ;çàãðóçèòü çíà÷åíèå (õ shl 16 + äëèííà) äëÿ ÷åê áîêñà
mov ebx,ecx
shr ebx,16 ;bx = êîîðäèíàòà ïî X
cmp ax,bx
134,17 → 134,17
jb .check_box_mouse_end ;óêàçàòåëü ìûøêè ìåíüøå íà÷àëüíîé êîîðäèíàòû ïî X ÷åì êîîðäèíàòà ïî X ó áîêñà
;ñðàâíåíèå êîíå÷íîé òî÷êè ïî X
add bx,cx ;ñëîæèì äëèííó ïî x è êîîðäèíàòó òî÷êè ïî õ ïîëó÷èì êîîðäèíàòó êîíå÷íîé òî÷êè ïî Õ
add bx,word 2ch_sz_str ;äîáàâèì äëèííó ñòðîêè òåêñòà ñ îòñòóïîì ïðåäâàðòèåëüíî çàïèñàâ èõ â ìîìåíò èíèöèàëèçàöèè
add bx,word ch_sz_str ;äîáàâèì äëèííó ñòðîêè òåêñòà ñ îòñòóïîì ïðåäâàðòèåëüíî çàïèñàâ èõ â ìîìåíò èíèöèàëèçàöèè
cmp ax,bx
ja .check_box_mouse_end ;óêàçàòåëü ìûøêè áîëüøå êîíå÷íîé êîîðäèíàòû ïî õ ÷åì êîîðäèíàòà ïî Õ ó áîêñà
;åñëè âñå ïðîâåðêè áûëè óñïåøíî ïðîéäåíû ìû îáÿçàíû ïîìåíÿòü ñîñòîÿíèå áîêñà
btc dword 2ch_flags,1 ;ïåðåíîñ 2-ãî áèòà â cf è èíâåðñèÿ åãî
btc dword ch_flags,1 ;ïåðåíîñ 2-ãî áèòà â cf è èíâåðñèÿ åãî
jnc .enable_box ;åñëè CF=1 òî îòîáðàçèì âêëþ÷åííûé áîêñ è âûéäåì
push dword .check_box_mouse_end ;ôîêóñ -ïîêóñ, âåðíåìñÿ ïîñëå âûçîâà check_box_clear_ch íà ìåòêó check_box_mouse_end
jmp check_box_clear_ch2 ;âûêëþ÷èòü ÷åê áîêñ ò.å. íà ìåñòå çàêðàøåííîãî ïðÿìîóãîëüíèêà îòîáðàçèòü öâåò ôîíà.
jmp check_box_clear_ch ;âûêëþ÷èòü ÷åê áîêñ ò.å. íà ìåñòå çàêðàøåííîãî ïðÿìîóãîëüíèêà îòîáðàçèòü öâåò ôîíà.
 
.enable_box:
call check_box_draw_ch2 ;îòîáðàçèòü âêëþ÷åííûé ÷åê áîêñ
call check_box_draw_ch ;îòîáðàçèòü âêëþ÷åííûé ÷åê áîêñ
.check_box_mouse_end:
popad ;âîññòàíîâèòü ðåãèñòðû èç ñòåêà
ret 4 ;âûéòè è âîññòàíîâèì ñòåê
/programs/develop/libraries/box_lib/trunk/d_button.asm
0,0 → 1,169
;**************************************************************
; Dinamic Button Macro for Kolibri OS
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
macro dinamic_button_exit
{
popa
ret 4
}
;*****************************************************************************
align 16
dinamic_button:
db_type equ [edi]
db_size_x equ [edi+4]
db_start_x equ [edi+6]
db_size_y equ [edi+8]
db_start_y equ [edi+10]
db_mouse_pos equ [edi+12]
db_mouse_keys equ [edi+16]
db_mouse_keys_old equ [edi+20]
db_active_raw equ [edi+24]
db_passive_raw equ [edi+28]
db_click_raw equ [edi+32]
db_resolution_raw equ [edi+36]
db_palette_raw equ [edi+40]
db_offset_raw equ [edi+44]
db_select equ [edi+48]
db_click equ [edi+52]
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
.draw:
pusha
mov edi,dword [esp+36]
call .draw_1
dinamic_button_exit
 
.draw_1:
cmp dword db_select,1
je .active_1
cmp dword db_select,2
je .click_2
mov ebx,db_passive_raw
jmp .draw_2
.active_1:
mov ebx,db_active_raw
jmp .draw_2
.click_2:
mov ebx,db_click_raw
@@:
.draw_2:
mov cx,db_size_x
shl ecx,16
mov cx,db_size_y
mov dx,db_start_x
shl edx,16
mov dx,db_start_y
 
mov esi,db_resolution_raw
 
mov ebp,db_offset_raw
push edi
mov edi,db_palette_raw
mcall SF_PUT_IMAGE_EXT
pop edi
ret
;*****************************************************************************
;*****************************************************************************
; mouse event
;*****************************************************************************
;*****************************************************************************
align 4
.mouse:
pusha
mov edi,dword [esp+36]
mcall SF_MOUSE_GET,SSF_BUTTON
mov ebx,db_mouse_keys
mov db_mouse_keys_old,ebx
mov db_mouse_keys,eax
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov db_mouse_pos,eax
test eax,0x80000000
jnz .exit_menu
test eax,0x8000
jnz .exit_menu
 
mov ebx,eax
shr ebx,16 ; x position
shl eax,16
shr eax,16 ; y position
mov cx,db_start_x
cmp bx,cx
jb .exit_menu
add cx,db_size_x
cmp bx,cx
ja .exit_menu
 
mov cx,db_start_y
cmp ax,cx
jb .exit_menu
add cx,db_size_y
cmp ax,cx
ja .exit_menu
test db_mouse_keys,dword 1b
jnz @f
cmp dword db_select,1
je .exit_menu_1
mov db_select,dword 1
call .draw_1
jmp .exit_menu_1
@@:
mov eax,db_mouse_keys
cmp eax,db_mouse_keys_old
je .exit_menu_1
mov db_select,dword 2
call .draw_1
mcall SF_SLEEP, 25
mov db_select,dword 1
call .draw_1
 
mov db_click,dword 1
jmp .exit_menu_2
.exit_menu:
cmp dword db_select,0
je .exit_menu_1
mov db_select,dword 0
call .draw_1
 
.exit_menu_1:
; mov db_click,dword 0
.exit_menu_2:
dinamic_button_exit
/programs/develop/libraries/box_lib/trunk/filebrowser.asm
0,0 → 1,1547
;*****************************************************************************
; File Browser control for Kolibri OS
; Copyright (c) 2009-2013, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
;*****************************************************************************
macro file_browser_exit
{
popa
ret 4
}
;*****************************************************************************
fb_type equ dword [edi] ;dword
fb_size_x equ [edi+4] ;word
fb_start_x equ [edi+6] ;word
fb_size_y equ [edi+8] ;word
fb_start_y equ [edi+10] ;word
fb_icon_size_y equ word [edi+12] ;word
fb_icon_size_x equ word [edi+14] ;word
fb_line_size_x equ word [edi+16] ;word
fb_line_size_y equ word [edi+18] ;word
fb_type_size_x equ word [edi+20] ;word
fb_size_size_x equ word [edi+22] ;word
fb_date_size_x equ word [edi+24] ;word
fb_attributes_size_x equ word [edi+26] ;word
fb_icon_assoc_area equ dword [edi+28] ;dword
fb_icon_raw_area equ dword [edi+32] ;dword
fb_resolution_raw equ dword [edi+36] ;dword
fb_palette_raw equ dword [edi+40] ;dword
fb_directory_path_area equ dword [edi+44] ;dword
fb_file_name_area equ dword [edi+48] ;dword
fb_select_flag equ dword [edi+52] ;dword
fb_background_color equ dword [edi+56] ;dword
fb_select_color equ dword [edi+60] ;dword
fb_seclect_text_color equ dword [edi+64] ;dword
fb_text_color equ dword [edi+68] ;dword
fb_reduct_text_color equ dword [edi+72] ;dword
fb_marked_text_color equ dword [edi+76] ;dword
fb_max_panel_line equ dword [edi+80] ;dword
fb_select_panel_counter equ dword [edi+84] ;dword
fb_folder_block equ dword [edi+88] ;dword
fb_start_draw_line equ dword [edi+92] ;dword
fb_start_draw_cursor_line equ word [edi+96] ;word
fb_folder_data equ dword [edi+98] ;dword
fb_temp_counter equ dword [edi+102] ;dword
fb_file_name_length equ dword [edi+106] ;dword
fb_marked_file equ dword [edi+110] ;dword
fb_extension_size equ dword [edi+114] ;dword
fb_extension_start equ dword [edi+118] ;dword
fb_type_table equ dword [edi+122] ;dword
fb_ini_file_start equ dword [edi+126] ;dword
fb_ini_file_end equ dword [edi+130] ;dword
fb_draw_scroll_bar equ dword [edi+134] ;dword
fb_font_size_y equ word [edi+138] ;dword
fb_font_size_x equ word [edi+140] ;dword
fb_mouse_keys equ dword [edi+142] ;dword
fb_mouse_keys_old equ dword [edi+146] ;dword
fb_mouse_pos equ dword [edi+150] ;dword
fb_mouse_keys_delta equ dword [edi+154] ;dword
fb_mouse_key_delay equ dword [edi+158] ;dword
fb_mouse_keys_tick equ dword [edi+162] ;dword
fb_start_draw_cursor_line_2 equ word [edi+166] ;dword
fb_all_redraw equ dword [edi+168] ;dword
fb_selected_BDVK_adress equ dword [edi+172] ;dword
fb_key_action equ word [edi+176] ;word
fb_key_action_num equ word [edi+178] ;word
fb_name_temp_area equ dword [edi+180] ;dword
fb_max_name_temp_size equ dword [edi+184] ;dword
fb_display_name_max_length equ dword [edi+188] ;dword
fb_draw_panel_selection_flag equ dword [edi+192] ;dword
fb_mouse_pos_old equ dword [edi+196] ;dword
fb_marked_counter equ dword [edi+200] ;dword
fb_keymap_pointer equ dword [edi+204] ;dword
;---------------------------------------------------------------------
align 16
fb_draw_panel:
pusha
mov edi,dword [esp+36]
call fb_clear_panel
call fb_calc_max_panel_line
call fb_calc_folder_sysdata
call fb_draw_panel_selection
call fb_draw_folder_data
call fb_prepare_selected_BDVK_adress
file_browser_exit
;---------------------------------------------------------------------
fb_draw_panel_1:
pusha
mov eax,fb_select_color
push eax
mov eax,fb_seclect_text_color
push eax
mov ax,fb_start_draw_cursor_line
push eax
mov eax,fb_background_color
mov fb_select_color,eax
mov eax,fb_text_color
mov fb_seclect_text_color,eax
mov ax,fb_start_draw_cursor_line_2
mov fb_start_draw_cursor_line,ax
call fb_draw_panel_selection
pop eax
mov fb_start_draw_cursor_line,ax
pop eax
mov fb_seclect_text_color,eax
pop eax
mov fb_select_color,eax
call fb_draw_panel_selection
call fb_draw_folder_data
popa
ret
;---------------------------------------------------------------------
align 4
fb_clear_panel:
cmp fb_all_redraw,1
jne @f
xor eax,eax
mov fb_max_name_temp_size,eax
@@:
ret
;---------------------------------------------------------------------
align 4
fb_calc_folder_sysdata:
mov eax,fb_folder_data
mov eax,[eax+4]
mov fb_folder_block,eax
ret
;---------------------------------------------------------------------
align 4
fb_calc_max_panel_line:
xor eax,eax
xor ebx,ebx
mov ax,fb_size_y
mov bx,fb_line_size_y
test ebx,ebx
jnz @f
inc ebx
@@:
xor edx,edx
div ebx
mov fb_max_panel_line,eax
ret
;---------------------------------------------------------------------
align 4
fb_draw_panel_selection:
cmp fb_all_redraw,2
je .end
mov eax,fb_folder_block
test eax,eax
jz .end
xor eax,eax
cmp fb_select_panel_counter,eax
je .end
mov eax,fb_folder_block
sub eax,fb_start_draw_line
mov cx,fb_start_draw_cursor_line
call fb_for_all_panel_selection
mov eax,fb_folder_block
dec eax
xor edx,edx
mov dx,fb_line_size_y
imul eax,edx
cmp ax,cx
jae @f
mov cx,ax
@@:
mov fb_start_draw_cursor_line,cx
mov ebx,fb_size_x
add cx,fb_start_y
shl ecx,16
mov cx,fb_line_size_y
mov edx,fb_select_color
xor eax,eax
mov ax,fb_icon_size_x
add eax,2
sub ebx,eax
shl eax,16
push eax
add ebx,eax
mcall SF_DRAW_RECT
pop ebx
cmp fb_all_redraw,0
je .end
mov bx,fb_start_x
ror ebx,16
mcall SF_DRAW_RECT,,,fb_background_color
.end:
ret
;---------------------------------------------------------------------
align 4
fb_for_all_panel_selection:
xor edx,edx
mov dx,fb_line_size_y
imul eax,edx
cmp ax,cx
jae @f
mov cx,ax
@@:
mov eax,fb_max_panel_line
dec eax
imul eax,edx
cmp ax,cx
jae @f
mov cx,ax
@@:
ret
;---------------------------------------------------------------------
align 4
fb_draw_folder_data:
mov eax,fb_folder_block
sub eax,fb_max_panel_line
test eax,0x80000000
jz .ok_left
mov fb_start_draw_line,0
jmp @f
.ok_left:
cmp eax,fb_start_draw_line
jae @f
mov fb_start_draw_line,eax
@@:
mov bx,fb_start_x
add bx,3
add bx,fb_icon_size_x
shl ebx,16
mov bx,fb_start_y
mov edx,fb_start_draw_line
imul edx,304
add edx,fb_folder_data
add edx,32+40
xor eax,eax
.start:
pusha
mov eax,edx
sub eax,fb_folder_data
sub eax,32+40
xor edx,edx
mov ebx,304
div ebx
cmp eax,fb_folder_block
je .end_1
popa
cmp eax,fb_max_panel_line
je .end_2
mov fb_marked_file,0
cmp [edx+299-40],byte 0
je @f
mov fb_marked_file,1
@@:
call fb_clear_line
call fb_draw_type_size_date
cmp fb_all_redraw,2
je .draw_icon
cmp fb_all_redraw,0
je @f
.draw_icon:
call fb_draw_icon
@@:
push eax
xor eax,eax
mov ax,fb_size_x
push ebx edx
xor ebx,ebx
mov bx,fb_font_size_x
xor edx,edx
div ebx
pop edx ebx
sub eax,23+2+2
mov esi,fb_file_name_length
mov fb_temp_counter,0
mov fb_display_name_max_length,eax
cmp esi,eax
jbe @f
mov esi,eax
mov fb_temp_counter,1
@@:
cmp fb_max_name_temp_size,esi
jae @f
mov fb_max_name_temp_size,esi
inc fb_max_name_temp_size
@@:
mov ecx,fb_text_color
cmp fb_marked_file,0
je @f
mov ecx,fb_reduct_text_color
@@:
mov ax,fb_line_size_y
sub ax,fb_font_size_y
push ebx
mov bx,ax
shr ax,1
test bx,1b
jz @f
inc ax
@@:
pop ebx
push ebx
add bx,ax
call .draw_name_temp_area
cmp fb_temp_counter,0
jz .continue
xor eax,eax
mov ax,fb_font_size_x
imul eax,fb_display_name_max_length
shl eax,16
push edx
add ebx,eax
mov esi,2
mov ecx,fb_reduct_text_color
mov edx,dword fb_truncated_filename_char
mcall SF_DRAW_TEXT
pop edx
.continue:
pop ebx
add bx,fb_line_size_y
add edx,304
pop eax
inc eax
jmp .start
;--------------------------------------
align 4
.draw_name_temp_area:
pusha
mov eax,fb_max_name_temp_size
add eax,2
sub eax,esi
mov ecx,esi
mov esi,edx
mov edi,fb_name_temp_area
cld
jcxz @f
rep movsb
cmp byte [edi-1],0
jnz @f
dec edi
inc eax
@@:
mov ecx,eax
shr ecx,2
mov eax,dword ' '
rep stosd
popa
pusha
mov edx,fb_name_temp_area
cmp fb_all_redraw,2
jne @f
mov esi,fb_max_name_temp_size
add esi,2
@@:
bts ecx,30
mov eax,fb_background_color
cmp fb_draw_panel_selection_flag,1
jne @f
mov eax,fb_select_color
@@:
mov edi,eax
mcall SF_DRAW_TEXT
popa
ret
;--------------------------------------
.end_1:
popa
.end_2:
cmp fb_all_redraw,1
jne @f
mov ax,fb_start_y
add ax,fb_size_y
mov cx,bx
rol ecx,16
mov cx,ax
mov eax,ecx
shr eax,16
sub cx,ax
cmp cx,0
jbe @f
mov bx,fb_size_x
ror ebx,16
sub bx,fb_icon_size_x
sub bx,3
rol ebx,16
mov edx,fb_background_color ;0xffffff
mcall SF_DRAW_RECT
@@:
ret
;---------------------------------------------------------------------
align 4
fb_clear_line:
mov fb_draw_panel_selection_flag,0
pusha
shl ebx,16
shr ebx,16
cmp fb_select_panel_counter,0
je .continue
mov ax,fb_start_draw_cursor_line
add ax,fb_start_y
cmp bx,ax
jne .continue
mov fb_draw_panel_selection_flag,1
jmp .end
.continue:
cmp fb_all_redraw,2
je .end
cmp fb_all_redraw,0
je .end
mov ebx,[esp+16]
mov cx,bx
rol ecx,16
mov cx,fb_line_size_y
mov bx,fb_size_x
ror ebx,16
sub bx,fb_icon_size_x
sub bx,3
rol ebx,16
mcall SF_DRAW_RECT,,,fb_background_color
.end:
popa
ret
;---------------------------------------------------------------------
align 4
fb_draw_type_size_date:
pusha
mov eax,fb_type_table
test [edx-40],byte 0x10
jz .copy_type
mov [eax],dword '<DIR'
mov [eax+4],word '> '
mov fb_file_name_length,0
mov fb_extension_size,0
jmp .start
.copy_type:
mov [eax],dword ' '
mov [eax+4],word ' '
.start:
mov esi,edx
xor eax,eax
@@:
cld
lodsb
test eax,eax
jnz @b
mov fb_file_name_length,esi
sub fb_file_name_length,edx
mov fb_temp_counter,esi
test [edx-40],byte 0x10
jnz .size
dec esi
dec edx
@@:
std
lodsb
cmp esi,edx
je .extension_size_0
cmp al,'.'
jnz @b
add esi,2
mov fb_extension_start,esi
mov ecx,fb_temp_counter
sub ecx,esi
inc ecx
mov fb_extension_size,ecx
sub fb_file_name_length,ecx
cmp ecx,2
ja @f
inc fb_file_name_length
@@:
sub ecx,2
cmp ecx,4
jbe @f
mov ecx,3
mov eax,fb_type_table
mov [eax+3],word '..'
@@:
push edi
mov edi,fb_type_table
cld
rep movsb
pop edi
inc edx
jmp .size
.extension_size_0:
inc edx
mov fb_extension_size,0
.size:
mov eax,fb_type_table
test [edx-40],byte 0x10
jz .copy_size
mov [eax+6],dword '----'
mov [eax+6+4],word '- '
jmp .date
;-----------------------------------------
align 4
.call_decimal_string:
mov ebx,fb_type_table
add ebx,6
call fb_decimal_string_4
mov [ebx],dl
jmp .size_convert_end
;-----------------------------------------
align 4
.copy_size:
;/0x40000000 - Gb
;/0x100000 - Mb
;/0x400 Kb
mov [eax+6],dword ' '
mov [eax+6+4],word ' '
push ebx edx
mov eax,[edx-40+32]
mov ebx,eax
shr eax,30 ; /(1024*1024*1024)
test eax,eax
jz @f
mov dl,byte 'G'
jmp .call_decimal_string
@@:
mov eax,ebx
shr eax,20 ; /(1024*1024)
test eax,eax
jz @f
mov dl,byte 'M'
jmp .call_decimal_string
@@:
mov eax,ebx
shr eax,10 ; /1024
test eax,eax
jz @f
mov dl,byte 'K'
jmp .call_decimal_string
@@:
mov eax,ebx
mov ebx,fb_type_table
add ebx,6
call fb_decimal_string_4
.size_convert_end:
mov eax,fb_type_table
add eax,6
push edi
cmp [eax],byte '0'
jne @f
mov [eax],byte ' '
@@:
add eax,3
@@:
cmp [eax+1],byte ' '
jne @f
mov esi,eax
mov edi,esi
inc edi
mov ecx,5
std
rep movsb
jmp @r
@@:
pop edi
pop edx ebx
;-----------------------------------------
.date:
xor eax,eax
mov al,[edx-40+28]
push ebx
mov ebx,fb_type_table
add ebx,12
call fb_decimal_string_2 ; day
mov al,[edx-40+29]
mov ebx,fb_type_table
add ebx,12+3
call fb_decimal_string_2 ; month
mov ax,[edx-40+30]
mov ebx,fb_type_table
add ebx,12+15
call fb_decimal_string_4 ; year
mov ebx,fb_type_table
mov ax,[ebx+12+15+2]
mov [ebx+12+6],ax
pop ebx
;-----------------------------------------
ror ebx,16
add bx,fb_size_x
sub ebx,122+12+15
rol ebx,16
mov ecx,fb_text_color
cmp fb_marked_file,0
je @f
mov ecx,fb_reduct_text_color
@@:
mov edx,fb_type_table
mov esi,20
mov ax,fb_line_size_y
sub ax,fb_font_size_y
push ebx
mov bx,ax
shr ax,1
test bx,1b
jz @f
inc ax
@@:
pop ebx
add bx,ax
bts ecx,30
mov eax,fb_background_color
cmp fb_draw_panel_selection_flag,1
jne @f
mov eax,fb_select_color
@@:
mov edi,eax
mcall SF_DRAW_TEXT
popa
ret
;---------------------------------------------------------------------
align 4
fb_draw_icon:
pusha
xor eax,eax
mov ax,fb_icon_size_y
mov ebx,fb_resolution_raw
imul eax,ebx
mov bx,fb_icon_size_x
imul eax,ebx
mov ebx,eax
shr eax,3
test ebx,111b
jz @f
inc eax
@@:
test [edx-40],byte 0x10
jnz .draw_dir_pic
call fb_get_icon_number
imul ebx,eax ;16*16*3
jmp .draw
.draw_dir_pic:
xor ebx,ebx
cmp [edx],word '..'
jne .draw
mov ebx,eax ;16*16*3
.draw:
add ebx,fb_icon_raw_area
mov cx,fb_icon_size_x
shl ecx,16
mov cx,fb_icon_size_y
mov edx,[esp+16]
ror edx,16
sub edx,2
sub dx,fb_icon_size_x
rol edx,16
mov ax,fb_line_size_y
sub ax,fb_icon_size_y
shr ax,1
add dx,ax
mov esi,fb_resolution_raw
xor ebp,ebp
push edi
mov edi,fb_palette_raw
mcall SF_PUT_IMAGE_EXT
pop edi
popa
ret
;---------------------------------------------------------------------
; Convert of a binary number in decimal string form
; Input:
; AX - value
; EBX - address of string
; Output:
; string contains the number, marked the end of the code 0
align 4
fb_decimal_string_2:
push eax ebx ecx edx
xor ecx,ecx
mov [ebx],byte '0'
inc ebx
.p3:
xor edx,edx
push ebx
mov ebx,10
div ebx
pop ebx
add edx,48
push edx
inc ecx
cmp ax,0
jne .p3
cmp ecx,1
jbe .p4
mov ecx,2
dec ebx
.p4:
pop edx
mov [ebx],dl
inc ebx
loop .p4
pop edx ecx ebx eax
ret
;---------------------------------------------------------------------
align 4
fb_decimal_string_4:
push eax ecx edx
xor ecx,ecx
mov [ebx],byte '0'
inc ebx
.p3:
xor edx,edx
push ebx
mov ebx,10
div ebx
pop ebx
add edx,48
push edx
inc ecx
cmp eax,0
jne .p3
cmp ecx,3
jbe .p4
mov ecx,4
dec ebx
.p4:
pop edx
mov [ebx],dl
inc ebx
loop .p4
pop edx ecx eax
ret
;---------------------------------------------------------------------
align 4
fb_get_icon_number:
push eax
mov ebp,fb_extension_size
test ebp,ebp
je .end
dec ebp
test ebp,ebp
je .end
dec ebp
test ebp,ebp
je .end
@@:
mov edx,fb_ini_file_end
sub edx,ebp
mov eax,fb_ini_file_start
dec eax
.search_association:
cmp edx,eax
jbe .end
mov esi,fb_extension_start
inc eax
mov ecx,eax
mov ebx,eax
cld
.check:
lodsb
test al,al
jz @f
call fb_char_toupper
shl ax,8
.search_start_of_line:
mov al,[ebx]
inc ebx
call fb_char_toupper
cmp al,ah
je .check
mov eax,ecx
jmp .search_association
@@:
mov esi,ecx
add esi,ebp
lodsb
cmp al,byte '='
jne .end
mov eax,ecx
cmp eax,fb_ini_file_start
je @f
dec eax
cmp [eax],byte 15
ja .end
@@:
xor ebx,ebx
xor eax,eax
mov ecx,9
call .calculate
cmp al,0x30
jb .end
cmp al,0x39
ja .end
sub eax,0x30
@@:
call .calculate_1
cmp al,0x30
jb @f
cmp al,0x39
ja @f
sub eax,0x30
lea ebx,[ebx+ebx*4]
shl ebx,1
dec ecx
jnz @b
@@:
pop eax
ret
.end:
mov ebx,2
pop eax
ret
;---------------------------------------------------------------------
align 4
.calculate_1:
add ebx,eax
.calculate:
xor eax,eax
cld
lodsb
ret
;---------------------------------------------------------------------
align 4
fb_char_toupper:
; convert character to uppercase, using cp866 encoding
; in: al=symbol
; out: al=converted symbol
cmp al,'a'
jb .ret
cmp al, 'z'
jbe .az
cmp al, ' '
jb .ret
cmp al, 'à'
jb .rus1
cmp al, 'ï'
ja .ret
; 0xE0-0xEF -> 0x90-0x9F
sub al, 'à'-''
.ret:
ret
.rus1:
; 0xA0-0xAF -> 0x80-0x8F
.az:
and al, not 0x20
ret
;---------------------------------------------------------------------
align 4
fb_char_todown:
; convert character to lowercase, using cp866 encoding
; in: al=symbol
; out: al=converted symbol
cmp al, 'A'
jb .ret
cmp al, 'Z'
jbe .az
cmp al, '€'
jb .ret
cmp al, ''
jb .rus1
cmp al, 'Ÿ'
ja .ret
; 0x90-0x9F -> 0xE0-0xEF
add al, 'à'-''
.ret:
ret
.rus1:
; 0x80-0x8F -> 0xA0-0xAF
.az:
add al, 0x20
ret
;---------------------------------------------------------------------
fb_truncated_filename_char:
db '..'
;---------------------------------------------------------------------
;*****************************************************************************
;*****************************************************************************
; mouse event
;*****************************************************************************
;*****************************************************************************
align 4
fb_mouse:
pusha
mov edi,dword [esp+36]
;-------------------------------------------------------
mcall SF_MOUSE_GET,SSF_BUTTON
mov ebx,fb_mouse_keys
mov fb_mouse_keys_old,ebx
mov fb_mouse_keys,eax
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,fb_mouse_pos
mov fb_mouse_pos_old,ebx
mov fb_mouse_pos,eax
test eax,0x80000000
jnz .exit_fb
test eax,0x8000
jnz .exit_fb
 
mov ebx,eax
shr ebx,16 ; x position
shl eax,16
shr eax,16 ; y position
mov cx,fb_start_x
cmp bx,cx
jb .exit_fb
add cx,fb_size_x
cmp bx,cx
ja .exit_fb
 
mov cx,fb_start_y
cmp ax,cx
jb .exit_fb
add cx,fb_size_y
cmp ax,cx
ja .exit_fb
 
cmp fb_mouse_keys,0
jz @f
mov fb_select_flag,1
@@:
;-------------------------------------------------------
cmp fb_mouse_keys_delta,1
je .enter_1
 
cmp fb_mouse_keys,0
jz .exit_fb
.start:
sub ax,fb_start_y
xor ebx,ebx
mov bx,fb_line_size_y
xor edx,edx
push eax
div ebx
pop eax
sub eax,edx
xor edx,edx
cmp fb_select_panel_counter,edx
jne @f
mov fb_mouse_keys_delta,0
jmp .continue
@@:
xor edx,edx
cmp fb_start_draw_cursor_line,ax
jne @f
cmp fb_mouse_keys,edx
jnz .continue
@@:
mov fb_mouse_keys_delta,edx
.continue:
xor ebx,ebx
mov bx,fb_line_size_y
imul ebx,fb_folder_block
cmp eax,ebx
jb @f
xor edx,edx
mov dx,fb_line_size_y
sub ebx,edx
cmp bx,fb_start_draw_cursor_line
je .enter
call .store_old_cursor_line
mov fb_start_draw_cursor_line,bx
jmp .continue_1
@@:
cmp ax,fb_start_draw_cursor_line
je .enter
call .store_old_cursor_line
mov fb_start_draw_cursor_line,ax
.continue_1:
test fb_mouse_keys,10b
jne .mark_mouse
jmp .enter_1
.continue_2:
mov ax,fb_start_draw_cursor_line
cmp ax,fb_start_draw_cursor_line_2
je .exit_fb
 
call fb_draw_panel_1
jmp .exit_fb
.enter:
cmp fb_mouse_keys_delta,2
je .enter_2
cmp fb_mouse_keys_delta,1
je .enter_1
mov eax,fb_mouse_keys_old
cmp fb_mouse_keys,eax
jz .exit_fb
test fb_mouse_keys,10b
jne .mark_mouse
xor edx,edx
inc edx
mov fb_mouse_keys_delta,edx
jmp .exit_fb
.enter_1:
; mov eax,fb_mouse_keys_old
; cmp fb_mouse_keys,eax
; jz .exit_fb
test fb_mouse_keys,10b
jne .mark_mouse
mov edx,2
mov fb_mouse_keys_delta,edx
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
add eax,fb_mouse_key_delay
mov fb_mouse_keys_tick,eax
jmp .continue_2
.enter_2:
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
cmp eax,fb_mouse_keys_tick
ja @f
; mov eax,fb_mouse_pos_old
; cmp eax,fb_mouse_pos
; jne @f
mov eax,fb_mouse_keys_old
cmp fb_mouse_keys,eax
jz @f
test fb_mouse_keys,10b
jne .mark_mouse
call .enter_3
jmp .exit_fb
@@:
xor eax,eax
inc eax
mov fb_mouse_keys_delta,eax
;-------------------------------------------------------
.exit_fb:
call fb_prepare_selected_BDVK_adress
file_browser_exit
;-------------------------------------------------------
align 4
.mark_mouse:
call fb_key.mark_1
call fb_draw_panel_1
xor eax,eax
mov fb_mouse_keys_delta,eax
jmp .exit_fb
;-------------------------------------------------------
align 4
.enter_3:
xor eax,eax
mov fb_mouse_keys,eax
mov fb_mouse_keys_old,eax
mov eax,3
mov fb_mouse_keys_delta,eax
xor eax,eax
mov fb_max_name_temp_size,eax
ret
;-------------------------------------------------------
align 4
.store_old_cursor_line:
push eax
mov ax,fb_start_draw_cursor_line
mov fb_start_draw_cursor_line_2,ax
xor eax,eax
; mov fb_mouse_keys_delta,eax
pop eax
ret
;*****************************************************************************
;*****************************************************************************
align 4
fb_prepare_selected_BDVK_adress:
xor eax,eax
mov ax,fb_start_draw_cursor_line
xor ebx,ebx
mov bx,fb_line_size_y
xor edx,edx
div ebx
add eax,fb_start_draw_line
imul eax,304
add eax,32
add eax,fb_folder_data
mov fb_selected_BDVK_adress,eax
ret
;*****************************************************************************
;*****************************************************************************
; key event
; 1 - arrow down
; 2 - arrow up
; 3 - PageDown
; 4 - PageUp
; 5 - Home
; 6 - End
; 7 - Enter
; 8 - Insert (Mark)
; 9 - Mark All
; 10 - Unmark All
; 11 - Invert Mark
; 12 - Search with key
;*****************************************************************************
;*****************************************************************************
align 4
fb_key:
pusha
mov edi,dword [esp+36]
;-------------------------------------------------------
xor eax,eax
mov ax,fb_key_action
shl eax,2
add eax,dword fb_key_table
cmp eax,fb_key_table.end
jae .exit_fb
cmp [eax],dword 0
je .exit_fb
jmp dword [eax]
;-------------------------------------------------------
align 4
.arrow_down:
mov ax,fb_start_draw_cursor_line
add ax,fb_line_size_y
add ax,fb_line_size_y
cmp ax,word fb_size_y
ja @f
.add_1:
call fb_mouse.store_old_cursor_line
mov ax,fb_start_draw_cursor_line
add ax,fb_line_size_y
mov fb_start_draw_cursor_line,ax
call fb_draw_panel_1
jmp .exit_fb
@@:
mov eax,fb_folder_block
sub eax,fb_max_panel_line
test eax,0x80000000
jnz .page_down_2
 
call .prepare_data_down
ja @f
 
cmp fb_start_draw_line,eax
je .exit_fb
@@:
inc fb_start_draw_line
call fb_draw_panel_3
jmp .exit_fb
;-------------------------------------------------------
align 4
.arrow_up:
mov ax,fb_start_draw_cursor_line
add ax,fb_start_y
cmp fb_start_y,ax
je @f
call fb_mouse.store_old_cursor_line
mov ax,fb_start_draw_cursor_line
sub ax,fb_line_size_y
mov fb_start_draw_cursor_line,ax
call fb_draw_panel_1
jmp .exit_fb
@@:
cmp fb_start_draw_line,0
je .exit_fb
dec fb_start_draw_line
call fb_draw_panel_3
jmp .exit_fb
;-------------------------------------------------------
align 4
.page_down:
mov eax,fb_max_panel_line
mov ebx,fb_folder_block
sub ebx,eax
test ebx,0x80000000
jnz .page_down_2
sub ebx,fb_start_draw_line
cmp ebx,eax
ja .page_down_3
mov ebx,fb_folder_block
sub ebx,eax
call .prepare_data_down
ja @f
cmp ebx,fb_start_draw_line
je .exit_fb
@@:
mov fb_start_draw_line,ebx
.page_down_0:
dec eax
xor ebx,ebx
mov bx,fb_line_size_y
imul eax,ebx
.page_down_1:
call fb_mouse.store_old_cursor_line
mov fb_start_draw_cursor_line,ax
call fb_draw_panel_2
jmp .exit_fb
.page_down_2:
mov eax,fb_folder_block
sub eax,fb_start_draw_line
dec eax
xor ebx,ebx
mov bx,fb_line_size_y
imul eax,ebx
cmp ax,fb_start_draw_cursor_line
jbe .exit_fb
jmp .page_down_1
.page_down_3:
add fb_start_draw_line,eax
call fb_draw_panel_2
jmp .exit_fb
;-------------------------------------------------------
align 4
.prepare_data_down:
mov ecx,fb_folder_block
sub ecx,fb_start_draw_line
dec ecx
xor edx,edx
mov dx,fb_line_size_y
imul ecx,edx
cmp cx,fb_start_draw_cursor_line
ret
;-------------------------------------------------------
align 4
.page_up:
mov eax,fb_max_panel_line
mov ebx,fb_start_draw_line
sub ebx,eax
test ebx,0x80000000
jz @f
cmp fb_start_draw_line,0
jne .page_up_1
cmp fb_start_draw_cursor_line,0
je .exit_fb
mov fb_start_draw_cursor_line,0
.page_up_1:
mov fb_start_draw_line,0
call fb_draw_panel_2
jmp .exit_fb
@@:
sub fb_start_draw_line,eax
call fb_draw_panel_2
jmp .exit_fb
;-------------------------------------------------------
align 4
.home:
cmp fb_start_draw_line,0
jne @f
cmp fb_start_draw_cursor_line,0
je .exit_fb
@@:
mov fb_start_draw_line,0
mov fb_start_draw_cursor_line,0
call fb_mouse.store_old_cursor_line
call fb_draw_panel_2
jmp .exit_fb
;-------------------------------------------------------
align 4
.end:
mov eax,fb_folder_block
sub eax,fb_max_panel_line
test eax,0x80000000
jnz .page_down_2
call .prepare_data_down
ja @f
cmp eax,fb_start_draw_line
je .exit_fb
@@:
mov fb_start_draw_line,eax
mov eax,fb_max_panel_line
jmp .page_down_0
;-------------------------------------------------------
align 4
.enter:
call fb_mouse.enter_3
jmp .exit_fb
;-------------------------------------------------------
align 4
.mark:
call .mark_1
jmp .arrow_down
;-------------------------------------------------------
align 4
.mark_1:
mov eax,fb_folder_block
test eax,eax
jz .exit
 
xor eax,eax
mov ax,fb_start_draw_cursor_line
xor edx,edx
xor ebx,ebx
mov bx,fb_line_size_y
div ebx
mov esi,fb_start_draw_line
add esi,eax
imul esi,304
add esi,fb_folder_data
 
add esi,32+299
mov al,[esi]
and al,1
test al,al
jnz @f
inc fb_marked_counter
jmp .mark_2
@@:
dec fb_marked_counter
.mark_2:
mov al,[esi]
inc al
and al,1
mov [esi],al
.exit:
ret
;-------------------------------------------------------
align 4
.mark_all:
mov eax,fb_folder_block
test eax,eax
jz .exit_fb
 
mov fb_temp_counter,0
.mark_all_1:
mov ebp,fb_folder_block
.mark_all_2:
mov ebx,ebp
dec ebx
imul ebx,304
add ebx,fb_folder_data
add ebx,32+40
cmp [ebx],word '..'
jne .mark_all_3
cmp [ebx+2],byte 0
je @f
.mark_all_3:
call .select_mark_action
@@:
dec ebp
jnz .mark_all_2
call fb_draw_panel_3
cmp fb_temp_counter,0
jne @f
mov eax,fb_folder_block
jmp .mark_all_4
@@:
cmp fb_temp_counter,1
jne @f
mov fb_marked_counter,0
jmp .exit_fb
@@:
mov eax,fb_folder_block
sub eax,fb_marked_counter
.mark_all_4:
dec eax
mov fb_marked_counter,eax
jmp .exit_fb
;-------------------------------------------------------
align 4
.select_mark_action:
add ebx,299-40
cmp fb_temp_counter,0
jne @f
mov [ebx],byte 1
jmp .select_mark_action_1
@@:
cmp fb_temp_counter,1
jne @f
mov [ebx],byte 0
jmp .select_mark_action_1
@@:
mov al,[ebx]
inc al
and al,1
mov [ebx],al
.select_mark_action_1:
ret
;-------------------------------------------------------
align 4
.unmark_all:
mov eax,fb_folder_block
test eax,eax
jz .exit_fb
 
mov fb_temp_counter,1
jmp .mark_all_1
;-------------------------------------------------------
align 4
.invert_mark:
mov eax,fb_folder_block
test eax,eax
jz .exit_fb
 
mov fb_temp_counter,2
jmp .mark_all_1
;-------------------------------------------------------
; * bit 0 (mask 1): left Shift is pressed
; * bit 1 (mask 2): right Shift is pressed
; * bit 2 (mask 4): left Ctrl is pressed
; * bit 3 (mask 8): right Ctrl is pressed
; * bit 4 (mask 0x10): left Alt is pressed
; * bit 5 (mask 0x20): right Alt is pressed
; * bit 6 (mask 0x40): CapsLock is on
; * bit 7 (mask 0x80): NumLock is on
; * bit 8 (mask 0x100): ScrollLock is on
; * bit 9 (mask 0x200): left Win is pressed
; * bit 10 (mask 0x400): right Win is pressed
;-------------------------------------------------------
align 4
.search_with_key:
mcall SF_BOARD,SSF_GET_CONTROL_KEYS
test al,11b
jnz .shift_layout
 
test al,110000b
jnz .alt_layout
 
mov ecx,1 ; Normal
jmp .get_keyboard_layout
 
.shift_layout:
mov ecx,2 ; Shift
jmp .get_keyboard_layout
 
.alt_layout:
mov ecx,3 ; Alt
.get_keyboard_layout:
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,fb_keymap_pointer
xor eax,eax
mov ax,fb_key_action_num
add eax,fb_keymap_pointer
mov al,[eax]
and eax,0xff
call fb_char_todown
mov ah,al
xor esi,esi
push eax
movzx eax,fb_start_draw_cursor_line
movzx ebx,fb_line_size_y
xor edx,edx
div ebx
add si,ax ;fb_start_draw_cursor_line
pop eax
add esi,fb_start_draw_line
mov ecx,esi
xor ebx,ebx
inc ecx
cmp ecx,fb_folder_block
ja .reset_data
 
.first_entry:
imul esi,304
add esi,fb_folder_data
add esi,40+32
@@:
add esi,304
mov al,[esi]
call fb_char_todown
cmp ah,al
je .match
 
inc ecx
cmp ecx,fb_folder_block
jb @b
 
.reset_data:
xor esi,esi
dec esi
cmp ebx,2
jae .exit_fb
 
xor ecx,ecx
inc ebx
jmp .first_entry
 
.match:
mov fb_start_draw_line,ecx
mov eax,fb_folder_block
mov ebx,fb_max_panel_line
sub eax,ebx
jbe .1
 
cmp eax,ecx
jbe @f
xor ecx,ecx
jmp .2
@@:
mov fb_start_draw_line,eax
mov eax,fb_folder_block
sub eax,ecx
 
mov ecx,fb_max_panel_line
sub ecx,eax
jmp .2
 
.1:
xor eax,eax
mov fb_start_draw_line,eax
.2:
movzx eax,fb_line_size_y
imul ecx,eax
mov fb_start_draw_cursor_line,cx
call fb_draw_panel_2
;-------------------------------------------------------
.exit_fb:
call fb_prepare_selected_BDVK_adress
file_browser_exit
;-------------------------------------------------------
align 4
fb_key_table:
dd 0
dd fb_key.arrow_down ; 1
dd fb_key.arrow_up ; 2
dd fb_key.page_down ; 3
dd fb_key.page_up ; 4
dd fb_key.home ; 5
dd fb_key.end ; 6
dd fb_key.enter ; 7
dd fb_key.mark ; 8
dd fb_key.mark_all ; 9
dd fb_key.unmark_all ; 10
dd fb_key.invert_mark ; 11
dd fb_key.search_with_key ; 12
.end:
dd 0
;-------------------------------------------------------
align 4
fb_draw_panel_3:
mov eax,2
mov fb_all_redraw,eax
jmp fb_draw_panel_2.1
align 4
fb_draw_panel_2:
xor eax,eax
inc eax
mov fb_all_redraw,eax
call fb_draw_panel_selection
.1:
call fb_draw_folder_data
xor eax,eax
mov fb_all_redraw,eax
inc eax
mov fb_draw_scroll_bar,eax
ret
 
/programs/develop/libraries/box_lib/trunk/frame.asm
0,0 → 1,267
;**************************************************************
; 2016, 0CodErr
; Added border styles(raised, sunken, etched, ridged).
; Added possibility to fill frame background.
;**************************************************************
; Frame Macro for Kolibri OS
; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
macro frame_start
{
pusha
}
;*****************************************************************************
macro frame_exit
{
popa
ret 4
}
;*****************************************************************************
fr equ [esp + 36]
frame:
fr_type equ [eax + FR_STYLE] ; dword
fr_size_x equ [eax + FR_WIDTH] ; word
fr_start_x equ [eax + FR_LEFT] ; word
fr_size_y equ [eax + FR_HEIGHT] ; word
fr_start_y equ [eax + FR_TOP] ; word
fr_ext_fr_col equ [eax + FR_OUTER_COLOR] ; dword
fr_int_fr_col equ [eax + FR_INNER_COLOR] ; dword
fr_flags equ [eax + FR_FLAGS] ; dword
fr_text_pointer equ [eax + FR_TEXT] ; dword
fr_text_position equ [eax + FR_TEXT_POSITION] ; dword
fr_font_number equ [eax + FR_FONT] ; dword
fr_font_size_y equ [eax + FR_FONT_HEIGHT] ; dword
fr_font_color equ [eax + FR_FORE_COLOR] ; dword
fr_font_backgr_color equ [eax + FR_BACK_COLOR] ; dword
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
align 16
.draw:
frame_start
mov eax, fr
mov edx, fr_ext_fr_col
mov edi, fr_int_fr_col
mov esi, edx
mov ebp, edi
mov eax, fr_flags
and eax, 1110b
.raised:
cmp eax, FR_RAISED
je .border_style_selected
.sunken:
cmp eax, FR_SUNKEN
jne .etched
xchg edx, edi
xchg esi, ebp
jmp .border_style_selected
.etched:
cmp eax, FR_ETCHED
jne .ridged
xchg edx, edi
jmp .border_style_selected
.ridged:
cmp eax, FR_RIDGED
jne .double
xchg esi, ebp
jmp .border_style_selected
.double:
cmp eax, FR_DOUBLE
jne .border_style_selected
mov edi, edx
mov esi, ebp
.border_style_selected:
; Outer Top Line
mov eax, fr
mov bx, fr_start_x
mov cx, fr_start_y
shl ebx, 16
shl ecx, 16
mov bx, fr_size_x
add bx, fr_start_x
sub ebx, 1
mov cx, fr_start_y
mov eax, 38
int 64
; Outer Left Line
mov eax, fr
mov bx, fr_start_x
add cx, fr_size_y
sub ecx, 1
mov eax, 38
int 64
; Inner Top Line
mov eax, fr
mov bx, fr_start_x
mov cx, fr_start_y
add ebx, 1
add ecx, 1
shl ebx, 16
shl ecx, 16
mov bx, fr_size_x
mov cx, fr_start_y
add bx, fr_start_x
sub ebx, 2
add ecx, 1
mov edx, esi
mov eax, 38
int 64
; Inner Left Line
mov eax, fr
mov bx, fr_start_x
add cx, fr_size_y
add ebx, 1
sub ecx, 3
mov edx, esi
mov eax, 38
int 64
; Outer Bottom Line
mov eax, fr
mov bx, fr_size_x
mov cx, fr_size_y
add bx, fr_start_x
add cx, fr_start_y
sub ebx, 1
sub ecx, 1
shl ebx, 16
shl ecx, 16
mov bx, fr_start_x
mov cx, fr_size_y
add cx, fr_start_y
sub ecx, 1
mov edx, edi
mov eax, 38
int 64
; Outer Right Line
mov eax, fr
add bx, fr_size_x
sub ebx, 1
mov cx, fr_start_y
mov edx, edi
mov eax, 38
int 64
; Inner Bottom Line
mov eax, fr
mov bx, fr_size_x
mov cx, fr_size_y
add bx, fr_start_x
add cx, fr_start_y
sub ebx, 2
sub ecx, 2
shl ebx, 16
shl ecx, 16
mov bx, fr_start_x
mov cx, fr_size_y
add cx, fr_start_y
add ebx, 1
sub ecx, 2
mov edx, ebp
mov eax, 38
int 64
; Inner Right Line
mov eax, fr
mov cx, fr_start_y
add bx, fr_size_x
sub ebx, 3
add ecx, 1
mov edx, ebp
mov eax, 38
int 64
;----------------------------------------------------------------------
mov eax, fr
test dword fr_flags, FR_FILLED
je .fill_exit
mov bx, fr_start_x
mov cx, fr_start_y
add ebx, 2
add ecx, 2
shl ebx, 16
shl ecx, 16
mov bx, fr_size_x
mov cx, fr_size_y
sub ebx, 4
sub ecx, 4
mov edx, fr_font_backgr_color
mov eax, 13
int 64
.fill_exit:
;----------------------------------------------------------------------
mov eax, fr
test dword fr_flags, FR_CAPTION
je .exit
 
mov ecx,0xC0000000
mov eax,fr_font_number
and eax,11b
shl eax,28
add ecx,eax
mov eax, fr
mov eax,fr_font_color
and eax,0xffffff
add ecx,eax
 
mov eax, fr
 
mov eax,fr_font_backgr_color
and eax,0xffffff
 
xor esi,esi
 
mov eax, fr
mov bx,fr_start_x
add bx,10
shl ebx,16
mov bx,fr_font_size_y
shr bx,1
 
not bx
add bx,fr_start_y
 
test fr_font_size_y,word 1b
jz @f
inc bx
;--------------------------------------
align 4
@@:
cmp fr_text_position,dword 0
je .draw_1
add bx,fr_size_y
;--------------------------------------
align 4
.draw_1:
mov edx,fr_text_pointer
mov edi,fr_font_backgr_color
mcall SF_DRAW_TEXT
;----------------------------------------------------------------------
align 4
.exit:
frame_exit
;*****************************************************************************
/programs/develop/libraries/box_lib/trunk/menubar.asm
0,0 → 1,598
;**************************************************************
; MenuBar Macro for Kolibri OS
; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
macro menu_bar_exit
{
popa
ret 4
}
;*****************************************************************************
align 16
menu_bar:
m_type equ [edi]
m_size_x equ [edi+4]
m_start_x equ [edi+6]
m_size_y equ [edi+8]
m_start_y equ [edi+10]
m_text_pointer equ [edi+12]
m_pos_pointer equ [edi+16]
m_text_end equ [edi+20]
m_ret_key equ [edi+24]
m_mouse_keys equ [edi+28]
m_size_x1 equ [edi+32]
m_start_x1 equ [edi+34]
m_size_y1 equ [edi+36]
m_start_y1 equ [edi+38]
m_bckg_col equ [edi+40]
m_frnt_col equ [edi+44]
m_menu_col equ [edi+48]
m_select equ [edi+52]
m_out_select equ [edi+56]
m_buf_adress equ [edi+60]
m_procinfo equ [edi+64]
m_click equ [edi+68]
m_cursor equ [edi+72]
m_cursor_old equ [edi+76]
m_interval equ [edi+80]
m_cursor_max equ [edi+84]
m_extended_key equ [edi+88]
m_menu_sel_col equ [edi+92]
m_bckg_text_col equ [edi+96]
m_frnt_text_col equ [edi+100]
m_mouse_keys_old equ [edi+104]
m_font_height equ [edi+108]
m_cursor_out equ [edi+112]
m_get_mouse_flag equ [edi+116]
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
.draw:
pusha
mov edi,dword [esp+36]
call .draw_1
menu_bar_exit
.draw_1:
call .calc_m_cursor_max
dec dword m_cursor_max
mov eax,m_cursor_max
imul eax,m_interval
mov m_size_y1,ax
mov ebx,m_size_x
mov ecx,m_size_y
cmp dword m_select,1
je .active
mov edx,m_bckg_col
jmp @f
.active:
mov edx,m_frnt_col
@@:
mcall SF_DRAW_RECT
shr ecx,16
mov bx,cx
movzx eax,word m_size_y
call .calculate_font_offset
cmp dword m_select,1
je .active_1
mov ecx,m_bckg_text_col
add ecx,0x80000000
jmp @f
.active_1:
mov ecx,m_frnt_text_col
add ecx,0x80000000
@@:
mov edx,m_text_pointer
mcall SF_DRAW_TEXT
ret
 
.draw_2:
mcall SF_DRAW_RECT,m_size_x1,m_size_y1,m_menu_col
ret
 
.calculate_font_offset:
sub eax,m_font_height
shr eax,1
add ebx,eax
add ebx,4 shl 16
ret
.draw_3:
mov ebx,m_size_x1
mov ecx,m_size_y1
 
push ebx ecx
mov eax,m_cursor_old
imul eax,m_interval
shl eax,16
add ecx,eax
mov cx,m_interval
mcall SF_DRAW_RECT,,,m_menu_col
pop ecx ebx
push ebx ecx
mov eax,m_cursor
imul eax,m_interval
shl eax,16
add ecx,eax
mov cx,m_interval
mov edx,m_menu_sel_col
mcall SF_DRAW_RECT
pop ecx ebx
shr ecx,16
mov bx,cx
mov eax,m_interval
call .calculate_font_offset
mov edx,m_pos_pointer
xor ebp,ebp
@@:
cmp ebp,m_cursor
jne .no_active_text
mov ecx,m_frnt_text_col
mov eax,m_menu_sel_col
jmp .active_text
.no_active_text:
mov ecx,m_bckg_text_col
mov eax,m_menu_col
.active_text:
add ecx,0xC0000000
push edi
mov edi,eax
mcall SF_DRAW_TEXT
pop edi
call .get_next_text
inc ebp
add ebx,m_interval
jmp @r
.draw_end:
ret
.calc_m_cursor_max:
mov edx,m_pos_pointer
mov m_cursor_max,dword 0
@@:
inc dword m_cursor_max
call .get_next_text
jmp @r
;*****************************************************************************
.get_next_text:
mov esi,edx
@@:
cmp esi,m_text_end
je .get_next_text_end
cld
lodsb
test al,al
jnz @r
mov edx,esi
ret
.get_next_text_end:
add esp,4
ret
;*****************************************************************************
;*****************************************************************************
; mouse event
;*****************************************************************************
;*****************************************************************************
.activate:
pusha
mov edi,dword [esp+36]
jmp .start_loop
.mouse:
pusha
mov edi,dword [esp+36]
 
call .processing_real_mouse
 
test eax,0x80000000
jnz .exit_menu
test eax,0x8000
jnz .exit_menu
 
mov ebx,eax
shr ebx,16 ; x position
shl eax,16
shr eax,16 ; y position
mov cx,m_start_x
cmp bx,cx
jb .exit_menu
add cx,m_size_x
dec cx
cmp bx,cx
ja .exit_menu
 
mov cx,m_start_y
cmp ax,cx
jb .exit_menu
add cx,m_size_y
cmp ax,cx
ja .exit_menu
 
test dword m_mouse_keys,1b
jnz @f
cmp dword m_select,1
je .exit_menu_1
mov dword m_select,1
call .draw_1
jmp .exit_menu_1
@@:
cmp dword m_get_mouse_flag,1
mov m_get_mouse_flag,dword 0
je @f
mov eax,m_mouse_keys
cmp eax,m_mouse_keys_old
je .exit_menu_1
@@:
cmp dword m_type,1
jne .start_loop
 
xor eax,eax
inc eax
mov m_cursor_out,eax
mov m_click,eax
menu_bar_exit
 
.start_loop:
mov m_select,dword 1
call .draw_1
call .allocate_menu_area
call .get_menu_area
call .draw_2
.red:
call .draw_3
.still:
mcall SF_WAIT_EVENT
cmp eax,1
je .exit_menu_3
cmp eax,2
je .key_menu
cmp eax,3
je .exit_menu_3
cmp eax,6
je .mouse_menu
jmp .still
.key_menu:
mcall SF_GET_KEY
 
cmp dword m_extended_key,1
je .extended_key
test al,al
jnz .key_menu_end
cmp ah, 0xE0
jne @f
mov m_extended_key,dword 1
.key_menu_end:
jmp .still
@@:
cmp ah,72 ;Arrow Up
je .menu_key_72_1
cmp ah,80 ; Arrow Down
je .menu_key_80_1
cmp ah,28 ; Enter
je .menu_key_28_1
cmp ah,1 ; Esc
je .menu_key_1_1
cmp ah,75 ; L-Arrow down
je .menu_key_75_1
cmp ah,77 ; R-Arrow down
je .menu_key_77_1
.key_menu_end_1:
cmp ah,208 ; Arrow Down
je .key_menu_end
cmp ah,200 ; Arrow Up
je .key_menu_end
cmp ah,156 ; Enter
je .key_menu_end
cmp ah,129 ; Esc
je .key_menu_end
cmp ah,199 ;Home
je .key_menu_end
cmp ah,207 ;End
je .key_menu_end
cmp ah,201 ;Page UP
je .key_menu_end
cmp ah,209 ;Page Down
je .key_menu_end
cmp ah,42 ; NumLock ON
je .key_menu_end
cmp ah,170 ; NumLock ON
je .key_menu_end
cmp ah,210 ; Insert
je .key_menu_end
cmp ah,211 ; Delete
je .key_menu_end
cmp ah,157 ; Ctrl up
je .key_menu_end
cmp ah,184 ; Alt up
je .key_menu_end
cmp ah,170 ; L-Shift up
je .key_menu_end
cmp ah,182 ; R-Shift up
je .key_menu_end
cmp ah,203 ; L-Arrow up
je .key_menu_end
cmp ah,205 ; R-Arrow up
je .key_menu_end
 
jmp .exit_menu_3
 
;---------------------------------------------------------------------
.extended_key:
mov m_extended_key, dword 0
.menu_key_80:
cmp ah,80 ; arrow down
jne .menu_key_72
.menu_key_80_1:
mov eax,m_cursor_max
dec eax
cmp eax,m_cursor
je .still ;@f
mov ebx,m_cursor
mov m_cursor_old,ebx
inc dword m_cursor
;@@:
jmp .red
;---------------------------------------------------------------------
.menu_key_72:
cmp ah,72 ;arrow up
jne .menu_key_71
.menu_key_72_1:
cmp m_cursor,dword 0
je .still ;@f
mov ebx,m_cursor
mov m_cursor_old,ebx
dec dword m_cursor
;@@:
jmp .red
;---------------------------------------------------------------------
.menu_key_71:
cmp ah,71 ;Home
je @f
cmp ah,73 ;PageUp
jne .menu_key_79
@@:
cmp dword m_cursor,0
je .still
mov ebx,m_cursor
mov m_cursor_old,ebx
mov m_cursor,dword 0
jmp .red
;---------------------------------------------------------------------
.menu_key_79:
cmp ah,79 ; End
je @f
cmp ah,81 ; PageDown
jne .menu_key_1
@@:
mov ecx,m_cursor_max
dec ecx
cmp m_cursor,ecx
je .still
mov ebx,m_cursor
mov m_cursor_old,ebx
mov m_cursor,ecx
jmp .red
;---------------------------------------------------------------------
.menu_key_1:
cmp ah,1 ; Esc
jne .menu_key_28
.menu_key_1_1:
jmp .exit_menu_3
;---------------------------------------------------------------------
.menu_key_28:
cmp ah,28 ; Enter
jne .menu_key_75
.menu_key_28_1:
xor eax,eax
mov m_mouse_keys_old,eax
inc eax
mov m_mouse_keys,eax
jmp .exit_menu_2
;---------------------------------------------------------------------
.menu_key_75:
cmp ah,75 ; L-Arrow down
jne .menu_key_77
.menu_key_75_1:
mov m_ret_key,dword 1
jmp .exit_menu_3
;---------------------------------------------------------------------
.menu_key_77:
cmp ah,77 ; R-Arrow down
jne .key_menu_end_1
.menu_key_77_1:
mov m_ret_key,dword 2
jmp .exit_menu_3
;---------------------------------------------------------------------
.processing_real_mouse:
mcall SF_MOUSE_GET,SSF_BUTTON
mov ebx,m_mouse_keys
mov m_mouse_keys_old,ebx
mov m_mouse_keys,eax
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
ret
;---------------------------------------------------------------------
.allocate_menu_area:
call .free_menu_area
movzx ecx,word m_size_x1
movzx eax,word m_size_y1
imul ecx,eax
lea ecx,[ecx*3]
mcall SF_SYS_MISC,SSF_MEM_ALLOC
mov m_buf_adress,eax
ret
;---------------------------------------------------------------------
.free_menu_area:
cmp dword m_buf_adress,0
je @f
mcall SF_SYS_MISC,SSF_MEM_FREE,m_buf_adress
xor eax,eax
mov m_buf_adress,eax
@@:
ret
;---------------------------------------------------------------------
.get_menu_area:
mcall SF_THREAD_INFO, m_procinfo,-1
mov cx,m_size_x1
shl ecx,16
mov cx,m_size_y1
mov dx,m_start_x1
mov eax,m_procinfo
add dx,[eax+34]
add dx,[eax+54]
shl edx,16
mov dx,m_start_y1
add dx,[eax+38]
add dx,[eax+58]
mcall SF_GET_IMAGE, m_buf_adress
ret
;---------------------------------------------------------------------
.put_menu_area:
mov cx,m_size_x1
shl ecx,16
mov cx,m_size_y1
mov dx,m_start_x1
shl edx,16
mov dx,m_start_y1
mcall SF_PUT_IMAGE, m_buf_adress
call .free_menu_area
ret
;---------------------------------------------------------------------
.mouse_menu:
call .processing_real_mouse
 
test eax,0x80000000
jnz .still
test eax,0x8000
jnz .still
mov ebx,eax
shr ebx,16
shl eax,16
shr eax,16
xor ecx,ecx
mov cx,m_start_y1
cmp ax,cx
jbe .close
add cx,m_size_y1
cmp ax,cx
jae .close
mov cx,m_start_x1
cmp bx,cx
jbe .close
add cx,m_size_x1
cmp bx,cx
jae .close
sub ax,m_start_y1
mov ebx,m_interval
xor edx,edx
div ebx
mov ebx,m_cursor
cmp eax,ebx
je .no_red
mov m_cursor_old,ebx
cmp eax,m_cursor_max
jb @f
mov eax,m_cursor_max
@@:
mov m_cursor,eax
test m_mouse_keys,dword 1b
jz .red
jmp .exit_menu_2
.no_red:
test m_mouse_keys,dword 1b
jz .still
jmp .exit_menu_2
.close:
test m_mouse_keys,dword 1b
jz .still
jmp .exit_menu_3
.exit_menu:
cmp dword m_select,0
je .exit_menu_1
mov m_select,dword 0
call .draw_1
 
test m_mouse_keys,dword 1b
jz .exit_menu_1
.exit_menu_3:
mov m_select,dword 0
call .put_menu_area
xor eax,eax
mov m_cursor_out,eax
jmp .exit
.exit_menu_2:
mov m_select,dword 0
call .put_menu_area
mov edx,m_pos_pointer
mov ebx,m_cursor
@@:
cmp ebx,0
jz @f
dec ebx
call .get_next_text
jmp @r
@@:
mov m_out_select,edx
mov eax,m_cursor
inc eax
mov m_cursor_out,eax
mov eax,m_mouse_keys
cmp eax,m_mouse_keys_old
jne .exit
xor eax,eax
mov m_cursor_out,eax
.exit:
call .draw_1
mov m_click,dword 1
jmp @f
.exit_menu_1:
mov m_click,dword 0
@@:
menu_bar_exit
/programs/develop/libraries/box_lib/trunk/pathshow.asm
0,0 → 1,150
;**************************************************************
; Path Show Macro for Kolibri OS
; Copyright (c) 2010, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
macro path_show_start
{
pusha
mov edi,dword [esp+36]
}
;*****************************************************************************
macro path_show_exit
{
popa
ret 4
}
;*****************************************************************************
align 16
path_show:
ps_type equ [edi] ;dword
ps_start_y equ [edi+4] ;word
ps_start_x equ [edi+6] ;word
ps_font_size_x equ [edi+8] ;word
ps_area_size_x equ [edi+10] ;word
ps_font_number equ [edi+12] ;dword
ps_background_flag equ [edi+16] ;dword
ps_font_color equ [edi+20] ;dword
ps_background_color equ [edi+24] ;dword
ps_text_pointer equ [edi+28] ;dword
ps_work_area_pointer equ [edi+32] ;dword
ps_temp_text_length equ [edi+36] ;dword
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
.prepare:
path_show_start
;-------------------------------------
mov esi,ps_text_pointer
xor eax,eax
xor ecx,ecx
dec ecx
cld
@@:
lodsb
inc ecx
test eax,eax
jnz @b
mov ps_temp_text_length,ecx
movzx eax,word ps_font_size_x
imul ecx,eax
movzx eax,word ps_area_size_x
cmp ecx,eax
jae .cut
;-------------------------------------
mov esi,ps_text_pointer
mov edi,ps_work_area_pointer
xor eax,eax
@@:
lodsb
stosb
test eax,eax
jnz @b
jmp .exit
;-------------------------------------
.cut:
; copy the first 6 characters of path
mov esi,ps_text_pointer
push edi
mov edi,ps_work_area_pointer
mov ecx,6
rep movsb
; insert a line break '...'
mov al,byte '.'
mov ecx,3
rep stosb
mov ecx,edi
; calculate the display length, in characters
pop edi
movzx ebx,word ps_font_size_x
movzx eax,word ps_area_size_x
xor edx,edx
div ebx
sub eax,9
; eax - maximum length of display area, the number of characters
mov esi,ps_temp_text_length
add esi,ps_text_pointer
sub esi,eax
; esi - pointer of the last segment of the displayed text
mov edi,ecx
mov ecx,eax
rep movsb
xor eax,eax
stosb
;-------------------------------------
.exit:
path_show_exit
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
.draw:
path_show_start
;-------------------------------------
mov ebx,ps_start_y
xor ecx,ecx
or ecx,0x80000000
mov eax,ps_background_flag
and eax,1b
shl eax,30
add ecx,eax
mov eax,ps_font_number
and eax,11b
shl eax,28
add ecx,eax
mov eax,ps_font_color
and eax,0xffffff
add ecx,eax
mov edx,ps_work_area_pointer
mov eax,ps_background_color
and eax,0xffffff
xor esi,esi
mov edi,eax
mcall SF_DRAW_TEXT
path_show_exit
;*****************************************************************************
/programs/develop/libraries/box_lib/trunk/progressbar.asm
0,0 → 1,140
pb equ [esp + 4 + 8*4]
align 16
progressbar_draw:
pushad
; draw frame
mov eax, pb
mov edx, [eax + PB_FRAME_COLOR]
mov ebx, [eax + PB_LEFT]
mov edi, [eax + PB_TOP]
mov ebp, [eax + PB_WIDTH]
mov esi, [eax + PB_HEIGHT]
add ebp, ebx
add esi, edi
dec ebp
dec esi
mov eax, SF_DRAW_LINE
shl ebx, 16
mov bx, bp
shrd ecx, edi, 16
mov cx, di
int 64
shrd ecx, esi, 16
mov cx, si
int 64
shld esi, ebx, 16
mov bx, si
shrd ecx, edi, 16
int 64
shrd ebx, ebp, 16
mov bx, bp
int 64
; if min > max then .skip
mov eax, pb
mov edx, [eax + PB_MAX]
mov ecx, [eax + PB_MIN]
cmp ecx, edx
; jg .skip
jne .min_no_eq_max
dec edx
.min_no_eq_max:
; draw all progress rectangle
call get_progress_width
mov edi, eax
mov eax, pb
mov ebx, [eax + PB_LEFT]
mov ecx, [eax + PB_TOP]
mov edx, [eax + PB_PROGRESS_COLOR]
inc ebx
inc ecx
shl ebx, 16
shl ecx, 16
add ebx, edi
add ecx, [eax + PB_HEIGHT]
dec ecx
mov eax, SF_DRAW_RECT
dec ecx
int 64
; draw last part of non-progress rectangle
; edi = pW, esi = W - 2
sub esi, edi ; width
shr ebx, 16
add ebx, edi
shl ebx, 16
add ebx, esi
mov esi, pb
mov edx, [esi + PB_BACK_COLOR]
int 64
; .skip:
popad
ret 4
 
align 16
get_progress_width:
; pW = (W-2)(value - min) / (max - min)
mov esi, [eax + PB_WIDTH]
mov eax, [eax + PB_VALUE]
dec esi
sub eax, ecx
dec esi
neg ecx
add ecx, edx
mul esi
div ecx
ret
 
align 16
progressbar_progress:
pushad
; if min > max then .skip
mov eax, pb
mov edx, [eax + PB_MAX]
mov ecx, [eax + PB_MIN]
cmp ecx, edx
; jg .skip
jne .min_no_eq_max1
dec edx
.min_no_eq_max1:
call get_progress_width
mov edi, eax
; increase value
mov eax, pb
mov ecx, [eax + PB_VALUE]
mov edx, [eax + PB_MAX]
inc ecx
; if value > max then value = max
cmp ecx, edx
jng .next
mov ecx, edx
.next:
mov [eax + PB_VALUE], ecx
; draw new part of progress rectangle
mov eax, pb
mov ecx, [eax + PB_MIN]
cmp ecx, edx
jne .min_no_eq_max2
dec edx
.min_no_eq_max2:
call get_progress_width
mov esi, eax
; edi = last pW, esi = new pW
mov eax, pb
mov ebx, [eax + PB_LEFT]
mov ecx, [eax + PB_TOP]
mov edx, [eax + PB_PROGRESS_COLOR]
inc ebx
inc ecx
add ebx, edi
shl ecx, 16
shl ebx, 16
add ecx, [eax + PB_HEIGHT]
add ebx, esi
dec ecx
sub ebx, edi
mov eax, SF_DRAW_RECT
dec ecx
int 64
; .skip:
popad
ret 4
restore pb
/programs/develop/libraries/box_lib/trunk/scrollbar.asm
0,0 → 1,1626
;**************************************************************
; ScrollBar Macro for Kolibri OS
; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; 15.11.2011 add scroll type 1 by IgorA
;*****************************************************************************
macro scroll_bar_exit
{
popa
ret 4
}
;*****************************************************************************
macro draw_up_arrow_vertical
{
push ebx
xor eax,eax
mov ax,sb_size_x
shr eax,1
shl eax,16
add ebx,eax
xor eax,eax
mov ax,sb_btn_high
shr eax,1
shl eax,16
add ecx,eax
mov edx,sb_line_col
sub ebx,4 shl 16
mov bx,7
mov cx,1
mcall SF_DRAW_RECT
sub ecx,1 shl 16
add ebx,1 shl 16
mov bx,5
int 0x40
sub ecx,1 shl 16
add ebx,1 shl 16
mov bx,3
int 0x40
sub ecx,1 shl 16
add ebx,1 shl 16
mov bx,1
int 0x40
pop ebx
}
;*****************************************************************************
macro draw_up_arrow_vertical_type2
{
push ebx
mov bx,sb_size_x
shr bx,1
add bx,sb_start_x
 
mov cx,sb_btn_high
shr cx,1
add cx,sb_start_y
mov ax,bx
shl eax,16
mov ax,cx
sub cx,2
shl ebx,16
shl ecx,16
mov cx,ax
shr eax,16
mov bx,ax
add cx,1
sub bx,3
 
mcall SF_DRAW_LINE,,,sb_line_col
 
add bx,6
mcall
pop ebx
}
;*****************************************************************************
macro draw_down_arrow_vertical
{
push ebx
xor eax,eax
mov ax,sb_size_x
shr eax,1
shl eax,16
add ebx,eax
xor eax,eax
mov ax,sb_btn_high
shr eax,1
shl eax,16
add ecx,eax
mov edx,sb_line_col
sub ebx,4 shl 16
mov bx,7
sub ecx,2 shl 16
mov cx,1
mcall SF_DRAW_RECT
add ecx,1 shl 16
add ebx,1 shl 16
mov bx,5
int 0x40
add ecx,1 shl 16
add ebx,1 shl 16
mov bx,3
int 0x40
add ecx,1 shl 16
add ebx,1 shl 16
mov bx,1
int 0x40
pop ebx
}
;*****************************************************************************
macro draw_down_arrow_vertical_type2
{
push ebx
mov bx,sb_size_x
shr bx,1
add bx,sb_start_x
 
mov ax,sb_btn_high
shr ax,1
mov cx,sb_start_y
add cx,sb_size_y
sub cx,ax
mov ax,bx
shl eax,16
mov ax,cx
add cx,1
shl ebx,16
shl ecx,16
mov cx,ax
shr eax,16
mov bx,ax
sub cx,2
sub bx,3
 
mcall SF_DRAW_LINE,,,sb_line_col
 
add bx,6
mcall
pop ebx
}
;*****************************************************************************
macro draw_runner_center_vertical
{
push ebx ecx
xor eax,eax
mov ax,sb_size_x
shr eax,1
shl eax,16
add ebx,eax
mov edx,sb_run_size
shr edx,1
shl edx,16
add ecx,edx
mov edx,sb_line_col
sub ecx,8 shl 16
sub ebx,5 shl 16
mov bx,10
add ecx,4 shl 16
mov cx,1
mcall SF_DRAW_RECT
add ecx,3 shl 16
sub ebx,1 shl 16
mov bx,12
int 0x40
add ebx,1 shl 16
mov bx,10
add ecx,3 shl 16
int 0x40
pop ecx ebx
}
;*****************************************************************************
macro draw_up_arrow_horizontal
{
push ecx
xor eax,eax
mov ax,sb_btn_high
shr eax,1
shl eax,16
add ebx,eax
xor eax,eax
mov ax,sb_size_y
shr eax,1
shl eax,16
add ecx,eax
mov edx,sb_line_col
sub ecx,4 shl 16
mov cx,7
mov bx,1
mcall SF_DRAW_RECT
sub ebx,1 shl 16
add ecx,1 shl 16
mov cx,5
int 0x40
sub ebx,1 shl 16
add ecx,1 shl 16
mov cx,3
int 0x40
sub ebx,1 shl 16
add ecx,1 shl 16
mov cx,1
int 0x40
pop ecx
}
;*****************************************************************************
macro draw_up_arrow_horizontal_type2
{
push ebx ecx
mov bx,sb_btn_high
shr bx,1
add bx,sb_start_x
 
mov cx,sb_size_y
shr cx,1
add cx,sb_start_y
mov ax,bx
shl eax,16
mov ax,cx
sub bx,2
shl ebx,16
shl ecx,16
mov cx,ax
shr eax,16
mov bx,ax
add bx,1
sub cx,3
 
mcall SF_DRAW_LINE,,,sb_line_col
 
add cx,6
mcall
pop ecx ebx
}
;*****************************************************************************
macro draw_down_arrow_horizontal
{
push ecx
xor eax,eax
mov ax,sb_btn_high
shr eax,1
shl eax,16
add ebx,eax
xor eax,eax
mov ax,sb_size_y
shr eax,1
shl eax,16
add ecx,eax
mov edx,sb_line_col
sub ecx,4 shl 16
mov cx,7
sub ebx,2 shl 16
mov bx,1
mcall SF_DRAW_RECT
add ebx,1 shl 16
add ecx,1 shl 16
mov cx,5
int 0x40
add ebx,1 shl 16
add ecx,1 shl 16
mov cx,3
int 0x40
add ecx,1 shl 16
add ebx,1 shl 16
mov cx,1
int 0x40
pop ecx
}
;*****************************************************************************
macro draw_down_arrow_horizontal_type2
{
push ebx ecx
mov ax,sb_btn_high
shr ax,1
mov bx,sb_start_x
add bx,sb_size_x
sub bx,ax
mov cx,sb_size_y
shr cx,1
add cx,sb_start_y
mov ax,bx
shl eax,16
mov ax,cx
add cx,1
shl ebx,16
shl ecx,16
mov cx,ax
shr eax,16
mov bx,ax
sub cx,2
sub bx,3
 
mcall SF_DRAW_LINE,,,sb_line_col
 
add cx,6
mcall
pop ecx ebx
}
;*****************************************************************************
macro draw_runner_center_horizontal
{
push ebx ecx
xor eax,eax
mov ax,sb_size_y
shr eax,1
shl eax,16
add ecx,eax
mov edx,sb_run_size
shr edx,1
shl edx,16
add ebx,edx
mov edx,sb_line_col
sub ebx,8 shl 16
sub ecx,5 shl 16
mov cx,10
add ebx,4 shl 16
mov bx,1
mcall SF_DRAW_RECT
add ebx,3 shl 16
sub ecx,1 shl 16
mov cx,12
int 0x40
add ecx,1 shl 16
mov cx,10
add ebx,3 shl 16
int 0x40
pop ecx ebx
}
;*****************************************************************************
sb_size_x equ [edi]
sb_start_x equ [edi+2]
sb_size_y equ [edi+4]
sb_start_y equ [edi+6]
sb_btn_high equ [edi+8]
sb_type equ [edi+12]
sb_max_area equ [edi+16]
sb_cur_area equ [edi+20]
sb_position equ [edi+24]
sb_bckg_col equ [edi+28]
sb_frnt_col equ [edi+32]
sb_line_col equ [edi+36]
sb_redraw equ [edi+40]
sb_delta equ [edi+44]
sb_delta2 equ [edi+46]
sb_r_size_x equ [edi+48]
sb_r_start_x equ [edi+50]
sb_r_size_y equ [edi+52]
sb_r_start_y equ [edi+54]
sb_m_pos equ [edi+56]
sb_m_pos_2 equ [edi+60]
sb_m_keys equ [edi+64]
sb_run_size equ [edi+68]
sb_position2 equ [edi+72]
sb_work_size equ [edi+76]
sb_all_redraw equ [edi+80]
sb_ar_offset equ [edi+84]
 
;*****************************************************************************
;*****************************************************************************
; draw event
;*****************************************************************************
;*****************************************************************************
align 16
scroll_bar_vertical:
.draw:
pusha
mov edi,dword [esp+36]
mov sb_delta,word 0
call .draw_1
mov sb_all_redraw,dword 0
scroll_bar_exit
.draw_1:
pusha
;*********************************
xor eax,eax
mov ax,sb_size_y
mov edx,sb_btn_high
shl edx,1
sub eax,edx
mov sb_work_size,eax
;*********************************
mov eax,sb_work_size
mov ebx,sb_max_area
cmp ebx,sb_cur_area
ja @f
jmp .no_size
 
@@:
imul eax,sb_cur_area
xor edx,edx
div ebx
shl edx,1
cmp edx,ebx
jb @f
inc eax
@@:
cmp eax,10
jae @f
mov eax,10
@@:
.no_size:
mov sb_run_size,eax
;*********************************
cmp word sb_delta,1
je .@@_3
mov eax,sb_work_size
sub eax,sb_run_size
mov ebx,sb_max_area
cmp ebx,sb_cur_area
ja @f
xor eax,eax
jmp .@@_1
@@:
sub ebx,sb_cur_area
imul eax,sb_position
xor edx,edx
div ebx
shl edx,1
cmp edx,ebx
jb @f
inc eax
@@:
.@@_1:
mov sb_position2,eax
xor edx,edx
mov dx,sb_size_y
sub edx,sb_btn_high
sub edx,sb_btn_high
sub edx,sb_run_size
cmp sb_position2,edx
jbe .@@_3
mov sb_position2,edx
.@@_3:
;*********************************
mov ebx,sb_start_x
shl ebx,16
inc ebx
mov ecx,sb_size_y
mov edx,sb_line_col
mov eax,SF_DRAW_RECT
cmp dword sb_all_redraw,0
je @f
int 0x40 ; left extreme line
@@:
push ebx
ror ebx,16
add bx,sb_size_x
rol ebx,16
cmp dword sb_all_redraw,0
je @f
int 0x40 ; right extreme line
@@:
pop ebx
 
push ecx
add ebx,1 shl 16
mov bx,sb_size_x
dec ebx
mov cx,1
cmp dword sb_all_redraw,0
je @f
int 0x40 ; top button - extreme line
@@:
push ecx
add ecx,1 shl 16
add ecx,sb_btn_high
sub ecx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je .no_draw_top_button
int 0x40 ; top button filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
jne .no_type2
;*********************************
draw_up_arrow_vertical_type2
;*********************************
jmp .no_draw_top_button
.no_type2:
;*********************************
draw_up_arrow_vertical
;*********************************
.no_draw_top_button:
pop ecx
ror ecx,16
add ecx,sb_btn_high ;14 shl 16
rol ecx,16
mov edx,sb_line_col
cmp dword sb_all_redraw,0
je @f
mcall SF_DRAW_RECT ; top button - bottom line
@@:
pop ecx
;*********************************
ror ecx,16
add ecx,sb_btn_high ;15 shl 16
inc ecx
rol ecx,16
sub ecx,sb_btn_high ;30
sub ecx,sb_btn_high
push ecx
mov cx,0
add ecx,sb_position2
dec cx
mov eax,SF_DRAW_RECT
test cx,0x8000
jnz @f
mov edx,sb_bckg_col
int 0x40 ; top interval
@@:
;*********************************
shr ecx,16
add ecx,sb_position2
dec ecx
shl ecx,16
inc ecx
mov edx,sb_line_col
int 0x40 ; runner - top extreme line
add ecx,1 shl 16
mov cx,0
add ecx,sb_run_size
mov sb_r_size_x,ebx
mov sb_r_size_y,ecx
sub ecx,2
mov edx,sb_frnt_col
int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;*********************************
draw_runner_center_vertical
;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
push eax ebx ecx edx
movzx eax,word sb_start_x
xor ebx,ebx
add bx,sb_r_start_y
dec ebx
movzx ecx,word sb_size_x
mov edx,sb_run_size
dec edx
; drawing a stylish frame on the slider
stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col
pop edx ecx ebx eax
@@:
;-----------------------------------------------------------------------------
shr ecx,16
add ecx,sb_run_size
sub ecx,2
shl ecx,16
inc ecx
mov edx,sb_line_col
int 0x40 ; runner - bottom extreme line
add ecx,1 shl 16
mov cx,sb_start_y
add cx,sb_size_y
sub ecx,sb_btn_high
dec ecx
mov eax,ecx
shr eax,16
sub cx,ax
test cx,0x8000
jnz @f
mov edx,sb_bckg_col
mcall SF_DRAW_RECT ; bottom interval
@@:
pop ecx
;*********************************
mov ax,cx
shr ecx,16
add cx,ax
sub ecx,2
shl ecx,16
inc ecx
mov edx,sb_line_col
mov eax,SF_DRAW_RECT
cmp dword sb_all_redraw,0
je @f
int 0x40 ; bottom button - top line
@@:
push ecx
add ecx,1 shl 16
add cx,sb_btn_high
sub ecx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je .no_draw_bottom_button
int 0x40 ; bottom button filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
jne .no_type2_1
;*********************************
draw_down_arrow_vertical_type2
;*********************************
jmp .no_draw_bottom_button
.no_type2_1:
;*********************************
draw_down_arrow_vertical
;*********************************
.no_draw_bottom_button:
pop ecx
ror ecx,16
add ecx,sb_btn_high
rol ecx,16
mov edx,sb_line_col
mov cx,1
cmp dword sb_all_redraw,0
je @f
mcall SF_DRAW_RECT ; bottom button - extreme line
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
movzx eax,word sb_start_x
movzx ebx,word sb_start_y
movzx ecx,word sb_size_x
; drawing a stylish frame on the top button
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
sb_bckg_col,sb_frnt_col,sb_line_col
add bx,sb_size_y
sub ebx,sb_btn_high
dec ebx
; drawing a stylish frame on the bottom button
stdcall draw_edge,eax,ebx,ecx,sb_btn_high,\
sb_bckg_col,sb_frnt_col,sb_line_col
@@:
;-----------------------------------------------------------------------------
popa
ret
;*****************************************************************************
;*****************************************************************************
; mouse event
;*****************************************************************************
;*****************************************************************************
.mouse:
pusha
mov edi,dword [esp+36]
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov sb_m_pos,eax
cmp dword sb_m_pos_2,0
jne @f
mov sb_m_pos_2,eax
@@:
mcall SF_MOUSE_GET,SSF_BUTTON
mov sb_m_keys,eax
 
cmp sb_m_keys,eax
je @f
mov sb_m_keys,eax
mov sb_delta,dword 0
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .continue_2
@@:
cmp dword sb_m_keys,0
jne @f
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .correct_1 ;.exit_sb
@@:
mov sb_delta,word 1
 
.continue_2:
mov eax,sb_m_pos
test eax,0x80000000
jnz .exit_sb
test eax,0x8000
jnz .exit_sb
mov ebx,eax
shr ebx,16 ; x position
shl eax,16
shr eax,16 ; y position
 
mov cx,sb_start_y
cmp ax,cx
jb .exit_sb
cmp word sb_delta2,0
je @f
push ecx
add cx,sb_btn_high
cmp ax,cx
pop ecx
jb .exit_sb
@@:
add cx,sb_size_y
cmp ax,cx
ja .exit_sb
 
cmp word sb_delta2,0
je @f
sub cx,sb_btn_high
cmp ax,cx
ja .exit_sb
@@:
cmp word sb_delta2,1
je @f
cmp dword sb_m_keys,0
je .exit_sb
mov cx,sb_start_x
cmp bx,cx
jb .exit_sb
add cx,sb_size_x
cmp bx,cx
ja .exit_sb
 
mov cx,sb_r_start_y
cmp ax,cx
jb .no_runner
add cx,sb_r_size_y
cmp ax,cx
ja .no_runner
 
mov sb_delta2,word 1
@@:
push eax
mov ax,sb_m_pos
cmp ax,sb_m_pos_2
je .correct
shl eax,16
shr eax,16
mov ebx,sb_m_pos_2
shl ebx,16
shr ebx,16
cmp eax,ebx
jb .sub
sub eax,ebx
mov ebx,eax
add sb_position2,ebx
xor eax,eax
mov ax,sb_size_y
sub eax,sb_btn_high
sub eax,sb_btn_high
sub eax,sb_run_size
cmp sb_position2,eax
jbe @f
mov sb_position2,eax
@@:
mov eax,sb_m_pos
mov sb_m_pos_2,eax
pop eax
call .draw_1
jmp .no_runner_1
.correct:
pop eax
jmp .exit_sb
.correct_1:
mov sb_delta,dword 0
jmp .exit_sb
 
.sub:
sub ebx,eax
sub sb_position2,ebx
test sb_position2,dword 0x80000000
jz @f
mov sb_position2,dword 0
@@:
mov eax,sb_m_pos
mov sb_m_pos_2,eax
pop eax
call .draw_1
jmp .no_runner_1
 
;*****************************************************************************
.no_runner:
mov sb_delta,dword 0
.no_runner_1:
xor ecx,ecx
mov cx,sb_start_y
add cx,sb_btn_high ;15
cmp word sb_delta,1
je .scroll_sb
cmp ax,cx
ja .scroll_sb
cmp dword sb_m_keys,0
je .exit_sb
mov eax,sb_ar_offset
cmp sb_position,eax ;dword 0
jbe @f
sub sb_position,eax
jmp .all_sb
@@:
xor eax,eax
mov sb_position,eax ;dword 0
mov sb_position2,eax ;dword 0
jmp .all_sb
;*****************************************************************************
.scroll_sb:
add cx,sb_size_y
sub cx,sb_btn_high
sub cx,sb_btn_high
cmp word sb_delta,1
je @f
cmp ax,cx
ja .down_sb
@@:
mov ebx,sb_btn_high ;16 ;15
add bx,sb_start_y
sub cx,bx
sub ax,bx
.scroll_sb_1:
mov ebx,sb_run_size
;*****************************************************************************
cmp word sb_delta,1
je .continue
@@:
mov edx,eax
push ebx
shr ebx,1
sub edx,ebx
pop ebx
mov sb_position2,edx
test sb_position2,dword 0x80000000
jz .test_1
mov sb_position2,dword 0
jmp .continue
.test_1:
xor edx,edx
mov dx,sb_size_y
sub edx,sb_btn_high
sub edx,sb_btn_high
sub edx,sb_run_size
cmp sb_position2,edx
jbe .continue
mov sb_position2,edx
 
.continue:
mov eax,sb_position2
sub ecx,ebx
.continue_1:
;*****************************************************************************
mov ebx,eax
 
mov eax,sb_max_area
cmp eax,sb_cur_area
ja @f
 
xor eax,eax
inc eax
mov sb_position2,eax
jmp .all_sb
@@:
sub eax,sb_cur_area
inc eax
shl eax,10
xor edx,edx
div ecx
shl edx,1
cmp edx,ecx
jb @f
inc eax
@@:
imul eax,ebx
shr eax,10
cmp sb_position,eax
je .exit_sb
cmp eax,0
ja @f
xor eax,eax
@@:
.store_position:
mov edx,sb_max_area
sub edx,sb_cur_area
cmp edx,eax
ja @f
 
mov sb_position,edx
jmp .all_sb
 
@@:
mov sb_position,eax
.all_sb:
mov sb_redraw,dword 1
call .draw_1
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .exit_sb
;*****************************************************************************
.down_sb:
cmp dword sb_m_keys,0
je .exit_sb
mov eax,sb_max_area
mov ebx,sb_ar_offset
sub eax,sb_cur_area
push eax
sub eax,ebx
cmp sb_position,eax
pop eax
jae @f
add sb_position,ebx
jmp .all_sb
@@:
mov sb_position,eax
xor eax,eax
mov ax,sb_size_y
sub eax,sb_btn_high
sub eax,sb_btn_high
sub eax,sb_run_size
mov sb_position2,eax
jmp .all_sb
.exit_sb:
scroll_bar_exit
 
 
;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
;*****************************************************************************
align 16
scroll_bar_horizontal:
.draw:
pusha
mov edi,dword [esp+36]
mov sb_delta,word 0
call .draw_1
mov sb_all_redraw,dword 0
scroll_bar_exit
.draw_1:
pusha
;*********************************
xor eax,eax
mov ax,sb_size_x ;sb_size_y
mov edx,sb_btn_high
shl edx,1
sub eax,edx
mov sb_work_size,eax
;*********************************
mov eax,sb_work_size ;sb_max_area
mov ebx,sb_max_area
cmp ebx,sb_cur_area
ja @f
 
jmp .no_size
 
@@:
imul eax,sb_cur_area
xor edx,edx
div ebx
shl edx,1
cmp edx,ebx
jb @f
inc eax
@@:
cmp eax,10
jae @f
mov eax,10
@@:
.no_size:
mov sb_run_size,eax
;*********************************
cmp word sb_delta,1
je .@@_3
mov eax,sb_work_size
sub eax,sb_run_size
mov ebx,sb_max_area
cmp ebx,sb_cur_area
ja @f
xor eax,eax
jmp .@@_1
@@:
sub ebx,sb_cur_area
imul eax,sb_position
xor edx,edx
div ebx
shl edx,1
cmp edx,ebx
jb @f
inc eax
@@:
.@@_1:
mov sb_position2,eax
xor edx,edx
mov dx,sb_size_x
sub edx,sb_btn_high
sub edx,sb_btn_high
sub edx,sb_run_size
cmp sb_position2,edx
jbe .@@_3
mov sb_position2,edx
.@@_3:
;*********************************
mov ebx,sb_size_x
mov ecx,sb_start_y
shl ecx,16
inc ecx
mov edx,sb_line_col
mov eax,SF_DRAW_RECT
cmp dword sb_all_redraw,0
je @f
int 0x40 ; top extreme line
@@:
push ecx
ror ecx,16
add cx,sb_size_y
rol ecx,16
cmp dword sb_all_redraw,0
je @f
int 0x40 ; bottom extreme line
@@:
pop ecx
 
push ebx
add ecx,1 shl 16
mov cx,sb_size_y
dec ecx
mov bx,1
cmp dword sb_all_redraw,0
je @f
int 0x40 ; left button - extreme line
@@:
push ebx
add ebx,1 shl 16
add ebx,sb_btn_high
sub ebx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je .no_draw_top_button
int 0x40 ; left button filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
jne .no_type2
;*********************************
draw_up_arrow_horizontal_type2
;*********************************
jmp .no_draw_top_button
.no_type2:
;*********************************
draw_up_arrow_horizontal
;*********************************
.no_draw_top_button:
pop ebx
ror ebx,16
add ebx,sb_btn_high ;14 shl 16
rol ebx,16
mov edx,sb_line_col
cmp dword sb_all_redraw,0
je @f
mcall SF_DRAW_RECT ; left button - right line
@@:
pop ebx
;*********************************
ror ebx,16
add ebx,sb_btn_high ;15 shl 16
inc ebx
rol ebx,16
sub ebx,sb_btn_high ;30
sub ebx,sb_btn_high
push ebx
mov bx,0
add ebx,sb_position2
dec bx
mov eax,SF_DRAW_RECT
test bx,0x8000
jnz @f
mov edx,sb_bckg_col
int 0x40 ; left interval
@@:
;*********************************
shr ebx,16
add ebx,sb_position2
dec ebx
shl ebx,16
inc ebx
mov edx,sb_line_col
int 0x40 ; runner - left extreme line
add ebx,1 shl 16
mov bx,0
add ebx,sb_run_size
mov sb_r_size_x,ebx
mov sb_r_size_y,ecx
sub ebx,2
mov edx,sb_frnt_col
int 0x40 ; runner filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
je @f
;*********************************
draw_runner_center_horizontal
;*********************************
@@:
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
push eax ebx ecx edx
xor eax,eax
add ax,sb_r_start_x
dec eax
movzx ebx,word sb_start_y
mov ecx,sb_run_size
dec ecx
movzx edx,word sb_size_y
; drawing a stylish frame on the slider
stdcall draw_edge,eax,ebx,ecx,edx,\
sb_bckg_col,sb_frnt_col,sb_line_col
pop edx ecx ebx eax
@@:
;-----------------------------------------------------------------------------
shr ebx,16
add ebx,sb_run_size
sub ebx,2
shl ebx,16
inc ebx
mov edx,sb_line_col
int 0x40 ; runner - bottom extreme line
add ebx,1 shl 16
mov bx,sb_start_x
add bx,sb_size_x
sub ebx,sb_btn_high
dec ebx
mov eax,ebx
shr eax,16
sub bx,ax
test bx,0x8000
jnz @f
mov edx,sb_bckg_col
mcall SF_DRAW_RECT ; bottom interval
@@:
pop ebx
;*********************************
mov ax,bx
shr ebx,16
add bx,ax
sub ebx,2
shl ebx,16
inc ebx
mov edx,sb_line_col
mov eax,SF_DRAW_RECT
cmp dword sb_all_redraw,0
je @f
int 0x40 ; bottom button - top line
@@:
push ebx
add ebx,1 shl 16
add bx,sb_btn_high
sub ebx,2
mov edx,sb_frnt_col
cmp dword sb_all_redraw,0
je .no_draw_bottom_button
int 0x40 ; bottom button filling
;-----------------------------------------------------------------------------
; scrollbar type 2
cmp word sb_type,2
jne .no_type2_1
;*********************************
draw_down_arrow_horizontal_type2
;*********************************
jmp .no_draw_bottom_button
.no_type2_1:
;*********************************
draw_down_arrow_horizontal
;*********************************
.no_draw_bottom_button:
pop ebx
ror ebx,16
add ebx,sb_btn_high ;14 shl 16
rol ebx,16
mov edx,sb_line_col
mov bx,1
cmp dword sb_all_redraw,0
je @f
mcall SF_DRAW_RECT ; bottom button - extreme line
;-----------------------------------------------------------------------------
; scrollbar type 1 - stylish frame
cmp word sb_type,1
jne @f
; drawing a stylish frame on the left button
movzx eax,word sb_start_x
movzx ebx,word sb_start_y
movzx edx,word sb_size_y
stdcall draw_edge,eax,ebx,sb_btn_high,edx,\
sb_bckg_col,sb_frnt_col,sb_line_col
movzx eax,word sb_start_x
add ax,sb_size_x
sub eax,sb_btn_high
dec eax
; drawing a stylish frame on the right button
stdcall draw_edge,eax,ebx,sb_btn_high,edx,\
sb_bckg_col,sb_frnt_col,sb_line_col
@@:
;-----------------------------------------------------------------------------
popa
ret
;*****************************************************************************
; mouse event
;*****************************************************************************
.mouse:
pusha
mov edi,dword [esp+36]
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov sb_m_pos,eax
cmp dword sb_m_pos_2,0
jne @f
mov sb_m_pos_2,eax
@@:
mcall SF_MOUSE_GET,SSF_BUTTON
mov sb_m_keys,eax
 
cmp sb_m_keys,eax
je @f
mov sb_m_keys,eax
mov sb_delta,dword 0
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .continue_2
@@:
cmp dword sb_m_keys,0
jne @f
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .correct_1 ;.exit_sb
@@:
mov sb_delta,word 1
 
.continue_2:
mov eax,sb_m_pos
test eax,0x80000000
jnz .exit_sb
test eax,0x8000
jnz .exit_sb
mov ebx,eax
shr eax,16 ; x position
shl ebx,16
shr ebx,16 ; y position
 
mov cx,sb_start_x ;y
cmp ax,cx
jb .exit_sb
cmp word sb_delta2,0
je @f
push ecx
add cx,sb_btn_high
cmp ax,cx
pop ecx
jb .exit_sb
@@:
add cx,sb_size_x ;y
cmp ax,cx
ja .exit_sb
 
cmp word sb_delta2,0
je @f
sub cx,sb_btn_high
cmp ax,cx
ja .exit_sb
@@:
cmp word sb_delta2,1
je @f
cmp dword sb_m_keys,0
je .exit_sb
mov cx,sb_start_y ;x
cmp bx,cx
jb .exit_sb
add cx,sb_size_y ;x
cmp bx,cx
ja .exit_sb
mov cx,sb_r_start_x
cmp ax,cx
jb .no_runner
add cx,sb_r_size_x
cmp ax,cx
ja .no_runner
 
mov sb_delta2,word 1
@@:
push eax
mov eax,sb_m_pos
mov ebx,sb_m_pos_2
shr eax,16
shr ebx,16
cmp eax,ebx
je .correct
; shl eax,16
; shr eax,16
; mov ebx,sb_m_pos_2
; shl ebx,16
; shr ebx,16
; cmp eax,ebx
jb .sub
sub eax,ebx
mov ebx,eax
add sb_position2,ebx
xor eax,eax
mov ax,sb_size_x ;y
sub eax,sb_btn_high
sub eax,sb_btn_high
sub eax,sb_run_size
cmp sb_position2,eax
jbe @f
mov sb_position2,eax
@@:
mov eax,sb_m_pos
mov sb_m_pos_2,eax
pop eax
call .draw_1
jmp .no_runner_1
.correct:
pop eax
jmp .exit_sb
.correct_1:
mov sb_delta,dword 0
jmp .exit_sb
 
.sub:
sub ebx,eax
sub sb_position2,ebx
test sb_position2,dword 0x80000000
jz @f
mov sb_position2,dword 0
@@:
mov eax,sb_m_pos
mov sb_m_pos_2,eax
pop eax
call .draw_1
jmp .no_runner_1
 
;*****************************************************************************
.no_runner:
mov sb_delta,dword 0
.no_runner_1:
xor ecx,ecx
mov cx,sb_start_x ;y
add cx,sb_btn_high ;15
cmp word sb_delta,1
je .scroll_sb
cmp ax,cx
ja .scroll_sb
cmp dword sb_m_keys,0
je .exit_sb
mov eax,sb_ar_offset
cmp sb_position,eax ;dword 0
jbe @f
sub sb_position,eax
jmp .all_sb
@@:
xor eax,eax
mov sb_position,eax ;dword 0
mov sb_position2,eax ;dword 0
jmp .all_sb
;*****************************************************************************
.scroll_sb:
add cx,sb_size_x ;y
sub cx,sb_btn_high
sub cx,sb_btn_high
cmp word sb_delta,1
je @f
cmp ax,cx
ja .down_sb
@@:
mov ebx,sb_btn_high ;16 ;15
add bx,sb_start_x ;y
sub cx,bx
sub ax,bx
.scroll_sb_1:
mov ebx,sb_run_size
;*****************************************************************************
cmp word sb_delta,1
je .continue
@@:
mov edx,eax
 
push ebx
shr ebx,1
sub edx,ebx
pop ebx
mov sb_position2,edx
test sb_position2,dword 0x80000000
jz .test_1
mov sb_position2,dword 0
jmp .continue
.test_1:
xor edx,edx
mov dx,sb_size_x ;y
sub edx,sb_btn_high
sub edx,sb_btn_high
sub edx,sb_run_size
cmp sb_position2,edx
jbe .continue
mov sb_position2,edx
 
.continue:
mov eax,sb_position2
sub ecx,ebx
.continue_1:
;*****************************************************************************
mov ebx,eax
 
mov eax,sb_max_area
cmp eax,sb_cur_area
ja @f
 
xor eax,eax
inc eax
mov sb_position2,eax
jmp .all_sb
@@:
sub eax,sb_cur_area
inc eax
shl eax,10
xor edx,edx
div ecx
shl edx,1
cmp edx,ecx
jb @f
inc eax
@@:
imul eax,ebx
shr eax,10
cmp sb_position,eax
je .exit_sb
cmp eax,0
ja @f
xor eax,eax
@@:
.store_position:
mov edx,sb_max_area
sub edx,sb_cur_area
cmp edx,eax
ja @f
 
mov sb_position,edx
jmp .all_sb
 
@@:
mov sb_position,eax
.all_sb:
mov sb_redraw,dword 1
call .draw_1
mov eax,sb_m_pos
mov sb_m_pos_2,eax
jmp .exit_sb
;*****************************************************************************
.down_sb:
cmp dword sb_m_keys,0
je .exit_sb
mov eax,sb_max_area
mov ebx,sb_ar_offset
sub eax,sb_cur_area
push eax
sub eax,ebx
cmp sb_position,eax
pop eax
jae @f
add sb_position,ebx
jmp .all_sb
@@:
mov sb_position,eax
xor eax,eax
mov ax,sb_size_x
sub eax,sb_btn_high
sub eax,sb_btn_high
sub eax,sb_run_size
mov sb_position2,eax
jmp .all_sb
;*****************************************************************************
.exit_sb:
scroll_bar_exit
/programs/games/life3/trunk/life3.asm
7,7 → 7,7
include '../../../proc32.inc'
include '../../../KOSfuncs.inc'
include '../../../load_img.inc'
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../load_lib.mac'
 
;include 'lang.inc'
 
603,8 → 603,8
add edi,[memCell] ;edi -> &memCell[fristC]
mov esi,[edi] ;swp=memCell[fristC];
mov edx,[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
mov dword[edi],edx ;memCell[fristC]=memCell[i];
mov dword[ecx],esi ;memCell[i]=swp;
mov [edi],edx ;memCell[fristC]=memCell[i];
mov [ecx],esi ;memCell[i]=swp;
dec eax
dec ebx
sub ecx,4
614,10 → 614,10
cmp ebx,eax
jle @b
mov ebx,[memCell]
mov dword[ebx],eax ;firstC <- eax
mov [ebx],eax ;firstC <- eax
 
mov dword[b_sort],eax
stdcall pole_fl_sort, dword[memCell],eax
mov [b_sort],eax
stdcall pole_fl_sort, [memCell],eax
 
mov ecx,[memCell]
mov ebx,1
628,7 → 628,7
jae .no_change
xor byte[edx+Cell.liv],3
mov edi,[tim]
mov dword[edx+Cell.tc],edi
mov [edx+Cell.tc],edi
bt word[edx+Cell.liv],0
jc .new_cell
push eax
722,8 → 722,8
add edi,ecx ;edi -> &a[i]
mov esi,[edi] ;w=a[i];
mov edx,[ecx+4]
mov dword[edi],edx ;a[i]=a[1];
mov dword[ecx+4],esi ;a[1]=w;
mov [edi],edx ;a[i]=a[1];
mov [ecx+4],esi ;a[1]=w;
 
dec eax
cmp eax,2
749,7 → 749,7
lea edx,[ebx*4]
add edx,eax
mov edx,[edx]
mov dword[copy],edx ;copy=a[i];
mov [copy],edx ;copy=a[i];
mov edi,ebx
shl edi,1 ;m=i<<1;
.cycle_b: ;while (m<=k) {
774,7 → 774,7
;if (pole_compare_cells_bm(a[j],copy)) {
lea edx,[esi*4]
add edx,eax
stdcall pole_compare_cells_bm, dword[edx],dword[copy]
stdcall pole_compare_cells_bm, dword[edx],[copy]
cmp dl,0
je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
 
795,7 → 795,7
shl ebx,2
add eax,ebx
mov edx,[copy]
mov dword[eax],edx ;a[i]=copy;
mov [eax],edx ;a[i]=copy;
 
popad
ret
1480,7 → 1480,7
xor edx,edx
div ecx
@@:
add dword[Cor_y],eax
add [Cor_y],eax
pop edx ecx eax
stdcall [buf2d_clear], buf_0, [buf_0.color]
call pole_paint
1499,7 → 1499,7
xor edx,edx
div ecx
@@:
sub dword[Cor_y],eax
sub [Cor_y],eax
pop edx ecx eax
stdcall [buf2d_clear], buf_0, [buf_0.color]
call pole_paint
1511,14 → 1511,13
push eax ecx edx
mov eax,[buf_0.w]
shr eax,2
xor ecx,ecx
mov cl,byte[zoom]
cmp cx,2
movzx ecx,byte[zoom]
cmp ecx,2
jl @f ;¤¥«¥­¨¥ ­  ¢¥«¨ç¨­ã zoom
xor edx,edx
div ecx
@@:
add dword[Cor_x],eax
add [Cor_x],eax
pop edx ecx eax
stdcall [buf2d_clear], buf_0, [buf_0.color]
call pole_paint
1537,7 → 1536,7
xor edx,edx
div ecx
@@:
sub dword[Cor_x],eax
sub [Cor_x],eax
pop edx ecx eax
stdcall [buf2d_clear], buf_0, [buf_0.color]
call pole_paint
1544,18 → 1543,13
stdcall [buf2d_draw], buf_0
ret
 
;align 4
;but_bru_clear:
; ret
 
;input:
; buf - 㪠§ â¥«ì ­  áâபã, ç¨á«® ¤®«¦­® ¡ëâì ¢ 10 ¨«¨ 16 à¨ç­®¬ ¢¨¤¥
;output:
; eax - ç¨á«®
align 4
proc conv_str_to_int, buf:dword
proc conv_str_to_int uses ebx ecx esi, buf:dword
xor eax,eax
push ebx ecx esi
xor ebx,ebx
mov esi,[buf]
;®¯à¥¤¥«¥­¨¥ ®âà¨æ â¥«ì­ëå ç¨á¥«
1617,7 → 1611,6
sub ecx,eax
mov eax,ecx
@@:
pop esi ecx ebx
ret
endp
 
1661,32 → 1654,17
db 0
 
 
 
head_f_i:
head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
 
system_dir_0 db '/sys/lib/'
lib_name_0 db 'proc_lib.obj',0
err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tE',0
 
system_dir_1 db '/sys/lib/'
lib_name_1 db 'libimg.obj',0
err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tE',0
 
system_dir_2 db '/sys/lib/'
lib_name_2 db 'buf2d.obj',0
err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tE',0
 
l_libs_start:
lib0 l_libs lib_name_0, 0, file_name, system_dir_0,\
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
lib1 l_libs lib_name_1, 0, file_name, system_dir_1,\
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
lib2 l_libs lib_name_2, 0, file_name, system_dir_2,\
err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
lib0 l_libs lib_name_0, file_name, system_dir_0, import_proclib
lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
lib2 l_libs lib_name_2, file_name, system_dir_2, import_buf2d
l_libs_end:
 
align 4
1702,7 → 1680,7
aimg_destroy db 'img_destroy',0
 
align 4
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
dd 0,0
1740,16 → 1718,15
 
align 16
i_end:
mouse_dd dd 0
last_time dd 0
mouse_dd rd 1
last_time rd 1
sc system_colors
procinfo process_information
rb 1024
stacktop:
sys_path rb 1024
file_name:
rb 2048 ;4096
file_name rb 2048 ;4096
plugin_path rb 4096
openfile_path rb 4096
filename_area rb 256
rb 1024
stacktop:
mem:
/programs/media/img_transform/img_transform.asm
8,13 → 8,14
include '../../proc32.inc'
include '../../KOSfuncs.inc'
include '../../load_img.inc'
include '../../load_lib.mac'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include '../../develop/libraries/TinyGL/asm_fork/zbuffer.inc'
include '../../develop/libraries/libs-dev/libimg/libimg.inc'
include '../../develop/info3ds/info_fun_float.inc'
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Image transform 02.10.20',0 ;¯®¤¯¨áì ®ª­ 
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Image transform 08.12.20',0 ;¯®¤¯¨áì ®ª­ 
 
BUF_STRUCT_SIZE equ 21
buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
1423,39 → 1424,11
lib_name_3 db 'tinygl.obj',0
 
align 4
head_f_i:
if lang eq ru
head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tE',0
err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tE',0
err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tE',0
err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,'" -tE',0
else
head_f_l db '"System error',0
err_message_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
err_message_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tE',0
err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'buf2d',39,'" -tE',0
err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_3 db 'Error on load import library ',39,'tinygl',39,'" -tE',0
end if
 
align 4
l_libs_start:
lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\
err_msg_found_lib_3,head_f_l,import_lib_tinygl,err_msg_import_3,head_f_i
lib_0 l_libs lib_name_0, file_name, system_dir_0, import_proclib
lib_1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
lib_2 l_libs lib_name_2, library_path, system_dir_2, import_buf2d
lib_3 l_libs lib_name_3, library_path, system_dir_3, import_lib_tinygl
l_libs_end:
 
align 4
1506,7 → 1479,7
aimg_draw db 'img_draw',0
 
align 4
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
OpenDialog_Set_file_name dd aOpenDialog_Set_file_name
1656,8 → 1629,7
align 16
stacktop:
sys_path rb 1024
file_name:
rb 1024 ;4096
file_name rb 1024 ;4096
library_path rb 1024
plugin_path rb 4096
openfile_path rb 4096
/programs/media/midamp/trunk/midamp.asm
1,9 → 1,9
; MIDI PLAYER FOR MENUET v1.0
; MIDI PLAYER FOR KOLIBRI v1.0
; Written in pure assembler by Ivushkin Andrey aka Willow
;
;
; Created: December 7, 2004
; Last changed: July 29, 2005
; Last changed: December 8, 2020
;
; COMPILE WITH FASM
 
53,16 → 53,13
FL_MULSEL equ 0x8000
 
use32
org 0x0
org 0
 
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd 1, START, IM_END
dd I_END ;APP_MEM
dd stacktop ;APP_MEM - 1024
dd I_PARAM
dd cur_dir_path
dd I_PARAM, cur_dir_path
listsel dd 0
channel dd 0
69,7 → 66,8
COLOR_ORDER equ MENUETOS
include '../../../config.inc' ;for nightbuild
include '../../../macros.inc' ; decrease code size (optional)
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../KOSfuncs.inc'
include '../../../load_lib.mac'
 
@use_library
 
86,7 → 84,7
btns:
file 'buttons.gif'
START:
mcall 68, 11
mcall SF_SYS_MISC, SSF_HEAP_INIT
load_libraries l_libs_start,end_l_libs
 
105,7 → 103,7
or [flag],FL_BOTTRED;+FL_MUTE
mov ecx,ipcarea
call init_ipc
mcall 40,1000111b
mcall SF_SET_EVENTS_MASK,1000111b
mov esi,btns
mov edi,btn_raw
call ReadGIF
116,7 → 114,7
mov edi,bottom_raw
call ReadGIF
call respawn
mcall 9,prcinfo,-1
mcall SF_THREAD_INFO,prcinfo,-1
mov edx,[ebx+30]
mov [parentPID],edx
mov esi,I_PARAM
190,9 → 188,7
mov esi,filename
mov edi,I_PARAM
rep movsd
mov eax,70
mov ebx,file_info
mcall
mcall SF_FILE,file_info
add ebx,workarea
mov [midi_limit],ebx
mov edi,I_PARAM
245,7 → 241,7
test [flag],FL_PLAY
jz .noplay
call draw_window
mcall 5,100
mcall SF_SLEEP,100
mov eax,IPC_PLAY
call ipc_send
.noplay:
263,8 → 259,7
still:
mov ecx,ipcarea
call init_ipc
mov eax,10
mcall
mcall SF_WAIT_EVENT
prc_event:
test eax,eax
jz still
290,7 → 285,7
xor edx,edx
test [flag],FL_SHUFFLE
jz .noshuf
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
movzx ebx,byte[list_count]
div ebx
mov eax,edx
424,12 → 419,6
;---------------------------------------------------------------------
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
 
head_f_i:
head_f_l db 'error',0
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
 
err_message_import2 db 'proc_lib.obj - Wrong import!',0
 
;---------------------------------------------------------------------
align 4
ProcLib_import:
444,8 → 433,8
;---------------------------------------------------------------------
l_libs_start:
 
library01 l_libs system_dir_ProcLib+9, cur_dir_path, temp_dir_pach, system_dir_ProcLib, \
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
library01 l_libs system_dir_ProcLib+9, temp_dir_pach, system_dir_ProcLib, \
ProcLib_import
 
end_l_libs:
;---------------------------------------------------------------------
/programs/media/scrshoot/label.inc
8,13 → 8,8
mov ah,[edx+esi]
inc esi
test ah,ah
jz @f
jmp .check_next
@@:
mov eax,4
mov ebx,[edi]
mov ecx,[edi+4]
mcall
jnz .check_next
mcall SF_DRAW_TEXT,[edi],[edi+4]
popa
ret
}
/programs/media/scrshoot/scrshoot.asm
21,7 → 21,7
format binary as ""
 
title equ 'Screenshooter v1.21' ; ‡ £®«®¢®ª ®ª­ 
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../config.inc' ;for nightbuild
include '../../proc32.inc'
34,21 → 34,15
include 'scrshoot.mac'
 
use32
org 0x0
org 0
db 'MENUET01'
dd 0x1
dd start
dd IM_END
dd i_end
dd stacktop
dd cmdstr
dd cur_dir_path
dd 1, start, IM_END, i_end, stacktop, cmdstr, cur_dir_path
 
include 'lang.inc'
include '../../dll.inc'
 
align 4
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
use_txt_button ; |
use_label ; |-- GUI ª®¬¯®­¥­âë ¨ ­¥ª®â®àë¥ ¯à®æ¥¤ãàë
use_text_work ; /
607,14 → 601,14
;---------------------------------------------------------------------
l_libs_start:
 
library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \
Box_lib_import
 
library02 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \
ProcLib_import
 
library03 l_libs system_dir_LibImg+9, cur_dir_path, library_path, system_dir_LibImg, \
err_message_found_lib3, head_f_l, import_libimg, err_message_import3, head_f_i
library03 l_libs system_dir_LibImg+9, library_path, system_dir_LibImg, \
import_libimg
 
end_l_libs:
;---------------------------------------------------------------------
/programs/media/scrshoot/scrshoot.mac
14,24 → 14,15
 
macro start_draw_window
{
;mov eax,12
push 12
pop eax
xor ebx,ebx
inc ebx
mcall
mcall SF_REDRAW
}
 
;--- ñîîáùèòü ñèñòåìå î çàâåðøåíèè ïåðåðèñîâêè îêíà ---
macro stop_draw_window
{
;mov eax,12
push 12
pop eax
;mov ebx,2
push 2
pop ebx
mcall
mcall SF_REDRAW, SSF_END_DRAW
}
 
;--- óñòàíîâèòü ìàñêó îæèäàåìûõ ñîáûòèé ---
39,8 → 30,7
;--- îæèäàòü ñîáûòèÿ ---
macro wait_event redraw,key,button,mouse,ipc,other
{
mov eax,10
mcall
mcall SF_WAIT_EVENT
dec ax
if redraw eq
else
77,76 → 67,25
;--- óñòàíîâèòü ìàñêó îæèäàåìûõ ñîáûòèé ---
macro set_events_mask mask
{
;mov eax,40
push 40
pop eax
;mov ebx,mask
push mask
pop ebx
mcall
mcall SF_SET_EVENTS_MASK, mask
}
 
;macro check_boxes_set_sys_color start,end,color_table
;{
;ch_left equ [edi] ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî õ
;ch_top equ [edi+4] ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî ó
;ch_text_margin equ [edi+8] ;=4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
;ch_size equ [edi+8] ;12 ðàçìåð êâàäðàòà ÷åê áîêñà
;ch_color equ [edi+12] ;öâåò âíóòðè checkbox
;ch_border_color equ [edi+16] ; or [edi+4] ;öâåò ðàìêè checkbox åå ìîæíî çàäàòü ñàìîñòîÿòåëüíî
;ch_text_color equ [edi+20];[edi+4] ;öâåò òåêñòà
;ch_text_ptr equ [edi+24] ;óêàçàòåëü íà íà÷àëî òåêñòîâîé ñòðîêè
;ch_text_length equ [edi+28]
;ch_flags equ [edi+32] ;ôëàãè
 
 
;ch_left equ [edi] ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî õ
;ch_top equ [edi+2] ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî ó
;ch_color equ [edi+4] ;öâåò âíóòðè checkbox
;ch_border_color equ [edi+8] ;öâåò ðàìêè checkbox
;ch_text_color equ [edi+12] ;öâåò òåêñòà
;ch_text_ptr equ [edi+16] ;óêàçàòåëü íà íà÷àëî òåêñòîâîé ñòðîêè
;ch_text_length equ [edi+20] ;äëèíà íàäïèñè (2^64 òàêîé äëèíû ìîæåò áûòü òåêñò)
;ch_flags equ [edi+24] ;ôëàãè
 
; mov edi,start
; mov ecx,((end-start)/ch_struc_size)
; mov esi,color_table
;@@:
; push dword [esi+32]
; pop dword ch_text_color
; push dword [esi+36]
; pop dword ch_border_color
; add edi,ch_struc_size
; loop @b
;}
macro get_key
{
;mov eax,2
push 2
pop eax
mcall
mcall SF_GET_KEY
}
;--- ïîëó÷èòü êîä íàæàòîé êíîïêè ---
macro get_pressed_button
{
;mov eax,17
push 17
pop eax
mcall
mcall SF_GET_BUTTON
}
macro get_active_window
{
mov eax,18
mov ebx,7
mcall
mcall SF_SYSTEM,SSF_GET_ACTIVE_WINDOW
}
;--- ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ¯à®æ¥áᥠ---
;--- ïîëó÷èòü èíôîðìàöèþ î ïðîöåññå ---
macro get_procinfo proc_inf_buf,slot_num
{
;mov eax,9
push 9
pop eax
;mov ebx,proc_inf_buf
push proc_inf_buf
pop ebx
158,11 → 97,11
push slot_num
pop ecx
end if
mcall
mcall SF_THREAD_INFO
}
macro get_screen_prop struc_ptr
{
mov eax,61
mov eax,SF_GET_GRAPHICAL_PARAMS
push eax eax
xor ebx,ebx
inc ebx
179,39 → 118,31
}
macro min_window
{
mov eax,18
mov ebx,10
mcall
mcall SF_SYSTEM,SSF_MINIMIZE_WINDOW
}
macro app_close
{
or eax,-1
mcall
mcall SF_TERMINATE_PROCESS
}
macro get_skin_height
{
mov eax,48
mov ebx,4
mcall
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
}
macro delay time
{
mov eax,5
if time eq
else
mov ebx,time
end if
mcall
mcall SF_SLEEP
}
macro activ_window slot_n
{
mov eax,18
mov ebx,3
if slot_n eq
else
mov ecx,slot_n
end if
mcall
mcall SF_SYSTEM,SSF_FOCUS_WINDOW
}
struc screen_prop
{
261,7 → 192,7
.messages: rb size
}
 
;--- æ¢¥â  ---
;--- öâåòà  ---
cl_white=0xffffff
cl_black=0x000000
 
/programs/media/scrshoot/srectwin.inc
55,6 → 55,7
 
jmp .still
 
align 4
.draw_window:
start_draw_window
 
130,8 → 131,9
call [edit_box_set_text] ;ecx,edi
ret
;--------------------------------------------------------------------
;--- ‘ç¨â뢠­¨¥ ®¡« â¨ ----------------------------------------------
;--- ‘ç¨â뢠­¨¥ ®¡« á⨠---------------------------------------------
;--------------------------------------------------------------------
align 4
read_rect:
bt dword [use_rect_active_window.flags],1
jc read_rect_from_active_window
173,6 → 175,7
mov [rect.height],ax
ret
 
align 4
read_rect_from_active_window:
call get_active_window_info
 
188,6 → 191,7
mov [rect.height],ax
ret
 
align 4
draw_rect_on_screen:
 
xor edx,edx
237,37 → 241,11
 
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
 
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
system_dir_LibImg db '/sys/lib/libimg.obj',0
 
if lang eq ru
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
 
err_message_found_lib1 db 'box_lib.obj - ­¥ ­ ©¤¥­ !',0
err_message_found_lib2 db 'proc_lib.obj - ­¥ ­ ©¤¥­ !',0
err_message_found_lib3 db 'libimg.obj - ­¥ ­ ©¤¥­ !',0
 
err_message_import1 db 'box_lib.obj - ®è¨¡ª  ¨¬¯®àâ !',0
err_message_import2 db 'proc_lib.obj - ®è¨¡ª  ¨¬¯®àâ !',0
err_message_import3 db 'libimg.obj - ®è¨¡ª  ¨¬¯®àâ !',0
 
else
 
head_f_i:
head_f_l db 'System error',0
 
err_message_found_lib1 db 'box_lib.obj - Not found!',0
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
err_message_found_lib3 db 'libimg.obj - Not found!',0
 
err_message_import1 db 'box_lib.obj - Wrong import!',0
err_message_import2 db 'proc_lib.obj - Wrong import!',0
err_message_import3 db 'libimg.obj - Wrong import!',0
end if
;---------------------------------------------------------------------
align 4
ProcLib_import:
/programs/other/kpack/trunk/const_var.inc
69,8 → 69,7
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
;OpenDialog__Version dd aOpenDialog_Version
dd 0
dd 0
dd 0,0
aOpenDialog_Init db 'OpenDialog_init',0
aOpenDialog_Start db 'OpenDialog_start',0
;aOpenDialog_Version db 'Version_OpenDialog',0
85,8 → 84,7
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
 
dd 0
dd 0
dd 0,0
 
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
97,15 → 95,6
aCheck_box_mouse db 'check_box_mouse2',0
 
;---------------------------------------------------------------------
head_f_i:
head_f_l db 'System error',0
 
err_message_found_lib1 db 'box_lib.obj - Not found!',0
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
 
err_message_import1 db 'box_lib.obj - Wrong import!',0
err_message_import2 db 'proc_lib.obj - Wrong import!',0
 
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
;---------------------------------------------------------------------
112,11 → 101,9
align 4
l_libs_start:
 
library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, Box_lib_import
 
library02 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, ProcLib_import
 
load_lib_end:
;---------------------------------------------------------------------
/programs/other/kpack/trunk/kpack.asm
23,15 → 23,16
dd cur_dir_path
;---------------------------------------------------------------------
include '../../../config.inc' ;for nightbuild
include '../../../KOSfuncs.inc'
include '../../../macros.inc'
include '../../../gui_patterns.inc'
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../load_lib.mac'
@use_library
 
START:
mcall 68,11
mcall 40,0x80000027
mcall SF_SYS_MISC,SSF_HEAP_INIT
mcall SF_SET_EVENTS_MASK,0x80000027
 
load_libraries l_libs_start,load_lib_end
cmp eax,-1
130,7 → 131,7
call draw_window
;--------------------------------------
still:
mcall 10
mcall SF_WAIT_EVENT
dec eax
jz red
 
182,11 → 183,11
exit:
xor eax,eax
dec eax
mcall
mcall ;SF_TERMINATE_PROCESS
;*********************************************************************
button:
; button pressed
mcall 17
mcall SF_GET_BUTTON
xchg al,ah
cmp al,7
jz but7
318,7 → 319,7
ret
;*********************************************************************
key:
mcall 2
mcall SF_GET_KEY
 
push dword edit1
call [edit_box_key]
408,7 → 409,7
neg ecx
mov esi,ecx
pop edi
mcall 4,,0xB0000000,edi
mcall SF_DRAW_TEXT,,0xB0000000,edi
add ebx,16
add edi,80
cmp edi,message_cur_pos
418,20 → 419,20
;*********************************************************************
draw_log_area:
DrawRectangle 5, LOG_Y, WIN_W-12, LOG_H, [sc.work_graph]
mcall 13, <6,WIN_W-13>, <LOG_Y+1,LOG_H-1>, 0xFFFfff
mcall SF_DRAW_RECT, <6,WIN_W-13>, <LOG_Y+1,LOG_H-1>, 0xFFFfff
DrawRectangle3D 6, LOG_Y+1, WIN_W-13, LOG_H-1, 0xDEDEDE, [sc.work_graph]
ret
;*********************************************************************
draw_window:
; start redraw
mcall 12,1
mcall 48,3,sc,40
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,40
;--------------------------------------
edit_boxes_set_sys_color edit1,editboxes_end,sc
check_boxes_set_sys_color2 check1,check1_end,sc
;--------------------------------------
; define window
mcall 48,4
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
 
mov ecx,100 shl 16 + WIN_H
add ecx, eax
440,8 → 441,8
add edx,34000000h
xor esi,esi
xor edi,edi
mcall 0,<250,WIN_W+10>,,,,caption_str
mcall 9,procinfo,-1
mcall SF_CREATE_WINDOW,<250,WIN_W+10>,,,,caption_str
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo+70] ;status of window
test eax,100b
457,7 → 458,7
call draw_editbox
; end redraw
.end:
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
ret
;*********************************************************************
draw_editbox:
494,7 → 495,7
draw_buttons:
; define compress button
mov cx,18
mcall 8,<WIN_W - RIGHT_BTN_W - 5, RIGHT_BTN_W>, <3, 20>,2,[sc.work_button]
mcall SF_DEFINE_BUTTON,<WIN_W - RIGHT_BTN_W - 5, RIGHT_BTN_W>, <3, 20>,2,[sc.work_button]
; uncompress button
inc edx
add ecx,LINE_H shl 16
506,10 → 507,10
mov ecx,[sc.work_button_text]
or ecx,0x90000000
mov edx,aQuestion
mcall 4,<WIN_W-19, LINE_H*2+5>
mcall SF_DRAW_TEXT,<WIN_W-19, LINE_H*2+5>
pop esi
; define Path button
mcall 8,<6,64>,<LINE_H*2+3,20>,4
mcall SF_DEFINE_BUTTON,<6,64>,<LINE_H*2+3,20>,4
; text on Path button
mov ebx,8 shl 16+5
mov al,4
/programs/system/format/format.asm
44,13 → 44,14
include 'lang.inc'
include '../../macros.inc'
include '../../proc32.inc'
include '../../KOSfuncs.inc'
include '../../dll.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' ;for uses checkBox and editBox
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../load_lib.mac'
@use_library
 
START:
mcall 48,3,sc,sizeof.system_colors ;get system colors
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors ;get system colors
 
stdcall dll.Load, @IMPORT
or eax, eax
61,7 → 62,7
 
;set mask for events:
;ñîîáùåíèå î ïåðåðèñîâêå,íàæàòà êíîïêà, îïðåäåë¸ííàÿ ðàíåå, ñîáûòèå îò ìûøè (÷òî-òî ñëó÷èëîñü - íàæàòèå íà êíîïêó ìûøè èëè ïåðåìåùåíèå; ñáðàñûâàåòñÿ ïðè ïðî÷òåíèè)
mcall 40, 0x27
mcall SF_SET_EVENTS_MASK, 0x27
 
mov ecx,[sc.work_text]
and ecx, 0x9FFFFFFF
120,7 → 121,7
call draw_window
 
event_wait:
mcall 10
mcall SF_WAIT_EVENT
 
cmp eax, 1 ; Event redraw
je redraw
142,18 → 143,18
jmp event_wait
 
key:
mcall 2
mcall SF_GET_KEY
invoke edit_box_key, editLabel
invoke edit_box_key, editMBR
jmp event_wait
 
button:
mcall 17
mcall SF_GET_BUTTON
 
cmp ah, 1 ;Close button
jne @f
exit:
mcall -1
mcall SF_TERMINATE_PROCESS
@@:
cmp ah, 2 ;Format button
jne @f
225,7 → 226,7
 
butSelectFS:
push eax ebx ecx
mcall 9, pi, -1 ;get window coord
mcall SF_THREAD_INFO, pi, -1 ;get window coord
 
mov eax, dword[pi+34]
add eax, Otstup
241,7 → 242,7
 
butUnit:
push eax ebx ecx
mcall 9, pi, -1
mcall SF_THREAD_INFO, pi, -1
 
mov eax, dword[pi+34]
add eax, Otstup+80+30+delta
257,7 → 258,7
 
butDevice:
push eax ebx ecx
mcall 9, pi, -1
mcall SF_THREAD_INFO, pi, -1
 
mov eax, dword[pi+34]
add eax, Otstup+80+30+delta
279,9 → 280,9
ret
 
draw_window:
mcall 12, 1
mcall SF_REDRAW, SSF_BEGIN_DRAW
 
mov eax, 0 ; function 0 : define and draw window
mov eax, SF_CREATE_WINDOW ; define and draw window
mov ebx, 100 * 65536 + (290+delta) ; [x start] *65536 + [x size]
mov ecx, 100 * 65536 + (310+dy) ; [y start] *65536 + [y size]
mov edx,[sc.work] ;0x14FFFFFF
293,38 → 294,24
mcall
 
 
mov ebx, (290+delta-Otstup-130+10)*65536+130
mov ecx, (270+dy)*65536+(20+3)
mov edx, 0x00000002
mov esi, 0xAABBCC
mcall 8
mcall SF_DEFINE_BUTTON, (290+delta-Otstup-130+10)*65536+130, (270+dy)*65536+(20+3), 2
 
mov ebx, (290+delta-Otstup-50-2)*65536+(50+2)
mov ecx, (210+dy)*65536+21 ;14
mov edx, 0x00000003
mov esi, 0xAABBCC
mcall 8
inc edx
mcall , (290+delta-Otstup-50-2)*65536+(50+2), (210+dy)*65536+21 ;14
 
;button select FS
mov ebx, Otstup*65536+120
mov ecx, (110)*65536+(21)
mov edx, 0x00000004
inc edx
mov esi, 0xFFFFFF
mcall 8
mcall , Otstup*65536+120, (110)*65536+(21)
 
;button select unit size
mov ebx, (Otstup+80+30+delta)*65536+120
mov ecx, (110)*65536+(21)
mov edx, 0x00000005
mov esi, 0xFFFFFF
mcall 8
inc edx
mcall , (Otstup+80+30+delta)*65536+120, (110)*65536+(21)
 
;button select device
mov ebx, (Otstup+80+30+delta)*65536+120
mov ecx, (60)*65536+(21)
mov edx, 0x00000006
mov esi, 0xFFFFFF
mcall 8
inc edx
mcall , (Otstup+80+30+delta)*65536+120, (60)*65536+(21)
 
invoke check_box_draw, ch1 ;ðèñîâàíèå ÷åêáîêñîâ
invoke check_box_draw, ch2
345,7 → 332,7
push dword frame_data2
invoke frame_draw
 
mcall 12, 2
mcall SF_REDRAW, SSF_END_DRAW
ret
 
 
385,13 → 372,6
.6 db '32 Š¡', 0
.7 db '64 Š¡', 0
 
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
err_message_found_lib0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
err_message_found_lib1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,0
err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,0
 
else ;EN language
 
title db "Formatting Disk Utility", 0
418,13 → 398,6
.6 db '32 Kb', 0
.7 db '64 Kb', 0
 
head_f_i:
head_f_l db 'System error',0
err_message_found_lib0 db 'Could not find library ',39,'proc_lib.obj',39,0
err_message_import0 db 'Error importing library ',39,'proc_lib.obj',39,0
err_message_found_lib1 db 'Could not find library ',39,'kmenu.obj',39,0
err_message_import1 db 'Error importing library ',39,'kmenu',39,0
 
end if
 
 
450,11 → 423,11
mov [kmDevice], eax
sizeBDVK = 560 ;304 ;
 
mcall 68, 11
mcall SF_SYS_MISC, SSF_HEAP_INIT
 
mcall 68, 12, sizeBDVK*maxDeviceCount+32
mcall SF_SYS_MISC, SSF_MEM_ALLOC, sizeBDVK*maxDeviceCount+32
mov dword[read_folder_struct.return], eax
mcall 70, read_folder_struct
mcall SF_FILE, read_folder_struct
cmp eax, 0
je .next
cmp eax, 6
500,27 → 473,27
mov eax, text.volume
mov edx, eax
mov esi, 13
mcall 4
mcall SF_DRAW_TEXT
 
mov ebx, Otstup * 65536 + 99-6
mov edx, text.fs
mov esi, 12
mcall 4
mcall SF_DRAW_TEXT
 
mov ebx, (Otstup+80+30+delta) * 65536 + 99-6
mov edx, text.unit
mov esi, 21
mcall 4
mcall SF_DRAW_TEXT
 
mov ebx, (Otstup+80+30+delta) * 65536 + 49-6
mov edx, text.disk
mov esi, 9
mcall 4
mcall SF_DRAW_TEXT
 
; mov ebx, Otstup * 65536 + (151-6+dy)
; mov edx, text.option
; mov esi, 8
; mcall 4
; mcall SF_DRAW_TEXT
 
mov ebx, (Otstup+80+30+delta +5) * 65536 + (110+3)
mov dl, byte[kmUnitID]
567,7 → 540,7
mov byte[kmUnitID], 0
mov edx, unittext.0
.printUnit:
mcall 4
mcall SF_DRAW_TEXT
 
mov ebx, (Otstup+5) * 65536 + (110+3)
mov dl, byte[kmID]
600,7 → 573,7
mov edx, kmNone
.printFS:
;mov esi, 8
mcall 4
mcall SF_DRAW_TEXT
 
;button device
mov ebx, (Otstup+80+30+delta +5) * 65536 + (60+3)
609,7 → 582,7
add edx, deviceAdrStr
mov edx, dword[edx]
;call setCurrentDeviceInEDX
mcall 4
mcall SF_DRAW_TEXT
 
;buttons text
mov ebx, (290+delta-Otstup-130+10+2+10) * 65536 + (277-3+dy)
617,7 → 590,7
mov eax, text.format
mov edx, eax
mov esi, 6
mcall 4
mcall SF_DRAW_TEXT
 
mov ebx, (290+delta-Otstup-52+6+8) * 65536 + (213+dy)
;mov ecx, 0xFFFFFF
624,7 → 597,7
mov eax, browse ;text.browse
mov edx, eax
mov esi, 6
mcall 4
mcall SF_DRAW_TEXT
 
pop esi edi edx ecx ebx eax
ret
777,7 → 750,7
akmenuitem_draw db 'kmenuitem_draw',0
 
align 4
proclib_import:
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
dd 0,0
839,8 → 812,8
;kmXFS: db 'XFS', 0
 
l_libs_start:
lib0 l_libs lib0_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, proclib_import,err_message_import0, head_f_i
lib1 l_libs lib1_name, sys_path, file_name, system_dir0, err_message_found_lib1, head_f_l, import_libkmenu,err_message_import1,head_f_i
lib0 l_libs lib0_name, file_name, system_dir0, import_proclib
lib1 l_libs lib1_name, file_name, system_dir0, import_libkmenu
load_lib_end:
 
;ðàçìåðû: 80 è 120