Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 1295 → Rev 1303

/programs/develop/libraries/box_lib/trunk/box_lib.asm
162,6 → 162,8
dd sz_tl_node_poi_get_info, tl_node_poi_get_info
dd sz_tl_node_poi_get_next_info,tl_node_poi_get_next_info
dd sz_tl_node_poi_get_data, tl_node_poi_get_data
dd sz_tl_save_mem, tl_save_mem
dd sz_tl_load_mem, tl_load_mem
dd sz_tl_version_tree_list, 0x00000001
 
dd 0,0
226,4 → 228,6
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
sz_tl_save_mem db 'tl_save_mem',0
sz_tl_load_mem db 'tl_load_mem',0
sz_tl_version_tree_list db 'version_tree_list',0
/programs/develop/libraries/box_lib/trunk/tree_list.mac
1,6 → 1,6
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
; ýëåìåíò TreeList äëÿ Kolibri OS
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 24.11.2009 IgorA
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 2.12.2009 IgorA
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
 
 
32,7 → 32,8
tl_box_width equ dword[edi+66]
tl_box_height equ dword[edi+70]
tl_capt_cy equ word[edi+74] ;âûñîòà ïîäïèñè
tl_info_capt_offs equ dword[edi+76] ;ñäâèã äëÿ íà÷àëà òåêñòà (ïîäïèñè óçëà)
tl_info_capt_offs equ word[edi+76] ;ñäâèã äëÿ íà÷àëà òåêñòà (ïîäïèñè óçëà)
tl_info_capt_len equ word[edi+78] ;äëèííà òåêñòà ïîäïèñè óçëà (åñëè = 0 òî äî êîíöà ñòðóêòóðû)
tl_el_focus equ dword[edi+80] ;óêàçàòåëü íà ñòðóêòóðó ýëåìåíòà â ôîêóñå
tl_p_scrol equ dword[edi+84] ;óêàçàòåëü íà ñòðóêòóðó ñêðîëëèíãà
tl_sb_draw equ dword[edi+88] ;óêàçàòåëü íà ôóíêöèþ ïåðåðèñîâûâàþùóþ ñêðîëëèíã
43,6 → 44,13
tl_draw_par_line equ 10b ;ðèñîâàòü ëèíèè ê ðîäèòåëüñêîìó óçëó
tl_list_box_mode equ 100b ;ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå îäíîãî óðîâíÿ)
 
;êîíñòàíòû äëÿ ôóíêöèé
tl_err_save_memory_size equ 10b ;íå õâàòàåò ïàìÿòè äëÿ ñîõðàíåíèÿ ýëåìåíòà
tl_err_load_caption equ 1b ;â ïàìÿòè íåò çàãîëîâêà 'tree'
tl_err_load_info_size equ 100b ;íå ñîâïàäàåò ðàçìåð èíôîðìàöèîííîé ñòðóêòóðû ïðè îòêðûòèè
tl_load_mode_add equ 0x20000 ;îïöèÿ ñ÷èòûâàíèÿ â ðåæèìå äîáàâëåíèÿ èíôîðìàöèè
tl_save_load_heder_size equ 26 ;ðàçìåð çàãîëîâêà äëÿ çàïèñè/÷òåíèÿ ýëåìåíòîâ
 
;data_info dd ? ;+ 0 óêàçàòåëü íà îñíîâíûå äàíûå
;info_max_count dd ? ;+ 6 ìàêñèìàëüíîå êîëëè÷åñòâî ñòðóêòóð
;data_img dd ? ;+18 óêàçàòåëü íà èçîáðàæåíèÿ
51,7 → 59,7
 
struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\
el_focus, p_scrol,p_sb_draw,on_press {
info_capt_len,el_focus, p_scrol,p_sb_draw,on_press {
.data_info dd 0
.info_size dw info_size
.info_max_count dd info_max_count
68,12 → 76,13
.col_bkg dd col_bkg
.col_zag dd col_zag
.col_txt dd col_txt
.box_lert dd box_l
.box_left dd box_l
.box_top dd box_t
.box_width dd box_w
.box_height dd box_h
.capt_cy dw capt_cy
.info_capt_offs dd info_capt_offs
.info_capt_offs dw info_capt_offs
.info_capt_len dw info_capt_len
.el_focus dd el_focus
.p_scrol dd p_scrol
.p_sb_draw dd p_sb_draw
205,7 → 214,13
loop @b
mov eax,tl_data_nodes ;óêàçàòåëü íà 0-é óçåë
mov dword[eax+8],1 ;óêàçàòåëü next â 0-ì óçëå ïðèðàâíèâàåì ê 1
call tb_scrol_resize ;îáðàáîòêà ñêðîëëèíãà
 
cmp tl_p_scrol,0 ;îáðàáîòêà ñêðîëëèíãà
je @f
mov eax,tl_p_scrol
mov dword[eax+24],0 ;+24 .position
call tb_scrol_resize
@@:
pop edi ecx eax
pop ebp
ret 4
215,7 → 230,7
tl_key: ;ðåàêöèÿ íà êëàâèàòóðó
push ebp
mov ebp,esp
push ebx edi
push ebx ecx edi
mov edi,dword[ebp+8]
 
mov ebx,tl_el_focus
222,44 → 237,66
cmp dword[ebx],edi
jne .no_focus ;ýëåìåíò íå â ôîêóñå
 
push eax
mov eax,66
mov ebx,2
int 0x40 ;ïîëó÷èòü ðåæèì ââîäà ñ êëàâèàòóðû
 
lea ecx,[tl_key_scan]
cmp eax,1 ;1 = ñêàíêîäû
je @f
lea ecx,[tl_key_ascii]
@@:
pop eax
 
xor bx,bx
cmp ah,13 ;Enter
cmp ah,byte[ecx] ;Enter
jne @f
cmp tl_on_press,0
je @f
call tl_on_press
@@:
cmp ah,32 ;Space
cmp ah,byte[ecx+1] ;Space
jne @f
push dword edi
call tl_node_close_open
@@:
cmp ah,178 ;Up
cmp ah,byte[ecx+2] ;Up
jne @f
push dword edi
call tl_cur_perv
@@:
cmp ah,177 ;Down
cmp ah,byte[ecx+3] ;Down
jne @f
push dword edi
call tl_cur_next
@@:
cmp ah,byte[ecx+7] ;Page Up
jne @f
push dword edi
call tl_cur_page_up
@@:
cmp ah,byte[ecx+8] ;Page Down
jne @f
push dword edi
call tl_cur_page_down
@@:
 
bt tl_style,0 ;tl_key_no_edit
jc .no_edit
cmp ah,176 ;Left
cmp ah,byte[ecx+4] ;Left
jne @f
push dword edi
call tl_node_lev_dec
mov bx,1
@@:
cmp ah,179 ;Right
cmp ah,byte[ecx+5] ;Right
jne @f
push dword edi
call tl_node_lev_inc
mov bx,1
@@:
cmp ah,182 ;Delete
cmp ah,byte[ecx+6] ;Delete
jne @f
push dword edi
call tl_node_delete
273,7 → 310,7
call tl_draw
.no_focus:
 
pop edi ebx
pop edi ecx ebx
pop ebp
ret 4
 
1113,7 → 1150,7
 
xor esi,esi
mov si,tl_info_size
cmp esi,tl_info_capt_offs
cmp si,tl_info_capt_offs
jle @f ;if caption size <= 0
 
push eax
1120,8 → 1157,8
call tl_get_node_index ;eax = node index
imul esi,eax
pop eax
add si,tl_info_capt_offs
add esi,dword[edi]
add esi,tl_info_capt_offs
mov edx,esi
 
shr ebx,16
1223,8 → 1260,10
jne .u0
 
inc tl_ch_tim
push word[ebp+14] ;get type
pop word[edx]
mov cx,word[ebp+14] ;get type
mov word[edx],cx
mov cl,byte[ebp+13]
mov byte[edx+3],cl ;node[i].clo
mov byte[edx+2], 0 ;node[i].lev=0
bt tl_style,2 ;tl_list_box_mode
jc .l_box_m
1251,9 → 1290,17
 
mov esi,edi
mov edi,dword[ebp+16] ;restore edi
mov ecx,tl_info_capt_offs
mov cx,tl_info_capt_offs
cmp cx,tl_info_size
jge .no_text_data
cmp tl_info_capt_len,0 ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó ñòðîêè
je .no_len_ogran
add cx,tl_info_capt_len
and ecx,0xffff
add esi,ecx
mov cx,tl_info_size
sub esi,ecx
.no_len_ogran:
dec esi
mov byte[esi],0
.no_text_data:
1334,11 → 1381,23
 
mov esi,edi
mov edi,dword[ebp+12] ;restore edi
mov ecx,tl_info_capt_offs
mov cx,tl_info_capt_offs
cmp cx,tl_info_size
jge .no_text_data
dec esi
mov byte[esi],0
mov ax,tl_info_capt_len ;ïðîâåðÿåì åñòü ëè îãðàíè÷åíèå íà äëèííó òåêñòà
cmp ax,0
je .no_limit
add cx,ax ;cx = tl_info_capt_offs + tl_info_capt_len
and ecx,0xffff
xor eax,eax
mov ax,tl_info_size
cmp eax,ecx
jl .no_limit ;ïîëüçîâàòåëü çàäàë ñëèøêîì áîëüøóþ äëèííó òåêñòà
add esi,ecx
sub esi,eax
.no_limit:
dec esi
mov byte[esi],0 ;îáíóëÿåì ïîñëåäíèé ñèìâîë ïîäïèñè, ÷òî-áû íå ãëþ÷èëî åñëè ïîëüçîâàòåëü çàäàë íåïðàâèëüíóþ ñòðóêòóðó
.no_text_data:
 
@@:
1599,7 → 1658,29
pop edx ecx
ret
 
;input:
; edi = pointer 'tl' struct
;output:
; eax = struct index of current node
align 4
tl_get_node_count_all: ;áåðåò ÷èñëî âñåõ âèäèìûõ óçëîâ (ñ÷èòàÿ çàêðûòûå äî÷åðíèå)
push ecx edx
;cycle to nodes
xor eax,eax
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
@@:
call tl_iterat_next_all
cmp edx,ecx
jle @f
inc eax
jmp @b
@@:
pop edx ecx
ret
 
align 4
tl_cur_perv: ;ïåðåíåñòè êóðñîð íà 1 ïîçèöèþ âûøå
push ebp
mov ebp,esp
1641,6 → 1722,110
ret 4
 
align 4
tl_cur_page_up: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó âûøå
push ebp
mov ebp,esp
push eax edi esi
mov edi,dword[ebp+8]
 
cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
je .no_redraw
 
mov esi,tl_p_scrol
call tl_get_rows_count ;eax = rows count
 
cmp tl_cur_pos,0
jne @f
cmp dword[esi+24],0 ;åñëè ñêðîëëèíã íà âåðõó, âûõîäèì
jne @f
jmp .no_redraw
@@:
cmp tl_cur_pos,eax ;ïðîâåðÿåì ïîçèöèþ êóðñîðà è êîë-âî ñòîê íà ñòðàíèöå
jl @f ;åñëè ìåíüøå, òî ïðèðàâíèâàåì ê 0, ÷òî-áû íå îòíÿòü áîëüøå ÷åì íàäî
sub tl_cur_pos,eax
jmp .cursor
@@:
mov tl_cur_pos,0
.cursor:
cmp dword[esi+24],eax
jl @f
sub dword[esi+24],eax
jmp .scroll
@@:
mov dword[esi+24],0
.scroll:
;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
push dword edi
call tl_draw ;draw window
push dword esi
mov eax,dword[ebp+8]
mov eax,tl_sb_draw ;.redraw
call dword[eax]
.no_redraw:
pop esi edi eax
pop ebp
ret 4
 
align 4
tl_cur_page_down: ;ïåðåíåñòè êóðñîð íà 1 ñòðàíèöó íèæå
push ebp
mov ebp,esp
push eax ebx ecx edi esi
;eax - êîë-âî ñòðîê íà ñòðàíèöå
;ebx - ìàêñ. ïîçèöèÿ êóðñîðà
;ecx - ìàêñ. ïîçèöèÿ ñêðîëëèíãà
mov edi,dword[ebp+8]
 
cmp tl_p_scrol,0 ;åñëè åñòü óêàçàòåëü íà ñêðîëëèíã
je .no_redraw
 
mov esi,tl_p_scrol
call tl_get_node_count ;eax = node count
mov ebx,eax
call tl_get_rows_count ;eax = rows count
 
mov ecx,ebx
inc ecx ;åñëè íèæíèé óçåë âèäåí íà ïîëîâèíó
cmp ecx,eax ;if (ecx>eax) { ecx=ecx-eax } else { ecx=0 }
jl @f
sub ecx,eax ;óìåíüøàåì ìàêñèìàëüíóþ ïîçèöèþ ñêðîëëèíãà, òàê ÷òî-áû áûëè âèäíû ïîñëåäíèå óçëû
jmp .control
@@:
xor ecx,ecx ;ecx=0 - âñå óçëû âëàçÿò â ýêðàí, ñêðîëëèíã íå íóæåí
.control:
 
cmp tl_cur_pos,ebx ;êóðñîð âíèçó ?
jl @f
cmp dword[esi+24],ecx ;ñêðîëëèíã âíèçó ?
jl @f
jmp .no_redraw
@@:
 
add tl_cur_pos,eax ;ïåðåìåùàåì êóðñîð
cmp tl_cur_pos,ebx
jl @f
mov tl_cur_pos,ebx
@@:
 
add dword[esi+24],eax ;ïåðåìåùàåì ñêðîëëèíã
cmp dword[esi+24],ecx
jl @f
mov dword[esi+24],ecx
@@:
 
;ïåðåðèñîâêè îêíà è ñêðîëëèíãà
push dword edi
call tl_draw ;draw window
push dword esi
mov eax,dword[ebp+8]
mov eax,tl_sb_draw ;.redraw
call dword[eax]
.no_redraw:
pop esi edi ecx ebx eax
pop ebp
ret 4
 
align 4
tl_node_close_open: ;îòêðûòü/çàêðûòü óçåë (ðàáîòàåò ñ óçëàìè êîòîðûå èìåþò äî÷åðíèå óçëû)
push ebp
mov ebp,esp
1874,6 → 2059,205
@@:
ret
 
;input:
;dword[ebp+ 8] - memory size
;dword[ebp+12] - pointer to memory
;dword[ebp+16] - options: 0 - first element, 1 - add next element
;dword[ebp+20] - pointer to 'TreeList' struct
;output:
;dword[ebp+ 8] - error code
align 4
tl_save_mem:
push ebp
mov ebp,esp
push eax ebx ecx edx edi esi
mov esi,dword[ebp+12]
mov edi,dword[ebp+20]
 
cmp dword[ebp+16],0 ;add mode
je @f
.beg_cycle:
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
jne @f
xor ebx,ebx
mov bx,word[esi+4]
imul ebx,dword[esi+6]
add ebx,tl_save_load_heder_size
add esi,ebx
jmp .beg_cycle
@@:
 
xor ebx,ebx
mov bx,tl_info_size
 
call tl_get_node_count_all ;eax = all node count
 
mov ecx,eax ;âû÷èñëÿåì ñêîëüêî ïàìÿòè äîëæíî áûòü çàïîëíåíî
imul ecx,ebx ;óìíîæàåì íà ðàçìåð ñòðóêòóðû óçëà
add ecx,tl_save_load_heder_size+1 ;element header +1 end element sumbol
add ecx,esi ;äîáàâëÿåì óêàçàòåëü íà íà÷àëî ïàìÿòè (ñ ó÷åòîì ðàíåå çàïèñàííûõ ñòðóêòóð)
sub ecx,dword[ebp+12] ;îòíèìàåì óêàçàòåëü íà íà÷àëî ïàìÿòè (áåç ðàíåå çàïèñàííûõ ñòðóêòóð)
cmp ecx,dword[ebp+8] ;ecx = element memory size
jg .err_mem_size
 
;save tree params
mov dword[esi],0x65657274 ;0x65657274 = 'tree'
mov word[esi+4],bx
mov dword[esi+6],eax ;element count
add esi,10
 
mov eax,tl_style
mov dword[esi],eax
add esi,4
 
mov eax,tl_cur_pos
mov dword[esi],eax
add esi,4
 
mov ax,tl_info_capt_offs
mov word[esi],ax
add esi,2
 
mov ax,tl_info_capt_len
mov word[esi],ax
add esi,2+4
 
;cycle to nodes
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
@@:
call tl_iterat_next_all
cmp edx,ecx
jle @f
;save node params
call tl_get_node_index ;eax = index of pointer [edx]
mov dword[esi],eax
 
add esi,4
mov eax,dword[edx] ;eax = (type; lev; clo)
mov dword[esi],eax
add esi,4
 
;push dword edi
;call tl_node_get_data
;pop eax
push dword edi
push dword edx
call tl_node_poi_get_data
pop dword eax
 
;call tl_node_copy_data
push ecx edi
mov edi,eax
mov ecx,ebx
xchg esi,edi
rep movsb
mov esi,edi
pop edi ecx
;add esi,ebx
jmp @b
@@:
mov byte[esi],0 ;end of 'treelist'
mov dword[ebp+20],0 ;return error code
jmp @f
.err_mem_size:
or dword[ebp+20],tl_err_save_memory_size
@@:
pop esi edi edx ecx ebx eax
pop ebp
ret 12
 
;input:
;dword[ebp+ 8] - memory size
;dword[ebp+12] - pointer to memory
;word[ebp+16] - options: element index
;word[ebp+18] - options: 2*(add mode)+(init mode)
;dword[ebp+20] - pointer to 'TreeList' struct
;output:
;dword[ebp+ 8] - error code
align 4
tl_load_mem:
push ebp
mov ebp,esp
push eax ebx ecx edx edi esi
mov esi,dword[ebp+12]
mov edi,dword[ebp+20]
 
mov dword[ebp+20],0 ;return error code
 
xor ecx,ecx
mov cx,word[ebp+16]
cmp cx,0 ;load in array mode
je @f
.beg_cycle:
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
jne .no_tree
xor ebx,ebx
mov bx,word[esi+4]
imul ebx,dword[esi+6]
add ebx,tl_save_load_heder_size
add esi,ebx
loop .beg_cycle
@@:
 
cmp dword[esi],0x65657274 ;0x65657274 = 'tree'
jne .no_tree
bt word[ebp+18],1 ;load in add mode
jc @f
push dword edi
call tl_info_clear
@@:
 
xor ebx,ebx
mov bx,word[esi+4] ;info_size
cmp bx,tl_info_size
je @f
or dword[ebp+20],tl_err_load_info_size
@@:
mov ecx,dword[esi+6] ;count nodes
cmp ecx,1
jl .end_f
add esi,tl_save_load_heder_size
 
@@:
;load node params
push dword edi
mov eax,dword[esi+4]
ror eax,16
push dword eax ;options (type; lev; clo)
add esi,8
push dword esi
call tl_node_add
 
push dword edi
call tl_cur_next
;...
add esi,ebx
loop @b
 
jmp .end_f
.no_tree:
mov dword[ebp+20],tl_err_load_caption
.end_f:
pop esi edi edx ecx ebx eax
pop ebp
ret 12
 
;ascii scan key
; 13 28 Enter
; 32 57 Space
; 178 72 Up
; 177 80 Down
; 176 75 Left
; 179 77 Right
; 182 83 Delete
; 184 73 Pg Up
; 183 81 Pg Dn
 
tl_key_ascii db 13,32,178,177,176,179,182,184,183
tl_key_scan db 28,57, 72, 80, 75, 77, 83, 73, 81
 
txt_capt_cur db '‘âப ',0
txt_capt_otm db 'Žâ¬¥­ë',0
}
/programs/develop/libraries/box_lib/trunk/tree_list_doc/info_treelist.htm
71,6 → 71,8
<li>tl_node_poi_get_info</li>
<li>tl_node_poi_get_next_info</li>
<li>tl_node_poi_get_data</li>
<li><a href="#fun_sme">tl_save_mem</a></li>
<li><a href="#fun_lme">tl_load_mem</a></li>
<li>version_tree_list</li>
</ul>
<p><a href="#struc_tree_list">Ñòðóêòóðà tree_list</a></p>
91,7 → 93,10
<p>Î÷èñòêà ñïèñêà îò âñåõ óçëîâ. Ýòî äåéñòâèå íåëüçÿ îòìåíèòü ôóíêöèåé <b>tl_info_undo</b>.</p>
 
<h2><a name="fun_key">tl_key</a></h2>
<p>Ôóíêöèÿ êîòîðóþ íóæíî âûçûâàòü ïðè íàæàòèè íà êëàâèàòóðó.</p>
<p>Ôóíêöèÿ êîòîðóþ íóæíî âûçûâàòü ïðè íàæàòèè íà êëàâèàòóðó.
Êíîïêè, êîòîðûå íå äîñòóïíû åñëè åñòü ñòèëü <i>tl_key_no_edit</i>: [<b>Enter</b>], [<b>Delete</b>], [<b>&larr;</b>], [<b>&rarr;</b>].
Âñåãäà äîñòóïíû: [<b>&uarr;</b>], [<b>&darr;</b>], [<b>Page Up</b>], [<b>Page Dn</b>], [<b>Space</b>].
Ôóíêöèÿ ïðîâåðÿåò âêëþ÷åí ëè ðåæèì scan êîäîâ, è â ñëó÷àå íåîáõîäèìîñòè ñàìà ïðåîáðàçóåò êîäû.</p>
 
<h2><a name="fun_mouse">tl_mouse</a></h2>
<p>Ôóíêöèÿ äëÿ ñîáûòèé îò ìûøè.</p>
111,7 → 116,8
push dword 0x10002
push dword data_buffer
call dword[tl_node_add]</pre>
<p>ãäå: <b>tree1</b> - ñòðóêòóðà tree_list; <b>0x10002</b> - ïàðàìåòðû óçëà (ñòàðøèå áàéòû 0x0001 - èíäåêñ èêîíêè, îòîáðàæàåìîé âîçëå óçëà; ìåíüøèé áàéò 0x02 - óðîâåíü âëîæåíîñòè óçëà); <b>data_buffer</b> - óêàçàòåëü íà äûííûå, äîáàâëÿåìûå â óçåë.</p>
<p>ãäå: <b>tree1</b> - ñòðóêòóðà tree_list;
<b>0x10002</b> - ïàðàìåòðû óçëà (ñòàðøèå áàéòû 0x0001 - èíäåêñ èêîíêè, îòîáðàæàåìîé âîçëå óçëà; ìåíüøèé áàéò 0x02 - óðîâåíü âëîæåíîñòè óçëà); <b>data_buffer</b> - óêàçàòåëü íà äûííûå, äîáàâëÿåìûå â óçåë.</p>
 
<h2>tl_node_set_data</h2>
<p>Óñòàíàâëèâàåò íîâûå äàííûå (ïîëüçîâàòåëüñêèå è ïîäïèñü) â óçåë ïîä êóðñîðîì.</p>
154,6 → 160,40
 
<p>Ôóíêöèÿìè tl_node_poi_get_info, tl_node_poi_get_next_info è tl_node_poi_get_data ìîæíî ñ÷èòûâàòü èíôîðìàöèþ î óçëàõ ýëåìåíòà, ïðè ýòîì íå ìåíÿÿ òåêóùåãî ïîëîæåíèÿ êóðñîðà. Ò. å. ìîæíî îðãàíèçîâàòü äîñòóï ê äàíûì ýëåìåíòà â &quot;ôîíîâîì ðåæèìå&quot;.</p>
 
<h2><a name="fun_sme">tl_save_mem</a></h2>
<p>Ñîõðàíÿåò èíôîðìàöèþ îá óçëàõ ýëåìåíòà â ïàìÿòü. Ïðèìåð èñïîëüçîâàíèÿ ôóíêöèè:</p>
<pre> MEM_SIZE equ 5000
node_data rb MEM_SIZE
.........
push dword tree1
push dword 0
push dword node_data
push dword MEM_SIZE
call dword[tl_save_mem]
pop eax</pre>
<p>ãäå: <b>tree1</b> - ñòðóêòóðà tree_list;
<b>0</b> - îïöèÿ ñîõðàíåíèÿ â íà÷àëî áëîêà ïàìÿòè (åñëè = 1, òî äîáàâëÿåò ýëåìåíò ïîñëå äðóãèõ ñîõðàíåííûõ ðàíåå);
<b>node_data</b> - óêàçàòåëü íà áëîê ïàìÿòè;
<b>MEM_SIZE</b> - ðàçìåð áëîêà ïàìÿòè äëÿ ñîõðàíåíèÿ.
 ðåãèñòð <b>eax</b> ïèøåòñÿ çíà÷åíèå 0 èëè çàïèñûâàþòñÿ êîäû îøèáîê ñîõðàíåíèÿ.</p>
 
<h2><a name="fun_lme">tl_load_mem</a></h2>
<p>Çàãðóæàåò èíôîðìàöèþ îá óçëàõ ýëåìåíòà èç ïàìÿòè. Ïðèìåð èñïîëüçîâàíèÿ ôóíêöèè:</p>
<pre> MEM_SIZE equ 5000
node_data rb MEM_SIZE
.........
push dword tree1
push dword 0
push dword node_data
push dword MEM_SIZE
call dword[tl_load_mem]
pop eax</pre>
<p>ãäå: <b>tree1</b> - ñòðóêòóðà tree_list;
<b>0</b> - èíäåêñ ñ÷èòûâàåìîãî ýëåìåíòà;
<b>node_data</b> - óêàçàòåëü íà áëîê ïàìÿòè;
<b>MEM_SIZE</b> - ðàçìåð áëîêà ïàìÿòè äëÿ ñîõðàíåíèÿ.
 ðåãèñòð <b>eax</b> ïèøåòñÿ çíà÷åíèå 0 èëè çàïèñûâàþòñÿ êîäû îøèáîê ñ÷èòûâàíèÿ.</p>
 
<h2>version_tree_list</h2>
<p>Âåðñèÿ ýëåìåíòà</p>
 
160,7 → 200,7
<h1><a name="struc_tree_list">Ñòðóêòóðà tree_list</a></h1>
<pre>struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\
el_focus, p_scrol,p_sb_draw,on_press {
info_capt_len,el_focus, p_scrol,p_sb_draw,on_press {
.data_info dd 0
.info_size dw info_size
.info_max_count dd info_max_count
177,19 → 217,20
.col_bkg dd col_bkg
.col_zag dd col_zag
.col_txt dd col_txt
.box_lert dd box_l
.box_left dd box_l
.box_top dd box_t
.box_width dd box_w
.box_height dd box_h
.capt_cy dw capt_cy
.info_capt_offs dd info_capt_offs
.el_focus dd el_focus
.p_scrol dd p_scrol
.p_sb_draw dd p_sb_draw
.info_capt_offs dw info_capt_offs
.info_capt_len dw info_capt_len
.el_focus dd el_focus
.p_scrol dd p_scrol
.p_sb_draw dd p_sb_draw
.on_activate dd 0
.on_press dd on_press
}</pre>
<p><b>info_size</b> - êîëè÷åñòâî áàéò, êîòîðîå áóäåò âûäåëåíî äëÿ êàæäîãî óçëà. ×àñòü ýòîé ïàìÿòè ïîëüçîâàòåëü ìîæåò èñïîëüçîâàòü äëÿ ñâîèõ öåëåé (ðåãóëèðóåòñÿ ÷åðåç <i>info_capt_offs</i>) à îñòàëüíàÿ ÷àñòü áóäåò èñïîëüçîâàíà êàê ïîäïèñü óçëà.</p>
<p><b>info_size</b> - êîëè÷åñòâî áàéò, êîòîðîå áóäåò âûäåëåíî äëÿ êàæäîãî óçëà. ×àñòü ýòîé ïàìÿòè ïîëüçîâàòåëü ìîæåò èñïîëüçîâàòü äëÿ ñâîèõ öåëåé (ðåãóëèðóåòñÿ ÷åðåç <i>info_capt_offs</i> è <i>info_capt_len</i>) à îñòàëüíàÿ ÷àñòü áóäåò èñïîëüçîâàíà êàê ïîäïèñü óçëà.</p>
<p><b>info_max_count</b> - ìàêñèìàëüíîå êîëè÷åñòâî óçëîâ, êîòîðûå ìîæíî äîáàâèòü â ýëåìåíò.</p>
<p><b>style</b> - ñòèëè ýëåìåíòà.</p>
<p><b>data_nodes</b> - óêàçàòåëü íà âíóòðåííèå ñòðóêòóðû óçëîâ (<i>TreeList</i>).</p>
196,14 → 237,15
<p><b>data_img</b> - óêàçàòåëü íà èçîáðàæåíèÿ ñ èêîíêàìè óçëîâ.</p>
<p><b>data_img_sys</b> - óêàçàòåëü íà ñèñòåìíûå èçîáðàæåíèÿ (êóðñîð, ïëþñèêè, ëèíèè, ... âñå êðîìå èêîíîê óçëîâ).</p>
<p><b>capt_cy</b> - âûñîòà ñòðîêè äëÿ ïîäïèñè ââåðõó ýëåìåíòà, åñëè ìåíüøå 9 ïîäïèñü íå âûâîäèòñÿ.</p>
<p><b>info_capt_len</b> - äëèííà òåêñòà äëÿ ïîäïèñè. Åñëè ðàâíî 0, òî äëèííà ñ÷èòàåòñÿ òàê: <i>info_size - info_capt_offs</i>.</p>
<p><b>p_scrol</b> - óêàçàòåëü íà ñòðóêòóðó ñêðîëëèíãà, ñâÿçàííîãî ñ äàííûì ýëåìåíòîì.</p>
<p><b>p_sb_draw</b> - óêàçàòåëü íà ôóíêöèþ ïåðåðèñîâêè âåðòèêàëüíîãî ñêðîëëèíãà (<i>scrollbar_ver_draw</i>).</p>
<p><b>on_press</b> - óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ áóäåò âûçâàíà ïðè íàæèòèè <b>[Enter]</b>. Åñëè óêàçàòåëü ðàâåí 0 òî íè÷åãî íå áóäåò âûçûâàòñÿ.</p>
<p><b>on_press</b> - óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ áóäåò âûçâàíà ïðè íàæèòèè [<b>Enter</b>]. Åñëè óêàçàòåëü ðàâåí 0 òî íè÷åãî íå áóäåò âûçûâàòñÿ.</p>
 
<p>Ïðèìåð ñîçäàíèÿ ñòðóêòóðû:</p>
<pre>tree1 tree_list 24,500, tl_draw_par_line+tl_list_box_mode, 16,16,\
0x8080ff,0x0000ff,0xffffff, 10,35,200-16,285, 14,4,\
el_focus, wScr,scrollbar_ver_draw,fun_on_enter</pre>
0,el_focus, wScr,scrollbar_ver_draw,fun_on_enter</pre>
 
<h1><a name="tree_list_styles">Ñòèëè ýëåìåíòà</a></h1>
<h2>tl_key_no_edit</h2>
214,6 → 256,6
<p>Ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå óçëû îäíîãî óðîâíÿ).</p>
 
<hr>
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü ïîñëåäíèé ðàç 25.11.09.</p>
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü ïîñëåäíèé ðàç 2.12.09.</p>
</body>
</html>