upgrade editbox 07.03.2007

git-svn-id: svn://kolibrios.org@396 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2007-03-07 08:35:01 +00:00
parent ed47d8bf86
commit ce8943dff7
2 changed files with 42 additions and 118 deletions

View File

@ -1,3 +1,4 @@
; <Lrz> 07.03.2007 „®¯¨á « ã¯à ¢«¥­¨¥ á shift home + end ãá¯à ¢¨« ­¥áª®«ìª® ¡ £®¢
; <Lrz> 06.03.2007 <20>¥à¥¯¨á « ¯®«­®áâìî  «£®à¨â¬ ã¯à ¢«¥­¨ï shift
; <Lrz> 15.02.2007 ã«ãç襭¨¥ á­ïâ¨ï ¢ë¤¥«¥­¨ï ¨ ¯¥à¥à¨á®¢ª¨ ®ç¨é ¥¬®© ®¡« áâ¨, §­ ç¨â¥«ì­® ¯à¨ïâ­¥¥ à ¡®â ¥â ª®¬¯®­¥­â
; <Lrz> 13.02.2007 ã¡à « ¯® ¢®§¬®¦­®á⨠¬¥àæ ­¨¥, ã«ãç襭  ®¡à ¡®âª  ¯¥à¥à¨á®¢ª¨ ä®­ 
@ -69,8 +70,8 @@ ed_pos equ [edi+42] ;
ed_offset equ [edi+46] ;ᬥ饭¨¥
cl_curs_x equ [edi+50] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+54] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+58]
ed_shift_pos_old equ [edi+62]
ed_shift_pos equ [edi+58] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+62] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
@ -93,26 +94,6 @@ pusha
call .draw_text
popa
ret
;.str:
; mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
; ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
; cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
; jb @f
; xor edx,edx ;®ç¨áâ¨âì edx
; div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
; push edx ;¯®«®¦¨âì ¢ á⥪
; ;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
; call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
; pop eax
; @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
; ;sbb al,$69 ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
; ;das ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
; or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
; stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
;
; ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
@ -172,7 +153,6 @@ ret
mov ebx,6 ;§ £à㧬¨ ¤¥«¨â¥«ì
div ebx ;à §¬¤¥«¨¬ ­  6
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
;----------------------------------------------------------
@ -183,9 +163,7 @@ ret
mov ecx,cl_curs_y
jmp .draw_curs
.draw_cursor:
mov edx,ed_text_color
;@@:
mov ebx,ed_pos
mov ecx,ed_offset
sub ebx,ecx
@ -212,13 +190,12 @@ ret
mov eax,38
int 0x40
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
;----------------------------------------------------------
.draw_border:
;--- 梥â à ¬ª¨ ---
test dword ed_flags,ed_focus
test word ed_flags,ed_focus
mov edx,ed_focus_border_color
jne @f
mov edx,ed_blur_border_color
@ -303,11 +280,11 @@ pusha
.add_8: add ebx,edx
.chk_d: mov ed_offset,ebx
call .draw_bg
;mov dword [esp+28],-1
and word ed_flags,ed_offset_cl
popa
ret
@@:
mov dword [esp+28],0
or word ed_flags,ed_offset_fl
popa
ret
;==========================================================
@ -327,7 +304,6 @@ pusha
test al,0x03
je @f
or word ed_flags,ed_shift ;ãáâ ­®¢¨¬ ä« £
@@: pop eax ;¢®ááâ ­®¢¨¬ áç¨â ­ë© ᨬ¢®« á ª« ¢¨ âãàë
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
@ -362,36 +338,29 @@ pusha
jb .no_figure
cmp ah,'9'
ja .no_figure
;¯à®¢¥àª  ­  shift
@@: test word ed_flags,ed_shift_on
je @f
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
push eax
mov edx,ed_size
mov ecx,ed_pos
pusha
;cmp edx,ecx
;jne .sh_cl
;clear
mov ebp,edx ;ed_size
call .clear_bg
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call .sh_cl_
.sh_nxt:popa
call .del_char
;;;;
mov eax,dword ed_shift_pos
mov ebx,ed_size
sub ebx,eax
mov ed_size,ebx
pop eax
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
@@: mov ecx,ed_size
mov edx, ed_max
@ -512,9 +481,7 @@ popa
call .clear_cursor
call .check_offset
call .draw_bg
ret
@@: dec dword ed_size
.draw_all2:
@ -525,7 +492,6 @@ popa
mov ebp,ed_size
call .clear_bg
ret
;jmp .shift
;--- ­ ¦ â  ª« ¢¨è  left ---
.left: mov ebx,ed_pos
test ebx,ebx
@ -557,6 +523,7 @@ popa
mov ebx,ed_pos
cmp ebx,dword ed_size
je .sh_st_of
call .sh_first_sh
mov eax,ed_size
mov ed_pos,eax
call .sh_home_end
@ -568,20 +535,21 @@ popa
@@: mov ebp,shift_color
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebx,dword ed_shift_pos
call .sh_cl_
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
.f_exit:call .check_offset
and word ed_flags,ed_shift_cl
and word ed_flags,ed_shift_cl
call .enable_null
jmp .draw_cursor_text
.sh_cl_:
;;;;;;SHIFT end
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
; or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov eax,dword ed_pos
mov ebx,dword ed_shift_pos
; mov ebx,dword ed_shift_pos
cmp eax,ebx
jae .sh_n
push eax ;¬¥­ì襥 ¢ eax
@ -592,11 +560,8 @@ popa
push eax
.sh_n1:
call .check_offset
; test eax,eax
; jz .drw_sim
call .get_n
mov edx,eax ;size of ed_box
; push eax
mov ecx,ed_offset
add eax,ecx ;eax = w_off= ed_offset+width
mov edx,eax ;save
@ -613,7 +578,6 @@ popa
@@: mov ebx,edx
sub ebx,ecx
jmp .nxt_f
.f_f:
sub eax,ecx
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
@ -639,9 +603,7 @@ popa
mov edx,ebp;shift_color
call .draw_bg_eax
@@: ;and word ed_flags,1111111111111011b
call .enable_null
;mov dword ed_shift_pos,0
@@: call .enable_null
ret
;;;;;;;;;;;;;;;;;;;;;
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
@ -651,8 +613,6 @@ popa
call .draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
jmp @b
;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;
;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
@ -664,11 +624,8 @@ popa
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebp,shift_color
mov eax,dword ed_pos
;mov ebx,dword ed_shift_pos
test word ed_flags,ed_left_fl
jz .low
; sub eax,2
;dec eax
jmp @f
;;;;;;;;;;
;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
@ -681,7 +638,6 @@ popa
mov ebp,ed_color
mov eax,dword ed_pos
;mov ebx,dword ed_shift_pos
test word ed_flags,ed_left_fl
jz .low
;dec eax
@ -699,7 +655,6 @@ popa
mov dword ed_shift_pos,ebx
or word ed_flags,ed_shift_on
@@: ret
;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨¥, ¥á«¨ ­¥â shift
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
@ -709,32 +664,11 @@ popa
test word ed_flags,ed_shift_bac
je @f
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call .sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
call .draw_wigwag_cl
and word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
jmp .draw_cursor_text
@@:
;----------- ®â« ¤ª 
; pushad
; mov dword [ed_buffer.3],0
; mov eax,ebx;word ed_flags
; mov edi,ed_buffer.3
; call .str
; ;à¨á®¢ ­¨¥ ä®­ 
; mov eax,13
; mov ebx,178*65536+70
; mov ecx,28*65536+10
; xor edx,edx
; int 0x40
; ;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
; mov eax,4
; mov ebx,180*65536+30
; mov ecx,0x10DDBBCC
; mov edx,ed_buffer.3
; mov esi,8
; int 0x40
; popad
;----------- ®â« ¤ª 
and word ed_flags,ed_shift_off
popa
ret
@ -749,6 +683,7 @@ popa
call .check_offset
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call .sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
call .draw_wigwag_cl
and word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
@ -760,8 +695,8 @@ popa
ret
.sh_ext_en:
call .check_offset
test eax,eax
jnz @f
test word ed_flags,ed_offset_fl
jne @f
;<3B>¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov eax,dword ed_shift_pos
mov ebx,dword ed_pos
@ -784,6 +719,7 @@ popa
.sh_e_end: and word ed_flags,ed_shift_off
ret
@@: mov ebp,shift_color
mov ebx,dword ed_shift_pos
call .sh_cl_
jmp .sh_e_end
;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
@ -793,29 +729,18 @@ popa
test word ed_flags,ed_shift_bac
je @f
mov ebp,ed_color
mov ebx,dword ed_shift_pos_old
call .sh_cl_
@@: test word ed_flags,ed_shift
je .sh_exit_ ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª (®¡« áâì)
call .check_offset
mov ebp,shift_color
mov ebx,dword ed_shift_pos
call .sh_cl_
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jmp .sh_e_end
.sh_exit_: ret
; test word ed_flags,ed_shift_bac
; je @f
.sh_exit_: call .check_offset
ret
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
.enable_null:
pusha
@ -827,9 +752,8 @@ popa
mov [eax],bl
popa
ret
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
.del_char:
mov esi,ed_text
test word ed_flags,ed_shift_on
@ -876,7 +800,6 @@ popa
pop edi
ret
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
.clear_bg:
@ -930,7 +853,6 @@ popa
;eax=dword ed_pos
;ebp=-梥â ed_color or shift_color
.draw_rectangle:
; mov eax,dword ed_pos
mov ecx,dword ed_offset
sub eax,ecx
lea ebx,[eax*2+eax]
@ -1014,8 +936,6 @@ pusha
jc @f
call .draw_cursor
jmp .drc
._blur:
test word ed_flags,ed_always_focus
jne @f
@ -1042,9 +962,9 @@ ret
;popa
;ret
}
ed_figure_only= 1000000000000000b
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
ed_focus=10b
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥­¨ï
ed_shift_on= 1000b ;¥á«¨ ­¥ ãáâ ­®¢«¥­ -§­ ç¨â ¢¯¥à¢ë¥ ­ ¦ â shift,¥á«¨ ¡ë« ãáâ ­®¢«¥­, §­ ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ­ ¦ â¨¨ ­  shift â.¥. ¥á«¨ ­ ¦¨¬ î
ed_shift_off= 1111111111111011b
@ -1052,6 +972,8 @@ ed_shift_bac= 10000b ;
ed_shift_cl= 1111111111100011b
ed_left_fl= 100000b
ed_right_fl= 1111111111011111b
ed_offset_fl= 1000000b
ed_offset_cl= 1111111110111111b
ed_insert= 10000000b
ed_insert_cl= 1111111101111111b
ed_height=14 ; ¢ëá®â 
@ -1081,13 +1003,15 @@ macro key_edit_boxes start,end
mov edi,start
mov ecx,((end-start)/ed_struc_size)
@@:
; push eax
call edit_box.key
; pop eax
add edi,ed_struc_size
loop @b
}
ed_struc_size=66
struc edit_box width,left,top,color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size
blur_border_color,text_color,max,text,flags
{
.width dd width
.left dd left
@ -1099,7 +1023,7 @@ struc edit_box width,left,top,color,focus_border_color,\
.max dd max
.text dd text
.flags dw flags+0
.size dd size+0
.size dd 0
.pos dd 0
.offset dd 0
.cl_curs_x dd 0

View File

@ -81,22 +81,22 @@ draw_window: ;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥
editboxes:
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
edit1 edit_box 168,5,10,0xffffff,0,0,0,99,ed_buffer.2,ed_figure_only
edit2 edit_box 168,5,30,0xffffff,0,0,0,512,ed_buffer.1,ed_focus
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
data_of_code dd 0
ed_buffer:
.1: rb 513;256
.2: rb 100
.3: rb 10
.4: rb 2
.1: rb 514;256
.2: rb 101
.3: rb 11
.4: rb 3
;¤¢  § ¯ á­ëå ¡ ©â  ­¥®¡å®¤¨¬ë ¤«ï ⮣® çâ® ¡ë ­¥ ¯¥¯¥à¥¯¨á âì á«¥¤ãî騥© ¡ ©âë, ¢ ª®­æ¥ ¡ãä¥à  0
;text_b: db 'Š®«-¢® ᨬ¢®«®¢'
;buffer: dd 0
buffer_end:
hed db 'EDITBOX optimization and retype <Lrz> date 06.03.2007',0
hed db 'EDITBOX optimization and retype <Lrz> date 07.03.2007',0
i_end1:
rb 1024
i_end:
keymap:
i_end: