From 4a1dd808d912e04e9eef2577acbf0fc4b81f54d5 Mon Sep 17 00:00:00 2001 From: IgorA Date: Tue, 15 Nov 2011 13:23:09 +0000 Subject: [PATCH] box_lib.obj: add scroll type 1 git-svn-id: svn://kolibrios.org@2317 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/box_lib/trunk/box_lib.asm | 111 ++++++++++++++++++ .../libraries/box_lib/trunk/scrollbar.mac | 61 ++++++++++ .../libraries/box_lib/trunk/tree_list.mac | 30 ++--- 3 files changed, 187 insertions(+), 15 deletions(-) diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.asm b/programs/develop/libraries/box_lib/trunk/box_lib.asm index 5fe8b8a5bf..a01c8d473d 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.asm +++ b/programs/develop/libraries/box_lib/trunk/box_lib.asm @@ -124,6 +124,117 @@ lib_init: ret +align 4 +proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dword, box_h:dword,\ + col_0:dword, col_1:dword, col_2:dword + + mov esi,dword[col_1] + and esi,111111101111111011111110b + + mov eax,13 + ;bottom line + mov edx,dword[col_2] + mov ebx,dword[box_l] + shl ebx,16 + add ebx,dword[box_w] + inc ebx ;для заливки диагональных пикселей + mov ecx,dword[box_t] + add ecx,dword[box_h] + shl ecx,16 + inc ecx + + mov edi,3 ;for cycle + @@: + ;calculate colors + and edx,111111101111111011111110b + add edx,esi + shr edx,1 + ;line move up and ->...<- + sub ecx,1 shl 16 ;move up + add ebx,1 shl 16 ;->... + sub ebx,2 ;...<- + ;draw line + int 0x40 + dec edi + jnz @b + + ;right line + mov edx,dword[col_2] + mov ebx,dword[box_l] + add ebx,dword[box_w] + shl ebx,16 + inc ebx + mov ecx,dword[box_t] + shl ecx,16 + add ecx,dword[box_h] + + mov edi,3 ;for cycle + @@: + ;calculate colors + and edx,111111101111111011111110b + add edx,esi + shr edx,1 + ;line move left and ... + sub ebx,1 shl 16 ;move left + add ecx,1 shl 16 + sub ecx,2 + ;draw line + int 0x40 + dec edi + jnz @b + + ;top line + mov edx,dword[col_0] + mov ebx,dword[box_l] + shl ebx,16 + add ebx,dword[box_w] + mov ecx,dword[box_t] + shl ecx,16 + inc ecx + + mov edi,3 ;for cycle + @@: + ;calculate colors + and edx,111111101111111011111110b + add edx,esi + shr edx,1 + ;line move down and ->...<- + add ecx,1 shl 16 ;move down + add ebx,1 shl 16 ;->... + sub ebx,2 ;...<- + ;draw line + int 0x40 + dec edi + jnz @b + + ;left line + mov edx,dword[col_0] + mov ebx,dword[box_l] + shl ebx,16 + inc ebx + mov ecx,dword[box_t] + shl ecx,16 + add ecx,dword[box_h] + + mov edi,3 ;for cycle + @@: + ;calculate colors + and edx,111111101111111011111110b + add edx,esi + shr edx,1 + ;line move left and ... + add ebx,1 shl 16 ;move left + add ecx,1 shl 16 + sub ecx,2 + ;draw line + int 0x40 + dec edi + jnz @b + + ret +endp + + align 16 EXPORTS: diff --git a/programs/develop/libraries/box_lib/trunk/scrollbar.mac b/programs/develop/libraries/box_lib/trunk/scrollbar.mac index aeb362f873..0550830562 100644 --- a/programs/develop/libraries/box_lib/trunk/scrollbar.mac +++ b/programs/develop/libraries/box_lib/trunk/scrollbar.mac @@ -442,6 +442,20 @@ draw_up_arrow_vertical ;********************************* draw_runner_center_vertical ;********************************* + cmp word sb_type,1 + jne @f + push eax ebx ecx edx + movzx eax,word sb_start_x + xor ebx,ebx + add bx,sb_r_start_y + dec ebx + movzx ecx,word sb_size_x + mov edx,sb_run_size + dec edx + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  Ї®«§г­ЄҐ + stdcall draw_edge, eax,ebx,ecx,edx, sb_bckg_col, sb_frnt_col, sb_line_col + pop edx ecx ebx eax + @@: shr ecx,16 add ecx,sb_run_size sub ecx,2 @@ -501,6 +515,21 @@ draw_down_arrow_vertical cmp dword sb_all_redraw,0 je @f int 0x40 ; bottom button - extreme line + cmp word sb_type,1 + jne @f + movzx eax,word sb_start_x + movzx ebx,word sb_start_y + movzx ecx,word sb_size_x + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  ўҐае­Ґ© Є­®ЇЄҐ + stdcall draw_edge, eax,ebx,ecx,sb_btn_high,\ + sb_bckg_col, sb_frnt_col, sb_line_col + + add bx,sb_size_y + sub ebx,sb_btn_high + dec ebx + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  ­Ё¦­Ґ© Є­®ЇЄҐ + stdcall draw_edge, eax,ebx,ecx,sb_btn_high,\ + sb_bckg_col, sb_frnt_col, sb_line_col @@: popa ret @@ -966,6 +995,22 @@ draw_up_arrow_horizontal ;********************************* draw_runner_center_horizontal ;********************************* + cmp word sb_type,1 + jne @f + push eax ebx ecx edx + xor eax,eax + add ax,sb_r_start_x + dec eax + movzx ebx,word sb_start_y + mov ecx,sb_run_size + dec ecx + movzx edx,word sb_size_y + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  Ї®«§г­ЄҐ + stdcall draw_edge, eax,ebx,ecx,edx,\ + sb_bckg_col, sb_frnt_col, sb_line_col + pop edx ecx ebx eax + @@: + shr ebx,16 add ebx,sb_run_size sub ebx,2 @@ -1025,6 +1070,22 @@ draw_down_arrow_horizontal cmp dword sb_all_redraw,0 je @f int 0x40 ; bottom button - extreme line + cmp word sb_type,1 + jne @f + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  «Ґў®© Є­®ЇЄҐ + movzx eax,word sb_start_x + movzx ebx,word sb_start_y + movzx edx,word sb_size_y + stdcall draw_edge, eax,ebx,sb_btn_high,edx,\ + sb_bckg_col, sb_frnt_col, sb_line_col + + movzx eax,word sb_start_x + add ax,sb_size_x + sub eax,sb_btn_high + dec eax + ;аЁб®ў ­ЁҐ бвЁ«м­®© а ¬ЄЁ ­  Їа ў®© Є­®ЇЄҐ + stdcall draw_edge, eax,ebx,sb_btn_high,edx,\ + sb_bckg_col, sb_frnt_col, sb_line_col @@: popa ret diff --git a/programs/develop/libraries/box_lib/trunk/tree_list.mac b/programs/develop/libraries/box_lib/trunk/tree_list.mac index b0bdb872fc..291ee443e0 100644 --- a/programs/develop/libraries/box_lib/trunk/tree_list.mac +++ b/programs/develop/libraries/box_lib/trunk/tree_list.mac @@ -46,11 +46,11 @@ tl_data_init: ; mov eax,tl_p_scrol ;*** цветовые настройки *** mov ecx,tl_col_bkg - mov dword[eax+28],ecx ;+28 .bckg_col + mov dword[eax+sb_offs_bckg_col],ecx mov ecx,tl_col_zag - mov dword[eax+32],ecx ;+32 .frnt_col + mov dword[eax+sb_offs_frnt_col],ecx mov ecx,tl_col_txt - mov dword[eax+36],ecx ;+32 .line_col + mov dword[eax+sb_offs_line_col],ecx ;*** настройки размеров *** mov ecx,tl_box_left add ecx,tl_box_width @@ -107,7 +107,7 @@ tl_info_clear: ; cmp tl_p_scrol,0 ;обработка скроллинга je @f mov eax,tl_p_scrol - mov dword[eax+24],0 ;+24 .position + mov dword[eax+sb_offs_position],0 call tb_scrol_resize @@: pop edi ecx eax @@ -324,19 +324,19 @@ tl_mouse: ; cmp eax,ebx ;правая граница окна jg .no_in_wnd - mov eax,dword[edx+16] ;+16 .max_area - cmp eax,dword[edx+20] ;+20 .cur_area + mov eax,dword[edx+sb_offs_max_area] + cmp eax,dword[edx+sb_offs_cur_area] jbe .no_in_wnd ;все узлы попадают в окно скроллинга push dword edx call scroll_bar_vertical.mouse ;scrollbar_ver_mouse - cmp dword[edx+40],0 ;+40 .redraw + cmp dword[edx+sb_offs_redraw],0 je @f - mov dword[edx+40],0 ;+40 .redraw + mov dword[edx+sb_offs_redraw],0 push dword edi call tl_draw ;произошли изменения скроллинга @@: - cmp dword[edx+46],0 ;+46 .delta2 + cmp dword[edx+sb_offs_delta2],0 jne .no_draw ;попали на скроллинг - не снимаем фокус с TreeList ;------------------------------------------------------------------------------- .no_in_wnd: ;не попали в окно - потеря фокуса (при условии что фокус был на данном эелементе) @@ -1396,8 +1396,8 @@ tb_scrol_resize: .ye_sb: mov edx,tl_p_scrol - mov dword[edx+20],eax ;+20 .cur_area - mov dword[edx+16],ecx ;+16 .max_area + mov dword[edx+sb_offs_cur_area],eax + mov dword[edx+sb_offs_max_area],ecx push dword edx ;pointer to scroll struct call scroll_bar_vertical.draw @@: @@ -1658,10 +1658,10 @@ tl_cur_next: ; je @f call tl_get_rows_count ;eax = rows count mov ebx,tl_p_scrol - add eax,dword[ebx+24] ;.position +24 + add eax,dword[ebx+sb_offs_position] cmp tl_cur_pos,eax jl @f - inc dword[ebx+24] ;.position +24 + inc dword[ebx+sb_offs_position] push dword ebx call scroll_bar_vertical.draw @@ -2169,7 +2169,7 @@ tl_save_mem: ;copy scroll position mov edx,tl_p_scrol - mov eax,dword[edx+24] ;+24 .position + mov eax,dword[edx+sb_offs_position] mov dword[esi+22],eax add esi,tl_save_load_heder_size ;add header size @@ -2300,7 +2300,7 @@ add esi,ebx mov ebx,tl_p_scrol cmp ebx,0 je .end_f - mov dword[ebx+24],eax ;+24 .position + mov dword[ebx+sb_offs_position],eax push dword ebx ;pointer to scroll struct call scroll_bar_vertical.draw