Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 395 → Rev 396

/programs/develop/examples/editbox/trunk/EDITBOX.INC
1,3 → 1,4
; <Lrz> 07.03.2007 „®¯¨á « ã¯à ¢«¥­¨¥ á shift home + end ãá¯à ¢¨« ­¥áª®«ìª® ¡ £®¢
; <Lrz> 06.03.2007 ¥à¥¯¨á « ¯®«­®áâìî  «£®à¨â¬ ã¯à ¢«¥­¨ï shift
; <Lrz> 15.02.2007 ã«ãç襭¨¥ á­ïâ¨ï ¢ë¤¥«¥­¨ï ¨ ¯¥à¥à¨á®¢ª¨ ®ç¨é ¥¬®© ®¡« áâ¨, §­ ç¨â¥«ì­® ¯à¨ïâ­¥¥ à ¡®â ¥â ª®¬¯®­¥­â
; <Lrz> 13.02.2007 ã¡à « ¯® ¢®§¬®¦­®á⨠¬¥àæ ­¨¥, ã«ãç襭  ®¡à ¡®âª  ¯¥à¥à¨á®¢ª¨ ä®­ 
69,8 → 70,8
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]
ed_shift_pos equ [edi+58] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+62] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
93,26 → 94,6
call .draw_text
popa
ret
 
;.str:
; mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
; ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
; cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
; jb @f
; xor edx,edx ;®ç¨áâ¨âì edx
; div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
; push edx ;¯®«®¦¨âì ¢ á⥪
; ;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
; call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
; pop eax
; @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
; ;sbb al,$69 ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
; ;das ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
; or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
; stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
;
; ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
 
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
172,7 → 153,6
mov ebx,6 ;§ £à㧬¨ ¤¥«¨â¥«ì
div ebx ;à §¬¤¥«¨¬ ­  6
ret
 
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
;----------------------------------------------------------
183,9 → 163,7
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
212,13 → 190,12
mov eax,38
int 0x40
ret
 
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
;----------------------------------------------------------
.draw_border:
;--- 梥â à ¬ª¨ ---
test dword ed_flags,ed_focus
test word ed_flags,ed_focus
mov edx,ed_focus_border_color
jne @f
mov edx,ed_blur_border_color
303,11 → 280,11
.add_8: add ebx,edx
.chk_d: mov ed_offset,ebx
call .draw_bg
;mov dword [esp+28],-1
and word ed_flags,ed_offset_cl
popa
ret
@@:
mov dword [esp+28],0
or word ed_flags,ed_offset_fl
popa
ret
;==========================================================
327,7 → 304,6
test al,0x03
je @f
or word ed_flags,ed_shift ;ãáâ ­®¢¨¬ ä« £
 
@@: pop eax ;¢®ááâ ­®¢¨¬ áç¨â ­ë© ᨬ¢®« á ª« ¢¨ âãàë
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
362,29 → 338,23
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
;cmp edx,ecx
;jne .sh_cl
;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
391,7 → 361,6
sub ebx,eax
mov ed_size,ebx
pop eax
 
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
@@: mov ecx,ed_size
mov edx, ed_max
512,9 → 481,7
call .clear_cursor
call .check_offset
call .draw_bg
 
ret
 
@@: dec dword ed_size
 
.draw_all2:
525,7 → 492,6
mov ebp,ed_size
call .clear_bg
ret
;jmp .shift
;--- ­ ¦ â  ª« ¢¨è  left ---
.left: mov ebx,ed_pos
test ebx,ebx
557,6 → 523,7
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
568,6 → 535,7
 
@@: mov ebp,shift_color
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebx,dword ed_shift_pos
call .sh_cl_
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
579,9 → 547,9
;;;;;;SHIFT end
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
; or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov eax,dword ed_pos
mov ebx,dword ed_shift_pos
; mov ebx,dword ed_shift_pos
cmp eax,ebx
jae .sh_n
push eax ;¬¥­ì襥 ¢ eax
592,11 → 560,8
push eax
.sh_n1:
call .check_offset
; test eax,eax
; jz .drw_sim
call .get_n
mov edx,eax ;size of ed_box
; push eax
mov ecx,ed_offset
add eax,ecx ;eax = w_off= ed_offset+width
mov edx,eax ;save
613,7 → 578,6
@@: mov ebx,edx
sub ebx,ecx
jmp .nxt_f
 
.f_f:
sub eax,ecx
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
639,9 → 603,7
mov edx,ebp;shift_color
 
call .draw_bg_eax
@@: ;and word ed_flags,1111111111111011b
call .enable_null
;mov dword ed_shift_pos,0
@@: call .enable_null
ret
;;;;;;;;;;;;;;;;;;;;;
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
651,8 → 613,6
call .draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
jmp @b
;;;;;;;;;;;;;;;;;;;;;
 
;;;;;;;;;;
;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
664,11 → 624,8
or word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebp,shift_color
mov eax,dword ed_pos
;mov ebx,dword ed_shift_pos
test word ed_flags,ed_left_fl
jz .low
; sub eax,2
;dec eax
jmp @f
;;;;;;;;;;
;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
681,7 → 638,6
 
mov ebp,ed_color
mov eax,dword ed_pos
;mov ebx,dword ed_shift_pos
test word ed_flags,ed_left_fl
jz .low
;dec eax
699,7 → 655,6
mov dword ed_shift_pos,ebx
or word ed_flags,ed_shift_on
@@: ret
 
;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨¥, ¥á«¨ ­¥â shift
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
709,32 → 664,11
test word ed_flags,ed_shift_bac
je @f
mov ebp,ed_color
mov ebx,dword ed_shift_pos
call .sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
call .draw_wigwag_cl
and word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
jmp .draw_cursor_text
@@:
;----------- ®â« ¤ª 
; pushad
; mov dword [ed_buffer.3],0
; mov eax,ebx;word ed_flags
; 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
;----------- ®â« ¤ª 
and word ed_flags,ed_shift_off
popa
ret
749,6 → 683,7
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¢ à ­¥ ­ã¦­®
760,8 → 695,8
ret
.sh_ext_en:
call .check_offset
test eax,eax
jnz @f
test word ed_flags,ed_offset_fl
jne @f
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov eax,dword ed_shift_pos
mov ebx,dword ed_pos
784,6 → 719,7
.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
793,29 → 729,18
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_ ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª (®¡« áâì)
call .check_offset
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_: ret
 
 
; test word ed_flags,ed_shift_bac
; je @f
 
 
 
 
 
 
 
 
 
.sh_exit_: call .check_offset
ret
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
.enable_null:
pusha
827,7 → 752,6
mov [eax],bl
popa
ret
 
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
.del_char:
876,7 → 800,6
pop edi
ret
 
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
.clear_bg:
930,7 → 853,6
;eax=dword ed_pos
;ebp=-梥â ed_color or shift_color
.draw_rectangle:
; mov eax,dword ed_pos
mov ecx,dword ed_offset
sub eax,ecx
lea ebx,[eax*2+eax]
1014,8 → 936,6
jc @f
call .draw_cursor
jmp .drc
 
 
._blur:
test word ed_flags,ed_always_focus
jne @f
1042,9 → 962,9
;popa
;ret
}
ed_figure_only= 1000000000000000b
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
ed_focus=10b
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥­¨ï
ed_shift_on= 1000b ;¥á«¨ ­¥ ãáâ ­®¢«¥­ -§­ ç¨â ¢¯¥à¢ë¥ ­ ¦ â shift,¥á«¨ ¡ë« ãáâ ­®¢«¥­, §­ ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ­ ¦ â¨¨ ­  shift â.¥. ¥á«¨ ­ ¦¨¬ î
ed_shift_off= 1111111111111011b
1052,6 → 972,8
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_height=14 ; ¢ëá®â 
1081,13 → 1003,15
mov edi,start
mov ecx,((end-start)/ed_struc_size)
@@:
; push eax
call edit_box.key
; pop eax
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
blur_border_color,text_color,max,text,flags
{
.width dd width
.left dd left
1099,7 → 1023,7
.max dd max
.text dd text
.flags dw flags+0
.size dd size+0
.size dd 0
.pos dd 0
.offset dd 0
.cl_curs_x dd 0