Boxlib: the tree_list can use large fonts, fix line number error

This commit is contained in:
2025-03-31 20:24:16 +03:00
committed by Max Logaev
parent ff625706c0
commit 5abc319817

View File

@@ -1,7 +1,6 @@
; í«¥¬¥­â TreeList ¤«ï ¡¨¡«¨®â¥ª¨ box_lib.obj ; SPDX-License-Identifier: GPL-2.0-only
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï ; TreeList: used as a ListBox or Tree control (determined by settings)
; ¯®á«¥¤­ïï ¬®¤¨ä¨ª æ¨ï 12.01.2021 IgorA ; Copyright (C) 2009-2025 IgorA <aie85playm@gmail.com>
struct TreeNode struct TreeNode
type dw ? ;+ 0 ⨯ í«¥¬¥­â , ¨«¨ ¨­¤¥ªá ¨ª®­ª¨ ¤«ï ã§«  type dw ? ;+ 0 ⨯ í«¥¬¥­â , ¨«¨ ¨­¤¥ªá ¨ª®­ª¨ ¤«ï ã§« 
@@ -14,6 +13,52 @@ struct TreeNode
ends ends
;input:
; ecx - 0xXX...... font options
;output:
; eax - font height in pixels
align 4
proc get_font_h uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,9
jmp .siz0
@@:
mov ebx,16
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;input:
; ecx - 0xXX...... font options
;output:
; eax - font width in pixels
align 4
proc get_font_w uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,6
jmp .siz0
@@:
mov ebx,8
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;¢ë¤¥«­¨¥ ¯ ¬ï⨠¤«ï áâàãªâãà ᯨ᪠ ¨ ®á­®¢­®© ¨­ä®à¬ æ¨¨ (ª®­áâàãªâ®à) ;¢ë¤¥«­¨¥ ¯ ¬ï⨠¤«ï áâàãªâãà ᯨ᪠ ¨ ®á­®¢­®© ¨­ä®à¬ æ¨¨ (ª®­áâàãªâ®à)
align 16 align 16
proc tl_data_init uses eax ecx edi, tlist:dword proc tl_data_init uses eax ecx edi, tlist:dword
@@ -463,34 +508,24 @@ proc tl_draw, tlist:dword
cmp tl_capt_cy,9 ;9 - minimum caption height cmp tl_capt_cy,9 ;9 - minimum caption height
jl @f jl @f
mov ebx,edi ;calculate cursor position call tl_draw_caption_cur_pos
mov eax,tl_cur_pos
inc eax
lea edi,[txt_capt_cur.v]
stdcall tl_convert_to_str, 5
mov edi,ebx
mov eax,tl_tim_undo mov eax,tl_tim_undo
or eax,eax
jz @f
mov ebx,edi ;save edi
lea edi,[txt_capt_otm.v] lea edi,[txt_capt_otm.v]
stdcall tl_convert_to_str, 5 stdcall tl_convert_to_str, 5
mov edi,ebx ;restore edi mov edi,ebx ;restore edi
mov eax,SF_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,0x80000000
lea edx,[txt_capt_cur]
int 0x40
mov ebx,tl_box_left mov ebx,tl_box_left
shl ebx,16 shl ebx,16
add ebx,100*65536+3 add ebx,100*65536+3
mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0x80000000
add ebx,tl_box_top add ebx,tl_box_top
lea edx,[txt_capt_otm] lea edx,[txt_capt_otm]
int 0x40 mcall SF_DRAW_TEXT ;undo
@@: @@:
;cycle to nodes ;cycle to nodes
@@ -1163,10 +1198,11 @@ proc tl_draw_node_caption uses ebx ecx edx esi
ror ecx,16 ror ecx,16
mov ebx,ecx mov ebx,ecx
add bx,tl_img_cy ;¢ëà ¢­¨¢¨­¨¥ ¯® ­¨¦­¥© £à ­¨æ¥ ¨ª®­ª¨ add bx,tl_img_cy ;¢ëà ¢­¨¢¨­¨¥ ¯® ­¨¦­¥© £à ­¨æ¥ ¨ª®­ª¨
sub bx,9 ;®â­¨¬ ¥¬ ¢ëá®âã ⥪áâ 
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0xffffff call get_font_h
mcall SF_DRAW_TEXT sub bx,ax ;®â­¨¬ ¥¬ ¢ëá®âã ⥪áâ 
and ecx,0x37ffffff
mcall SF_DRAW_TEXT ;node text
@@: @@:
ret ret
endp endp
@@ -1179,13 +1215,15 @@ endp
align 4 align 4
proc tl_get_draw_text_len uses eax ecx edx proc tl_get_draw_text_len uses eax ecx edx
mov esi,eax ;¡¥à¥¬ ¤«¨­­ã áâப¨ mov esi,eax ;¡¥à¥¬ ¤«¨­­ã áâப¨
mov ecx,tl_col_txt
call get_font_w
mov ecx,eax
mov eax,tl_box_left mov eax,tl_box_left
add eax,tl_box_width add eax,tl_box_width
cmp eax,ebx cmp eax,ebx
jle .text_null ;¥á«¨ ¯®¤¯¨áì ¯®«­®áâìî ¢áï §  íªà ­®¬ jle .text_null ;¥á«¨ ¯®¤¯¨áì ¯®«­®áâìî ¢áï §  íªà ­®¬
sub eax,ebx sub eax,ebx
xor edx,edx xor edx,edx
mov ecx,6 ;è¨à¨­  á¨á⥬­®£® èà¨äâ 
div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥ div ecx ;ᬮâਬ ᪮«ìª® ᨬ¢®«®¢ ¬®¦¥â ¯®¬¥áâ¨âìáï ­  íªà ­¥
cmp esi,eax cmp esi,eax
jl @f jl @f
@@ -1858,10 +1896,8 @@ pushad
.po8: .po8:
call tl_node_move_po8 ;ã§«ë ¨¤ãâ ­¥ ¯®¤àï¤ ¬¥­ï¥¬ 8 ááë«®ª call tl_node_move_po8 ;ã§«ë ¨¤ãâ ­¥ ¯®¤àï¤ ¬¥­ï¥¬ 8 ááë«®ª
.cur_mov: .cur_mov:
push dword edi stdcall tl_cur_perv, edi
call tl_cur_perv stdcall tl_draw, edi
push dword edi
call tl_draw
@@: @@:
popad popad
ret ret
@@ -1981,10 +2017,11 @@ tl_draw_caption_cur_pos:
add ebx,5*65536+3 add ebx,5*65536+3
add ebx,tl_box_top add ebx,tl_box_top
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0xc0000000 ;0x40000000 § ªà è¨¢ âì ä®­ 梥⮬ edi or ecx,0xc0000000 ;0x40000000 § ªà è¨¢ âì ä®­ 梥⮬ edi
lea edx,[txt_capt_cur] lea edx,[txt_capt_cur]
mov edi,tl_col_zag mov edi,tl_col_zag
mcall SF_DRAW_TEXT ;captions mcall SF_DRAW_TEXT ;row number
popad popad
@@: @@:
ret ret
@@ -2253,6 +2290,6 @@ align 4
jge @f jge @f
or al,0x30 ;¤®¡ ¢«ï¥¬ ᨬ¢®« '0' or al,0x30 ;¤®¡ ¢«ï¥¬ ᨬ¢®« '0'
stosb ;§ ¯¨á âì al ¢ ï祪㠯 ¬ï⨠[edi] stosb ;§ ¯¨á âì al ¢ ï祪㠯 ¬ï⨠[edi]
mov byte[edi],0 mov word[edi],' ' ;add space symbol and 0
@@: @@:
ret ret