Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7576 → Rev 7577

/programs/develop/libraries/box_lib/trunk/t_edit.asm
234,7 → 234,7
@@:
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
; 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,10 → 1885,9
mov edx,ted_tex_1
;call ted_get_text_perv_pos
@@:
pop ebx eax
ret
endp
 
 
;input:
; eax = Row
; edi = pointer to tedit struct
2062,7 → 2058,7
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
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­  ª®â®àë© ãª §ë¢ ¥â 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
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
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
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,20 → 2991,18
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 - 㤠筮
2996,28 → 3009,73
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
ted_key_ctrl_home:
3835,48 → 3893,6
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
proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword