't_edit' add auto open syntax files (max 10 files)

git-svn-id: svn://kolibrios.org@2855 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2012-07-10 11:05:50 +00:00
parent 20e789a104
commit baa66d1a4c
4 changed files with 102 additions and 17 deletions

View File

@ -27,7 +27,8 @@ run_file_70 FileInfoBlock
; al = ª®¤ ®è¨¡ª¨
align 4
ted_on_init_synt_err:
mov byte[msgbox_3.err],al
mov byte[msgbox_3.err],'0'
add byte[msgbox_3.err],al
stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file!
ret
@ -117,8 +118,39 @@ ted_but_open_file:
mov [edit1.size],eax
mov [edit1.pos],eax
stdcall [edit_box_draw], edit1
;¨é¥¬ ¥áâì «¨ ä ©« ¯®¤á¢¥âª¨ ¤«ï ®âªà뢠¥¬®£® ⥪á⮢®£® ä ©« 
mov edx,[edit1.text]
add edx,eax
.f_beg:
cmp byte[edx],'.'
je .found
dec edx
cmp edx,[edit1.text]
jg .f_beg
.found:
inc edx ;edx - 㪠§ â¥«ì ­  à áè¨à¥­¨¥ ®âªàë⮣® ä ©« 
mov ebx,synt_auto_open
.cycle_0:
add ebx,32
stdcall strcmp,ebx,edx ;áà ¢­¨¢ ¥¬ à áè¨à¥­¨¥ ®âªàë⮣® ä ©«  á® §­ ç¥­¨ï¬¨ ®âªàëâ묨 á ini ä ©« 
test eax,eax
jz .ok
add ebx,32
cmp byte[ebx],0
jne .cycle_0
jmp .end_0
.ok: ;®âªàë⨥ ä ©«  ¯®¤á¢¥âª¨ ¢ § ¢¨á¨¬®á⨠®â ­ ©¤¥­­®£® à áè¨à¥­¨ï
sub ebx,32
;mov ecx,ebx
;mcall 71,1
call open_unpac_synt_file
.end_0:
stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
call ted_messages_after_open_file
.ret_f:
popad
ret
@ -154,7 +186,6 @@ endp
;input:
; eax = ª®¤ ®è¨¡ª¨
; ebx = ª®««¨ç¥á⢮ ¯à®ç¨â ­­ëå ¡ ©â
; edi = pointer to tedit struct
align 4
ted_messages_after_open_file:
push ecx edi
@ -202,9 +233,6 @@ proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
stdcall dword[tl_node_get_data], tree1
pop dword[fn_col_option]
mov ebx,dword[fn_col_option]
copy_path ebx,fn_syntax_dir,file_name_rez,0x0
copy_path file_name_rez,sys_path,file_name,0x0
call open_unpac_synt_file
cmp ebx,-1
je @f
@ -216,11 +244,27 @@ proc ted_but_open_syntax uses eax ebx ecx edi, edit:dword
endp
;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
;input:
; ebx - 㪠§ â¥«ì ­  ¨¬ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á  (¡¥§ ¯ã⨠¨ ¯ ¯ª¨ info)
;output:
; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
; ecx - à §àãè ¥âáï
align 4
open_unpac_synt_file:
push eax edi esi
mov edi,last_open_synt_file
stdcall strcmp,ebx,edi ;áà ¢­¨¢ ¥¬ ¨¬ï ¯®¤ª«î祭­®£® ä ©«  á ¯®¤ª«î祭­ë¬ à ­¥¥ ä ©«®¬
test eax,eax
jz @f
;ª®¯¨à㥬 ¨¬ï ¯®¤ª«î祭­®£® ä ©«  (¤«ï ¨§¡¥¦ ­¨ï ¯®¢â®à­ëå ¯®¤ª«î祭¨©)
mov esi,ebx
mov ecx,32
cld
rep movsb
copy_path ebx,fn_syntax_dir,file_name_rez,0
copy_path file_name_rez,sys_path,file_name,0
mov edi, tedit0
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0

View File

@ -21,10 +21,19 @@ key_symbol_w db 'symbol_w',0
key_symbol_h db 'symbol_h',0
key_scroll_type db 'scroll_type',0
ini_sec_options db 'Options',0
key_synt_file:
db 'syntax_'
.numb: db '0',0
key_synt_ext:
db 'ext_'
.numb: db '0',0
ini_def_synt_f db 0
align 4
wnd_s_pos: ;¬¥áâ® ¤«ï ­ áâ஥ª áâ à⮢®© ¯®§¨æ¨¨ ®ª­ 
rq 0
max_synt_auto_open equ 10
synt_auto_open:
rb 64*max_synt_auto_open
db 0
system_dir_0 db '/sys/lib/'
lib_name_0 db 'box_lib.obj',0
@ -488,7 +497,6 @@ tedit0: ;
;------------------------------------------------------------------------------
conv_tabl rb 128 ; â ¡«¨æ  ¤«ï ª®­¢¥àâ¨à®¢ ­¨ï scan-ª®¤  ¢ ascii-ª®¤
buf db BUF_SIZE dup(0)
el_focus dd 0
mouse_dd dd 0
@ -504,11 +512,9 @@ tree_file_struct:
db 0
dd file_name ;sys_path
dir_mem rb 32+304*count_of_dir_list_files
if lang eq ru
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 05.07.12',0 ;¯®¤¯¨áì ®ª­ 
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 10.07.12',0 ;¯®¤¯¨áì ®ª­ 
menu_text_area:
db '” ©«',0
@ -626,7 +632,7 @@ txtFormatApply db '
else
hed db 'Text editor 05.07.12',0
hed db 'Text editor 10.07.12',0
menu_text_area:
db 'File',0

View File

@ -168,7 +168,7 @@ mov ecx,ebx
.end_dir_init:
;--- load ini file ---
copy_path ini_name,sys_path,file_name,0x0
copy_path ini_name,sys_path,file_name,0
;window startup pozition
stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l
mov word[wnd_s_pos+2],ax
@ -190,11 +190,27 @@ mov ecx,ebx
mov dword[tedit0.rec.height],eax
lea eax,[eax+eax*2]
mov dword[tedit0.rec.top],eax
;ä ©«®¢ë¥ à áè¨à¥­¨ï
xor edx,edx
mov ebx,synt_auto_open
@@:
;¡¥à¥¬ ¨¬ï ä ©« 
stdcall dword[ini_get_str],file_name,ini_sec_options,key_synt_file,ebx,32,ini_def_synt_f
cmp byte[ebx],0
je @f
inc byte[key_synt_file.numb]
add ebx,32
;¡¥à¥¬ à áè¨à¥­¨ï
stdcall dword[ini_get_str],file_name,ini_sec_options,key_synt_ext,ebx,32,ini_def_synt_f
inc byte[key_synt_ext.numb]
add ebx,32
inc edx
cmp edx,max_synt_auto_open
jl @b
@@:
;--- load color option file ---
mov ebx,dword[fn_col_option]
copy_path ebx,fn_syntax_dir,file_name_rez,0x0
copy_path file_name_rez,sys_path,file_name,0x0
call open_unpac_synt_file
;--- get cmd line ---
@ -509,7 +525,6 @@ edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 4090, open
edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
unpac_mem dd 0
buf_find db 302 dup(0)
if lang eq ru
head_f_i:
@ -555,6 +570,12 @@ load_lib_end:
IncludeIGlobals
i_end:
dir_mem rb 32+304*count_of_dir_list_files
wnd_s_pos: ;¬¥áâ® ¤«ï ­ áâ஥ª áâ à⮢®© ¯®§¨æ¨¨ ®ª­ 
rq 1
last_open_synt_file rb 32 ;¨¬ï ¯®á«¥¤­¥£® ¯®¤ª«î祭­®£® ä ©«  ᨭ⠪á¨á 
buf rb BUF_SIZE ;¡ãä¥à ¤«ï ª®¯¨à®¢ ­¨ï ¨ ¢áâ ¢ª¨
buf_find rb 302 ;¡ãä¥à ¤«ï ¯®¨áª  ⥪áâ 
IncludeUGlobals
rb 1024
align 16

View File

@ -6,4 +6,18 @@ h=370
symbol_w=7
symbol_h=11
scroll_type=0
[Options]
[Options]
syntax_0=asm.syn
ext_0=asm
syntax_1=cpp_kol_dar.syn
ext_1=cpp
syntax_2=html.syn
ext_2=htm
syntax_3=ini_files.syn
ext_3=ini
syntax_4=asm.syn
ext_4=inc
syntax_5=cpp_kol_dar.syn
ext_5=h
syntax_6=html.syn
ext_6=html