forked from KolibriOS/kolibrios
optimize TreeList:
1) 'tl_mouse' add mouse in child scroll bar 2) optimize some functions git-svn-id: svn://kolibrios.org@1309 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
421700a8b0
commit
caf224ae96
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
@ -1,6 +1,6 @@
|
||||
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
|
||||
; ýëåìåíò TreeList äëÿ Kolibri OS
|
||||
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 2.12.2009 IgorA
|
||||
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 8.12.2009 IgorA
|
||||
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@ 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] ;óêàçàòåëü íà ôóíêöèþ ïåðåðèñîâûâàþùóþ ñêðîëëèíã
|
||||
tl_on_press equ dword[edi+96] ;óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ âûçûâàåòñÿ ïðè íàæàòèè Enter
|
||||
|
||||
;êîíñòàíòû ñòèëÿ
|
||||
@ -59,7 +58,7 @@ tl_save_load_heder_size equ 26 ;
|
||||
|
||||
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,\
|
||||
info_capt_len,el_focus, p_scrol,p_sb_draw,on_press {
|
||||
info_capt_len,el_focus, p_scrol,on_press {
|
||||
.data_info dd 0
|
||||
.info_size dw info_size
|
||||
.info_max_count dd info_max_count
|
||||
@ -85,7 +84,7 @@ struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
|
||||
.info_capt_len dw info_capt_len
|
||||
.el_focus dd el_focus
|
||||
.p_scrol dd p_scrol
|
||||
.p_sb_draw dd p_sb_draw
|
||||
rb 4
|
||||
.on_activate dd 0
|
||||
.on_press dd on_press
|
||||
}
|
||||
@ -341,7 +340,7 @@ tl_mouse: ;
|
||||
add ebx,tl_box_width
|
||||
shl ebx,16
|
||||
cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
|
||||
jg .no_in_wnd
|
||||
jg .test_scroll ;.no_in_wnd
|
||||
|
||||
mov ebx,tl_box_top
|
||||
add ebx,tl_box_height
|
||||
@ -421,11 +420,40 @@ tl_mouse: ;
|
||||
call tl_draw_cursor ;ïåðåðèñîâêà êóðñîðà
|
||||
call tl_draw_caption_cur_pos
|
||||
jmp .no_draw
|
||||
;--- mouse event for children scrollbar ----------------------------------------
|
||||
.test_scroll:
|
||||
mov edx,tl_p_scrol
|
||||
cmp edx,0
|
||||
je .no_in_wnd ;ïîëüçîâàòåëü íå ñîçäàë äî÷åðíåãî ñêðîëëèíãà
|
||||
shr ebx,16
|
||||
add bx,word[edx] ;+0 .size_x
|
||||
shl ebx,16
|
||||
cmp eax,ebx ;ïðàâàÿ ãðàíèöà îêíà
|
||||
jg .no_in_wnd
|
||||
|
||||
mov eax,dword[edx+16] ;+16 .max_area
|
||||
cmp eax,dword[edx+20] ;+20 .cur_area
|
||||
jbe .no_in_wnd ;âñå óçëû ïîïàäàþò â îêíî ñêðîëëèíãà
|
||||
push dword edx
|
||||
call scroll_bar_vertical.mouse ;scrollbar_ver_mouse
|
||||
|
||||
cmp dword[edx+40],0 ;+40 .redraw
|
||||
je @f
|
||||
mov dword[edx+40],0 ;+40 .redraw
|
||||
push dword edi
|
||||
call tl_draw ;ïðîèçîøëè èçìåíåíèÿ ñêðîëëèíãà
|
||||
@@:
|
||||
cmp dword[edx+46],0 ;+46 .delta2
|
||||
jne .no_draw ;ïîïàëè íà ñêðîëëèíã - íå ñíèìàåì ôîêóñ ñ TreeList
|
||||
;-------------------------------------------------------------------------------
|
||||
.no_in_wnd: ;íå ïîïàëè â îêíî - ïîòåðÿ ôîêóñà (ïðè óñëîâèè ÷òî ôîêóñ áûë íà äàííîì ýåëåìåíòå)
|
||||
mov ebx,tl_el_focus
|
||||
cmp dword[ebx],edi
|
||||
jne .no_draw ;ýëåìåíò íå â ôîêóñå
|
||||
mov dword[ebx],0 ;reset focus
|
||||
mov esi,tl_box_top
|
||||
add esi,tl_box_height ;esi = coord bottom border
|
||||
call tl_draw_cursor ;ðèñóåì êóðñîð ñ ïîòåðÿíûì ôîêóñîì
|
||||
.no_draw:
|
||||
|
||||
pop esi edi edx ecx ebx eax
|
||||
@ -558,6 +586,20 @@ tl_draw: ;
|
||||
|
||||
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 eax,4 ;draw text captions
|
||||
mov ebx,tl_box_left
|
||||
shl ebx,16
|
||||
@ -574,37 +616,8 @@ tl_draw: ;
|
||||
add ebx,tl_box_top
|
||||
lea edx,[txt_capt_otm]
|
||||
int 0x40
|
||||
|
||||
mov eax,47 ;draw
|
||||
mov ebx,0x40000
|
||||
mov ecx,tl_cur_pos
|
||||
inc ecx
|
||||
mov edx,tl_box_left
|
||||
shl edx,16
|
||||
add edx,50*65536+3
|
||||
add edx,tl_box_top
|
||||
mov esi,tl_col_txt
|
||||
int 0x40
|
||||
mov ecx,tl_tim_undo
|
||||
mov edx,tl_box_left
|
||||
shl edx,16
|
||||
add edx,140*65536+3
|
||||
add edx,tl_box_top
|
||||
mov esi,tl_col_txt
|
||||
int 0x40
|
||||
@@:
|
||||
|
||||
;---debug---
|
||||
;mov ecx,0
|
||||
;@@:
|
||||
;call DebugSymb
|
||||
;inc ecx
|
||||
;cmp ecx,10
|
||||
;jge @f
|
||||
;jmp @b
|
||||
;@@:
|
||||
;---debug---
|
||||
|
||||
;cycle to nodes
|
||||
xor eax,eax
|
||||
mov edx,tl_data_nodes
|
||||
@ -725,15 +738,12 @@ tl_iterat_next_all:
|
||||
; edi = pointer to 'TreeList' struct
|
||||
align 4
|
||||
tl_iterat_perv:
|
||||
push bx
|
||||
mov bl,0x7f
|
||||
cmp byte[edx+3],1
|
||||
jne @f
|
||||
mov bl,byte[edx+2]
|
||||
@@:
|
||||
push eax
|
||||
|
||||
; mov bl,byte[edx+2]
|
||||
|
||||
cmp tl_tim_undo,0
|
||||
je .else
|
||||
je .beg1
|
||||
|
||||
push eax
|
||||
.beg0:
|
||||
@ -743,23 +753,43 @@ tl_iterat_perv:
|
||||
call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
|
||||
cmp al,1
|
||||
je .beg0
|
||||
cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
|
||||
jl .beg0
|
||||
@@:
|
||||
pop eax
|
||||
pop bx
|
||||
ret
|
||||
|
||||
.else:
|
||||
.beg1:
|
||||
call tl_move_perv
|
||||
cmp edx,ecx
|
||||
jle .endif
|
||||
jle @f
|
||||
cmp dword[edx+16],0 ;td = 'time delete' -> ïðîïóñê óäàëåííûõ
|
||||
jne .else
|
||||
cmp bl,byte[edx+2] ;ïðîïóñê çàêðûòûõ
|
||||
jl .else
|
||||
.endif:
|
||||
pop bx
|
||||
jne .beg1
|
||||
|
||||
@@:
|
||||
call tl_move_max_clo_par
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
;input:
|
||||
; edx = pointer to some node struct
|
||||
; edi = pointer to 'TreeList' struct
|
||||
;output:
|
||||
; edx = pointer closed parent node with maximum level
|
||||
align 4
|
||||
tl_move_max_clo_par: ;íàõîäèò ðîäèòåëüñêèé çàêðûòûé óçåë ìàêñèìàëüíîãî óðîâíÿ
|
||||
push 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
|
||||
pop ebx eax
|
||||
ret
|
||||
|
||||
;input:
|
||||
@ -786,6 +816,36 @@ tl_move_perv:
|
||||
add edx,tl_data_nodes
|
||||
ret
|
||||
|
||||
;input:
|
||||
; ecx =
|
||||
; edx = pointer to some node struct
|
||||
; edi = pointer to 'TreeList' struct
|
||||
;output:
|
||||
; edx = pointer to parent node struct
|
||||
align 4
|
||||
tl_move_par: ;ïåðåäâèãàåìñÿ íà ðîäèòåëüñêèé óçåë, åñëè òàêîãî íåò, òî îñòàâëÿåì ñòàðîå çíà÷åíèå óêàçàòåëÿ
|
||||
cmp byte[edx+2],0
|
||||
je .end_f ;óçåë 0-ãî óðîâíÿ íå ìîæåò áûòü äî÷åðíèì
|
||||
push eax ebx esi
|
||||
mov esi,edx ;copy node pointer (edx)
|
||||
mov bl,byte[edx+2]
|
||||
@@:
|
||||
call tl_move_perv
|
||||
cmp edx,ecx
|
||||
jle @f ;âñå âûøå ñòîÿùèå óçëû íå ðîäèòåëüñêèå
|
||||
call tl_node_not_vis ;ïðîïóñê óäàëåííûõ è îòìåíåííûõ
|
||||
cmp al,1
|
||||
je @b
|
||||
cmp byte[edx+2],bl
|
||||
jl .end_0 ;óäà÷íî íàøëè ðîäèòåëüñêèé óçåë
|
||||
jmp @b
|
||||
@@:
|
||||
mov esi,ebx ;restore node pointer
|
||||
.end_0:
|
||||
pop esi ebx eax
|
||||
.end_f:
|
||||
ret
|
||||
|
||||
;input:
|
||||
; edx = pointer to symbol struct
|
||||
; edi = pointer to 'TreeList' struct
|
||||
@ -855,15 +915,28 @@ tl_draw_cursor: ;
|
||||
@@:
|
||||
mov ebx,tl_data_img_sys
|
||||
imul ax,tl_img_cy
|
||||
mov cx,tl_img_cx
|
||||
shl ecx,16
|
||||
mov cx,tl_img_cy
|
||||
mov edx,tl_box_left
|
||||
shl edx,16
|
||||
mov dx,ax
|
||||
add edx,tl_box_top
|
||||
add dx,tl_capt_cy
|
||||
|
||||
mov ecx,tl_el_focus ;ïðîâåðÿåì â ôîêóñå ýëåìåíò èëè íåò
|
||||
cmp dword[ecx],edi
|
||||
je .focus
|
||||
xor eax,eax
|
||||
xor ecx,ecx
|
||||
mov cx,tl_img_cx
|
||||
mov ax,tl_img_cy
|
||||
imul eax,ecx
|
||||
imul eax,4*3 ;4=icon index 3=rgb
|
||||
add ebx,eax
|
||||
.focus:
|
||||
|
||||
mov cx,tl_img_cx
|
||||
shl ecx,16
|
||||
mov cx,tl_img_cy
|
||||
|
||||
;crop image if on the border
|
||||
cmp si,dx ;åñëè êóðñîð âíèçó è åãî âîîáùå íå âèäíî
|
||||
jl .end_f
|
||||
@ -1020,7 +1093,7 @@ tl_draw_node:
|
||||
bt tl_style,1
|
||||
jae .end_draw
|
||||
call tl_draw_node_icon_par_lin
|
||||
|
||||
call tl_draw_node_icon_par_lin_up
|
||||
.end_draw:
|
||||
pop esi edx ecx ebx eax
|
||||
ret
|
||||
@ -1068,6 +1141,7 @@ tl_draw_node_icon_opn_clo: ;
|
||||
ret
|
||||
|
||||
;input:
|
||||
; al = óðîâåíü ýëåìåíòà
|
||||
;...
|
||||
align 4
|
||||
tl_draw_node_icon_par_lin:
|
||||
@ -1101,7 +1175,7 @@ tl_draw_node_icon_par_lin:
|
||||
int 0x40 ;draw minus rect, if not system icons
|
||||
jmp @f
|
||||
.draw_img_s:
|
||||
mov ecx,esi ;load ecx
|
||||
; mov ecx,esi ;load ecx
|
||||
mov edx,ebx
|
||||
ror ecx,16
|
||||
mov dx,cx
|
||||
@ -1122,6 +1196,72 @@ tl_draw_node_icon_par_lin:
|
||||
.close:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
;icon:
|
||||
; al = óðîâåíü ýëåìåíòà
|
||||
;...
|
||||
align 4
|
||||
tl_draw_node_icon_par_lin_up:
|
||||
push 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:
|
||||
call tl_iterat_perv ;get perv visible item
|
||||
cmp edx,ecx
|
||||
jle .cycle1 ;if begin of list
|
||||
|
||||
cmp byte[edx+2],al
|
||||
jle .cycle1 ;óðîâåíü âåðõíåãî ýëåìåíòà íå òðåáóåò ïðîðèñîâêè
|
||||
inc si
|
||||
jmp .cycle0
|
||||
.cycle1:
|
||||
cmp si,0 ;si = êîë-âî èêîíîê ëèíèè êîòîðûå íóæíî íàðèñîâàòü ñâåðõó
|
||||
je @f
|
||||
shl esi,16
|
||||
|
||||
pop ecx ;esi->ecx
|
||||
push ecx ;save esi
|
||||
|
||||
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
|
||||
;imul ebx,1
|
||||
add ebx,tl_data_img_sys
|
||||
|
||||
add esi,tl_box_top
|
||||
add si,tl_capt_cy ;si = âåðõíÿÿ ãðàíèöà îêíà
|
||||
mov eax,7
|
||||
;---------
|
||||
.cycle2:
|
||||
sub dx,tl_img_cy ;ïîäíèìàåì êîîðäèíàòó y ââåðõ
|
||||
cmp dx,si
|
||||
jl @f
|
||||
; int 0x40 ;draw line icon
|
||||
cmp esi,0x10000
|
||||
jl @f
|
||||
int 0x40 ;draw line icon
|
||||
sub esi,0x10000 ;óìåíüøàåì ñ÷åò÷èê èêîíîê
|
||||
jmp .cycle2
|
||||
@@:
|
||||
pop esi edx ecx ebx eax
|
||||
ret
|
||||
|
||||
;input:
|
||||
; edi = pointer to TreeInfo struct
|
||||
;output:
|
||||
@ -1353,8 +1493,7 @@ tb_scrol_resize:
|
||||
mov dword[edx+20],eax ;+20 .cur_area
|
||||
mov dword[edx+16],ecx ;+16 .max_area
|
||||
push dword edx ;pointer to scroll struct
|
||||
mov edx,tl_sb_draw ;pointer to scroll draw function
|
||||
call dword[edx]
|
||||
call scroll_bar_vertical.draw
|
||||
@@:
|
||||
pop edx ecx eax
|
||||
ret
|
||||
@ -1587,8 +1726,7 @@ tl_cur_beg: ;
|
||||
mov dword[edi+24],0
|
||||
push dword edi
|
||||
mov edi,dword[ebp+8]
|
||||
mov edi,tl_sb_draw
|
||||
call dword[edi]
|
||||
call scroll_bar_vertical.draw
|
||||
@@:
|
||||
pop edi
|
||||
|
||||
@ -1619,8 +1757,7 @@ tl_cur_next: ;
|
||||
jl @f
|
||||
inc dword[ebx+24] ;.position +24
|
||||
push dword ebx
|
||||
mov edi,tl_sb_draw ;ïåðåðèñîâêà ñêðîëëèíãà
|
||||
call dword[edi]
|
||||
call scroll_bar_vertical.draw
|
||||
|
||||
mov edi,dword[ebp+8] ;restore edi
|
||||
push dword edi
|
||||
@ -1704,8 +1841,7 @@ tl_cur_perv: ;
|
||||
dec dword[eax+24]
|
||||
push dword eax
|
||||
mov edi,dword[ebp+8]
|
||||
mov edi,tl_sb_draw ;.redraw
|
||||
call dword[edi]
|
||||
call scroll_bar_vertical.draw
|
||||
mov edi,dword[ebp+8] ;restore edi
|
||||
push dword edi
|
||||
call tl_draw ;ïîëíàÿ ïåðåðèñîâêà îêíà
|
||||
@ -1758,9 +1894,7 @@ tl_cur_page_up: ;
|
||||
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]
|
||||
call scroll_bar_vertical.draw
|
||||
.no_redraw:
|
||||
pop esi edi eax
|
||||
pop ebp
|
||||
@ -1817,9 +1951,7 @@ tl_cur_page_down: ;
|
||||
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]
|
||||
call scroll_bar_vertical.draw
|
||||
.no_redraw:
|
||||
pop esi edi ecx ebx eax
|
||||
pop ebp
|
||||
@ -2043,18 +2175,25 @@ tl_draw_caption_cur_pos:
|
||||
cmp tl_capt_cy,9 ;9 - minimum caption height
|
||||
jl @f
|
||||
push eax ebx ecx edx edi esi
|
||||
mov eax,47 ;draw
|
||||
mov ebx,0x40000
|
||||
mov ecx,tl_cur_pos
|
||||
inc ecx
|
||||
mov edx,tl_box_left
|
||||
shl edx,16
|
||||
add edx,50*65536+3
|
||||
add edx,tl_box_top
|
||||
mov esi,tl_col_txt
|
||||
or esi,0x40000000 ;çàêðàøèâàòü ôîí öâåòîì edi
|
||||
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,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,0xc0000000 ;0x40000000 çàêðàøèâàòü ôîí öâåòîì edi
|
||||
lea edx,[txt_capt_cur]
|
||||
mov edi,tl_col_zag
|
||||
int 0x40
|
||||
|
||||
pop esi edi edx ecx ebx eax
|
||||
@@:
|
||||
ret
|
||||
@ -2100,27 +2239,29 @@ tl_save_mem:
|
||||
cmp ecx,dword[ebp+8] ;ecx = element memory size
|
||||
jg .err_mem_size
|
||||
|
||||
;save tree params
|
||||
;save tree params (in header)
|
||||
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 dword[esi+10],eax
|
||||
|
||||
mov eax,tl_cur_pos
|
||||
mov dword[esi],eax
|
||||
add esi,4
|
||||
mov dword[esi+14],eax
|
||||
|
||||
mov ax,tl_info_capt_offs
|
||||
mov word[esi],ax
|
||||
add esi,2
|
||||
mov word[esi+18],ax
|
||||
|
||||
mov ax,tl_info_capt_len
|
||||
mov word[esi],ax
|
||||
add esi,2+4
|
||||
mov word[esi+20],ax
|
||||
|
||||
;copy scroll position
|
||||
mov edx,tl_p_scrol
|
||||
mov eax,dword[edx+24] ;+24 .position
|
||||
mov dword[esi+22],eax
|
||||
|
||||
add esi,tl_save_load_heder_size ;add header size
|
||||
|
||||
;cycle to nodes
|
||||
mov edx,tl_data_nodes
|
||||
@ -2139,9 +2280,6 @@ 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
|
||||
@ -2218,6 +2356,7 @@ tl_load_mem:
|
||||
mov ecx,dword[esi+6] ;count nodes
|
||||
cmp ecx,1
|
||||
jl .end_f
|
||||
mov edx,esi ;save header pointer
|
||||
add esi,tl_save_load_heder_size
|
||||
|
||||
@@:
|
||||
@ -2236,6 +2375,18 @@ call tl_cur_next
|
||||
add esi,ebx
|
||||
loop @b
|
||||
|
||||
bt word[ebp+18],1 ;load in add mode
|
||||
jc .no_tree
|
||||
mov eax,dword[edx+14] ;set cursor pos
|
||||
mov tl_cur_pos,eax
|
||||
mov eax,dword[edx+22] ;set scroll pos
|
||||
mov ebx,tl_p_scrol
|
||||
cmp ebx,0
|
||||
je .end_f
|
||||
mov dword[ebx+24],eax ;+24 .position
|
||||
push dword ebx ;pointer to scroll struct
|
||||
call scroll_bar_vertical.draw
|
||||
|
||||
jmp .end_f
|
||||
.no_tree:
|
||||
mov dword[ebp+20],tl_err_load_caption
|
||||
@ -2258,6 +2409,39 @@ add esi,ebx
|
||||
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 '‘âப ',0
|
||||
txt_capt_otm db 'Žâ¬¥ë ',0
|
||||
|
||||
;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
|
||||
;input:
|
||||
; eax = value
|
||||
; edi = string buffer
|
||||
;output:
|
||||
; edi =
|
||||
align 4
|
||||
tl_convert_to_str:
|
||||
pushad
|
||||
mov dword[edi+1],0x20202020
|
||||
call .str
|
||||
popad
|
||||
ret
|
||||
|
||||
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 ;ïîëîæèòü â ñòåê
|
||||
;dec edi ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
|
||||
call .str;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
|
||||
pop eax
|
||||
@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
|
||||
;sbb al,$69 ;- ÷åñòíî äàííàÿ èíñòðóêöèÿ ìåíÿ çàñòàâëÿåò çàäóìàòüñÿ ò.å. ÿ íå çíàþ êàê ýòî ðàáîòàåò
|
||||
;das ;ïîñëå äàííîé êîìàíäû êàê áû ïðîèñõîäèò óìåíüøåíèå al íà 66h (â êíèãå íàïèñàíî äðóãîå)
|
||||
or al,0x30 ;äàííàÿ êîìàíäà êîðî÷å ÷åì äâå âûøå
|
||||
stosb ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
|
||||
ret ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ table { font-size: 15px; }
|
||||
<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,\
|
||||
info_capt_len,el_focus, p_scrol,p_sb_draw,on_press {
|
||||
info_capt_len,el_focus, p_scrol,on_press {
|
||||
.data_info dd 0
|
||||
.info_size dw info_size
|
||||
.info_max_count dd info_max_count
|
||||
@ -226,7 +226,7 @@ table { font-size: 15px; }
|
||||
.info_capt_len dw info_capt_len
|
||||
.el_focus dd el_focus
|
||||
.p_scrol dd p_scrol
|
||||
.p_sb_draw dd p_sb_draw
|
||||
rb 4
|
||||
.on_activate dd 0
|
||||
.on_press dd on_press
|
||||
}</pre>
|
||||
@ -239,13 +239,12 @@ table { font-size: 15px; }
|
||||
<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>Ïðèìåð ñîçäàíèÿ ñòðóêòóðû:</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,\
|
||||
0,el_focus, wScr,scrollbar_ver_draw,fun_on_enter</pre>
|
||||
0x8080ff,0x0000ff,0xffffff, 10,35,200-16,285, 14,4,0,\
|
||||
el_focus, wScr,fun_on_enter</pre>
|
||||
|
||||
<h1><a name="tree_list_styles">Ñòèëè ýëåìåíòà</a></h1>
|
||||
<h2>tl_key_no_edit</h2>
|
||||
@ -256,6 +255,6 @@ table { font-size: 15px; }
|
||||
<p>Ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå óçëû îäíîãî óðîâíÿ).</p>
|
||||
|
||||
<hr>
|
||||
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü ïîñëåäíèé ðàç 2.12.09.</p>
|
||||
<p>Äîêóìåíòàöèÿ îáíîâëÿëàñü ïîñëåäíèé ðàç 5.12.09.</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user