forked from KolibriOS/kolibrios
t_edit: add function ted_but_replace, fix code
git-svn-id: svn://kolibrios.org@7577 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -480,17 +480,17 @@ pushad
|
||||
mcall 68,11
|
||||
mcall 68,12,4096
|
||||
push eax
|
||||
pop dword [arrea_xx]
|
||||
pop dword[arrea_xx]
|
||||
|
||||
mov edi,eax
|
||||
mov esi,dword head
|
||||
mov esi,head
|
||||
cld
|
||||
align 4
|
||||
lp0:
|
||||
movsb
|
||||
cmp byte[esi],0
|
||||
jne lp0
|
||||
mov word[edi],'. '
|
||||
mov word[edi],0xa0d
|
||||
add edi,2
|
||||
mov esi,dword err_message
|
||||
align 4
|
||||
@@ -508,7 +508,7 @@ macro notify_window_run message
|
||||
{
|
||||
push eax ebx
|
||||
mov eax,message ;¯ à ¬¥âàë ¤«ï ª®¬ ¤®© áâப¨
|
||||
mov [run_notify_struct.Flags], eax
|
||||
mov [run_notify_struct.Flags],eax
|
||||
mov eax,70 ;run @notify
|
||||
mov ebx,run_notify_struct
|
||||
int 0x40
|
||||
|
||||
@@ -319,7 +319,6 @@ dd sz_ted_but_undo, ted_but_undo
|
||||
dd sz_ted_but_redo, ted_but_redo
|
||||
dd sz_ted_but_reverse, ted_but_reverse
|
||||
dd sz_ted_but_find, ted_but_find
|
||||
dd sz_ted_but_find_next, ted_but_find_next
|
||||
dd sz_ted_but_replace, ted_but_replace
|
||||
dd sz_ted_text_colored, ted_text_colored
|
||||
dd sz_ted_version, 0x00000005
|
||||
@@ -433,7 +432,6 @@ sz_ted_but_undo db 'ted_but_undo',0
|
||||
sz_ted_but_redo db 'ted_but_redo',0
|
||||
sz_ted_but_reverse db 'ted_but_reverse',0
|
||||
sz_ted_but_find db 'ted_but_find',0
|
||||
sz_ted_but_find_next db 'ted_but_find_next',0
|
||||
sz_ted_but_replace db 'ted_but_replace',0
|
||||
sz_ted_text_colored db 'ted_text_colored',0
|
||||
sz_ted_version db 'version_text_edit',0
|
||||
|
||||
@@ -234,7 +234,7 @@ proc ted_key, edit:dword, table:dword, control:dword
|
||||
@@:
|
||||
cmp ah,KEY_F3 ;[F3]
|
||||
jne @f
|
||||
stdcall ted_but_find_next,edi
|
||||
stdcall ted_but_find,edi,0
|
||||
jmp .end_key_fun
|
||||
@@:
|
||||
|
||||
@@ -1851,12 +1851,9 @@ ted_get_pos_by_cursor:
|
||||
; edx = tex[1] if error
|
||||
; ted_gp_opt = 0 if text no found
|
||||
align 16
|
||||
ted_get_pos_by_coords:
|
||||
push eax ;Row
|
||||
push ebx ;Col
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
proc ted_get_pos_by_coords uses eax ebx
|
||||
xor eax,eax ;Row
|
||||
xor ebx,ebx ;Col
|
||||
mov ted_gp_opt,0
|
||||
mov edx,ted_tex
|
||||
@@:
|
||||
@@ -1888,9 +1885,8 @@ ted_get_pos_by_coords:
|
||||
mov edx,ted_tex_1
|
||||
;call ted_get_text_perv_pos
|
||||
@@:
|
||||
pop ebx eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
;input:
|
||||
; eax = Row
|
||||
@@ -2062,7 +2058,7 @@ ted_go_to_pos:
|
||||
push eax ebx
|
||||
mov eax,ted_scr_h
|
||||
sub ecx,[eax+sb_offs_position]
|
||||
cmp ecx,0 ;ted_cur_y < 0
|
||||
cmp ecx,0 ;ted_cur_x < 0
|
||||
jge @f
|
||||
add [eax+sb_offs_position],ecx ;¯à®ªàã⪠áªà®««¨£ ¢«¥¢®
|
||||
xor ecx,ecx
|
||||
@@ -2839,33 +2835,51 @@ endp
|
||||
; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
|
||||
;input:
|
||||
; f_opt = ¯ à ¬¥âàë ¯®¨áª :
|
||||
; (0 - ¨áª âì ¢ëè¥ ªãàá®à , 1 - ¨áª âì ¨¦¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« )
|
||||
; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« )
|
||||
; ¥á«¨ ãáâ ®¢«¥ 31-© ¡¨â, â® ¥ ®¡®¢«ï¥âáï ®ª®
|
||||
;output:
|
||||
; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ )
|
||||
align 16
|
||||
proc ted_but_find, edit:dword, f_opt:dword
|
||||
proc ted_but_find uses ebx ecx edx edi esi, edit:dword, f_opt:dword
|
||||
push [edit]
|
||||
cmp dword[f_opt],2
|
||||
cmp word[f_opt],2
|
||||
jne @f
|
||||
call ted_but_find_first
|
||||
jmp .end_f
|
||||
call _but_find_first
|
||||
jmp .end0
|
||||
@@:
|
||||
cmp dword[f_opt],0
|
||||
cmp word[f_opt],0
|
||||
jne @f
|
||||
call ted_but_find_next
|
||||
jmp .end_f
|
||||
call _but_find_next
|
||||
jmp .end0
|
||||
@@:
|
||||
cmp dword[f_opt],1
|
||||
jne .end_f
|
||||
call ted_but_find_perv
|
||||
.end_f:
|
||||
cmp word[f_opt],1
|
||||
jne .end0
|
||||
call _but_find_perv
|
||||
.end0:
|
||||
|
||||
bt dword[f_opt],31
|
||||
jc .end1
|
||||
or eax,eax
|
||||
jz @f
|
||||
;⥪áâ ©¤¥, ®¡®¢«ï¥¬ ®ª®
|
||||
stdcall ted_draw,edi
|
||||
jmp .end1
|
||||
@@:
|
||||
;⥪áâ ¥ ©¤¥, ¯à®¡ã¥¬ ¢ë§¢ âì á®®¡é¥¨¥
|
||||
cmp ted_fun_find_err,0
|
||||
je .end1
|
||||
call ted_fun_find_err ;¯®«ì§®¢ ⥫ì᪠ï äãªæ¨ï
|
||||
.end1:
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
|
||||
; ¨é¥â ®â ç « ä ©« , ¨«¨ ®â ª®æ ⥪ã饣® ¢ë¤¥«¥¨ï
|
||||
; äãªæ¨ï 室¨â ⥪áâ ®â ç « ä ©« , ¨«¨ ®â ª®æ ⥪ã饣® ¢ë¤¥«¥¨ï
|
||||
;output:
|
||||
; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ )
|
||||
; ebx, ecx, edx, edi, edi - ¯®àâïâáï
|
||||
align 16
|
||||
proc ted_but_find_first, edit:dword
|
||||
pushad
|
||||
proc _but_find_first, edit:dword
|
||||
mov edi,[edit]
|
||||
|
||||
call ted_is_select
|
||||
@@ -2892,17 +2906,17 @@ proc ted_but_find_first, edit:dword
|
||||
jle @f
|
||||
jmp @b
|
||||
@@:
|
||||
call but_find
|
||||
popad
|
||||
call _but_find_select
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
|
||||
; ¨é¥â ¢ëè¥ ªãàá®à
|
||||
; äãªæ¨ï 室¨â ⥪áâ ¢ëè¥ ªãàá®à
|
||||
;output:
|
||||
; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ )
|
||||
; ebx, ecx, edx, edi, edi - ¯®àâïâáï
|
||||
align 16
|
||||
proc ted_but_find_perv, edit:dword
|
||||
pushad
|
||||
proc _but_find_perv, edit:dword
|
||||
mov edi,[edit]
|
||||
call ted_is_select
|
||||
or al,al
|
||||
@@ -2928,17 +2942,17 @@ proc ted_but_find_perv, edit:dword
|
||||
jle @f
|
||||
jmp @b
|
||||
@@:
|
||||
call but_find
|
||||
popad
|
||||
call _but_find_select
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; äãªæ¨ï 室¨â ⥪áâ ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
|
||||
; ¨é¥â ¨¦¥ ªãàá®à
|
||||
; äãªæ¨ï 室¨â ⥪áâ ¨¦¥ ªãàá®à
|
||||
;output:
|
||||
; eax = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ )
|
||||
; ebx, edx, edi, esi - ¯®àâïâáï
|
||||
align 16
|
||||
proc ted_but_find_next, edit:dword
|
||||
pushad
|
||||
proc _but_find_next, edit:dword
|
||||
mov edi,[edit]
|
||||
|
||||
call ted_get_pos_by_cursor
|
||||
@@ -2953,16 +2967,17 @@ proc ted_but_find_next, edit:dword
|
||||
jle @f
|
||||
jmp @b
|
||||
@@:
|
||||
call but_find
|
||||
popad
|
||||
call _but_find_select
|
||||
ret
|
||||
endp
|
||||
|
||||
;description:
|
||||
; ¢á¯®¬®£ ⥫ì ï äãªæ¨ï, ¢ë¤¥«ï¥â ©¤¥ë© ⥪áâ
|
||||
;input:
|
||||
; bh = ¡ë« «¨ ©¤¥ ¨áª®¬ë© ⥪áâ (0 - ¥â, 1 - ¤ )
|
||||
; esi = first symbol pointer
|
||||
align 16
|
||||
but_find:
|
||||
_but_find_select:
|
||||
or bh,bh
|
||||
jz @f
|
||||
call ted_get_text_coords
|
||||
@@ -2976,47 +2991,90 @@ but_find:
|
||||
call ted_get_text_coords
|
||||
mov ted_sel_x0,ebx
|
||||
mov ted_sel_y0,eax
|
||||
stdcall ted_draw,edi
|
||||
jmp .end_find
|
||||
xor eax,eax
|
||||
inc eax
|
||||
jmp .end0
|
||||
@@:
|
||||
;¯®¯ ¤ ¥¬ áî¤ ¥á«¨ ⥪áâ ¥ ©¤¥
|
||||
cmp ted_fun_find_err,0
|
||||
je .end_find
|
||||
call ted_fun_find_err ;¯®«ì§®¢ ⥫ì᪠ï äãªæ¨ï
|
||||
.end_find:
|
||||
xor eax,eax ;⥪áâ ¥ ©¤¥
|
||||
.end0:
|
||||
ret
|
||||
|
||||
;input:
|
||||
; rpl_text = ⥪áâ ¤«ï § ¬¥ë
|
||||
; r_opt = ¯ à ¬¥âàë ¯®¨áª :
|
||||
; (0 - ¨áª âì ¢ëè¥ ªãàá®à , 1 - ¨áª âì ¨¦¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« )
|
||||
; (0 - ¨áª âì ¨¦¥ ªãàá®à , 1 - ¨áª âì ¢ëè¥ ªãàá®à , 2 - ¨áª âì ®â ç « ä ©« )
|
||||
; n_tim = 䨪á¨à®¢ âì § ¬¥ã ¢ ¨§¬¥¥¨ïå (0 - ¥â, 1 - ¤ )
|
||||
;output:
|
||||
; eax = 0 - ¥ 㤠ç®, 1 - 㤠ç®
|
||||
align 16
|
||||
proc ted_but_replace uses edx edi esi, edit:dword, rpl_text:dword, r_opt:dword, n_tim:dword
|
||||
mov edi,[edit]
|
||||
stdcall ted_but_find, edi,[r_opt]
|
||||
mov eax,[r_opt]
|
||||
bts eax,31
|
||||
stdcall ted_but_find, edi,eax
|
||||
or eax,eax
|
||||
jz .end0
|
||||
|
||||
xor edx,edx
|
||||
cmp dword[n_tim],0
|
||||
je @f
|
||||
call ted_set_undo
|
||||
mov edx,ted_opt_ed_change_time
|
||||
@@:
|
||||
stdcall ted_sel_text_del, edx
|
||||
or eax,0xff
|
||||
jz @f
|
||||
jz .end0
|
||||
mov esi,[rpl_text]
|
||||
stdcall tl_strlen
|
||||
or eax,eax
|
||||
jz @f
|
||||
jz .end0
|
||||
stdcall ted_text_add, edi,esi,eax,ted_opt_ed_move_cursor
|
||||
xor eax,eax
|
||||
inc eax
|
||||
@@:
|
||||
.end0:
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
; eax - text need find
|
||||
; bl - first symbol to find
|
||||
; edx - first symbol pointer
|
||||
; edi - pointer to tedit struct
|
||||
;output:
|
||||
; bh - rezult
|
||||
; edx - last text position (if find sucess)
|
||||
; esi - first symbol pointer
|
||||
;description:
|
||||
; ”ãªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
|
||||
; á ⥪á⮬ । ªâ®à ¯® 㪠§ ⥫î edx.
|
||||
; ‘â ¤ àâë¥ äãªæ¨¨ ( ¯à. strcmp) âãâ ¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
|
||||
; ¢ ¯ ¬ï⨠। ªâ®à ⥪áâ ᮤ¥à¦¨âáï ¥ ¢ ¢¨¤¥ ascii áâப.
|
||||
align 16
|
||||
ted_get_find_rezult:
|
||||
push eax
|
||||
mov bh,1
|
||||
mov esi,edx ;copy edx
|
||||
@@:
|
||||
cmp byte[edx],bl
|
||||
jne .no_text
|
||||
|
||||
inc eax ;*** get next symbol (in find text) ***
|
||||
mov bl,byte[eax]
|
||||
or bl,bl
|
||||
jz @f ;end of find text
|
||||
|
||||
call ted_iterat_next ;*** get next symbol (in editor text) ***
|
||||
cmp edx,ted_tex_1
|
||||
jg @b
|
||||
align 4
|
||||
.no_text:
|
||||
xor bh,bh
|
||||
mov edx,esi ;restore edx
|
||||
@@:
|
||||
pop eax
|
||||
mov bl,byte[eax] ;restore bl
|
||||
ret
|
||||
|
||||
;input:
|
||||
; edi = pointer to tedit struct
|
||||
align 16
|
||||
@@ -3834,48 +3892,6 @@ popad
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
; eax - text need find
|
||||
; bl - first symbol to find
|
||||
; edx - first symbol pointer
|
||||
; edi - pointer to tedit struct
|
||||
;output:
|
||||
; bh - rezult
|
||||
; edx - last text position (if find sucess)
|
||||
; esi - first symbol pointer
|
||||
;description:
|
||||
; ”ãªæ¨ï ¯à®¢¥àï¥â ᮢ¯ ¤ ¥â «¨ ⥪áâ ¢ ¡ãä¥à¥ eax
|
||||
; á ⥪á⮬ । ªâ®à ¯® 㪠§ ⥫î edx.
|
||||
; ‘â ¤ àâë¥ äãªæ¨¨ ( ¯à. strcmp) âãâ ¥ ¯®¤®©¤ãâ, ¯®â®¬ã çâ®
|
||||
; ¢ ¯ ¬ï⨠। ªâ®à ⥪áâ ᮤ¥à¦¨âáï ¥ ¢ ¢¨¤¥ ascii áâப.
|
||||
align 16
|
||||
ted_get_find_rezult:
|
||||
push eax
|
||||
mov bh,1
|
||||
mov esi,edx ;copy edx
|
||||
@@:
|
||||
cmp byte[edx],bl
|
||||
jne .no_text
|
||||
|
||||
inc eax ;*** get next symbol (in find text) ***
|
||||
mov bl,byte[eax]
|
||||
or bl,bl
|
||||
jz @f ;end of find text
|
||||
|
||||
call ted_iterat_next ;*** get next symbol (in editor text) ***
|
||||
cmp edx,ted_tex_1
|
||||
jle @f ;end of editor text
|
||||
|
||||
jmp @b
|
||||
align 4
|
||||
.no_text:
|
||||
xor bh,bh
|
||||
mov edx,esi ;restore edx
|
||||
@@:
|
||||
pop eax
|
||||
mov bl,byte[eax] ;restore bl
|
||||
ret
|
||||
|
||||
;input:
|
||||
; clear_o - ¥á«¨ =1 ®ç¨áâ¨âì ®¤ã áâபã, =0 ®ç¨áâ¨âì ¢á¥ áâப¨ ®ª ¤® ¨§ã
|
||||
align 16
|
||||
|
||||
Reference in New Issue
Block a user