use32
	org 0x0
	db 'MENUET01'
	dd 0x1
	dd start
	dd i_end
	dd mem
	dd stacktop
	dd buf_cmd_lin
	dd sys_path

include '../../macros.inc'
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/skincfg/trunk/kglobals.inc'
include '../../system/skincfg/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 16.11.15',0

sizeof.TreeList equ 20 ;need for element 'tree_list'

BUF_STRUCT_SIZE equ 21
buf2d_data equ dword[edi] ;¤ ­­ë¥ ¡ãä¥à  ¨§®¡à ¦¥­¨ï
buf2d_w equ dword[edi+8] ;è¨à¨­  ¡ãä¥à 
buf2d_h equ dword[edi+12] ;¢ëá®â  ¡ãä¥à 
buf2d_l equ word[edi+4] ;®âáâ㯠᫥¢ 
buf2d_t equ word[edi+6] ;®âáâ㯠ᢥàåã
buf2d_size_lt equ dword[edi+4] ;®âáâ㯠᫥¢  ¨ á¯à ¢  ¤«ï ¡ãä¥à 
buf2d_color equ dword[edi+16] ;梥â ä®­  ¡ãä¥à 
buf2d_bits equ byte[edi+20] ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥­¨ï


MAX_CED_OBJECTS equ 200
MAX_OPT_FIELDS equ 11
MAX_OBJ_TYPES equ 17 ;¬ ªá¨¬ «ì­®¥ ç¨á«® ®¡ê¥ªâ®¢
MAX_OBJ_CAPTIONS equ 1000 ;à §¬¥à ¤®¯®«­¨â¥«ì­ëå ¯®¤¯¨á¥© ¯®¤¯¨á¥©
WND_CAPT_COLOR equ 0xb0d0ff
BUF_SIZE equ 1000

;modif
BIT_MOD_ACI equ 0 ;¯¥à¢®­ ç «ì­ë¥ ­ áâனª¨ í«¥¬¥­â®¢
BIT_MOD_ACM equ 1 ;ᮡëâ¨ï ®â ¬ëè¨
BIT_MOD_ACD equ 2 ;¤ ­­ë¥ ®¡ê¥ªâ®¢
BIT_MOD_ABU equ 3 ;á¢ï§ë¢ ­¨¥ ª­®¯®ª
BIT_MOD_WI_CAPT equ 0 ;áâ¨«ì ®ª­  ¯®¤¯¨áì
BIT_MOD_WI_CORD_OTN_CL_OBL equ 1 ;áâ¨«ì ®ª­  ª®®à¤¨­ âë ®â­®á¨â¥«ì­® ª«¨¥­â᪮© ®¡« áâ¨
BIT_MOD_WI_REDR equ 2 ;áâ¨«ì ®ª­  ¯¥à¥à¨á®¢ª  ®ª­ 
BIT_MOD_WI_GRAD equ 3 ;áâ¨«ì ®ª­  £à ¤¨¥­â
BIT_MOD_CHE equ 0 ; ch_flag_en - ¢ë¡à ­ CheckBox
BIT_MOD_CHE_T equ 1 ;ᢥàåã
BIT_MOD_CHE_M equ 2 ;¯® 業âàã
BIT_MOD_CHE_B equ 3 ;á­¨§ã
BIT_MOD_TXT_ASCII_0 equ 0 ;⥪áâ § ª ­ç¨¢. 0
BIT_MOD_TXT_NO_TRAN equ 1 ;⥪á⠯஧à ç­ë©
BIT_MOD_TXT_CHAR2 equ 2 ;⥪áâ 2-¬ èà¨ä⮬
BIT_MOD_EDIT_FOC equ 0 ;EditBox ¢ 䮪ãá¥
BIT_MOD_EDIT_FIO equ 1 ;
;CPP_MOD_RE_GR equ 1 ;£à ¤¨¥­â­ë© ¯àאַ㣮«ì­¨ª
BIT_MOD_BUT_NFON equ 0 ;á⨫ì Button ­¥ à¨á®¢ âì ª­®¯ªã
BIT_MOD_BUT_NBORD equ 1 ;á⨫ì Button ­¥ à¨á®¢ âì £à ­¨æã
BIT_MOD_IMPORT_FUNCT_COMMENT equ 0 ;ª®¬¥­â¨à®¢ âì äã­ªæ¨î

macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
	;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
	if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
		jmp @f
			local .path_str
			.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
			db 0
		@@:
		;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
		copy_path .path_str,[32],file_name,0
	else
		copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
	end if

	stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
	mov [buf],eax

	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], eax
	mov byte[run_file_70+20], 0
	mov [run_file_70.FileName], file_name
	mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
	cmp ebx,0xffffffff
	je @f
		;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
		stdcall dword[img_decode], dword[buf],ebx,0
		mov dword[image_data],eax
		;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
		stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
		;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
		stdcall dword[img_destroy], dword[image_data]
	@@:
}

struct FileInfoBlock
	Function dd ?
	Position dd ?
	Flags	 dd ?
	Count	 dd ?
	Buffer	 dd ?
	rezerv	 db ?
	FileName dd ?
ends

struct object
	id dd ? ;¨¤¥­â¨ä¨ª â®à ®¡ê¥ªâ 
	txt rb MAX_LEN_OBJ_TXT ;⥪áâ®¢ë¥ á¢®©á⢠
	lvl db 0
	clo db 0
	typid dd ? ;­®¬¥à ®¡ê¥ªâ  ®¯à¥¤¥«ïî饣® ⨯ ¯¥à¥¬¥­­®©
	modif dd ? ;¡¨â®¢ë¥ ᢮©á⢠
ends

struct ObjOpt
	dd ?
	bl_type db ?
	graph db ?
	info rb 30
	caption rb MAX_OPT_CAPTION
	Col rw MAX_OPT_FIELDS
	img rw MAX_OPT_FIELDS ;¨­¤¥ªáë ª à⨭®ª (¢ ä ©«¥ 'icon.bmp')
	bit_prop dd 0 ;¡¨â®¢ë¥ ᢮©á⢠ (¯®¤¯¨á¨, ­ §¢ ­¨ï)
	bit_val dd 0 ;¡¨â®¢ë¥ ᢮©á⢠ (§­ ç¥­¨ï, ª®­áâ ­âë)
ends

SKIN_H equ 22
SKIN_W1 equ 5
SKIN_W2 equ 7
SKIN_W3 equ 23
fn_skin_1 db 'left.bmp',0
fn_skin_2 db 'base.bmp',0
fn_skin_3 db 'oper.bmp',0
IMAGE_FILE_SKIN1_SIZE equ 3*(SKIN_W1+3)*SKIN_H+54
IMAGE_FILE_SKIN2_SIZE equ 3*(SKIN_W2+3)*SKIN_H+54
IMAGE_FILE_SKIN3_SIZE equ 3*(SKIN_W3+3)*SKIN_H+54

IMAGE_FILE_FONT1_SIZE equ 96*144*3 ;à §¬¥à ä ©«  á 1-¬ á¨á⥬­ë¬ èà¨ä⮬

fn_icon db 'icon.bmp',0
count_main_icons equ 35 ;ç¨á«® ¨ª®­®ª ¢ ä ©«¥ icon.bmp
bmp_icon rb 0x300*count_main_icons

TREE_ICON_SYS16_BMP_SIZE equ 256*3*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
icon_tl_sys dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
icon_font_s1 dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì ¤«ï § £à㧪¨ èà¨äâ 

fn_syntax db 'asm.syn',0 ;¨¬ï § £à㦠¥¬®£® ä ©«  ᨭ⠪á¨á 

;¬ ªà®á ¤«ï ¯à®¢¥àª¨ ¡¨â®¢®£® ᢮©á⢠
macro test_bool_prop obj_reg,n_prop
{
	bt dword[obj_reg+u_object.modif-u_object],n_prop
}

include 'ced_wnd_m.inc'
include 'ced_wnd_prop.inc' ;ä ©« á äã­ªæ¨ï¬¨ ®ª­  ᢮©á⢠®¡ê¥ªâ 
include 'ced_constr.inc' ;ä ©« á äã­ªæ¨ï¬¨ ®ª­  ª®­áâàãªâ®à 
include 'ced_code_g.inc' ;ä ©« á äã­ªæ¨ï¬¨ £¥­¥à¨à®¢ ­¨ï ª®¤®¢

align 4
start:
	load_libraries l_libs_start,load_lib_end

	;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
	mov	ebp,lib0
	cmp	dword [ebp+ll_struc_size-4],0
	jz	@f
		mcall -1 ;exit not correct
	@@:
	mov	ebp,lib1
	cmp	dword [ebp+ll_struc_size-4],0
	jz	@f
		mcall -1 ;exit not correct
	@@:
	mov	ebp,lib2
	cmp	dword [ebp+ll_struc_size-4],0
	jz	@f
		mcall -1 ;exit not correct
	@@:
	mov	ebp,lib3
	cmp	dword [ebp+ll_struc_size-4],0
	jz	@f
		mcall -1 ;exit not correct
	@@:

	;§ ¤ ­¨¥ à §¬¥à®¢ ¯®«¥© ᮠ᢮©á⢠¬¨
	mov eax,prop_edits_top
	mov ebx,16+6 ;è¨à¨­  ¨ª®­ª¨ + ®âáâã¯ë
	mov edi,edit2
	@@:
		mov ed_top,eax ;®âáâ㯠ᢥàåã
		mov ed_left,ebx ;®âáâ㯠᫥¢ 
		add edi,ed_struc_size
		add eax,prop_edits_height
		cmp edi,prop_wnd_edits_end
		jl @b

	stdcall [buf2d_create], buf_fon

	mcall 48,3,sc,sizeof.system_colors
	mcall 40,0x27

	stdcall dword[tl_data_init], tree1
	stdcall dword[tl_data_init], tree2

	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
	mov [run_file_70.Count], 0x300*count_main_icons
	mov [run_file_70.Buffer], bmp_icon
	mov [run_file_70.rezerv], 0
	mov [run_file_70.FileName], file_name
	mcall 70,run_file_70

	cmp ebx,-1
	mov [err_ini0],1
	je @f ;if open file
		mov [err_ini0],0
		mov dword[tree1.data_img],bmp_icon
		mov dword[tree2.data_img],bmp_icon
	@@:

	;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
	load_image_file 'tl_sys_16.png', icon_tl_sys,TREE_ICON_SYS16_BMP_SIZE
	;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
	;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
	mov eax,dword[icon_tl_sys]
	mov dword[tree1.data_img_sys],eax
	mov dword[tree2.data_img_sys],eax

	;1-© ä ©« ᪨­ 
	load_image_file fn_skin_1, icon_font_s1,IMAGE_FILE_SKIN1_SIZE
	stdcall [buf2d_create_f_img], buf_skin1,[icon_font_s1] ;ᮧ¤ ¥¬ ¡ãä¥à
	stdcall mem.Free,[icon_font_s1] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
	;2-© ä ©« ᪨­ 
	load_image_file fn_skin_2, icon_font_s1,IMAGE_FILE_SKIN2_SIZE
	stdcall [buf2d_create_f_img], buf_skin2,[icon_font_s1] ;ᮧ¤ ¥¬ ¡ãä¥à
	stdcall mem.Free,[icon_font_s1] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
	;3-© ä ©« ᪨­ 
	load_image_file fn_skin_3, icon_font_s1,IMAGE_FILE_SKIN3_SIZE
	stdcall [buf2d_create_f_img], buf_skin3,[icon_font_s1] ;ᮧ¤ ¥¬ ¡ãä¥à
	stdcall mem.Free,[icon_font_s1] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì

	;ᨬ¢®«ë 1-£® á¨á⥬­®£® èà¨äâ 
	load_image_file 'font6x9.bmp', icon_font_s1,IMAGE_FILE_FONT1_SIZE
	stdcall [buf2d_create_f_img], buf_font,[icon_font_s1] ;ᮧ¤ ¥¬ ¡ãä¥à
	stdcall mem.Free,[icon_font_s1] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
	stdcall [buf2d_conv_24_to_8], buf_font,1 ;¤¥« ¥¬ ¡ãä¥à ¯à®§à ç­®á⨠8 ¡¨â
	stdcall [buf2d_convert_text_matrix], buf_font


	copy_path fn_obj_opt,sys_path,fp_obj_opt,0
	;load options file
	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
	mcall 70,run_file_70

	cmp ebx,-1
	mov [err_ini1],1
	je .open_end ;jmp if not open file
		mov [err_ini1],0

		mov eax,obj_opt ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâë
		@@:
			mov ebx,dword[eax]
			cmp ebx,0
			je @f
			;xor ecx,ecx ;¢ ecx ¡ã¤¥â ¨­¤¥ªá ¨ª®­ª¨
			mov cx,word[eax+obj_opt.img-obj_opt]
			cmp cx,0
			jge .zero
				xor cx,cx ;çâ®-¡ë ­¥ £«î稫® á ®âà¨æ â¥«ì­ë¬ ¨­¤¥ªá®¬
			.zero:
			shl ecx,16
			stdcall dword[tl_node_add], tree1,ecx,eax ;¤®¡ ¢«ï¥¬ ­ §¢ ­¨¥ ®¡ê¥ªâ 
			stdcall dword[tl_cur_next], tree1 ;¯¥à¥­®á¨¬ ªãàá®à ¢­¨§, çâ®-¡ë ­¥ ¯®¬¥­ï«áï ¯®à冷ª
			add eax,sizeof.ObjOpt ;¯¥à¥å®¤ ­  á«¥¤ãî騩 ®¡ê¥ªâ
			jmp @b
		@@:
		stdcall dword[tl_cur_beg], tree1 ;¯¥à¥­®á¨¬ ªãàá®à ¢¢¥àå

	.open_end:

	stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
	stdcall [ted_init], tedit0
	copy_path fn_syntax,sys_path,file_name,0

	; *** init syntax file ***
	; ¯à®¢¥à塞 à §¬¥à ä ©«  ᨭ⠪á¨á 
	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], file_name
	mcall 70,run_file_70
	cmp eax,0
	jne @f

	mov edi,tedit0
	mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
	mov ted_syntax_file_size,ecx

	stdcall mem.Alloc,ecx ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ä ©«  ᨭ⠪á¨á 
	mov ted_syntax_file,eax

	;¯à®¡ã¥¬ ®âªàëâì ä ©« ᨭ⠪á¨á 
	call open_unpac_synt_file
	jmp .end_0
	@@:
		notify_window_run txt_not_syntax_file
	.end_0:

	;get cmd line
	cmp [buf_cmd_lin],0
	je @f ;if file names exist
		mov esi,buf_cmd_lin
		call strlen ;eax=strlen
		mov edi,[edit1.text]
		mov [edit1.size],eax
		mov ecx,eax
		rep movsb
		call but_open_proj
	@@:



align 4
red_win:
	call draw_window

align 4
still:
	mcall 10

	cmp al,1
	jne @f
		call draw_window
	@@:
	cmp al,2
	jz key
	cmp al,3
	jz button
	cmp al,6
	jne @f 
		call mouse
	@@:

	jmp still

align 4
draw_window:
pushad
	mcall 12,1

	xor eax,eax
	mov ebx,20*65536+670
	mov ecx,20*65536+370
	mov edx,[sc.work]
	or  edx,0x33000000
	mov edi,hed
	int 0x40

	mov eax,8 ;button 'Open Project'
	mov esi,0x80ff
	mov ebx,230*65536+18
	mov ecx,5*65536+18
	mov edx,5
	int 0x40
	stdcall draw_icon, 22,231,6 ;22 - open

	;button 'Save Project'
	mov ebx,250*65536+18
	mov ecx,5*65536+18
	mov edx,6
	int 0x40
	stdcall draw_icon, 17,251,6 ;17 - save

	;button 'Show Constructor'
	mov ebx,310*65536+18
	mov ecx,5*65536+18
	mov edx,11
	int 0x40
	stdcall draw_icon, 12,311,6 ;12 - window

	;button 'Show Code'
	mov ebx,330*65536+18
	mov edx,12
	int 0x40
	stdcall draw_icon, 11,331,6 ;11 - text

	;button 'Update: Code, Constructor'
	mov ebx,350*65536+18
	mov edx,13
	int 0x40
	stdcall draw_icon, 32,351,6 ;32 - update

	;button 'Save Code'
	mov ebx,370*65536+18
	mov edx,14
	int 0x40
	stdcall draw_icon, 17,371,6 ;17 - save

	;button ']P'
	mov ebx,390*65536+18
	mov edx,15
	int 0x40
	stdcall draw_icon, 18,391,6 ;18 - §­ ª ª®­æ   ¡§ æ 

	;button 'Show color text'
	mov ebx,410*65536+18
	mov edx,16
	int 0x40
	stdcall draw_icon, 19,411,6

	;button 'Add Object'
	mov ebx,125*65536+18
	mov ecx,30*65536+18
	mov edx,31
	int 0x40
	stdcall draw_icon, 14,126,31 ;14 - add object

	;button 'Move Up'
	mov ebx,155*65536+18
	mov edx,21
	int 0x40
	stdcall draw_icon, 23,156,31 ;23 - move up

	;button 'Move Down'
	mov ebx,175*65536+18
	mov edx,22
	int 0x40
	stdcall draw_icon, 24,176,31 ;24 - move down

	;button 'Copy'
	mov ebx,195*65536+18
	mov edx,23
	int 0x40
	stdcall draw_icon, 30,196,31 ;30 - copy

	;button 'Paste'
	mov ebx,215*65536+18
	mov edx,24
	int 0x40
	stdcall draw_icon, 31,216,31 ;31 - paste

	;button 'Property'
	mov ebx,235*65536+18
	mov edx,25
	int 0x40
	stdcall draw_icon, 7,236,31 ;7 - property

	;button 'Undo'
	mov ebx,255*65536+18
	mov edx,26
	int 0x40
	stdcall draw_icon, 33,256,31 ;33 - undo

	;button 'Redo'
	mov ebx,275*65536+18
	mov edx,27
	int 0x40
	stdcall draw_icon, 34,276,31 ;34 - redo

; 10 30 50 70 90

	cmp [err_opn],1
	jne @f
		mcall 4,10*65536+35,0x80ff0000,txtErrOpen
	@@:

	stdcall [edit_box_draw], dword edit1
	stdcall [edit_box_draw], dword edit_sav

	mov dword[w_scr_t1.all_redraw],1
	;stdcall [scrollbar_ver_draw],dword w_scr_t1
	stdcall [tl_draw],dword tree1
	mov dword[w_scr_t2.all_redraw],1
	;stdcall [scrollbar_ver_draw],dword w_scr_t2
	stdcall [tl_draw],dword tree2

	cmp byte[show_mode],0 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠®ª­  ª®­áâàãªâ®à 
	jne @f
		stdcall [buf2d_draw], buf_fon
	@@:
	cmp byte[show_mode],1 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠⥪á⮢®£® ®ª­ 
	jne @f
		stdcall [ted_draw], tedit0
	@@:
	mcall 12,2
popad
	ret

align 4
mouse:
	stdcall [edit_box_mouse], dword edit1
	stdcall [edit_box_mouse], dword edit_sav
	stdcall [tl_mouse], dword tree1
	stdcall [tl_mouse], dword tree2
	cmp byte[show_mode],1 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠⥪á⮢®£® ®ª­ 
	jne @f
		stdcall [ted_mouse], tedit0
	@@:
	ret


align 4
key:
	mcall 2
	stdcall [edit_box_key], dword edit1
	stdcall [edit_box_key], dword edit_sav
	stdcall [tl_key], dword tree1
	stdcall [tl_key], dword tree2

	jmp still

align 4
button:
	mcall 17
	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
		;call but_element_change
	;@@:
	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
.exit:
	stdcall mem.Free,[icon_tl_sys]
	mov dword[tree1.data_img],0
	mov dword[tree2.data_img],0
	mov dword[tree1.data_img_sys],0
	mov dword[tree2.data_img_sys],0
	stdcall dword[tl_data_clear], tree1
	stdcall dword[tl_data_clear], tree2
	stdcall [buf2d_delete],buf_fon ;㤠«ï¥¬ ¡ãä¥à
	stdcall [buf2d_delete],buf_font ;㤠«ï¥¬ ¡ãä¥à  
	stdcall [buf2d_delete],buf_skin1
	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
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 [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 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 [err_opn],0
		stdcall [edit_box_set_text], edit1,openfile_path

		stdcall dword[tl_info_clear], tree2
		mov eax,[open_file_data] ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâë
		@@:
			mov ebx,dword[eax]
			cmp ebx,0
			je @f

			call find_obj_in_opt ;edi = pointer to ObjOpt struct

			mov cx,word[edi+obj_opt.img-obj_opt]
			cmp cx,0
			jge .zero
				xor cx,cx ;çâ®-¡ë ­¥ £«î稫® á ®âà¨æ â¥«ì­ë¬ ¨­¤¥ªá®¬
			.zero:
			shl ecx,16 ;¢ ecx ¨­¤¥ªá ¨ª®­ª¨
			mov cl,byte[eax+u_object.lvl-u_object] ;ã஢¥­ì ®¡ê¥ªâ 

			;tl_node_close_open - ­¥ ¯®¤å®¤¨â, â.ª. ¤¥©áâ¢ã¥â ­  ã§«ë ¨¬¥î騥 ¤®ç¥à­¨¥
			mov ch,byte[eax+u_object.clo-u_object] ;§ ªàëâë©/®âªàëâë©

			stdcall dword[tl_node_add], tree2,ecx,eax ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ

			stdcall dword[tl_cur_next], tree2 ;¯¥à¥­®á¨¬ ªãàá®à ¢­¨§, çâ®-¡ë ­¥ ¯®¬¥­ï«áï ¯®à冷ª
			add eax,sizeof.object ;¯¥à¥å®¤ ­  á«¥¤ãî騩 ®¡ê¥ªâ
			jmp @b
		@@:
		stdcall dword[tl_cur_beg], tree2 ;¯¥à¥­®á¨¬ ªãàá®à ¢¢¥àå

		mov [foc_obj],0
		call draw_constructor
		call code_gen
	.open_end:
	call draw_window ;¯¥à¥à¨á®¢ª  ®ª­  ¨¤¥â ¢ «î¡®¬ á«ãç ¥, ¤ ¦¥ ¥á«¨ ä ©« ­¥ ®âªàë«áï
	popad
	ret

;á®åà ­¥­¨¥ ä ©«  ¯à®íªâ  ­  ¤¨áª
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
	;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 

	;¡¥à¥¬ à §¬¥à ¯ ¬ïâ¨, ­¥®¡å®¤¨¬®© ¤«ï á®åà ­¥­¨ï ä ©« 
	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

	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], tree2,edx
		mov esi,eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 

		mov bl,byte[edx+2] ;bl - ã஢¥­ì ®¡ê¥ªâ 
		mov byte[esi+u_object.lvl-u_object],bl
		mov bl,byte[edx+3] ;bl - ®âªàë⨥/§ ªàë⨥ ®¡ê¥ªâ 
		mov byte[esi+u_object.clo-u_object],bl

		;¢ëç¨á«ï¥¬ ­®¢ë© ¨­¤¥ªá ¤«ï ⨯  ®¡ê¥ªâ 
		mov ebx,[esi+u_object.typid-u_object] ;ebx - ⨯ ®¡ê¥ªâ 
		;á®å࠭塞 ⨯ ®¡ê¥ªâ 
		push ebx
			imul ebx,sizeof.TreeList
			add ebx,[tree2.data_nodes] ;ebx - 㪠§ â¥«ì ®¡ê¥ªâ 㪠§ë¢ î騩 ⨯
			stdcall get_obj_npp,ebx
			mov [esi+u_object.typid-u_object],eax
			mov eax,esi
			;ª®¯¨à㥬 ®¡ê¥ªâ ¢ ¯ ¬ïâì ¤«ï á®åà ­¥­¨ï
			movzx ecx,word[tree2.info_size]
			cld
			rep movsb
		;¢®ááâ ­ ¢«¨¢ ¥¬ ⨯ ®¡ê¥ªâ 
		pop dword[eax+u_object.typid-u_object]

		stdcall [tl_node_poi_get_next_info], tree2,edx
		mov edx,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
		jmp @b
	@@:
	mov dword[edi],0 ;¬¥âª  ª®­æ  ä ©« 
	add edi,4

	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
	m2m [run_file_70.Buffer], [open_file_data]
	mov [run_file_70.rezerv], 0
	mov dword[run_file_70.FileName], openfile_path
	mcall 70,run_file_70

	.end_save_file:
	popad
	ret

;¡¥à¥â ­®¬¥à ¯® ¯®à浪㠯® 㪠§ â¥«î ­  áâàãªâãàã ®¡ê¥ªâ 
;output:
; eax - ­®¬¥à ®¡ê¥ªâ 
align 4
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], tree2,0
	@@:
		cmp eax,0
		je .no_exist
		cmp eax,ebx
		je @f

		inc ecx
		stdcall [tl_node_poi_get_next_info], tree2,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
		jmp @b
	.no_exist: ;ª®£¤  ¨¤¥â áá뫪  ­  ­¥ áãé¥áâ¢ãî騩 ®¡ê¥ªâ
		xor ecx,ecx ;®¡­ã«ï¥¬ 㪠§ â¥«ì, çâ®-¡ë ­¥ á®åà ­ïâì ¢ ä ©« ¬ãá®à
	@@:
	mov eax,ecx
	ret
endp

;äã­ªæ¨ï ¤«ï á®åà ­¥­¨ï ᮧ¤ ­­®£® asm ä ©« 
align 4
but_save_asm:
	push edi
	mov edi, tedit0

	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: ” ©« ¡ë« á®åà ­¥­
	@@:
	pop edi
	ret

;äã­ªæ¨ï ¤«ï ¯®ª § /áªàëâ¨ï ­¥¢¨¤¨¬ëå ᨬ¢®«®¢
align 4
but_show_invis:
	push edi
	mov edi,tedit0

	xor ted_mode_invis,1
	cmp byte[show_mode],1 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠⥪á⮢®£® ®ª­ 
	jne @f
		stdcall [ted_draw],edi
	@@:
	pop edi
	ret

;
align 4
but_show_syntax:
	push edi
	mov edi,tedit0

	xor ted_mode_color,1
	cmp byte[show_mode],1 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠⥪á⮢®£® ®ª­ 
	jne @f
		stdcall [ted_draw],edi
	@@:
	pop edi
	ret

align 4
ted_save_err_msg:
	mov byte[msgbox_0.err],al
	stdcall [mb_create],msgbox_0,thread ;message: Can-t save text file!
	ret

;äã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ­ ¦ â¨¨ Enter ¢ ®ª­¥ tree2
;®¡­®¢«ï¥â ⥪áâ®¢ë¥ ¯®«ï §­ ç¥­¨ï¬¨ ¯ à ¬¥â஢ ¢§ïâëå ¨§ ®¡ê¥ªâ®¢
;äã­ªæ¨ï ®¡à â­ ï ª ¤ ­­®© but_element_change
align 4
on_file_object_select:
	cmp byte[prop_wnd_run],0
	jne @f
		mov byte[prop_wnd_run],1
		stdcall [tl_node_get_data], tree2
		mov dword[foc_obj],eax
		cmp eax,0
		je @f
			pushad
			;¢á¥ ¤¥©áâ¢¨ï ¯® ­ áâனª¥ í«¥¬¥­â®¢ ã¯à ¢«¥­¨ï ¢ë¯®«­ïîâáï ¢ ®ª­¥ ᮠ᢮©á⢠¬¨
			mcall 51,1,prop_start,prop_thread
			popad
	@@:
	;call draw_window
	ret

;äã­ªæ¨ï ¢ë§ë¢ ¥¬ ï ¯à¨ ­ ¦ â¨¨ Enter ¢ ®ª­¥ tree1
;¤®¡ ¢«ï¥â ­®¢ë© ®¡ê¥ªâ ¢ ®ª­® tree2
align 4
on_add_object:
push eax ebx ecx
	stdcall [tl_node_get_data], tree1
	cmp eax,0
	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]
		mov dword[u_object.id],ebx
		stdcall dword[tl_node_add], tree2,ecx,u_object ;¤®¡ ¢«ï¥¬ ®¡ê¥ªâ
	@@:
pop ecx ebx eax
	call draw_window
	ret

align 4
but_ctrl_o:
	ret
align 4
but_ctrl_n:
	ret
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 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
	dw 310 ;+4 left
	dw 50 ;+6 top
	dd 340 ;+8 w
	dd 280 ;+12 h
	dd 0xffffff ;+16 color
	db 24 ;+20 bit in pixel

align 4
buf_font: ;¡ãä¥à ¬ âà¨æë á® èà¨ä⮬
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
	dw 25 ;+4 left
	dw 25 ;+6 top
	dd 96 ;+8 w
	dd 144 ;+12 h
	dd 0 ;+16 color
	db 24 ;+20 bit in pixel

align 4
buf_skin1:
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
	dw 0 ;+4 left
	dw 0 ;+6 top
	dd SKIN_W1 ;+8 w
	dd SKIN_H ;+12 h
	dd 0 ;+16 color
	db 24 ;+20 bit in pixel
align 4
buf_skin2:
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
	dw 0 ;+4 left
	dw 0 ;+6 top
	dd SKIN_W2 ;+8 w
	dd SKIN_H ;+12 h
	dd 0 ;+16 color
	db 24 ;+20 bit in pixel
align 4
buf_skin3:
	dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
	dw 0 ;+4 left
	dw 0 ;+6 top
	dd SKIN_W3 ;+8 w
	dd SKIN_H ;+12 h
	dd 0 ;+16 color
	db 24 ;+20 bit in pixel

show_mode db 0 ;०¨¬ ¤«ï ¯®ª §  ®¯à¥¤¥«¥­­®£® ®ª­ 
txtErrOpen db '¥ ­ ©¤¥­ ä ©«, ¯à®¢¥àì⥠¯à ¢¨«ì­®áâì ¨¬¥­¨',0
txtErrIni1 db '¥ ®âªàë«áï ä ©« á ®¯æ¨ï¬¨',0
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

edit2 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text2, mouse_dd, 0
edit3 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text3, mouse_dd, 0
edit4 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text4, mouse_dd, 0
edit5 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text5, mouse_dd, 0
edit6 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text6, mouse_dd, 0
edit7 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text7, mouse_dd, 0
edit8 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text8, mouse_dd, 0
edit9 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text9, mouse_dd, 0
edit10 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text10, mouse_dd, 0
edit11 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text11, mouse_dd, 0
edit12 edit_box 115, 32, 20, 0xffffff, 0x80ff, 0xff, 0x808080, 0, MAX_LEN_OBJ_TXT, ed_text12, mouse_dd, 0
prop_wnd_edits_end: ;ª®­¥æ ⥪á⮢ëå ¯®«¥©, ®â¢¥ç îé¨å §  ᢮©á⢠

edit_sav edit_box 210, 310, 30, 0xffffff, 0xff80, 0xff, 0xff0000, 0x4080, 300, ed_text_sav, mouse_dd, 0


ed_text1 db '/hd0/1/',0
	rb 295
ed_text2 rb MAX_LEN_OBJ_TXT+2
ed_text3 rb MAX_LEN_OBJ_TXT+2
ed_text4 rb MAX_LEN_OBJ_TXT+2
ed_text5 rb MAX_LEN_OBJ_TXT+2
ed_text6 rb MAX_LEN_OBJ_TXT+2
ed_text7 rb MAX_LEN_OBJ_TXT+2
ed_text8 rb MAX_LEN_OBJ_TXT+2
ed_text9 rb MAX_LEN_OBJ_TXT+2
ed_text10 rb MAX_LEN_OBJ_TXT+2
ed_text11 rb MAX_LEN_OBJ_TXT+2
ed_text12 rb MAX_LEN_OBJ_TXT+2
ed_text_sav rb 302

txt_null db 'null',0
mouse_dd dd ?

el_focus dd tree1
;¤¥à¥¢® ᮠᯨ᪮¬ ¢®§¬®¦­ëå ⨯®¢ ®¡ê¥ªâ®¢
tree1 tree_list sizeof.ObjOpt,20+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\
	16,16, 0xffffff,0xb0d0ff,0xd000ff, 5,50,125,280, 0,obj_opt.info-obj_opt,0, el_focus,\
	w_scr_t1,on_add_object
;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥
tree2 tree_list sizeof.object,MAX_CED_OBJECTS+2, tl_draw_par_line,\
	16,16, 0xffffff,0xb0d0ff,0xd000ff, 155,50,130,280, 13,u_object.txt-u_object,MAX_LEN_OBJ_TXT, el_focus,\
	w_scr_t2,on_file_object_select

msgbox_0:
  db 1,0
  db 'Warning',0
  db 'Error saving file!',13,\
     'Maybe the file name is not entered correctly.',13,\
     '  (error code ='
  .err: db '?'
  db ')',0
  db 'Close',0
  db 0

msgbox_1:
	db 1,0
	db ':)',0
	db 'File was saved',0
	db 'Ok',0
	db 0

struct TexSelect
	x0 dd ?
	y0 dd ?
	x1 dd ?
	y1 dd ?
