forked from KolibriOS/kolibrios
3e1c43afe7
git-svn-id: svn://kolibrios.org@449 a494cfbc-eb01-0410-851d-a64ba20cac60
1180 lines
29 KiB
Plaintext
1180 lines
29 KiB
Plaintext
; <Lrz> 04.04.2007 Œ®¤¥à¨§¨à®¢ « á¨á⥬㠢뤥«¥¨ï, áãé¥á⢥® ¯¥à¥¤¥« ® ã¯à ¢«¥¨¥ ¨ ®¡à ¡®âª , ¤®¡ ¢«¥® ¡«®ª¨à®¢ ¨ï ®¡à ¡®âª¨ ¤àã£¨å ¡®ªá®¢, ¢® ¢à¥¬ï ¢ë¤¥«¥¨ï ¬ë誮© ⥪áâ , ¤«ï í⮣® ¢ ⥪áâ ¯à®£à ¬¬ë ¥®¡å®¤¨¬® ¤®¡ ¢¨âì ¨¤¥â¨ä¨ª â®à ¡®ªá â.¥. dd 0x0 ¨ ¢ ¥£® ¡ã¤¥â ¯®¬¥é âìáï 㪠⥫ì editbox
|
||
; <Lrz> 30.03.2007 <20>¥à¥¤¥« « ¯à®æ¥¤ãà㠢뤥«¥¨ï, ⥯¥àì ⥪á⠢뤥«ï¥âáï ⮫쪮 ⮫쪮 ¬ë誮©
|
||
; <Lrz> 09.03.2007 „®¯¨á « ã¯à ¢«¥¨¥ mouse + shift ¢ë¤¥«¥¨¥ ¨ ¯¥à¥¬¥é¥¨¥
|
||
; <Lrz> 07.03.2007 „®¯¨á « ã¯à ¢«¥¨¥ á shift home + end ãá¯à ¢¨« ¥áª®«ìª® ¡ £®¢
|
||
; <Lrz> 06.03.2007 <20>¥à¥¯¨á « ¯®«®áâìî «£®à¨â¬ ã¯à ¢«¥¨ï shift
|
||
; <Lrz> 15.02.2007 ã«ãç襨¥ áïâ¨ï ¢ë¤¥«¥¨ï ¨ ¯¥à¥à¨á®¢ª¨ ®ç¨é ¥¬®© ®¡« áâ¨, § ç¨â¥«ì® ¯à¨ï⥥ à ¡®â ¥â ª®¬¯®¥â
|
||
; <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 ¯®ä¨ªá¥« ¡ £¨ ¢ë§¢ ë¥ ¥ ¯à ¢¨«ìë¬ ª®¤®¬ )).
|
||
; <Lrz> 22.01.2007 ¨§¡ ¢¨«áï ®â £«îª®¢ ¯à¨ à ¡®â¥ á ¢ë¤¥«¥¨¥¬ ¨ 㤠«¥¨¥, ª®à४â ï à ¡®â ª« ¢¨è¥© del & backspase
|
||
; <Lrz> 20.01.2007 ॠ«¨§®¢ « ¢ë¤¥«¥¨¥ ⥪áâ ¯® shift
|
||
; <Lrz> 12.12.2006 ॠ«¨§®¢ « ¯®¤¤¥à¦ªã ª®¯ª¨ insert ¨ ᥣ®¤ï ª®¬¯®¥â ¯®çâ¨ à ¡®â ¥â!!!!
|
||
; <Lrz> 07.12.2006 ¯à®¤®«¦ ¥âáï à ¡®â ¤ ¯¥à¥à ¡®âª®© ª®¬¯®¥â ,¨§¬¥¥¨ï¬ ¯®¤¢¥à£«¨áì ¬®£¨¥ äãªæ¨¨, ¯¥à¥à ¡®â ¢ë¢®¤ ⥪áâ , â ª ¦¥ «£®à¨â¬ ¢¥á¥¨ï ᨬ¢®«®¢.
|
||
; <Lrz> 03.09.2006 ¯® ¢®§¬®¦®á⨠®âª § «áï ®â 16 ¡¨â®© à¨ä¬¥â¨ª¨, ¤®¡ ¢¨« ®¢ë¥ ¡ £¨
|
||
; <Lrz> 09.08.2006 ¯à®¨§¢¥¤¥ ®¯â¨¬¨§ æ¨ï à ¡®âë ª®¯®ª DEL ¨ Backspace, 㬥ìè¥ à §¬¥à ¢ë¯®«ï¥¬®£® ª®¤ .
|
||
; <Lrz> 21.07.2006 ¤®¡ ¢«¥ äãªæ¨ï ª®¯ª¨ Del, ⥯¥àì ¬®¦® 㤠«ïâì ᨬ¢®«ë ¯à¨ ¯®¬®é¨ ¤ ®© ª« ¢¨è¨
|
||
; €¢â®à: …¢â¨å®¢ Œ ªá¨¬ (Maxxxx32) email: maxxxxm@mail.ru
|
||
; „ â ¯®á«¥¤¨å ¨§¬¥¥¨©: 13.06.06 10:40
|
||
; <20> ¯¨è¨â¥ ¢ ¨á室®¬ ª®¤¥ ᢮¥© ¯à®£à ¬¬ë use_edit_box,
|
||
; íâ® ¢áâ ¢¨â ¥®¡å®¤¨¬ë¥ ¯à®æ¥¤ãàë ¢ ª®¤ ¢ 襩 ¯à®£à ¬¬ë.
|
||
; <20>à®æ¥¤ãàë:
|
||
; edit_box.draw - ¯®« ï ¯¥à¥à¨á®¢ª ;
|
||
; edit_box.key - ®¡à ¡®âª ª« ¢¨ âãàë;
|
||
; edit_box.mouse - ®¡à ¡®âª ¬ëè¨;
|
||
; edit_box.focus - ãáâ ®¢ª 䮪ãá ;
|
||
; edit_box.blur - ¥£® à §¬ë¢ ¨¥;
|
||
; edit_box.get_n - ¯®«ãç¨âì ª®«¨ç¥á⢮ ¯à®à¨á®¢ë¢ ¥¬ëå ᨬ¢®«®¢.
|
||
; <20>ਠ¢ë§®¢¥ «î¡ëå ¨§ íâ¨å ¯à®æ¥¤ãà ¢ ॣ¨áâॠedi á«¥¤ã¥â
|
||
; ®áâ ¢¨âì 㪠§ ⥫ì áâàãªâãàã.
|
||
; <20>ਬ¥à áâàãªâãàë:
|
||
; some_edit edit_box 100,10,30,0x00ffffff,0,0x00aaaaaa,0,255,some_edit_text
|
||
; ¤«¨ , ¢ëá®â , ¢¥àå, 梥â ä® , 梥â à ¬ª¨, ¥á«¨ ¢ë¡à ,
|
||
; 梥â à ¬ª¨, ¥á«¨ ¥ ¢ë¡à , ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ ᨬ¢®«®¢,
|
||
; 㪠§ â¥«ì ¡ãä¥à, £¤¥ ¡ã¤ãâ åà ¨âáï ᨬ¢®«ë. <20>ãä¥à ¤®«¦¥
|
||
; ®ª 稢 âìáï ã«¥¬, ¯à¨¬¥à ¥á«¨ ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ 255:
|
||
; some_edit_text:
|
||
; rb 256 ;255+1
|
||
|
||
; <20>ਬ¥à ¢ë§®¢ ¯à®æ¥¤ãàë:
|
||
; mov edi,some_edit
|
||
; call edit_box.draw
|
||
|
||
; <20>ਠ¢ë§®¢¥ ¯à®æ¥¤ãàë edit_box.key ª®¤ ª« ¢¨è¨ ¤®«¦¥
|
||
; 室¨âáï ¢ ah, â® ¥áâì ¯¥à¥¤ ¢ë§®¢®¬ í⮩ ¯à®æ¥¤ãàë ¤® ¢ë§¢ âì
|
||
; 2-ãî á¨á¥¬ãî äãªæ¨î, ¯à¨¬¥à:
|
||
; mov eax,2
|
||
; int 0x40
|
||
; mov edi,some_edit1
|
||
; call edit_box.key
|
||
; mov edi,some_edit2
|
||
; call edit_box.key
|
||
; <20>¥à¥¤ ¢ë§®¢®¬ ®¡à ¡®â稪 ¬ëè¨ á«¥¤ã¥â ¯à®¢¥à¨âì, ï¥âáï «¨ ®ª®
|
||
; ªâ¨¢ë¬.
|
||
; …᫨ 饫箪 ¬ëè¨ ¡ë« ¯à®©§¢¥¤¥ § ¯à¥¤¥« ¬¨ edit box
|
||
; 䮪ãá â¥àï¥âáï.
|
||
macro use_edit_box
|
||
{
|
||
edit_box:
|
||
ed_width equ [edi] ;è¨à¨ ª®¬¯®¥â
|
||
ed_left equ [edi+4] ;¯®«®¦¥¨¥ ¯® ®á¨ å
|
||
ed_top equ [edi+8] ;¯®«®¦¥¨¥ ¯® ®á¨ ã
|
||
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_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_shift_pos equ [edi+58] ;¯®«®¦¥¨¥ ªãàá®à
|
||
ed_shift_pos_old equ [edi+62] ;áâ ஥ ¯®«®¦¥¨¥ ªãàá®à
|
||
;==========================================================
|
||
;=== ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ =================================
|
||
;==========================================================
|
||
.draw:
|
||
pusha
|
||
;--- à¨á㥬 à ¬ªã ---
|
||
call .draw_border ; ”ãªæ¨ï áâ ¡¨«ì
|
||
.draw_bg_cursor_text:
|
||
;--- ¨§¬¥ï¥¬ ᬥ饨¥, ¥á«¨ ¤® ---
|
||
call .check_offset ;¢ëç¨á«¥¨¥ ¯®§¨æ¨¨ ªãàá®à áâ ¡¨«ì
|
||
;--- à¨á㥬 ¢ãâà¥îî ®¡« áâì ---
|
||
call .draw_bg ; à¨á®¢ âì ¯àאַ㣮«ì¨ª à ¡®ç¥© ®¡« áâ¨
|
||
;---- à¨á㥬 ¢ë¤¥«¥¨¥, ¯® shift ¥á«¨ ¥áâì
|
||
call .draw_shift
|
||
.draw_cursor_text:
|
||
;--- à¨á㥬 ªãàá®à ---
|
||
;--- ¬®¦¥â ¥£® ¥ ¤® à¨á®¢ âì ----
|
||
test word ed_flags,ed_focus
|
||
je @f
|
||
call .draw_cursor
|
||
@@:
|
||
call .draw_text
|
||
popa
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ¢ë¤¥«¥®© ç á⨠-----------------
|
||
;----------------------------------------------------------
|
||
.draw_shift:
|
||
test word ed_flags,ed_shift_bac ;ãáâ ®¢ª ä« £ , ¢ë¤¥«¥®© ®¡« áâ¨
|
||
jz @f
|
||
mov ebp,shift_color
|
||
mov ebx,dword ed_shift_pos
|
||
call .sh_cl_
|
||
@@: ret
|
||
|
||
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ⥪áâ --------------------------
|
||
;----------------------------------------------------------
|
||
.draw_text:
|
||
;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ ---
|
||
;--- çâ®¡ë ¬ãá®à ¥ à¨á®¢ âì ---
|
||
call .get_n
|
||
mov esi,ed_size
|
||
mov ebx,ed_offset
|
||
sub esi,ebx
|
||
cmp eax,esi
|
||
jae @F
|
||
mov esi,eax ;çâ®¡ë ¥ ¢ë室¨âì § ¯à¥¤¥«ë íªà
|
||
;--- à¨á㥬 ⥪áâ ---
|
||
@@: mov eax,4
|
||
mov ebx,ed_left
|
||
mov edx,ed_offset
|
||
add ebx,2
|
||
shl ebx,16
|
||
mov bx,ed_top
|
||
add ebx,4
|
||
mov ecx,ed_text_color
|
||
add edx,ed_text
|
||
int 0x40
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ä® ----------------------------
|
||
;¢å®¤ë¥ ¤ ë¥
|
||
;eax
|
||
;edx - color
|
||
;----------------------------------------------------------
|
||
;¢å®¤ ⮫쪮 梥â edx
|
||
.draw_bg:
|
||
mov ebx,ed_left
|
||
add ebx,1
|
||
shl ebx,16
|
||
mov bx,ed_width
|
||
sub ebx,1
|
||
mov edx,ed_color
|
||
.draw_bg_eax:
|
||
mov ecx,ed_top
|
||
mov eax,13
|
||
add ecx,1
|
||
shl ecx,16
|
||
mov cx,ed_height
|
||
dec ecx
|
||
int 0x40
|
||
ret
|
||
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà ¯®«ãç¥¨ï ª®«¨ç¥á⢠ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨¥ ª®¬¯®¥â --------------
|
||
;----------------------------------------------------------
|
||
.get_n:
|
||
mov eax,ed_width ;¯®«ã祬 è¨à¨ã ª®¬¯®¥â
|
||
xor edx,edx ;१ã«ìâ â à ᯮ«®£ ¥âáï ¢ ¯ ॠedx:eax ¢ eax - ®áâ ⮪
|
||
sub eax,4 ;¢ëç⨬ 4
|
||
mov ebx,6 ;§ £à㧬¨ ¤¥«¨â¥«ì
|
||
div ebx ;à §¬¤¥«¨¬ 6
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï ªãàá®à --------------------------
|
||
;----------------------------------------------------------
|
||
;¢å®¤ë¥ ebp- 梥â
|
||
.clear_cursor:
|
||
mov edx,ebp
|
||
mov ebx,cl_curs_x
|
||
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
|
||
|
||
lea ebx,[ebx*2+ebx]
|
||
shl ebx,1
|
||
;imul ebx,6
|
||
add bx,ed_left
|
||
mov ecx,ed_top
|
||
inc ebx
|
||
add ecx,2
|
||
mov ebp,ebx
|
||
shl ebx,16
|
||
mov bx,bp
|
||
mov ebp,ecx
|
||
|
||
shl ecx,16
|
||
mov cx,bp
|
||
add cx,ed_height-4
|
||
|
||
mov cl_curs_x,ebx
|
||
mov cl_curs_y,ecx
|
||
.draw_curs:
|
||
mov eax,38
|
||
int 0x40
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï à ¬ª¨ ----------------------------
|
||
;----------------------------------------------------------
|
||
.draw_border:
|
||
;--- 梥â à ¬ª¨ ---
|
||
test word ed_flags,ed_focus
|
||
mov edx,ed_focus_border_color
|
||
jne @f
|
||
mov edx,ed_blur_border_color
|
||
@@:
|
||
;--- ᢥàåã ---
|
||
mov eax,38
|
||
mov ebx,ed_left
|
||
mov ecx,ebx
|
||
shl ebx,16
|
||
mov bx,cx
|
||
add bx,ed_width
|
||
mov ecx, ed_top
|
||
mov esi,ecx
|
||
shl ecx,16
|
||
mov cx,si
|
||
int 0x40
|
||
|
||
;--- ᨧã ---
|
||
mov esi,ecx
|
||
add ecx,ed_height
|
||
mov ebp,ecx
|
||
shl ecx,16
|
||
mov cx,bp
|
||
int 0x40
|
||
|
||
;--- á«¥¢ ---
|
||
mov cx,si
|
||
mov ebp,ebx
|
||
sub bx,ed_width
|
||
int 0x40
|
||
|
||
;--- á¯à ¢ ---
|
||
mov ebx,ebp
|
||
shl ebx,16
|
||
mov bx,bp
|
||
int 0x40
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®¢¥àª , § 襫 «¨ ªãàá®à § £à ¨æë ¨, ¥á«¨ ¤®, ---
|
||
;--- ¨§¬¥ï¥¬ ᬥ饨¥ ------------------------------------
|
||
;--- eax = -1, ¥á«¨ ¥ ¨§¬¥¨«®áì ¨«¨ eax = 0, ¥á«¨
|
||
; ¨§¬¥¨«®áì
|
||
;----------------------------------------------------------
|
||
.check_offset:
|
||
pusha
|
||
mov ecx,ed_pos
|
||
mov ebx,ed_offset
|
||
cmp ebx,ecx
|
||
ja .sub_8
|
||
|
||
push ebx
|
||
call .get_n ;¯®«ã稬 ª®«-¢® ᨬ¢®«®¢ ¢ ¯ ॠॣ¨áâ஢ edx:eax
|
||
pop ebx
|
||
mov edx,ebx
|
||
add edx,eax ;ed_offset+width editbox
|
||
inc edx ;¥®¡å®¤¨¬® ¤«ï ®¬ «ì®£® ¯®«®¦¥¨ï ªãàá®à ¢ ªà ©¥© «¥¢®© ¯®§¨æ¨¨
|
||
cmp edx,ecx
|
||
ja @f
|
||
|
||
mov edx,ed_size
|
||
cmp edx,ecx
|
||
je .add_end
|
||
|
||
sub edx,ecx
|
||
cmp edx,8
|
||
jbe .add_8
|
||
add ebx,8
|
||
jmp .chk_d
|
||
|
||
.sub_8: cmp ecx,0
|
||
je .sub_min
|
||
cmp ebx,8
|
||
jbe .sub_min
|
||
sub ebx,8 ;ebx=ed_offset
|
||
jmp .chk_d
|
||
.sub_min:
|
||
xor ebx,ebx
|
||
jmp .chk_d
|
||
|
||
.add_end:sub edx,eax
|
||
mov ebx,edx
|
||
jmp .chk_d
|
||
.add_8: add ebx,edx
|
||
.chk_d: mov ed_offset,ebx
|
||
call .draw_bg
|
||
and word ed_flags,ed_offset_cl
|
||
popa
|
||
ret
|
||
@@:
|
||
or word ed_flags,ed_offset_fl
|
||
popa
|
||
ret
|
||
;==========================================================
|
||
;=== ®¡à ¡®âª ª« ¢¨ âãàë =================================
|
||
;==========================================================
|
||
.key:
|
||
pusha
|
||
test word ed_flags,ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||
je @b
|
||
;<3B>஢¥àª ¦ âë shift
|
||
call .check_shift
|
||
;----------------------------------------------------------
|
||
;--- ¯à®¢¥à塞, çâ® ¦ â® --------------------------------
|
||
;----------------------------------------------------------
|
||
cmp ah,8
|
||
jz .backspace
|
||
cmp ah,0xb6
|
||
jz .delete
|
||
cmp ah,176
|
||
jz .left
|
||
cmp ah,179
|
||
jz .right
|
||
cmp ah,180
|
||
jz .home
|
||
cmp ah,181
|
||
jz .end
|
||
cmp ah,185 ;insert
|
||
jz .insert
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||
;‡ £«ãèª ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢¨§
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||
cmp ah,177
|
||
jz .no_figure
|
||
cmp ah,178
|
||
jz .no_figure
|
||
cmp ah,27 ;ESC - ª« ¢¨è ))
|
||
jz .no_figure
|
||
;--- ¦ â ¤àã£ ï ª« ¢¨è ---
|
||
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë ?
|
||
jz @f
|
||
cmp ah,'0'
|
||
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
|
||
;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
|
||
test word ed_flags,ed_insert
|
||
jne @f
|
||
cmp ecx,edx
|
||
jae .no_figure
|
||
@@: mov ebx, ed_pos
|
||
cmp ebx,edx
|
||
jl @f ; ¥á«¨ ¬¥ìè¥ ¨«¨ à ¢®
|
||
.no_figure:
|
||
popa
|
||
ret
|
||
.insert: test word ed_flags,ed_insert ;not word ed_insert
|
||
je .insert_1
|
||
and word ed_flags,ed_insert_cl
|
||
jmp .no_figure
|
||
.insert_1:
|
||
or word ed_flags,ed_insert
|
||
jmp .no_figure
|
||
.ins_v:
|
||
dec dword [ebp+38];ed_size ;processing is insert
|
||
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
|
||
push edi eax
|
||
mov ebp,edi
|
||
mov esi,ed_text ; “ª § â¥«ì ¡ãä¥à
|
||
;<3B>㤥¬ à ¡®â âì á® áâப®©
|
||
add esi,ecx ;add ed_size ¤®¡ ¢¨¬ max size
|
||
mov edi,esi
|
||
|
||
cmp ecx,ebx ;…᫨ ã á ¯®§¨æ¨ï ªãàá®à = ⥪ã饬ã à §¬¥àã ¯¥ç â ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®æ¥
|
||
je .In_k
|
||
|
||
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 ;‘¬¥á⨬ è¨ á¨¬¢®«ë ¢ ¯à ¢®
|
||
std
|
||
inc ecx
|
||
@@:
|
||
;--------
|
||
lodsb
|
||
stosb
|
||
;--------
|
||
loop @b
|
||
.In_k: cld
|
||
pop eax
|
||
mov al,ah
|
||
stosb
|
||
pop edi
|
||
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
|
||
; 㢥«¨ç¨¢ ¥¬ § 票¥ à §¬¥à ¨ ¯®§¨æ¨¨
|
||
inc dword ed_size
|
||
inc dword ed_pos
|
||
call .draw_all2
|
||
jmp .shift;.draw_cursor_text
|
||
.delete:
|
||
mov edx,ed_size
|
||
mov ecx,ed_pos
|
||
cmp edx,ecx
|
||
jg .bac_del
|
||
test word ed_flags,ed_shift_on
|
||
jne .del_bac
|
||
popa
|
||
ret
|
||
.bac_del:
|
||
call .del_char
|
||
jmp .draw_all
|
||
|
||
;--- ¦ â ª« ¢¨è backspace ---
|
||
.backspace:
|
||
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
|
||
mov edx,ed_size
|
||
mov ecx,ed_pos
|
||
test ecx,ecx
|
||
jnz .del_bac
|
||
test word ed_flags,ed_shift_on
|
||
jne .bac_del
|
||
popa
|
||
ret
|
||
.del_bac:
|
||
cmp edx,ecx ;if ed_pos=ed_size
|
||
je @f
|
||
dec ecx
|
||
call .del_char
|
||
@@: test word ed_flags,ed_shift_on
|
||
jne .bac_del
|
||
dec dword ed_pos
|
||
|
||
.draw_all:
|
||
push .shift;.draw_cursor_text;eax
|
||
|
||
test word ed_flags,ed_shift_on
|
||
je @f
|
||
mov eax,dword ed_shift_pos
|
||
mov ebx,ed_size
|
||
sub ebx,eax
|
||
mov ed_size,ebx
|
||
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
call .check_offset
|
||
call .draw_bg
|
||
ret
|
||
@@: dec dword ed_size
|
||
|
||
.draw_all2:
|
||
and word ed_flags,ed_shift_cl
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
call .check_offset
|
||
mov ebp,ed_size
|
||
call .clear_bg
|
||
ret
|
||
;--- ¦ â ª« ¢¨è left ---
|
||
.left: mov ebx,ed_pos
|
||
test ebx,ebx
|
||
jz .sh_st_of
|
||
or word ed_flags,ed_left_fl
|
||
call .sh_first_sh
|
||
dec dword ed_pos
|
||
call .sh_enable
|
||
jmp .draw_cursor_text
|
||
;--- ¦ â ª« ¢¨è right ---
|
||
.right: mov ebx,ed_pos
|
||
cmp ebx,ed_size
|
||
je .sh_st_of
|
||
and word ed_flags,ed_right_fl
|
||
call .sh_first_sh
|
||
inc dword ed_pos
|
||
call .sh_enable
|
||
jmp .draw_cursor_text
|
||
.home:
|
||
mov ebx,ed_pos
|
||
test ebx,ebx
|
||
jz .sh_st_of
|
||
call .sh_first_sh
|
||
xor eax,eax
|
||
mov ed_pos,eax
|
||
call .sh_home_end
|
||
jmp .draw_cursor_text
|
||
.end:
|
||
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
|
||
jmp .draw_cursor_text
|
||
;Ž¡à ¡®âª Shift ¤«ï áïâ¨ï ¢ë¤¥«¥¨ï ¥¨§¢¥á⮩ ®¡« áâ¨
|
||
.shift: ;;;;;;;SHIFT
|
||
test word ed_flags,ed_shift
|
||
je .f_exit
|
||
|
||
@@: 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
|
||
call .enable_null
|
||
jmp .draw_cursor_text
|
||
.sh_cl_:
|
||
;;;;;;SHIFT end
|
||
;®¡à ¡®âª ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥¨¨ ¢ë¤¥«¥¨ï
|
||
;¤«ï ®¡à ¡®âª¨ áïâ¨ï ¢ë¤¥«¥¨ï
|
||
;¢å®¤ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
|
||
mov eax,dword ed_pos
|
||
cmp eax,ebx
|
||
|
||
jae .sh_n
|
||
push eax ;¬¥ì襥 ¢ eax
|
||
push ebx ;¡®«ì襥
|
||
jmp .sh_n1
|
||
;¥á«¨ ¨ ç¥
|
||
.sh_n: push ebx
|
||
push eax
|
||
.sh_n1:
|
||
call .check_offset
|
||
call .get_n
|
||
mov edx,eax ;size of ed_box
|
||
mov ecx,ed_offset
|
||
add eax,ecx ;eax = w_off= ed_offset+width
|
||
mov edx,eax ;save
|
||
pop ebx ;¡®«ì襥
|
||
pop eax ;¬¥ì襥
|
||
|
||
cmp eax,ecx ;áà ¢¥¨¥ á ¬¥ì襣® á offset.
|
||
jae .f_f ;¥á«¨ ¡®«ìè¥
|
||
xor eax,eax
|
||
cmp edx,ebx ;cà ¢¨¬ à §¬¥à w_off á ¡®«ì訬
|
||
jb @f
|
||
sub ebx,ecx
|
||
jmp .nxt_f
|
||
@@: mov ebx,edx
|
||
sub ebx,ecx
|
||
jmp .nxt_f
|
||
.f_f:
|
||
sub eax,ecx
|
||
cmp edx,ebx ;cà ¢¨¬ à §¬¥à w_off á ¡®«ì訬
|
||
jle @f
|
||
sub ebx,ecx
|
||
sub ebx,eax
|
||
jmp .nxt_f
|
||
@@:
|
||
mov ebx,edx
|
||
sub ebx,ecx
|
||
sub ebx,eax
|
||
.nxt_f:
|
||
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
|
||
inc ebx
|
||
mov edx,ebp;shift_color
|
||
|
||
call .draw_bg_eax
|
||
@@: call .enable_null
|
||
ret
|
||
;;;;;;;;;;;;;;;;;;;;;
|
||
;“áâ ®¢ª - áï⨥ ¢ë¤¥«¥¨ï ¢ ®¤¨ ᨬ¢®«
|
||
;;;;;;;;;;;;;;;;;;;;;
|
||
.drw_sim:
|
||
mov eax,dword ed_pos
|
||
call .draw_rectangle ; à¨á®¢ âì ¯àאַ㣮«ì¨ª á § ¤ ë¬ æ¢¥â®¬
|
||
jmp @b
|
||
;;;;;;;;;;;;;;;;;;;;;
|
||
;”ãªæ¨ï ãáâ ®¢ª¨ ¢ë¤¥«¥¨ï ¯à¨ ¤¢¨¦¥¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ¦ ⨨ shift
|
||
;‹®£¨ª :
|
||
;;;;;;;;;;
|
||
.draw_wigwag:
|
||
;äãªæ¨ï ãáâ ®¢ª¨ ¯¥à¥¬¥ëå
|
||
mov ebp,shift_color
|
||
call .clear_cursor
|
||
|
||
or word ed_flags,ed_shift_bac ;ãáâ ®¢ª ä« £ , ¢ë¤¥«¥®© ®¡« áâ¨
|
||
mov ebp,shift_color
|
||
mov eax,dword ed_pos
|
||
test word ed_flags,ed_left_fl
|
||
jz .low
|
||
jmp @f
|
||
;;;;;;;;;;
|
||
;”ãªæ¨ï 㤠«¥¨ï ¢ë¤¥«¥¨ï ¯à¨ ¤¢¨¦¥¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ¦ ⨨ shift
|
||
;‹®£¨ª :
|
||
;;;;;;;;;;
|
||
.draw_wigwag_cl:
|
||
;äãªæ¨ï ãáâ ®¢ª¨ ¯¥à¥¬¥ëå
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
|
||
mov ebp,ed_color
|
||
mov eax,dword ed_pos
|
||
test word ed_flags,ed_left_fl
|
||
jz .low
|
||
@@: call .draw_rectangle ; à¨á®¢ âì ¯àאַ㣮«ì¨ª § ªà 訢 ¥¬®© ®¡« áâ¨
|
||
ret
|
||
.low: dec eax
|
||
jmp @b
|
||
;¢å®¤®© ¯ à ¬¥âà ebx - ed_pos
|
||
.sh_first_sh:
|
||
test word ed_flags,ed_shift
|
||
je @f
|
||
mov dword ed_shift_pos_old,ebx
|
||
test word ed_flags,ed_shift_on
|
||
jne @f
|
||
mov dword ed_shift_pos,ebx
|
||
or word ed_flags,ed_shift_on
|
||
@@: ret
|
||
;Ž¡à ¡®âª ªà ©¨å ¯®«®¦¥¨© ¢ editbox ¯à¨ ¦ ⮬ shift
|
||
;¯à®¨§¢®¤¨â áï⨥ ¢ë¤¥«¥¨¥, ¥á«¨ ¥â shift
|
||
;¨ ç¥ ¢®®¡é¥ ¢ë室¨â
|
||
.sh_st_of:
|
||
test word ed_flags,ed_shift
|
||
jne @f
|
||
test word ed_flags,ed_shift_bac
|
||
je @f
|
||
mov ebp,ed_color
|
||
mov ebx,dword ed_shift_pos
|
||
call .sh_cl_ ;®ç¨á⪠¢ë¤¥«¥®£® äà £¬¥â
|
||
and word ed_flags,ed_shift_cl ; ®ç¨á⪠®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥¨¥
|
||
jmp .draw_cursor_text
|
||
@@:
|
||
and word ed_flags,ed_shift_off
|
||
popa
|
||
ret
|
||
|
||
;¯à®¢¥àª á®áâ®ï¨ï shift ¡ë« «¨ ® ¦ â à ìè¥?
|
||
.sh_enable:
|
||
test word ed_flags,ed_shift
|
||
jne .sh_ext_en ; à¨á®¢ âì § ªà è¥ë© ¯àאַ㣮«ì¨ª
|
||
|
||
test word ed_flags,ed_shift_bac
|
||
je @f
|
||
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¢ à ¥ 㦮
|
||
ret
|
||
|
||
@@: mov ebp,ed_color
|
||
call .clear_cursor
|
||
call .check_offset
|
||
ret
|
||
.sh_ext_en:
|
||
call .check_offset
|
||
test word ed_flags,ed_offset_fl
|
||
je @f
|
||
;<3B>¨á®¢ ¨¥ § ªà è¥ëå ¯àאַ㣮«ì¨ª®¢ ¨ ®ç¨á⪠¨å
|
||
mov eax,dword ed_shift_pos
|
||
mov ebx,dword ed_pos
|
||
mov ecx,dword ed_shift_pos_old
|
||
;¯à®¢¥àª ¨ à¨á®¢ ¨¥ § ªà è¥ëå ®¡« á⥩
|
||
cmp eax,ecx
|
||
je .1_shem
|
||
jb .smaller
|
||
cmp ecx,ebx
|
||
ja .1_shem
|
||
call .draw_wigwag_cl ;clear
|
||
jmp .sh_e_end
|
||
.smaller:
|
||
cmp ecx,ebx
|
||
jb .1_shem
|
||
call .draw_wigwag_cl ;clear
|
||
jmp .sh_e_end
|
||
;alike =
|
||
.1_shem: call .draw_wigwag
|
||
.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
|
||
.sh_home_end:
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
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_ ;¢ë©â¨
|
||
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_: call .check_offset
|
||
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
|
||
.del_char:
|
||
mov esi,ed_text
|
||
test word ed_flags,ed_shift_on
|
||
je @f
|
||
mov eax,dword ed_shift_pos
|
||
mov ebx,esi
|
||
cmp eax,ecx
|
||
jae .dh_n
|
||
|
||
mov ed_pos,eax ;çâ® ¡ë ¥ ¡ë«® ã¡¥£ ¨ï ªãàá®à
|
||
mov ebp,ecx
|
||
sub ebp,eax
|
||
add ebx,eax ;eax ¬¥ìè¥
|
||
sub edx,ecx
|
||
add esi,ecx
|
||
|
||
mov dword ed_shift_pos,ebp
|
||
jmp .del_ch_sh
|
||
;¥á«¨ ¨ ç¥
|
||
.dh_n:
|
||
mov ebp,eax
|
||
sub ebp,ecx
|
||
add ebx,ecx
|
||
sub edx,eax
|
||
add esi,eax
|
||
mov dword ed_shift_pos,ebp
|
||
jmp .del_ch_sh
|
||
|
||
@@: add esi,ecx ;㪠§ ⥫ì + ᬥ饨¥ ª ॠ«ì®¬ã ¡ãää¥àã
|
||
mov ebx,esi
|
||
inc esi
|
||
cld
|
||
|
||
sub edx,ecx
|
||
.del_ch_sh:
|
||
|
||
push edi
|
||
mov edi,ebx
|
||
@@:
|
||
lodsb
|
||
stosb
|
||
dec edx
|
||
jns @b
|
||
|
||
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
|
||
;;;;;;;;;;;;;;;;;;;
|
||
;;; Ž¡à ¡®âª ¯à¨¬¨â¨¢®¢
|
||
;;;;;;;;;;;;;;;;;;;;
|
||
;<3B> à¨á®¢ âì ¯àאַ㣮«ì¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
|
||
;¢å®¤ë¥ ¯ à ¬¥âàë:
|
||
;eax=dword ed_pos
|
||
;ebp=-梥â ed_color or shift_color
|
||
.draw_rectangle:
|
||
mov ecx,dword ed_offset
|
||
sub eax,ecx
|
||
lea ebx,[eax*2+eax]
|
||
shl ebx,1
|
||
inc ebx
|
||
add ebx,ed_left
|
||
shl ebx,16
|
||
mov bx,6
|
||
mov edx,ebp
|
||
call .draw_bg_eax
|
||
ret
|
||
;;;;;;;;;;;;;;;;;;
|
||
;;<3B>஢¥àª ¦ â «¨ shift
|
||
;;;;;;;;;;;;;;;;;;
|
||
.check_shift:
|
||
pusha ;á®åà ¨¬ ¢á¥ ॣ¨áâàë
|
||
xor ecx,ecx
|
||
inc ecx
|
||
mov eax,66
|
||
mov ebx,3
|
||
int 0x40
|
||
test al,0x03
|
||
je @f
|
||
or word ed_flags,ed_shift ;ãáâ ®¢¨¬ ä« £
|
||
@@: popa ;¢®ááâ ®¢¨¬ ॣ¨áâàë
|
||
ret
|
||
|
||
;==========================================================
|
||
;=== ®¡à ¡®âª ¬ëè¨ =======================================
|
||
;==========================================================
|
||
.mouse:
|
||
pusha
|
||
mov eax,dword [mouse_flag]
|
||
test eax,eax
|
||
jz @f
|
||
cmp eax,edi
|
||
je @f
|
||
|
||
popa
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯®«ãç ¥¬ á®áâ®ï¨¥ ª®¯®ª ¬ëè¨ -----------------------
|
||
;----------------------------------------------------------
|
||
@@:
|
||
mov eax,37
|
||
mov ebx,2
|
||
int 0x40
|
||
;----------------------------------------------------------
|
||
;--- ¯à®¢¥à塞 á®áâ®ï¨¥ ----------------------------------
|
||
;----------------------------------------------------------
|
||
test eax,1
|
||
jnz .mouse_left_button
|
||
and word ed_flags,ed_mouse_on_off
|
||
xor ebx,ebx
|
||
mov dword [mouse_flag],ebx
|
||
popa
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- Ž¡à ¡®âª .mouse_wigwag
|
||
;----------------------------------------------------------
|
||
.mouse_wigwag:
|
||
shr eax,16
|
||
or word ed_flags,ed_shift_on+ed_shift
|
||
|
||
mov ecx,structure_of_potock
|
||
mov ebx,dword [ecx+34]
|
||
add ebx,ed_left
|
||
add ebx,5
|
||
cmp eax,ebx
|
||
jl .left
|
||
add ebx,ed_width
|
||
cmp eax,ebx
|
||
jg .right
|
||
jmp ._mvpos
|
||
|
||
.mouse_left_button:
|
||
;----------------------------------------------------------
|
||
;--- ¬®¤¨ä¨æ¨à㥬 ª®®à¤¨ âë, â.¥. ¤®¡ ¢«ï¥¬ ª®®à¤¨ âë ®ª .
|
||
;----------------------------------------------------------
|
||
mov eax,9
|
||
mov ebx,structure_of_potock
|
||
or ecx,-1
|
||
int 0x40
|
||
;----------------------------------------------------------
|
||
;--- ¯®«ãç ¥¬ ª®®à¤¨ âë ¬ëè¨ ®â®á¨â¥«ì® 0 â.¥ ¢á¥© ®¡« á⨠íªà
|
||
;----------------------------------------------------------
|
||
mov eax,37
|
||
xor ebx,ebx
|
||
int 0x40
|
||
;----------------------------------------------------------
|
||
;--- € ¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §ë¥ áâ®à®ë?
|
||
;----------------------------------------------------------
|
||
mov ecx,structure_of_potock
|
||
test word ed_flags,ed_mouse_on
|
||
jne .mouse_wigwag
|
||
;----------------------------------------------------------
|
||
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
|
||
;----------------------------------------------------------
|
||
mov ebx,dword [ecx+38]
|
||
add ebx,ed_top
|
||
add ebx,22
|
||
cmp ax,bx
|
||
jl ._blur;.mouse_end_no_focus
|
||
|
||
add ebx,ed_height
|
||
cmp ax,bx
|
||
jg ._blur;.mouse_end_no_focus
|
||
|
||
shr eax,16
|
||
|
||
mov ebx,dword [ecx+34]
|
||
add ebx,ed_left
|
||
add ebx,5
|
||
cmp ax,bx
|
||
jl ._blur;.mouse_end_no_focus
|
||
|
||
add ebx,ed_width
|
||
cmp ax,bx
|
||
jg ._blur;.mouse_end_no_focus
|
||
;--- ¨§¬¥ï¥¬ ¯®§¨æ¨î ªãàá®à ---
|
||
push eax
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
pop eax
|
||
._mvpos:
|
||
mov ecx,structure_of_potock
|
||
mov ebx,dword [ecx+34]
|
||
xor edx,edx
|
||
sub eax,ed_left
|
||
sub eax,ebx
|
||
sub eax,5-2 ;â®«é¨ ®¡¢®¤ª¨ ᪨ =5
|
||
mov ebx,6
|
||
div bx
|
||
add eax,ed_offset
|
||
cmp eax,ed_size
|
||
jna ._mshift
|
||
mov eax,ed_size
|
||
._mshift:
|
||
;;;;;;;
|
||
;;‘¥ªæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥¨ï ¯® shift
|
||
;;;;;;;
|
||
test word ed_flags,ed_shift_bac
|
||
je @f
|
||
mov ebp,dword ed_color
|
||
mov ebx,dword ed_shift_pos
|
||
push eax
|
||
call .sh_cl_
|
||
and word ed_flags,ed_shift_bac_cl
|
||
pop eax
|
||
@@:
|
||
test word ed_flags,ed_mouse_on
|
||
jne @f
|
||
|
||
mov dword ed_shift_pos,eax
|
||
or word ed_flags,ed_mous_adn_b;ed_mouse_on
|
||
mov dword ed_pos,eax
|
||
jmp .m_sh
|
||
@@:
|
||
cmp eax,dword ed_shift_pos ;¥á«¨ ¯®§¨æ¨¨ ¥ ¨§¬¥¨«¨áì
|
||
je .mouse_ex
|
||
mov ed_pos,eax
|
||
mov ebp,dword shift_color
|
||
mov ebx,dword ed_shift_pos
|
||
call .sh_cl_
|
||
or word ed_flags,ed_mous_adn_b ;ãáâ ®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
|
||
mov dword [mouse_flag],edi
|
||
.m_sh: call .draw_text
|
||
call .draw_cursor
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà ãáâ ®¢ª¨ 䮪ãá ---------------------------
|
||
;----------------------------------------------------------
|
||
bts word ed_flags,1
|
||
jc .mouse_ex
|
||
jmp .drc
|
||
._blur:
|
||
test word ed_flags,ed_always_focus
|
||
jne .mouse_ex
|
||
btr word ed_flags,1 ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||
jnc .mouse_ex
|
||
|
||
mov ebp,ed_color
|
||
call .clear_cursor
|
||
.drc: call .draw_border
|
||
.mouse_ex:
|
||
|
||
popa
|
||
ret
|
||
;----------------------------------------------------------
|
||
;--- ¯à®æ¥¤ãà à §¬ë¢ ¨ï 䮪ãá --------------------------
|
||
;----------------------------------------------------------
|
||
;.blur:
|
||
;pusha
|
||
;._blur:
|
||
;btr ed_flags,1
|
||
;jnc @f
|
||
;call .draw_border
|
||
;call .clear_cursor
|
||
;@@:
|
||
;popa
|
||
;ret
|
||
}
|
||
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë
|
||
ed_always_focus= 100000000000000b
|
||
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï
|
||
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
|
||
ed_shift_on_off=1111111111110111b
|
||
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î
|
||
ed_shift_off= 1111111111111011b
|
||
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥
|
||
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï
|
||
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_mouse_on = 100000000b
|
||
ed_mous_adn_b= 100011000b
|
||
ed_mouse_on_off=1111111011111111b
|
||
ed_height=14 ; ¢ëá®â
|
||
shift_color=0x6a9480
|
||
macro draw_edit_boxes start,end
|
||
{
|
||
mov edi,start
|
||
mov ecx,((end-start)/ed_struc_size)
|
||
@@:
|
||
call edit_box.draw
|
||
add edi,ed_struc_size
|
||
loop @b
|
||
}
|
||
|
||
macro mouse_edit_boxes start,end
|
||
{
|
||
mov edi,start
|
||
mov ecx,((end-start)/ed_struc_size)
|
||
@@:
|
||
call edit_box.mouse
|
||
add edi,ed_struc_size
|
||
loop @b
|
||
}
|
||
|
||
macro key_edit_boxes start,end
|
||
{
|
||
mov edi,start
|
||
mov ecx,((end-start)/ed_struc_size)
|
||
@@:
|
||
call edit_box.key
|
||
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
|
||
{
|
||
.width dd width
|
||
.left dd left
|
||
.top dd top
|
||
.color dd color
|
||
.focus_border_color dd focus_border_color
|
||
.blur_border_color dd blur_border_color
|
||
.text_color dd text_color
|
||
.max dd max
|
||
.text dd text
|
||
.flags dw flags+0
|
||
.size dd size+0
|
||
.pos dd 0
|
||
.offset dd 0
|
||
.cl_curs_x dd 0
|
||
.cl_curs_y dd 0
|
||
.shift dd 0
|
||
.shift_old dd 0
|
||
}
|
||
|
||
|
||
macro edit_boxes_set_sys_color start,end,color_table
|
||
{
|
||
mov edi,start
|
||
mov ecx,((end-start)/ed_struc_size)
|
||
mov esi,color_table
|
||
@@:
|
||
mov eax,[esi+36]
|
||
mov ebx,[esi+20]
|
||
mov ed_focus_border_color,eax
|
||
shr bh,1
|
||
shr bl,1
|
||
shr ah,1
|
||
shr al,1
|
||
add ah,bh
|
||
add al,bl
|
||
ror eax,16
|
||
ror ebx,16
|
||
shr bl,1
|
||
shr al,1
|
||
add al,bl
|
||
ror eax,16
|
||
mov ed_blur_border_color,eax
|
||
add edi,ed_struc_size
|
||
loop @b
|
||
}
|
||
|
||
macro draw_edit_box ed_ptr
|
||
{
|
||
mov edi,ed_ptr
|
||
call edit_box.draw
|
||
}
|
||
|
||
macro mouse_edit_box ed_ptr
|
||
{
|
||
mov edi,ed_ptr
|
||
call edit_box.mouse
|
||
}
|
||
|
||
macro key_edit_box ed_ptr
|
||
{
|
||
mov edi,ed_ptr
|
||
call edit_box.key
|
||
} |