Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 5948 → Rev 5947

/programs/develop/libraries/box_lib/trunk/tree_list.mac
1,6 → 1,6
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
; í«¥¬¥­â TreeList ¤«ï Kolibri OS
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 03.12.2015 IgorA
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 14.11.2015 IgorA
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
 
 
63,7 → 63,8
 
;®ç¨á⪠ ¯ ¬ïâ¨ í«¥¬¥­â  (¤¥áâàãªâ®à)
align 4
proc tl_data_clear uses eax edi, tlist:dword
proc tl_data_clear uses edi, tlist:dword
;uses eax ???
mov edi,dword[tlist]
cmp tl_data_img,0
je @f
128,7 → 129,7
jne @f
cmp tl_on_press,0
je @f
call tl_on_press
call tl_on_press
@@:
cmp ah,byte[ecx+1] ;Space
jne @f
189,6 → 190,7
shl ebx,16
cmp eax,ebx ;«¥¢ ï £à ­¨æ  ®ª­ 
jl .no_in_wnd ;.test_scroll ­¥ ¯à¨¬¥­ï¥¬
 
shr ebx,16
add ebx,tl_box_width
shl ebx,16
206,9 → 208,9
jl .test_scroll
 
push eax ebx
mcall 37,7 ;®¡à ¡®âª  ª®«¥á  ¬ëè¨
mov edx,eax
xor ecx,ecx
mcall 37,7 ;®¡à ¡®âª  ª®«¥á  ¬ëè¨
mov edx,eax
xor ecx,ecx
test eax,eax
jz .mouse_next
test ax,0x8000
229,7 → 231,7
dec ecx
jnz @r
jmp .mouse_next
;------------------------------------------------
;----------------------------------------
.decr: ;¢¥à⨪ «ì­ ï ¯à®ªàã⪠ ®âà¨æ â¥«ì­ ï
mov bx,ax ;ax = mouse scroll data vertical
jmp @f
243,7 → 245,7
stdcall tl_cur_perv, edi
dec ecx
jnz @r
;------------------------------------------------
;---------------------------------------------------
.mouse_next:
pop ebx eax
 
338,7 → 340,7
stdcall scroll_bar_vertical.mouse, edx ;scrollbar_ver_mouse
 
cmp dword[edx+sb_offs_redraw],0
je @f
je @f
mov dword[edx+sb_offs_redraw],0
stdcall tl_draw, edi ;¯à®¨§®è«¨ ¨§¬¥­¥­¨ï áªà®««¨­£ 
@@:
349,6 → 351,7
mcall 37,2 ;¯à®¢¥à塞 ­ ¦ â®áâì «î¡ëå ª­®¯®ª
cmp eax,0 ;­¨ç¥£® ­¥ ­ ¦ «¨ eax=0
je .no_draw
 
mov ebx,tl_el_focus
cmp dword[ebx],edi
jne .no_draw ;í«¥¬¥­â ­¥ ¢ 䮪ãá¥
391,149 → 394,160
;¢­ãâ७­ïï äã­ªæ¨ï, ­¥ ¤«ï íªá¯®àâ 
align 4
tl_info_set_undo:
cmp tl_tim_undo,1
jl .no_work
cmp tl_tim_undo,1
jl .no_work
 
push eax ebx ecx edx
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
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
jle .no_u1
mov dword[edx+12],0
mov dword[edx+16],0
push eax ebx ecx edx
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
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
 
mov ebx, dword[edx+4]
imul ebx,sizeof.TreeList
add ebx, tl_data_nodes ;.next
push dword[edx+8] ;node[node[i].perv].next=node[i].next;
pop dword[ebx+8]
;if(node[i].tc>ch_tim){ // ¥á«¨ ᮧ¤ ­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
cmp dword[edx+12],eax
jle .no_u1
mov dword[edx+12],0
mov dword[edx+16],0
 
mov ebx, dword[edx+8]
imul ebx,sizeof.TreeList
add ebx, tl_data_nodes ;.perv
push dword[edx+4] ;node[node[i].next].perv=node[i].perv;
pop dword[ebx+4]
.no_u1:
mov ebx, dword[edx+4]
imul ebx,sizeof.TreeList
add ebx, tl_data_nodes ;.next
push dword[edx+8] ;node[node[i].perv].next=node[i].next;
pop dword[ebx+8]
 
;else if(node[i].td>ch_tim) node[i].td=0; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
cmp dword[edx+16],eax
jle .no_u2
mov dword[edx+16],0
.no_u2:
call tl_move_next
jmp @b
@@:
mov tl_tim_undo,0
pop edx ecx ebx eax
.no_work:
ret
mov ebx, dword[edx+8]
imul ebx,sizeof.TreeList
add ebx, tl_data_nodes ;.perv
push dword[edx+4] ;node[node[i].next].perv=node[i].perv;
pop dword[ebx+4]
 
.no_u1:
 
;else if(node[i].td>ch_tim) node[i].td=0; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
cmp dword[edx+16],eax
jle .no_u2
mov dword[edx+16],0
.no_u2:
 
call tl_move_next
jmp @b
@@:
mov tl_tim_undo,0
; mov eax,[edi+?] ;co_tim
; cmp tl_ch_tim,eax ;ch_tim
; jge @f
; mov [edi+?],0 ;co_tim
; @@:
pop edx ecx ebx eax
.no_work:
 
ret
 
;¢ë¢®¤ ᯨ᪠ ­  íªà ­
align 4
proc tl_draw, tlist:dword
pushad
;draw dir_list main rect
mov edi,dword[tlist]
mov ebx,tl_box_left
shl ebx,16
add ebx,tl_box_width
mov ecx,tl_box_top
shl ecx,16
mov cx,tl_capt_cy
mov edx,tl_col_zag
mcall 13 ;draw window caption
pushad
;draw dir_list main rect
mov edi,dword[tlist]
mov ebx,tl_box_left
shl ebx,16
add ebx,tl_box_width
mov ecx,tl_box_top
shl ecx,16
mov cx,tl_capt_cy
mov edx,tl_col_zag
mcall 13 ;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
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
 
cmp tl_capt_cy,9 ;9 - minimum caption height
jl @f
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
cmp tl_capt_cy,9 ;9 - minimum caption height
jl @f
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
 
mov edi,ebx
mov eax,tl_tim_undo
lea edi,[txt_capt_otm]
add edi,7
call tl_convert_to_str
mov edi,ebx ;restore edi
mov edi,ebx
mov eax,tl_tim_undo
lea edi,[txt_capt_otm]
add edi,7
call tl_convert_to_str
mov edi,ebx ;restore edi
 
mov eax,4 ;draw text captions
mov ebx,tl_box_left
shl ebx,16
add ebx,5*65536+3
add ebx,tl_box_top
mov ecx,tl_col_txt
or ecx,0x80000000
lea edx,[txt_capt_cur]
int 0x40
mov eax,4 ;draw text captions
mov ebx,tl_box_left
shl ebx,16
add ebx,5*65536+3
add ebx,tl_box_top
mov ecx,tl_col_txt
or ecx,0x80000000
lea edx,[txt_capt_cur]
int 0x40
 
mov ebx,tl_box_left
shl ebx,16
add ebx,100*65536+3
add ebx,tl_box_top
lea edx,[txt_capt_otm]
int 0x40
@@:
mov ebx,tl_box_left
shl ebx,16
add ebx,100*65536+3
add ebx,tl_box_top
lea edx,[txt_capt_otm]
int 0x40
@@:
 
;cycle to nodes
xor eax,eax
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
;cycle to nodes
xor eax,eax
mov edx,tl_data_nodes
mov ecx,edx
add ecx,sizeof.TreeList
 
;*** ¯à®¯ã᪠㧫®¢, ª®â®àë¥ ¯à®¬®â ­ë áªà®««¨­£®¬ ***
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .end_c1
mov esi,tl_p_scroll
cmp dword[esi+sb_offs_position],0 ;¥á«¨ áªà®««¨­£ ­  ¢¥àåã, ¢ë室¨¬
je .end_c1
@@:
call tl_iterat_next
cmp edx,ecx
jle .end_draw
inc eax
cmp eax,dword[esi+sb_offs_position]
jl @b
.end_c1:
;*** ¯à®¯ã᪠㧫®¢, ª®â®àë¥ ¯à®¬®â ­ë áªà®««¨­£®¬ ***
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .end_c1
mov esi,tl_p_scroll
cmp dword[esi+sb_offs_position],0 ;¥á«¨ áªà®««¨­£ ­  ¢¥àåã, ¢ë室¨¬
je .end_c1
@@:
call tl_iterat_next
cmp edx,ecx
jle .end_draw
inc eax
cmp eax,dword[esi+sb_offs_position]
jge .end_c1
jmp @b
.end_c1:
 
xor eax,eax
mov esi,tl_box_top
add esi,tl_box_height ;esi = coord bottom border
@@:
call tl_iterat_next
cmp edx,ecx
jle @f
call tl_draw_node
inc eax
jmp @b
@@:
xor eax,eax
mov esi,tl_box_top
add esi,tl_box_height ;esi = coord bottom border
@@:
call tl_iterat_next
cmp edx,ecx
jle @f
call tl_draw_node
inc eax
jmp @b
@@:
 
call tl_draw_cursor
call tl_draw_cursor
 
mov edi,tl_p_scroll ;à¨á㥬 ¤®ç¥à­¨© áªà®««¨­£
cmp edi,0 ;¤«ï ⮣® çâ®-¡ë ¥£® ­¥ ¯à¨è«®áì à¨á®¢ âì ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
je .end_draw ;¥á«¨ ­¥â áªà®««¨­£  ¢ë室¨¬
stdcall scroll_bar_vertical.draw, edi
.end_draw:
popad
ret
mov edi,tl_p_scroll ;à¨á㥬 ¤®ç¥à­¨© áªà®««¨­£
cmp edi,0 ;¤«ï ⮣® çâ®-¡ë ¥£® ­¥ ¯à¨è«®áì à¨á®¢ âì ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
je .end_draw ;¥á«¨ ­¥â áªà®««¨­£  ¢ë室¨¬
stdcall scroll_bar_vertical.draw, edi
 
.end_draw:
popad
ret
endp
 
;¯¥à¥å®¤ ­  á«¥¤ã騩 ¢¨¤¨¬ë© 㧥« (¯à®¯ãáª ï § ªàëâë¥)
545,42 → 559,42
; edx = pointer to next node struct
align 4
tl_iterat_next:
push bx
mov bl,0x7f
cmp byte[edx+3],1
jne @f
mov bl,byte[edx+2]
@@:
push bx
mov bl,0x7f
cmp byte[edx+3],1
jne @f
mov bl,byte[edx+2]
@@:
 
cmp tl_tim_undo,0
je .else
cmp tl_tim_undo,0
je .else
 
push eax
.beg0:
call tl_move_next
cmp edx,ecx
jle @f
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥­­ëå ¨ ®â¬¥­¥­­ëå
cmp al,1
je .beg0
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå
jl .beg0
@@:
pop eax
pop bx
ret
push eax
.beg0:
call tl_move_next
cmp edx,ecx
jle @f
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥­­ëå ¨ ®â¬¥­¥­­ëå
cmp al,1
je .beg0
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå
jl .beg0
@@:
pop eax
pop bx
ret
 
.else:
call tl_move_next
cmp edx,ecx
jle .endif
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥­­ëå
jne .else
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå
jl .else
.endif:
pop bx
ret
.else:
call tl_move_next
cmp edx,ecx
jle .endif
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥­­ëå
jne .else
cmp bl,byte[edx+2] ;¯à®¯ã᪠§ ªàëâëå
jl .else
.endif:
pop bx
ret
 
;¯¥à¥å®¤ ­  á«¥¤ã騩 ¢¨¤¨¬ë© 㧥« (¨ ­  § ªàëâë¥ â®¦¥)
;input:
591,28 → 605,28
; edx = pointer to next visible node struct
align 4
tl_iterat_next_all:
cmp tl_tim_undo,0
je .else
cmp tl_tim_undo,0
je .else
 
push eax
@@:
call tl_move_next
cmp edx,ecx
jle @f
call tl_node_not_vis
cmp al,1
je @b
@@:
pop eax
ret
.else:
call tl_move_next
cmp edx,ecx
jle .endif
cmp dword[edx+16],0 ;td -> time delete
jne .else
.endif:
ret
push eax
@@:
call tl_move_next
cmp edx,ecx
jle @f
call tl_node_not_vis
cmp al,1
je @b
@@:
pop eax
ret
.else:
call tl_move_next
cmp edx,ecx
jle .endif
cmp dword[edx+16],0 ;td -> time delete
jne .else
.endif:
ret
 
;¯¥à¥å®¤ ­  ¯à¥¤ë¤ã騩 ¢¨¤¨¬ë© 㧥« (¯à®¯ãáª ï § ªàëâë¥)
;input:
621,29 → 635,29
; edi = pointer to 'TreeList' struct
align 4
tl_iterat_perv:
push eax
cmp tl_tim_undo,0
je .beg1
push eax
cmp tl_tim_undo,0
je .beg1
 
.beg0:
call tl_move_perv
cmp edx,ecx
jle @f
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥­­ëå ¨ ®â¬¥­¥­­ëå
cmp al,1
je .beg0
.beg0:
call tl_move_perv
cmp edx,ecx
jle @f
call tl_node_not_vis ;¯à®¯ã᪠㤠«¥­­ëå ¨ ®â¬¥­¥­­ëå
cmp al,1
je .beg0
 
.beg1:
call tl_move_perv
cmp edx,ecx
jle @f
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥­­ëå
jne .beg1
.beg1:
call tl_move_perv
cmp edx,ecx
jle @f
cmp dword[edx+16],0 ;td = 'time delete' -> ¯à®¯ã᪠㤠«¥­­ëå
jne .beg1
 
@@:
call tl_move_max_clo_par
pop eax
ret
@@:
call tl_move_max_clo_par
pop eax
ret
 
;­ å®¤¨â த¨â¥«ì᪨© § ªàëâë© ã§¥« ¬ ªá¨¬ «ì­®£® ã஢­ï
;input:
653,21 → 667,21
; edx = pointer closed parent node with maximum level
align 4
proc tl_move_max_clo_par uses eax ebx
mov eax,edx
xor ebx,ebx
.beg:
call tl_move_par
cmp byte[edx+3],1 ;த¨â¥«ì᪨© 㧥« § ªàëâ ?
jne @f
mov eax,edx
@@:
cmp ebx,edx
je .end_f
mov ebx,edx
jmp .beg
.end_f:
mov edx,eax
ret
mov eax,edx
xor ebx,ebx
.beg:
call tl_move_par
cmp byte[edx+3],1 ;த¨â¥«ì᪨© 㧥« § ªàëâ ?
jne @f
mov eax,edx
@@:
cmp ebx,edx
je .end_f
mov ebx,edx
jmp .beg
.end_f:
mov edx,eax
ret
endp
 
;input:
734,25 → 748,25
; (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
je @f
mov eax,dword[edx+16] ;eax=node[i].td
add eax,tl_tim_undo
cmp eax,tl_ch_tim
jg @f
mov al,1
ret
@@:
cmp dword[edx+16],0
je @f
mov eax,dword[edx+16] ;eax=node[i].td
add eax,tl_tim_undo
cmp eax,tl_ch_tim
jg @f
mov al,1
ret
@@:
 
mov eax,tl_ch_tim
sub eax,tl_tim_undo
cmp dword[edx+12],eax ;tc -> time create
jle @f
mov al,1
ret
@@:
xor al,al
ret
mov eax,tl_ch_tim
sub eax,tl_tim_undo
cmp dword[edx+12],eax ;tc -> time create
jle @f
mov al,1
ret
@@:
xor al,al
ret
 
;à¨á㥬 ªãàá®à ­  íªà ­¥
;input:
837,32 → 851,36
; esi = coord bottom border
align 4
proc tl_draw_null_cursor uses eax ebx ecx edx esi
call tl_get_display_cur_pos ;eax = cursor pos in screen
cmp eax,0
jl .end_f ;ªãàá®à ­ å®¤¨âáï ¢ëè¥ ®ª­ , ¢ ®¡« á⨠¯à®ªàã祭­®© áªà®««¨­£®¬
mov ebx,tl_box_left
shl ebx,16
mov bx,tl_img_cx
xor ecx,ecx
mov cx,tl_img_cy
imul ecx,eax
add ecx,tl_box_top
add cx,tl_capt_cy
call tl_get_display_cur_pos ;eax = cursor pos in screen
cmp eax,0
jl .end_f ;ªãàá®à ­ å®¤¨âáï ¢ëè¥ ®ª­ , ¢ ®¡« á⨠¯à®ªàã祭­®© áªà®««¨­£®¬
 
;crop image if on the border
cmp esi,ecx ;¥á«¨ ªãàá®à ¢­¨§ã ¨ ¥£® ¢®®¡é¥ ­¥ ¢¨¤­®
jl .end_f
mov ebx,tl_box_left
shl ebx,16
mov bx,tl_img_cx
xor ecx,ecx
mov cx,tl_img_cy
imul ecx,eax
add ecx,tl_box_top
add cx,tl_capt_cy
 
sub esi,ecx
shl ecx,16
mov cx,tl_img_cy
cmp si,tl_img_cy
jge @f
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥­ ç áâ¨ç­® (¯®¯ « ­  ­¨¦­îî £à ­¨æã)
@@:
mcall 13,,,tl_col_bkg ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
.end_f:
ret
;crop image if on the border
cmp esi,ecx ;¥á«¨ ªãàá®à ¢­¨§ã ¨ ¥£® ¢®®¡é¥ ­¥ ¢¨¤­®
jl .end_f
 
sub esi,ecx
shl ecx,16
mov cx,tl_img_cy
cmp si,tl_img_cy
jge @f
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥­ ç áâ¨ç­® (¯®¯ « ­  ­¨¦­îî £à ­¨æã)
@@:
 
mov edx,tl_col_bkg
mcall 13 ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
 
.end_f:
ret
endp
 
;¡¥à¥â ¯®§¨æ¨î ªãàá®à , ®â­®á¨â¥«ì­® íªà ­ 
872,20 → 890,20
; eax = index
align 4
tl_get_display_cur_pos:
mov eax,tl_cur_pos
cmp tl_p_scroll,0
je @f
push ebx
mov ebx,tl_p_scroll
mov ebx,dword[ebx+sb_offs_position]
sub eax,ebx ;®â­¨¬ ¥¬ ¯®§¨æ¨î áªà®««¨­£ 
pop ebx
@@:
ret
mov eax,tl_cur_pos
cmp tl_p_scroll,0
je @f
push ebx
mov ebx,tl_p_scroll
mov ebx,dword[ebx+sb_offs_position]
sub eax,ebx ;®â­¨¬ ¥¬ ¯®§¨æ¨î áªà®««¨­£ 
pop ebx
@@:
ret
 
;à¨áã¥â 㧥« á: ª à⨭ª®©, ¯®¤¯¨áìî, ¨ª®­ª®© ®âªàëâ¨ï/§ ªàëâ¨ï ¨ «¨­¨ï¬¨ ª த¨â. 㧫ã
;input:
; eax = node position (0, ..., max_nodes-scroll_pos) ­¥ ¤® tl_box_height/tl_img_cy
; eax = node position
; edx = pointer to some node struct
; edi = pointer to 'TreeList' struct
; esi = coord of bottom border
905,9 → 923,8
xor ecx,ecx
mov cx,tl_img_cy
imul ecx,eax
add ecx,tl_box_top
add cx,tl_capt_cy
jc .end_draw ;ª®£¤  ¬­®£® 㧫®¢, â® ¬®¦¥â ¡ëâì ¯¥à¥¯®«­¥­¨¥ ª®®à¤¨­ âë cx
add ecx,tl_box_top
 
;crop image if on the border
cmp esi,ecx ;¥á«¨ 㧥« ¢­¨§ã ¨ ¥£® ¢®®¡é¥ ­¥ ¢¨¤­®
930,7 → 947,7
push edx
mov edx,tl_col_txt
mcall 13 ;draw node rect
pop edx
pop edx
jmp @f
.draw_img_n:
push ebx edx esi
978,37 → 995,38
;...
align 4
proc tl_draw_node_icon_opn_clo uses eax ebx ecx edx esi
inc al
call tl_iterat_next_all ;get next visible item
cmp edx,ecx
jle @f
mov ecx,esi ;load ecx
cmp al,byte[edx+2]
jne @f
ror ebx,16
sub bx,tl_img_cx
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
jmp @f
.draw_img_s:
mov ecx,esi ;load ecx
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
shr eax,8
and eax,0xff
imul ebx,eax ;eax = icon index
add ebx,tl_data_img_sys
mcall 7 ;draw minus icon '-'
@@:
ret
inc al
call tl_iterat_next_all ;get next visible item
cmp edx,ecx
jle @f
mov ecx,esi ;load ecx
cmp al,byte[edx+2]
jne @f
ror ebx,16
sub bx,tl_img_cx
ror ebx,16
cmp tl_data_img_sys,0
jne .draw_img_s
mov edx,tl_col_txt
mcall 13 ;draw minus rect, if not system icons
jmp @f
.draw_img_s:
mov ecx,esi ;load ecx
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
shr eax,8
and eax,0xff
imul ebx,eax ;eax = icon index
add ebx,tl_data_img_sys
mcall 7 ;draw minus icon '-'
@@:
ret
endp
 
;à¨á®¢ ­¨¥ «¨­¨¨ ª த¨â¥«ì᪮¬ã í«¥¬¥­âã
1019,111 → 1037,121
;...
align 4
tl_draw_node_icon_par_lin:
cmp byte[edx+3],1
je .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]
jne .line3 ;jg ???
mov eax,3 ;line in middle element
jmp .line2
.line3:
mov eax,6 ;line in end element
.line2:
cmp byte[edx+3],1
je .close
push eax ebx ecx edx esi
cmp al,0
je @f
; dec al
; call tl_iterat_perv ;get perv visible item
 
mov ecx,esi ;load ecx
ror ebx,16
sub bx,tl_img_cx
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
jmp @f
.draw_img_s:
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
call tl_iterat_next_all ;get next visible item
cmp edx,ecx
jle .line3 ;if end of list
cmp al,byte[edx+2]
jne .line3 ;jg ???
mov eax,3 ;line in middle element
jmp .line2
.line3:
mov eax,6 ;line in end element
.line2:
 
imul ebx,eax ;eax = icon index
add ebx,tl_data_img_sys
mcall 7 ;draw line icon
@@:
pop esi edx ecx ebx eax
.close:
ret
mov ecx,esi ;load ecx
ror ebx,16
sub bx,tl_img_cx
ror ebx,16
cmp tl_data_img_sys,0
jne .draw_img_s
mov edx,tl_col_txt
mcall 13 ;draw minus rect, if not system icons
jmp @f
.draw_img_s:
; mov ecx,esi ;load ecx
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
 
; shr eax,8
; and eax,0xff
imul ebx,eax ;eax = icon index
add ebx,tl_data_img_sys
mcall 7 ;draw line icon
@@:
pop esi edx ecx ebx eax
.close:
ret
 
 
;input:
; al = ã஢¥­ì í«¥¬¥­â 
; ebx = (node.left shl 16) + tl_img_cx
; ecx = pointer to 1 node struct
; edx = pointer to some 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
xor esi,esi ;¢ si ¡ã¤¥¬ ­ áç¨â뢠âì ª®«-¢® ¨ª®­®ª, ­ã¦­ëå ¤«ï ¯à®à¨á®¢ª¨ «¨­¨¨
tl_draw_node_icon_par_lin_up:
push eax ebx ecx edx
push esi
cmp tl_data_img_sys,0 ;if not image
je @f
cmp al,0
je @f
 
xor esi,esi ;¢ si ¡ã¤¥¬ ­ áç¨â뢠âì ª®«-¢® ¨ª®­®ª, ­ã¦­ëå ¤«ï ¯à®à¨á®¢ª¨ «¨­¨¨
;--- 横« ¤«ï ¢ëç¨á«¥­¨ï ª®««¨ç¥á⢠ ¢¥à⨪ «ì­ëå «¨­¨© ---
.cycle0:
call tl_iterat_perv ;get perv visible item
cmp edx,ecx
jle .cycle1 ;if begin of list
.cycle0:
call tl_iterat_perv ;get perv visible item
cmp edx,ecx
jle .cycle1 ;if begin of list
 
cmp byte[edx+2],al
jle .cycle0end ;ã஢¥­ì ¢¥àå­¥£® í«¥¬¥­â  ­¥ âॡã¥â ¯à®à¨á®¢ª¨
inc si
jmp .cycle0
.cycle0end:
cmp si,0 ;si = ª®«-¢® ¨ª®­®ª «¨­¨¨ ª®â®àë¥ ­ã¦­® ­ à¨á®¢ âì ᢥàåã
je @f
shl esi,16
cmp byte[edx+2],al
jle .cycle0end ;ã஢¥­ì ¢¥àå­¥£® í«¥¬¥­â  ­¥ âॡã¥â ¯à®à¨á®¢ª¨
inc si
jmp .cycle0
.cycle0end:
cmp si,0 ;si = ª®«-¢® ¨ª®­®ª «¨­¨¨ ª®â®àë¥ ­ã¦­® ­ à¨á®¢ âì ᢥàåã
je @f
shl esi,16
 
pop ecx ;esi->ecx
push ecx ;save esi
pop ecx ;esi->ecx
push ecx ;save esi
 
ror ebx,16
sub bx,tl_img_cx
ror ebx,16
ror ebx,16
sub bx,tl_img_cx
ror ebx,16
 
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov cx,tl_img_cy ;restore size y (if crop)
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
add ebx,tl_data_img_sys
mov edx,ebx
ror ecx,16
mov dx,cx
mov cx,bx
ror ecx,16
mov cx,tl_img_cy ;restore size y (if crop)
mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx
imul bx,tl_img_cy
add ebx,tl_data_img_sys
 
add esi,tl_box_top
add si,tl_capt_cy ;si = ¢¥àå­ïï £à ­¨æ  ®ª­ 
mov eax,7
add esi,tl_box_top
add si,tl_capt_cy ;si = ¢¥àå­ïï £à ­¨æ  ®ª­ 
mov eax,7
;--- 横« ¤«ï à¨á®¢ ­¨ï ¢¥à⨪ «ì­®© «¨­¨¨ ---
.cycle1:
sub dx,tl_img_cy ;¯®¤­¨¬ ¥¬ ª®®à¤¨­ âã y ¢¢¥àå
cmp dx,si
jl @f
cmp esi,0x10000
jl @f
int 0x40 ;draw line icon
sub esi,0x10000 ;㬥­ìè ¥¬ áç¥â稪 ¨ª®­®ª
jmp .cycle1
@@:
ret
endp
.cycle1:
sub dx,tl_img_cy ;¯®¤­¨¬ ¥¬ ª®®à¤¨­ âã y ¢¢¥àå
cmp dx,si
jl @f
cmp esi,0x10000
jl @f
int 0x40 ;draw line icon
sub esi,0x10000 ;㬥­ìè ¥¬ áç¥â稪 ¨ª®­®ª
jmp .cycle1
@@:
pop esi
pop edx ecx ebx eax
ret
 
;input:
; edi = pointer to TreeInfo struct
1131,15 → 1159,15
; eax = rows
align 4
tl_get_rows_count:
push ecx edx
mov eax,tl_box_height
sub ax,tl_capt_cy
xor ecx,ecx
mov cx,tl_img_cy
xor edx,edx
div ecx
pop edx ecx
ret
push ecx edx
mov eax,tl_box_height
sub ax,tl_capt_cy
xor ecx,ecx
mov cx,tl_img_cy
xor edx,edx
div ecx
pop edx ecx
ret
 
;input:
; eax = node position
1148,37 → 1176,41
; edx = pointer to some node struct
; edi = pointer to TreeInfo struct
align 4
proc tl_draw_node_caption uses ebx ecx edx esi
xor esi,esi
mov si,tl_info_size
cmp si,tl_info_capt_offs
jle @f ;if caption size <= 0
push eax
call tl_get_node_index ;eax = node index
imul esi,eax
pop eax
add si,tl_info_capt_offs
add esi,tl_data_info
mov edx,esi
tl_draw_node_caption:
push ebx ecx edx esi
 
shr ebx,16
add bx,tl_img_cx ;ᤢ¨£ ¥¬ ­ ¤¯¨áì ¯® £®à¨§®­â «¨ --->
add bx,3 ;®âáâã¯
;bx = coord.x
call tl_strlen ;eax = strlen
call tl_get_draw_text_len
mov cx,bx
ror ecx,16
mov ebx,ecx
add bx,tl_img_cy ;¢ëà ¢­¨¢¨­¨¥ ¯® ­¨¦­¥© £à ­¨æ¥ ¨ª®­ª¨
sub bx,9 ;®â­¨¬ ¥¬ ¢ëá®âã ⥪áâ 
mov ecx,tl_col_txt
and ecx,0xffffff
mcall 4
@@:
ret
endp
xor esi,esi
mov si,tl_info_size
cmp si,tl_info_capt_offs
jle @f ;if caption size <= 0
 
push eax
call tl_get_node_index ;eax = node index
imul esi,eax
pop eax
add si,tl_info_capt_offs
add esi,tl_data_info
mov edx,esi
 
shr ebx,16
add bx,tl_img_cx ;ᤢ¨£ ¥¬ ­ ¤¯¨áì ¯® £®à¨§®­â «¨ --->
add bx,3 ;®âáâã¯
;bx = coord. x
call tl_strlen ;eax = strlen
call tl_get_draw_text_len
mov cx,bx
ror ecx,16
mov ebx,ecx
add bx,tl_img_cy ;¢ëà ¢­¨¢¨­¨¥ ¯® ­¨¦­¥© £à ­¨æ¥ ¨ª®­ª¨
sub bx,9 ;®â­¨¬ ¥¬ ¢ëá®âã ⥪áâ 
mov ecx,tl_col_txt
and ecx,0xffffff
; or ecx,0x80000000 ;text is ASCIIZ
mcall 4
@@:
pop esi edx ecx ebx
ret
 
;input:
; eax = strlen
; ebx = text coord x
1185,26 → 1217,29
;output:
; esi = text len
align 4
proc tl_get_draw_text_len uses eax ecx edx
mov esi,eax ;¡¥à¥¬ ¤«¨­­ã áâப¨
mov eax,tl_box_left
add eax,tl_box_width
cmp eax,ebx
jle .text_null ;¥á«¨ ¯®¤¯¨áì ¯®«­®áâìî ¢áï §  íªà ­®¬
sub eax,ebx
xor edx,edx
mov ecx,6 ;è¨à¨­  á¨á⥬­®£® èà¨äâ 
div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥
cmp esi,eax
jl @f
mov esi,eax ;¥á«¨ ¤«¨­­  ⥪áâ  ¬¥­ìè¥, 祬 ¢á¥ ¬¥áâ® ¯®¤ áâபã
jmp @f
.text_null:
xor esi,esi
@@:
ret
endp
tl_get_draw_text_len:
push eax ecx edx
mov esi,eax ;¡¥à¥¬ ¤«¨­­ã áâப¨
 
mov eax,tl_box_left
add eax,tl_box_width
cmp eax,ebx
jle .text_null ;¥á«¨ ¯®¤¯¨áì ¯®«­®áâìî ¢áï §  íªà ­®¬
sub eax,ebx
xor edx,edx
mov ecx,6 ;è¨à¨­  á¨á⥬­®£® èà¨äâ 
div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥
 
cmp esi,eax
jl @f
mov esi,eax ;¥á«¨ ¤«¨­­  ⥪áâ  ¬¥­ìè¥, 祬 ¢á¥ ¬¥áâ® ¯®¤ áâபã
jmp @f
.text_null:
xor esi,esi
@@:
pop edx ecx eax
ret
 
;input:
; esi = pointer to string
;output:
1211,15 → 1246,15
; eax = strlen
align 4
tl_strlen:
mov eax,esi
@@:
cmp byte[eax],0
je @f
inc eax
jmp @b
@@:
sub eax,esi
ret
mov eax,esi
@@:
cmp byte[eax],0
je @f
inc eax
jmp @b
@@:
sub eax,esi
ret
 
;¤®¡ ¢¨âì 㧥«
;input:
1228,101 → 1263,103
; 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,dword[tlist]
 
call tl_info_set_undo
call tl_info_set_undo
 
mov ebx,sizeof.TreeList
imul ebx,tl_info_max_count
add ebx,tl_data_nodes
mov ebx,sizeof.TreeList
imul ebx,tl_info_max_count
add ebx,tl_data_nodes
;--
call tl_get_cur_node_index ;eax=po_t
imul eax,sizeof.TreeList
add eax,tl_data_nodes
mov edx,eax
call tl_move_perv
call tl_get_node_index ;eax = index of pointer [edx]
call tl_get_cur_node_index ;eax=po_t
imul eax,sizeof.TreeList
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
shl edx,1
add edx,tl_data_nodes
@@: ;for(i=2;i<nodeMax;i++)
cmp dword [edx+12],0
jne .u0
cmp dword [edx+16],0
jne .u0
mov edx,sizeof.TreeList
shl edx,1
add edx,tl_data_nodes
@@: ;for(i=2;i<nodeMax;i++)
cmp dword [edx+12],0
jne .u0
cmp dword [edx+16],0
jne .u0
 
inc tl_ch_tim
mov ecx,dword[n_opt]
ror ecx,16 ;cx = type
mov word[edx],cx
rol ecx,8 ;cl = close|open
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
mov cl,byte[n_opt]
mov byte[edx+2],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;
;*** copy node data ***
push esi
xor ecx,ecx
mov cx,tl_info_size
mov esi,ecx
inc tl_ch_tim
mov ecx,dword[n_opt]
ror ecx,16 ;cx = type
mov word[edx],cx
;;;mov cl,byte[ebp+13]
rol ecx,8 ;cl = close|open
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
mov cl,byte[n_opt]
mov byte[edx+2],cl ;node[i].lev
.l_box_m:
push tl_ch_tim ;node[i].tc=ch_tim;
pop dword[edx+12]
mov dword[edx+4], eax ;node[i].perv=po_t;
;*** copy node data ***
push esi
xor ecx,ecx
mov cx,tl_info_size
mov esi,ecx
 
push eax
call tl_get_node_index ;eax = node index
imul esi,eax
pop eax
add esi,tl_data_info
mov edi,dword[n_info] ;pointer to node data
xchg edi,esi
rep movsb
push eax
call tl_get_node_index ;eax = node index
imul esi,eax
pop eax
add esi,tl_data_info
mov edi,dword[n_info] ;pointer to node data
xchg edi,esi
rep movsb
 
mov esi,edi
mov edi,dword[tlist] ;restore edi
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:
pop esi ;restore esi
mov esi,edi
mov edi,dword[tlist] ;restore edi
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:
pop esi ;restore esi
 
mov ecx,eax
imul ecx,sizeof.TreeList
add ecx,tl_data_nodes ; *** ecx = node[po_t] ***
add ecx,8 ; *** ecx = node[po_t].next ***
push dword[ecx] ;node[i].next=node[po_t].next;
pop dword[edx+8]
mov ecx,eax
imul ecx,sizeof.TreeList
add ecx,tl_data_nodes ; *** ecx = node[po_t] ***
add ecx,8 ; *** ecx = node[po_t].next ***
push dword [ecx] ;node[i].next=node[po_t].next;
pop dword [edx+8]
 
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
add ecx,tl_data_nodes ; *** ecx = node[node[i].next] ***
mov [ecx+4],eax ;node[node[i].next].perv=i;
call tl_get_node_index ;*** eax = i ***
cmp eax,tl_info_max_count
jge .u0
 
call tb_scrol_resize ;®¡à ¡®âª  áªà®««¨­£ 
jmp @f
.u0:
add edx,sizeof.TreeList
cmp edx,ebx ;enf of node memory ?
jle @b
@@:
mov [ecx],eax ;node[po_t].next=i; // áá뫪¨ ¯¥à¥­ ¯à ¢«ï¥¬
mov ecx,[edx+8] ; *** ecx = node[i].next ***
imul ecx,sizeof.TreeList
add ecx,tl_data_nodes ; *** ecx = node[node[i].next] ***
mov [ecx+4],eax ;node[node[i].next].perv=i;
 
call tb_scrol_resize ;®¡à ¡®âª  áªà®««¨­£ 
jmp @f
.u0:
add edx,sizeof.TreeList
cmp edx,ebx ;enf of node memory ?
jle @b
@@:
ret
endp
 
1331,20 → 1368,21
align 4
proc tb_scrol_resize uses eax ecx edx
cmp tl_p_scroll,0 ;®¡à ¡®âª  áªà®««¨­£ 
je @f
call tl_get_node_count ;eax = node count
mov ecx,eax
call tl_get_rows_count
cmp ecx,eax
jg .ye_sb
xor ecx,ecx
.ye_sb:
mov edx,tl_p_scroll
mov dword[edx+sb_offs_cur_area],eax
mov dword[edx+sb_offs_max_area],ecx
je @f
call tl_get_node_count ;eax = node count
mov ecx,eax
call tl_get_rows_count
cmp ecx,eax
jg .ye_sb
xor ecx,ecx
.ye_sb:
 
mov edx,tl_p_scroll
mov dword[edx+sb_offs_cur_area],eax
mov dword[edx+sb_offs_max_area],ecx
stdcall scroll_bar_vertical.draw,edx
@@:
ret
@@:
ret
endp
 
;input:
1351,39 → 1389,40
;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]
call tl_get_cur_node_index ;eax=po_t
cmp eax,2
jl @f
xor ecx,ecx
mov cx,tl_info_size
imul eax,ecx
add eax,tl_data_info
mov edi,eax
mov esi,dword[n_info] ;pointer to node data
rep movsb
mov edi,dword[tlist]
call tl_get_cur_node_index ;eax=po_t
cmp eax,2
jl @f
xor ecx,ecx
mov cx,tl_info_size
imul eax,ecx
add eax,tl_data_info
mov edi,eax
mov esi,dword[n_info] ;pointer to node data
rep movsb
 
mov esi,edi
mov edi,dword[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
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:
@@:
mov esi,edi
mov edi,dword[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
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:
 
@@:
ret
endp
 
1472,15 → 1511,15
mov edi,dword[tlist]
mov edx,dword[node_p]
 
call tl_get_node_index ;eax = node index
cmp eax,2
jl @f
xor ecx,ecx
mov cx,tl_info_size
imul eax,ecx
call tl_get_node_index ;eax = node index
cmp eax,2
jl @f
xor ecx,ecx
mov cx,tl_info_size
imul eax,ecx
add eax,tl_data_info
jmp .end_f ;return node data pointer
@@:
@@:
xor eax,eax ;¢®§¢à é ¥¬ 0 ¢ á«ãç ¥ ­¥ 㤠筮£® ¯®¨áª 
.end_f:
ret
1567,31 → 1606,33
;¯¥à¥­¥á⨠ªãàá®à ­  1 ¯®§¨æ¨î ­¨¦¥
align 4
proc tl_cur_next uses eax ebx edi esi, tlist:dword
mov edi,dword[tlist]
call tl_get_node_count ;eax = node count
cmp tl_cur_pos,eax
jge .no_redraw
mov esi,tl_box_top
add esi,tl_box_height ;esi = coord bottom border
call tl_draw_null_cursor ;áâ¨à ¥¬ ªãàá®à
inc tl_cur_pos
mov edi,dword[tlist]
call tl_get_node_count ;eax = node count
;inc eax
cmp tl_cur_pos,eax
jge .no_redraw
mov esi,tl_box_top
add esi,tl_box_height ;esi = coord bottom border
call tl_draw_null_cursor ;áâ¨à ¥¬ ªãàá®à
inc tl_cur_pos
 
cmp tl_p_scroll,0 ;if not scrol struct
je @f
call tl_get_rows_count ;eax = rows count
mov ebx,tl_p_scroll
add eax,dword[ebx+sb_offs_position]
cmp tl_cur_pos,eax
jl @f
inc dword[ebx+sb_offs_position]
stdcall scroll_bar_vertical.draw,ebx
stdcall tl_draw,dword[tlist] ;¯®«­ ï ¯¥à¥à¨á®¢ª  ®ª­ 
jmp .no_redraw
@@:
mov edi,dword[tlist] ;restore edi
call tl_draw_cursor ;¯¥à¥à¨á®¢ª  ªãàá®à 
call tl_draw_caption_cur_pos
.no_redraw:
cmp tl_p_scroll,0 ;if not scrol struct
je @f
call tl_get_rows_count ;eax = rows count
mov ebx,tl_p_scroll
add eax,dword[ebx+sb_offs_position]
cmp tl_cur_pos,eax
jl @f
inc dword[ebx+sb_offs_position]
stdcall scroll_bar_vertical.draw,ebx
 
stdcall tl_draw,dword[tlist] ;¯®«­ ï ¯¥à¥à¨á®¢ª  ®ª­ 
jmp .no_redraw
@@:
mov edi,dword[tlist] ;restore edi
call tl_draw_cursor ;¯¥à¥à¨á®¢ª  ªãàá®à 
call tl_draw_caption_cur_pos
.no_redraw:
ret
endp
 
1675,37 → 1716,38
;¯¥à¥­¥á⨠ªãàá®à ­  1 áâà ­¨æã ¢ëè¥
align 4
proc tl_cur_page_up uses eax edi esi, tlist:dword
mov edi,dword[tlist]
mov edi,dword[tlist]
 
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
mov esi,tl_p_scroll
call tl_get_rows_count ;eax = rows count
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
 
cmp tl_cur_pos,0
jne @f
cmp dword[esi+sb_offs_position],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+sb_offs_position],eax
jl @f
sub dword[esi+sb_offs_position],eax
jmp .scroll
@@:
mov dword[esi+sb_offs_position],0
.scroll:
;¯¥à¥à¨á®¢ª¨ ®ª­  ¨ áªà®««¨­£ 
stdcall tl_draw, edi ;draw window
stdcall scroll_bar_vertical.draw, esi
.no_redraw:
mov esi,tl_p_scroll
call tl_get_rows_count ;eax = rows count
 
cmp tl_cur_pos,0
jne @f
cmp dword[esi+sb_offs_position],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+sb_offs_position],eax
jl @f
sub dword[esi+sb_offs_position],eax
jmp .scroll
@@:
mov dword[esi+sb_offs_position],0
.scroll:
;¯¥à¥à¨á®¢ª¨ ®ª­  ¨ áªà®««¨­£ 
stdcall tl_draw, edi ;draw window
stdcall scroll_bar_vertical.draw, esi
.no_redraw:
ret
endp
 
1715,45 → 1757,49
;eax - ª®«-¢® áâப ­  áâà ­¨æ¥
;ebx - ¬ ªá. ¯®§¨æ¨ï ªãàá®à 
;ecx - ¬ ªá. ¯®§¨æ¨ï áªà®««¨­£ 
mov edi,dword[tlist]
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
mov esi,tl_p_scroll
call tl_get_node_count ;eax = node count
mov ebx,eax
call tl_get_rows_count ;eax = rows count
mov edi,dword[tlist]
 
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_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
 
cmp tl_cur_pos,ebx ;ªãàá®à ¢­¨§ã ?
jl @f
cmp dword[esi+sb_offs_position],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+sb_offs_position],eax ;¯¥à¥¬¥é ¥¬ áªà®««¨­£
cmp dword[esi+sb_offs_position],ecx
jl @f
mov dword[esi+sb_offs_position],ecx
@@:
mov esi,tl_p_scroll
call tl_get_node_count ;eax = node count
mov ebx,eax
call tl_get_rows_count ;eax = rows count
 
;¯¥à¥à¨á®¢ª¨ ®ª­  ¨ áªà®««¨­£ 
stdcall tl_draw, edi ;draw window
stdcall scroll_bar_vertical.draw, esi
.no_redraw:
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+sb_offs_position],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+sb_offs_position],eax ;¯¥à¥¬¥é ¥¬ áªà®««¨­£
cmp dword[esi+sb_offs_position],ecx
jl @f
mov dword[esi+sb_offs_position],ecx
@@:
 
;¯¥à¥à¨á®¢ª¨ ®ª­  ¨ áªà®««¨­£ 
stdcall tl_draw, edi ;draw window
stdcall scroll_bar_vertical.draw, esi
.no_redraw:
ret
endp
 
1933,6 → 1979,7
;ecx = ?
align 4
tl_node_move_po8:
; push ecx
mov ecx,edx ;save node pointer
call tl_move_perv
mov dword[edx+8],ebx
1946,6 → 1993,7
call tl_move_next
mov dword[edx+4],eax
mov edx,ecx ;restore node pointer
; pop ecx
 
;+4 perv
mov eax,dword[edx+4]
2236,17 → 2284,17
 
align 4
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
call .str ;¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ®ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ®ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
}