t_edit: update found functions

git-svn-id: svn://kolibrios.org@7576 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2019-01-21 11:39:35 +00:00
parent 3810c9cbc8
commit 16292e542a
8 changed files with 497 additions and 156 deletions

View File

@ -318,7 +318,9 @@ dd sz_ted_but_paste, ted_but_paste
dd sz_ted_but_undo, ted_but_undo dd sz_ted_but_undo, ted_but_undo
dd sz_ted_but_redo, ted_but_redo dd sz_ted_but_redo, ted_but_redo
dd sz_ted_but_reverse, ted_but_reverse 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_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_text_colored, ted_text_colored
dd sz_ted_version, 0x00000005 dd sz_ted_version, 0x00000005
@ -430,7 +432,9 @@ sz_ted_but_paste db 'ted_but_paste',0
sz_ted_but_undo db 'ted_but_undo',0 sz_ted_but_undo db 'ted_but_undo',0
sz_ted_but_redo db 'ted_but_redo',0 sz_ted_but_redo db 'ted_but_redo',0
sz_ted_but_reverse db 'ted_but_reverse',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_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_text_colored db 'ted_text_colored',0
sz_ted_version db 'version_text_edit',0 sz_ted_version db 'version_text_edit',0

View File

@ -14,6 +14,7 @@
<ul> <ul>
<li><a href="#fun_but_copy">ted_but_copy</a></li> <li><a href="#fun_but_copy">ted_but_copy</a></li>
<li><a href="#fun_but_cut">ted_but_cut</a></li> <li><a href="#fun_but_cut">ted_but_cut</a></li>
<li><a href="#fun_but_find">ted_but_find</a></li>
<li><a href="#fun_but_find_next">ted_but_find_next</a></li> <li><a href="#fun_but_find_next">ted_but_find_next</a></li>
<li><a href="#fun_but_paste">ted_but_paste</a></li> <li><a href="#fun_but_paste">ted_but_paste</a></li>
<li><a href="#fun_but_redo">ted_but_redo</a></li> <li><a href="#fun_but_redo">ted_but_redo</a></li>
@ -87,8 +88,20 @@ ends</pre>
<p>Ïðèìåð èñïîëüçîâàíèÿ:</p> <p>Ïðèìåð èñïîëüçîâàíèÿ:</p>
<pre>stdcall [ted_but_cut], tedit0</pre> <pre>stdcall [ted_but_cut], tedit0</pre>
<h4><a name="fun_but_find">ted_but_find</a></h4>
<p>Функция для поиска текста. Ищет текст из буфера <b>ted_buffer_find</b>, при нахождении перемещает курсор к найденому тексту и выделяет его. Принимает 2 параметра:</p>
<p>1) структура tedit,</p>
<p>2) параметры поиска:</p>
<ul>
<li>0 - искать ниже курсора</li>
<li>1 - искать выше курсора</li>
<li>2 - искать от начала документа</li>
</ul>
<p>Пример использования:</p>
<pre>stdcall [ted_but_find], tedit0, 2</pre>
<h4><a name="fun_but_find_next">ted_but_find_next</a></h4> <h4><a name="fun_but_find_next">ted_but_find_next</a></h4>
<p>Функция для поиска текста. Ищет текст из буфера <b>ted_buffer_find</b>, при нахождении перемещает курсор к найденому тексту и выделяет его.</p> <p>Функция для поиска текста. Ищет текст из буфера <b>ted_buffer_find</b>, при нахождении перемещает курсор к найденому тексту и выделяет его. Поиск ведется ниже текущего положения курсора.</p>
<p>Ïðèìåð èñïîëüçîâàíèÿ:</p> <p>Ïðèìåð èñïîëüçîâàíèÿ:</p>
<pre>stdcall [ted_but_find_next], tedit0</pre> <pre>stdcall [ted_but_find_next], tedit0</pre>
@ -375,7 +388,7 @@ tedit0: ;
.ptr_free_symb dd ? ;+246 óêàçàòåëü íà ñâîáîäíóþ ïàìÿòü, â êîòîðóþ ìîæíî äîáàâëÿòü ñèìâîë (èñïîëüçóåòñÿ âíóòðè ýëåìåíòà äëÿ óñêîðåíèÿ âñòàâêè òåêñòà) .ptr_free_symb dd ? ;+246 óêàçàòåëü íà ñâîáîäíóþ ïàìÿòü, â êîòîðóþ ìîæíî äîáàâëÿòü ñèìâîë (èñïîëüçóåòñÿ âíóòðè ýëåìåíòà äëÿ óñêîðåíèÿ âñòàâêè òåêñòà)
.font_s dd ? ;+250 ñòèëè äëÿ øðèôòà (îò 0 äî 7 ìíîæèòåëü äëÿ ðàçìåðà, +16 äëÿ âòîðîãî ñèñòåìíîãî øðèôòà)</pre> .font_s dd ? ;+250 ñòèëè äëÿ øðèôòà (îò 0 äî 7 ìíîæèòåëü äëÿ ðàçìåðà, +16 äëÿ âòîðîãî ñèñòåìíîãî øðèôòà)</pre>
<hr> <hr>
<p>Документация обновлялась последний раз 21.02.16.</p> <p>Документация обновлялась последний раз 21.01.19.</p>
</body> </body>
</html> </html>