ends
;------------------------------------------------------------------------------
align 4
tedit0: ;áâàãªâãà  â¥ªá⮢®£® । ªâ®à 
	.wnd BOX 310,50,325,260 ;+ 0
	.rec BOX 30,13,7,10   ;+16
	.drag_m db 0 ;+32 ¢ë¤¥«¥­¨¥ ®â ¬ëè¨
	.drag_k db 0 ;+33 ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
	.sel  TexSelect 0,0,0,0 ;+34 áâàãªâãà  ¢ë¤¥«¥­¨ï
	.seln TexSelect ;+50 ¤®¯®«­¨â¥«ì­ ï áâàãªâãà  ¢ë¤¥«¥­¨ï
	.tex	  dd 0 ;+66 text memory pointer
	.tex_1	  dd 0 ;+70 text first symbol pointer
	.tex_end  dd 0 ;+74 text end memory pointer
	.cur_x	  dd 0 ;+78 ª®®à¤¨­ â  x ªãàá®à 
	.cur_y	  dd 0 ;+82 ª®®à¤¨­ â  y ªãàá®à 
	.max_chars dd 25002 ;+86 ¬ ªá¨¬ «ì­®¥ ç¨á«® ᨬ¢®«®¢ ¢ ®¤­®¬ ¤®ªã¬¥­â¥
	.count_colors_text dd 1 ;+90 ª®««¨ç¥á⢮ 梥⮢ ⥪áâ 
	.count_key_words   dd 0 ;+94 ª®««¨ç¥á⢮ ª«î祢ëå á«®¢
	.color_cursor	   dd 0xff0000 ;+98 梥⠪ãàá®à 
	.color_wnd_capt    dd 0x0080c0 ;+102 梥⠯®«¥© ¢®ªà㣠®ª­ 
	.color_wnd_work    dd	   0x0 ;+106 梥â ä®­  ®ª­ 
	.color_wnd_bord    dd 0xffffff ;+110 梥â ⥪áâ  ­  ¯®«ïå
	.color_select	   dd 0x0000ff ;+114 梥⠢뤥«¥­¨ï
	.color_cur_text    dd 0xffff00 ;+118 梥â ᨬ¢®«  ¯®¤ ªãàá®à®¬
	.color_wnd_text    dd 0x80ffff ;+122 梥â ⥪áâ  ¢ ®ª­¥
	.syntax_file	   dd 0 ;+126 㪠§ â¥«ì ­  ­ ç «® ä ©«  ᨭ⠪á¨á 
	.syntax_file_size  dd 55*1024 ;+130 ¬ ªá¨¬ «ì­ë© à §¬¥à ä ©«  ᨭ⠪á¨á 
	.text_colors	   dd 0 ;+134 㪠§ â¥«ì ­  ¬ áᨢ 梥⮢ ⥪áâ 
	.help_text_f1	   dd 0 ;+138 㪠§ â¥«ì ­  ⥪áâ á¯à ¢ª¨ (¯® ­ ¦ â¨¨ F1)
	.help_id	   dd -1 ;+142 ¨¤¥­â¨ä¨ª â®à ¤«ï á¯à ¢ª¨
	.key_words_data    dd 0 ;+146 㪠§ â¥«ì ­  áâàãªâãàë ª«î祢ëå á«®¢ TexColViv
	.tim_ch      dd ? ;+150 ª®«¨ç¥á⢮ ¨§¬¥­¥­¨© ¢ ä ©«¥
	.tim_undo    dd ? ;+154 ª®«¨ç¥á⢮ ®â¬¥­¥­­ëå ¤¥©á⢨©
	.tim_ls      dd ? ;+158 ¢à¥¬ï ¯®á«¥¤­¥£® á®åà ­¥­¨ï
	.tim_co      dd ? ;+162 ¢à¥¬ï ¯®á«¥¤­¥© 梥⮢®© à §¬¥âª¨
	.el_focus    dd el_focus ;+166 㪠§ â¥«ì ­  ¯¥à¥¬¥­­ãî í«¥¬¥­â  ¢ 䮪ãá¥
	.err_save    db 0 ;+170 ®è¨¡ª  á®åà ­¥­¨ï ä ©« 
	.panel_id    db 0 ;+171 ­®¬¥à ®âªàë⮩ ¯ ­¥«¨
	.key_new     db 0 ;+172 ᨬ¢®«, ª®â®àë© ¡ã¤¥â ¤®¡ ¢«ïâáï á ª« ¢¨ âãàë
	.symbol_new_line db 20 ;+173 ᨬ¢®« § ¢¥à襭¨ï áâப¨
	.scr_w	     dd scrol_w1 ;+174 ¢¥à⨪ «ì­ë© áªà®««¨­£
	.scr_h	     dd scrol_h1 ;+178 £®à¨§®­â «ì­ë© áªà®««¨­£
	.arr_key_pos dd 0 ;+182 㪠§ â¥«ì ­  ¬ áᨢ ¯®§¨æ¨© ª«î祢ëå á«®¢
	.buffer      dd text_buffer ;+186 㪠§ â¥«ì ­  ¡ãä¥à ª®¯¨à®¢ ­¨ï/¢áâ ¢ª¨
	.buffer_find dd 0 ;+190 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï ¯®¨áª 
	.cur_ins     db 1 ;+194 ०¨¬ à ¡®âë ªãàá®à  (®¡ëç­ë© ¨«¨ § ¬¥­ )
	.mode_color  db 1 ;+195 ०¨¬ ¢ë¤¥«¥­¨ï á«®¢ 梥⮬ (0-¢ëª«. 1-¢ª«.)
	.mode_invis  db 0 ;+196 ०¨¬ ¯®ª §  ­¥¯¥ç â ¥¬ëå ᨬ¢®«®¢
	.gp_opt      db 0 ;+197 ®¯æ¨¨ ¢®§¢à é ¥¬ë¥ ä㭪樥© ted_get_pos_by_cursor
	.fun_on_key_ctrl_o dd but_ctrl_o ;+198 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¯à¨ ­ ¦ â¨¨ Ctrl+O (®âªàë⨥ ä ©« )
	.fun_on_key_ctrl_f dd 0 ;+202 ... Ctrl+F (¢ë§®¢ /áªàëâ¨ï ¯ ­¥«¨ ¯®¨áª )
	.fun_on_key_ctrl_n dd but_ctrl_n ;+206 ... Ctrl+N (ᮧ¤ ­¨¥ ­®¢®£® ¤®ªã¬¥­â )
	.fun_on_key_ctrl_s dd 0 ;+210 ... Ctrl+S
	.buffer_size	   dd BUF_SIZE ;+214 à §¬¥à ¡ãä¥à  ª®¯¨à®¢ ­¨ï/¢áâ ¢ª¨
	.fun_find_err	   dd 0 ;+218 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ ¯®¨áª § ª®­ç¨«áï ­¥ã¤ ç­®
	.fun_init_synt_err dd 0 ;+222 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¯à¨ ®è¨¡®ç­®¬ ®âªàë⨨ ä ©«  ᨭ⠪á¨á 
	.fun_draw_panel_buttons dd 0 ;+226 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ á ª­®¯ª ¬¨
	.fun_draw_panel_find	dd 0 ;+230 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ ¯®¨áª 
	.fun_draw_panel_syntax	dd 0 ;+234 㪠§ â¥«ì ­  äã­ªæ¨î à¨á®¢ ­¨ï ¯ ­¥«¨ ᨭ⠪á¨á 
	.fun_save_err		dd ted_save_err_msg ;+238 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ á®åà ­¥­¨¥ ä ©«  § ª®­ç¨«®áì ­¥ã¤ ç­®
	.increase_size dd 1000 ;+242 ç¨á«® ᨬ¢®«®¢ ­  ª®â®àë¥ ¡ã¤¥â 㢥稢 âìáï ¯ ¬ïâì ¯à¨ ­¥å¢ âª¥
	.ptr_free_symb dd ? ;+246 㪠§ â¥«ì ­  ᢮¡®¤­ãî ¯ ¬ïâì, ¢ ª®â®àãî ¬®¦­® ¤®¡ ¢«ïâì ᨬ¢®« (¨á¯®«ì§ã¥âáï ¢­ãâà¨ í«¥¬¥­â  ¤«ï ã᪮७¨ï ¢áâ ¢ª¨ ⥪áâ )
;------------------------------------------------------------------------------
align 4
scrol_w1:
.x:
.size_x   dw 16 ;+0
.start_x  dw 85 ;+2
.y:
.size_y   dw 100 ; +4
.start_y  dw  15 ; +6
.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 0x808080 ;+36
.redraw   dd   0 ;+40
.delta	  dw   0 ;+44
.delta2   dw   0 ;+46
.run_x:
rb 32
.all_redraw dd 0 ;+80
.ar_offset  dd 1 ;+84
;---------------------------------------------------------------------
align 4
scrol_h1:
.x:
.size_x     dw 85 ;+0
.start_x    dw 30 ;+2
.y:
.size_y     dw 16 ;+4
.start_y    dw 100 ;+6
.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 0x808080 ;+36
.redraw     dd 0  ;+40
.delta	    dw 0  ;+44
.delta2     dw 0  ;+46
.run_x:
rb 32
.all_redraw dd 0 ;+80
.ar_offset  dd 1 ;+84



align 4
w_scr_t1:
.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 32
.all_redraw dd 0 ;+80
.ar_offset  dd 1 ;+84

align 4
w_scr_t2:
.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 32
.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

text_buffer db BUF_SIZE dup(0)
fn_obj_opt db 'ob_o.opt',0
obj_opt ObjOpt
	rb sizeof.ObjOpt*(MAX_OBJ_TYPES-1)+MAX_OBJ_CAPTIONS
	db 0 ;eof options

cur_x dd 0
cur_y dd 0
foc_obj dd 0 ;®¡ê¥ªâ ¢ 䮪ãá¥
obj_count_txt_props dd 0 ;ª®«¨ç¥á⢮ ¨á¯®«ì§ã¥¬ëå ⥪á⮢ëå ᢮©áâ¢
obj_m_win dd 0 ;áâàãªâãà  £« ¢­®£® ®ª­ 

;
if 1 ;lang eq ru

	err_message_found_lib0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  box_lib.obj',0  ;áâப , ª®â®à ï ¡ã¤¥â ¢ áä®à¬¨à®¢ ­­®¬ ®ª­¥, ¥á«¨ ¡¨¡«¨®â¥ª  ­¥ ¡ã¤¥â ­ ©¤¥­ 
	err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
	err_message_found_lib1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  proc_lib.obj',0
	err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ proc_lib.obj',0
	err_message_found_lib2 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã buf2d.obj',0
	err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ buf2d.obj',0
	err_message_found_lib3 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
	err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
	err_message_found_lib4 db '¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã msgbox.obj',0
	err_message_import4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ msgbox.obj',0

	head_f_i:
	head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
else

	err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0
	err_message_import0 db 'Error on load import library box_lib.obj',0
	err_message_found_lib1 db 'Sorry I cannot found library proc_lib.obj',0
	err_message_import1 db 'Error on load import library proc_lib.obj',0
	err_message_found_lib2 db 'Sorry I cannot found library buf2d.obj',0
	err_message_import2 db 'Error on load import library buf2d.obj',0
	err_message_found_lib3 db 'Sorry I cannot found library libimg.obj',0
	err_message_import3 db 'Error on load import library libimg.obj',0
	err_message_found_lib4 db 'Sorry I cannot found library msgbox.obj',0
	err_message_import4 db 'Error on load import library msgbox.obj',0

	head_f_i:
	head_f_l db 'System error',0 ;§ £®«®¢®ª ®ª­ , ¯à¨ ¢®§­¨ª­®¢¥­¨¨ ®è¨¡ª¨
end if

	system_dir0 db '/sys/lib/'
	lib0_name db 'box_lib.obj',0

	system_dir1 db '/sys/lib/'
	lib1_name db 'proc_lib.obj',0

	system_dir2 db '/sys/lib/'
	lib2_name db 'buf2d.obj',0

	system_dir3 db '/sys/lib/'
	lib3_name db 'libimg.obj',0

	system_dir4 db '/sys/lib/'
	lib4_name db 'msgbox.obj',0

align 4
import_buf2d_lib:
	dd sz_lib_init
	buf2d_create dd sz_buf2d_create
	buf2d_create_f_img dd sz_buf2d_create_f_img
	buf2d_clear dd sz_buf2d_clear
	buf2d_draw dd sz_buf2d_draw
	buf2d_delete dd sz_buf2d_delete
	buf2d_line dd sz_buf2d_line
	buf2d_rect_by_size dd sz_buf2d_rect_by_size
	buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
	;buf2d_circle dd sz_buf2d_circle
	buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
	buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
	buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
	buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
	buf2d_bit_blt dd sz_buf2d_bit_blt
	buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
	buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
	;buf2d_curve_bezier dd sz_buf2d_curve_bezier
	buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
	buf2d_draw_text dd sz_buf2d_draw_text
	;buf2d_crop_color dd sz_buf2d_crop_color
	buf2d_offset_h dd sz_buf2d_offset_h	
dd 0,0
	sz_lib_init db 'lib_init',0
	sz_buf2d_create db 'buf2d_create',0
	sz_buf2d_create_f_img db 'buf2d_create_f_img',0
	sz_buf2d_clear db 'buf2d_clear',0
	sz_buf2d_draw db 'buf2d_draw',0
	sz_buf2d_delete db 'buf2d_delete',0
	sz_buf2d_line db 'buf2d_line',0
	sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 ;à¨á®¢ ­¨¥ ¯àאַ㣮«ì­¨ª , 2-ï ª®®à¤¨­ â  § ¤ ­  ¯® à §¬¥àã
	sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
	;sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ­¨¥ ®ªà㦭®áâ¨
	sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
	sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
	sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
	sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
	sz_buf2d_bit_blt db 'buf2d_bit_blt',0
	sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
	sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
	;sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
	sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
	sz_buf2d_draw_text db 'buf2d_draw_text',0
	;sz_buf2d_crop_color db 'buf2d_crop_color',0
	sz_buf2d_offset_h db 'buf2d_offset_h',0

align 4
import_box_lib:
	dd alib_init2

	edit_box_draw dd aEdit_box_draw
	edit_box_key dd aEdit_box_key
	edit_box_mouse dd aEdit_box_mouse
	edit_box_set_text dd aEdit_box_set_text

	init_checkbox dd aInit_checkbox
	check_box_draw dd aCheck_box_draw
	check_box_mouse dd aCheck_box_mouse

	scrollbar_ver_draw dd aScrollbar_ver_draw
	scrollbar_hor_draw dd aScrollbar_hor_draw

	tl_data_init dd sz_tl_data_init
	tl_data_clear dd sz_tl_data_clear
	tl_info_clear dd sz_tl_info_clear
	tl_key dd sz_tl_key
	tl_mouse dd sz_tl_mouse
	tl_draw dd sz_tl_draw
	tl_info_undo dd sz_tl_info_undo
	tl_info_redo dd sz_tl_info_redo
	tl_node_add dd sz_tl_node_add
	tl_node_set_data dd sz_tl_node_set_data
	tl_node_get_data dd sz_tl_node_get_data
	tl_node_delete dd sz_tl_node_delete
	tl_node_move_up dd sz_tl_node_move_up
	tl_node_move_down dd sz_tl_node_move_down
	tl_cur_beg dd sz_tl_cur_beg
	tl_cur_next dd sz_tl_cur_next
	tl_cur_perv dd sz_tl_cur_perv
	tl_node_close_open dd sz_tl_node_close_open
	tl_node_lev_inc dd sz_tl_node_lev_inc
	tl_node_lev_dec dd sz_tl_node_lev_dec
	tl_node_poi_get_info dd sz_tl_node_poi_get_info
	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_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
	ted_clear dd sz_ted_clear
	ted_delete dd sz_ted_delete
	ted_draw dd sz_ted_draw
	ted_init dd sz_ted_init
	ted_init_scroll_bars dd sz_ted_init_scroll_bars
	ted_init_syntax_file dd sz_ted_init_syntax_file
	ted_is_select dd sz_ted_is_select
	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
	ted_but_copy dd sz_ted_but_copy
	ted_but_paste dd sz_ted_but_paste
	ted_but_undo dd sz_ted_but_undo
	ted_but_redo dd sz_ted_but_redo
	ted_but_reverse dd sz_ted_but_reverse
	ted_but_find_next dd sz_ted_but_find_next
	ted_text_colored dd sz_ted_text_colored
	;version_text_edit dd sz_ted_version

