modernization component

git-svn-id: svn://kolibrios.org@282 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2007-01-19 14:36:00 +00:00
parent 15170454cc
commit 983c7036a5
2 changed files with 237 additions and 48 deletions

View File

@ -1,3 +1,4 @@
; <Lrz> 19.01.2007 ॠ«¨§®¢ « ¢ë¤¥«¥­¨¥ ⥪áâ  ¯® shift
; <Lrz> 12.12.2006 ॠ«¨§®¢ « ¯®¤¤¥à¦ªã ª­®¯ª¨ insert ¨ ᥣ®¤ï ª®¬¯®­¥­â ¯®ç⨠ࠡ®â ¥â!!!!
; <Lrz> 07.12.2006 ¯à®¤®«¦ ¥âáï à ¡®â  ­ ¤ ¯¥à¥à ¡®âª®© ª®¬¯®­¥­â ,¨§¬¥­¥­¨ï¬ ¯®¤¢¥à£«¨áì ¬­®£¨¥ ä㭪樨, ¯¥à¥à ¡®â ­ ¢ë¢®¤ ⥪áâ ,   â ª  ¦¥  «£®à¨â¬ ¢­¥á¥­¨ï ᨬ¢®«®¢.
; <Lrz> 03.09.2006 ¯® ¢®§¬®¦­®á⨠®âª § «áï ®â 16 ¡¨â­®©  à¨ä¬¥â¨ª¨, ¤®¡ ¢¨« ­®¢ë¥ ¡ £¨
@ -52,16 +53,18 @@ ed_color equ [edi+12] ;梥
ed_focus_border_color equ [edi+16] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
ed_blur_border_color equ [edi+20] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
ed_text_color equ [edi+24] ;梥â ⥪áâ 
ed_flags equ [edi+28] ;ä« £¨
ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_size equ [edi+36] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+40] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+44] ;ᬥ饭¨¥
ed_text equ [edi+48] ;㪠§ â¥«ì ­  ¡ãä¥à
cl_curs_x equ [edi+52] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+56] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_insert equ [edi+60] ;word
ed_max equ [edi+28] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_text equ [edi+32] ;㪠§ â¥«ì ­  ¡ãä¥à
ed_flags equ [edi+36] ;ä« £¨
ed_size equ [edi+38] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+42] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+46] ;ᬥ饭¨¥
cl_curs_x equ [edi+50] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+54] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_insert equ [edi+58] ;word
ed_shift_pos equ [edi+60]
ed_height=14 ; ¢ëá®â 
shift_color=0x6a9480
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
@ -77,7 +80,7 @@ pusha
.draw_cursor_text:
;--- à¨á㥬 ªãàá®à ---
;--- ¬®¦¥â ¥£® ­¥ ­ ¤® à¨á®¢ âì ----
test dword ed_flags,1
test word ed_flags,ed_focus
je @f
call .draw_cursor
@@:
@ -85,6 +88,25 @@ pusha
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 ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
@ -116,22 +138,22 @@ ret
;eax
;----------------------------------------------------------
.draw_bg_eax:
pusha
;pusha
mov ecx,ed_top
add ecx,1
shl ecx,16
mov cx,13
; sub ecx,1
mov edx,ed_color
mov edx,[esp+4] ;color
; mov edx,ed_color
mov eax,13
int 0x40
popa
ret
;popa
ret 4
jmp @f
.draw_bg:
pusha
;pusha
mov ebx,ed_left
add ebx,1
shl ebx,16
@ -148,7 +170,7 @@ pusha
mov edx,ed_color
mov eax,13
int 0x40
popa
;popa
ret
;----------------------------------------------------------
@ -167,10 +189,15 @@ ret
;----------------------------------------------------------
.clear_cursor:
mov edx,ed_color
test word ed_flags,ed_shift
je @f
mov edx,shift_color
@@:
mov ebx,cl_curs_x
mov ecx,cl_curs_y
jmp .draw_curs
.draw_cursor:
mov edx,ed_text_color
@@:
mov ebx,ed_pos
@ -207,7 +234,7 @@ ret
;----------------------------------------------------------
.draw_border:
;--- 梥â à ¬ª¨ ---
test dword ed_flags,1
test dword ed_flags,ed_focus
mov edx,ed_focus_border_color
jne @f
mov edx,ed_blur_border_color
@ -271,6 +298,7 @@ ret
shl ebx,16
mov bx,ed_width
dec ebx
push dword ed_color
call .draw_bg_eax
mov dword [esp+28],0
@@: popad
@ -280,8 +308,20 @@ ret
;==========================================================
.key:
pusha
test dword ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .no_figure ;@f
push eax
mov ecx,1
mov eax,66
mov ebx,3
int 0x40
xor ebx,ebx
test al,0x03
je @f
or word ed_flags,ed_shift
@@: pop eax
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
@ -324,6 +364,7 @@ pusha
popa
ret
.insert: not word ed_insert
jmp .no_figure
.ins_v:
pop eax edi
@ -366,10 +407,16 @@ pusha
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
inc dword ed_size
push dword ed_pos
push dword ed_size
; push .return
call .draw_all2
inc dword ed_pos
;.return:
jmp .draw_cursor_text
.delete:
mov edx,ed_size
mov ecx,ed_pos
@ -399,7 +446,8 @@ pusha
dec dword ed_pos
.draw_all:
; mov eax,.draw_cursor_text
push dword ed_pos
push dword ed_size
push .draw_cursor_text;eax
dec dword ed_size
.draw_all2:
@ -409,19 +457,19 @@ pusha
push eax
mov ebx,ed_offset
add eax,ebx ;eax = w_off= ed_offset+width
mov ebx,ed_size
mov ebx,[esp+8] ;ed_size
cmp eax,ebx
jb @f
mov eax,ed_pos
mov eax,[esp+12] ; ed_pos
sub ebx,eax
mov ecx,ed_offset
sub eax,ecx
jmp .nxt
@@: mov ebx,ed_pos
@@: mov ebx,[esp+12];ed_pos
push ebx
sub eax,ebx
mov ebx,eax ;don't optimal
mov ebx,eax ;It is don't optimal
pop eax ;ed_pos
mov ecx,ed_offset
@ -444,11 +492,18 @@ pusha
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
push dword ed_color
call .draw_bg_eax
ret
ret 8
;--- ­ ¦ â  ª« ¢¨è  left ---
.left:
mov ebx,ed_pos
.left: test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: mov ebx,ed_pos
test ebx,ebx
jz .nd_k
call .clear_cursor
@ -456,14 +511,25 @@ pusha
jmp .nd_k
;--- ­ ¦ â  ª« ¢¨è  right ---
.right:
mov ebx,ed_pos
test word ed_flags,ed_shift
je @f
test word ed_flags,ed_shift_on
jne @f
push dword ed_pos
pop dword ed_shift_pos
or word ed_flags,ed_shift_on
@@: mov ebx,ed_pos
cmp ebx,ed_size
je .nd_k
call .clear_cursor
inc dword ed_pos
jmp .nd_k
.home:
mov ebx,ed_pos
; test word ed_flags,ed_shift
; je @f
; push dword ed_pos
; pop dword ed_shift_pos
@@: mov ebx,ed_pos
test ebx,ebx
jz .nd_k
call .clear_cursor
@ -472,16 +538,124 @@ pusha
jmp .nd_k
.end:
mov ebx,ed_pos
; test word ed_flags,ed_shift
; je @f
; push dword ed_pos
; pop dword ed_shift_pos
@@: mov ebx,ed_pos
cmp ebx,dword ed_size
je @f
call .clear_cursor
mov eax,ed_size
mov ed_pos,eax
.nd_k: call .check_offset
test eax,eax
jz .draw_bg_cursor_text
;test eax,eax
;jz .draw_bg_cursor_text
call .draw_cursor
.shift: ;;;;;;;SHIFT
;----------- ®â« ¤ª 
pushad
mov [data_of_code],0
mov ax,word ed_flags
mov edi,data_of_code
call .str
;à¨á®¢ ­¨¥ ä®­ 
mov eax,13
mov ebx,178*65536+36
mov ecx,28*65536+10
xor edx,edx
int 0x40
;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
mov eax,4
mov ebx,180*65536+30
mov ecx,0x10DDBBCC
mov edx,data_of_code
mov esi,4
int 0x40
popad
;----------- ®â« ¤ª 
call .draw_bg
test word ed_flags,ed_shift
je .f_exit
;;;;;;SHIFT end
mov eax,dword ed_pos
mov ebx,dword ed_shift_pos
cmp eax,ebx
jae .sh_n
push eax ;¬¥­ì襥 ¢ eax
push ebx ;¡®«ì襥
jmp .sh_n1
;¥á«¨ ¨­ ç¥
.sh_n: push ebx
push eax
.sh_n1:
; jmp .draw_all2
;;;;;;;;;;;;;;;;;;;;;;;;;
;call .clear_cursor
call .check_offset
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 ebp,eax ;save
pop ebx ;¡®«ì襥
pop eax ;¬¥­ì襥
cmp eax,ecx ;áà ¢­¥­¨¥ á ¬¥­ì襣® á offset.
jae .f_f ;¥á«¨ ¡®«ìè¥
xor eax,eax
cmp ebp,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jb @f
sub ebx,ecx
jmp .nxt_f
@@: mov ebx,ebp
sub ebx,ecx
jmp .nxt_f
.f_f:
sub eax,ecx
cmp ebp,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jle @f
sub ebx,ecx
sub ebx,eax
jmp .nxt_f
@@:
mov ebx,ebp
sub ebx,ecx
sub ebx,eax
.nxt_f:
; mov ebp,eax ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
; add ebp,ebx
; pop edx
; cmp ebp,edx
; je .ff
; inc ebx
.ff: 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 ebp,ed_color
; not ebp
push dword shift_color
call .draw_bg_eax
; pop edx
; or word ed_flags,ed_shift
and word ed_flags,1111111111111011b
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
.f_exit: and word ed_flags,ed_shift_cl
jmp .draw_cursor_text
@@:
popa
ret
@ -522,9 +696,6 @@ pusha
;----------------------------------------------------------
test eax,1
jnz .mouse_left_button
; or eax,1
; jc @f
; btr dword ed_flags,2
@@: popa
ret
@ -572,10 +743,7 @@ pusha
@@:
mov ed_pos,ax
call .check_offset
; test eax,eax
; jz .draw_bg_cursor_text
call .draw_cursor
call .focus
.mouse_pressed:
@ -591,13 +759,13 @@ ret
.blur:
pusha
._blur:
btr dword ed_flags,0
btr dword ed_flags,1
jnc @f
call .clear_cursor
jmp .blur_end
.focus:
pusha
bts dword ed_flags,0
bts dword ed_flags,1
jc @f
call .draw_cursor
.blur_end:
@ -622,6 +790,9 @@ ret
}
ed_figure_only=1000000000000000b
ed_focus=10b
ed_shift_on=1000b
ed_shift=100b
ed_shift_cl=0011b
macro draw_edit_boxes start,end
{
mov edi,start
@ -651,7 +822,7 @@ macro key_edit_boxes start,end
add edi,ed_struc_size
loop @b
}
ed_struc_size=62
ed_struc_size=64
struc edit_box width,left,top,color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size
{
@ -662,15 +833,16 @@ struc edit_box width,left,top,color,focus_border_color,\
.focus_border_color dd focus_border_color
.blur_border_color dd blur_border_color
.text_color dd text_color
.flags dd flags+0
.max dd max
.text dd text
.flags dw flags+0
.size dd size+0
.pos dd 0
.offset dd 0
.text dd text
.cl_curs_x dd 0
.cl_curs_y dd 0
.insert dw 0
.shift dd 0
}
macro edit_boxes_set_sys_color start,end,color_table

View File

@ -12,8 +12,8 @@ use32 ;
dd start ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd (i_end+0x100) and not 3 ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
dd (i_end+0x100) and not 3 ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd i_end and not 3 ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
dd i_end and not 3 ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd 0x0,0x0 ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
; ¥á«¨ ¯®á«¥ § ¯ã᪠ ­¥à ¢­® ­ã«î, ¯à¨«®¦¥­¨¥ ¡ë«®
; § ¯ã饭® á ¯ à ¬¥âà ¬¨ ¨§ ª®¬ ­¤­®© áâப¨
@ -28,6 +28,20 @@ start: ;
mov eax,40 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
mov ebx,0x27 ;á¨á⥬  ¡ã¤¥â ॠ£¨à®¢ âì ⮫쪮 ­  á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥,­ ¦ â  ª­®¯ª , ®¯à¥¤¥«ñ­­ ï à ­¥¥, ᮡë⨥ ®â ¬ëè¨ (çâ®-â® á«ã稫®áì - ­ ¦ â¨¥ ­  ª­®¯ªã ¬ëè¨ ¨«¨ ¯¥à¥¬¥é¥­¨¥; á¡à á뢠¥âáï ¯à¨ ¯à®ç⥭¨¨) ¨ ­ ¦ â¨¥ ª« ¢¨è¨
int 0x40
; mov eax,66 ; keyboard mode definitions
; mov ebx,1 ; set
; xor ecx,ecx
; inc ecx ; return scancodes
; int 0x40
; mov eax,26 ; get setup for keyboard
; inc ebx
; mov ebx,2
; mov ecx,1 ; base keymap
; mov edx,keymap
; int 0x40
red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
still: ;®á­®¢­®© ®¡à ¡®â稪
@ -75,7 +89,7 @@ draw_window: ;
add eax,4 ;¥á«¨ ¯à¥¤¯®« £ ¥âáï ¨á¯®«ì§®¢ âì ᪠«ïà­ë© ¯à®æ¥áá®à, â® ¬®¦­® ¨á¯®«ì§®¢ âì ¤ ­­î ¨­áâàãªæ¨î
mov ebx,8*65536+8 ; [ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [ª®®à¤¨­ â  ¯® ®á¨ y] mov ecx,0x10DDEEFF ; 0xX0RRGGBB, £¤¥ RR, GG, BB § ¤ îâ 梥â ⥪áâ 
mov edx,hed ; 㪠§ â¥«ì ­  ­ ç «® áâப¨
mov esi,i_end - hed ; ¤«¨­  áâப¨, ¤®«¦­  ¡ëâì ­¥ ¡®«ìè¥ 255
mov esi,i_end1 - hed ; ¤«¨­  áâப¨, ¤®«¦­  ¡ëâì ­¥ ¡®«ìè¥ 255
int 0x40 ;¢ë¢¥á⨠⥪áâ
draw_edit_boxes editboxes,editboxes_end ;à¨á®¢ ­¨¥ edit box'®¢
@ -102,5 +116,8 @@ ed_buffer:
;text_b: db 'Š®«-¢® ᨬ¢®«®¢'
;buffer: dd 0
buffer_end:
hed db 'EDITBOX optimization and retype <Lrz> date 12.12.2006'
i_end:
hed db 'EDITBOX optimization and retype <Lrz> date 19.01.2007'
i_end1:
rb 2048
i_end:
keymap: