fixed bugs and upgrade edit_box

git-svn-id: svn://kolibrios.org@343 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2007-02-13 10:09:13 +00:00
parent 3ea0750ebe
commit 271a1c2ecd
2 changed files with 118 additions and 97 deletions

View File

@ -1,3 +1,5 @@
; <Lrz> 13.02.2007 ã¡à « ¯® ¢®§¬®¦­®á⨠¬¥àæ ­¨¥, ã«ãç襭  ®¡à ¡®â ª  ¯¥à¥à¨á®¢ª¨ ä®­ 
; ¤®¡ ¢¨« ä¨âçã ¢­¥á¥­¨ï 0å0 ¯®  ¤à¥áã ed_size ¨­ ç¥ ã Maxxx32 ¡ë«¨ ­¥á®áâ몮¢ª¨ ¢ ª®¤¥. <20>à¥ç­¨  ¢ ⮬, çâ® ®¯â¨¬¨§ æ¨ï ¡ë«  ᢥ¤¥­  ª ⮬ã çâ® ï ­¥ ç¨á⨫ ᨬ¢®«ë ¢ ¡ãä¥à¥, ª®£¤  㤠«ï«, ï ¯à®áâ® ¨å ­¥ ¢ë¢®¤¨«, ¨ ¯®â®¬ ª®£¤  ¢­®á¨«áï ­®¢ë© ᨬ¢®«, ®­ ¯® ¯à®áâã § â¨à « 㦥 ¨¬¥î騩áï. …᫨ ¡ë ¯à®£à ¬¬  ®¡à ¡ â뢠«  ª®­¥æ áâப¨ ¯® ed_size, ¯à®¡«¥¬ ¡ë ­¥ ¢®§­¨ª«®. <20>® ᥩç á íâ®â ­¥¤®áâ â®ª ¨á¯à ¢«¥­.
; <Lrz> 01.02.2007 ¤®à ¡®âª  edit_box, ¨á¯à ¢¨« ¡ £¨.
; <Lrz> 26.01.2007 ­®à¬ «ì­ ï à ¡®â  ª®¬¯ ­¥­â  ¨á¯à ¢¨« äãªæ¨î .check_offset
; <Lrz> 24.01.2007 ¯®ä¨ªá¥« ¡ £¨ ¢ë§¢ ­ë¥ ­¥ ¯à ¢¨«ì­ë¬ ª®¤®¬ )).
@ -153,6 +155,7 @@ ret
ret
jmp @f
;¢å®¤ ⮫쪮 梥â edx
.draw_bg:
mov ebx,ed_left
add ebx,1
@ -347,30 +350,6 @@ popad
mov dword [esp+28],0
popad
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; mov ebx,eax
; mov eax,ed_pos
; xor edx,edx
; idiv ebx
; xor edx,edx
; imul eax,ebx
; mov ed_offset,eax
; pop ebx
; cmp ax,bx
; je @f
;;;;;;;; ¤ ­­ë¥ ¤«ï § ªà è¨¢ ­¨ï ¢á¥© ¯®«®áë ¯àאַ㣮«ì­¨ª 
; mov ebx,ed_left
; inc ebx
; shl ebx,16
; mov bx,ed_width
; dec ebx
; mov edx,ed_color
; call .draw_bg_eax
; mov dword [esp+28],0
;@@: popad
; ret
;==========================================================
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
;==========================================================
@ -379,6 +358,7 @@ pusha
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .no_figure ;@f
;<3B>஢¥àª  ­  ­ ¦ âë shift
xor ecx,ecx
push eax
inc ecx
@ -387,9 +367,9 @@ pusha
int 0x40
test al,0x03
je @f
or word ed_flags,ed_shift
or word ed_flags,ed_shift ;ãáâ ­®¢¨¬ ä« £
@@: pop eax
@@: pop eax ;¢®ááâ ­®¢¨¬ áç¨â ­ë© ᨬ¢®« á ª« ¢¨ âãàë
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
@ -433,6 +413,9 @@ pusha
mov edx,ed_size
mov ecx,ed_pos
call .del_char
;clear
mov ebp,ed_size
call .clear_bg
;;;;
mov eax,ed_shift_pos
mov ebx,ed_size
@ -443,9 +426,11 @@ pusha
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
@@: mov ecx,ed_size
mov edx, ed_max
test word ed_flags,ed_insert
jne @f
cmp ecx,edx
jae .no_figure
mov ebx, ed_pos
@@: mov ebx, ed_pos
cmp ebx,edx
jl @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
.no_figure:
@ -463,6 +448,12 @@ pusha
sub esi,ecx
add esi,ebx
mov edi,esi
;clear
pusha
mov edi,ebp
mov ebp,ed_pos
call .clear_bg
popa
jmp .In_k
@@: ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
mov ecx,ed_size
@ -478,6 +469,13 @@ pusha
test word [ebp+36],ed_insert ;IF insert is enable â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
jne .ins_v
;clear
pusha
mov edi,ebp
mov ebp,ed_size
call .clear_bg
popa
sub ecx,ebx ;<3B> ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
inc edi ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
@ -534,7 +532,7 @@ pusha
dec dword ed_pos
.draw_all:
push .shift;.draw_cursor_text;eax
push .shift;.draw_cursor_text;eax
test word ed_flags,ed_shift_on
je @f
@ -542,7 +540,12 @@ pusha
mov ebx,ed_size
sub ebx,eax
mov ed_size,ebx
jmp .draw_all2
call .clear_cursor
call .check_offset
call .draw_bg
ret
@@: dec dword ed_size
@ -550,55 +553,10 @@ pusha
and word ed_flags,ed_shift_cl
call .clear_cursor
call .check_offset
;;;;;;;;;;;;;;;
test eax,eax
jne @f
call .draw_bg
mov ebp,ed_size
call .clear_bg
ret
;;;;;;;;;;;;;;;
@@: call .get_n
push eax
mov ebx,ed_offset
add eax,ebx ;eax = w_off= ed_offset+width
mov ebx,ed_size
cmp eax,ebx
jb @f
mov eax,ed_pos
sub ebx,eax
mov ecx,ed_offset
sub eax,ecx
jmp .nxt
@@: mov ebx,ed_pos
push ebx
sub eax,ebx
mov ebx,eax ;It is don't optimal
pop eax ;ed_pos
mov ecx,ed_offset
sub eax,ecx
.nxt:
mov ebp,eax ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
add ebp,ebx
pop edx
cmp ebp,edx
je @f
inc ebx
@@: mov edx,ebx
lea ebx,[eax*2+eax]
shl ebx,1
add ebx,ed_left
inc ebx
shl ebx,16
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
mov edx,ed_color
call .draw_bg_eax
ret
; jmp .shift
;jmp .shift
;--- ­ ¦ â  ª« ¢¨è  left ---
.left: call .sh_enable
mov ebx,ed_pos
@ -636,9 +594,13 @@ pusha
;jz .draw_bg_cursor_text
call .draw_cursor
.shift: ;;;;;;;SHIFT
call .draw_bg ;­¥ ®¯â¨¬ «ì­®
;test ed_flags,ed_
;mov ebp,ed_size
;call .clear_bg
test word ed_flags,ed_shift
je .f_exit
;;;;;;SHIFT end
@ -702,11 +664,13 @@ pusha
mov edx,shift_color
call .draw_bg_eax
and word ed_flags,1111111111111011b
call .enable_null
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
.f_exit: and word ed_flags,ed_shift_cl
jmp .draw_cursor_text
.f_exit: and word ed_flags,ed_shift_cl
call .enable_null
jmp .draw_cursor_text
;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
.sh_enable:
@ -720,7 +684,22 @@ pusha
ret
@@: and word ed_flags,ed_shift_cl
.sh_ext_en: ret
ret
.sh_ext_en: mov ebp,ed_size
call .clear_bg
ret
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
.enable_null:
pusha
mov eax,ed_size
mov ebx,ed_text
add eax,ebx
inc eax
xor ebx,ebx
mov [eax],bl
popa
ret
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
@ -771,6 +750,54 @@ pusha
pop edi
ret
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
.clear_bg:
call .get_n ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
push eax
mov ebx,ed_offset
add eax,ebx ;eax = w_off= ed_offset+width
mov ebx,ebp ;ed_size
cmp eax,ebx
jb @f
mov eax,ed_pos
sub ebx,eax
mov ecx,ed_offset
sub eax,ecx
jmp .nxt
@@: mov ebx,ed_pos
push ebx
sub eax,ebx
mov ebx,eax ;It is don't optimal
pop eax ;ed_pos
mov ecx,ed_offset
sub eax,ecx
.nxt:
mov ebp,eax ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
add ebp,ebx
pop edx
cmp ebp,edx
je @f
inc ebx
@@: mov edx,ebx
lea ebx,[eax*2+eax]
shl ebx,1
add ebx,ed_left
inc ebx
shl ebx,16
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
mov edx,ed_color
call .draw_bg_eax
ret
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
;==========================================================

View File

@ -67,30 +67,24 @@ draw_window: ;
xor eax,eax ;®¡­ã«¨âì eax
mov ebx,50*65536+390 ;[ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
mov ecx,30*65536+200 ;[ª®®à¤¨­ â  ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
mov edx,0x03AABBCC ;0xXYRRGGBB Y =3 - ¢ë¢®¤ à ¬ª¨, ¨á¯®«ì§ãï áªà¨­
mov edx,0xb3AABBCC ;0xXYRRGGBB Y =3 - ¢ë¢®¤ à ¬ª¨, ¨á¯®«ì§ãï áªà¨­
mov esi,0x805080DD ;0xXYRRGGBB - 梥⠧ £®«®¢ª 
mov edi,0x005080DD ;0x00RRGGBB - 梥â à ¬ª¨
mov edi,hed ;“ª § â¥«ì ­  áâபã á § £®«®¢ª®¬
int 0x40 ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
add eax,4 ;¥á«¨ ¯à¥¤¯®« £ ¥âáï ¨á¯®«ì§®¢ âì ᪠«ïà­ë© ¯à®æ¥áá®à, â® ¬®¦­® ¨á¯®«ì§®¢ âì ¤ ­­î ¨­áâàãªæ¨î
mov ebx,8*65536+8 ; [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y] mov ecx,0x10DDEEFF ; 0xX0RRGGBB, £¤¥ RR, GG, BB § ¤ îâ 梥â ⥪áâ 
mov edx,hed ; 㪠§ â¥«ì ­  ­ ç «® áâப¨
mov esi,i_end1 - hed ; ¤«¨­  áâப¨, ¤®«¦­  ¡ëâì ­¥ ¡®«ìè¥ 255
int 0x40 ;¢ë¢¥á⨠⥪áâ
draw_edit_boxes editboxes,editboxes_end ;à¨á®¢ ­¨¥ edit box'®¢
add eax,8 ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mov eax,12 ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
mov ebx,2 ;<3B>®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
int 0x40
ret
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
editboxes:
edit1 edit_box 168,10,50,0xffffff,0,0,0,512,ed_buffer.1,ed_focus
edit2 edit_box 168,10,30,0xffffff,0,0,0,99,ed_buffer.2,ed_figure_only
edit3 edit_box 35,10,70,0xffffff,0,0,0,9,ed_buffer.3,ed_figure_only
edit4 edit_box 16,10,90,0xffffff,0,0,0,1,ed_buffer.4,ed_figure_only
edit1 edit_box 168,5,30,0xffffff,0,0,0,512,ed_buffer.1,ed_focus
edit2 edit_box 168,5,10,0xffffff,0,0,0,99,ed_buffer.2,ed_figure_only
edit3 edit_box 35,5,50,0xffffff,0,0,0,9,ed_buffer.3,ed_figure_only
edit4 edit_box 16,5,70,0xffffff,0,0,0,1,ed_buffer.4,ed_figure_only
editboxes_end:
;data_of_code dd 0
ed_buffer:
@ -101,8 +95,8 @@ ed_buffer:
;text_b: db 'Š®«-¢® ᨬ¢®«®¢'
;buffer: dd 0
buffer_end:
hed db 'EDITBOX optimization and retype <Lrz> date 01.02.2007'
hed db 'EDITBOX optimization and retype <Lrz> date 26.01.2007',0
i_end1:
rb 2048
rb 1024
i_end:
keymap: