kol_f_edit:

1) add unpack code
2) fix when icon index -1

git-svn-id: svn://kolibrios.org@3475 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-04-17 13:29:19 +00:00
parent 3f2315327d
commit b1640343a9

View File

@ -14,12 +14,14 @@ include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../dll.inc'
include '../../system/desktop/trunk/kglobals.inc'
include '../../system/desktop/trunk/unpacker.inc'
include 'strlen.inc'
include 'obj_codes.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
hed db 'kol_f_edit 11.04.13',0
hed db 'kol_f_edit 17.04.13',0
sizeof.TreeList equ 20 ;need for element 'tree_list'
@ -325,19 +327,8 @@ start:
mov ted_syntax_file,eax
;¯à®¡ã¥¬ ®âªàëâì ä ©« ᨭ⠪á¨á 
mov ebx,run_file_70
mov dword[ebx], 0
mov dword[ebx+4], 0
mov dword[ebx+8], 0
mov dword[ebx+12], ecx
mov dword[ebx+16], eax ;ted_syntax_file
mov byte[ebx+20], 0
m2m dword[ebx+21], file_name
mcall 70
cmp eax,0
jne @f
stdcall [ted_init_syntax_file],edi
jmp .end_0
call open_unpac_synt_file
jmp .end_0
@@:
notify_window_run txt_not_syntax_file
.end_0:
@ -638,6 +629,10 @@ button:
stdcall [buf2d_delete],buf_skin2
stdcall [buf2d_delete],buf_skin3
stdcall [ted_delete], tedit0
cmp dword[unpac_mem],0
je @f
stdcall mem.Free,[unpac_mem]
@@:
mcall -1
align 4
@ -868,6 +863,13 @@ push eax ebx ecx
je @f
xor ecx,ecx
mov cx,word[eax+obj_opt.img-obj_opt] ;cx - ¨­¤¥ªá £« ¢­®© ¨ª®­ª¨ ¤®¡ ¢«ï¥¬®£® ®¡ê¥ªâ 
cmp ecx,count_main_icons ;¢ áâ àè¨å ¡¨â å ecx ¡ã¤ãâ 0, ¯®â®¬ã ®âà¨æ â¥«ì­ë¥ ç¨á«  ⮦¥ ¯à®¢¥àïîâáï
jl .end_0
;¥á«¨ ¨ª®­ª¨ ­¥â, ¯® 㬮«ç ­¨î ¡¥à¥¬ 0-î
xor cx,cx
.end_0:
shl ecx,16
stdcall mem_clear, u_object,sizeof.object
mov ebx,dword[eax]
@ -888,6 +890,84 @@ align 4
but_ctrl_s:
ret
;®âªàë⨥ ¨ à á¯ ª®¢ª  ä ©«  ¯®¤á¢¥âª¨ ᨭ⠪á¨á 
;input:
; ted_syntax_file - ¡ãä¥à ¤«ï ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á 
; ted_syntax_file_size - à §¬¥à ®âªà뢠¥¬®£® ä ©«  ᨭ⠪á¨á 
;output:
; ebx - ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â ¨§ ä ©« 
align 4
open_unpac_synt_file:
push eax edi esi
mov edi, tedit0
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ecx, ted_syntax_file_size
mov dword[run_file_70.Count], ecx
m2m dword[run_file_70.Buffer], ted_syntax_file
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mcall 70, run_file_70
cmp ebx,-1
jne .end_0
;¥á«¨ ¢®§­¨ª«¨ ®è¨¡ª¨ ¯à¨ ®âªàë⨨ ä ©«  ᨭ⠪á¨á 
mov byte[txt_not_syntax_file.err],'0'
add byte[txt_not_syntax_file.err],al
notify_window_run txt_not_syntax_file ;Can-t open color options file!
jmp @f
.end_0:
mov eax,ted_syntax_file
cmp dword[eax],'KPCK'
jne .end_unpack
mov ecx,dword[eax+4] ;ecx - à §¬¥à ä ©«  ᨭ⠪á¨á  ¯®á«¥ à á¯ ª®¢ª¨
cmp dword[unpac_mem],0
jne .end_1
;¯¥à¢®­ ç «ì­®¥ ¢ë¤¥«¥­¨¥ ¢à¥¬¥­­®© ¯ ¬ï⨠¤«ï à á¯ ª®¢ª¨ ä ©« 
stdcall mem.Alloc,ecx
mov [unpac_mem],eax
mov [unpac_mem_size],ecx
.end_1:
cmp dword[unpac_mem_size],ecx
jge .end_2
;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠢६¥­­®© ¯ ¬ïâ¨
stdcall mem.ReAlloc,[unpac_mem],ecx ;§ ­®¢® ¢ë¤¥«ï¥¬ ¢à¥¬¥­­ãî ¯ ¬ïâì
mov [unpac_mem],eax
mov [unpac_mem_size],ecx
.end_2:
;à á¯ ª®¢ª  ä ©«  ¢® ¢à¥¬¥­­ãî ¯ ¬ïâì
stdcall unpack,ted_syntax_file,[unpac_mem]
cmp ted_syntax_file_size,ecx
jge .end_3
;¥á«¨ ¤«ï à á¯ ª®¢ ­®£® ä ©«  ­¥ 墠⠥⠯ ¬ïâ¨
stdcall mem.ReAlloc,ted_syntax_file,ecx ;§ ­®¢® ¢ë¤¥«ï¥¬ ¯ ¬ïâì
mov ted_syntax_file,eax
mov ted_syntax_file_size,ecx
.end_3:
;ª®¯¨à®¢ ­¨¥ à á¯ ª®¢ ­­®£® ä ©«  ¨§ ¢à¥¬¥­­®© ¯ ¬ï⨠¢ ¯ ¬ïâì í«¥¬¥­â 
mov edi,ted_syntax_file
mov esi,[unpac_mem]
cld
rep movsb
.end_unpack:
;¯à¨¬¥­¥­¨¥ ä ©«  ¯®¤á¢¥âª¨
stdcall [ted_init_syntax_file], tedit0
@@:
pop esi edi eax
ret
align 4
txt_not_syntax_file:
db 'Žè¨¡ª  ¯à¨ ®âªàë⨨ ä ©«  á 梥⮢묨 ­ áâனª ¬¨! (Š®¤ ®è¨¡ª¨ ='
.err: db '?'
db ')',0
align 4
buf_fon: ;ä®­®¢ë© ¡ãä¥à
dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
@ -942,6 +1022,8 @@ txtErrIni1 db '
err_opn db 0 ;१. ®âªàëâ¨ï ä ©«  ¯à®íªâ 
err_ini0 db 0 ;१. ®âªàëâ¨ï ä ©«  á ¨ª®­ª ¬¨
err_ini1 db 0 ;१. ®âªàëâ¨ï ä ©«  á ®¯æ¨ï¬¨
unpac_mem dd 0
unpac_mem_size dd 0
edit1 edit_box 210, 10, 5, 0xffffff, 0xff80, 0xff, 0xff0000, 0x4080, 300, ed_text1, mouse_dd, 0, 7, 7
@ -1094,17 +1176,7 @@ rb 4+4
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.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
rb 32
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
;---------------------------------------------------------------------
@ -1127,17 +1199,7 @@ rb 4+4
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.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
rb 32
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
@ -1156,7 +1218,7 @@ rb 4+4
.line_col dd 0 ;+36
rb 4+2+2
.run_x:
rb 2+2+2+2+4+4+4+4+4+4
rb 32
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
@ -1173,7 +1235,7 @@ rb 4+4
.line_col dd 0 ;+36
rb 4+2+2
.run_x:
rb 2+2+2+2+4+4+4+4+4+4
rb 32
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
@ -1197,8 +1259,6 @@ foc_obj dd 0 ;
obj_count_txt_props dd 0 ;ª®«¨ç¥á⢮ ¨á¯®«ì§ã¥¬ëå ⥪á⮢ëå ᢮©áâ¢
obj_m_win dd 0 ;áâàãªâãà  £« ¢­®£® ®ª­ 
txt_not_syntax_file db '<27>¥ ­ ©¤¥­ ä ©« ¤«ï ¯®¤á¢¥âª¨ ᨭ⠪á¨á .',0
;
if 1 ;lang eq ru
@ -1508,7 +1568,9 @@ procinfo process_information
run_file_70 FileInfoBlock
open_b rb 560
IncludeIGlobals
i_end:
IncludeUGlobals
buf_cmd_lin rb 1024
file_name rb 1024 ;icon file path
fp_obj_opt rb 1024 ;obj options file patch