Subversion Repositories Kolibri OS

Compare Revisions

Regard 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
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
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
 
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 ;í«¥¬¥­â ­¥ ¢ 䮪ãá¥
404,6 → 407,7
mov eax,tl_ch_tim
cmp edx,ecx
jle @f
 
;if(node[i].tc>ch_tim){ // ¥á«¨ ᮧ¤ ­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
cmp dword[edx+12],eax
jle .no_u1
421,6 → 425,7
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; // ¥á«¨ 㤠«¥­¨¥ ᨬ¢®«  ¡ë«® ®â¬¥­¥­®
428,12 → 433,19
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
 
;¢ë¢®¤ ᯨ᪠ ­  íªà ­
510,7 → 522,8
jle .end_draw
inc eax
cmp eax,dword[esi+sb_offs_position]
jl @b
jge .end_c1
jmp @b
.end_c1:
 
xor eax,eax
531,6 → 544,7
cmp edi,0 ;¤«ï ⮣® çâ®-¡ë ¥£® ­¥ ¯à¨è«®áì à¨á®¢ âì ¢ ¯®«ì§®¢ â¥«ì᪮© ¯à®£à ¬¬¥
je .end_draw ;¥á«¨ ­¥â áªà®««¨­£  ¢ë室¨¬
stdcall scroll_bar_vertical.draw, edi
 
.end_draw:
popad
ret
840,6 → 854,7
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
860,7 → 875,10
jge @f
mov cx,si ;¥á«¨ ªãàá®à ¢¨¤¥­ ç áâ¨ç­® (¯®¯ « ­  ­¨¦­îî £à ­¨æã)
@@:
mcall 13,,,tl_col_bkg ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
 
mov edx,tl_col_bkg
mcall 13 ;à¨á㥬 ¯à®á⮩ ¯àאַ㣮«ì­¨ª á ä®­®¢ë¬ 梥⮬
 
.end_f:
ret
endp
885,7 → 903,7
 
;à¨áã¥â 㧥« á: ª à⨭ª®©, ¯®¤¯¨áìî, ¨ª®­ª®© ®âªàëâ¨ï/§ ªàëâ¨ï ¨ «¨­¨ï¬¨ ª த¨â. 㧫ã
;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 ;¥á«¨ 㧥« ¢­¨§ã ¨ ¥£® ¢®®¡é¥ ­¥ ¢¨¤­®
990,7 → 1007,8
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
mov edx,tl_col_txt
mcall 13 ;draw minus rect, if not system icons
jmp @f
.draw_img_s:
mov ecx,esi ;load ecx
1024,6 → 1042,9
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
1041,9 → 1062,11
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
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
1053,6 → 1076,8
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
1064,16 → 1089,18
 
;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
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:
1122,8 → 1149,9
sub esi,0x10000 ;㬥­ìè ¥¬ áç¥â稪 ¨ª®­®ª
jmp .cycle1
@@:
pop esi
pop edx ecx ebx eax
ret
endp
 
;input:
; edi = pointer to TreeInfo struct
1148,11 → 1176,14
; edx = pointer to some node struct
; edi = pointer to TreeInfo struct
align 4
proc tl_draw_node_caption uses ebx ecx edx esi
tl_draw_node_caption:
push 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
1174,10 → 1205,11
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
1185,8 → 1217,10
;output:
; esi = text len
align 4
proc tl_get_draw_text_len uses eax ecx edx
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
1195,6 → 1229,7
xor edx,edx
mov ecx,6 ;è¨à¨­  á¨á⥬­®£® èà¨äâ 
div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥
 
cmp esi,eax
jl @f
mov esi,eax ;¥á«¨ ¤«¨­­  ⥪áâ  ¬¥­ìè¥, 祬 ¢á¥ ¬¥áâ® ¯®¤ áâபã
1202,8 → 1237,8
.text_null:
xor esi,esi
@@:
pop edx ecx eax
ret
endp
 
;input:
; esi = pointer to string
1256,6 → 1291,7
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
1266,7 → 1302,7
.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;
mov dword[edx+4], eax ;node[i].perv=po_t;
;*** copy node data ***
push esi
xor ecx,ecx
1310,6 → 1346,7
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
1339,6 → 1376,7
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
1383,6 → 1421,7
dec esi
mov byte[esi],0 ;®¡­ã«ï¥¬ ¯®á«¥¤­¨© ᨬ¢®« ¯®¤¯¨á¨, çâ®-¡ë ­¥ £«î稫® ¥á«¨ ¯®«ì§®¢ â¥«ì § ¤ « ­¥¯à ¢¨«ì­ãî áâàãªâãàã
.no_text_data:
 
@@:
ret
endp
1569,6 → 1608,7
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
1585,6 → 1625,7
jl @f
inc dword[ebx+sb_offs_position]
stdcall scroll_bar_vertical.draw,ebx
 
stdcall tl_draw,dword[tlist] ;¯®«­ ï ¯¥à¥à¨á®¢ª  ®ª­ 
jmp .no_redraw
@@:
1679,6 → 1720,7
 
cmp tl_p_scroll,0 ;¥á«¨ ¥áâì 㪠§ â¥«ì ­  áªà®««¨­£
je .no_redraw
 
mov esi,tl_p_scroll
call tl_get_rows_count ;eax = rows count
 
1716,8 → 1758,10
;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
1739,11 → 1783,13
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
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]
2243,7 → 2291,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 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