Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7575 → Rev 7576

/programs/develop/libraries/box_lib/trunk/t_edit.asm
23,6 → 23,7
TED_PANEL_NULL equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
TED_PANEL_FIND equ 1 ;¯ ­¥«ì ¯®¨áª 
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
TED_PANEL_REPLACE equ 3 ;¯ ­¥«ì § ¬¥­ë
TED_PANEL_WIDTH equ 150 ;è¨à¨­  ¯ ­¥«¨
 
TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥
557,7 → 558,7
xor al,al
cmp ted_drag_m,1
je @f
mov al,1
inc al
mov ebx,ted_sel_x0
cmp ebx,ted_sel_x1
jne @f
577,8 → 578,8
mov esi,edi
add esi,ted_offs_sel
add edi,ted_offs_seln
mov ecx,sizeof.TexSelect
rep movsb
mov ecx,sizeof.TexSelect/4
rep movsd
pop edi
 
jmp @f
750,8 → 751,8
mov eax,edi ;á®å࠭塞 §­ ç¥­¨¥ edi
mov esi,ted_syntax_file
add edi,ted_offs_count_colors
mov ecx,9*4
rep movsb
mov ecx,9
rep movsd
mov edi,eax ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edi
 
mov eax,ted_syntax_file
759,8 → 760,7
mov ted_text_colors,eax
 
mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words)
add eax,8
shl eax,2
lea eax,[4*eax+32]
add eax,ted_syntax_file
mov ted_key_words_data,eax
 
768,14 → 768,12
xor eax,eax
@@:
ColToIndexOffset eax,edx
xor ebx,ebx
mov bl,byte[edx]
shl bx,2
movzx ebx,byte[edx]
mov esi,ted_arr_key_pos
add esi,ebx
lea esi,[esi+4*ebx]
cmp dword[esi],-1
jne .no_ch_key
mov dword[esi],eax
mov [esi],eax
.no_ch_key:
inc eax
loop @b
911,8 → 909,8
push ebx
@@:
mov edx,[edx+2]
cmp edx,0
je @f
or edx,edx
jz @f
imul edx,sizeof.symbol
add edx,ted_tex
call ted_symbol_not_vis
928,8 → 926,8
ret
.else:
mov edx,[edx+2]
cmp edx,0
je @f
or edx,edx
jz @f
imul edx,sizeof.symbol
add edx,ted_tex
cmp dword [edx+14],0
1080,8 → 1078,8
ret
 
;input:
; text:dword - pointer to text string
; add_opt:dword - options
; text - pointer to text string
; add_opt - options
align 16
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
locals
1353,8 → 1351,8
pushad
 
call ted_is_select
cmp al,0
je .end_f
or al,al
jz .end_f
call ted_set_undo
call ted_sel_normalize
 
1392,9 → 1390,7
cmp edx,ted_tex
je @f
cmp edx,ebx
je @f
 
jmp @b
jne @b
@@:
cmp dword[conv_cou],0
jne @f
1444,8 → 1440,8
align 16
proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword
call ted_is_select
cmp al,0
je .end_f
or al,al
jz .end_f
call ted_sel_normalize
 
mov esi,ted_seln_x1
2058,26 → 2054,60
; ecx = Col
; edx = Row
; edi = pointer to tedit struct
;output:
; ecx = cursor x
; edx = cursor y
align 16
ted_go_to_pos:
push eax
push eax ebx
mov eax,ted_scr_h
sub ecx,[eax+sb_offs_position]
cmp ecx,0 ;ted_cur_y < 0
jge @f
add [eax+sb_offs_position],ecx ;¯à®ªàã⪠ áªà®««¨­£  ¢«¥¢®
xor ecx,ecx
@@:
mov ebx,5 ;5 - ¦¥« ¥¬ë© ®âáâ㯠᫥¢ 
cmp ecx,ebx
jge .end0
sub ebx,ecx ;ebx - ­  ᪮«ìª® ᨬ¢®«®¢ ­ã¦­® ᤢ¨­ãâì ªãàá®à
cmp [eax+sb_offs_position],ebx
jge @f
add ecx,[eax+sb_offs_position]
mov dword[eax+sb_offs_position],0
jmp .end0
@@:
sub [eax+sb_offs_position],ebx
add ecx,ebx
.end0:
cmp ecx,[eax+sb_offs_cur_area] ;ted_cur_x > [.cur_area]
jl .end1
mov ebx,ecx
sub ebx,[eax+sb_offs_cur_area]
inc ebx
add [eax+sb_offs_position],ebx ;¯à®ªàã⪠ áªà®««¨­£  ¢¯à ¢®
sub ecx,ebx
.end1:
mov ted_cur_x,ecx
 
mov eax,ted_scr_w
mov ted_cur_x,ecx
sub edx,[eax+sb_offs_position]
 
cmp edx,0 ;ted_cur_y < 0
jge @f
add [eax+sb_offs_position],edx ;¯à®ªàã⪠ áªà®««¨­£  ¢¢¥àå
xor edx,edx
jmp .end2
@@:
cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area]
jl @f
push ebx
jl .end2
mov ebx,edx
sub ebx,[eax+sb_offs_cur_area]
inc ebx
add [eax+sb_offs_position],ebx
add [eax+sb_offs_position],ebx ;¯à®ªàã⪠ áªà®««¨­£  ¢­¨§
sub edx,ebx
pop ebx
; ??? redrav
@@:
.end2:
mov ted_cur_y,edx
pop eax
pop ebx eax
ret
 
;input:
2805,7 → 2835,108
ret
endp
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­  ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
;input:
; f_opt = ¯ à ¬¥âàë ¯®¨áª :
; (0 - ¨áª âì ¢ëè¥ ªãàá®à , 1 - ¨áª âì ­¨¦¥ ªãàá®à , 2 - ¨áª âì ®â ­ ç «  ä ©« )
align 16
proc ted_but_find, edit:dword, f_opt:dword
push [edit]
cmp dword[f_opt],2
jne @f
call ted_but_find_first
jmp .end_f
@@:
cmp dword[f_opt],0
jne @f
call ted_but_find_next
jmp .end_f
@@:
cmp dword[f_opt],1
jne .end_f
call ted_but_find_perv
.end_f:
ret
endp
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­  ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
; ¨é¥â ®â ­ ç «  ä ©« , ¨«¨ ®â ª®­æ  ⥪ã饣® ¢ë¤¥«¥­¨ï
align 16
proc ted_but_find_first, edit:dword
pushad
mov edi,[edit]
 
call ted_is_select
or al,al
jz @f
call ted_sel_normalize
mov edx,ted_sel_y1
mov ecx,ted_sel_x1
call ted_go_to_pos ;¯¥à¥å®¤ ­  ª®­¥æ ¢ë¤¥«¥­¨ï
call ted_get_pos_by_cursor
jmp .end0
@@:
mov edx,ted_tex
call ted_iterat_next
.end0:
mov eax,ted_buffer_find
mov bl,byte[eax]
@@:
call ted_get_find_rezult
cmp bh,1
je @f ; find
call ted_iterat_next
cmp edx,ted_tex_1
jle @f
jmp @b
@@:
call but_find
popad
ret
endp
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­  ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
; ¨é¥â ¢ëè¥ ªãàá®à 
align 16
proc ted_but_find_perv, edit:dword
pushad
mov edi,[edit]
call ted_is_select
or al,al
jz @f
call ted_sel_normalize
mov edx,ted_sel_y0
mov ecx,ted_sel_x0
call ted_go_to_pos ;¯¥à¥å®¤ ­  ­ ç «® ¢ë¤¥«¥­¨ï
call ted_get_pos_by_cursor
call ted_iterat_perv ;¯¥à¥å®¤ ­  1-© ᨬ¢®« ¯¥à¥¤ ¢ë¤¥«¥­¨¥¬
jmp .end0
@@:
call ted_get_pos_by_cursor
.end0:
mov eax,ted_buffer_find
mov bl,byte[eax]
@@:
call ted_get_find_rezult
cmp bh,1
je @f ; find
call ted_iterat_perv
cmp edx,ted_tex_1
jle @f
jmp @b
@@:
call but_find
popad
ret
endp
 
;description:
; äã­ªæ¨ï ­ å®¤¨â ⥪áâ ­  ª®â®àë© ãª §ë¢ ¥â ted_buffer_find
; ¨é¥â ­¨¦¥ ªãàá®à 
align 16
proc ted_but_find_next, edit:dword
pushad
mov edi,[edit]
2822,8 → 2953,18
jle @f
jmp @b
@@:
cmp bh,0
je @f
call but_find
popad
ret
endp
 
;input:
; bh = ¡ë« «¨ ­ ©¤¥­ ¨áª®¬ë© ⥪áâ (0 - ­¥â, 1 - ¤ )
; esi = first symbol pointer
align 16
but_find:
or bh,bh
jz @f
call ted_get_text_coords
inc ebx ;move cursor right
mov ted_sel_x1,ebx
2831,7 → 2972,7
mov edx,eax
mov ecx,ebx
call ted_go_to_pos
mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ ted_get_find_rezult
mov edx,esi
call ted_get_text_coords
mov ted_sel_x0,ebx
mov ted_sel_y0,eax
2843,8 → 2984,37
je .end_find
call ted_fun_find_err ;¯®«ì§®¢ â¥«ì᪠ï äã­ªæ¨ï
.end_find:
popad
ret
 
;input:
; rpl_text = ⥪áâ ¤«ï § ¬¥­ë
; r_opt = ¯ à ¬¥âàë ¯®¨áª :
; (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]
 
xor edx,edx
cmp dword[n_tim],0
je @f
mov edx,ted_opt_ed_change_time
@@:
stdcall ted_sel_text_del, edx
or eax,0xff
jz @f
mov esi,[rpl_text]
stdcall tl_strlen
or eax,eax
jz @f
stdcall ted_text_add, edi,esi,eax,ted_opt_ed_move_cursor
xor eax,eax
inc eax
@@:
ret
endp
 
;input:
3752,8 → 3922,8
@@:
 
call ted_is_select
cmp al,0
je .no_select
or al,al
jz .no_select
cmp ted_seln_y0,esi
jg .no_select
cmp ted_seln_y1,esi