Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 506 → Rev 507

/programs/develop/examples/editbox/trunk/EDITBOX.INC
45,6 → 45,10
call .draw_cursor
@@:
call .draw_text
;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢
;;;;;;;;;;;;;;;;;;;;;;;;;;
.editbox_exit:
edit_ex
;==========================================================
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
52,7 → 56,7
.key:
pusha
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .no_figure
je .editbox_exit
;à®¢¥àª  ­ ¦ â shift ?
call .check_shift
;----------------------------------------------------------
68,193 → 72,18
;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ¥á«¨ â ª®©­¥®¡å®¤¨¬®á⨠­¥â ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_figures_only
;¯à®¢¥àª  ­  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:
edit_ex
.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+42];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 ; “ª § â¥«ì ­  ¡ãä¥à
;ã¤¥¬ à ¡®â âì á® áâப®©
add esi,ecx ;add ed_size ¤®¡ ¢¨¬ max size
mov edi,esi
 
cmp ecx,ebx ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
je .In_k
 
test word [ebp+40],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 ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
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
edit_ex
.bac_del:
call .del_char
jmp .draw_all
;--- ­ ¦ â  ª« ¢¨è  backspace ---
.backspace:
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
mov ecx,ed_pos
test ecx,ecx
jnz .del_bac
test word ed_flags,ed_shift_on
jne .bac_del
 
edit_ex
.del_bac:
mov edx,ed_size
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 ¡ë« «¨ ­ ¦ â
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_shift_press
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_cur_end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspase,home,end,left,right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_key
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
;==========================================================
273,7 → 102,7
and word ed_flags,ed_mouse_on_off
xor ebx,ebx
mov dword [mouse_flag],ebx
edit_ex
jmp .editbox_exit
.mouse_left_button:
;----------------------------------------------------------
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
288,111 → 117,11
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
;----------------------------------------------------------
@@: mcall 37,0
;----------------------------------------------------------
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
;----------------------------------------------------------
test word ed_flags,ed_mouse_on
jne .mouse_wigwag
;----------------------------------------------------------
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
;----------------------------------------------------------
mov ebx,[procinfo.box.top]
add ebx,ed_top
if scr_h eq
else
add ebx,scr_h
end if
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,[procinfo.box.left]
add ebx,ed_left
if scr_w eq
else
add ebx,scr_w
end if
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 ebx,dword [procinfo.box.left]
xor edx,edx
sub eax,ed_left
sub eax,ebx
if scr_w eq
else
add ebx,scr_w
sub eax,2
end if
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_mouse_on
mov dword ed_pos,eax
mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
bts word ed_flags,1 ;ãáâ ­®¢ª  䮪ãá 
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 +
.m_sh: call .draw_text
call .draw_cursor
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
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:
 
edit_ex
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”ã­ªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_mause scr_h,scr_w
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_general_func
400,118 → 129,14
;”㭪樨 ¤«ï à ¡®âë á key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_func
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à §¬ë¢ ­¨ï 䮪ãá  --------------------------
;----------------------------------------------------------
;.blur:
;pusha
;._blur:
;btr ed_flags,1
;jnc @f
;call .draw_border
;call .clear_cursor
;@@:
;edit_ex
 
;----------------------------------------------------------
;--- Ž¡à ¡®âª  .mouse_wigwag
;----------------------------------------------------------
.mouse_wigwag:
shr eax,16
or word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
;;;;;;;;;;;;;;;;;;
mov ebx,[procinfo.box.left]
add ebx,ed_left
if scr_w eq
else
add ebx,scr_w
end if
cmp eax,ebx
jb .mleft
 
add ebx,ed_width
cmp eax,ebx
ja .mright
 
sub ebx,ed_width
 
xor edx,edx
sub eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
mov ebx,6
div ebx
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
;;;;;;;;;;;;;;;;;;
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
add eax,ed_offset ;¤®¡ ¢¨¬ ᬥ饭¨¥
cmp eax,dword ed_size ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
ja .mwigvag
.mdraw:
mov dword ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov ecx,dword ed_shift_pos
mov ebx,dword ed_shift_pos_old
mov dword ed_shift_pos_old,eax ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
cmp ecx,ebx ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
je .m1_shem ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
jb .msmaller ;¤¢¨¦¥­¨¥ ¡ë«® ->
cmp ebx,eax ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
ja .m1_shem ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
je .mwigvag ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
mov ebp,ed_color ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
.msmaller:
cmp ebx,eax
jb .m1_shem
mov ebp,ed_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
;alike =
.m1_shem:
mov ebp,shift_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov ebx,ecx
call .sh_cl_
jmp .mwigvag
.mwigvag:
and word ed_flags,ed_shift_mcl
jmp .draw_cursor_text
; popa
; ret
.mleft:
mov eax,ed_pos
cmp eax,0
jbe .mwigvag
dec eax
call .check_offset
push eax
mov ebx,ed_shift_pos
mov ebp,shift_color
call .sh_cl_
pop eax
jmp .mdraw
.mright:
mov eax,ed_pos
mov ebx,ed_size
cmp eax,ebx
jae .mwigvag
inc eax
call .check_offset
mov ebx,ed_shift_pos
mov ebp,shift_color
push eax
call .sh_cl_
pop eax
jmp .mdraw
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_mouse_func scr_w
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥­¨ï
/programs/develop/examples/editbox/trunk/History
6,7 → 6,8
Ýòî íå ìíîãî ôîëüêëåðà, ñâÿçàííîå, ñ òåì, ÷òî íàïèñàíèå ïðîãðàìì äëèííûå è ìóòîðíûé ïðîöåññ, è îí íå îáõîäèòüñÿ áåç âûðàæåíèé ïîäîáíîãî ñîäåðæàíèÿ, íî íå ïîïàäàþùåãî â êîìåíòàðèè è îñíîâíîé êîä.....
 
Òåïëîâ Àëåêñåé Þðüåâè÷ aka <Lrz>
; <Lrz> 14.05.2007 Èñïîëüçîâàíèå ìàêðîñîâ,óäîáî÷èòàåìîñü ïðîãðàììû
; <Lrz> 18.05.2007 Óëó÷øåíèå ïîíèìàíèÿ ðàáîòû ïðîãðàììû çà ñ÷åò âûíåñà îñíîâíûõ ôóíêöèé â îòäåëüíûå ìàêðîñû
; <Lrz> 14.05.2007 Èñïîëüçîâàíèå ìàêðîñîâ,óäîáî÷èòàåìîñü ïðîãðàììû èñïîëüçîâàíèå ìàêðîñà mcall äëÿ âûçîâà ñèñ. ôóíêöèé
; <Lrz> 09.05.2007 Îáùàÿ äîðàáîòêà ìàêðîñîâ,çàìåíà íåñêîëüêî ìåòîê, ìèãðàöèÿ êîäà â edit_box.mac
; <Lrz> 19.04.2007 Îáùàÿ äîðàáîòêà ìàêðîñîâ
; <Lrz> 14.04.2007 Èñïðàâëåíî óïðàâëåíèå ìûøêîé, ïðè óäàëåíèè ïîñëåäíåãî ñèìâîëà â áóôåðå ïèøåòüñÿ 0 (ñïàñèáî Mario79)
/programs/develop/examples/editbox/trunk/editbox.mac
593,17 → 593,17
if up eq
else
cmp ah,177
jz .no_figure
jz .editbox_exit
end if
if down eq
else
cmp ah,178
jz .no_figure
jz .editbox_exit
end if
if esc eq
else
cmp ah,27 ;ESC - ª« ¢¨è  ))
jz .no_figure
jz .editbox_exit
end if
}
 
612,17 → 612,418
test word ed_flags,ed_figure_only ; ⮫쪮 æ¨äàë ?
jz @f
cmp ah,'0'
jb .no_figure
jb .editbox_exit
cmp ah,'9'
ja .no_figure
ja .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
;;;;;;;;;;;;;;;;;;;;;
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call .sh_cl_
;;;;;;;;;;;;;;;;;;;;;
popa
call .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 .editbox_exit
@@: mov ebx, ed_pos
cmp ebx,edx
jl @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
jmp .editbox_exit
 
@@: ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
mov ecx,ed_size
push edi eax
mov ebp,edi
mov esi,ed_text ; “ª § â¥«ì ­  ¡ãä¥à
;ã¤¥¬ à ¡®â âì á® áâப®©
add esi,ecx ;add ed_size ¤®¡ ¢¨¬ max size
mov edi,esi
 
