Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5916 → Rev 5917

/programs/develop/kol_f_edit/kol_f_edit.asm
21,7 → 21,7
 
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
 
hed db 'kol_f_edit 17.04.13',0
hed db 'kol_f_edit 16.11.15',0
 
sizeof.TreeList equ 20 ;need for element 'tree_list'
 
75,24 → 75,22
db 0
@@:
;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
copy_path .path_str,[32],file_name,0x0
copy_path .path_str,[32],file_name,0
else
copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
 
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
m2m [run_file_70.Buffer], [buf]
m2m [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
216,8 → 214,7
stdcall dword[tl_data_init], tree1
stdcall dword[tl_data_init], tree2
 
copy_path fn_icon,sys_path,file_name,0x0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
mov eax,70 ;load icon file
copy_path fn_icon,sys_path,file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
mov [run_file_70.Function], 0
mov [run_file_70.Position], 54
mov [run_file_70.Flags], 0
225,8 → 222,7
mov [run_file_70.Buffer], bmp_icon
mov [run_file_70.rezerv], 0
mov [run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40
mcall 70,run_file_70
 
cmp ebx,-1
mov [err_ini0],1
265,15 → 261,13
stdcall [buf2d_convert_text_matrix], buf_font
 
 
copy_path fn_obj_opt,sys_path,fp_obj_opt,0x0
copy_path fn_obj_opt,sys_path,fp_obj_opt,0
;load options file
mov eax,70
mov [run_file_70.Position], 0
mov [run_file_70.Count], sizeof.ObjOpt*MAX_OBJ_TYPES+MAX_OBJ_CAPTIONS
mov [run_file_70.Buffer], obj_opt
mov [run_file_70.FileName], fp_obj_opt
mov ebx,run_file_70
int 0x40
mcall 70,run_file_70
 
cmp ebx,-1
mov [err_ini1],1
292,7 → 286,7
xor cx,cx ;çâ®-¡ë ­¥ £«î稫® á ®âà¨æ â¥«ì­ë¬ ¨­¤¥ªá®¬
.zero:
shl ecx,16
stdcall dword[tl_node_add], eax, ecx, tree1 ;¤®¡ ¢«ï¥¬ ­ §¢ ­¨¥ ®¡ê¥ªâ 
stdcall dword[tl_node_add], tree1,ecx,eax ;¤®¡ ¢«ï¥¬ ­ §¢ ­¨¥ ®¡ê¥ªâ 
stdcall dword[tl_cur_next], tree1 ;¯¥à¥­®á¨¬ ªãàá®à ¢­¨§, çâ®-¡ë ­¥ ¯®¬¥­ï«áï ¯®à冷ª
add eax,sizeof.ObjOpt ;¯¥à¥å®¤ ­  á«¥¤ãî騩 ®¡ê¥ªâ
jmp @b
301,12 → 295,12
 
.open_end:
 
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
stdcall [ted_init], tedit0
copy_path fn_syntax,sys_path,file_name,0x0
copy_path fn_syntax,sys_path,file_name,0
 
; *** init syntax file ***
; ¯à®¢¥à塞 à §¬¥à ä ©«  ᨭ⠪á¨á 
mov eax,70
mov [run_file_70.Function], 5
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
314,8 → 308,7
mov dword[run_file_70.Buffer], open_b
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40
mcall 70,run_file_70
cmp eax,0
jne @f
 
488,11 → 481,7
 
cmp [err_opn],1
jne @f
mov eax,4
mov ebx,10*65536+35
mov ecx,0x80ff0000
mov edx,txtErrOpen
int 0x40
mcall 4,10*65536+35,0x80ff0000,txtErrOpen
@@:
 
stdcall [edit_box_draw], dword edit1
546,10 → 535,12
cmp ah,5
jne @f
call but_open_proj
jmp still
@@:
cmp ah,6
jne @f
call but_save_proj
jmp still
@@:
;cmp ah,10
;jne @f
558,60 → 549,74
cmp ah,11
jne @f
call but_show_constructor
jmp still
@@:
cmp ah,12
jne @f
call but_show_code
jmp still
@@:
cmp ah,13
jne @f
call but_update
jmp still
@@:
cmp ah,14
jne @f
call but_save_asm
jmp still
@@:
cmp ah,15
jne @f
call but_show_invis
jmp still
@@:
cmp ah,16
jne @f
call but_show_syntax
jmp still
@@:
cmp ah,21
jne @f
call but_obj_move_up
jmp still
@@:
cmp ah,22
jne @f
call but_obj_move_down
jmp still
@@:
cmp ah,23
jne @f
call but_obj_copy
jmp still
@@:
cmp ah,24
jne @f
call but_obj_paste
jmp still
@@:
cmp ah,25
jne @f
call on_file_object_select
jmp still
@@:
cmp ah,26
jne @f
stdcall [tl_info_undo], tree2
stdcall [tl_draw], tree2
jmp still
@@:
cmp ah,27
jne @f
stdcall [tl_info_redo], tree2
stdcall [tl_draw], tree2
jmp still
@@:
cmp ah,31
jne @f
call on_add_object
jmp still
@@:
cmp ah,1
jne still
636,30 → 641,49
mcall -1
 
align 4
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
 
align 4
but_open_proj:
copy_path open_dialog_name,communication_area_default_path,file_name,0
pushad
mov eax,70
mov [OpenDialog_data.type],0
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],2
je .open_end
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
 
mov [run_file_70.Function], 5
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], 0
mov dword[run_file_70.Buffer], open_b
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70
 
mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
mov [open_file_size],ecx
stdcall mem.ReAlloc,[open_file_data],ecx
mov [open_file_data],eax
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], sizeof.object*MAX_CED_OBJECTS
mov [run_file_70.Buffer], ced_info
mov [run_file_70.rezerv], 0
push [edit1.text]
pop [run_file_70.FileName]
mov ebx,run_file_70
int 0x40
 
cmp ebx,-1
mov dword[run_file_70.Count], ecx
m2m dword[run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©«
cmp ebx,0xffffffff
mov [err_opn],1
je .open_end ;if open file
mov ecx,ced_info
add ecx,ebx
mov byte [ecx],0
mov [err_opn],0
stdcall [edit_box_set_text], edit1,openfile_path
 
stdcall dword[tl_info_clear], tree2
mov eax,ced_info ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâë
mov eax,[open_file_data] ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâë
@@:
mov ebx,dword[eax]
cmp ebx,0
673,12 → 697,12
xor cx,cx ;çâ®-¡ë ­¥ £«î稫® á ®âà¨æ â¥«ì­ë¬ ¨­¤¥ªá®¬
.zero:
shl ecx,16 ;¢ ecx ¨­¤¥ªá ¨ª®­ª¨
mov cl,byte[eax++u_object.lvl-u_object] ;ã஢¥­ì ®¡ê¥ªâ 
mov cl,byte[eax+u_object.lvl-u_object] ;ã஢¥­ì ®¡ê¥ªâ 
 
;tl_node_close_open - ­¥ ¯®¤å®¤¨â, â.ª. ¤¥©áâ¢ã¥â ­  ã§«ë ¨¬¥î騥 ¤®ç¥à­¨¥
mov ch,byte[eax++u_object.clo-u_object] ;§ ªàëâë©/®âªàëâë©
mov ch,byte[eax+u_object.clo-u_object] ;§ ªàëâë©/®âªàëâë©
 
stdcall dword[tl_node_add], eax, ecx, tree2 ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
stdcall dword[tl_node_add], tree2,ecx,eax ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
 
stdcall dword[tl_cur_next], tree2 ;¯¥à¥­®á¨¬ ªãàá®à ¢­¨§, çâ®-¡ë ­¥ ¯®¬¥­ï«áï ¯®à冷ª
add eax,sizeof.object ;¯¥à¥å®¤ ­  á«¥¤ãî騩 ®¡ê¥ªâ
697,17 → 721,39
;á®åà ­¥­¨¥ ä ©«  ¯à®íªâ  ­  ¤¨áª
align 4
but_save_proj:
copy_path open_dialog_name,communication_area_default_path,file_name,0
pushad
mov [OpenDialog_data.type],1
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],2
je .end_save_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
 
mov edi,ced_info
;¡¥à¥¬ à §¬¥à ¯ ¬ïâ¨, ­¥®¡å®¤¨¬®© ¤«ï á®åà ­¥­¨ï ä ©« 
xor ecx,ecx
stdcall [tl_node_poi_get_info], tree2,0
@@:
cmp eax,0
je @f
inc ecx
stdcall [tl_node_poi_get_next_info], tree2,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
@@:
;movzx eax,word[tree2.info_size]
imul ecx,sizeof.object ;eax
add ecx,4 ;¬¥âª  ª®­æ  ä ©« 
mov [open_file_size],ecx
stdcall mem.ReAlloc,[open_file_data],ecx
mov [open_file_data],eax
 
stdcall [tl_node_poi_get_info], 0,tree2
pop edx
mov edi,[open_file_data]
stdcall [tl_node_poi_get_info], tree2,0
mov edx,eax
@@:
cmp edx,0
je @f
stdcall [tl_node_poi_get_data], edx,tree2
pop esi ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
stdcall [tl_node_poi_get_data], tree2,edx
mov esi,eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
 
mov bl,byte[edx+2] ;bl - ã஢¥­ì ®¡ê¥ªâ 
mov byte[esi+u_object.lvl-u_object],bl
724,34 → 770,31
mov [esi+u_object.typid-u_object],eax
mov eax,esi
;ª®¯¨à㥬 ®¡ê¥ªâ ¢ ¯ ¬ïâì ¤«ï á®åà ­¥­¨ï
xor ecx,ecx
mov cx,word[tree2.info_size]
movzx ecx,word[tree2.info_size]
cld
rep movsb
;¢®ááâ ­ ¢«¨¢ ¥¬ ⨯ ®¡ê¥ªâ 
pop dword[eax+u_object.typid-u_object]
 
stdcall [tl_node_poi_get_next_info], edx,tree2
pop edx ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
stdcall [tl_node_poi_get_next_info], tree2,edx
mov edx,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
@@:
mov dword[edi],0 ;¬¥âª  ª®­æ  ä ©« 
add edi,4
mov ecx,edi
sub ecx,ced_info ;ecx - à §¬¥à á®å࠭塞®£® ä ©« 
 
mov eax,70
stdcall [edit_box_set_text], edit1,openfile_path
mov ecx,[open_file_size] ;ecx - à §¬¥à á®å࠭塞®£® ä ©« 
mov [run_file_70.Function], 2
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], ecx
mov [run_file_70.Buffer], ced_info
m2m [run_file_70.Buffer], [open_file_data]
mov [run_file_70.rezerv], 0
push [edit1.text]
pop [run_file_70.FileName]
mov ebx,run_file_70
int 0x40
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70
 
.end_save_file:
popad
ret
 
759,27 → 802,24
;output:
; eax - ­®¬¥à ®¡ê¥ªâ 
align 4
proc get_obj_npp, p_obj_str:dword
mov eax,2
push ebx edx
proc get_obj_npp uses ebx ecx, p_obj_str:dword
mov ecx,2
mov ebx,[p_obj_str]
 
stdcall [tl_node_poi_get_info], 0,tree2
pop edx
stdcall [tl_node_poi_get_info], tree2,0
@@:
cmp edx,0
cmp eax,0
je .no_exist
cmp edx,ebx
cmp eax,ebx
je @f
 
inc eax
stdcall [tl_node_poi_get_next_info], edx,tree2
pop edx ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
inc ecx
stdcall [tl_node_poi_get_next_info], tree2,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
.no_exist: ;ª®£¤  ¨¤¥â áá뫪  ­  ­¥ áãé¥áâ¢ãî騩 ®¡ê¥ªâ
xor eax,eax ;®¡­ã«ï¥¬ 㪠§ â¥«ì, çâ®-¡ë ­¥ á®åà ­ïâì ¢ ä ©« ¬ãá®à
xor ecx,ecx ;®¡­ã«ï¥¬ 㪠§ â¥«ì, çâ®-¡ë ­¥ á®åà ­ïâì ¢ ä ©« ¬ãá®à
@@:
pop edx ebx
mov eax,ecx
ret
endp
 
786,11 → 826,10
;äã­ªæ¨ï ¤«ï á®åà ­¥­¨ï ᮧ¤ ­­®£® asm ä ©« 
align 4
but_save_asm:
;stdcall [ted_but_save_file], tedit0,run_file_70,[edit_sav.text]
push edi
mov edi, tedit0
 
stdcall [ted_but_save_file],edi,run_file_70,[edit_sav.text]
stdcall [ted_save_file],edi,run_file_70,[edit_sav.text]
cmp ted_err_save,0
jne @f
stdcall [mb_create],msgbox_1,thread ;message: ” ©« ¡ë« á®åà ­¥­
841,8 → 880,8
jne @f
mov byte[prop_wnd_run],1
stdcall [tl_node_get_data], tree2
pop dword[foc_obj]
cmp dword[foc_obj],0
mov dword[foc_obj],eax
cmp eax,0
je @f
pushad
;¢á¥ ¤¥©áâ¢¨ï ¯® ­ áâனª¥ í«¥¬¥­â®¢ ã¯à ¢«¥­¨ï ¢ë¯®«­ïîâáï ¢ ®ª­¥ ᮠ᢮©á⢠¬¨
858,7 → 897,6
on_add_object:
push eax ebx ecx
stdcall [tl_node_get_data], tree1
pop eax
cmp eax,0
je @f
xor ecx,ecx
874,7 → 912,7
stdcall mem_clear, u_object,sizeof.object
mov ebx,dword[eax]
mov dword[u_object.id],ebx
stdcall dword[tl_node_add], u_object, ecx, tree2 ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
stdcall dword[tl_node_add], tree2,ecx,u_object ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
@@:
pop ecx ebx eax
call draw_window
1239,14 → 1277,51
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
 
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
align 4
OpenDialog_data:
.type dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
.procinfo dd procinfo ;+4
.com_area_name dd communication_area_name ;+8
.com_area dd 0 ;+12
.opendir_path dd plugin_path ;+16
.dir_default_path dd default_dir ;+20
.start_path dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
.draw_window dd draw_window ;+28
.status dd 0 ;+32
.openfile_path dd openfile_path ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
.filename_area dd filename_area ;+40
.filter_area dd Filter
.x:
.x_size dw 420 ;+48 ; Window X size
.x_start dw 10 ;+50 ; Window X position
.y:
.y_size dw 320 ;+52 ; Window y size
.y_start dw 10 ;+54 ; Window Y position
 
default_dir db '/rd/1',0
 
communication_area_name:
db 'FFFFFFFF_open_dialog',0
open_dialog_name:
db 'opendial',0
communication_area_default_path:
db '/rd/1/File managers/',0
 
Filter:
dd Filter.end - Filter ;.1
.1:
db 'CED',0
db 'ASM',0
.end:
db 0
 
 
data_of_code dd 0
sc system_colors
 
image_data dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
 
ced_info object 0 ;on start == 0
rb sizeof.object*(MAX_CED_OBJECTS-1)
 
text_buffer db BUF_SIZE dup(0)
fn_obj_opt db 'ob_o.opt',0
obj_opt ObjOpt
1395,7 → 1470,6
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
 
ted_but_save_file dd sz_ted_but_save_file
ted_but_sumb_upper dd sz_ted_but_sumb_upper
ted_but_sumb_lover dd sz_ted_but_sumb_lover
ted_can_save dd sz_ted_can_save
1409,6 → 1483,7
ted_key dd sz_ted_key
ted_mouse dd sz_ted_mouse
ted_open_file dd sz_ted_open_file
ted_save_file dd sz_ted_save_file
ted_text_add dd sz_ted_text_add
ted_but_select_word dd sz_ted_but_select_word
ted_but_cut dd sz_ted_but_cut
1461,7 → 1536,6
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
 
sz_ted_but_save_file db 'ted_but_save_file',0
sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0
sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0
sz_ted_can_save db 'ted_can_save',0
1475,6 → 1549,7
sz_ted_key db 'ted_key',0
sz_ted_mouse db 'ted_mouse',0
sz_ted_open_file db 'ted_open_file',0
sz_ted_save_file db 'ted_save_file',0
sz_ted_text_add db 'ted_text_add',0
sz_ted_but_select_word db 'ted_but_select_word',0
sz_ted_but_cut db 'ted_but_cut',0
1564,7 → 1639,6
 
 
align 16
procinfo process_information
run_file_70 FileInfoBlock
open_b rb 560
 
1571,6 → 1645,7
IncludeIGlobals
i_end:
IncludeUGlobals
procinfo process_information
buf_cmd_lin rb 1024
file_name rb 1024 ;icon file path
fp_obj_opt rb 1024 ;obj options file patch
1582,4 → 1657,7
stacktop: ;¢¢¥àåã á⥪ ®á­®¢­®© ¯à®£à ¬¬ë
sys_path rb 1024
library_path rb 1024
plugin_path rb 4096
openfile_path rb 4096
filename_area rb 256
mem: