1,27 → 1,23 |
; ¬ ªà®á ¤«ï á¨á⥬®© ¡¨¡«¨®â¥ª¨ box_lib.obj |
; í«¥¬¥â TreeList ¤«ï Kolibri OS |
; ä ©« ¯®á«¥¤¨© à § ¨§¬¥ï«áï 03.12.2015 IgorA |
; í«¥¬¥â TreeList ¤«ï ¡¨¡«¨®â¥ª¨ box_lib.obj |
; ª®¤ ¯à¨¬¥¥ GPL2 «¨æ¥§¨ï |
; ¯®á«¥¤ïï ¬®¤¨ä¨ª æ¨ï 12.09.2017 IgorA |
|
|
sizeof.TreeList equ 20 |
;struct TreeList |
; type dw ? ;+ 0 ⨯ í«¥¬¥â , ¨«¨ ¨¤¥ªá ¨ª®ª¨ ¤«ï 㧫 |
; lev db ? ;+ 2 ã஢¥ì í«¥¬¥â |
; clo db ? ;+ 3 ä« £ § ªàëâ¨ï, ¨«¨ ®âªàëâ¨ï (¨¬¥¥â á¬ëá« ¤«ï த¨â¥«ì᪮£® 㧫 ) |
; perv dd ? ;+ 4 ¨¤¥ªá ¯à¥¤ë¤ã饣® í«¥¬¥â |
; next dd ? ;+ 8 ¨¤¥ªá ¯®á«¥¤ãî饣® í«¥¬¥â |
; tc dd ? ;+12 ¢à¥¬. ᮧ¤ ¨ï |
; td dd ? ;+16 ¢à¥¬. 㤠«¥¨ï |
;ends |
struct TreeNode |
type dw ? ;+ 0 ⨯ í«¥¬¥â , ¨«¨ ¨¤¥ªá ¨ª®ª¨ ¤«ï 㧫 |
level db ? ;+ 2 ã஢¥ì í«¥¬¥â |
close db ? ;+ 3 ä« £ § ªàëâ¨ï, ¨«¨ ®âªàëâ¨ï (¨¬¥¥â á¬ëá« ¤«ï த¨â¥«ì᪮£® 㧫 ) |
perv dd ? ;+ 4 ¨¤¥ªá ¯à¥¤ë¤ã饣® í«¥¬¥â |
next dd ? ;+ 8 ¨¤¥ªá ¯®á«¥¤ãî饣® í«¥¬¥â |
t_create dd ? ;+12 ¢à¥¬. ᮧ¤ ¨ï |
t_delete dd ? ;+16 ¢à¥¬. 㤠«¥¨ï |
ends |
|
macro use_tree_list |
{ |
|
;¢ë¤¥«¨¥ ¯ ¬ï⨠¤«ï áâàãªâãà ᯨ᪠¨ ®á®¢®© ¨ä®à¬ 樨 (ª®áâàãªâ®à) |
align 4 |
align 16 |
proc tl_data_init uses eax ecx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
|
xor ecx,ecx |
mov cx,tl_info_size |
31,7 → 27,7 |
mov tl_data_img,0 ;®¡ã«ï¥¬ 㪠§ ⥫ì 'data_img' |
mov tl_data_img_sys,0 ;®¡ã«ï¥¬ 㪠§ ⥫ì 'data_img_sys' |
|
mov ecx,sizeof.TreeList |
mov ecx,sizeof.TreeNode |
imul ecx,tl_info_max_count |
invoke mem.alloc,ecx |
mov tl_data_nodes,eax ;ª®¯¨à㥬 㪠§ â¥«ì ¯®«ãç¥ãî ¯ ¬ïâì ¢ áâàãªâãàã |
64,7 → 60,7 |
;®ç¨á⪠¯ ¬ïâ¨ í«¥¬¥â (¤¥áâàãªâ®à) |
align 4 |
proc tl_data_clear uses eax edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
cmp tl_data_img,0 |
je @f |
invoke mem.free,tl_data_img ;ç¨á⪠á¨á⥬ëå ¨ª®®ª |
81,11 → 77,11 |
;®ç¨á⪠ᯨ᪠(¨ä®à¬ 樨) |
align 4 |
proc tl_info_clear uses eax ecx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov tl_ch_tim,0 |
mov tl_tim_undo,0 |
mov tl_cur_pos,0 |
mov ecx,sizeof.TreeList |
mov ecx,sizeof.TreeNode |
imul ecx,tl_info_max_count |
mov eax,tl_data_nodes |
@@: |
93,7 → 89,7 |
inc eax |
loop @b |
mov eax,tl_data_nodes ;㪠§ ⥫ì 0-© 㧥« |
mov dword[eax+8],1 ;㪠§ ⥫ì next ¢ 0-¬ 㧫¥ ¯à¨à ¢¨¢ ¥¬ ª 1 |
mov dword[eax+TreeNode.next],1 ;㪠§ ⥫ì next ¢ 0-¬ 㧫¥ ¯à¨à ¢¨¢ ¥¬ ª 1 |
|
cmp tl_p_scroll,0 ;®¡à ¡®âª áªà®««¨£ |
je @f |
107,14 → 103,14 |
;ॠªæ¨ï ª« ¢¨ âãàã |
align 4 |
proc tl_key uses ebx ecx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
|
mov ebx,tl_el_focus |
cmp dword[ebx],edi |
cmp [ebx],edi |
jne .no_focus ;í«¥¬¥â ¥ ¢ 䮪ãᥠ|
|
push eax |
mcall 66,2 ;¯®«ãç¨âì ०¨¬ ¢¢®¤ á ª« ¢¨ âãàë |
mcall SF_KEYBOARD,SSF_GET_INPUT_MODE ;¯®«ãç¨âì ०¨¬ ¢¢®¤ á ª« ¢¨ âãàë |
|
lea ecx,[tl_key_scan] |
cmp eax,1 ;1 = ᪠ª®¤ë |
181,9 → 177,9 |
align 4 |
proc tl_mouse, tlist:dword |
pushad |
mov edi,dword[tlist] |
mov edi,[tlist] |
|
mcall 37,1 ;ª®®à¤¨ âë ¬ëè¨ ®â®á¨â¥«ì® ®ª |
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;ª®®à¤¨ âë ¬ëè¨ ®â®á¨â¥«ì® ®ª |
|
mov ebx,tl_box_left |
shl ebx,16 |
206,7 → 202,7 |
jl .test_scroll |
|
push eax ebx |
mcall 37,7 ;®¡à ¡®âª ª®«¥á ¬ëè¨ |
mcall SF_MOUSE_GET,SSF_SCROLL_DATA |
mov edx,eax |
xor ecx,ecx |
test eax,eax |
226,8 → 222,7 |
jz .mouse_next |
@@: |
stdcall tl_cur_next, edi |
dec ecx |
jnz @r |
loop @r |
jmp .mouse_next |
;------------------------------------------------ |
.decr: ;¢¥à⨪ «ì ï ¯à®ªàã⪠®âà¨æ ⥫ì ï |
241,21 → 236,17 |
inc ecx |
@@: |
stdcall tl_cur_perv, edi |
dec ecx |
jnz @r |
loop @r |
;------------------------------------------------ |
.mouse_next: |
pop ebx eax |
|
push eax ebx |
mcall 37,2 |
|
mcall SF_MOUSE_GET,SSF_BUTTON |
bt eax,0 ;left mouse button press |
pop ebx eax |
jae .no_draw |
|
mov esi,tl_el_focus |
mov dword[esi],edi ;set focus |
mov [esi],edi ;set focus |
|
; if '+' or '-' press |
mov esi,eax |
263,15 → 254,14 |
sub esi,tl_box_left ;esi = mouse x coord in element window |
|
and eax,0xffff |
sub ax,bx |
sub eax,ebx |
xor edx,edx |
xor ecx,ecx |
mov cx,tl_img_cy |
movzx ecx,tl_img_cy |
div ecx |
cmp tl_p_scroll,0 ;ãç¨âë¢ ¥¬ áªà®««¨£ |
je @f |
mov edx,tl_p_scroll |
add eax,dword[edx+sb_offs_position] ;¤®¡ ¢«ï¥¬ áªà®««¨£ ¢¥àåã |
add eax,[edx+sb_offs_position] ;¤®¡ ¢«ï¥¬ áªà®««¨£ ¢¥àåã |
@@: |
|
mov ecx,eax |
296,10 → 286,10 |
call tl_get_cur_node_index ;eax = node index |
cmp eax,2 |
jl .no_open_close ;ªãàá®à á⮨⠯ãá⮬ ¬¥áâ¥, ¡¥§ 㧫®¢ |
imul eax,sizeof.TreeList |
imul eax,sizeof.TreeNode |
add eax,tl_data_nodes |
xor bx,bx |
mov bl,byte[eax+2] ;+2 lev á®åà 塞 ã஢¥ì ⥪ã饣® 㧫 |
mov bl,byte[eax+TreeNode.level] ;á®åà 塞 ã஢¥ì ⥪ã饣® 㧫 |
inc bx ;+ ¯®«¥ ¤«ï ªãàá®à |
|
cmp si,tl_img_cx |
324,8 → 314,8 |
;--- mouse event for children scrollbar ---------------------------------------- |
.test_scroll: |
mov edx,tl_p_scroll |
cmp edx,0 |
je .no_in_wnd ;¯®«ì§®¢ â¥«ì ¥ ᮧ¤ « ¤®ç¥à¥£® áªà®««¨£ |
or edx,edx |
jz .no_in_wnd ;¯®«ì§®¢ â¥«ì ¥ ᮧ¤ « ¤®ç¥à¥£® áªà®««¨£ |
shr ebx,16 |
add bx,word[edx] ;+0 .size_x |
shl ebx,16 |
332,8 → 322,8 |
cmp eax,ebx ;¯à ¢ ï £à ¨æ ®ª |
jg .no_in_wnd |
|
mov eax,dword[edx+sb_offs_max_area] |
cmp eax,dword[edx+sb_offs_cur_area] |
mov eax,[edx+sb_offs_max_area] |
cmp eax,[edx+sb_offs_cur_area] |
jbe .no_in_wnd ;¢á¥ ã§«ë ¯®¯ ¤ îâ ¢ ®ª® áªà®««¨£ |
stdcall scroll_bar_vertical.mouse, edx ;scrollbar_ver_mouse |
|
346,11 → 336,11 |
jne .no_draw ;¯®¯ «¨ áªà®««¨£ - ¥ ᨬ ¥¬ 䮪ãá á TreeList |
;------------------------------------------------------------------------------- |
.no_in_wnd: ;¥ ¯®¯ «¨ ¢ ®ª® - ¯®â¥àï 䮪ãá (¯à¨ ãá«®¢¨¨ ç⮠䮪ãá ¡ë« ¤ ®¬ í¥«¥¬¥â¥) |
mcall 37,2 ;¯à®¢¥à塞 ¦ â®áâì «î¡ëå ª®¯®ª |
cmp eax,0 ;¨ç¥£® ¥ ¦ «¨ eax=0 |
je .no_draw |
mcall SF_MOUSE_GET,SSF_BUTTON |
or eax,eax ;¨ç¥£® ¥ ¦ «¨ eax=0 |
jz .no_draw |
mov ebx,tl_el_focus |
cmp dword[ebx],edi |
cmp [ebx],edi |
jne .no_draw ;í«¥¬¥â ¥ ¢ 䮪ãᥠ|
mov dword[ebx],0 ;reset focus |
mov esi,tl_box_top |
365,7 → 355,7 |
;®â¬¥ ¤¥©á⢨ï |
align 4 |
proc tl_info_undo uses eax edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov eax,tl_tim_undo |
cmp tl_ch_tim,eax |
jbe @f |
378,7 → 368,7 |
;¯®¢â®à ¤¥©á⢨ï |
align 4 |
proc tl_info_redo uses edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
cmp tl_tim_undo,1 |
jl @f |
dec tl_tim_undo |
397,36 → 387,38 |
push eax ebx ecx edx |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
call tl_move_next ;long i=node[0].next; |
|
mov eax,tl_tim_undo |
sub tl_ch_tim,eax ;ch_tim-=tim_undo; |
mov eax,tl_ch_tim |
|
cmp edx,ecx |
jle @f |
;if(node[i].tc>ch_tim){ // ¥á«¨ ᮧ¤ ¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
cmp dword[edx+12],eax |
mov eax,tl_ch_tim |
cmp [edx+TreeNode.t_create],eax |
jle .no_u1 |
mov dword[edx+12],0 |
mov dword[edx+16],0 |
mov dword[edx+TreeNode.t_create],0 |
mov dword[edx+TreeNode.t_delete],0 |
|
mov ebx, dword[edx+4] |
imul ebx,sizeof.TreeList |
mov ebx, [edx+TreeNode.perv] |
imul ebx,sizeof.TreeNode |
add ebx, tl_data_nodes ;.next |
push dword[edx+8] ;node[node[i].perv].next=node[i].next; |
pop dword[ebx+8] |
push dword[edx+TreeNode.next] ;node[node[i].perv].next=node[i].next; |
pop dword[ebx+TreeNode.next] |
|
mov ebx, dword[edx+8] |
imul ebx,sizeof.TreeList |
mov ebx, [edx+TreeNode.next] |
imul ebx,sizeof.TreeNode |
add ebx, tl_data_nodes ;.perv |
push dword[edx+4] ;node[node[i].next].perv=node[i].perv; |
pop dword[ebx+4] |
push dword[edx+TreeNode.perv] ;node[node[i].next].perv=node[i].perv; |
pop dword[ebx+TreeNode.perv] |
.no_u1: |
|
;else if(node[i].td>ch_tim) node[i].td=0; // ¥á«¨ 㤠«¥¨¥ ᨬ¢®« ¡ë«® ®â¬¥¥® |
cmp dword[edx+16],eax |
cmp [edx+TreeNode.t_delete],eax |
jle .no_u2 |
mov dword[edx+16],0 |
mov dword[edx+TreeNode.t_delete],0 |
.no_u2: |
call tl_move_next |
jmp @b |
441,7 → 433,7 |
proc tl_draw, tlist:dword |
pushad |
;draw dir_list main rect |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov ebx,tl_box_left |
shl ebx,16 |
add ebx,tl_box_width |
449,14 → 441,13 |
shl ecx,16 |
mov cx,tl_capt_cy |
mov edx,tl_col_zag |
mcall 13 ;draw window caption |
mcall SF_DRAW_RECT ;draw window caption |
|
add ecx,tl_box_top |
shl ecx,16 |
add ecx,tl_box_height |
sub cx,tl_capt_cy |
mov edx,tl_col_bkg |
int 0x40 ;draw window client rect |
mcall ,,,tl_col_bkg ;draw window client rect |
|
cmp tl_capt_cy,9 ;9 - minimum caption height |
jl @f |
463,18 → 454,16 |
mov ebx,edi ;calculate cursor position |
mov eax,tl_cur_pos |
inc eax |
lea edi,[txt_capt_cur] |
add edi,7 |
call tl_convert_to_str |
lea edi,[txt_capt_cur.v] |
stdcall tl_convert_to_str, 5 |
|
mov edi,ebx |
mov eax,tl_tim_undo |
lea edi,[txt_capt_otm] |
add edi,7 |
call tl_convert_to_str |
lea edi,[txt_capt_otm.v] |
stdcall tl_convert_to_str, 5 |
mov edi,ebx ;restore edi |
|
mov eax,4 ;draw text captions |
mov eax,SF_DRAW_TEXT ;captions |
mov ebx,tl_box_left |
shl ebx,16 |
add ebx,5*65536+3 |
496,7 → 485,7 |
xor eax,eax |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
|
;*** ¯à®¯ã᪠㧫®¢, ª®â®àë¥ ¯à®¬®â ë áªà®««¨£®¬ *** |
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ ⥫ì áªà®««¨£ |
539,7 → 528,7 |
;¯¥à¥å®¤ á«¥¤ã騩 ¢¨¤¨¬ë© 㧥« (¯à®¯ãáª ï § ªàëâë¥) |
;input: |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer to next node struct |
547,9 → 536,9 |
tl_iterat_next: |
push bx |
mov bl,0x7f |
cmp byte[edx+3],1 |
cmp byte[edx+TreeNode.close],1 |
jne @f |
mov bl,byte[edx+2] |
mov bl,byte[edx+TreeNode.level] |
@@: |
|
cmp tl_tim_undo,0 |
563,7 → 552,7 |
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥ëå ¨ ®â¬¥¥ëå |
cmp al,1 |
je .beg0 |
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå |
cmp bl,byte[edx+TreeNode.level] ;¯à®¯ã᪠§ ªàëâëå |
jl .beg0 |
@@: |
pop eax |
574,9 → 563,9 |
call tl_move_next |
cmp edx,ecx |
jle .endif |
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥ëå |
cmp dword[edx+TreeNode.t_delete],0 ;¯à®¯ã᪠㤠«¥ëå |
jne .else |
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå |
cmp bl,byte[edx+TreeNode.level] ;¯à®¯ã᪠§ ªàëâëå |
jl .else |
.endif: |
pop bx |
585,7 → 574,7 |
;¯¥à¥å®¤ á«¥¤ã騩 ¢¨¤¨¬ë© 㧥« (¨ § ªàëâë¥ â®¦¥) |
;input: |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer to next visible node struct |
609,7 → 598,7 |
call tl_move_next |
cmp edx,ecx |
jle .endif |
cmp dword[edx+16],0 ;td -> time delete |
cmp dword[edx+TreeNode.t_delete],0 ;td -> time delete |
jne .else |
.endif: |
ret |
617,11 → 606,10 |
;¯¥à¥å®¤ ¯à¥¤ë¤ã騩 ¢¨¤¨¬ë© 㧥« (¯à®¯ãáª ï § ªàëâë¥) |
;input: |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
align 4 |
tl_iterat_perv: |
push eax |
proc tl_iterat_perv uses eax |
cmp tl_tim_undo,0 |
je .beg1 |
|
637,17 → 625,17 |
call tl_move_perv |
cmp edx,ecx |
jle @f |
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥ëå |
cmp dword[edx+TreeNode.t_delete],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥ëå |
jne .beg1 |
|
@@: |
call tl_move_max_clo_par |
pop eax |
ret |
endp |
|
; 室¨â த¨â¥«ì᪨© § ªàëâë© ã§¥« ¬ ªá¨¬ «ì®£® ã஢ï |
;input: |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer closed parent node with maximum level |
657,7 → 645,7 |
xor ebx,ebx |
.beg: |
call tl_move_par |
cmp byte[edx+3],1 ;த¨â¥«ì᪨© 㧥« § ªàëâ ? |
cmp byte[edx+TreeNode.close],1 ;த¨â¥«ì᪨© 㧥« § ªàëâ ? |
jne @f |
mov eax,edx |
@@: |
671,43 → 659,43 |
endp |
|
;input: |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer to next node struct |
align 4 |
tl_move_next: |
mov edx,dword[edx+8] |
imul edx,sizeof.TreeList |
mov edx,[edx+TreeNode.next] |
imul edx,sizeof.TreeNode |
add edx,tl_data_nodes |
ret |
|
;input: |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer to perv node struct |
align 4 |
tl_move_perv: |
mov edx,dword[edx+4] |
imul edx,sizeof.TreeList |
mov edx,[edx+TreeNode.perv] |
imul edx,sizeof.TreeNode |
add edx,tl_data_nodes |
ret |
|
;¯¥à¥¤¢¨£ ¥¬áï த¨â¥«ì᪨© 㧥«, ¥á«¨ â ª®£® ¥â, â® ®áâ ¢«ï¥¬ áâ ஥ § 票¥ 㪠§ ⥫ï |
;input: |
; ecx = |
; edx = pointer to some node struct |
; ecx = pointer to 1 node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; edx = pointer to parent node struct |
align 4 |
tl_move_par: |
cmp byte[edx+2],0 |
cmp byte[edx+TreeNode.level],0 |
je .end_f ;㧥« 0-£® ãà®¢ï ¥ ¬®¦¥â ¡ëâì ¤®ç¥à¨¬ |
push eax ebx esi |
mov esi,edx ;copy node pointer (edx) |
mov bl,byte[edx+2] |
mov bl,byte[edx+TreeNode.level] |
@@: |
call tl_move_perv |
cmp edx,ecx |
715,7 → 703,7 |
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥ëå ¨ ®â¬¥¥ëå |
cmp al,1 |
je @b |
cmp byte[edx+2],bl |
cmp byte[edx+TreeNode.level],bl |
jl .end_0 ;ã¤ ç® è«¨ த¨â¥«ì᪨© 㧥« |
jmp @b |
@@: |
727,7 → 715,7 |
|
;¯à®¢¥àï¥â ¢¨¤¨¬ë© «¨ 㪠§ ë© ã§¥« á ãç¥â®¬: ¤®¡ ¢«¥¨©, 㤠«¥¨©, ®â¬¥ ¤¥©á⢨© |
;input: |
; edx = pointer to symbol struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
;output: |
; al = 1 if sumbol not visible |
734,9 → 722,9 |
; (node[i].td+tim_Undo<=ch_tim && node[i].td) || (node[i].tc>ch_tim-tim_Undo) |
align 4 |
tl_node_not_vis: |
cmp dword[edx+16],0 |
cmp dword[edx+TreeNode.t_delete],0 |
je @f |
mov eax,dword[edx+16] ;eax=node[i].td |
mov eax,[edx+TreeNode.t_delete] ;eax=node[i].td |
add eax,tl_tim_undo |
cmp eax,tl_ch_tim |
jg @f |
746,7 → 734,7 |
|
mov eax,tl_ch_tim |
sub eax,tl_tim_undo |
cmp dword[edx+12],eax ;tc -> time create |
cmp [edx+TreeNode.t_create],eax ;time create |
jle @f |
mov al,1 |
ret |
769,8 → 757,7 |
mov ebx,tl_box_left |
shl ebx,16 |
mov bx,tl_img_cx |
xor ecx,ecx |
mov cx,tl_img_cy |
movzx ecx,tl_img_cy |
imul ecx,eax |
add ecx,tl_box_top |
add cx,tl_capt_cy |
788,7 → 775,7 |
.crop0: |
|
mov edx,tl_col_txt |
mcall 13 ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì¨ª, â.ª. ¥â á¨á⥬ëå ¨ª®®ª |
mcall SF_DRAW_RECT ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì¨ª, â.ª. ¥â á¨á⥬ëå ¨ª®®ª |
jmp .end_f |
@@: |
mov ebx,tl_data_img_sys |
803,10 → 790,8 |
cmp dword[ecx],edi |
je .focus |
;¥á«¨ ¥ ¢ 䮪ãᥠᤢ¨£ ¥¬ ª®®à¤¨ âë ¨ª®ªã ¥ ªâ¨¢®£® ªãàá®à |
xor eax,eax |
xor ecx,ecx |
mov cx,tl_img_cx |
mov ax,tl_img_cy |
movzx ecx,tl_img_cx |
movzx eax,tl_img_cy |
imul eax,ecx |
imul eax,4*3 ;4=icon index 3=rgb |
add ebx,eax |
826,7 → 811,7 |
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥ ç áâ¨ç® (¯®¯ « ¨¦îî £à ¨æã) |
.crop1: |
|
mcall 7 ;à¨á㥬 ¨ª®ªã ªãàá®à |
mcall SF_PUT_IMAGE ;à¨á㥬 ¨ª®ªã ªãàá®à |
.end_f: |
ret |
endp |
843,8 → 828,7 |
mov ebx,tl_box_left |
shl ebx,16 |
mov bx,tl_img_cx |
xor ecx,ecx |
mov cx,tl_img_cy |
movzx ecx,tl_img_cy |
imul ecx,eax |
add ecx,tl_box_top |
add cx,tl_capt_cy |
860,7 → 844,7 |
jge @f |
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥ ç áâ¨ç® (¯®¯ « ¨¦îî £à ¨æã) |
@@: |
mcall 13,,,tl_col_bkg ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì¨ª á ä®®¢ë¬ 梥⮬ |
mcall SF_DRAW_RECT,,,tl_col_bkg ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì¨ª á ä®®¢ë¬ 梥⮬ |
.end_f: |
ret |
endp |
886,7 → 870,7 |
;à¨áã¥â 㧥« á: ª à⨪®©, ¯®¤¯¨áìî, ¨ª®ª®© ®âªàëâ¨ï/§ ªàëâ¨ï ¨ «¨¨ï¬¨ ª த¨â. 㧫ã |
;input: |
; eax = node position (0, ..., max_nodes-scroll_pos) ¥ ¤® tl_box_height/tl_img_cy |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
; esi = coord of bottom border |
align 4 |
895,7 → 879,7 |
bt tl_style,2 ;tl_list_box_mode |
jc @f |
inc ebx ;+1 - ¬¥áâ® ¯®¤ § ª +,- |
add bl,byte[edx+2] ;¤®¡ ¢«ï¥¬ ã஢¥ì í«¥¬¥â ¤«ï ¥£® ãç¥â ¢ «¥¢®¬ ®âáâ㯥 ¨ª®ª¨ |
add bl,byte[edx+TreeNode.level] ;¤®¡ ¢«ï¥¬ ã஢¥ì í«¥¬¥â ¤«ï ¥£® ãç¥â ¢ «¥¢®¬ ®âáâ㯥 ¨ª®ª¨ |
@@: |
imul bx,tl_img_cx |
add ebx,tl_box_left |
902,8 → 886,7 |
|
shl ebx,16 |
mov bx,tl_img_cx |
xor ecx,ecx |
mov cx,tl_img_cy |
movzx ecx,tl_img_cy |
imul ecx,eax |
add cx,tl_capt_cy |
jc .end_draw ;ª®£¤ ¬®£® 㧫®¢, â® ¬®¦¥â ¡ëâì ¯¥à¥¯®«¥¨¥ ª®®à¤¨ âë cx |
925,17 → 908,14 |
.crop: |
mov esi,ecx ;save ecx |
|
push edx |
cmp tl_data_img,0 |
jne .draw_img_n |
push edx |
mov edx,tl_col_txt |
mcall 13 ;draw node rect |
pop edx |
mcall SF_DRAW_RECT,,,tl_col_txt ;draw node rect |
jmp @f |
.draw_img_n: |
push ebx edx esi |
xor esi,esi |
mov si,word[edx] ;get icon type |
push ebx esi |
movzx esi,word[edx+TreeNode.type] ;get icon type |
mov edx,ebx |
ror ecx,16 |
mov dx,cx |
947,16 → 927,17 |
imul ebx,esi ;esi = icon index |
add ebx,tl_data_img |
|
mcall 7 ;draw node icon '-' |
pop esi edx ebx |
mcall SF_PUT_IMAGE ;draw node icon '-' |
pop esi ebx |
@@: |
pop edx |
|
mov al,byte[edx+2] ;draw minus '-' |
mov al,byte[edx+TreeNode.level] ;draw minus '-' |
mov ecx,tl_data_nodes |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
|
mov ah,10 ;get icon index '+' or '-' ? |
cmp byte[edx+3],1 |
cmp byte[edx+TreeNode.close],1 |
jne .close |
dec ah |
.close: |
974,7 → 955,7 |
;input: |
; al = ã஢¥ì í«¥¬¥â |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
;... |
align 4 |
proc tl_draw_node_icon_opn_clo uses eax ebx ecx edx esi |
983,7 → 964,7 |
cmp edx,ecx |
jle @f |
mov ecx,esi ;load ecx |
cmp al,byte[edx+2] |
cmp al,byte[edx+TreeNode.level] |
jne @f |
ror ebx,16 |
sub bx,tl_img_cx |
990,7 → 971,7 |
ror ebx,16 |
cmp tl_data_img_sys,0 |
jne .draw_img_s |
mcall 13,,,tl_col_txt ;draw minus rect, if not system icons |
mcall SF_DRAW_RECT,,,tl_col_txt ;draw minus rect, if not system icons |
jmp @f |
.draw_img_s: |
mov ecx,esi ;load ecx |
1006,7 → 987,7 |
and eax,0xff |
imul ebx,eax ;eax = icon index |
add ebx,tl_data_img_sys |
mcall 7 ;draw minus icon '-' |
mcall SF_PUT_IMAGE ;draw minus icon '-' |
@@: |
ret |
endp |
1015,19 → 996,19 |
;input: |
; al = ã஢¥ì í«¥¬¥â |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
;... |
align 4 |
tl_draw_node_icon_par_lin: |
cmp byte[edx+3],1 |
cmp byte[edx+TreeNode.close],1 |
je .close |
or al,al |
jz .close |
push eax ebx ecx edx esi |
cmp al,0 |
je @f |
call tl_iterat_next_all ;get next visible item |
cmp edx,ecx |
jle .line3 ;if end of list |
cmp al,byte[edx+2] |
cmp al,byte[edx+TreeNode.level] |
jne .line3 ;jg ??? |
mov eax,3 ;line in middle element |
jmp .line2 |
1041,7 → 1022,7 |
ror ebx,16 |
cmp tl_data_img_sys,0 |
jne .draw_img_s |
mcall 13,,,tl_col_txt ;draw minus rect, if not system icons |
mcall SF_DRAW_RECT,,,tl_col_txt ;draw minus rect, if not system icons |
jmp @f |
.draw_img_s: |
mov edx,ebx |
1055,7 → 1036,7 |
|
imul ebx,eax ;eax = icon index |
add ebx,tl_data_img_sys |
mcall 7 ;draw line icon |
mcall SF_PUT_IMAGE ;draw line icon |
@@: |
pop esi edx ecx ebx eax |
.close: |
1066,14 → 1047,14 |
; al = ã஢¥ì í«¥¬¥â |
; ebx = (node.left shl 16) + tl_img_cx |
; ecx = pointer to 1 node struct |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to 'TreeList' struct |
align 4 |
proc tl_draw_node_icon_par_lin_up uses eax ebx ecx edx esi |
cmp tl_data_img_sys,0 ;if not image |
je @f |
cmp al,0 |
je @f |
or al,al |
jz @f |
xor esi,esi ;¢ si ¡ã¤¥¬ áç¨âë¢ âì ª®«-¢® ¨ª®®ª, ã¦ëå ¤«ï ¯à®à¨á®¢ª¨ «¨¨¨ |
;--- 横« ¤«ï ¢ëç¨á«¥¨ï ª®««¨ç¥á⢠¢¥à⨪ «ìëå «¨¨© --- |
.cycle0: |
1081,13 → 1062,13 |
cmp edx,ecx |
jle .cycle1 ;if begin of list |
|
cmp byte[edx+2],al |
cmp byte[edx+TreeNode.level],al |
jle .cycle0end ;ã஢¥ì ¢¥à奣® í«¥¬¥â ¥ âॡã¥â ¯à®à¨á®¢ª¨ |
inc si |
jmp .cycle0 |
.cycle0end: |
cmp si,0 ;si = ª®«-¢® ¨ª®®ª «¨¨¨ ª®â®àë¥ ã¦® à¨á®¢ âì ᢥàåã |
je @f |
or si,si ;si = ª®«-¢® ¨ª®®ª «¨¨¨ ª®â®àë¥ ã¦® à¨á®¢ âì ᢥàåã |
jz @f |
shl esi,16 |
|
pop ecx ;esi->ecx |
1110,7 → 1091,7 |
|
add esi,tl_box_top |
add si,tl_capt_cy ;si = ¢¥àåïï £à ¨æ ®ª |
mov eax,7 |
mov eax,SF_PUT_IMAGE |
;--- 横« ¤«ï à¨á®¢ ¨ï ¢¥à⨪ «ì®© «¨¨¨ --- |
.cycle1: |
sub dx,tl_img_cy ;¯®¤¨¬ ¥¬ ª®®à¤¨ âã y ¢¢¥àå |
1134,8 → 1115,7 |
push ecx edx |
mov eax,tl_box_height |
sub ax,tl_capt_cy |
xor ecx,ecx |
mov cx,tl_img_cy |
movzx ecx,tl_img_cy |
xor edx,edx |
div ecx |
pop edx ecx |
1145,7 → 1125,7 |
; eax = node position |
; ebx = [ª®®à¤¨ â ¯® ®á¨ x]*65536 + [img_cx] |
; ecx = [ª®®à¤¨ â ¯® ®á¨ y]*65536 + [img_cy] |
; edx = pointer to some node struct |
; edx = pointer to node struct |
; edi = pointer to TreeInfo struct |
align 4 |
proc tl_draw_node_caption uses ebx ecx edx esi |
1174,7 → 1154,7 |
sub bx,9 ;®â¨¬ ¥¬ ¢ëá®âã ⥪áâ |
mov ecx,tl_col_txt |
and ecx,0xffffff |
mcall 4 |
mcall SF_DRAW_TEXT |
@@: |
ret |
endp |
1228,45 → 1208,45 |
; n_info - 㪠§ â¥«ì ¤®¡ ¢«ï¥¬ë¥ ¤ ë¥ |
align 4 |
proc tl_node_add uses eax ebx ecx edx edi, tlist:dword, n_opt:dword, n_info:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
|
call tl_info_set_undo |
|
mov ebx,sizeof.TreeList |
mov ebx,sizeof.TreeNode |
imul ebx,tl_info_max_count |
add ebx,tl_data_nodes |
;-- |
call tl_get_cur_node_index ;eax=po_t |
imul eax,sizeof.TreeList |
imul eax,sizeof.TreeNode |
add eax,tl_data_nodes |
mov edx,eax |
call tl_move_perv |
call tl_get_node_index ;eax = index of pointer [edx] |
;-- |
mov edx,sizeof.TreeList |
mov edx,sizeof.TreeNode |
shl edx,1 |
add edx,tl_data_nodes |
@@: ;for(i=2;i<nodeMax;i++) |
cmp dword [edx+12],0 |
cmp dword[edx+TreeNode.t_create],0 |
jne .u0 |
cmp dword [edx+16],0 |
cmp dword[edx+TreeNode.t_delete],0 |
jne .u0 |
|
inc tl_ch_tim |
mov ecx,dword[n_opt] |
ror ecx,16 ;cx = type |
mov word[edx],cx |
mov word[edx+TreeNode.type],cx |
rol ecx,8 ;cl = close|open |
mov byte[edx+3],cl ;node[i].clo |
mov byte[edx+2],0 ;node[i].lev=0 |
mov byte[edx+TreeNode.close],cl ;node[i].clo |
mov byte[edx+TreeNode.level],0 ;node[i].lev=0 |
bt tl_style,2 ;tl_list_box_mode |
jc .l_box_m |
mov cl,byte[n_opt] |
mov byte[edx+2],cl ;node[i].lev |
mov byte[edx+TreeNode.level],cl ;node[i].lev |
.l_box_m: |
push tl_ch_tim ;node[i].tc=ch_tim; |
pop dword[edx+12] |
mov [edx+4],eax ;node[i].perv=po_t; |
pop dword[edx+TreeNode.t_create] |
mov [edx+TreeNode.perv],eax ;node[i].perv=po_t; |
;*** copy node data *** |
push esi |
xor ecx,ecx |
1283,7 → 1263,7 |
rep movsb |
|
mov esi,edi |
mov edi,dword[tlist] ;restore edi |
mov edi,[tlist] ;restore edi |
mov cx,tl_info_capt_offs |
cmp cx,tl_info_size |
jge .no_text_data |
1301,25 → 1281,25 |
pop esi ;restore esi |
|
mov ecx,eax |
imul ecx,sizeof.TreeList |
imul ecx,sizeof.TreeNode |
add ecx,tl_data_nodes ; *** ecx = node[po_t] *** |
add ecx,8 ; *** ecx = node[po_t].next *** |
add ecx,TreeNode.next ; *** ecx = node[po_t].next *** |
push dword[ecx] ;node[i].next=node[po_t].next; |
pop dword[edx+8] |
pop dword[edx+TreeNode.next] |
|
call tl_get_node_index ;*** eax = i *** |
cmp eax,tl_info_max_count |
jge .u0 |
mov [ecx],eax ;node[po_t].next=i; // áá뫪¨ ¯¥à¥ ¯à ¢«ï¥¬ |
mov ecx,[edx+8] ; *** ecx = node[i].next *** |
imul ecx,sizeof.TreeList |
mov ecx,[edx+TreeNode.next] ; *** ecx = node[i].next *** |
imul ecx,sizeof.TreeNode |
add ecx,tl_data_nodes ; *** ecx = node[node[i].next] *** |
mov [ecx+4],eax ;node[node[i].next].perv=i; |
mov [ecx+TreeNode.perv],eax ;node[node[i].next].perv=i; |
|
call tb_scrol_resize ;®¡à ¡®âª áªà®««¨£ |
jmp @f |
.u0: |
add edx,sizeof.TreeList |
add edx,sizeof.TreeNode |
cmp edx,ebx ;enf of node memory ? |
jle @b |
@@: |
1351,7 → 1331,7 |
;n_info - pointer to node info |
align 4 |
proc tl_node_set_data uses eax ecx edx edi esi, tlist:dword, n_info:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
1364,13 → 1344,13 |
rep movsb |
|
mov esi,edi |
mov edi,dword[tlist] ;restore edi |
mov edi,[tlist] ;restore edi |
mov cx,tl_info_capt_offs |
cmp cx,tl_info_size |
jge .no_text_data |
mov ax,tl_info_capt_len ;¯à®¢¥à塞 ¥áâì «¨ ®£à ¨ç¥¨¥ ¤«¨ã ⥪áâ |
cmp ax,0 |
je .no_limit |
or ax,ax |
jz .no_limit |
add cx,ax ;cx = tl_info_capt_offs + tl_info_capt_len |
and ecx,0xffff |
xor eax,eax |
1394,7 → 1374,7 |
; eax - pointer to node data |
align 4 |
proc tl_node_get_data uses ecx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
1416,13 → 1396,13 |
; eax - pointer to node info |
align 4 |
proc tl_node_poi_get_info uses ebx ecx edx edi, tlist:dword, node_ind:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov ebx,dword[node_ind] |
|
;cycle to nodes |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
@@: |
call tl_iterat_next_all |
cmp edx,ecx |
1446,11 → 1426,11 |
; eax - pointer to next node struct |
align 4 |
proc tl_node_poi_get_next_info uses ecx edx edi, tlist:dword, node_p:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov edx,dword[node_p] |
|
mov ecx,tl_data_nodes |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
|
call tl_iterat_next_all |
cmp edx,ecx |
1469,7 → 1449,7 |
; eax - pointer |
align 4 |
proc tl_node_poi_get_data uses ecx edx edi, tlist:dword, node_p:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov edx,dword[node_p] |
|
call tl_get_node_index ;eax = node index |
1497,7 → 1477,7 |
xor eax,eax |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
@@: |
call tl_iterat_next |
cmp edx,ecx |
1510,7 → 1490,7 |
mov eax,edx |
sub eax,tl_data_nodes |
xor edx,edx |
mov ecx,sizeof.TreeList |
mov ecx,sizeof.TreeNode |
div ecx |
ret |
endp |
1527,7 → 1507,7 |
mov eax,edx |
sub eax,tl_data_nodes |
xor edx,edx |
mov ecx,sizeof.TreeList |
mov ecx,sizeof.TreeNode |
div ecx |
pop edx ecx |
ret |
1535,16 → 1515,16 |
;㤠«¨âì 㧥« |
align 4 |
proc tl_node_delete uses eax edx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
imul eax,sizeof.TreeList |
imul eax,sizeof.TreeNode |
add eax,tl_data_nodes |
mov edx,eax |
inc tl_ch_tim |
mov eax,tl_ch_tim |
mov dword[edx+16],eax |
mov dword[edx+TreeNode.t_delete],eax |
call tb_scrol_resize ;®¡à ¡®âª áªà®««¨£ |
@@: |
ret |
1553,7 → 1533,7 |
;¯®áâ ¢¨âì ªãàá®à ¯¥à¢ë© 㧥« |
align 4 |
proc tl_cur_beg uses edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
mov tl_cur_pos,0 |
cmp tl_p_scroll,0 |
je @f |
1567,7 → 1547,7 |
;¯¥à¥¥á⨠ªãàá®à 1 ¯®§¨æ¨î ¨¦¥ |
align 4 |
proc tl_cur_next uses eax ebx edi esi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_node_count ;eax = node count |
cmp tl_cur_pos,eax |
jge .no_redraw |
1588,7 → 1568,7 |
stdcall tl_draw,dword[tlist] ;¯®« ï ¯¥à¥à¨á®¢ª ®ª |
jmp .no_redraw |
@@: |
mov edi,dword[tlist] ;restore edi |
mov edi,[tlist] ;restore edi |
call tl_draw_cursor ;¯¥à¥à¨á®¢ª ªãàá®à |
call tl_draw_caption_cur_pos |
.no_redraw: |
1607,7 → 1587,7 |
xor eax,eax |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
@@: |
call tl_iterat_next |
cmp edx,ecx |
1630,7 → 1610,7 |
xor eax,eax |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
@@: |
call tl_iterat_next_all |
cmp edx,ecx |
1644,7 → 1624,7 |
;¯¥à¥¥á⨠ªãàá®à 1 ¯®§¨æ¨î ¢ëè¥ |
align 4 |
proc tl_cur_perv uses eax edi esi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
cmp tl_cur_pos,0 |
je .no_redraw |
mov esi,tl_box_top |
1665,7 → 1645,7 |
stdcall tl_draw, dword[tlist] ;¯®« ï ¯¥à¥à¨á®¢ª ®ª |
jmp .no_redraw |
@@: |
mov edi,dword[tlist] ;restore edi |
mov edi,[tlist] ;restore edi |
call tl_draw_cursor ;¯¥à¥à¨á®¢ª ªãàá®à |
call tl_draw_caption_cur_pos |
.no_redraw: |
1675,7 → 1655,7 |
;¯¥à¥¥á⨠ªãàá®à 1 áâà ¨æã ¢ëè¥ |
align 4 |
proc tl_cur_page_up uses eax edi esi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
|
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ ⥫ì áªà®««¨£ |
je .no_redraw |
1715,7 → 1695,7 |
;eax - ª®«-¢® áâப áâà ¨æ¥ |
;ebx - ¬ ªá. ¯®§¨æ¨ï ªãàá®à |
;ecx - ¬ ªá. ¯®§¨æ¨ï áªà®««¨£ |
mov edi,dword[tlist] |
mov edi,[tlist] |
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ ⥫ì áªà®««¨£ |
je .no_redraw |
mov esi,tl_p_scroll |
1760,11 → 1740,11 |
;®âªàëâì/§ ªàëâì 㧥« (à ¡®â ¥â á 㧫 ¬¨ ª®â®àë¥ ¨¬¥îâ ¤®ç¥à¨¥ 㧫ë) |
align 4 |
proc tl_node_close_open uses eax edx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax = ¯®§¨æ¨ï 㧫 ª®â®à®¬ á⮨⠪ãàá®à |
cmp eax,2 ;ªãàá®à á⮨â 㧫¥ ? |
jl @f |
imul eax,sizeof.TreeList |
imul eax,sizeof.TreeNode |
add eax,tl_data_nodes |
;eax = 㪠§ ⥫ì áâàãªâãàã 㧫 ¢ë¡à ®£® ªãàá®à®¬ |
push eax |
1771,12 → 1751,12 |
stdcall tl_node_poi_get_next_info, edi,eax |
mov edx,eax ;edx = 㪠§ ⥫ì áâàãªâãàã 㧫 ª®â®àë© ¨¤¥â ¯®á«¥ 㧫 eax |
pop eax |
cmp edx,0 ;¥áâì «¨ ã§«ë ¨¦¥ ¢ë¡à ®£® ¬¨ ? |
je @f |
mov dl,byte[edx+2] ;¡¥à¥¬ ã஢¥ì ¨¦¥£® 㧫 |
cmp byte[eax+2],dl ;+2 = .lev |
or edx,edx ;¥áâì «¨ ã§«ë ¨¦¥ ¢ë¡à ®£® ¬¨ ? |
jz @f |
mov dl,byte[edx+TreeNode.level] ;¡¥à¥¬ ã஢¥ì ¨¦¥£® 㧫 |
cmp byte[eax+TreeNode.level],dl |
jge @f ;¥á«¨ ¨¦¨¥ ã§«ë ¬¥ì襣® ã஢ï, § ç¨â ®¨ ¥ ¤®ç¥à¨¥, ª®¥æ äãªæ¨¨ |
xor byte[eax+3],1 ;+3 = .clo *** ®âªàë⨥/§ ªàë⨥ 㧫 *** |
xor byte[eax+TreeNode.close],1 ;*** ®âªàë⨥/§ ªàë⨥ 㧫 *** |
call tb_scrol_resize ;®¡à ¡®âª áªà®««¨£ |
|
stdcall tl_draw, edi ;®¡®¢«¥¨¥ ®ª |
1787,7 → 1767,7 |
;㢥«¨ç¨âì ã஢¥ì |
align 4 |
proc tl_node_lev_inc uses eax ecx edx edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
bt tl_style,2 ;tl_list_box_mode |
jc @f |
call tl_get_cur_node_index ;eax=po_t |
1794,19 → 1774,19 |
cmp eax,2 |
jl @f |
mov ecx,tl_data_nodes |
imul eax,sizeof.TreeList |
add eax,ecx ;eax = pointer to some node struct |
add ecx,sizeof.TreeList ;ecx = pointer to 1 node struct |
imul eax,sizeof.TreeNode |
add eax,ecx ;eax = pointer to node struct |
add ecx,sizeof.TreeNode ;ecx = pointer to 1 node struct |
|
mov edx,eax |
call tl_iterat_perv ;¯à®¢¥à塞 ¥áâì «¨ ¢¥à娩 㧥« |
cmp edx,ecx |
jle @f ;¥á«¨ ¢¥à奣® 㧫 ¥â ⮠⥪ã騩 㧥« ¥ ¤¢¨£ ¥¬ |
mov cl,byte[edx+2] ;¡¥à¥¬ ã஢¥ì த¨â¥«ì᪮£® 㧫 |
mov cl,byte[edx+TreeNode.level] ;¡¥à¥¬ ã஢¥ì த¨â¥«ì᪮£® 㧫 |
inc cl ;¤®¡ ¢«ï¥¬ 1 ¨ ¯®«ãç ¥¬ ¬ ªá¨¬ «ì®¥ § 票¥ |
cmp byte[eax+2],cl |
cmp byte[eax+TreeNode.level],cl |
jge @f |
inc byte[eax+2] ;㢥«¨ç¨¢ ¥¬ § 票¥ 㧫 |
inc byte[eax+TreeNode.level] ;㢥«¨ç¨¢ ¥¬ § 票¥ 㧫 |
@@: |
ret |
endp |
1814,11 → 1794,11 |
;㬥ìè¨âì ã஢¥ì |
align 4 |
proc tl_node_lev_dec uses eax edi, tlist:dword |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
imul eax,sizeof.TreeList |
imul eax,sizeof.TreeNode |
add eax,tl_data_nodes |
cmp byte[eax+2],0 |
je @f |
1831,7 → 1811,7 |
align 4 |
proc tl_node_move_up tlist:dword |
pushad |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
1838,8 → 1818,8 |
mov ebx,eax ;copy index of node struct |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
imul eax,sizeof.TreeList |
add ecx,sizeof.TreeNode |
imul eax,sizeof.TreeNode |
add eax,edx ;eax = pointer to 2 node struct |
mov edx,eax ;edx = pointer to 2 node struct |
mov esi,eax ;esi = pointer to 2 node struct |
1847,7 → 1827,7 |
call tl_get_node_index ;eax = index of 1 node struct |
cmp edx,ecx |
jle @f |
cmp dword[edx+8],ebx ;+8 next |
cmp dword[edx+TreeNode.next],ebx |
jne .po8 |
call tl_node_move_po6 ;ã§«ë ¨¤ãâ ¯®¤àï¤ ¬¥ï¥¬ 6 ááë«®ª |
jmp .cur_mov |
1867,7 → 1847,7 |
align 4 |
proc tl_node_move_down tlist:dword |
pushad |
mov edi,dword[tlist] |
mov edi,[tlist] |
call tl_get_cur_node_index ;eax=po_t |
cmp eax,2 |
jl @f |
1874,8 → 1854,8 |
mov ebx,eax ;copy index of node struct |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
imul eax,sizeof.TreeList |
add ecx,sizeof.TreeNode |
imul eax,sizeof.TreeNode |
add eax,edx ;eax = pointer to 1 node struct |
mov edx,eax ;edx = pointer to 1 node struct |
mov esi,eax ;esi = pointer to 1 node struct |
1883,7 → 1863,7 |
call tl_get_node_index ;eax = index of 2 node struct |
cmp edx,ecx |
jle @f |
cmp dword[esi+8],eax ;+8 next |
cmp dword[esi+TreeNode.next],eax |
jne .po8 |
xchg eax,ebx ;¬¥ï¥ ¯®à冷ª á«¥¤®¢ ¨ï § ¬¥ï¥¬ëå 㧫®¢ |
xchg edx,esi |
1903,22 → 1883,20 |
tl_node_move_po6: |
mov ecx,edx ;save node pointer |
call tl_move_perv |
mov dword[edx+8],ebx |
mov dword[edx+TreeNode.next],ebx |
|
mov edx,esi |
call tl_move_next |
mov dword[edx+4],eax |
mov dword[edx+TreeNode.perv],eax |
mov edx,ecx ;restore node pointer |
|
;+4 perv |
mov ecx,dword[edx+4] |
mov dword[esi+4],ecx |
;+8 next |
mov ecx,dword[esi+8] |
mov dword[edx+8],ecx |
mov ecx,dword[edx+TreeNode.perv] |
mov dword[esi+TreeNode.perv],ecx |
mov ecx,dword[esi+TreeNode.next] |
mov dword[edx+TreeNode.next],ecx |
|
mov dword[edx+4],ebx |
mov dword[esi+8],eax |
mov dword[edx+TreeNode.perv],ebx |
mov dword[esi+TreeNode.next],eax |
ret |
|
;input |
1935,30 → 1913,29 |
tl_node_move_po8: |
mov ecx,edx ;save node pointer |
call tl_move_perv |
mov dword[edx+8],ebx |
mov dword[edx+TreeNode.next],ebx |
mov edx,ecx |
call tl_move_next |
mov dword[edx+4],ebx |
mov dword[edx+TreeNode.perv],ebx |
mov edx,esi |
call tl_move_perv |
mov dword[edx+8],eax |
mov dword[edx+TreeNode.next],eax |
mov edx,esi |
call tl_move_next |
mov dword[edx+4],eax |
mov dword[edx+TreeNode.perv],eax |
mov edx,ecx ;restore node pointer |
|
;+4 perv |
mov eax,dword[edx+4] |
mov ebx,dword[esi+4] |
mov eax,dword[edx+TreeNode.perv] |
mov ebx,dword[esi+TreeNode.perv] |
xchg eax,ebx |
mov dword[edx+4],eax |
mov dword[esi+4],ebx |
;+8 next |
mov eax,dword[edx+8] |
mov ebx,dword[esi+8] |
mov dword[edx+TreeNode.perv],eax |
mov dword[esi+TreeNode.perv],ebx |
|
mov eax,dword[edx+TreeNode.next] |
mov ebx,dword[esi+TreeNode.next] |
xchg eax,ebx |
mov dword[edx+8],eax |
mov dword[esi+8],ebx |
mov dword[edx+TreeNode.next],eax |
mov dword[esi+TreeNode.next],ebx |
ret |
|
;input: |
1971,9 → 1948,8 |
mov ebx,edi ;calculate cursor position |
mov eax,tl_cur_pos |
inc eax |
lea edi,[txt_capt_cur] |
add edi,7 |
call tl_convert_to_str |
lea edi,[txt_capt_cur.v] |
stdcall tl_convert_to_str, 5 |
mov edi,ebx |
|
mov ebx,tl_box_left |
1984,8 → 1960,7 |
or ecx,0xc0000000 ;0x40000000 § ªà 訢 âì ä® æ¢¥â®¬ edi |
lea edx,[txt_capt_cur] |
mov edi,tl_col_zag |
mcall 4 ;draw text captions |
|
mcall SF_DRAW_TEXT ;captions |
popad |
@@: |
ret |
1999,8 → 1974,8 |
; eax - error code |
align 4 |
proc tl_save_mem uses ebx ecx edx edi esi, tlist:dword, opt:dword, h_mem:dword, mem_size:dword |
mov esi,dword[h_mem] |
mov edi,dword[tlist] |
mov esi,[h_mem] |
mov edi,[tlist] |
|
cmp dword[opt],0 ;add mode |
je @f |
2048,7 → 2023,7 |
;cycle to nodes |
mov edx,tl_data_nodes |
mov ecx,edx |
add ecx,sizeof.TreeList |
add ecx,sizeof.TreeNode |
@@: |
call tl_iterat_next_all |
cmp edx,ecx |
2058,7 → 2033,7 |
mov dword[esi],eax |
|
add esi,4 |
mov eax,dword[edx] ;eax = (type; lev; clo) |
mov eax,dword[edx+TreeNode.type] ;eax = (type; level; close) |
mov dword[esi],eax |
add esi,4 |
|
2109,14 → 2084,14 |
locals |
er_code dd ? |
endl |
mov esi,dword[h_mem] |
mov edi,dword[tlist] |
mov esi,[h_mem] |
mov edi,[tlist] |
|
mov dword[er_code],0 ;return error code |
|
mov ecx,dword[opt] |
cmp cx,0 ;load in array mode |
je @f |
mov ecx,[opt] |
or cx,cx ;load in array mode |
jz @f |
;stdcall tl_get_mem_size, esi,edi ;¡¥à¥¬ à §¬¥à à ¥¥ á®åà ñëå ¤ ëå |
;add esi,eax |
and ecx,0xffff |
2124,8 → 2099,7 |
.beg_cycle: |
cmp dword[esi],'tree' |
jne .no_tree |
xor ebx,ebx |
mov bx,word[esi+4] |
movzx ebx,word[esi+4] |
add bx,8 |
imul ebx,dword[esi+6] |
add ebx,tl_save_load_heder_size |
2137,7 → 2111,7 |
jne .no_tree |
bt dword[opt],17 ;load in add mode |
jc @f |
stdcall tl_info_clear, dword edi |
stdcall tl_info_clear, edi |
@@: |
|
xor ebx,ebx |
2146,7 → 2120,7 |
je @f |
or dword[er_code],tl_err_load_info_size |
@@: |
mov ecx,dword[esi+6] ;count nodes |
mov ecx,[esi+6] ;count nodes |
cmp ecx,1 |
jl .end_f |
mov edx,esi ;save header pointer |
2155,7 → 2129,7 |
cld |
@@: ;load node params |
mov eax,dword[esi+4] |
ror eax,16 ;eax - options (type; lev; clo) |
ror eax,16 ;eax - options (type; level; close) |
add esi,8 |
stdcall tl_node_add, edi,eax,esi |
stdcall tl_cur_next, edi |
2168,8 → 2142,8 |
mov eax,dword[edx+14] ;set cursor pos |
mov tl_cur_pos,eax |
mov ebx,tl_p_scroll |
cmp ebx,0 |
je .end_f |
or ebx,ebx |
jz .end_f |
mov eax,dword[edx+22] ;set scroll pos |
mov dword[ebx+sb_offs_position],eax |
stdcall scroll_bar_vertical.draw, ebx |
2186,8 → 2160,8 |
; eax - error code |
align 4 |
proc tl_get_mem_size uses ebx edi, tlist:dword, h_mem:dword |
mov edi,dword[tlist] |
mov eax,dword[h_mem] |
mov edi,[tlist] |
mov eax,[h_mem] |
@@: |
cmp dword[eax],'tree' |
jne @f |
2219,25 → 2193,30 |
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 |
txt_capt_cur: db 'âப ' |
.v: db ' ',0 |
txt_capt_otm: db '⬥ë ' |
.v: db ' ',0 |
|
;íâ®â ª®¤ ¥ ¬®©, ® ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã |
;description: |
; ¯à¥à¥¢®¤ ç¨á« ¢ ASCII áâபã |
;input: |
; eax = value |
; edi = string buffer |
align 4 |
tl_convert_to_str: |
proc tl_convert_to_str, len:dword |
pushad |
mov dword[edi+1],0x20202020 |
mov esi,[len] |
add esi,edi |
dec esi |
call .str |
popad |
ret |
endp |
|
align 4 |
.str: |
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬ áç¨á«¥¨ï ¨§¬¥ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤ë¥ ¯ à ¬¥âàë eax - ç¨á«® |
;¯à¥à¥¢®¤ ç¨á« ¢ ASCII áâப㠢§®¤ë¥ ¤ ë¥ ecx=á¨á⥬ áç¨á«¥ï edi ¤à¥á ªã¤ § ¯¨áë¢ âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®¥æ ¯¥à¥¬¥®© |
mov ecx,10 ;§ ¤ ¥âáï á¨á⥬ áç¨á«¥¨ï |
cmp eax,ecx ;áà ¢¨âì ¥á«¨ ¢ eax ¬¥ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ @@-1 â.¥. pop eax |
jb @f |
xor edx,edx ;®ç¨áâ¨âì edx |
2245,8 → 2224,11 |
push edx ;¯®«®¦¨âì ¢ á⥪ |
call .str ;¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥â ¯®ª ¢ eax ¥ á⠥⠬¥ìè¥ ç¥¬ ¢ ecx |
pop eax |
@@: ;cmp al,10 ;¯à®¢¥à¨âì ¥ ¬¥ìè¥ «¨ § 票¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥ï 10 ¤ ï ª®¬ ¤ - «¨è ï)) |
or al,0x30 ;¤ ï ª®¬ ¤ ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥ |
stosb ;§ ¯¨á âì í«¥¬¥â ¨§ ॣ¨áâà al ¢ ï祪㠯 ¬ï⨠es:edi |
ret ;¢¥àãâìáï ®ç¥ì ¨â¥à¥áë© å®¤ â.ª. ¯®ª ¢ á⥪¥ åà ¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï |
} |
@@: |
cmp edi,esi |
jge @f |
or al,0x30 ;¤®¡ ¢«ï¥¬ ᨬ¢®« '0' |
stosb ;§ ¯¨á âì al ¢ ï祪㠯 ¬ï⨠[edi] |
mov byte[edi],0 |
@@: |
ret |