dd 0,0
 
	alib_init2 db 'lib_init',0

	aEdit_box_draw	db 'edit_box',0
	aEdit_box_key	db 'edit_box_key',0
	aEdit_box_mouse db 'edit_box_mouse',0
	aEdit_box_set_text db 'edit_box_set_text',0

	aInit_checkbox db 'init_checkbox2',0
	aCheck_box_draw db 'check_box_draw2',0
	aCheck_box_mouse db 'check_box_mouse2',0

	aScrollbar_ver_draw  db 'scrollbar_v_draw',0
	aScrollbar_hor_draw  db 'scrollbar_h_draw',0
  
	sz_tl_data_init db 'tl_data_init',0
	sz_tl_data_clear db 'tl_data_clear',0
	sz_tl_info_clear db 'tl_info_clear',0
	sz_tl_key db 'tl_key',0
	sz_tl_mouse db 'tl_mouse',0
	sz_tl_draw db 'tl_draw',0
	sz_tl_info_undo db 'tl_info_undo',0
	sz_tl_info_redo db 'tl_info_redo',0
	sz_tl_node_add db 'tl_node_add',0
	sz_tl_node_set_data db 'tl_node_set_data',0
	sz_tl_node_get_data db 'tl_node_get_data',0
	sz_tl_node_delete db 'tl_node_delete',0
	sz_tl_node_move_up db 'tl_node_move_up',0
	sz_tl_node_move_down db 'tl_node_move_down',0
	sz_tl_cur_beg db 'tl_cur_beg',0
	sz_tl_cur_next db 'tl_cur_next',0
	sz_tl_cur_perv db 'tl_cur_perv',0
	sz_tl_node_close_open db 'tl_node_close_open',0
	sz_tl_node_lev_inc db 'tl_node_lev_inc',0
	sz_tl_node_lev_dec db 'tl_node_lev_dec',0
	sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
	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_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
	sz_ted_clear			db 'ted_clear',0
	sz_ted_delete			db 'ted_delete',0
	sz_ted_draw				db 'ted_draw',0
	sz_ted_init				db 'ted_init',0
	sz_ted_init_scroll_bars db 'ted_init_scroll_bars',0
	sz_ted_init_syntax_file db 'ted_init_syntax_file',0
	sz_ted_is_select		db 'ted_is_select',0
	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
	sz_ted_but_copy 		db 'ted_but_copy',0
	sz_ted_but_paste		db 'ted_but_paste',0
	sz_ted_but_undo 		db 'ted_but_undo',0
	sz_ted_but_redo 		db 'ted_but_redo',0
	sz_ted_but_reverse		db 'ted_but_reverse',0
	sz_ted_but_find_next	db 'ted_but_find_next',0
	sz_ted_text_colored		db 'ted_text_colored',0
	;sz_ted_version db 'version_text_edit',0

align 4
import_proc_lib:
	OpenDialog_Init dd aOpenDialog_Init
	OpenDialog_Start dd aOpenDialog_Start
dd 0,0
	aOpenDialog_Init db 'OpenDialog_init',0
	aOpenDialog_Start db 'OpenDialog_start',0

align 4
import_libimg:
	dd alib_init1
	img_is_img  dd aimg_is_img
	img_info    dd aimg_info
	img_from_file dd aimg_from_file
	img_to_file dd aimg_to_file
	img_from_rgb dd aimg_from_rgb
	img_to_rgb  dd aimg_to_rgb
	img_to_rgb2 dd aimg_to_rgb2
	img_decode  dd aimg_decode
	img_encode  dd aimg_encode
	img_create  dd aimg_create
	img_destroy dd aimg_destroy
	img_destroy_layer dd aimg_destroy_layer
	img_count   dd aimg_count
	img_lock_bits dd aimg_lock_bits
	img_unlock_bits dd aimg_unlock_bits
	img_flip    dd aimg_flip
	img_flip_layer dd aimg_flip_layer
	img_rotate  dd aimg_rotate
	img_rotate_layer dd aimg_rotate_layer
	img_draw    dd aimg_draw

dd 0,0

	alib_init1   db 'lib_init',0
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
	aimg_info    db 'img_info',0
	aimg_from_file db 'img_from_file',0
	aimg_to_file db 'img_to_file',0
	aimg_from_rgb db 'img_from_rgb',0
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
	aimg_to_rgb2 db 'img_to_rgb2',0
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
	aimg_encode  db 'img_encode',0
	aimg_create  db 'img_create',0
	aimg_destroy db 'img_destroy',0
	aimg_destroy_layer db 'img_destroy_layer',0
	aimg_count   db 'img_count',0
	aimg_lock_bits db 'img_lock_bits',0
	aimg_unlock_bits db 'img_unlock_bits',0
	aimg_flip    db 'img_flip',0
	aimg_flip_layer db 'img_flip_layer',0
	aimg_rotate  db 'img_rotate',0
	aimg_rotate_layer db 'img_rotate_layer',0
	aimg_draw    db 'img_draw',0

align 4
import_msgbox_lib:
	mb_create dd amb_create
	mb_reinit dd amb_reinit
	mb_setfunctions dd amb_setfunctions
dd 0,0
	amb_create db 'mb_create',0
	amb_reinit db 'mb_reinit',0
	amb_setfunctions db 'mb_setfunctions',0

;library structures
l_libs_start:
	lib0 l_libs lib0_name, sys_path, library_path, system_dir0, err_message_found_lib0, head_f_l, import_box_lib, err_message_import0, head_f_i
	lib1 l_libs lib1_name, sys_path, library_path, system_dir1, err_message_found_lib1, head_f_l, import_proc_lib,err_message_import1, head_f_i
	lib2 l_libs lib2_name, sys_path, library_path, system_dir2, err_message_found_lib2, head_f_l, import_buf2d_lib, err_message_import2, head_f_i
	lib3 l_libs lib3_name, sys_path, library_path, system_dir3, err_message_found_lib3, head_f_l, import_libimg, err_message_import3, head_f_i
	lib4 l_libs lib4_name, sys_path, library_path, system_dir4, err_message_found_lib4, head_f_l, import_msgbox_lib, err_message_import4, head_f_i
load_lib_end:


align 16
run_file_70 FileInfoBlock
open_b rb 560

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
	rb 1024
	prop_thread:
	rb 1024
	thread: ;¢¢¥àåã ¤®ç¥à­¨© á⥪ ¤«ï ®ª­  á®®¡é¥­¨ï
	rb 1024
stacktop: ;¢¢¥àåã á⥪ ®á­®¢­®© ¯à®£à ¬¬ë
	sys_path rb 1024
	library_path rb 1024
	plugin_path rb 4096
	openfile_path rb 4096
	filename_area rb 256
mem: