Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5947 → Rev 5948

/programs/develop/libraries/box_lib/trunk/tree_list.mac
1,6 → 1,6
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
; í«¥¬¥­â TreeList ¤«ï Kolibri OS
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 14.11.2015 IgorA
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 03.12.2015 IgorA
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
 
 
63,8 → 63,7
 
;®ç¨á⪠ ¯ ¬ïâ¨ í«¥¬¥­â  (¤¥áâàãªâ®à)
align 4
proc tl_data_clear uses edi, tlist:dword
;uses eax ???
proc tl_data_clear uses eax edi, tlist:dword
mov edi,dword[tlist]
cmp tl_data_img,0
je @f
190,7 → 189,6
shl ebx,16
cmp eax,ebx ;«¥¢ ï £à ­¨æ  ®ª­ 
jl .no_in_wnd ;.test_scroll ­¥ ¯à¨¬¥­ï¥¬
 
shr ebx,16
add ebx,tl_box_width
shl ebx,16
231,7 → 229,7
dec ecx
jnz @r
jmp .mouse_next
;----------------------------------------
;------------------------------------------------
.decr: ;¢¥à⨪ «ì­ ï ¯à®ªàã⪠ ®âà¨æ â¥«ì­ ï
mov bx,ax ;ax = mouse scroll data vertical
jmp @f
245,7 → 243,7
stdcall tl_cur_perv, edi
dec ecx
jnz @r
;---------------------------------------------------
;------------------------------------------------
.mouse_next:
pop ebx eax
 
351,7 → 349,6
mcall 37,2 ;¯à®¢¥à塞 ­ ¦ â®áâì «î¡ëå ª­®¯®ª
cmp eax,0 ;­¨ç¥£® ­¥ ­ ¦ «¨ eax=0
je .no_draw
 
mov ebx,tl_el_focus
cmp dword[ebx],edi
jne .no_draw ;í«¥¬¥­â ­¥ ¢ 䮪ãá¥
407,7 → 404,6
mov eax,tl_ch_tim
cmp edx,ecx
jle @f
 
;if(node[i].tc>ch_tim){ // ¥á«¨ ᮧ¤ ­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
cmp dword[edx+12],eax
jle .no_u1
425,7 → 421,6
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; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
433,19 → 428,12
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
 
;¢ë¢®¤ ᯨ᪠ ­  íªà ­
522,8 → 510,7
jle .end_draw
inc eax
cmp eax,dword[esi+sb_offs_position]
jge .end_c1
jmp @b
jl @b
.end_c1:
 
xor eax,eax
544,7 → 531,6
cmp edi,0 ;¤«ï ⮣® çâ®-¡ë ¥£® ­¥ ¯à¨è«®áì à¨á®¢ âì ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
je .end_draw ;¥á«¨ ­¥â áªà®««¨­£  ¢ë室¨¬
stdcall scroll_bar_vertical.draw, edi
 
.end_draw:
popad
ret
854,7 → 840,6
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
875,10 → 860,7
jge @f
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥­ ç áâ¨ç­® (¯®¯ « ­  ­¨¦­îî £à ­¨æã)
@@:
 
mov edx,tl_col_bkg
mcall 13 ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
 
mcall 13,,,tl_col_bkg ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
.end_f:
ret
endp
903,7 → 885,7
 
;à¨áã¥â 㧥« á: ª à⨭ª®©, ¯®¤¯¨áìî, ¨ª®­ª®© ®âªàëâ¨ï/§ ªàëâ¨ï ¨ «¨­¨ï¬¨ ª த¨â. 㧫ã
;input:
; eax = node position
; eax = node position (0, ..., max_nodes-scroll_pos) ­¥ ¤® tl_box_height/tl_img_cy
; edx = pointer to some node struct
; edi = pointer to 'TreeList' struct
; esi = coord of bottom border
923,8 → 905,9
xor ecx,ecx
mov cx,tl_img_cy
imul ecx,eax
add cx,tl_capt_cy
jc .end_draw ;ª®£¤  ¬­®£® 㧫®¢, â® ¬®¦¥â ¡ëâì ¯¥à¥¯®«­¥­¨¥ ª®®à¤¨­ âë cx
add ecx,tl_box_top
add cx,tl_capt_cy
 
;crop image if on the border
cmp esi,ecx ;¥á«¨ 㧥« ¢­¨§ã ¨ ¥£® ¢®®¡é¥ ­¥ ¢¨¤­®
1007,8 → 990,7
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
mcall 13,,,tl_col_txt ;draw minus rect, if not system icons
jmp @f
.draw_img_s:
mov ecx,esi ;load ecx
1042,9 → 1024,6
push eax ebx ecx edx esi
cmp al,0
je @f
; dec al
; call tl_iterat_perv ;get perv visible item
 
call tl_iterat_next_all ;get next visible item
cmp edx,ecx
jle .line3 ;if end of list
1062,11 → 1041,9
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
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
1076,8 → 1053,6
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
1089,18 → 1064,16
 
;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
tl_draw_node_icon_par_lin_up:
push eax ebx ecx edx
push esi
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 ¡ã¤¥¬ ­ áç¨â뢠âì ª®«-¢® ¨ª®­®ª, ­ã¦­ëå ¤«ï ¯à®à¨á®¢ª¨ «¨­¨¨
;--- 横« ¤«ï ¢ëç¨á«¥­¨ï ª®««¨ç¥á⢠ ¢¥à⨪ «ì­ëå «¨­¨© ---
.cycle0:
1149,9 → 1122,8
sub esi,0x10000 ;㬥­ìè ¥¬ áç¥â稪 ¨ª®­®ª
jmp .cycle1
@@:
pop esi
pop edx ecx ebx eax
ret
endp
 
;input:
; edi = pointer to TreeInfo struct
1176,14 → 1148,11
; edx = pointer to some node struct
; edi = pointer to TreeInfo struct
align 4
tl_draw_node_caption:
push ebx ecx edx esi
 
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
1205,11 → 1174,10
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
endp
 
;input:
; eax = strlen
1217,10 → 1185,8
;output:
; esi = text len
align 4
tl_get_draw_text_len:
push eax ecx edx
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
1229,7 → 1195,6
xor edx,edx
mov ecx,6 ;è¨à¨­  á¨á⥬­®£® èà¨äâ 
div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥
 
cmp esi,eax
jl @f
mov esi,eax ;¥á«¨ ¤«¨­­  ⥪áâ  ¬¥­ìè¥, 祬 ¢á¥ ¬¥áâ® ¯®¤ áâபã
1237,8 → 1202,8
.text_null:
xor esi,esi
@@:
pop edx ecx eax
ret
endp
 
;input:
; esi = pointer to string
1291,7 → 1256,6
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
1302,7 → 1266,7
.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;
mov [edx+4],eax ;node[i].perv=po_t;
;*** copy node data ***
push esi
xor ecx,ecx
1346,7 → 1310,6
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
1376,7 → 1339,6
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
1421,7 → 1383,6
dec esi
mov byte[esi],0 ;®¡­ã«ï¥¬ ¯®á«¥¤­¨© ᨬ¢®« ¯®¤¯¨á¨, çâ®-¡ë ­¥ £«î稫® ¥á«¨ ¯®«ì§®¢ â¥«ì § ¤ « ­¥¯à ¢¨«ì­ãî áâàãªâãàã
.no_text_data:
 
@@:
ret
endp
1608,7 → 1569,6
proc tl_cur_next uses eax ebx edi esi, tlist:dword
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
1625,7 → 1585,6
jl @f
inc dword[ebx+sb_offs_position]
stdcall scroll_bar_vertical.draw,ebx
 
stdcall tl_draw,dword[tlist] ;¯®«­ ï ¯¥à¥à¨á®¢ª  ®ª­ 
jmp .no_redraw
@@:
1720,7 → 1679,6
 
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
 
mov esi,tl_p_scroll
call tl_get_rows_count ;eax = rows count
 
1758,10 → 1716,8
;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
1783,13 → 1739,11
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
1979,7 → 1933,6
;ecx = ?
align 4
tl_node_move_po8:
; push ecx
mov ecx,edx ;save node pointer
call tl_move_perv
mov dword[edx+8],ebx
1993,7 → 1946,6
call tl_move_next
mov dword[edx+4],eax
mov edx,ecx ;restore node pointer
; pop ecx
 
;+4 perv
mov eax,dword[edx+4]
2291,7 → 2243,7
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
call .str ;¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