View File

@ -1,2 +1,3 @@
@fasm.exe -m 16384 box_lib.asm box_lib.obj @fasm.exe -m 16384 box_lib.asm box_lib.obj
@kpack box_lib.obj
pause pause

View File

@ -23,6 +23,7 @@ macro ColToIndexOffset ind_reg,out_reg {
TED_PANEL_NULL equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨ TED_PANEL_NULL equ 0 ;­¥â ®âªàë⮩ ¯ ­¥«¨
TED_PANEL_FIND equ 1 ;¯ ­¥«ì ¯®¨áª  TED_PANEL_FIND equ 1 ;¯ ­¥«ì ¯®¨áª 
TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨ TED_PANEL_SYNTAX equ 2 ;¯ ­¥«ì ¢ë¡®à  ä ©«®¢ ¯®¤á¢¥âª¨
TED_PANEL_REPLACE equ 3 ;¯ ­¥«ì § ¬¥­ë
TED_PANEL_WIDTH equ 150 ;è¨à¨­  ¯ ­¥«¨ TED_PANEL_WIDTH equ 150 ;è¨à¨­  ¯ ­¥«¨
TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥ TED_LINES_IN_NEW_FILE equ 30 ;ç¨á«® áâப ¢ ­®¢®¬ ä ©«¥
@ -557,7 +558,7 @@ proc ted_is_select uses ebx
xor al,al xor al,al
cmp ted_drag_m,1 cmp ted_drag_m,1
je @f je @f
mov al,1 inc al
mov ebx,ted_sel_x0 mov ebx,ted_sel_x0
cmp ebx,ted_sel_x1 cmp ebx,ted_sel_x1
jne @f jne @f
@ -577,8 +578,8 @@ proc ted_sel_normalize uses ecx esi
mov esi,edi mov esi,edi
add esi,ted_offs_sel add esi,ted_offs_sel
add edi,ted_offs_seln add edi,ted_offs_seln
mov ecx,sizeof.TexSelect mov ecx,sizeof.TexSelect/4
rep movsb rep movsd
pop edi pop edi
jmp @f jmp @f
@ -750,8 +751,8 @@ proc ted_init_syntax_file, edit:dword
mov eax,edi ;á®å࠭塞 §­ ç¥­¨¥ edi mov eax,edi ;á®å࠭塞 §­ ç¥­¨¥ edi
mov esi,ted_syntax_file mov esi,ted_syntax_file
add edi,ted_offs_count_colors add edi,ted_offs_count_colors
mov ecx,9*4 mov ecx,9
rep movsb rep movsd
mov edi,eax ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edi mov edi,eax ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edi
mov eax,ted_syntax_file mov eax,ted_syntax_file
@ -759,8 +760,7 @@ proc ted_init_syntax_file, edit:dword
mov ted_text_colors,eax mov ted_text_colors,eax
mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words)
add eax,8 lea eax,[4*eax+32]
shl eax,2
add eax,ted_syntax_file add eax,ted_syntax_file
mov ted_key_words_data,eax mov ted_key_words_data,eax
@ -768,14 +768,12 @@ proc ted_init_syntax_file, edit:dword
xor eax,eax xor eax,eax
@@: @@:
ColToIndexOffset eax,edx ColToIndexOffset eax,edx
xor ebx,ebx movzx ebx,byte[edx]
mov bl,byte[edx]
shl bx,2
mov esi,ted_arr_key_pos mov esi,ted_arr_key_pos
add esi,ebx lea esi,[esi+4*ebx]
cmp dword[esi],-1 cmp dword[esi],-1
jne .no_ch_key jne .no_ch_key
mov dword[esi],eax mov [esi],eax
.no_ch_key: .no_ch_key:
inc eax inc eax
loop @b loop @b
@ -911,8 +909,8 @@ ted_iterat_perv:
push ebx push ebx
@@: @@:
mov edx,[edx+2] mov edx,[edx+2]
cmp edx,0 or edx,edx
je @f jz @f
imul edx,sizeof.symbol imul edx,sizeof.symbol
add edx,ted_tex add edx,ted_tex
call ted_symbol_not_vis call ted_symbol_not_vis
@ -928,8 +926,8 @@ ted_iterat_perv:
ret ret
.else: .else:
mov edx,[edx+2] mov edx,[edx+2]
cmp edx,0 or edx,edx
je @f jz @f
imul edx,sizeof.symbol imul edx,sizeof.symbol
add edx,ted_tex add edx,ted_tex
cmp dword [edx+14],0 cmp dword [edx+14],0
@ -1080,8 +1078,8 @@ ted_symbol_not_vis:
ret ret
;input: ;input:
; text:dword - pointer to text string ; text - pointer to text string
; add_opt:dword - options ; add_opt - options
align 16 align 16
proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword
locals locals
@ -1353,8 +1351,8 @@ proc ted_convert_sel_text, conv_fun:dword
pushad pushad
call ted_is_select call ted_is_select
cmp al,0 or al,al
je .end_f jz .end_f
call ted_set_undo call ted_set_undo
call ted_sel_normalize call ted_sel_normalize
@ -1392,9 +1390,7 @@ proc ted_convert_sel_text, conv_fun:dword
cmp edx,ted_tex cmp edx,ted_tex
je @f je @f
cmp edx,ebx cmp edx,ebx
je @f jne @b
jmp @b
@@: @@:
cmp dword[conv_cou],0 cmp dword[conv_cou],0
jne @f jne @f
@ -1444,8 +1440,8 @@ endp
align 16 align 16
proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword proc ted_sel_text_del uses ebx ecx edx esi, del_opt:dword
call ted_is_select call ted_is_select
cmp al,0 or al,al
je .end_f jz .end_f
call ted_sel_normalize call ted_sel_normalize
mov esi,ted_seln_x1 mov esi,ted_seln_x1
@ -2058,26 +2054,60 @@ endp
; ecx = Col ; ecx = Col
; edx = Row ; edx = Row
; edi = pointer to tedit struct ; edi = pointer to tedit struct
;output:
; ecx = cursor x
; edx = cursor y
align 16 align 16
ted_go_to_pos: ted_go_to_pos:
push eax push eax ebx
mov eax,ted_scr_w 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 ted_cur_x,ecx
sub edx,[eax+sb_offs_position]
mov eax,ted_scr_w
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] cmp edx,[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area]
jl @f jl .end2
push ebx
mov ebx,edx mov ebx,edx
sub ebx,[eax+sb_offs_cur_area] sub ebx,[eax+sb_offs_cur_area]
inc ebx inc ebx
add [eax+sb_offs_position],ebx add [eax+sb_offs_position],ebx ;¯à®ªàã⪠ áªà®««¨­£  ¢­¨§
sub edx,ebx sub edx,ebx
pop ebx .end2:
; ??? redrav
@@:
mov ted_cur_y,edx mov ted_cur_y,edx
pop eax pop ebx eax
ret ret
;input: ;input:
@ -2805,6 +2835,107 @@ proc ted_but_redo uses edi, edit:dword
ret ret
endp 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 align 16
proc ted_but_find_next, edit:dword proc ted_but_find_next, edit:dword
pushad pushad
@ -2822,8 +2953,18 @@ proc ted_but_find_next, edit:dword
jle @f jle @f
jmp @b jmp @b
@@: @@:
cmp bh,0 call but_find
je @f 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 call ted_get_text_coords
inc ebx ;move cursor right inc ebx ;move cursor right
mov ted_sel_x1,ebx mov ted_sel_x1,ebx
@ -2831,7 +2972,7 @@ proc ted_but_find_next, edit:dword
mov edx,eax mov edx,eax
mov ecx,ebx mov ecx,ebx
call ted_go_to_pos call ted_go_to_pos
mov edx,esi ;esi ¡ë«® ãáâ ­®¢«¥® ¢ ted_get_find_rezult mov edx,esi
call ted_get_text_coords call ted_get_text_coords
mov ted_sel_x0,ebx mov ted_sel_x0,ebx
mov ted_sel_y0,eax mov ted_sel_y0,eax
@ -2843,7 +2984,36 @@ proc ted_but_find_next, edit:dword
je .end_find je .end_find
call ted_fun_find_err ;¯®«ì§®¢ â¥«ì᪠ï äã­ªæ¨ï call ted_fun_find_err ;¯®«ì§®¢ â¥«ì᪠ï äã­ªæ¨ï
.end_find: .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 ret
endp endp
@ -3752,8 +3922,8 @@ proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_l
@@: @@:
call ted_is_select call ted_is_select
cmp al,0 or al,al
je .no_select jz .no_select
cmp ted_seln_y0,esi cmp ted_seln_y0,esi
jg .no_select jg .no_select
cmp ted_seln_y1,esi cmp ted_seln_y1,esi

View File

@ -87,12 +87,12 @@ button:
@@: @@:
cmp ah,ID_BUT_FIND cmp ah,ID_BUT_FIND
jne @f jne @f
call ted_but_find call but_panel_find
jmp still jmp still
@@: @@:
cmp ah,ID_BUT_REPLACE cmp ah,ID_BUT_REPLACE
jne @f jne @f
call but_replace call but_panel_replace
jmp still jmp still
@@: @@:
cmp ah,ID_BUT_KEY_WORDS cmp ah,ID_BUT_KEY_WORDS
@ -137,7 +137,7 @@ button:
@@: @@:
cmp ah,ID_BUT_SYNTAX_MODE cmp ah,ID_BUT_SYNTAX_MODE
jne @f jne @f
stdcall but_choose_syntax, tedit0 stdcall but_panel_choose_syntax, tedit0
jmp still jmp still
@@: @@:
cmp ah,ID_BUT_CONVERT_1251_866 cmp ah,ID_BUT_CONVERT_1251_866
@ -156,11 +156,26 @@ button:
stdcall ted_but_open_syntax, tedit0 stdcall ted_but_open_syntax, tedit0
jmp still jmp still
@@: @@:
cmp ah,201 cmp ah,201 ;§ ¬¥­¨âì
jne @f jne .no_find
stdcall [ted_but_find_next], tedit0 call get_find_options
stdcall [ted_but_find], tedit0, eax
jmp still jmp still
@@: .no_find:
cmp ah,202 ;§ ¬¥­¨âì ¢á¥
jne .no_change
call get_find_options
stdcall [ted_but_replace], tedit0, buf_replace, eax, 1
or eax,eax
jz still
stdcall [ted_draw], tedit0
jmp still
.no_change:
cmp ah,203
jne .no_change_a
call but_replace_all
jmp still
.no_change_a:
cmp ah,1 cmp ah,1
jne @f jne @f
@ -202,6 +217,40 @@ ted_Exit:
mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
;ret ;ret
align 4
get_find_options:
xor eax,eax
cmp [opt_gr1],opt1
je @f
inc eax
cmp [opt_gr1],opt2
je @f
inc eax
@@:
ret
align 4
proc but_replace_all uses ebx ecx edx
call get_find_options
mov ebx,eax
stdcall [ted_but_replace], tedit0, buf_replace, ebx, 1
xor edx,edx
or eax,eax
jz @f
inc edx
mov ecx,0x1000
.cycle0:
stdcall [ted_but_replace], tedit0, buf_replace, ebx, 0
or eax,eax
jz @f
inc edx
loop .cycle0
@@:
stdcall [ted_draw], tedit0
mov eax,edx
ret
endp
;input: ;input:
; al = ª®¤ ®è¨¡ª¨ ; al = ª®¤ ®è¨¡ª¨
align 4 align 4
@ -553,7 +602,7 @@ endp
;description: ;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª  ; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
align 4 align 4
proc ted_but_find uses edi proc but_panel_find uses edi
mov edi,tedit0 mov edi,tedit0
cmp ted_panel_id,TED_PANEL_NULL cmp ted_panel_id,TED_PANEL_NULL
@ -570,6 +619,46 @@ proc ted_but_find uses edi
ret ret
endp endp
;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ § ¬¥­ë
align 4
proc but_panel_replace uses edi
mov edi,tedit0
cmp ted_panel_id,TED_PANEL_NULL
je @f
mov ted_panel_id,TED_PANEL_NULL
mov ted_wnd_l,0
jmp .e_if
@@:
mov ted_panel_id,TED_PANEL_REPLACE
mov ted_wnd_l,TED_PANEL_WIDTH
.e_if:
call EvSize
stdcall [ted_draw],edi
ret
endp
;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
align 4
proc but_panel_choose_syntax uses edi, edit:dword
mov edi,[edit]
cmp ted_panel_id,TED_PANEL_NULL
je @f
mov ted_panel_id,TED_PANEL_NULL
mov ted_wnd_l,0
jmp .e_if
@@:
mov ted_panel_id,TED_PANEL_SYNTAX
mov ted_wnd_l,TED_PANEL_WIDTH
.e_if:
call EvSize
stdcall [ted_draw],edi
ret
endp
align 4 align 4
tbl_1251_866: tbl_1251_866:
rb 128 rb 128
@ -599,13 +688,6 @@ ted_on_find_err:
stdcall [mb_create],msgbox_7,thread ;message: Can not find text stdcall [mb_create],msgbox_7,thread ;message: Can not find text
ret ret
;description:
; ª­®¯ª  [‡ ¬¥­¨âì] ­  ¯ ­¥«¨
align 4
but_replace:
; ¯®ª  ­¥ ᤥ« ­®
ret
;description: ;description:
; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢ ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
align 4 align 4
@ -647,22 +729,3 @@ proc but_use_syntax uses edi, edit:dword
ret ret
endp endp
;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ á ä ©« ¬¨ ᨭ⠪á¨á 
align 4
proc but_choose_syntax uses edi, edit:dword
mov edi,[edit]
cmp ted_panel_id,TED_PANEL_NULL
je @f
mov ted_panel_id,TED_PANEL_NULL
mov ted_wnd_l,0
jmp .e_if
@@:
mov ted_panel_id,TED_PANEL_SYNTAX
mov ted_wnd_l,TED_PANEL_WIDTH
.e_if:
call EvSize
stdcall [ted_draw],edi
ret
endp

File diff suppressed because one or more lines are too long

View File

@ -220,22 +220,33 @@ draw_but_toolbar: ;
; edi = pointer to tedit struct ; edi = pointer to tedit struct
align 4 align 4
proc draw_panel_find proc draw_panel_find
cmp ted_panel_id,TED_PANEL_FIND ;if not panel cmp ted_panel_id,TED_PANEL_FIND
jne @f jne @f
call p_find
jmp .end_f
@@:
cmp ted_panel_id,TED_PANEL_REPLACE
jne @f
call p_replace
jmp .end_f
@@:
push eax edx
mcall SF_DEFINE_BUTTON,,,0x80000000+201
mcall ,,,0x80000000+202
mcall ,,,0x80000000+203
pop edx eax
.end_f:
ret
endp
align 4
p_find:
push eax ebx ecx edx push eax ebx ecx edx
mov ecx,ted_wnd_t mov ecx,ted_wnd_t
shl ecx,16 shl ecx,16
mov cx,20 mov cx,20
mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
mov ebx,(30 shl 16)+25
add ebx,ted_wnd_t
mov ecx,[sc.work_text]
or ecx,0x80000000
mcall SF_DRAW_TEXT,,,txtFindCapt
stdcall [edit_box_draw], edit2
mov ecx,ted_wnd_t mov ecx,ted_wnd_t
add cx,20+15 ; 15 - height text box add cx,20+15 ; 15 - height text box
shl ecx,16 shl ecx,16
@ -243,30 +254,78 @@ proc draw_panel_find
mov edx,ted_scr_h mov edx,ted_scr_h
add cx,word[edx+sb_offs_size_y] add cx,word[edx+sb_offs_size_y]
sub cx,20+15-1 ; 15 - height text box sub cx,20+15-1 ; 15 - height text box
mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work] mcall ,,,[sc.work]
stdcall [edit_box_draw], edit2
mov ecx,ted_wnd_t mov ecx,ted_wnd_t
add cx,20+15+5
shl ecx,16 shl ecx,16
mov cx,20 add ecx,(93 shl 16)+20
mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id mcall SF_DEFINE_BUTTON,(5 shl 16)+85,,201,[sc.work_button] ;201 - button id
mov ebx,(15 shl 16)+(20+15+10) mov ebx,(23 shl 16)+7
add ebx,ted_wnd_t add ebx,ted_wnd_t
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,0x80000000 or ecx,0x80000000
mcall SF_DRAW_TEXT,,,txtFindNext mcall SF_DRAW_TEXT,,,txtFindCapt
mov ecx,[sc.work_button_text]
or ecx,0x80000000
mov ebx,(15 shl 16)+100
add ebx,ted_wnd_t
mcall ,,,txtFindNext
stdcall [option_box_draw], opt_grlist1
pop edx ecx ebx eax
ret
align 4
p_replace:
push eax ebx ecx edx
mov ecx,ted_wnd_t
shl ecx,16
mov cx,20
mcall SF_DRAW_RECT,TED_PANEL_WIDTH,,[sc.work]
mov ecx,ted_wnd_t
add cx,20+15 ; 15 - height text box
shl ecx,16
add ecx,ted_wnd_h
mov edx,ted_scr_h
add cx,word[edx+sb_offs_size_y]
sub cx,20+15-1 ; 15 - height text box
mcall ,,,[sc.work]
stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2
mov ecx,ted_wnd_t
shl ecx,16
add ecx,(133 shl 16)+20
mcall SF_DEFINE_BUTTON,(5 shl 16)+95,,202,[sc.work_button] ;replace next
add ecx,(26 shl 16)
mcall ,,,203 ;replace all
mov ebx,ted_wnd_t
add ebx,(23 shl 16)+7
mov ecx,[sc.work_text]
or ecx,0x80000000
mcall SF_DRAW_TEXT,,,txtFindCapt
add ebx,93
mcall SF_DRAW_TEXT,,,txtRerlaceCapt
mov ecx,[sc.work_button_text]
or ecx,0x80000000
mov ebx,ted_wnd_t
add ebx,(15 shl 16)+140
mcall ,,,txtRerlace
add ebx,26
mcall ,,,txtRerlaceAll
stdcall [option_box_draw], opt_grlist1
pop edx ecx ebx eax pop edx ecx ebx eax
jmp .end_f
@@:
push eax edx
mov edx,201
or edx,0x80000000
mcall SF_DEFINE_BUTTON
pop edx eax
.end_f:
ret ret
endp
;input: ;input:
; edi = pointer to tedit struct ; edi = pointer to tedit struct
@ -357,13 +416,14 @@ EvSize:
stdcall [ted_init_scroll_bars], tedit0,2 stdcall [ted_init_scroll_bars], tedit0,2
mov eax,ted_wnd_t mov eax,ted_wnd_t
mov edi,dword tree1 mov edi,tree1
mov tl_box_top,eax ;=ted_wnd_t mov tl_box_top,eax ;=ted_wnd_t
add tl_box_top,20 add tl_box_top,20
mov [edit2.top],eax ;=ted_wnd_t mov [edit2.top],eax ;=ted_wnd_t
add dword[edit2.top],20 add dword[edit2.top],20
mov [edit1.top],eax ;=ted_wnd_t
add dword[edit1.top],113
popad popad
ret ret

View File

@ -69,6 +69,7 @@ mov ebp,lib0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
stdcall [ted_init], tedit0 stdcall [ted_init], tedit0
stdcall [tl_data_init], tree1 stdcall [tl_data_init], tree1
option_boxes_set_sys_color sc,opt_grlist1
; OpenDialog initialisation ; OpenDialog initialisation
stdcall [OpenDialog_Init],OpenDialog_data stdcall [OpenDialog_Init],OpenDialog_data
@ -238,11 +239,19 @@ mouse:
stdcall [ted_mouse], tedit0 stdcall [ted_mouse], tedit0
.no_edit: .no_edit:
cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel ;¯à®¢¥àª  ¡®ª®¢ëå ¯ ­¥«¥©
cmp byte[tedit0.panel_id],TED_PANEL_FIND
jne @f jne @f
stdcall [edit_box_mouse], edit2 stdcall [edit_box_mouse], edit2
stdcall [option_box_mouse], opt_grlist1
@@: @@:
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel cmp byte[tedit0.panel_id],TED_PANEL_REPLACE
jne @f
stdcall [edit_box_mouse], edit2
stdcall [edit_box_mouse], edit1
stdcall [option_box_mouse], opt_grlist1
@@:
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX
jne @f jne @f
stdcall [tl_mouse], tree1 stdcall [tl_mouse], tree1
@@: @@:
@ -289,6 +298,25 @@ key:
mcall SF_GET_KEY mcall SF_GET_KEY
stdcall [tl_key], tree1 stdcall [tl_key], tree1
test word [edit1.flags],10b ;ed_focus ;¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je @f
cmp ah,0x80 ;if key up
ja still
cmp ah,42 ;[Shift] (left)
je still
cmp ah,54 ;[Shift] (right)
je still
cmp ah,56 ;[Alt]
je still
cmp ah,29 ;[Ctrl]
je still
cmp ah,69 ;[Pause Break]
je still
stdcall KeyConvertToASCII, conv_tabl
stdcall [edit_box_key], edit1
jmp still
@@:
test word [edit2.flags],10b ;ed_focus ;¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬ test word [edit2.flags],10b ;ed_focus ;¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je @f je @f
cmp ah,0x80 ;if key up cmp ah,0x80 ;if key up
@ -313,6 +341,7 @@ key:
jmp still jmp still
align 4 align 4
edit1 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_replace, mouse_dd, 0
edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0 edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
unpac_mem dd 0 unpac_mem dd 0
@ -376,6 +405,7 @@ i_end:
last_open_synt_file rb 32 ;¨¬ï ¯®á«¥¤­¥£® ¯®¤ª«î祭­®£® ä ©«  ᨭ⠪á¨á  last_open_synt_file rb 32 ;¨¬ï ¯®á«¥¤­¥£® ¯®¤ª«î祭­®£® ä ©«  ᨭ⠪á¨á 
buf rb BUF_SIZE ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ¨ ¢áâ ¢ª¨ buf rb BUF_SIZE ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ¨ ¢áâ ¢ª¨
buf_find rb 302 ;¡ãä¥à ¤«ï ¯®¨áª  ⥪áâ  buf_find rb 302 ;¡ãä¥à ¤«ï ¯®¨áª  ⥪áâ 
buf_replace rb 302 ;¡ãä¥à ¤«ï § ¬¥­ë ⥪áâ 
sc system_colors sc system_colors
IncludeUGlobals IncludeUGlobals
align 16 align 16