From 48f7d9c554ee0e6af2d66984b44e2709ca1ef4ad Mon Sep 17 00:00:00 2001 From: IgorA Date: Wed, 25 Nov 2009 11:01:46 +0000 Subject: [PATCH] add new functions: tl_node_move_up, tl_node_move_down. Small fix in redraw caption. git-svn-id: svn://kolibrios.org@1285 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/box_lib/trunk/box_lib.asm | 20 +- .../libraries/box_lib/trunk/tree_list.mac | 172 +++++++++++++++++- .../trunk/tree_list_doc/info_treelist.htm | 74 +++++--- 3 files changed, 229 insertions(+), 37 deletions(-) diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.asm b/programs/develop/libraries/box_lib/trunk/box_lib.asm index c3306635e6..5f79ff4f9e 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.asm +++ b/programs/develop/libraries/box_lib/trunk/box_lib.asm @@ -80,10 +80,12 @@ use_menu_bar ;-------------------------------------------------- align 16 use_file_browser + ;-------------------------------------------------- -;align 16 -init: -ret +;tree list +;-------------------------------------------------- +align 16 +use_tree_list ;;;;;;;;;;; ;;Data @@ -92,11 +94,9 @@ ret ;mouse_flag dd 0x0 ;-------------------------------------------------- -;tree list -;-------------------------------------------------- -align 16 -use_tree_list - +;align 16 +init: +ret align 16 @@ -157,6 +157,8 @@ EXPORTS: dd sz_tl_node_close_open,tl_node_close_open dd sz_tl_node_lev_inc,tl_node_lev_inc dd sz_tl_node_lev_dec,tl_node_lev_dec + dd sz_tl_node_move_up,tl_node_move_up + dd sz_tl_node_move_down, tl_node_move_down dd sz_tl_node_poi_get_info, tl_node_poi_get_info dd sz_tl_node_poi_get_next_info,tl_node_poi_get_next_info dd sz_tl_node_poi_get_data, tl_node_poi_get_data @@ -219,6 +221,8 @@ szVersion_FileBrowser db 'version_FileBrowser',0 sz_tl_node_close_open db 'tl_node_close_open',0 sz_tl_node_lev_inc db 'tl_node_lev_inc',0 sz_tl_node_lev_dec db 'tl_node_lev_dec',0 + sz_tl_node_move_up db 'tl_node_move_up',0 + sz_tl_node_move_down db 'tl_node_move_down',0 sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 diff --git a/programs/develop/libraries/box_lib/trunk/tree_list.mac b/programs/develop/libraries/box_lib/trunk/tree_list.mac index 90f435b1fe..1365480e5b 100644 --- a/programs/develop/libraries/box_lib/trunk/tree_list.mac +++ b/programs/develop/libraries/box_lib/trunk/tree_list.mac @@ -1,6 +1,6 @@ ; макрос для системной библиотеки box_lib.obj ; элемент TreeList для Kolibri OS -; файл последний раз изменялся 23.11.2009 IgorA +; файл последний раз изменялся 24.11.2009 IgorA ; на код применена GPL2 лицензия @@ -382,6 +382,7 @@ tl_mouse: ; mov esi,tl_box_top add esi,tl_box_height ;esi = coord bottom border call tl_draw_cursor ;перерисовка курсора + call tl_draw_caption_cur_pos jmp .no_draw .no_in_wnd: ;не попали в окно - потеря фокуса (при условии что фокус был на данном эелементе) mov ebx,tl_el_focus @@ -611,6 +612,8 @@ tl_draw: ; ; ecx = pointer to 1 node struct ; edx = pointer to some node struct ; edi = pointer to 'TreeList' struct +;output: +; edx = pointer to next node struct align 4 tl_iterat_next: push bx @@ -989,7 +992,7 @@ tl_draw_node: ; ecx = pointer to 1 node struct ;... align 4 -tl_draw_node_icon_opn_clo: +tl_draw_node_icon_opn_clo: ;рисует иконки открытого или закрытого узла (обычно + или -) push eax ebx ecx edx esi inc al call tl_iterat_next_all ;get next visible item @@ -1567,6 +1570,7 @@ tl_cur_next: ; @@: mov edi,dword[ebp+8] ;restore edi call tl_draw_cursor ;перерисовка курсора + call tl_draw_caption_cur_pos .no_redraw: pop esi edi ebx eax pop ebp @@ -1630,6 +1634,7 @@ tl_cur_perv: ; ;mov esi,tl_box_top ;add esi,tl_box_height ;esi = coord bottom border call tl_draw_cursor ;перерисовка курсора + call tl_draw_caption_cur_pos .no_redraw: pop esi edi eax pop ebp @@ -1706,6 +1711,169 @@ tl_node_lev_dec: ; pop ebp ret 4 +align 4 +tl_node_move_up: ;перемещаем узел вверх + push ebp + mov ebp,esp + push eax ebx ecx edx edi esi + mov edi,dword[ebp+8] + call tl_get_cur_node_index ;eax=po_t + cmp eax,2 + jl @f + 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 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 + call tl_iterat_perv ;edx = pointer to 1 node struct + call tl_get_node_index ;eax = index of 1 node struct + cmp edx,ecx + jle @f + cmp dword[edx+8],ebx ;+8 next + jne .po8 + call tl_node_move_po6 ;узлы идут подряд меняем 6 ссылок + jmp .cur_mov + .po8: + call tl_node_move_po8 ;узлы идут не подряд меняем 8 ссылок + .cur_mov: + push dword edi + call tl_cur_perv + push dword edi + call tl_draw + @@: + pop esi edi edx ecx ebx eax + pop ebp + ret 4 + +align 4 +tl_node_move_down: ;перемещаем узел вниз + push ebp + mov ebp,esp + push eax ebx ecx edx edi esi + mov edi,dword[ebp+8] + call tl_get_cur_node_index ;eax=po_t + cmp eax,2 + jl @f + 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 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 + call tl_iterat_next ;edx = pointer to 2 node struct + call tl_get_node_index ;eax = index of 2 node struct + cmp edx,ecx + jle @f + cmp dword[esi+8],eax ;+8 next + jne .po8 + xchg eax,ebx ;меняе порядок следования заменяемых узлов + xchg edx,esi + call tl_node_move_po6 ;узлы идут подряд меняем 6 ссылок + jmp .cur_mov + .po8: ;а тут порядок следования узлов не меняем + call tl_node_move_po8 ;узлы идут не подряд меняем 8 ссылок + .cur_mov: + push dword edi + call tl_cur_next + push dword edi + call tl_draw + @@: + pop esi edi edx ecx ebx eax + pop ebp + ret 4 + +align 4 +tl_node_move_po6: + mov ecx,edx ;save node pointer + call tl_move_perv + mov dword[edx+8],ebx + + mov edx,esi + call tl_move_next + mov dword[edx+4],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 dword[edx+4],ebx + mov dword[esi+8],eax + ret + +;input +;eax = index 1 node struct +;ebx = index 2 node struct +;edx = pointer 1 node struct +;esi = pointer 2 node struct +;edi = pointer to 'TreeList' struct +;output: +;eax = ? +;ebx = ? +;ecx = ? +align 4 +tl_node_move_po8: +; push ecx + mov ecx,edx ;save node pointer + call tl_move_perv + mov dword[edx+8],ebx + mov edx,ecx + call tl_move_next + mov dword[edx+4],ebx + mov edx,esi + call tl_move_perv + mov dword[edx+8],eax + mov edx,esi + call tl_move_next + mov dword[edx+4],eax + mov edx,ecx ;restore node pointer +; pop ecx + + ;+4 perv + mov eax,dword[edx+4] + mov ebx,dword[esi+4] + 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] + xchg eax,ebx + mov dword[edx+8],eax + mov dword[esi+8],ebx + ret + +;input: +; edi = pointer to 'TreeList' struct +align 4 +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 edi,tl_col_zag + int 0x40 + pop esi edi edx ecx ebx eax + @@: + ret + txt_capt_cur db '‘ва®Є ',0 txt_capt_otm db 'Ћв¬Ґ­л',0 } \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/tree_list_doc/info_treelist.htm b/programs/develop/libraries/box_lib/trunk/tree_list_doc/info_treelist.htm index bdec935bdb..c5613e4fca 100644 --- a/programs/develop/libraries/box_lib/trunk/tree_list_doc/info_treelist.htm +++ b/programs/develop/libraries/box_lib/trunk/tree_list_doc/info_treelist.htm @@ -48,15 +48,15 @@ table { font-size: 15px; }

Введение

Функции