cmp ecx,ebx ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
je .In_k
 
test word [ebp+40],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 ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
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
}
macro use_work_key
{
.insert: test word ed_flags,ed_insert ;not word ed_insert
je @f
and word ed_flags,ed_insert_cl
jmp .editbox_exit
@@:
or word ed_flags,ed_insert
jmp .editbox_exit
.ins_v:
dec dword [ebp+42];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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.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
edit_ex
.bac_del:
call .del_char
jmp .draw_all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  backspace ---
.backspace:
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
mov ecx,ed_pos
test ecx,ecx
jnz .del_bac
test word ed_flags,ed_shift_on
jne .bac_del
 
edit_ex
.del_bac:
mov edx,ed_size
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
}
 
macro use_mouse_func scr_w
{
;----------------------------------------------------------
;--- Ž¡à ¡®âª  .mouse_wigwag
;----------------------------------------------------------
.mouse_wigwag:
shr eax,16
or word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
;;;;;;;;;;;;;;;;;;
mov ebx,[procinfo.box.left]
add ebx,ed_left
if scr_w eq
else
add ebx,dword scr_w
end if
cmp eax,ebx
jb .mleft
 
add ebx,ed_width
cmp eax,ebx
ja .mright
 
sub ebx,ed_width
 
xor edx,edx
sub eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
mov ebx,6
div ebx
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
;;;;;;;;;;;;;;;;;;
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
add eax,ed_offset ;¤®¡ ¢¨¬ ᬥ饭¨¥
cmp eax,dword ed_size ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
ja .mwigvag
.mdraw:
mov dword ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov ecx,dword ed_shift_pos
mov ebx,dword ed_shift_pos_old
mov dword ed_shift_pos_old,eax ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
cmp ecx,ebx ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
je .m1_shem ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
jb .msmaller ;¤¢¨¦¥­¨¥ ¡ë«® ->
cmp ebx,eax ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
ja .m1_shem ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
je .mwigvag ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
mov ebp,ed_color ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
.msmaller:
cmp ebx,eax
jb .m1_shem
mov ebp,ed_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
;alike =
.m1_shem:
mov ebp,shift_color
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov ebx,ecx
call .sh_cl_
jmp .mwigvag
.mwigvag:
and word ed_flags,ed_shift_mcl
jmp .draw_cursor_text
; popa
; ret
.mleft:
mov eax,ed_pos
cmp eax,0
jbe .mwigvag
dec eax
call .check_offset
push eax
mov ebx,ed_shift_pos
mov ebp,shift_color
call .sh_cl_
pop eax
jmp .mdraw
.mright:
mov eax,ed_pos
mov ebx,ed_size
cmp eax,ebx
jae .mwigvag
inc eax
call .check_offset
mov ebx,ed_shift_pos
mov ebp,shift_color
push eax
call .sh_cl_
pop eax
jmp .mdraw
}
 
macro use_work_mause scr_h,scr_w
;----------------------------------------------------------
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
;----------------------------------------------------------
{
test word ed_flags,ed_mouse_on
jne .mouse_wigwag
;----------------------------------------------------------
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
;----------------------------------------------------------
mov ebx,[procinfo.box.top]
add ebx,ed_top
if scr_h eq
else
add ebx,scr_h
end if
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,[procinfo.box.left]
add ebx,ed_left
if scr_w eq
else
add ebx,scr_w
end if
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 ebx,dword [procinfo.box.left]
xor edx,edx
sub eax,ed_left
sub eax,ebx
if scr_w eq
else
add ebx,scr_w
sub eax,2
end if
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_mouse_on
mov dword ed_pos,eax
mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
bts word ed_flags,1 ;ãáâ ­®¢ª  䮪ãá 
jmp .m_sh
@@:
cmp eax,dword ed_shift_pos ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
je .editbox_exit
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 +
.m_sh: call .draw_text
call .draw_cursor
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
jmp .drc
._blur:
test word ed_flags,ed_always_focus
jne .editbox_exit
btr word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jnc .editbox_exit
 
mov ebp,ed_color
call .clear_cursor
.drc: call .draw_border
jmp .editbox_exit
}
 
 
; Œ ªà®á ¢ë室 
macro edit_ex
{