box_lib: fix clear cursor in 'editbox'

info3ds: crop zeros after floating point

git-svn-id: svn://kolibrios.org@7128 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2017-12-10 17:34:39 +00:00
parent 3befb301cf
commit 7dad6439fe
4 changed files with 63 additions and 17 deletions

View File

@ -1373,9 +1373,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 18.04.17',0 ;¯®¤¯¨áì ®ª­  capt db 'info 3ds ¢¥àá¨ï 10.12.17',0 ;¯®¤¯¨áì ®ª­ 
else else
capt db 'info 3ds version 18.04.17',0 ;window caption capt db 'info 3ds version 10.12.17',0 ;window caption
end if end if
align 16 align 16

View File

@ -59,6 +59,7 @@ Data_String DB 32 DUP (?)
;* ‚ë室­ë¥ ¯ à ¬¥âàë: * ;* ‚ë室­ë¥ ¯ à ¬¥âàë: *
;* Data_String - áâப -१ã«ìâ â. * ;* Data_String - áâப -१ã«ìâ â. *
;******************************************************* ;*******************************************************
align 4
DoubleFloat_to_String: DoubleFloat_to_String:
pushad pushad
; <EFBFBD>¥§ã«ìâ â § ¯¨á뢠âì ¢ áâபã Data_String ; <EFBFBD>¥§ã«ìâ â § ¯¨á뢠âì ¢ áâபã Data_String
@ -150,10 +151,11 @@ DoubleFloat_to_String:
; Žè¨¡ª  - ­¥â §­ ç é¨å æ¨äà ; Žè¨¡ª  - ­¥â §­ ç é¨å æ¨äà
jmp .Error jmp .Error
; ‘ª®¯¨à®¢ âì §­ ç éãî ç áâì ç¨á«  ¢ ­ ç «® áâப¨ ; ‘ª®¯¨à®¢ âì §­ ç éãî ç áâì ç¨á«  ¢ ­ ç «® áâப¨
align 4
.N4: rep movsb .N4: rep movsb
jmp .End jmp .End
; Žè¨¡ª  ; Žè¨¡ª 
align 4
.Error: .Error:
mov AL,'E' mov AL,'E'
stosb stosb
@ -165,12 +167,14 @@ DoubleFloat_to_String:
stosb stosb
jmp .End jmp .End
; <EFBFBD>¥à¥¯®«­¥­¨¥ à §à來®© á¥âª¨ ; <EFBFBD>¥à¥¯®«­¥­¨¥ à §à來®© á¥âª¨
align 4
.Overflow: .Overflow:
mov AL,'#' mov AL,'#'
stosb stosb
xor AL,AL xor AL,AL
stosb stosb
; Š®­¥æ ¯à®æ¥¤ãàë ; Š®­¥æ ¯à®æ¥¤ãàë
align 4
.End: .End:
popad popad
ret ret
@ -183,6 +187,7 @@ DoubleFloat_to_String:
;* ‚ë室­ë¥ ¯ à ¬¥âàë: * ;* ‚ë室­ë¥ ¯ à ¬¥âàë: *
;* Data_Double - ç¨á«® ¢ ¤¢®¨ç­®¬ ª®¤¥. * ;* Data_Double - ç¨á«® ¢ ¤¢®¨ç­®¬ ª®¤¥. *
;**************************************************** ;****************************************************
align 4
String_to_DoubleFloat: String_to_DoubleFloat:
pushad pushad
cld cld
@ -202,6 +207,7 @@ String_to_DoubleFloat:
jne .ShiftIgnoreEnd jne .ShiftIgnoreEnd
loop .ShiftIgnore loop .ShiftIgnore
jmp .Error jmp .Error
align 4
.ShiftIgnoreEnd: .ShiftIgnoreEnd:
; <EFBFBD>஢¥à塞 §­ ª ç¨á«  ; <EFBFBD>஢¥à塞 §­ ª ç¨á« 
cmp AL,'-' cmp AL,'-'
@ -222,6 +228,7 @@ String_to_DoubleFloat:
cmp AL,0 ;ª®­¥æ áâப¨? cmp AL,0 ;ª®­¥æ áâப¨?
jne .NotDot jne .NotDot
jmp .ASCIItoBCDConversionEnd jmp .ASCIItoBCDConversionEnd
align 4
.NotDot: .NotDot:
; “¢¥«¨ç¨âì ­  1 §­ ç¥­¨¥ ¯®§¨æ¨¨ â®çª¨, ; “¢¥«¨ç¨âì ­  1 §­ ç¥­¨¥ ¯®§¨æ¨¨ â®çª¨,
; ¥á«¨ ®­  ¥é¥ ­¥ ¢áâà¥ç « áì ; ¥á«¨ ®­  ¥é¥ ­¥ ¢áâà¥ç « áì
@ -284,7 +291,7 @@ String_to_DoubleFloat:
.NoDiv:; ‚ë£à㧨âì ç¨á«® ¢ ¤¢®¨ç­®¬ ä®à¬ â¥ .NoDiv:; ‚ë£à㧨âì ç¨á«® ¢ ¤¢®¨ç­®¬ ä®à¬ â¥
fstp [Data_Double] fstp [Data_Double]
jmp .End jmp .End
align 4
.Error:; <EFBFBD>ਠ«î¡®© ®è¨¡ª¥ ®¡­ã«¨âì १ã«ìâ â .Error:; <EFBFBD>ਠ«î¡®© ®è¨¡ª¥ ®¡­ã«¨âì १ã«ìâ â
fldz ;§ ­¥á⨠­®«ì á á⥪ ᮯà®æ¥áá®à  fldz ;§ ­¥á⨠­®«ì á á⥪ ᮯà®æ¥áá®à 
fstp [Data_Double] fstp [Data_Double]
@ -293,8 +300,7 @@ String_to_DoubleFloat:
ret ret
align 4 align 4
proc str_cat, str1:dword, str2:dword proc str_cat uses eax ecx edi esi, str1:dword, str2:dword
push eax ecx edi esi
mov esi,dword[str2] mov esi,dword[str2]
stdcall str_len,esi stdcall str_len,esi
mov ecx,eax mov ecx,eax
@ -304,7 +310,6 @@ proc str_cat, str1:dword, str2:dword
add edi,eax add edi,eax
cld cld
repne movsb repne movsb
pop esi edi ecx eax
ret ret
endp endp
@ -321,4 +326,34 @@ proc str_len, str1:dword
@@: @@:
sub eax,[str1] sub eax,[str1]
ret ret
endp
align 4
proc String_crop_0 uses eax ebx ecx edi
mov edi,Data_String
mov al,'.'
mov ecx,32
repne scasb
mov ebx,edi
mov edi,Data_String
xor al,al
mov ecx,32
repne scasb
cmp ebx,edi
jg .end_f
dec edi
.cycle0:
dec edi
cmp edi,Data_String
jle .end_f
cmp byte[edi],'0'
jne .cycle0end
mov byte[edi],0
jmp .cycle0
.cycle0end:
cmp byte[edi],'.'
jne .end_f
mov byte[edi],0
.end_f:
ret
endp endp

View File

@ -114,6 +114,7 @@ pushad
fld dword[ebx] fld dword[ebx]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
add ebx,4 add ebx,4
stdcall str_len, Data_String stdcall str_len, Data_String
mov esi,txt_space mov esi,txt_space
@ -439,6 +440,7 @@ prop_button:
fld dword[ebx] fld dword[ebx]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
add ebx,4 add ebx,4
stdcall str_len, Data_String stdcall str_len, Data_String
mov esi,txt_space mov esi,txt_space
@ -543,14 +545,17 @@ get_point_coords:
fld dword[ebx] fld dword[ebx]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
stdcall [edit_box_set_text], edit1, Data_String stdcall [edit_box_set_text], edit1, Data_String
fld dword[ebx+4] fld dword[ebx+4]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
stdcall [edit_box_set_text], edit2, Data_String stdcall [edit_box_set_text], edit2, Data_String
fld dword[ebx+8] fld dword[ebx+8]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
stdcall [edit_box_set_text], edit3, Data_String stdcall [edit_box_set_text], edit3, Data_String
stdcall [edit_box_draw], edit1 stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2 stdcall [edit_box_draw], edit2
@ -775,6 +780,7 @@ pushad
fld dword[ebx] fld dword[ebx]
fstp qword[Data_Double] fstp qword[Data_Double]
call DoubleFloat_to_String call DoubleFloat_to_String
call String_crop_0
add ebx,4 add ebx,4
stdcall str_len, Data_String stdcall str_len, Data_String
mov esi,txt_space mov esi,txt_space

View File

@ -781,28 +781,33 @@ edit_box.get_n:
;---------------------------------------------------------- ;----------------------------------------------------------
; in: ebp = Color ; in: ebp = Color
edit_box.clear_cursor: edit_box.clear_cursor:
mov edx, ebp
movzx ebx, word cl_curs_x movzx ebx, word cl_curs_x
movzx ecx, word cl_curs_y cmp ebx, ed_left ;¯®¯ ¤ ¥â «¨ ªãàá®à ⥪á⮢®¥ ¯®«¥?
jmp edit_box.draw_curs jle @f
mov edx, ebp
movzx ecx, word cl_curs_y
cmp ecx, ed_top
jg edit_box.draw_curs
@@:
ret
edit_box.draw_cursor: edit_box.draw_cursor:
mov edx, ed_text_color mov edx, ed_text_color
mov eax, ed_pos mov eax, ed_pos
sub eax, ed_offset sub eax, ed_offset
mul dword ed_char_width mul dword ed_char_width
mov ebx, eax mov ebx, eax
add ebx, ed_left add ebx, ed_left
inc ebx inc ebx
mov ecx, ed_top mov ecx, ed_top
add ecx, 2 add ecx, 2
mov cl_curs_x, bx mov cl_curs_x, bx
mov cl_curs_y, cx mov cl_curs_y, cx
edit_box.draw_curs: edit_box.draw_curs:
mov eax, ebx mov eax, ebx
shl ebx, 16 shl ebx, 16
or ebx, eax or ebx, eax
mov eax, ecx mov eax, ecx
shl ecx, 16 shl ecx, 16
or ecx, eax or ecx, eax
add ecx, ed_height add ecx, ed_height