;
; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ᮧ¤ î騥 ¯à®£à ¬­ë© ª®¤
;
u_object object ;¢à¥¬¥­­ë© ®¡ê¥ªâ ¤«ï § ¤ ­¨ï ᬥ饭¨©

macro insert_coma
{
	stdcall [ted_text_add], tedit0,txt_coma,1,ted_opt_ed_move_cursor
}
macro insert_nl
{
	stdcall [ted_text_add], tedit0,txt_nl,1,ted_opt_ed_move_cursor
}
macro insert_com
{
	stdcall [ted_text_add], tedit0,txt_com,1,ted_opt_ed_move_cursor
}
macro insert_sp
{
	stdcall [ted_text_add], tedit0,txt_sp,1,ted_opt_ed_move_cursor
}

;äã­ªæ¨ï ¢áâ ¢«ï¥â ⥪á⮢ãî áâப㠢 ⥪áâ®¢ë© à¥¤ ªâ®à
align 4
proc insert_text, txt:dword
	push eax
	stdcall str_len,dword[txt]
	cmp eax,1
	jl @f
		stdcall [ted_text_add], tedit0,dword[txt],eax,ted_opt_ed_move_cursor
	@@:
	pop eax
	ret
endp

;¢áâ ¢«ï¥â 㪠§ ­­®¥ ⥪á⮢®¥ ᢮©á⢮ ¨§ ®¡ê¥ªâ  ¢ ⥪áâ®¢ë© à¥¤ ªâ®à
align 4
proc insert_text_prop, p_obj:dword,index:dword
	push eax edx
		mov eax,[p_obj]
		mov edx,[index]
		stdcall get_obj_text_col,eax,edx
		stdcall str_len,edx
		stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
	pop edx eax
	ret
endp

;¢áâ ¢«ï¥â 㪠§ ­­®¥ ¡¨â®¢®¥ ᢮©á⢮ ¨§ ®¡ê¥ªâ  ¢ ⥪áâ®¢ë© à¥¤ ªâ®à
align 4
proc insert_bit_prop, p_obj:dword,index:dword
	push ebx ecx edi
		mov ebx,[p_obj]
		mov ecx,[index]
		test_bool_prop ebx,ecx
		jnc @f ;¥á«¨ ¯®«ì§®¢ â¥«ì ­¥ ¢ë¡à « ¢ ®¡ê¥ªâ¥ ¤ ­­®¥ ᢮©á⢮
			mov ebx,dword[ebx]
			call find_obj_in_opt
			mov ecx,dword[edi+obj_opt.bit_val-obj_opt] ;ecx - ᬥ饭¨¥ §­ ç¥­¨© ᢮©á⢠(ª®­áâ ­â)
			cmp byte[ecx],0
			je @f ;¥á«¨ ã ®¡ê¥ªâ  ­¥â § ¤ ­­ëå ¡¨â®¢ëå ᢮©áâ¢
				add ecx,obj_opt ;¤®¡ ¢«ï¥¬ ­ ç «® ä ©«  á ®¯æ¨ï¬¨
				stdcall get_string_by_ind, ecx,[index]
				cmp byte[edi],0
				je @f ;¥á«¨ ã ®¡ê¥ªâ  ¡¨â®¢®¥ ᢮©á⢮ ¯ãá⮥
				stdcall insert_text, txt_plus
				stdcall insert_text, edi
		@@:
	pop edi ecx ebx
	ret
endp

;äã­ªæ¨ï ¢áâ ¢«ï¥â 2 ¯ à ¬¥âà  ¯® 16 ¡¨â ¢ ¢¨¤¥:
; (_p1_ shl 16 + _p2_)
align 4
proc insert_2_prop_16_bit, obj:dword, p_hi:dword, p_lo:dword
	stdcall insert_text, txt_skob_o
	stdcall insert_text_prop, [obj],[p_hi]
	stdcall insert_text, txt_shl_16
	stdcall insert_text, txt_skob_c
	stdcall insert_text, txt_plus
	stdcall insert_text_prop, [obj],[p_lo]
	ret
endp

;¢áâ ¢«ï¥¬ áâப㠢¨¤ :
; txt_(n) db (s)
align 4
proc insert_text_label_data, obj:dword, col:dword
	push eax edx
	mov eax,[obj]
		stdcall insert_text, txt_txt
		mov edx,fp_icon
		stdcall get_obj_id_str, eax,edx ;edx = 'n'
		stdcall str_cat, edx,txt_db ;edx = 'n db '
		stdcall insert_text, edx
		stdcall insert_text_prop, eax,[col]
		insert_nl
	pop edx eax
	ret
endp

macro insert_tab
{
	stdcall [ted_text_add], tedit0,txt_tab,1,ted_opt_ed_move_cursor
}
macro insert_br
{
	stdcall [ted_text_add], tedit0,txt_br,3,ted_opt_ed_move_cursor
}
macro insert_a_met
{
	stdcall [ted_text_add], tedit0,txt_a_met,3,ted_opt_ed_move_cursor
}
macro insert_0
{
	stdcall [ted_text_add], tedit0,txt_0,1,ted_opt_ed_move_cursor
}
macro insert_plus
{
	stdcall [ted_text_add], tedit0,txt_plus,1,ted_opt_ed_move_cursor
}
macro insert_xor
{
	stdcall [ted_text_add], tedit0,txt_xor,4,ted_opt_ed_move_cursor
}
macro insert_cmp
{
	stdcall [ted_text_add], tedit0,txt_cmp,4,ted_opt_ed_move_cursor
}
macro insert_reg reg_name
{
	stdcall [ted_text_add], tedit0,reg_name,3,ted_opt_ed_move_cursor
}
macro insert_reg8 reg_name
{
	stdcall [ted_text_add], tedit0,reg_name,2,ted_opt_ed_move_cursor
}

;
macro insert_key_beg
{
	stdcall [ted_text_add], tedit0,txt_key_1,txt_key_2-txt_key_1,ted_opt_ed_move_cursor
}
macro insert_key_end
{
	stdcall [ted_text_add], tedit0,txt_key_2,txt_key_3-txt_key_2,ted_opt_ed_move_cursor
}

