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> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 18.04.17',0 ;¯®¤¯¨áì ®ª­ 
capt db 'info 3ds ¢¥àá¨ï 10.12.17',0 ;¯®¤¯¨áì ®ª­ 
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
align 16

View File

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

View File

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

View File

@ -781,10 +781,15 @@ edit_box.get_n:
;----------------------------------------------------------
; in: ebp = Color
edit_box.clear_cursor:
mov edx, ebp
movzx ebx, word cl_curs_x
cmp ebx, ed_left ;¯®¯ ¤ ¥â «¨ ªãàá®à ⥪á⮢®¥ ¯®«¥?
jle @f
mov edx, ebp
movzx ecx, word cl_curs_y
jmp edit_box.draw_curs
cmp ecx, ed_top
jg edit_box.draw_curs
@@:
ret
edit_box.draw_cursor:
mov edx, ed_text_color