kolibrios-gitea/programs/develop/libraries/box_lib/trunk/editbox.mac
IgorA 64cdacca6e Reorganization of the library 'box_lib.obj':
1) new file 'box_lib.mac' to connect all elements
2) Eliminate duplication of code.
Minor improvements 'fasm'.

git-svn-id: svn://kolibrios.org@1372 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-01-09 17:39:07 +00:00

1441 lines
44 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ed_struc_size=76
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Basic macros for use editbox ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ed_width equ [edi] ;è¨à¨­  ª®¬¯®­¥­â 
ed_left equ [edi+4] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
ed_top equ [edi+8] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
ed_color equ [edi+12] ;梥â ä®­  ª®¬¯®­¥­â 
shift_color equ [edi+16] ;=0x6a9480 ¤«ï ¯à¨¬¥à  ¢®§ì¥¬ ¦¥«¥­ë© 梥⠡®ªá 
ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
ed_blur_border_color equ [edi+24] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
ed_text_color equ [edi+28] ;梥â ⥪áâ 
ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
ed_mouse_variable equ [edi+40] ; 㪠§ â¥«ì ­  ¯¥à¥¬¥­­ãî ¤«ï ¡®ªá /£à㯯ë
ed_flags equ [edi+44] ;ä« £¨
bp_flags equ [ebp+44] ;¢ ­¥ª®â®àëå ¯à®æ¥¤ãà å edi ¨á¯®«ì§ã¥âáï, ¢§ ¬¥­ 㪠§ â¥«ì åà ­¨âìáï ¢ ebp
ed_size equ [edi+48] ;ª®«-¢® ᨬ¢®«®¢
bp_size equ [ebp+48] ;ª®«-¢® ᨬ¢¯®«®¢, ¤«ï  ¤à¥á æ¨¨ ¨á¯«ì§ã¥âáï ebp¡ edi § ­ïâ
ed_pos equ [edi+52] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+56] ;ᬥ饭¨¥
cl_curs_x equ [edi+60] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+64] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+68] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+72] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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_shift_mcl= 1111111111111011b
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 ; ¢ëá®â 
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
{
.width dd width
.left dd left
.top dd top
.color dd color
.shift_color dd shift_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
.mouse_variable dd mouse_variable
.flags dd flags+0
.size dd size+0
.pos dd pos+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,dword [esi+36]
mov ebx,dword [esi+20]
push dword eax
pop dword ed_focus_border_color
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 dword ed_blur_border_color,eax
mov dword shift_color,eax
add edi,ed_struc_size
loop @b
}
macro init_editbox
{
pushad
mcall
popad
}
macro use_editbox_draw
{
edit_box:
.draw:
pushad
;--- à¨á㥬 à ¬ªã ---
mov edi,dword [esp+36]
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
jz @f
call .draw_cursor
@@:
call .draw_text
; ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.editbox_exit:
popad
ret 4
}
macro use_editbox_key
{
;==========================================================
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
;==========================================================
edit_box_key:
pushad
mov edi,dword [esp+36]
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je edit_box.editbox_exit
test word ed_flags,ed_mouse_on
jne edit_box.editbox_exit
;<3B>஢¥àª  ­ ¦ â shift ?
call edit_box_key.check_shift
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
use_key_process backspase,delete,left,right,home,end,insert
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B>஢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ¥á«¨ â ª®©­¥®¡å®¤¨¬®á⨠­¥â ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_figures_only
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯à®¢¥àª  ­  shift ¡ë« «¨ ­ ¦ â
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_shift_press
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_cur_end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspase,home,end,left,right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_key
}
macro use_editbox_mouse
{
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
;==========================================================
;save for stdcall ebx,esi,edi,ebp
edit_box_mouse:
pushad
mov edi,dword [esp+36]
;debug
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
;----------------------------------------------------------
mcall 37,2
;----------------------------------------------------------
;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
;----------------------------------------------------------
test eax,1
jnz edit_box_mouse.mouse_left_button
and word ed_flags,ed_mouse_on_off
mov ebx,dword ed_mouse_variable
push 0
pop dword [ebx]
; mov dword [ebx],ebx
jmp edit_box.editbox_exit
.mouse_left_button:
;----------------------------------------------------------
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
;----------------------------------------------------------
mov eax,dword ed_mouse_variable
push dword [eax]
pop eax
test eax,eax
jz @f
cmp eax,edi
je @f
jmp edit_box_mouse._blur
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
;----------------------------------------------------------
@@: mcall 37,1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”ã­ªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_general_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_mouse_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;­¨¦¥ à á¯®«®¦¥­ë ä㭪樨 ª®â®à묨 ॠ«¨§ã¥âáï ¢¥áì  «£®à¨â¬
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Œ ªà®á ¤«ï ¢ë¢®¤  ®á­®¢­ëå ä㭪権 ª®â®àë¥ ¨á¯«ì§ãîâáï ¡®ªá®¬
macro use_general_func
{
;debug_func
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­®© ç á⨠-----------------
;----------------------------------------------------------
edit_box.draw_shift:
test word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jz @f
mov ebp,shift_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
@@: ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
edit_box.draw_text:
;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ ---
;--- çâ®¡ë ¬ãá®à ­¥ à¨á®¢ âì ---
call edit_box.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
add ebx,ed_top
mov ecx,ed_text_color
add ebx,4
add edx,ed_text
mcall
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
;¢å®¤­ë¥ ¤ ­­ë¥
;eax
;edx - color
;----------------------------------------------------------
;¢å®¤ ⮫쪮 梥â edx
edit_box.draw_bg:
mov ebx,ed_left
add ebx,1
mov edx,ed_color
shl ebx,16
add ebx,ed_width
sub ebx,1
edit_box.draw_bg_eax:
mov ecx,ed_top
mov eax,13
add ecx,1
shl ecx,16
add ecx,ed_height
dec ecx
mcall
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â 
;----------------------------------------------------------
edit_box.get_n:
mov eax,ed_width ;¯®«ã祬 è¨à¨­ã ª®¬¯®­¥­â 
xor edx,edx ;१ã«ìâ â à á¯®«®£ ¥âáï ¢ ¯ à¥ edx:eax ¢ eax - ®áâ â®ª
sub eax,4 ;¢ëç⨬ 4
mov ebx,6 ;§ £à㧬¨ ¤¥«¨â¥«ì
div ebx ;à §¬¤¥«¨¬ ­  6
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
;----------------------------------------------------------
;¢å®¤­ë¥ ebp- 梥â
edit_box.clear_cursor:
mov edx,ebp
mov ebx,cl_curs_x
mov ecx,cl_curs_y
jmp edit_box.draw_curs
edit_box.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 ebx,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 ecx,ed_height-4
mov cl_curs_x,ebx
mov cl_curs_y,ecx
edit_box.draw_curs:
mcall 38
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
;----------------------------------------------------------
edit_box.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 ebx,ed_width
mov ecx,ed_top
mov esi,ecx
shl ecx,16
mov cx,si
mcall
;--- á­¨§ã ---
mov esi,ecx
add ecx,ed_height
mov ebp,ecx
shl ecx,16
mov cx,bp
mcall
;--- á«¥¢  ---
mov cx,si
mov ebp,ebx
sub ebx,ed_width
mcall
;--- á¯à ¢  ---
mov ebx,ebp
shl ebx,16
mov bx,bp
mcall
ret
;----------------------------------------------------------
;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
;--- ¥á«¨ ᬥ饭¨¥ ¡ë«® ãáâ ­®¢ª  ä« £  ed_offset_cl ¨­ ç¥
; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
; ¢ ®¡é¥© ¡¨â®¢®© ¬ àà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
;----------------------------------------------------------
edit_box.check_offset:
pushad
mov ecx,ed_pos
mov ebx,ed_offset
cmp ebx,ecx
ja edit_box.sub_8
push ebx
call edit_box.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 edit_box.add_end
sub edx,ecx
cmp edx,8
jbe edit_box.add_8
add ebx,8
jmp edit_box.chk_d
edit_box.sub_8:
cmp ecx,0
je edit_box.sub_min
cmp ebx,8
jbe edit_box.sub_min
sub ebx,8 ;ebx=ed_offset
jmp edit_box.chk_d
edit_box.sub_min:
xor ebx,ebx
jmp edit_box.chk_d
edit_box.add_end:sub edx,eax
mov ebx,edx
jmp edit_box.chk_d
edit_box.add_8: add ebx,edx
edit_box.chk_d: mov ed_offset,ebx
call edit_box.draw_bg
and word ed_flags,ed_offset_cl
edit_ex
@@:
or word ed_flags,ed_offset_fl
edit_ex
}
macro use_key_func
{
;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
edit_box_key.shift: ;;;;;;;SHIFT
test word ed_flags,ed_shift
je edit_box_key.f_exit
@@: mov ebp,shift_color
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
jmp edit_box.draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
edit_box_key.f_exit: call edit_box.check_offset
and word ed_flags,ed_shift_cl
call edit_box_key.enable_null
jmp edit_box.draw_cursor_text
edit_box_key.sh_cl_:
;;;;;;SHIFT end
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov eax,dword ed_pos
cmp eax,ebx
jae edit_box_key.sh_n
push eax ;¬¥­ì襥 ¢ eax
push ebx ;¡®«ì襥
jmp edit_box_key.sh_n1
;¥á«¨ ¨­ ç¥
edit_box_key.sh_n:
push ebx
push eax
edit_box_key.sh_n1:
call edit_box.check_offset
call edit_box.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 edit_box_key.f_f ;¥á«¨ ¡®«ìè¥
xor eax,eax
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jb @f
sub ebx,ecx
jmp edit_box_key.nxt_f
@@: mov ebx,edx
sub ebx,ecx
jmp edit_box_key.nxt_f
edit_box_key.f_f:
sub eax,ecx
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jle @f
sub ebx,ecx
sub ebx,eax
jmp edit_box_key.nxt_f
@@:
mov ebx,edx
sub ebx,ecx
sub ebx,eax
edit_box_key.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 edit_box.draw_bg_eax
@@: call edit_box_key.enable_null
ret
;;;;;;;;;;;;;;;;;;;;;
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
;;;;;;;;;;;;;;;;;;;;;
edit_box_key.drw_sim:
mov eax,dword ed_pos
call edit_box_key.draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
jmp @b
;;;;;;;;;;;;;;;;;;;;;
;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
edit_box_key.draw_wigwag:
;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
mov ebp,shift_color
call edit_box.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 edit_box_key.low
jmp @f
;;;;;;;;;;
;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
edit_box_key.draw_wigwag_cl:
;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
mov ebp,ed_color
call edit_box.clear_cursor
mov ebp,ed_color
mov eax,dword ed_pos
test word ed_flags,ed_left_fl
jz edit_box_key.low
@@: call edit_box_key.draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª § ªà è¨¢ ¥¬®© ®¡« áâ¨
ret
edit_box_key.low: dec eax
jmp @b
;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
edit_box_key.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
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
edit_box_key.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 edit_box_key.sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
and word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
jmp edit_box.draw_cursor_text
@@:
and word ed_flags,ed_shift_off
popad
ret 4
;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
edit_box_key.sh_enable:
test word ed_flags,ed_shift
jne edit_box_key.sh_ext_en ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª
test word ed_flags,ed_shift_bac
je @f
call edit_box.check_offset
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
call edit_box_key.draw_wigwag_cl
and word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
ret
@@: mov ebp,ed_color
call edit_box.clear_cursor
call edit_box.check_offset
ret
edit_box_key.sh_ext_en:
call edit_box.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 edit_box_key.1_shem
jb edit_box_key.smaller
cmp ecx,ebx
ja edit_box_key.1_shem
call edit_box_key.draw_wigwag_cl ;clear
jmp edit_box_key.sh_e_end
edit_box_key.smaller:
cmp ecx,ebx
jb edit_box_key.1_shem
call edit_box_key.draw_wigwag_cl ;clear
jmp edit_box_key.sh_e_end
;alike =
edit_box_key.1_shem: call edit_box_key.draw_wigwag
edit_box_key.sh_e_end: and word ed_flags,ed_shift_off
ret
@@: mov ebp,shift_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
jmp edit_box_key.sh_e_end
;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
edit_box_key.sh_home_end:
mov ebp,ed_color
call edit_box.clear_cursor
test word ed_flags,ed_shift_bac
je @f
mov ebp,ed_color
mov ebx,dword ed_shift_pos_old
call edit_box_key.sh_cl_
@@: test word ed_flags,ed_shift
je edit_box_key.sh_exit_ ;¢ë©â¨
mov ebp,shift_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jmp edit_box_key.sh_e_end
edit_box_key.sh_exit_:
call edit_box.check_offset
ret
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
edit_box_key.enable_null:
pusha
mov eax,ed_size
mov ebx,ed_text
test eax,eax
add eax,ebx
jne @f
inc eax
@@: xor ebx,ebx
mov [eax],bl
edit_ex
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
edit_box_key.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 edit_box_key.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 edit_box_key.del_ch_sh
;¥á«¨ ¨­ ç¥
edit_box_key.dh_n:
mov ebp,eax
sub ebp,ecx
add ebx,ecx
sub edx,eax
add esi,eax
mov dword ed_shift_pos,ebp
jmp edit_box_key.del_ch_sh
@@: add esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãää¥àã
mov ebx,esi
inc esi
cld
sub edx,ecx
edit_box_key.del_ch_sh:
push edi
mov edi,ebx
@@:
lodsb
stosb
dec edx
jns @b
pop edi
ret
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
edit_box_key.clear_bg:
call edit_box.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 edit_box_key.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
edit_box_key.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 edit_box.draw_bg_eax
ret
;;;;;;;;;;;;;;;;;;;
;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
;;;;;;;;;;;;;;;;;;;;
;<3B> à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
;¢å®¤­ë¥ ¯ à ¬¥âàë:
;eax=dword ed_pos
;ebp=-梥â ed_color or shift_color
edit_box_key.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
add ebx,6
mov edx,ebp
call edit_box.draw_bg_eax
ret
;;;;;;;;;;;;;;;;;;
;;<3B>஢¥àª  ­ ¦ â «¨ shift
;;;;;;;;;;;;;;;;;;
edit_box_key.check_shift:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mcall 66,3
test al,0x03
je @f
or word ed_flags,ed_shift ;ãáâ ­®¢¨¬ ä« £
@@:edit_ex
}
;¬ ªà®á ª« ¢¨è ­  ª®â®àë¥ ¯à®¨á室¨â ॠªæ¨ï
macro use_key_process backspase,delete,left,right,home,end,insert
{
if backspase eq
else
cmp ah,8
jz edit_box_key.backspace
end if
if delete eq
else
cmp ah,0xb6
jz edit_box_key.delete
end if
if left eq
else
cmp ah,176
jz edit_box_key.left
end if
if right eq
else
cmp ah,179
jz edit_box_key.right
end if
if home eq
else
cmp ah,180
jz edit_box_key.home
end if
if home eq
else
cmp ah,181
jz edit_box_key.end
end if
if insert eq
else
cmp ah,185 ;insert
jz edit_box_key.insert
end if
}
macro use_key_no_process up,down,esc,enter,tab,numl,capsl,scrolll
{
if up eq
else
cmp ah,177
jz edit_box.editbox_exit
end if
if down eq
else
cmp ah,178
jz edit_box.editbox_exit
end if
if esc eq
else
cmp ah,27 ;ESC - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if enter eq
else
cmp ah,13 ;ENTER - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if tab eq
else
cmp ah,9 ;TAB - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if numl eq
else
cmp ah,4 ;Num Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if capsl eq
else
cmp ah,2 ;Caps Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
if scrolll eq
else
cmp ah,1 ;Scroll Lock - ª« ¢¨è  ))
jz edit_box.editbox_exit
end if
}
macro use_key_figures_only
{
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë ?
jz @f
cmp ah,'0'
jb edit_box.editbox_exit
cmp ah,'9'
ja edit_box.editbox_exit
@@:
}
macro are_key_shift_press
{
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 input arrea
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
mov ebp,ed_size
call edit_box_key.clear_bg
;;;;;;;;;;;;;;;;;;;;;
popa
call edit_box_key.del_char
;;;;
mov eax,dword ed_shift_pos
mov ebx,ed_size
sub ebx,eax
mov ed_size,ebx
pop eax
@@:
}
macro are_key_cur_end
{
mov ecx,ed_size
mov edx, ed_max
test word ed_flags,ed_insert
jne @f
cmp ecx,edx
jae edit_box.editbox_exit
@@: mov ebx, ed_pos
cmp ebx,edx
jl @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
jmp edit_box.editbox_exit
@@: ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
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 edit_box_key.In_k
test dword bp_flags,ed_insert ;IF insert is enable â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
jne edit_box_key.ins_v
;clear
pusha
mov edi,ebp
mov ebp,ed_size
call edit_box_key.clear_bg
popa
sub ecx,ebx ;<3B> ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
inc edi ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
std
inc ecx
@@:
;--------
lodsb
stosb
;--------
loop @b
edit_box_key.In_k:
cld
pop eax
mov al,ah
stosb
pop edi
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
inc dword ed_size
inc dword ed_pos
call edit_box_key.draw_all2
jmp edit_box_key.shift
}
macro use_work_key
{
edit_box_key.insert: test word ed_flags,ed_insert ;not word ed_insert
je @f
and word ed_flags,ed_insert_cl
jmp edit_box.editbox_exit
@@:
or word ed_flags,ed_insert
jmp edit_box.editbox_exit
edit_box_key.ins_v:
; dec dword [ebp+48];ed_size ;processing is insert
dec dword bp_size
sub esi,ecx
add esi,ebx
mov edi,esi
;clear
pusha
mov edi,ebp
mov ebp,ed_pos
call edit_box_key.clear_bg
popa
jmp edit_box_key.In_k
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_key.delete:
mov edx,ed_size
mov ecx,ed_pos
cmp edx,ecx
jg edit_box_key.bac_del
test word ed_flags,ed_shift_on
jne edit_box_key.del_bac
popad
ret 4
edit_box_key.bac_del:
call edit_box_key.del_char
jmp edit_box_key.draw_all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  backspace ---
edit_box_key.backspace:
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
mov ecx,ed_pos
test ecx,ecx
jnz edit_box_key.del_bac
test word ed_flags,ed_shift_on
jne edit_box_key.bac_del
popad
ret 4
edit_box_key.del_bac:
mov edx,ed_size
cmp edx,ecx ;if ed_pos=ed_size
je @f
dec ecx
call edit_box_key.del_char
@@: test word ed_flags,ed_shift_on
jne edit_box_key.bac_del
dec dword ed_pos
edit_box_key.draw_all:
push edit_box_key.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 edit_box.clear_cursor
call edit_box.check_offset
call edit_box.draw_bg
ret
@@: dec dword ed_size
edit_box_key.draw_all2:
and word ed_flags,ed_shift_cl
mov ebp,ed_color
call edit_box.clear_cursor
call edit_box.check_offset
mov ebp,ed_size
call edit_box_key.clear_bg
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  left ---
edit_box_key.left:
mov ebx,ed_pos
test ebx,ebx
jz edit_box_key.sh_st_of
or word ed_flags,ed_left_fl
call edit_box_key.sh_first_sh
dec dword ed_pos
call edit_box_key.sh_enable
jmp edit_box.draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  right ---
edit_box_key.right:
mov ebx,ed_pos
cmp ebx,ed_size
je edit_box_key.sh_st_of
and word ed_flags,ed_right_fl
call edit_box_key.sh_first_sh
inc dword ed_pos
call edit_box_key.sh_enable
jmp edit_box.draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_key.home:
mov ebx,ed_pos
test ebx,ebx
jz edit_box_key.sh_st_of
call edit_box_key.sh_first_sh
xor eax,eax
mov ed_pos,eax
call edit_box_key.sh_home_end
jmp edit_box.draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit_box_key.end:
mov ebx,ed_pos
cmp ebx,dword ed_size
je edit_box_key.sh_st_of
call edit_box_key.sh_first_sh
mov eax,ed_size
mov ed_pos,eax
call edit_box_key.sh_home_end
jmp edit_box.draw_cursor_text
}
macro use_mouse_func
{
;----------------------------------------------------------
;--- Ž¡à ¡®âª  .mouse_wigwag
;----------------------------------------------------------
edit_box_mouse.mouse_wigwag:
shr eax,16
or word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
;;;;;;;;;;;;;;;;;;
test ax,0x8000
jnz edit_box_mouse.mleft
mov ebx,ed_left
cmp eax,ebx
jb edit_box_mouse.mleft
add ebx,ed_width
cmp eax,ebx
ja edit_box_mouse.mright
sub ebx,ed_width
xor edx,edx
sub eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
mov ebx,6
div ebx
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
;;;;;;;;;;;;;;;;;;
;<3B>®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
;<3B>¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
add eax,ed_offset ;¤®¡ ¢¨¬ ᬥ饭¨¥
cmp eax,dword ed_size ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
ja edit_box_mouse.mwigvag
edit_box_mouse.mdraw:
mov dword ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
;<3B>¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov ecx,dword ed_shift_pos
mov ebx,dword ed_shift_pos_old
mov dword ed_shift_pos_old,eax ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
cmp ecx,ebx ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
je edit_box_mouse.m1_shem ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
jb edit_box_mouse.msmaller ;¤¢¨¦¥­¨¥ ¡ë«® ->
cmp ebx,eax ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
ja edit_box_mouse.m1_shem ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
je edit_box_mouse.mwigvag ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
mov ebp,ed_color ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call edit_box_key.sh_cl_
jmp edit_box_mouse.mwigvag
edit_box_mouse.msmaller:
cmp ebx,eax
jb edit_box_mouse.m1_shem
mov ebp,ed_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call edit_box_key.sh_cl_
jmp edit_box_mouse.mwigvag
;alike =
edit_box_mouse.m1_shem:
mov ebp,shift_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov ebx,ecx
call edit_box_key.sh_cl_
jmp edit_box_mouse.mwigvag
edit_box_mouse.mwigvag:
and word ed_flags,ed_shift_mcl
jmp edit_box.draw_cursor_text
; popa
; ret
edit_box_mouse.mleft:
mov eax,ed_pos
cmp eax,0
jbe edit_box_mouse.mwigvag
dec eax
call edit_box.check_offset
push eax
mov ebx,ed_shift_pos
mov ebp,shift_color
call edit_box_key.sh_cl_
pop eax
jmp edit_box_mouse.mdraw
edit_box_mouse.mright:
mov eax,ed_pos
mov ebx,ed_size
cmp eax,ebx
jae edit_box_mouse.mwigvag
inc eax
call edit_box.check_offset
mov ebx,ed_shift_pos
mov ebp,shift_color
push eax
call edit_box_key.sh_cl_
pop eax
jmp edit_box_mouse.mdraw
}
macro use_work_mouse
;----------------------------------------------------------
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
;----------------------------------------------------------
{
test word ed_flags,ed_mouse_on
jne edit_box_mouse.mouse_wigwag
;----------------------------------------------------------
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
;----------------------------------------------------------
mov ebx,ed_top
cmp ax,bx
jl edit_box_mouse._blur;.mouse_end_no_focus
add ebx,ed_height
cmp ax,bx
jg edit_box_mouse._blur;.mouse_end_no_focus
shr eax,16
mov ebx,ed_left
cmp ax,bx
jl edit_box_mouse._blur;.mouse_end_no_focus
add ebx,ed_width
cmp ax,bx
jg edit_box_mouse._blur;.mouse_end_no_focus
;--- ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à  ---
push eax
mov ebp,ed_color
call edit_box.clear_cursor
pop eax
edit_box_mouse._mvpos:
xor edx,edx
sub eax,ed_left
mov ebx,6
div bx
add eax,ed_offset
cmp eax,ed_size
jna edit_box_mouse._mshift
mov eax,ed_size
edit_box_mouse._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 edit_box_key.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_mouse_on
mov dword ed_pos,eax
; mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
mov ebx,dword ed_mouse_variable
push edi
pop dword [ebx]
bts word ed_flags,1 ;ãáâ ­®¢ª  䮪ãá 
jmp edit_box_mouse.m_sh
@@:
cmp eax,dword ed_shift_pos ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
je edit_box.editbox_exit
mov ed_pos,eax
mov ebp,dword shift_color
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
or word ed_flags,ed_mous_adn_b ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
edit_box_mouse.m_sh:
call edit_box.draw_text
call edit_box.draw_cursor
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
jmp edit_box_mouse.drc
edit_box_mouse._blur:
test word ed_flags,ed_always_focus
jne edit_box.editbox_exit
btr word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jnc edit_box.editbox_exit
mov ebp,ed_color
call edit_box.clear_cursor
edit_box_mouse.drc: call edit_box.draw_border
jmp edit_box.editbox_exit
}
; Œ ªà®á ¢ë室 
macro edit_ex
{
popad
ret
}
macro debug
{
;----------- ®â« ¤ª 
pushad
; mov dword [ed_buffer.2],0
; mov eax,edi
mov eax,dword [ed_buffer.2]
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
;----------- ®â« ¤ª 
}
macro debug_func
{
.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 ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
}
ed_struc_size=76
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
{
.width dd width
.left dd left
.top dd top
.color dd color
.shift_color dd shift_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
.mouse_variable dd mouse_variable
.flags dd flags+0
.size dd size+0
.pos dd pos+0
.offset dd 0
.cl_curs_x dd 0
.cl_curs_y dd 0
.shift dd 0
.shift_old dd 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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_shift_mcl= 1111111111111011b
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 ; ¢ëá®â 
}