macro insert_d_poi
{
	stdcall [ted_text_add], tedit0,txt_d_poi,1,ted_opt_ed_move_cursor
}
macro insert_ret
{
	stdcall [ted_text_add], tedit0,txt_ret,4,ted_opt_ed_move_cursor
}


align 4
but_update:
	call draw_constructor
	cmp byte[show_mode],0 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠®ª­  ª®­áâàãªâ®à 
	jne @f
		stdcall [buf2d_draw], buf_fon
	@@:
	call code_gen
	cmp byte[show_mode],1 ;ãá«®¢¨¥ ¢¨¤¨¬®á⨠⥪á⮢®£® ®ª­ 
	jne @f
		stdcall [ted_draw], tedit0
	@@:
	ret

;äã­ªæ¨ï ᮧ¤ îé ï ª®¤ ¢á¥£® ä ©« 
align 4
code_gen:
	stdcall [ted_clear], tedit0,1
pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	xor bl,bl
	call code_gen_obj
	stdcall [ted_text_add], tedit0,\
		txt_nl,1,ted_opt_ed_move_cursor+ted_opt_ed_change_time ;¤®¡ ¢«ï¥¬ ᨬ¢®« ­®¢®© áâப¨ á ®¯æ¨¥© ted_opt_ed_change_time ¤«ï ¢®§¬®¦­®á⨠á®åà ­¥­¨ï ä ©« 
	stdcall [ted_init_scroll_bars], tedit0, 4 ;¬¥­ï¥¬ à §¬¥àë áªà®««¨­£®¢
popad
	ret

;input:
; bl - ã஢¥­ì ®¡ê¥ªâ 
; esi - 㪠§ â¥«ì ­  㧥«
align 4
code_gen_obj:
push eax ebx edx
	.beg_iterat:
		cmp esi,0
		je .find_no

		cmp byte[esi+2],bl ;lev
		jl .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop eax ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp eax,0
		je .find_no

		cmp dword[eax],C_STR
		jne .no_struct
			stdcall get_obj_text_col, eax,1 ;edx - 㪠§ â¥«ì ­  1-¥ ᢮©á⢮ áâàãªâãàë
			stdcall insert_text,txt_struc
			cmp byte[edx],0
			jne @f
				stdcall insert_text,txt_t
			@@:
			insert_sp
			stdcall insert_text_prop, eax,0

			cmp byte[edx],0
			je @f
				;¥á«¨ áâàãªâãà  § ¤ ­  ¬ ªà®á®¬
				insert_sp
				stdcall insert_text_prop, eax,1
				insert_nl
				stdcall insert_text, txt_skob_fo
			@@:
			insert_nl
			stdcall get_code_children_objects, esi
			call move_next_no_child_objects ;¯à®¯ã᪠¤®ç¥à­¨å ®¡¥ªâ®¢
			cmp byte[edx],0
			je @f
				;¥á«¨ áâàãªâãà  § ¤ ­  ¬ ªà®á®¬
				stdcall insert_text, txt_skob_fc
				insert_nl
			@@:
			stdcall insert_text,txt_ends
		.no_struct:
		cmp dword[eax],C_TXT
		jne @f
			stdcall get_code_text,eax ;®¡à ¡®âª  ®¡ê¥ªâ 
		@@:
		cmp dword[eax],C_INC
		jne @f
			stdcall get_code_incl,eax ;®¡à ¡®âª  ®¡ê¥ªâ 
		@@:
		cmp dword[eax],C_VAR
		jne @f
			stdcall get_code_variable,eax,ebx ;®¡à ¡®âª  ®¡ê¥ªâ 
		@@:
		cmp dword[eax],C_WND
		jne @f
			stdcall get_code_window,eax ;®¡à ¡®âª  ®¡ê¥ªâ 
			stdcall get_code_children_objects, esi ;®¡à ¡®âª  ¤®ç¥à­¨å ®¡¥ªâ®¢
			call move_next_no_child_objects ;¯à®¯ã᪠¤®ç¥à­¨å ®¡¥ªâ®¢
			stdcall insert_text, txt_draw_we ;ª®¤ § ¢¥àè î騩 äã­ªæ¨î à¨á®¢ ­¨ï
		@@:
		cmp dword[eax],C_ACO
		jne @f
			stdcall get_code_auto,esi ;®¡à ¡®âª  ®¡ê¥ªâ 
			call move_next_no_child_objects ;¯à®¯ã᪠¤®ç¥à­¨å ®¡¥ªâ®¢
		@@:
		cmp dword[eax],C_KEY ;ª« ¢¨ âãà 
		jne @f
			stdcall get_code_key,eax ;®¡à ¡®âª  ®¡ê¥ªâ 
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
pop edx ebx eax
	ret

;¢§ïâì ª®¤ë ¤®ç¥à­¨å ®¡ê¥ªâ®¢
align 4
proc get_code_children_objects, p_node:dword
	push ebx esi
		mov esi,[p_node]
		mov bl,byte[esi+2] ;á®å࠭塞 ã஢¥­ì ⥪ã饣® ®¡ê¥ªâ 

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
		cmp esi,0 ;¥á«¨ ¤®á⨣«¨ ª®­æ  ᯨ᪠ ®¡ê¥ªâ®¢
		je @f
		cmp byte[esi+2],bl ;¥á«¨ ã஢¥­ì á«¥¤ãî饣® ®¡ê¥ªâ  ¡®«ìè¥ ¨«¨ à ¢¥­ ⥪ã饬ã
		jle @f ;â® ¤®ç¥à­¨å 㧫®¢ ­¥â
			mov bl,byte[esi+2]
			call code_gen_obj ;४ãàᨢ­ë© ¢ë§®¢ ¤®ç¥à­¨å ®¡ê¥ªâ®¢
		@@:
	pop esi ebx
	ret
endp

;¯à®¯ã᪠¢á¥å ¤®ç¥à­¨å ®¡ê¥ªâ®¢
;input:
; esi - 㪠§ â¥«ì ­  㧥«
;outpet:
; esi - 㪠§ â¥«ì á«¥¤ã騩 ­¥ ¤®ç¥à­¨© (®â­®á¨â¥«ì­® ¢å®¤ï饣®) ­  㧥«
align 4
move_next_no_child_objects:
	push eax ebx
		mov bl,byte[esi+2] ;á®å࠭塞 ã஢¥­ì ⥪ã饣® ®¡ê¥ªâ 
		@@:
			stdcall dword[tl_node_poi_get_next_info], esi,tree2
			pop eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
			cmp eax,0 ;¥á«¨ ¤®á⨣«¨ ª®­æ  ᯨ᪠ ®¡ê¥ªâ®¢
			je @f
			cmp byte[eax+2],bl ;¥á«¨ ã஢¥­ì á«¥¤ãî饣® ®¡ê¥ªâ  ¡®«ìè¥ ¨«¨ à ¢¥­ ⥪ã饬ã
			jle @f ;â® ¤®ç¥à­¨å 㧫®¢ ­¥â
			mov esi,eax ;¥á«¨ á«¥¤ã騩 㧥« ®ª § «áï ¤®ç¥à­¨¬, ¯¥à¥áâ ¢«ï¥¬ 㪠§ â¥«ì
			jmp @b
		@@:
	pop ebx eax
	ret

;¤®¡ ¢«¥­¨¥ ®¡ê¥ªâ  á ¯à®£à ¬­ë¬ ª®¤®¬ (⥪á⮬)
align 4
proc get_code_text, p_obj:dword
	;pushad
		insert_nl
		stdcall insert_text_prop, dword[p_obj],0
		insert_nl
	;popad
	ret
endp

;®¡à ¡®âª  ®¡ê¥ªâ  ᮧ¤ î饣®  ¢â®¬ â¨ç¥ªá¨¥ ª®¤ë
align 4
proc get_code_auto, p_node:dword
	pushad
		insert_nl
		mov esi,dword[p_node]
		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 

		test_bool_prop ebx,BIT_MOD_ACI
		jae @f
			mov edx,C_CHB
			stdcall find_obj_in_file,edx ;eax - 㪠§ â¥«ì ­  áâàãªâãàã check_box
			cmp eax,0
			je @f
				stdcall insert_text, txt_std_init_cb
		@@:
		test_bool_prop ebx,BIT_MOD_ACM
		jae @f
			; ¢â®¬ â¨ç¥áª¨¥ ᮡëâ¨ï ®â ¬ëè¨
			call get_code_auto_m
		@@:
		test_bool_prop ebx,BIT_MOD_ABU
		jae @f
			;ᮧ¤ ­¨¥ ä㭪樨 button
			stdcall insert_text, txt_but_beg
			call get_code_auto_but ;ª®¤ë ¢ë§®¢  ª­®¯®ª
			stdcall insert_text, txt_but_mid
			stdcall get_code_children_objects, esi
			;ª®­¥æ ä㭪樨 button (ª­®¯ª  id=-1, § ¢¥à襭¨¥ ¯à®£à ¬¬ë)
			stdcall insert_text, txt_but_end

			call get_code_a_but_fun ;ª®¤ë ä㭪権, ¢ë§ë¢ ¥¬ëå ¯à¨ ­ ¦ â¨¨ ª­®¯®ª
		@@:
		test_bool_prop ebx,BIT_MOD_ACD
		jae @f
			call get_code_auto_data_el

			mov edx,C_CHB
			stdcall find_obj_in_file,edx ;eax - 㪠§ â¥«ì ­  áâàãªâãàã check_box
			cmp eax,0
			je .no_check
				stdcall insert_text, txt_cb_b
				call get_code_auto_data_el_cbox
				stdcall insert_text, txt_cb_e
			.no_check:

			call get_code_auto_data_dop

			mov edx,C_LIB
			stdcall find_obj_in_file,edx ;eax - 㪠§ â¥«ì ­  áâàãªâãàã ¡¨¡«¨®â¥ª¨
			cmp eax,0
			je @f
				insert_nl
				stdcall insert_text, txt_head_i
				stdcall insert_text, txt_d_poi
				insert_nl
				stdcall insert_text, txt_head_l
				stdcall insert_text, txt_db
				stdcall insert_text, txt_str_beg
				stdcall insert_text, txt_sys_err
				stdcall insert_text, txt_str_end
				insert_nl

				call get_code_auto_data_libs_param
				stdcall insert_text, txt_ll_start
					call get_code_auto_data_libs_struc
				stdcall insert_text, txt_ll_end
				call get_code_auto_data_libs ;â ¡«¨æë ¨¬¯®àâ  ¡¨¡«¨®â¥ª
		@@:
		insert_nl
	popad
	ret
endp

align 4
proc get_code_auto_m
	pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_EDB
		jne @f
			stdcall insert_text, txt_std_mouse_ed
			stdcall insert_text_prop, ebx,0
			insert_nl
		@@:
		cmp dword[ebx],C_CHB
		jne @f
			stdcall insert_text, txt_std_mouse_cb
			stdcall insert_text_prop, ebx,0
			insert_nl
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;ᮧ¤ ­¨¥ ¤ ­­ëå (áâàãªâãà ®¡ê¥ªâ®¢)
align 4
proc get_code_auto_data_el
	pushad
	insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_EDB
		jne @f
			;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt
			stdcall insert_text_prop, ebx,0
			stdcall insert_text, txt_ebox

			mov ecx,1
			.prop:
				insert_sp
				stdcall insert_text_prop, ebx,ecx
				insert_coma
				inc ecx
				cmp ecx,10
			jl .prop

			insert_br
			stdcall insert_text, txt_txt

			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text, edx

			stdcall insert_text, txt_mouse_dd

			stdcall insert_text, txt_0 ;᢮©á⢠ editbox
			stdcall insert_bit_prop, ebx,BIT_MOD_EDIT_FOC
			stdcall insert_bit_prop, ebx,BIT_MOD_EDIT_FIO

			xchg eax,edx ;á®å࠭塞 §­ ç¥­¨¥ edx
			stdcall get_obj_text_col,ebx,10
			cmp byte[edx],0 ;¯à®¢¥à塞 ¯ãáâ ï «¨ áâப  ¯à¨ § ¯ã᪥ editbox
			je .null_string
				xchg eax,edx ;¢®áâ ­ ¢«¨¢ ¥¬ §­ ç¥­¨¥ edx
				stdcall insert_text, txt_coma

				stdcall insert_text, txt_txt
				stdcall insert_text, edx
				stdcall insert_text, txt_met_end
				stdcall insert_text, txt_minus
				stdcall insert_text, txt_txt
				stdcall insert_text, edx
				stdcall insert_text, txt_minus
				stdcall insert_text, txt_1
				stdcall insert_text, txt_coma

				stdcall insert_text, txt_txt
				stdcall insert_text, edx
				stdcall insert_text, txt_met_end
				stdcall insert_text, txt_minus
				stdcall insert_text, txt_txt
				stdcall insert_text, edx
				stdcall insert_text, txt_minus
				stdcall insert_text, txt_1
			.null_string:
			insert_nl
		@@:
		cmp dword[ebx],C_DTT
		jne @f
			stdcall insert_text_label_data, ebx,0
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

align 4
proc get_code_auto_data_el_cbox
	pushad
	insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_CHB
		jne .no_check
			;1,2,3,4,5, 6,7,8, 9 - ot_x,ot_y,w,h,ot_w_txt, col_fon,col_frame,col_txt, txt

			stdcall insert_text_prop, ebx,0
			stdcall insert_text, txt_cbox
			insert_sp

			stdcall insert_2_prop_16_bit, ebx,1,3
			stdcall insert_text, txt_coma
			stdcall insert_2_prop_16_bit, ebx,2,4
			stdcall insert_text, txt_coma

			stdcall insert_text_prop, ebx,5
			stdcall insert_text, txt_coma
			insert_sp

			stdcall insert_text_prop, ebx,6
			stdcall insert_text, txt_coma
			stdcall insert_text_prop, ebx,7
			stdcall insert_text, txt_coma
			stdcall insert_text_prop, ebx,8
			stdcall insert_text, txt_coma
			stdcall insert_text, txt_br

			stdcall insert_text, txt_txt
			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text, edx
			stdcall insert_text, txt_coma

			;ä« £¨
			stdcall insert_text,txt_0
			stdcall insert_bit_prop, ebx,BIT_MOD_CHE
			stdcall insert_bit_prop, ebx,BIT_MOD_CHE_T
			stdcall insert_bit_prop, ebx,BIT_MOD_CHE_M
			stdcall insert_bit_prop, ebx,BIT_MOD_CHE_B

			insert_nl
		.no_check:
		cmp dword[ebx],C_DTT
		jne @f
			stdcall insert_text_label_data, ebx,0
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;¤ ­­ë¥ ¤«ï ¡¨¡«¨®â¥ª
align 4
proc get_code_auto_data_libs_param
	pushad
	insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_LIB
		jne @f
			;0,1,2,3,4,5 - l_nam,s_dir,i_met,...

			stdcall insert_text, txt_sys_dir
			;object code
			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text,edx
			stdcall insert_text,txt_db
			;stdcall insert_text, txt_str_beg
			stdcall insert_text_prop, ebx,1
			;stdcall insert_text, txt_str_end
			insert_nl

			stdcall insert_text, txt_lib_name
			stdcall insert_text,edx
			stdcall insert_text,txt_db
			stdcall insert_text, txt_str_beg
			stdcall insert_text_prop, ebx,0
			stdcall insert_text, txt_str_end
			insert_nl

			stdcall insert_text,txt_err_m_f_lib
			stdcall insert_text,edx
			stdcall insert_text,txt_db
			stdcall insert_text, txt_str_beg
			stdcall insert_text_prop, ebx,4
			stdcall insert_text, txt_str_end
			insert_nl

			stdcall insert_text,txt_err_m_i_lib
			stdcall insert_text,edx
			stdcall insert_text,txt_db
			stdcall insert_text, txt_str_beg
			stdcall insert_text_prop, ebx,5
			stdcall insert_text, txt_str_end
			insert_nl

			insert_nl
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;¤ ­­ë¥ ¤«ï ¡¨¡«¨®â¥ª
align 4
proc get_code_auto_data_libs_struc
	pushad
	;insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_LIB
		jne @f
			;0,1,2,3,4,5 - l_nam,s_dir,i_met,...

			stdcall insert_text, txt_lib
			;object code
			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text,edx
			insert_sp
			stdcall insert_text, txt_ll
			stdcall insert_text, txt_lib_name
			stdcall insert_text,edx
			stdcall insert_text,txt_coma

			stdcall insert_text, txt_lib_path

			stdcall insert_text, txt_sys_dir
			stdcall insert_text,edx
			stdcall insert_text,txt_coma
			stdcall insert_text,txt_br
			stdcall insert_text,txt_tab

			stdcall insert_text,txt_err_m_f_lib
			stdcall insert_text,edx
			stdcall insert_text,txt_coma
			stdcall insert_text,txt_head_l
			stdcall insert_text,txt_coma

			stdcall insert_text_prop, ebx,2
			stdcall insert_text,txt_coma

			stdcall insert_text,txt_err_m_i_lib
			stdcall insert_text,edx
			stdcall insert_text,txt_coma
			stdcall insert_text,txt_head_i

			insert_nl
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;¤ ­­ë¥ ¤«ï ¡¨¡«¨®â¥ª
align 4
proc get_code_auto_data_libs
	pushad
	insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_LIB
		jne @f
			;0,1,2,3,4,5 - l_nam,s_dir,i_met,...
			stdcall insert_text, txt_align_4
			stdcall insert_text_prop, ebx,2
			stdcall insert_text, txt_d_poi
			insert_nl

			call get_code_lib_table
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;input:
; esi
align 4
get_code_lib_table:
pushad
	mov bl,byte[esi+2]
	mov edi,esi
	stdcall dword[tl_node_poi_get_data], esi,tree2
	pop edx ;¯®«ã祭¨¥ ¤ ­­ëå த¨â¥«ì᪮£® ®¡ê¥ªâ 
	cmp edx,0
	je @f
	@@:
		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
		cmp esi,0
		je @f
		cmp byte[esi+2],bl ;lev
		jle @f
			stdcall dword[tl_node_poi_get_data], esi,tree2
			pop ecx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
			cmp ecx,0
			je @f
			cmp dword[ecx],C_IFN
			jne @b
				;¢áâ ¢ª  㪠§ â¥«ï ­  äã­ªæ¨î
				test_bool_prop ecx,BIT_MOD_IMPORT_FUNCT_COMMENT
				jae .no_com_0
					stdcall insert_text, txt_com
				.no_com_0:
				insert_tab
				stdcall insert_text_prop, ecx,0
				stdcall insert_text, txt_dd
				stdcall insert_text_prop, edx,3 ;¯à¨áâ ¢ª  ª ä㭪樨
				stdcall insert_text_prop, ecx,0
				insert_nl
			jmp @b
	@@:
	stdcall insert_text, txt_dd_0_0
	mov esi,edi
	@@:
		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
		cmp esi,0
		je @f
		cmp byte[esi+2],bl ;lev
		jle @f
			stdcall dword[tl_node_poi_get_data], esi,tree2
			pop ecx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
			cmp ecx,0
			je @f
			cmp dword[ecx],C_IFN
			jne @b
				;¢áâ ¢ª  ¨¬¥­¨ ¨¬¯®àâ¨à®¢ ­­®© ä㭪樨
				test_bool_prop ecx,BIT_MOD_IMPORT_FUNCT_COMMENT
				jae .no_com_1
					stdcall insert_text, txt_com
				.no_com_1:
				insert_tab
				stdcall insert_text_prop, edx,3 ;¯à¨áâ ¢ª  ª ä㭪樨
				stdcall insert_text_prop, ecx,0
				stdcall insert_text, txt_db
				stdcall insert_text, txt_str_beg
				stdcall insert_text_prop, ecx,1
				stdcall insert_text, txt_str_end
				insert_nl
			jmp @b
	@@:
popad
	ret

;
align 4
proc get_code_auto_data_dop
	pushad
	insert_nl ;®âáâ㯠¤«ï ä®à¬ â¨à®¢ ­¨ï

	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_EDB
		jne @f
			;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt

			;ä®à¬¨à㥬 ⥪áâ®¢ë¥ ¤ ­­ë¥ ¤«ï editbox-®¢
			stdcall insert_text, txt_txt
			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text,edx

			stdcall get_obj_text_col,ebx,10
			cmp byte[edx],0
			je .no_text
				stdcall insert_text, txt_d_poi
				stdcall insert_text, txt_db
				stdcall insert_text, txt_str_beg
				stdcall str_len,edx
				stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
				stdcall insert_text, txt_str_end
				insert_nl

				insert_tab
				stdcall insert_text, txt_met_end
				stdcall insert_text, txt_rb
				stdcall insert_text, txt_txt
				mov edx,fp_icon
				stdcall get_obj_id_str, ebx,edx
				stdcall insert_text,edx

				stdcall insert_text, txt_minus
				stdcall insert_text, txt_txt
				stdcall insert_text,edx
				stdcall insert_text, txt_met_end

				insert_plus
				stdcall insert_text_prop,ebx,9
				insert_plus
				stdcall insert_text, txt_3
				
				insert_nl

				jmp @f

			.no_text: ;¯¥à¢®­ ç «ì­® ⥪áâ ­¥ § ¤ ­
				stdcall insert_text, txt_times

				stdcall insert_text_prop,ebx,9
				insert_plus
				stdcall insert_text, txt_2
				stdcall insert_text, txt_db
				insert_0
				insert_nl
		@@:
		cmp dword[ebx],C_CHB
		jne @f
			stdcall insert_text_label_data, ebx,9
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;á¢ï§ë¢ ¥¬ ª­®¯ª¨ á äã­ªæ¨ï¬¨
align 4
proc get_code_auto_but
	pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_BUT
		jne @f
			insert_tab
			insert_cmp
			insert_reg8 txt_ah
			insert_coma
			stdcall get_obj_text_col,ebx,0
			stdcall str_len,edx
			stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
			insert_nl
			insert_tab
			stdcall insert_text, txt_jne_f
			insert_nl
			insert_tab
			insert_tab
			stdcall insert_text, txt_call
			stdcall get_obj_text_col,ebx,6
			stdcall str_len,edx
			cmp eax,1
			jl .c_fun
				stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
			.c_fun:
			insert_nl
			insert_tab
			insert_a_met ;@@:
			insert_nl
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;¡¥à¥¬ ª®¤ë ¤«ï ä㭪権 ­ ¦ â¨© ­  ª­®¯ª¨
align 4
proc get_code_a_but_fun
	pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_BUT
		jne @f
			stdcall get_obj_text_col,ebx,6
			stdcall str_len,edx
			cmp eax,1
			jl .c_fun
				insert_nl
				stdcall insert_text, txt_align_4
				stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
				insert_d_poi
				insert_nl
				insert_tab
				insert_ret
			.c_fun:
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

align 4
proc get_code_key, p_obj:dword
	pushad
		insert_nl
		mov ebx,dword[p_obj]

		insert_key_beg
		call get_code_funct_key ;ª®¤ë ¢ë§®¢  ª­®¯®ª
		insert_key_end

		insert_nl
	popad
	ret
endp

align 4
proc get_code_funct_key
	pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_EDB
		jne @f
			stdcall insert_text, txt_std_key_ed
			stdcall insert_text_prop,ebx,0
			insert_nl
		@@:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;®¡ê¥ªâë ¯®¤ª«î祭¨ï ä ©«®¢ 'include ...'
align 4
proc get_code_incl, p_obj:dword
	pushad
		stdcall insert_text, txt_incl
		mov ebx,dword[p_obj]
		stdcall insert_text_prop,ebx,0

		stdcall get_obj_text_col,ebx,1
		stdcall str_len,edx
		cmp eax,1
		jl @f
			insert_sp
			insert_com
			stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
		@@:

		insert_nl
	popad
	ret
endp

;ᮧ¤ ¥¬ ª®¤ § ¤ ­¨ï ®ª­ 
align 4
proc get_code_window, p_obj:dword
	pushad
		mov ebx,dword[p_obj]
		;2,3,4,5,6 - x,y,w,h,col_bkg

		stdcall insert_text, txt_draw_wb

		insert_tab
		insert_xor
		insert_reg txt_eax
		insert_coma
		insert_reg txt_eax
		insert_nl

		;mov ebx,... § ¤ ¥âáï è¨à¨­  ®ª­  ¨ ®âáâ㯠®â «¥¢®£® ªà ï íªà ­ 
		insert_tab
		stdcall insert_text, txt_mov
		insert_reg txt_ebx
		insert_coma
		stdcall insert_2_prop_16_bit, ebx,2,4
		insert_nl

		;mov ecx,... § ¤ ¥âáï ¢ëá®â  ®ª­  ¨ ®âáâ㯠®â ¢¥àå­¥£® ªà ï íªà ­ 
		insert_tab
		stdcall insert_text, txt_mov
		insert_reg txt_ecx
		insert_coma
		stdcall insert_2_prop_16_bit, ebx,3,5
		insert_nl

		;mov edx,... § ¤ ¥âáï 梥â à ¡®ç¥© ®¡« á⨠®ª­ 
		insert_tab
		stdcall insert_text, txt_mov
		insert_reg txt_edx
		insert_coma
		stdcall insert_text_prop, ebx,6
		insert_nl

		;or edx,0x33000000
		insert_tab
		stdcall insert_text, txt_or
		insert_reg txt_edx
		insert_coma
		stdcall insert_text,txt_skob_o
		stdcall insert_text_prop, ebx,1 ;áâ¨«ì ®ª­ 
		stdcall insert_text,txt_shl_24
		stdcall insert_text,txt_skob_c
		stdcall insert_bit_prop, ebx,BIT_MOD_WI_CAPT
		stdcall insert_bit_prop, ebx,BIT_MOD_WI_CORD_OTN_CL_OBL
		stdcall insert_bit_prop, ebx,BIT_MOD_WI_REDR
		stdcall insert_bit_prop, ebx,BIT_MOD_WI_GRAD
		insert_nl

		;mov edi,...
		insert_tab
		stdcall insert_text, txt_mov
		insert_reg txt_edi
		insert_coma
		stdcall insert_text_prop, ebx,0
		insert_nl

		insert_tab
		stdcall insert_text, txt_i_40
		insert_nl

		call get_code_draw_obj
	popad
	ret
endp


;ä®à¬¨à㥬 ¢ë§®¢ ä㭪権 ¤«ï à¨á®¢ ­¨ï ®¡ê¥ªâ®¢
align 4
proc get_code_draw_obj
	pushad
	stdcall dword[tl_node_poi_get_info], 0,tree2
	pop esi
	.beg_iterat:
		cmp esi,0
		je .find_no

		stdcall dword[tl_node_poi_get_data], esi,tree2
		pop ebx ;¯®«ãç ¥¬ ¤ ­­ë¥ 㧫 
		cmp ebx,0
		je .find_no

		cmp dword[ebx],C_EDB
		jne @f
			stdcall insert_text, txt_editb_draw
			stdcall insert_text_prop, ebx,0
			insert_nl
		@@:
		cmp dword[ebx],C_CHB
		jne @f
			stdcall insert_text, txt_cbox_draw
			stdcall insert_text_prop, ebx,0
			insert_nl
		@@:
		cmp dword[ebx],C_BUT
		jne .ob_draw_but
			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_eax
			insert_coma
			stdcall insert_text, txt_8
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ebx
			insert_coma
			stdcall insert_2_prop_16_bit, ebx,1,3
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ecx
			insert_coma
			stdcall insert_2_prop_16_bit, ebx,2,4
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_edx
			insert_coma
			stdcall insert_text_prop, ebx,0
			test_bool_prop ebx,BIT_MOD_BUT_NFON
			jnc @f
				stdcall insert_text, txt_plus
				stdcall insert_text, txt_bit_30
			@@:
			test_bool_prop ebx,BIT_MOD_BUT_NBORD
			jnc @f
				stdcall insert_text, txt_plus
				stdcall insert_text, txt_bit_29
			@@:
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_esi
			insert_coma
			stdcall insert_text_prop, ebx,5 ;button color
			insert_nl

			insert_tab
			stdcall insert_text, txt_i_40
			insert_nl
		.ob_draw_but:
		cmp dword[ebx],C_REC
		jne @f
			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_eax
			insert_coma
			stdcall insert_text, txt_1
			stdcall insert_text, txt_3
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ebx
			insert_coma
			stdcall insert_2_prop_16_bit, ebx,1,3
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ecx
			insert_coma
			stdcall insert_2_prop_16_bit, ebx,2,4
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_edx
			insert_coma
			stdcall insert_text_prop, ebx,0 ;rect color
			insert_nl

			insert_tab
			stdcall insert_text, txt_i_40
			insert_nl
		@@:
		cmp dword[ebx],C_DTT ;à¨á®¢ ­¨¥ ⥪áâ  ç¥à¥§ á¨áâ. ä. 4
		jne .ob_draw_text
			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_eax
			insert_coma
			stdcall insert_text, txt_4
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ebx
			insert_coma
			stdcall insert_2_prop_16_bit, ebx,1,2
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_ecx
			insert_coma
			stdcall insert_text_prop, ebx,3
			stdcall insert_bit_prop, ebx,BIT_MOD_TXT_ASCII_0 ;31 - ¡¨â ¤«ï áâப¨ ASCIIZ
			stdcall insert_bit_prop, ebx,BIT_MOD_TXT_NO_TRAN ;30 - ¡¨â ¤«ï ­¥ ¯à®§à ç­®£® ⥪áâ 
			stdcall insert_bit_prop, ebx,BIT_MOD_TXT_CHAR2 ;28 - ¡¨â ¤«ï 2-£® á¨áâ. èà¨äâ 
			insert_nl

			insert_tab
			stdcall insert_text, txt_mov
			insert_reg txt_edx
			insert_coma
			stdcall insert_text, txt_txt
			mov edx,fp_icon
			stdcall get_obj_id_str, ebx,edx
			stdcall insert_text,edx
			insert_nl

;mov esi,...
			test_bool_prop ebx,BIT_MOD_TXT_NO_TRAN
			jnc @f
				insert_tab
				stdcall insert_text, txt_mov
				insert_reg txt_edi
				insert_coma
				stdcall insert_text_prop, ebx,4 ;梥â ä®­ 
				insert_nl
			@@:

			insert_tab
			stdcall insert_text, txt_i_40
			insert_nl
		.ob_draw_text:

		stdcall dword[tl_node_poi_get_next_info], esi,tree2
		pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã

		jmp .beg_iterat
	.find_no:
	popad
	ret
endp

;ᮧ¤ âì ª®¤ ®¡ê¥­¨ï ¯¥à¥¬¥­­®©
align 4
proc get_code_variable, p_obj:dword,o_lev:dword
	pushad
		mov ebx,dword[p_obj]
		;0,1,2 - name,value,comment

		mov ecx,dword[o_lev]
		cmp cl,0
		je .no_tab ;¨§¡¥£ ¥¬ § æ¨ª«¨¢ ­¨ï (0-1 = 2^32-1)
		and ecx,0xff
		cld
		@@:
			insert_tab ;ä®à¬¨à®¢ ­¨¥ ®âáâ㯠 ¯¥à¥¤ ¯¥à¥¬¥­­®©
		loop @b
		.no_tab:

		stdcall insert_text_prop, ebx,0 ;¨¬ï ¯¥à¥¬¥­­®©
		insert_sp

		mov ecx,dword[ebx+u_object.typid-u_object] ;ecx - ®â­®á¨â¥«ì­ë© ¨­¤¥ªá த¨â¥«ì᪮£® ®¡ê¥ªâ  (¢ ¯ ¬ïâ¨)
		xor eax,eax
		mov ax,[tree2.info_size]
		imul ecx,eax ;㬭®¦ ¥¬ ¨­¤¥ªá ­  à §¬¥à áâàãªâãàë
		add ecx,[tree2.data_info] ;ecx - 㪠§ â¥«ì ¤ ­­ë¥ த¨â¥«ì᪮£® 㧫 

		;¯à®¢¥àªã ­  ¯à ¢¨«ì­®áâì ecx ???

		stdcall insert_text_prop, ecx,0 ;⨯ ¯¥à¥¬¥­­®©
		insert_sp
		stdcall insert_text_prop, ebx,1 ;§­ ç¥­¨¥

		stdcall get_obj_text_col,ebx,2 ;ª®¬¬¥­â à¨©
		stdcall str_len,edx
		cmp eax,1
		jl @f
			insert_sp
			insert_com
			stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor
		@@:
		insert_nl

	popad
	ret
endp



;--- ⥪áâ®¢ë¥ ª®­áâ ­âë ---
txt_str_beg db 39,0
txt_str_end db 39,',0',0
txt_coma db ',',0
txt_skob_o db '(',0
txt_skob_c db ')',0
txt_skob_fo db '{',0 ;᪮¡ª  䨣ãà­ ï ®âªà뢠îé ï
txt_skob_fc db '}',0 ;᪮¡ª  䨣ãà­ ï § ªà뢠îé ï
txt_i_40 db 'int 0x40',13,0
txt_0 db '0',0
txt_1 db '1',0
txt_2 db '2',0
txt_3 db '3',0
txt_4 db '4',0
txt_8 db '8',0
txt_plus db '+',0
txt_minus db '-',0
;txt_dol db '$',0
txt_nl db 13,0
txt_com db ';',0
txt_sp db ' ',0
txt_tab db 9,0
txt_br db '\',13,9,0
txt_txt db 'txt_',0
txt_db db ' db ',0
txt_dd db ' dd ',0
txt_rb db ' rb ',0
txt_dd_0_0 db 9,'dd 0,0',13,0
txt_mouse_dd db ', mouse_dd, ',0
txt_times db ':',13,9,'times ',0
txt_draw_wb:
	db 13,'align 4',13,'draw_window:',13,'pushad',13,9,'mcall 12,1',13,0
txt_draw_we:
	db 9,'mcall 12,2',13,'popad',13,9,'ret',13,0
txt_sys_dir db 'system_dir_',0
txt_lib_name db 'lib_name_',0
txt_lib_path db ' sys_path, library_path, ',0
txt_sys_err db '‘¨á⥬­ ï ®è¨¡ª ',0
txt_ll_start db 'l_libs_start:',13,0
txt_lib db 9,'lib_',0
txt_ll db 'l_libs ',0
txt_err_m_f_lib db 'err_msg_found_lib_',0
txt_head_l db 'head_f_l',0
txt_err_m_i_lib db 'err_msg_import_',0
txt_head_i db 'head_f_i',0
txt_ll_end db 'l_libs_end:',13,0
;txt_bit_28 db '0x10000000',0
txt_bit_29 db '0x20000000',0
txt_bit_30 db '0x40000000',0
;txt_bit_31 db '0x80000000',0
txt_struc db 'struc',0
txt_t db 't',0
txt_met_end db '.end',0
txt_ends db 'ends',13,13,0
txt_mov db 'mov ',0
txt_xor db 'xor ',0
txt_or db 'or  ',0
txt_cmp db 'cmp ',0
txt_call db 'call ',0
txt_jne_f db 'jne @f',0
txt_a_met db '@@:',0
txt_ah db 'ah',0
txt_eax db 'eax',0
txt_ebx db 'ebx',0
txt_ecx db 'ecx',0
txt_edx db 'edx',0
txt_edi db 'edi',0
txt_esi db 'esi',0
txt_align_4 db 'align 4',13,0
txt_d_poi db ':',0
txt_ret db 'ret',13,0
txt_shl_16 db ' shl 16',0
txt_shl_24 db ' shl 24',0
txt_std_mouse_ed:
	db 9,'stdcall [edit_box_mouse], ',0
txt_std_init_cb:
	db 9,'init_checkboxes2 check_boxes,check_boxes_end',13,0
txt_std_mouse_cb:
	db 9,'stdcall [check_box_mouse], ',0
txt_std_key_ed:
	db 9,'stdcall [edit_box_key], ',0
txt_incl:
	db 'include ',0

txt_cbox db ' check_box2',0
txt_cb_b db 13,'check_boxes:',0
txt_cb_e db 'check_boxes_end:',13,0

txt_ebox db ' edit_box',0
txt_editb_draw db 9,'stdcall [edit_box_draw], ',0
txt_cbox_draw db 9,'stdcall [check_box_draw], ',0

;­ ç «® ä㭪樨 ª­®¯®ª
txt_but_beg db 'align 4',13,'button:',13,9,'mcall 17',13,0
txt_but_mid db 9,'cmp ah,1',13,9,'jne still',13,'.exit:',13,0
;ª®­¥æ ä㭪樨 ª­®¯®ª (§ ¢¥à襭¨¥ ¯à®£à ¬ë)
txt_but_end db 9,'mcall -1',13,0

txt_key_1:
db 'align 4',13,'key:',13,9,'mcall 2',13
txt_key_2:
db 9,'jmp still',13
txt_key_3:

;¯®«ãç ¥¬ ¯®à浪®¢ë© ­®¬¥à ®¡ê¥ªâ  ®â­®á¨â¥«ì­® ¯ ¬ïâ¨ í«¥¬¥­â  tree2
;output:
; txt_buf - áâப  á ­®¬¥à®¬ ®¡ê¥ªâ 
align 4
proc get_obj_id_str, p_obj:dword, txt_buf:dword
	push eax ecx edx
	mov eax,dword[p_obj]
	sub eax,[tree2.data_info]
	xor edx,edx
	xor ecx,ecx
	mov cx,word[tree2.info_size]
	div ecx

	mov edx,dword[txt_buf]
	mov byte[edx],0
	stdcall str_cat_value,edx,eax
	pop edx ecx eax
	ret
endp

;¯®«ãç ¥¬ ¯®à浪®¢ë© ­®¬¥à ®¡ê¥ªâ  ®â­®á¨â¥«ì­® ¯ ¬ïâ¨ í«¥¬¥­â  tree2
;output:
; eax - ­®¬¥à ®¡ê¥ªâ 
align 4
proc get_obj_id, p_obj:dword
	push ecx edx
	mov eax,dword[p_obj]
	sub eax,[tree2.data_info]
	xor edx,edx
	xor ecx,ecx
	mov cx,word[tree2.info_size]
	div ecx
	pop edx ecx
	ret
endp

;--- ⥪áâ®¢ë¥ ä㭪樨 ---

;¢ë¡¨à ¥¬ áâப㠨§ ¬ á¨¢ , ¯® 㪠§ ­­®¬ã ¨­¤¥ªáã
;input:
; str - 㪠§ â¥«ì ­  ¬ á¨¢ áâப
; ind - ¨­¤¥ªá ¨áª®¬®© áâப¨
;output:
; edi - 㪠§ â¥«ì ­  ­ ©¤¥­ãî áâபã
align 4
proc get_string_by_ind, str:dword, ind:dword
push eax ebx ecx
	mov edi,[str]
	mov ebx,[ind]
	xor al,al ;0 - ᨬ¢®« ª®­æ  áâப¨
	@@:
		cmp ebx,0
		jle @f ;¥á«¨ ­ ©¤¥­  áâப  á 㪠§ ­­ë¬ ¨­¤¥ªá®¬
		xor ecx,ecx
		dec ecx ;ecx - ç¨á«® ¯à®á¬ âਢ ¥¬ëå ¡ ©â
		cld
		repne scasb ;¨é¥¬ ª®­¥æ áâப¨ (al=0)
		cmp byte[edi],0
		je @f ;¥á«¨ á«¥¤ãî饩 áâப¨ ­¥â ¢ë室 ¨§ 横« 
		dec ebx
		jmp @b
	@@:
pop ecx ebx eax
	ret
endp

align 4
proc mem_clear, mem:dword, len:dword
	push eax ecx edi
	cld
	xor al,al
	mov edi, dword[mem]
	mov ecx, dword[len]
	repne stosb
	pop edi ecx eax
	ret
endp

align 4
proc str_cat, str1:dword, str2:dword
	push eax ecx edi esi
	mov esi,dword[str2]
	stdcall str_len,esi
	mov ecx,eax
	inc ecx
	mov edi,dword[str1]
	stdcall str_len,edi
	add edi,eax
	cld
	repne movsb
	pop esi edi ecx eax
	ret
endp

align 4
proc str_cat_value, str1:dword, value:dword
	pushad
	mov edi,[str1]
	stdcall str_len,edi
	add edi,eax
	mov eax,[value]
	call tl_convert_to_str
	popad
	ret
endp

;output:
; eax = strlen
align 4
proc str_len, str1:dword
	mov eax,[str1]
	@@:
		cmp byte[eax],0
		je @f
		inc eax
		jmp @b
	@@:
	sub eax,[str1]
	ret
endp

;input:
; eax = value
; edi = string buffer
align 4
tl_convert_to_str:
	pushad
	stdcall mem_clear,edi,12
	call .str
	popad
	ret

align 4
.str:
	mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
		;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢室­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®© 
	cmp eax,ecx  ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
	jb @f
		xor edx,edx ;®ç¨áâ¨âì edx
		div ecx     ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
		push edx    ;¯®«®¦¨âì ¢ á⥪
		;dec edi    ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
		call .str   ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
		pop eax
	@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
	or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  祬 ¤¢¥ ¢ëè¥ 
	stosb	    ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
	ret