't_edit' add new window 'search in keywords'

git-svn-id: svn://kolibrios.org@3244 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-02-14 21:09:13 +00:00
parent 082fd6ba1d
commit 0da906311f
5 changed files with 259 additions and 44 deletions

View File

@ -51,9 +51,9 @@ strlen:
linlen: linlen:
push ecx edi push ecx edi
pushfd pushfd
cld ; ! cld
mov ecx,eax mov ecx,eax
inc ecx inc ecx
mov edi,esi ; find terminating zero mov edi,esi ; find terminating zero
mov al,13 mov al,13
repne scasb repne scasb
@ -63,5 +63,31 @@ linlen:
popfd popfd
pop edi ecx pop edi ecx
ret ret
;%endif
;description:
; проверяет содержится ли строка str1 в строке str0
; проверка делается только начиная с первых символов, указанных в str0 и str1
; пример 1: если str0='aaabbbccc', str1='bbb' совпадения не будет
; пример 2: если str0='aaabbbccc', str1='aaa' совпадение будет
;output:
; al = 0 если строка str1 содержится в str0
; al != 0 если строка str1 не содержится в str0
align 4
proc str_instr uses edi esi, str0:dword, str1:dword
;xor eax,eax
mov edi,[str0]
mov esi,[str1]
cld
@@:
mov al,[esi]
cmp al,0
je .e1
inc esi
scasb ;сравниваем символы
jz @b ;если совпали, то переходим к сравнению следующих
;сюда попадаем если строки не совпали
sub al,[edi-1]
.e1: ;сюда попадаем если строка str1 (esi) закончилась
ret
endp

View File

@ -341,7 +341,12 @@ but_replace:
; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢ ; äã­ªæ¨ï ¯®¨áª  ¨­ä®à¬ æ¨¨ ¢ ᯨ᪥ ª«î祢ëå á«®¢
align 4 align 4
but_find_key_w: but_find_key_w:
; <EFBFBD>ͺ  ­₯ α€₯« ­<EFBFBD> cmp byte[wnd_k_words_run],0
jne @f
pushad
mcall 51,1,prop_start,thread_coords
popad
@@:
ret ret
;description: ;description:

View File

@ -59,6 +59,7 @@ import_box_lib:
edit_box_draw dd aEdit_box_draw edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse edit_box_mouse dd aEdit_box_mouse
;edit_box_set_text dd aEdit_box_set_text
;version_ed dd aVersion_ed ;version_ed dd aVersion_ed
scrollbar_ver_draw dd aScrollbar_ver_draw scrollbar_ver_draw dd aScrollbar_ver_draw
@ -126,6 +127,7 @@ dd 0,0
aEdit_box_draw db 'edit_box',0 aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0 aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0 aEdit_box_mouse db 'edit_box_mouse',0
;aEdit_box_set_text db 'edit_box_set_text',0
;aVersion_ed db 'version_ed',0 ;aVersion_ed db 'version_ed',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0
@ -250,17 +252,7 @@ wScr:
.delta dw 0 ;+44 .delta dw 0 ;+44
.delta2 dw 0 ;+46 .delta2 dw 0 ;+46
.run_x: .run_x:
.r_size_x dw 0 ;+48 rb 2+2+2+2+4+4+4+4+4+4
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80 .all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84 .ar_offset dd 1 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -284,17 +276,7 @@ hScr:
.delta dw 0 ;+44 .delta dw 0 ;+44
.delta2 dw 0 ;+46 .delta2 dw 0 ;+46
.run_x: .run_x:
.r_size_x dw 0 ;+48 rb 2+2+2+2+4+4+4+4+4+4
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80 .all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84 .ar_offset dd 1 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -318,17 +300,7 @@ ws_dir_lbox: ;
.delta dw 0 ;+44 .delta dw 0 ;+44
.delta2 dw 0 ;+46 .delta2 dw 0 ;+46
.run_x: .run_x:
.r_size_x dw 0 ;+48 rb 2+2+2+2+4+4+4+4+4+4
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80 .all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84 .ar_offset dd 1 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -514,7 +486,7 @@ tree_file_struct:
if lang eq ru if lang eq ru
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 10.07.12',0 ;¯®¤¯¨áì ®ª­  hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 14.02.13',0 ;¯®¤¯¨áì ®ª­ 
menu_text_area: menu_text_area:
db '” ©«',0 db '” ©«',0
@ -632,7 +604,7 @@ txtFormatApply db '
else else
hed db 'Text editor 10.07.12',0 hed db 'Text editor 14.02.13',0
menu_text_area: menu_text_area:
db 'File',0 db 'File',0

View File

@ -33,6 +33,7 @@ include 't_data.inc'
include 'strlen.inc' include 'strlen.inc'
include 't_draw.inc' ;draw main window functions include 't_draw.inc' ;draw main window functions
include 't_button.inc' ;text work functions include 't_button.inc' ;text work functions
include 'wnd_k_words.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@ -93,7 +94,7 @@ start:
jz button.exit jz button.exit
mcall 66,1,1 ;scan code mcall 66,1,1 ;scan code
mcall 40,0x27 mcall 40,0xC0000027
mov esi,file_name mov esi,file_name
call strlen call strlen
@ -182,6 +183,7 @@ mov ecx,ebx
mov [wScr.type],eax mov [wScr.type],eax
mov [hScr.type],eax mov [hScr.type],eax
mov [ws_dir_lbox.type],eax mov [ws_dir_lbox.type],eax
mov [w_scr_t3.type],eax
;symbol size ;symbol size
stdcall dword[ini_get_int],file_name,ini_sec_window,key_symbol_w,ini_def_symbol_w stdcall dword[ini_get_int],file_name,ini_sec_window,key_symbol_w,ini_def_symbol_w
mov dword[tedit0.rec.width],eax mov dword[tedit0.rec.width],eax
@ -239,9 +241,6 @@ still:
jz button jz button
cmp al,6 ;¬ëèì cmp al,6 ;¬ëèì
jne @f jne @f
mcall 9,procinfo,-1
cmp ax,word[procinfo+4]
jne @f ;ŽŞ­Ž ­Ľ  Şâ¨˘­Ž
jmp mouse jmp mouse
@@: @@:
jmp still jmp still
@ -576,12 +575,13 @@ i_end:
buf rb BUF_SIZE ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ¨ ¢áâ ¢ª¨ buf rb BUF_SIZE ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ¨ ¢áâ ¢ª¨
buf_find rb 302 ;¡ãä¥à ¤«ï ¯®¨áª  ⥪áâ  buf_find rb 302 ;¡ãä¥à ¤«ï ¯®¨áª  ⥪áâ 
IncludeUGlobals IncludeUGlobals
rb 1024
align 16 align 16
procinfo process_information procinfo process_information
rb 1024 rb 1024
thread: thread:
rb 1024 rb 1024
thread_coords:
rb 1024
stacktop: stacktop:
sys_path: sys_path:
rb 4096 rb 4096

View File

@ -0,0 +1,212 @@
;
; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï ᮧ¤ ­¨ï ¨
; à ¡®âë ®ª­  á ¯®¨áª®¬ ¢ ª«î祢ëå á«®¢ å
;
prop_wnd_width equ 350 ;è¨à¨­  ®ª­  á ¯®¨áª®¬
SIZE_ONE_FLOAT equ 14
IMAGE_TOOLBAR_ICON_SIZE equ 20*20*3
wnd_k_words_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ®¤­®¢à¥¬¥­­®
if lang eq ru
txt_caption db '<27>®¨áª ¢ ª«î祢ëå á«®¢ å',0
else
txt_caption db 'Search in keywords',0
end if
;¤ ­®¥ ®ª­® (¯à®æ¥áá) ¢ë§ë¢ ¥âìáï ä㭪樥© but_wnd_coords
align 4
prop_start:
pushad
mcall 40,0xC0000027 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
inc byte[wnd_k_words_run]
;­ áâனª  ᯨ᪠ ®¡ê¥ªâ®¢
mov dword[tree3.info_max_count],2
mov edi,tedit0
mov edx,ted_key_words_count
add dword[tree3.info_max_count],edx ;áâ ¢¨¬ ç¨á«® 㧫®¢, à ¢­®¥ ª®««¨ç¥áâ¢ã ª«î祢ëå á«®¢ ¢ ä ©«¥ ¯®¤á¢¥âª¨ (+2 ­  ­ ç «® ¨ ª®­¥æ ᯨ᪠)
stdcall dword[tl_data_init], tree3
mov eax,dword[icon_tl_sys]
mov dword[tree3.data_img],eax
mov eax,dword[tree1.data_img_sys]
mov dword[tree3.data_img_sys],eax
edit_boxes_set_sys_color edit3,editboxes_end,sc ;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
;stdcall [edit_box_set_text], edit3, txt_q
popad
align 4
prop_red_win:
pushad
mcall 12,1
xor eax,eax
mov edi,txt_caption
mov bx,word[procinfo.box.left]
add bx,5 ;word[buf_0.l]
shl ebx,16
mov bx,prop_wnd_width
mov cx,word[procinfo.box.top]
add cx,5 ;word[buf_0.t]
shl ecx,16
mov cx,250
mov edx,0xffffd0
or edx,0x33000000
int 0x40
mov eax,8
mov ebx,(5 shl 16)+19
mov ecx,(5 shl 16)+19
mov edx,3
mov esi,[sc.work_button]
int 0x40
add ebx,(25 shl 16)
mov edx,4
int 0x40
mov eax,7
mov ebx,[bmp_icon]
add ebx,7*IMAGE_TOOLBAR_ICON_SIZE
mov ecx,(20 shl 16)+20
mov edx,(5 shl 16)+5 ;­ ©â¨
int 0x40
sub ebx,2*IMAGE_TOOLBAR_ICON_SIZE
mov edx,(30 shl 16)+5 ;ª®¯¨à®¢ âì
int 0x40
mov dword[w_scr_t3.all_redraw],1
stdcall [scrollbar_ver_draw],dword w_scr_t3
stdcall [tl_draw], tree3
stdcall [edit_box_draw], edit3
mcall 12,2
popad
;­¥ ®âà뢠âì íâã äã­ªæ¨î ®â ¯à¥¤ë¤ã饩
align 4
prop_still:
mcall 10
cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz prop_red_win
cmp al,2
jne @f
call prop_key
@@:
cmp al,3
jne @f
call prop_button
@@:
cmp al,6
jne @f
call prop_mouse
@@:
jmp prop_still
.exit:
mov dword[tree3.data_img],0 ;ç¨á⨬ 㪠§ â¥«¨ ­  ¨ª®­ª¨ çâ®-¡ë ¨å ­¥ 㤠«¨« ¤¥áâàãªâ®à
mov dword[tree3.data_img_sys],0 ;â. ª. ®­¨ ¥é¥ ¨á¯®«ì§ãîâìáï ¢ ¤à㣨å í«¥¬¥­â å
stdcall dword[tl_data_clear], tree3
mov byte[wnd_k_words_run],0 ;®¡­ã«ï¥¬ áç¥â稪 ®ª®­
mcall -1 ;§ ªàë⨥ ®ª­  ¯®¨áª 
align 4
prop_key:
push eax
mcall 2
stdcall [edit_box_key], edit3
stdcall [tl_key], tree3
pop eax
ret
align 4
prop_mouse:
;push ecx edi
stdcall [tl_mouse], tree3
stdcall [edit_box_mouse], edit3
;pop edi ecx
ret
align 4
prop_button:
pushad
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,1
je prop_still.exit
cmp ah,3
jne @f
;­ ©â¨ á«®¢ 
mov edi,tedit0
cmp ted_syntax_file,0
je @f
stdcall dword[tl_info_clear], tree3
mov ebx,ted_key_words_data
mov ecx,ted_key_words_count
cld
.cycle_0:
stdcall str_instr, ebx,[edit3.text]
test al,al
jnz .end_add
stdcall dword[tl_node_add], ebx, (0 shl 16), tree3
stdcall dword[tl_cur_next], tree3
.end_add:
add ebx,MAX_COLOR_WORD_LEN+8 ;sizeof.TexColViv
loop .cycle_0
stdcall dword[tl_cur_beg], tree3
stdcall dword[tl_draw], tree3
@@:
cmp ah,4
jne @f
;ª®¯¨à®¢ âì ¢ ¡ãä¥à
stdcall [tl_node_get_data],tree3
pop esi
cmp esi,0
je .no_select_0
mov edi,[tedit0.buffer]
mov byte[edi+MAX_COLOR_WORD_LEN],0
mov ecx,MAX_COLOR_WORD_LEN
cld
rep movsb
.no_select_0:
@@:
popad
ret
;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥
align 4
tree3 tree_list MAX_COLOR_WORD_LEN,3,\
tl_key_no_edit+tl_list_box_mode,\
16,16, 0x8080ff,0x0000ff,0xffffff, 5,30,300,160, 16, 0,0, el_focus,\
w_scr_t3,0
align 4
edit3 edit_box 80, 70, 8, 0xffffff, 0xff, 0x80ff, 0, 0x8000, MAX_COLOR_WORD_LEN+2, string1, mouse_dd, 0
editboxes_end:
string1 rb MAX_COLOR_WORD_LEN
align 4
w_scr_t3:
.size_x dw 16 ;+0
rb 2+2+2
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
rb 4+4
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0 ;+36
rb 4+2+2
.run_x:
rb 2+2+2+2+4+4+4+4+4+4
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84