kolibrios/programs/develop/examples/editbox/trunk/EDITBOX.INC
Alexey Teplov ( b192d9260a modify macros and optimization
git-svn-id: svn://kolibrios.org@483 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-05-10 04:03:05 +00:00

653 lines
20 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.

; SEE YOU File FAQ.txt and HISTORY. Good Like!
;;;;;;;;;;;;;;;;;;
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥­ ®¡«¥£ç¨âì ¦¨§­ì :) ᯥ樠«ì­® ¤«ï editbox
;;;;;;;;;;;;;;;;;;
macro use_edit_box procinfo,scr_h,scr_w
{
edit_box:
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_flags equ [edi+40] ;ä« £¨
ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+50] ;ᬥ饭¨¥
cl_curs_x equ [edi+54] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+58] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+62] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+66] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
.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
edit_ex
;==========================================================
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
;==========================================================
.key:
pusha
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .no_figure
;<3B>஢¥àª  ­ ¦ â shift ?
call .check_shift
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
use_key_process backspase,delete,left,right,home,end,insert
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_no_process up,down,esc
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B>஢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ¥á«¨ â ª®©­¥®¡å®¤¨¬®á⨠­¥â ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 ; “ª § â¥«ì ­  ¡ãä¥à
;<3B>㤥¬ à ¡®â âì á® áâப®©
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 ;<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
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
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
;==========================================================
.mouse:
pusha
;debug
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
;----------------------------------------------------------
mcall 37,2
;----------------------------------------------------------
;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
;----------------------------------------------------------
test eax,1
jnz .mouse_left_button
and word ed_flags,ed_mouse_on_off
xor ebx,ebx
mov dword [mouse_flag],ebx
edit_ex
.mouse_left_button:
;----------------------------------------------------------
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
;----------------------------------------------------------
mov eax,dword [mouse_flag]
test eax,eax
jz @f
cmp eax,edi
je @f
jmp ._blur
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
;----------------------------------------------------------
@@: mcall 37,0
;----------------------------------------------------------
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
;----------------------------------------------------------
mov ecx,procinfo
test word ed_flags,ed_mouse_on
jne .mouse_wigwag
;----------------------------------------------------------
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
;----------------------------------------------------------
mov ebx,dword [ecx+38]
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,dword [ecx+34]
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 ecx,procinfo
mov ebx,dword [ecx+34]
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_general_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á 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 ecx,procinfo
mov ebx,dword [ecx+34]
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
;;;;;;;;;;;;;;;;;;
;<3B>®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
;<3B>¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
add eax,ed_offset ;¤®¡ ¢¨¬ ᬥ饭¨¥
cmp eax,dword ed_size ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
ja .mwigvag
.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 .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
}
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 ; ¢ëá®â 
macro draw_edit_boxes start,_end,use_f9,procinfo
{
if use_f9 eq
else
mcall 9,procinfo,-1
end if
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=70
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,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
.flags dw 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,[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,use_f9,procinfo
{
if use_f9 eq
else
mcall 9,procinfo,-1
end if
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
}
macro default_box ed_ptr
{
pusha
; xor eax,eax
; mov ed_shift_pos,eax
; mov ed_shift_pos_old,eax
and word ed_flags,ed_shift_cl
; mov ed_offset,eax
popa
}