Example #1
0
FindInFilesDialog::FindInFilesDialog() {

	set_custom_minimum_size(Size2(500 * EDSCALE, 0));
	set_title(TTR("Find in Files"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
	add_child(vbc);

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);
	vbc->add_child(gc);

	Label *find_label = memnew(Label);
	find_label->set_text(TTR("Find:"));
	gc->add_child(find_label);

	_search_text_line_edit = memnew(LineEdit);
	_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
	_search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
	_search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
	gc->add_child(_search_text_line_edit);

	gc->add_child(memnew(Control)); // Space to maintain the grid aligned.

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		_whole_words_checkbox = memnew(CheckBox);
		_whole_words_checkbox->set_text(TTR("Whole Words"));
		hbc->add_child(_whole_words_checkbox);

		_match_case_checkbox = memnew(CheckBox);
		_match_case_checkbox->set_text(TTR("Match Case"));
		hbc->add_child(_match_case_checkbox);

		gc->add_child(hbc);
	}

	Label *folder_label = memnew(Label);
	folder_label->set_text(TTR("Folder:"));
	gc->add_child(folder_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *prefix_label = memnew(Label);
		prefix_label->set_text("res://");
		hbc->add_child(prefix_label);

		_folder_line_edit = memnew(LineEdit);
		_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_folder_line_edit);

		Button *folder_button = memnew(Button);
		folder_button->set_text("...");
		folder_button->connect("pressed", this, "_on_folder_button_pressed");
		hbc->add_child(folder_button);

		_folder_dialog = memnew(FileDialog);
		_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
		_folder_dialog->connect("dir_selected", this, "_on_folder_selected");
		add_child(_folder_dialog);

		gc->add_child(hbc);
	}

	Label *filter_label = memnew(Label);
	filter_label->set_text(TTR("Filters:"));
	gc->add_child(filter_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		// TODO: Unhardcode this.
		Vector<String> exts;
		exts.push_back("gd");
		if (Engine::get_singleton()->has_singleton("GodotSharp"))
			exts.push_back("cs");
		exts.push_back("shader");

		for (int i = 0; i < exts.size(); ++i) {
			CheckBox *cb = memnew(CheckBox);
			cb->set_text(exts[i]);
			cb->set_pressed(true);
			hbc->add_child(cb);
			_filters.push_back(cb);
		}

		gc->add_child(hbc);
	}

	_find_button = add_button(TTR("Find..."), false, "find");
	_find_button->set_disabled(true);

	_replace_button = add_button(TTR("Replace..."), false, "replace");
	_replace_button->set_disabled(true);

	Button *cancel_button = get_ok();
	cancel_button->set_text(TTR("Cancel"));
}
EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {

	HBoxContainer *hb = memnew(HBoxContainer);
	add_child(hb);
	icon = memnew(TextureRect);
	hb->add_child(icon);

	VBoxContainer *vb = memnew(VBoxContainer);
	hb->add_child(vb);
	vb->set_h_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *title_hb = memnew(HBoxContainer);
	vb->add_child(title_hb);
	title = memnew(Label);
	title_hb->add_child(title);
	title->set_h_size_flags(SIZE_EXPAND_FILL);

	dismiss = memnew(TextureButton);
	dismiss->connect("pressed", this, "_close");
	title_hb->add_child(dismiss);

	title->set_clip_text(true);

	vb->add_spacer();

	status = memnew(Label(TTR("Idle")));
	vb->add_child(status);
	status->add_color_override("font_color", Color(0.5, 0.5, 0.5));
	progress = memnew(ProgressBar);
	vb->add_child(progress);

	HBoxContainer *hb2 = memnew(HBoxContainer);
	vb->add_child(hb2);
	hb2->add_spacer();

	install = memnew(Button);
	install->set_text(TTR("Install"));
	install->set_disabled(true);
	install->connect("pressed", this, "_install");

	retry = memnew(Button);
	retry->set_text(TTR("Retry"));
	retry->connect("pressed", this, "_make_request");

	hb2->add_child(retry);
	hb2->add_child(install);
	set_custom_minimum_size(Size2(250, 0));

	download = memnew(HTTPRequest);
	add_child(download);
	download->connect("request_completed", this, "_http_download_completed");
	download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));

	download_error = memnew(AcceptDialog);
	add_child(download_error);
	download_error->set_title(TTR("Download Error"));

	asset_installer = memnew(EditorAssetInstaller);
	add_child(asset_installer);

	prev_status = -1;

	external_install = false;
}
Example #3
0
ResourcesDock::ResourcesDock(EditorNode *p_editor) {

	editor=p_editor;

	VBoxContainer *vbc = this;

	HBoxContainer *hbc = memnew( HBoxContainer );
	vbc->add_child(hbc);


	Button *b;
	b = memnew( ToolButton );
	b->set_tooltip("Create New Resource");
	b->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW));
	hbc->add_child( b );
	button_new=b;

	b = memnew( ToolButton );
	b->set_tooltip("Open Resource");
	b->connect("pressed",this,"_tool_selected",make_binds(TOOL_OPEN));
	hbc->add_child( b );
	button_open=b;

	MenuButton *mb = memnew( MenuButton );
	mb->set_tooltip("Save Resource");
	mb->get_popup()->add_item("Save Resource",TOOL_SAVE);
	mb->get_popup()->add_item("Save Resource As..",TOOL_SAVE_AS);
	mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
	hbc->add_child( mb );
	button_save=mb;

	hbc->add_spacer();

	mb = memnew( MenuButton );
	mb->set_tooltip("Resource Tools");
	mb->get_popup()->add_item("Make Local",TOOL_MAKE_LOCAL);
	mb->get_popup()->add_item("Copy",TOOL_COPY);
	mb->get_popup()->add_item("Paste",TOOL_PASTE);
	mb->get_popup()->connect("item_pressed",this,"_tool_selected" );
	hbc->add_child( mb );
	button_tools=mb;

	resources = memnew( Tree );
	vbc->add_child(resources);
	resources->set_v_size_flags(SIZE_EXPAND_FILL);
	resources->create_item(); //root
	resources->set_hide_root(true);
	resources->connect("cell_selected",this,"_resource_selected");
	resources->connect("button_pressed",this,"_delete");

	create_dialog = memnew( CreateDialog );
	add_child(create_dialog);
	create_dialog->set_base_type("Resource");
	create_dialog->connect("create",this,"_create");
	accept = memnew (AcceptDialog);
	add_child(accept);

	file = memnew( FileDialog );
	add_child(file);
	file->connect("file_selected",this,"_file_action");


	block_add=false;
}
Example #4
0
ProjectManager::ProjectManager() {

	// load settings
	if (!EditorSettings::get_singleton())
		EditorSettings::create();


	EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came

	{
		int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode");
		if (dpi_mode==0) {
			editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 );
		} else if (dpi_mode==1) {
			editor_set_scale(0.75);
		} else if (dpi_mode==2) {
			editor_set_scale(1.0);
		} else if (dpi_mode==3) {
			editor_set_scale(1.5);
		} else if (dpi_mode==4) {
			editor_set_scale(2.0);
		}
	}

	FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));

	set_area_as_parent_rect();
	set_theme(create_editor_theme());

	gui_base = memnew( Control );
	add_child(gui_base);
	gui_base->set_area_as_parent_rect();
	gui_base->set_theme(create_custom_theme());

	Panel *panel = memnew( Panel );
	gui_base->add_child(panel);
	panel->set_area_as_parent_rect();

	VBoxContainer *vb = memnew( VBoxContainer );
	panel->add_child(vb);
	vb->set_area_as_parent_rect(20*EDSCALE);
	vb->set_margin(MARGIN_TOP,4*EDSCALE);
	vb->set_margin(MARGIN_BOTTOM,4*EDSCALE);
	vb->add_constant_override("separation",15*EDSCALE);

	String cp;
	cp.push_back(0xA9);
	cp.push_back(0);
	OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2016 Juan Linietsky, Ariel Manzur.");

	HBoxContainer *top_hb = memnew( HBoxContainer);
	vb->add_child(top_hb);
	CenterContainer *ccl = memnew( CenterContainer );
	Label *l = memnew( Label );
	l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
	l->add_font_override("font", gui_base->get_font("doc","EditorFonts"));
	ccl->add_child(l);
	top_hb->add_child(ccl);
	top_hb->add_spacer();
	l = memnew( Label );
	l->set_text("v" VERSION_MKSTRING);
	//l->add_font_override("font",get_font("bold","Fonts"));
	l->set_align(Label::ALIGN_CENTER);
	top_hb->add_child(l);
	//vb->add_child(memnew(HSeparator));
	//vb->add_margin_child("\n",memnew(Control));

	tabs = memnew( TabContainer );
	vb->add_child(tabs);
	tabs->set_v_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *tree_hb = memnew( HBoxContainer);
	projects_hb = tree_hb;

	projects_hb->set_name(TTR("Project List"));

	tabs->add_child(tree_hb);

	VBoxContainer *search_tree_vb = memnew(VBoxContainer);
	search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL);
	tree_hb->add_child(search_tree_vb);

	HBoxContainer *search_box = memnew(HBoxContainer);
	search_box->add_spacer(true);
	project_filter = memnew(ProjectListFilter);
	search_box->add_child(project_filter);
	project_filter->connect("filter_changed", this, "_load_recent_projects");
	project_filter->set_custom_minimum_size(Size2(250,10));
	search_tree_vb->add_child(search_box);

	PanelContainer *pc = memnew( PanelContainer);
	pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree"));
	search_tree_vb->add_child(pc);
	pc->set_v_size_flags(SIZE_EXPAND_FILL);

	scroll = memnew( ScrollContainer );
	pc->add_child(scroll);
	scroll->set_enable_h_scroll(false);

	VBoxContainer *tree_vb = memnew( VBoxContainer);
	tree_hb->add_child(tree_vb);
	scroll_childs = memnew( VBoxContainer );
	scroll_childs->set_h_size_flags(SIZE_EXPAND_FILL);
	scroll->add_child(scroll_childs);

	//HBoxContainer *hb = memnew( HBoxContainer );
	//vb->add_child(hb);

	Button *open = memnew( Button );
	open->set_text(TTR("Edit"));
	tree_vb->add_child(open);
	open->connect("pressed", this,"_open_project");
	open_btn=open;

	Button *run = memnew( Button );
	run->set_text(TTR("Run"));
	tree_vb->add_child(run);
	run->connect("pressed", this,"_run_project");
	run_btn=run;

	tree_vb->add_child(memnew( HSeparator ));

	Button *scan = memnew( Button );
	scan->set_text(TTR("Scan"));
	tree_vb->add_child(scan);
	scan->connect("pressed", this,"_scan_projects");

	tree_vb->add_child(memnew( HSeparator ));

	scan_dir = memnew( FileDialog );
	scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM);
	scan_dir->set_mode(FileDialog::MODE_OPEN_DIR);
	scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden
	scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") );
	gui_base->add_child(scan_dir);
	scan_dir->connect("dir_selected",this,"_scan_begin");


	Button* create = memnew( Button );
	create->set_text(TTR("New Project"));
	tree_vb->add_child(create);
	create->connect("pressed", this,"_new_project");

	Button* import = memnew( Button );
	import->set_text(TTR("Import"));
	tree_vb->add_child(import);
	import->connect("pressed", this,"_import_project");


	Button* erase = memnew( Button );
	erase->set_text(TTR("Remove"));
	tree_vb->add_child(erase);
	erase->connect("pressed", this,"_erase_project");
	erase_btn=erase;


	tree_vb->add_spacer();


	if (StreamPeerSSL::is_available()) {
		asset_library = memnew( EditorAssetLibrary(true) );
		asset_library->set_name("Templates");
		tabs->add_child(asset_library);
		asset_library->connect("install_asset",this,"_install_project");
	} else {
		WARN_PRINT("Asset Library not available, as it requires SSL to work.");
	}


	CenterContainer *cc = memnew( CenterContainer );
	Button * cancel = memnew( Button );
	cancel->set_text(TTR("Exit"));
	cancel->set_custom_minimum_size(Size2(100,1)*EDSCALE);
	cc->add_child(cancel);
	cancel->connect("pressed", this,"_exit_dialog");
	vb->add_child(cc);

	//

	erase_ask = memnew( ConfirmationDialog );
	erase_ask->get_ok()->set_text(TTR("Remove"));
	erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm");

	gui_base->add_child(erase_ask);

	multi_open_ask = memnew( ConfirmationDialog );
	multi_open_ask->get_ok()->set_text(TTR("Edit"));
	multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm");

	gui_base->add_child(multi_open_ask);

	multi_run_ask = memnew( ConfirmationDialog );
	multi_run_ask->get_ok()->set_text(TTR("Run"));
	multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm");

	gui_base->add_child(multi_run_ask);

	multi_scan_ask = memnew( ConfirmationDialog );
	multi_scan_ask->get_ok()->set_text(TTR("Scan"));

	gui_base->add_child(multi_scan_ask);

	OS::get_singleton()->set_low_processor_usage_mode(true);

	npdialog = memnew( NewProjectDialog );
	gui_base->add_child(npdialog);

	npdialog->connect("project_created", this,"_load_recent_projects");
	_load_recent_projects();

	if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) {
		_scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") );
	}

	//get_ok()->set_text("Open");
	//get_ok()->set_text("Exit");

	last_clicked = "";

	SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
}
Example #5
0
void ProjectManager::_load_recent_projects() {

	ProjectListFilter::FilterOption filter_option = project_filter->get_filter_option();
	String search_term = project_filter->get_search_term();

	while(scroll_childs->get_child_count()>0) {
		memdelete( scroll_childs->get_child(0));
	}

	Map<String, String> selected_list_copy = selected_list;

	List<PropertyInfo> properties;
	EditorSettings::get_singleton()->get_property_list(&properties);

	Color font_color = gui_base->get_color("font_color","Tree");

	List<ProjectItem> projects;
	List<ProjectItem> favorite_projects;

	for(List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) {

		String _name = E->get().name;
		if (!_name.begins_with("projects/") && !_name.begins_with("favorite_projects/"))
			continue;

		String path = EditorSettings::get_singleton()->get(_name);
		if (filter_option == ProjectListFilter::FILTER_PATH && search_term!="" && path.findn(search_term)==-1)
			continue;

		String project = _name.get_slice("/",1);
		String conf=path.plus_file("engine.cfg");
		bool favorite = (_name.begins_with("favorite_projects/"))?true:false;

		uint64_t last_modified = 0;
		if (FileAccess::exists(conf)) {
			last_modified = FileAccess::get_modified_time(conf);

			String fscache = path.plus_file(".fscache");
			if (FileAccess::exists(fscache)) {
				uint64_t cache_modified = FileAccess::get_modified_time(fscache);
				if ( cache_modified > last_modified )
					last_modified = cache_modified;
			}

			ProjectItem item(project, path, conf, last_modified, favorite);
			if (favorite)
				favorite_projects.push_back(item);
			else
				projects.push_back(item);
		} else {
			//project doesn't exist on disk but it's in the XML settings file
			EditorSettings::get_singleton()->erase(_name); //remove it
		}
	}

	projects.sort();
	favorite_projects.sort();

	for(List<ProjectItem>::Element *E=projects.front();E;) {
		List<ProjectItem>::Element *next = E->next();
		if (favorite_projects.find(E->get()) != NULL)
			projects.erase(E->get());
		E=next;
	}
	for(List<ProjectItem>::Element *E=favorite_projects.back();E;E=E->prev()) {
		projects.push_front(E->get());
	}

	Ref<Texture> favorite_icon = get_icon("Favorites","EditorIcons");

	for(List<ProjectItem>::Element *E=projects.front();E;E=E->next()) {

		ProjectItem &item = E->get();
		String project = item.project;
		String path = item.path;
		String conf = item.conf;
		bool is_favorite = item.favorite;

		Ref<ConfigFile> cf = memnew( ConfigFile );
		Error err = cf->load(conf);
		ERR_CONTINUE(err!=OK);


		String project_name=TTR("Unnamed Project");

		if (cf->has_section_key("application","name")) {
			project_name = static_cast<String>(cf->get_value("application","name")).xml_unescape();
		}

		if (filter_option==ProjectListFilter::FILTER_NAME && search_term!="" && project_name.findn(search_term)==-1)
			continue;

		Ref<Texture> icon;
		if (cf->has_section_key("application","icon")) {
			String appicon = cf->get_value("application","icon");
			if (appicon!="") {
				Image img;
				Error err = img.load(appicon.replace_first("res://",path+"/"));
				if (err==OK) {

					img.resize(64,64);
					Ref<ImageTexture> it = memnew( ImageTexture );
					it->create_from_image(img);
					icon=it;
				}
			}
		}

		if (icon.is_null()) {
			icon=get_icon("DefaultProjectIcon","EditorIcons");
		}

		String main_scene;
		if (cf->has_section_key("application","main_scene")) {
			main_scene = cf->get_value("application","main_scene");
		}

		selected_list_copy.erase(project);

		HBoxContainer *hb = memnew( HBoxContainer );
		hb->set_meta("name",project);
		hb->set_meta("main_scene",main_scene);
		hb->set_meta("favorite",is_favorite);
		hb->connect("draw",this,"_panel_draw",varray(hb));
		hb->connect("input_event",this,"_panel_input",varray(hb));
		hb->add_constant_override("separation",10*EDSCALE);

		VBoxContainer *favorite_box = memnew( VBoxContainer );
		TextureButton *favorite = memnew( TextureButton );
		favorite->set_normal_texture(favorite_icon);
		if (!is_favorite)
			favorite->set_opacity(0.2);
		favorite->set_v_size_flags(SIZE_EXPAND);
		favorite->connect("pressed",this,"_favorite_pressed",varray(hb));
		favorite_box->add_child(favorite);
		hb->add_child(favorite_box);

		TextureFrame *tf = memnew( TextureFrame );
		tf->set_texture(icon);
		hb->add_child(tf);

		VBoxContainer *vb = memnew(VBoxContainer);
		hb->add_child(vb);
		Control *ec = memnew( Control );
		ec->set_custom_minimum_size(Size2(0,1));
		vb->add_child(ec);
		Label *title = memnew( Label(project_name) );
		title->add_font_override("font", gui_base->get_font("large","Fonts"));
		title->add_color_override("font_color",font_color);
		vb->add_child(title);
		Label *fpath = memnew( Label(path) );
		vb->add_child(fpath);
		fpath->set_opacity(0.5);
		fpath->add_color_override("font_color",font_color);

		scroll_childs->add_child(hb);
	}

	for (Map<String,String>::Element *E = selected_list_copy.front();E;E = E->next()) {
		String key = E->key();
		selected_list.erase(key);
	}

	scroll->set_v_scroll(0);

	_update_project_buttons();

	EditorSettings::get_singleton()->save();

	tabs->set_current_tab(0);
}
InterfaceMini::InterfaceMini(Window *p_window,Mixer *p_mixer,ConfigApi *p_config) : tracker(p_mixer) {

	config=p_config;

	window=p_window;
	//window->set_large_dialogs(true);
	
	MiniTheme::create(window->get_skin(),window->get_painter());
	
	VBoxContainer *vbc = new VBoxContainer;

	window->set_root_frame(vbc);
	window->key_unhandled_signal.connect( this, &InterfaceMini::main_key );
	vbc->set_separation( 0 );
	
	top=vbc->add( new VBoxContainer);
	
	top_bar=top->add( new HBoxContainer, 0 );

	
	file = top_bar->add( new MenuBox("Song.."), 0);
	file->add_item("New");
	file->add_item("Open..");
	file->add_item("Save");
	file->add_item("Save As..");
	file->add_separator();
	file->add_item("Export WAV");
	file->add_separator();
	file->add_item("Clean Up");
	file->add_separator();
	file->add_item("Quit");
	file->item_selected_signal.connect(this, &InterfaceMini::song_menu_selected );
	file->set_focus_mode( FOCUS_NONE );
	top_bar->add( new VSeparator,0);
	
	/* Tab Bar */
	
	tabs=top_bar->add( new TabBar, 0 );
	tabs->add_tab("Pat");
	tabs->add_tab("Smp");
	tabs->add_tab("Ins");
	tabs->add_tab("Var");
	tabs->set_focus_mode( FOCUS_NONE );
	tabs->set_tab_visible( 2, false );
	

//	top_bar->add( new Widget,1);
	
	top_bar->add( new VSeparator,0);
	settings=top_bar->add(new MenuBox("Setup"),0);
	settings->add_item("Audio Driver");
	settings->add_item("Software Mixer");
	settings->add_item("Keyboard");
	settings->add_item("InterfaceMini");
	settings->add_item("Default Paths");
	settings->item_selected_signal.connect( this, &InterfaceMini::config_menu_selected );
	settings->set_focus_mode( FOCUS_NONE );
	top_bar->add( new VSeparator );
	help=top_bar->add(new MenuBox("Help"),0);
	help->add_item("Command List");
	help->add_item("Skins");
	help->add_item("About");
	help->set_focus_mode( FOCUS_NONE );
	help->item_selected_signal.connect( this, &InterfaceMini::help_menu_selected );
	
	/*
	HBoxContainer *status_hb = top->add( new HBoxContainer, 0);
	status_label = status_hb->add(new Label("Stopped"),1);
	status_hb->add( new Label("Memory:  "), 0);
	memory_label=status_hb->add( new Label("0kb"), 0); */

	
	top->set_stylebox_override( window->get_skin()->get_stylebox(SB_TOP_STACK_FRAME) );
	
	
	main_stack=vbc->add( new StackContainer,1);
	
	
	tabs->tab_changed_signal.connect( main_stack, &StackContainer::raise );
	tabs->tab_changed_signal.connect( this, &InterfaceMini::screen_changed_to );
	tabs->pre_tab_changed_signal.connect( this, &InterfaceMini::pre_screen_changed_from );
	
	pattern_screen=main_stack->add( new PatternScreen(&tracker,true) );
	
	sample_screen=main_stack->add( new SampleScreen(&tracker,true) );
	
	instrument_screen = main_stack->add(new InstrumentScreen(&tracker,true));
	instrument_screen->sample_list_changed_signal.connect( sample_screen, &SampleScreen::update_components );
	
	
	variables_screen = main_stack->add(new VariablesScreen(&tracker,true));
	variables_screen->song_name_changed_signal.connect(this, &InterfaceMini::update_title_bar);
	
	variables_screen->instrument_mode_changed.connect( this, &InterfaceMini::check_instrument_visibility );
	
	set_default_keybinds();
	
	main_stack->set_stylebox_override(window->get_skin()->get_stylebox(SB_MAIN_STACK_FRAME));

/*	default_octave->get_range()->set( (int)tracker.editor->get_default_octave() ); */
	
	for (int i=0;i<SCREEN_MAX;i++)
		old_focus[i]=0;		
	
	
	file_dialog = new FileDialog(window);
	file_dialog->file_activated_signal.connect( this, &InterfaceMini::song_file_callback );
	
	/* New Song Dialog */
	
	new_song.window=new Window(window,Window::MODE_POPUP,Window::SIZE_CENTER);
	
	WindowBox *new_song_vb = new WindowBox("New Song");
	new_song.window->set_root_frame( new_song_vb );
	MarginGroup *new_song_mg = new_song_vb->add(new MarginGroup("New Song"),0);
	
	new_song.patterns = new_song_vb->add( new CheckButton("Keep Patterns"),0);
	new_song.instruments = new_song_vb->add( new CheckButton("Keep Instruments"),0);
	new_song.samples = new_song_vb->add( new CheckButton("Keep Samples"),0);
	new_song.variables = new_song_vb->add( new CheckButton("Keep Variables"),0);
	
	
	new_song_vb->add( new CenterContainer, 0 )->set( new Button("Proceed"))->pressed_signal.connect(this,&InterfaceMini::new_song_accept);
	
	/* CleanUp Dialog */
	
	cleanup.window=new Window(window,Window::MODE_POPUP,Window::SIZE_CENTER);
	
	WindowBox *cleanup_vb = new WindowBox("Clean Up");
	cleanup.window->set_root_frame( cleanup_vb );
	
	cleanup.patterns = cleanup_vb->add( new CheckButton("Unused Patterns"),0);
	cleanup.instruments = cleanup_vb->add( new CheckButton("Unused Instruments"),0);
	cleanup.samples = cleanup_vb->add( new CheckButton("Unused Samples"),0);
	cleanup.orders = cleanup_vb->add( new CheckButton("Unused Orders"),0);
	cleanup_vb->add( new HSeparator,0);
	cleanup.def_vol = cleanup_vb->add( new CheckButton("Reset Default Volumes"),0);
	cleanup.def_pan = cleanup_vb->add( new CheckButton("Reset Default Pannings"),0);
	
	cleanup_vb->add( new CenterContainer, 0 )->set( new Button("Remove"))->pressed_signal.connect(this,&InterfaceMini::cleanup_accept);
	
	
	/* Quit Menu */
	quit=false;
	
	confirm_quit_window=new Window(window,Window::MODE_POPUP,Window::SIZE_CENTER);
	WindowBox *quit_vb = new WindowBox("Quit");
	
	confirm_quit_window->set_root_frame( quit_vb );
	quit_vb->add( new Label("Really Quit?"),0);
	quit_vb->add( new CenterContainer, 0)->set( new Button("Exit") )->pressed_signal.connect( this, &InterfaceMini::quit_accept );
	
	sound_driver_dialog = new SoundDriverDialog(window,config);	
	mixer_dialog = new MixerDialog(window,config);
	kb_dialog = new KeyboardDialog(window,config);
	ui_dialog = new InterfaceSettingsDialog(window,config);
	ui_dialog->repaint_interval_changed_signal.connect(this, &InterfaceMini::ui_repaint_interval_changed );
	uihelp_dialog = new InterfaceHelp(window,HELP_PATTERN_KEYS);
	skins_dialog = new InterfaceHelp(window,HELP_SKINS);
	wav_saver = new WavSaverDialog(window,&tracker);
	path_dialog = new PathsDialog(window,&paths,config);
	path_dialog->paths_changed_signal.connect( this, &InterfaceMini::paths_changed );
	
	
	window->get_timer()->create_timer( Method(this, &InterfaceMini::interface_update_timer_callback ),60 );
	pattern_screen->get_pattern_editor()->instrument_changed_signal.connect(this, &InterfaceMini::instrument_mask_changed );
	sample_screen->instrument_changed_signal.connect(this, &InterfaceMini::instrument_mask_changed );
	
	error_msg = new MessageBox(window);
	about_msg = new MessageBox(window);
	
	window->skin_changed_signal.connect(this,&InterfaceMini::skin_changed);
	update_title_bar();
	setup_logos();
	
	sample_screen->instrument_list_changed_signal.connect( instrument_screen, &InstrumentScreen::update_components );
	status_override_time=0;

}
Example #7
0
SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data)  {

	editor=p_editor;
	edited_scene=NULL;
	editor_data=&p_editor_data;
	editor_selection=p_editor_selection;
	scene_root=p_scene_root;

	VBoxContainer *vbc = this;

	HBoxContainer *hbc_top = memnew( HBoxContainer );
	vbc->add_child(hbc_top);

	ToolButton *tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false));
	tb->set_tooltip("Add/Create a New Node\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_NEW]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false));
	tb->set_tooltip("Instance a scene file as a Node.");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_INSTANCE]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPLACE, false));
	tb->set_tooltip("Replace a Node by Another Node Type");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_REPLACE]=tb;

	hbc_top->add_spacer();

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CONNECT, false));
	tb->set_tooltip("Edit the Node Connections");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_CONNECT]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_GROUP, false));
	tb->set_tooltip("Edit the Node Groups");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_GROUP]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false));
	tb->set_tooltip("Edit/Create the Node Script");
	hbc_top->add_child(tb);
	tool_buttons[TOOL_SCRIPT]=tb;


	scene_tree = memnew( SceneTreeEditor(false,true,true ));
	vbc->add_child(scene_tree);
	scene_tree->set_v_size_flags(SIZE_EXPAND|SIZE_FILL);

	scene_tree->connect("node_selected", this,"_node_selected",varray(),CONNECT_DEFERRED);
	scene_tree->connect("node_renamed", this,"_node_renamed",varray(),CONNECT_DEFERRED);
	scene_tree->connect("node_prerename", this,"_node_prerenamed");
	scene_tree->connect("open",this,"_load_request");
	scene_tree->connect("open_script",this,"_script_open_request");
	scene_tree->set_undo_redo(&editor_data->get_undo_redo());
	scene_tree->set_editor_selection(editor_selection);

	HBoxContainer *hbc_bottom = memnew( HBoxContainer );
	vbc->add_child(hbc_bottom);


	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_UP, false));
	tb->set_tooltip("Move Node Up\n("+keycode_get_string(KEY_MASK_CMD|KEY_UP)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_MOVE_UP]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_DOWN, false));
	tb->set_tooltip("Move Node Down\n("+keycode_get_string(KEY_MASK_CMD|KEY_DOWN)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_MOVE_DOWN]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_DUPLICATE, false));
	tb->set_tooltip("Duplicate Selected Node(s)\n("+keycode_get_string(KEY_MASK_CMD|KEY_D)+")");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_DUPLICATE]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPARENT, false));
	tb->set_tooltip("Reparent Selected Node(s)");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_REPARENT]=tb;

	hbc_bottom->add_spacer();

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MULTI_EDIT, false));
	tb->set_tooltip("Multi-Edit Selected Nodes");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_MULTI_EDIT]=tb;

	tb = memnew( ToolButton );
	tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ERASE, false));
	tb->set_tooltip("Erase Selected Node(s)");
	hbc_bottom->add_child(tb);
	tool_buttons[TOOL_ERASE]=tb;

	create_dialog = memnew( CreateDialog );
	create_dialog->set_base_type("Node");
	add_child(create_dialog);
	create_dialog->connect("create",this,"_create");

	groups_editor = memnew( GroupsEditor );
	add_child(groups_editor);
	groups_editor->set_undo_redo(&editor_data->get_undo_redo());
	connect_dialog = memnew( ConnectionsDialog(p_editor) );
	add_child(connect_dialog);
	connect_dialog->set_undoredo(&editor_data->get_undo_redo());
	script_create_dialog = memnew( ScriptCreateDialog );
	add_child(script_create_dialog);
	script_create_dialog->connect("script_created",this,"_script_created");
	reparent_dialog = memnew( ReparentDialog );
	add_child(reparent_dialog);
	reparent_dialog->connect("reparent",this,"_node_reparent");

	accept = memnew( AcceptDialog );
	add_child(accept);

	file = memnew( EditorFileDialog );
	add_child(file);
	file->connect("file_selected",this,"instance");
	set_process_unhandled_key_input(true);

	delete_dialog = memnew( ConfirmationDialog );
	add_child(delete_dialog);
	delete_dialog->connect("confirmed",this,"_delete_confirm");
	import_subscene_dialog = memnew( EditorSubScene );
	add_child(import_subscene_dialog);
	import_subscene_dialog->connect("subscene_selected",this,"_import_subscene");

	first_enter=true;


}
Example #8
0
ExportTemplateManager::ExportTemplateManager() {

	VBoxContainer *main_vb = memnew(VBoxContainer);
	add_child(main_vb);

	current_hb = memnew(HBoxContainer);
	main_vb->add_margin_child(TTR("Current Version:"), current_hb, false);

	installed_scroll = memnew(ScrollContainer);
	main_vb->add_margin_child(TTR("Installed Versions:"), installed_scroll, true);

	installed_vb = memnew(VBoxContainer);
	installed_scroll->add_child(installed_vb);
	installed_scroll->set_enable_v_scroll(true);
	installed_scroll->set_enable_h_scroll(false);
	installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);

	get_cancel()->set_text(TTR("Close"));
	get_ok()->set_text(TTR("Install From File"));

	remove_confirm = memnew(ConfirmationDialog);
	remove_confirm->set_title(TTR("Remove Template"));
	add_child(remove_confirm);
	remove_confirm->connect("confirmed", this, "_uninstall_template_confirm");

	template_open = memnew(FileDialog);
	template_open->set_title(TTR("Select template file"));
	template_open->add_filter("*.tpz ; Godot Export Templates");
	template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
	template_open->set_mode(FileDialog::MODE_OPEN_FILE);
	template_open->connect("file_selected", this, "_install_from_file");
	add_child(template_open);

	set_title(TTR("Export Template Manager"));
	set_hide_on_ok(false);

	request_mirror = memnew(HTTPRequest);
	add_child(request_mirror);
	request_mirror->connect("request_completed", this, "_http_download_mirror_completed");

	download_templates = memnew(HTTPRequest);
	add_child(download_templates);
	download_templates->connect("request_completed", this, "_http_download_templates_completed");

	template_downloader = memnew(AcceptDialog);
	template_downloader->set_title(TTR("Download Templates"));
	template_downloader->get_ok()->set_text(TTR("Close"));
	add_child(template_downloader);

	VBoxContainer *vbc = memnew(VBoxContainer);
	template_downloader->add_child(vbc);
	ScrollContainer *sc = memnew(ScrollContainer);
	sc->set_custom_minimum_size(Size2(400, 200) * EDSCALE);
	vbc->add_margin_child(TTR("Select mirror from list: "), sc);
	template_list = memnew(VBoxContainer);
	sc->add_child(template_list);
	sc->set_enable_v_scroll(true);
	sc->set_enable_h_scroll(false);
	template_list_state = memnew(Label);
	vbc->add_child(template_list_state);
	template_download_progress = memnew(ProgressBar);
	vbc->add_child(template_download_progress);

	update_countdown = 0;
}
Example #9
0
FileDialog::FileDialog() {

	show_hidden_files=default_show_hidden_files;

	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);


	mode=MODE_SAVE_FILE;
	set_title(RTR("Save a File"));

	dir = memnew(LineEdit);
	HBoxContainer *pathhb = memnew( HBoxContainer );
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	refresh = memnew( ToolButton );
	refresh->connect("pressed",this,"_update_file_list");
	pathhb->add_child(refresh);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text(RTR("Create Folder"));
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);

	vbc->add_margin_child(RTR("Path:"),pathhb);

	tree = memnew(Tree);
	tree->set_hide_root(true);
	vbc->add_margin_child(RTR("Directories & Files:"),tree,true);

	file = memnew(LineEdit);
	//add_child(file);
	vbc->add_margin_child(RTR("File:"),file);


	filter = memnew( OptionButton );
	//add_child(filter);
	vbc->add_margin_child(RTR("Filter:"),filter);
	filter->set_clip_text(true);//too many extensions overflow it

	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	access=ACCESS_RESOURCES;
	_update_drives();


	connect("confirmed", this,"_action_pressed");
	//cancel->connect("pressed", this,"_cancel_pressed");
	tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED);
	tree->connect("item_activated", this,"_tree_db_selected",varray());
	dir->connect("text_entered", this,"_dir_entered");
	file->connect("text_entered", this,"_file_entered");
	filter->connect("item_selected", this,"_filter_selected");


	confirm_save = memnew( ConfirmationDialog );
	confirm_save->set_as_toplevel(true);
	add_child(confirm_save);


	confirm_save->connect("confirmed", this,"_save_confirm_pressed");

	makedialog = memnew( ConfirmationDialog );
	makedialog->set_title(RTR("Create Folder"));
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);

	makedirname = memnew( LineEdit );
	makevb->add_margin_child(RTR("Name:"),makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text(RTR("Could not create folder."));
	add_child(mkdirerr);

	exterr = memnew( AcceptDialog );
	exterr->set_text(RTR("Must use a valid extension."));
	add_child(exterr);


	//update_file_list();
	update_filters();
	update_dir();

	set_hide_on_ok(false);
	vbox=vbc;


	invalidated=true;
	if (register_func)
		register_func(this);

}
Example #10
0
FindReplaceDialog::FindReplaceDialog() {

	set_self_modulate(Color(1,1,1,0.8));

	VBoxContainer *vb = memnew( VBoxContainer );
	add_child(vb);
	set_child_rect(vb);


	search_text = memnew( LineEdit );
	vb->add_margin_child(TTR("Search"),search_text);
	search_text->connect("text_entered", this,"_search_text_entered");
	//search_text->set_self_opacity(0.7);



	replace_label = memnew( Label);
	replace_label->set_text(TTR("Replace By"));
	vb->add_child(replace_label);
	replace_mc= memnew( MarginContainer);
	vb->add_child(replace_mc);

	replace_text = memnew( LineEdit );
	replace_text->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	replace_text->set_begin( Point2(15,132) );
	replace_text->set_end( Point2(15,135) );
	//replace_text->set_self_opacity(0.7);
	replace_mc->add_child(replace_text);


	replace_text->connect("text_entered", this,"_replace_text_entered");



	MarginContainer *opt_mg = memnew( MarginContainer );
	vb->add_child(opt_mg);
	VBoxContainer *svb = memnew( VBoxContainer);
	opt_mg->add_child(svb);

	svb ->add_child(memnew(Label));

	whole_words = memnew( CheckButton );
	whole_words->set_text(TTR("Whole Words"));
	svb->add_child(whole_words);

	case_sensitive = memnew( CheckButton );
	case_sensitive->set_text(TTR("Case Sensitive"));
	svb->add_child(case_sensitive);

	backwards = memnew( CheckButton );
	backwards->set_text(TTR("Backwards"));
	svb->add_child(backwards);

	opt_mg = memnew( MarginContainer );
	vb->add_child(opt_mg);
	VBoxContainer *rvb = memnew( VBoxContainer);
	opt_mg->add_child(rvb);
	replace_vb=rvb;
//	rvb ->add_child(memnew(HSeparator));
	rvb ->add_child(memnew(Label));

	prompt = memnew( CheckButton );
	prompt->set_text(TTR("Prompt On Replace"));
	rvb->add_child(prompt);
	prompt->connect("pressed", this,"_prompt_changed");

	selection_only = memnew( CheckButton );
	selection_only->set_text(TTR("Selection Only"));
	rvb->add_child(selection_only);


	int margin = get_constant("margin","Dialogs");
	int button_margin = get_constant("button_margin","Dialogs");

	skip = memnew( Button );
	skip->set_anchor( MARGIN_LEFT, ANCHOR_END );
	skip->set_anchor( MARGIN_TOP, ANCHOR_END );
	skip->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	skip->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
	skip->set_begin( Point2( 70, button_margin ) );
	skip->set_end( Point2(  10, margin ) );
	skip->set_text(TTR("Skip"));
	add_child(skip);
	skip->connect("pressed", this,"_skip_pressed");


	error_label = memnew( Label );
	error_label->set_align(Label::ALIGN_CENTER);
	error_label->add_color_override("font_color",Color(1,0.4,0.3));
	error_label->add_color_override("font_color_shadow",Color(0,0,0,0.2));
	error_label->add_constant_override("shadow_as_outline",1);

	vb->add_child(error_label);


	set_hide_on_ok(false);

}
Example #11
0
ScriptCreateDialog::ScriptCreateDialog() {

	/* DIALOG */

	/* Main Controls */

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);

	/* Error Messages Field */

	VBoxContainer *vb = memnew(VBoxContainer);

	HBoxContainer *hb = memnew(HBoxContainer);
	Label *l = memnew(Label);
	l->set_text(" - ");
	hb->add_child(l);
	error_label = memnew(Label);
	error_label->set_text(TTR("Error!"));
	error_label->set_align(Label::ALIGN_LEFT);
	hb->add_child(error_label);
	vb->add_child(hb);

	hb = memnew(HBoxContainer);
	l = memnew(Label);
	l->set_text(" - ");
	hb->add_child(l);
	path_error_label = memnew(Label);
	path_error_label->set_text(TTR("Error!"));
	path_error_label->set_align(Label::ALIGN_LEFT);
	hb->add_child(path_error_label);
	vb->add_child(hb);

	PanelContainer *pc = memnew(PanelContainer);
	pc->set_h_size_flags(Control::SIZE_FILL);
	pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
	pc->add_child(vb);

	/* Margins */

	Control *empty_h = memnew(Control);
	empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
	empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
	Control *empty_v = memnew(Control);
	empty_v->set_name("empty_v");
	empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));

	vb = memnew(VBoxContainer);
	vb->add_child(empty_h->duplicate());
	vb->add_child(gc);
	vb->add_child(empty_h->duplicate());
	vb->add_child(pc);
	vb->add_child(empty_h->duplicate());
	hb = memnew(HBoxContainer);
	hb->add_child(empty_v->duplicate());
	hb->add_child(vb);
	hb->add_child(empty_v->duplicate());

	memdelete(empty_h);
	memdelete(empty_v);

	add_child(hb);

	/* Language */

	language_menu = memnew(OptionButton);
	language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE);
	language_menu->set_h_size_flags(SIZE_EXPAND_FILL);
	l = memnew(Label);
	l->set_text(TTR("Language"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(language_menu);

	int default_lang = 0;
	for (int i = 0; i < ScriptServer::get_language_count(); i++) {

		String lang = ScriptServer::get_language(i)->get_name();
		language_menu->add_item(lang);
		if (lang == "GDScript") {
			default_lang = i;
		}
	}

	String last_selected_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
	if (last_selected_language != "") {
		for (int i = 0; i < language_menu->get_item_count(); i++) {
			if (language_menu->get_item_text(i) == last_selected_language) {
				language_menu->select(i);
				current_language = i;
				break;
			}
		}
	} else {
		language_menu->select(default_lang);
		current_language = default_lang;
	}

	language_menu->connect("item_selected", this, "_lang_changed");

	/* Inherits */

	hb = memnew(HBoxContainer);
	hb->set_h_size_flags(SIZE_EXPAND_FILL);
	parent_name = memnew(LineEdit);
	parent_name->connect("text_changed", this, "_parent_name_changed");
	parent_name->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(parent_name);
	parent_browse_button = memnew(Button);
	parent_browse_button->set_flat(true);
	parent_browse_button->connect("pressed", this, "_browse_path", varray(true));
	hb->add_child(parent_browse_button);
	l = memnew(Label);
	l->set_text(TTR("Inherits"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);
	is_browsing_parent = false;

	/* Class Name */

	class_name = memnew(LineEdit);
	class_name->connect("text_changed", this, "_class_name_changed");
	class_name->set_h_size_flags(SIZE_EXPAND_FILL);
	l = memnew(Label);
	l->set_text(TTR("Class Name"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(class_name);

	/* Templates */

	template_menu = memnew(OptionButton);
	l = memnew(Label);
	l->set_text(TTR("Template"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(template_menu);
	template_menu->connect("item_selected", this, "_template_changed");

	/* Built-in Script */

	internal = memnew(CheckButton);
	internal->connect("pressed", this, "_built_in_pressed");
	hb = memnew(HBoxContainer);
	hb->add_child(internal);
	l = memnew(Label);
	l->set_text(TTR("Built-in Script"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);

	/* Path */

	hb = memnew(HBoxContainer);
	file_path = memnew(LineEdit);
	file_path->connect("text_changed", this, "_path_changed");
	file_path->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(file_path);
	path_button = memnew(Button);
	path_button->set_flat(true);
	path_button->connect("pressed", this, "_browse_path", varray(false));
	hb->add_child(path_button);
	l = memnew(Label);
	l->set_text(TTR("Path"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);

	/* Dialog Setup */

	file_browse = memnew(EditorFileDialog);
	file_browse->connect("file_selected", this, "_file_selected");
	add_child(file_browse);
	get_ok()->set_text(TTR("Create"));
	alert = memnew(AcceptDialog);
	alert->set_as_minsize();
	alert->get_label()->set_autowrap(true);
	alert->get_label()->set_align(Label::ALIGN_CENTER);
	alert->get_label()->set_valign(Label::VALIGN_CENTER);
	alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE);
	add_child(alert);

	set_as_minsize();
	set_hide_on_ok(false);
	set_title(TTR("Attach Node Script"));

	is_parent_name_valid = false;
	is_class_name_valid = false;
	is_path_valid = false;

	has_named_classes = false;
	supports_built_in = false;
	can_inherit_from_file = false;
	is_built_in = false;

	is_new_script_created = true;
}
Example #12
0
ColorPicker::ColorPicker() :
	BoxContainer(true) {

	updating=true;
	edit_alpha=true;
	text_is_constructor = false;
	raw_mode_enabled=false;
	changing_color=false;
	screen=NULL;

	HBoxContainer *hb_smpl = memnew( HBoxContainer );
	btn_pick = memnew( ToolButton );
	btn_pick->connect("pressed",this,"_screen_pick_pressed");

	sample = memnew( TextureFrame );
	sample->set_h_size_flags(SIZE_EXPAND_FILL);
	sample->connect("draw",this,"_sample_draw");

	hb_smpl->add_child(sample);
	hb_smpl->add_child(btn_pick);
	add_child(hb_smpl);

	HBoxContainer *hb_edit = memnew( HBoxContainer );

	uv_edit= memnew ( TextureFrame );
	Image i(256, 256, false, Image::FORMAT_RGB);
	for (int y=0;y<256;y++)
		for (int x=0;x<256;x++)
			i.put_pixel(x,y,Color());
	Ref<ImageTexture> t;
	t.instance();
	t->create_from_image(i);
	uv_edit->set_texture(t);
	uv_edit->set_ignore_mouse(false);
	uv_edit->set_custom_minimum_size(Size2(256,256));
	uv_edit->connect("input_event", this, "_uv_input");
	Control *c= memnew( Control );
	uv_edit->add_child(c);
	c->set_area_as_parent_rect();
	c->set_stop_mouse(false);
	c->set_material(memnew ( CanvasItemMaterial ));
	Vector<Variant> args=Vector<Variant>();
	args.push_back(0);
	args.push_back(c);
	c->connect("draw",this,"_hsv_draw",args);

	add_child(hb_edit);
	w_edit= memnew( TextureFrame );
	i = Image(15, 256, false, Image::FORMAT_RGB);
	for (int y=0;y<256;y++)
		for (int x=0;x<15;x++)
			i.put_pixel(x,y,Color());
	Ref<ImageTexture> tw;
	tw.instance();
	tw->create_from_image(i);
	w_edit->set_texture(tw);
	w_edit->set_ignore_mouse(false);
	w_edit->set_custom_minimum_size(Size2(15,256));
	w_edit->connect("input_event", this, "_w_input");
	c= memnew( Control );
	w_edit->add_child(c);
	c->set_area_as_parent_rect();
	c->set_stop_mouse(false);
	c->set_material(memnew ( CanvasItemMaterial ));
	args.clear();
	args.push_back(1);
	args.push_back(c);
	c->connect("draw",this,"_hsv_draw",args);
	
	hb_edit->add_child(uv_edit);
	hb_edit->add_child(memnew( VSeparator ));
	hb_edit->add_child(w_edit);

	VBoxContainer *vbl = memnew( VBoxContainer );
	add_child(vbl);

	add_child(memnew( HSeparator ));

	VBoxContainer *vbr = memnew( VBoxContainer );
	add_child(vbr);
	vbr->set_h_size_flags(SIZE_EXPAND_FILL);
	const char* lt[4] = {"R","G","B","A"};

	for(int i=0;i<4;i++) {

		HBoxContainer *hbc = memnew( HBoxContainer );

		labels[i]=memnew( Label(lt[i]) );
		hbc->add_child(labels[i]);

		scroll[i]=memnew( HSlider );
		hbc->add_child(scroll[i]);

		values[i]=memnew( SpinBox );
		scroll[i]->share(values[i]);
		hbc->add_child(values[i]);


		scroll[i]->set_min(0);
		scroll[i]->set_page(0);
		scroll[i]->set_h_size_flags(SIZE_EXPAND_FILL);

		scroll[i]->connect("value_changed",this,"_value_changed");

		vbr->add_child(hbc);

	}

	HBoxContainer *hhb = memnew( HBoxContainer );
	
	btn_mode = memnew( CheckButton );
	btn_mode->set_text("RAW Mode");
	btn_mode->connect("toggled", this, "set_raw_mode");
	hhb->add_child(btn_mode);
	vbr->add_child(hhb);
	text_type = memnew( Button );
	text_type->set_flat(true);
	text_type->connect("pressed", this, "_text_type_toggled");
	hhb->add_child(text_type);

	c_text = memnew( LineEdit );
	hhb->add_child(c_text);
	c_text->connect("text_entered",this,"_html_entered");
	text_type->set_text("#");
	c_text->set_h_size_flags(SIZE_EXPAND_FILL);


	_update_controls();
	//_update_color();
	updating=false;

	uv_material.instance();
	Ref<Shader> s_uv = get_shader("uv_editor");
	uv_material->set_shader(s_uv);

	w_material.instance();
	
	Ref<Shader> s_w = get_shader("w_editor");
	w_material->set_shader(s_w);

	uv_edit->set_material(uv_material);
	w_edit->set_material(w_material);

	set_color(Color(1,1,1));

	i.create(256,20,false,Image::FORMAT_RGB);
	for (int y=0;y<20;y++)
		for(int x=0;x<256;x++)
			if ((x/4+y/4)%2)
				i.put_pixel(x,y,Color(1,1,1));
			else
				i.put_pixel(x,y,Color(0.6,0.6,0.6));
	Ref<ImageTexture> t_smpl;
	t_smpl.instance();
	t_smpl->create_from_image(i);
	sample->set_texture(t_smpl);

	HBoxContainer *bbc = memnew( HBoxContainer );
	add_child(bbc);

	preset = memnew( TextureFrame );
	bbc->add_child(preset);
	preset->set_ignore_mouse(false);
	preset->connect("input_event", this, "_preset_input");

	bt_add_preset = memnew ( Button );
	bt_add_preset->set_icon(get_icon("add_preset"));
	bt_add_preset->set_tooltip("Add current color as a preset");
	bt_add_preset->connect("pressed", this, "_add_preset_pressed");
	bbc->add_child(bt_add_preset);
}
EditorTextureImportDialog::EditorTextureImportDialog(EditorTextureImportPlugin* p_plugin, bool p_2d, bool p_atlas,bool p_large) {


	atlas=p_atlas;
	large=p_large;
	plugin=p_plugin;
	set_title("Import Textures");


	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);
	set_child_rect(vbc);


	VBoxContainer *source_vb=memnew(VBoxContainer);
	if (large)
		vbc->add_margin_child("Source Texture:",source_vb);
	else
		vbc->add_margin_child("Source Texture(s):",source_vb);

	HBoxContainer *hbc = memnew( HBoxContainer );
	source_vb->add_child(hbc);

	import_path = memnew( LineEdit );
	import_path->set_h_size_flags(SIZE_EXPAND_FILL);
	hbc->add_child(import_path);
	crop_source = memnew( CheckButton );
	crop_source->set_pressed(true);
	source_vb->add_child(crop_source);
	crop_source->set_text("Crop empty space.");
	if (!p_atlas)
		crop_source->hide();


	Button * import_choose = memnew( Button );
	import_choose->set_text(" .. ");
	hbc->add_child(import_choose);

	import_choose->connect("pressed", this,"_browse");

	hbc = memnew( HBoxContainer );
	vbc->add_margin_child("Target Path:",hbc);

	size = memnew( SpinBox );
	size->set_min(128);
	size->set_max(16384);

	if (p_atlas) {
		size->set_val(2048);
		vbc->add_margin_child("Max Texture size:",size);
	} else {
		size->set_val(256);
		vbc->add_margin_child("Cell Size:",size);
	}


	save_path = memnew( LineEdit );
	save_path->set_h_size_flags(SIZE_EXPAND_FILL);
	hbc->add_child(save_path);

	Button * save_choose = memnew( Button );
	save_choose->set_text(" .. ");
	hbc->add_child(save_choose);

	save_choose->connect("pressed", this,"_browse_target");

	file_select = memnew(EditorFileDialog);
	file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
	add_child(file_select);
	if (!large)
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
	else
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
	file_select->connect("files_selected", this,"_choose_files");
	file_select->connect("file_selected", this,"_choose_file");

	save_file_select = memnew(EditorFileDialog);
	save_file_select->set_access(EditorFileDialog::ACCESS_RESOURCES);
	add_child(save_file_select);
	save_file_select->set_mode(EditorFileDialog::MODE_SAVE_FILE);
	save_file_select->clear_filters();
	if (large)
		save_file_select->add_filter("*.ltex;Large Texture");
	else
		save_file_select->add_filter("*.tex;Base Atlas Texture");
	save_file_select->connect("file_selected", this,"_choose_save_dir");

	save_select = memnew(	EditorDirDialog );
	add_child(save_select);

//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
	save_select->connect("dir_selected", this,"_choose_save_dir");

	get_ok()->connect("pressed", this,"_import");
	get_ok()->set_text("Import");

	//move stuff up
	//for(int i=0;i<4;i++)
	//	vbc->move_child( vbc->get_child( vbc->get_child_count() -1), 0);

	error_dialog = memnew ( ConfirmationDialog );
	add_child(error_dialog);
	error_dialog->get_ok()->set_text("Accept");
//	error_dialog->get_cancel()->hide();

	set_hide_on_ok(false);

	texture_options = memnew( EditorImportTextureOptions );;
	vbc->add_child(texture_options);
	texture_options->set_v_size_flags(SIZE_EXPAND_FILL);

	if (atlas) {

		texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS|EditorTextureImportPlugin::IMAGE_FLAG_FILTER);
		texture_options->set_quality(0.7);
		texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSY);
		//texture_options->show_2d_notice();
		set_title("Import Textures for Atlas (2D)");
	} else if (large) {

		texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS|EditorTextureImportPlugin::IMAGE_FLAG_FILTER);
		texture_options->set_quality(0.7);
		texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSLESS);
		texture_options->show_2d_notice();
		set_title("Import Large Textures (2D)");

	} else if (p_2d) {

		texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS|EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_FILTER);
		texture_options->set_quality(0.7);
		texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_DISK_LOSSY);
		texture_options->show_2d_notice();
		set_title("Import Textures for 2D");
	} else {

		//texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_);
		//texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS);
		texture_options->set_flags(EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA|EditorTextureImportPlugin::IMAGE_FLAG_FILTER|EditorTextureImportPlugin::IMAGE_FLAG_REPEAT);
		texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM);
		set_title("Import Textures for 3D");
	}


//	GLOBAL_DEF("import/shared_textures","res://");
//	Globals::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR));


}
Example #14
0
FindInFilesPanel::FindInFilesPanel() {

	_finder = memnew(FindInFiles);
	_finder->connect(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found");
	_finder->connect(FindInFiles::SIGNAL_FINISHED, this, "_on_finished");
	add_child(_finder);

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
	add_child(vbc);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *find_label = memnew(Label);
		find_label->set_text(TTR("Find: "));
		hbc->add_child(find_label);

		_search_text_label = memnew(Label);
		_search_text_label->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
		hbc->add_child(_search_text_label);

		_progress_bar = memnew(ProgressBar);
		_progress_bar->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_progress_bar);
		set_progress_visible(false);

		_status_label = memnew(Label);
		hbc->add_child(_status_label);

		_cancel_button = memnew(Button);
		_cancel_button->set_text(TTR("Cancel"));
		_cancel_button->connect("pressed", this, "_on_cancel_button_clicked");
		_cancel_button->hide();
		hbc->add_child(_cancel_button);

		vbc->add_child(hbc);
	}

	_results_display = memnew(Tree);
	_results_display->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts"));
	_results_display->set_v_size_flags(SIZE_EXPAND_FILL);
	_results_display->connect("item_selected", this, "_on_result_selected");
	_results_display->connect("item_edited", this, "_on_item_edited");
	_results_display->set_hide_root(true);
	_results_display->set_select_mode(Tree::SELECT_ROW);
	_results_display->create_item(); // Root
	vbc->add_child(_results_display);

	_with_replace = false;

	{
		_replace_container = memnew(HBoxContainer);

		Label *replace_label = memnew(Label);
		replace_label->set_text(TTR("Replace: "));
		_replace_container->add_child(replace_label);

		_replace_line_edit = memnew(LineEdit);
		_replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		_replace_line_edit->connect("text_changed", this, "_on_replace_text_changed");
		_replace_container->add_child(_replace_line_edit);

		_replace_all_button = memnew(Button);
		_replace_all_button->set_text(TTR("Replace all (no undo)"));
		_replace_all_button->connect("pressed", this, "_on_replace_all_clicked");
		_replace_container->add_child(_replace_all_button);

		_replace_container->hide();

		vbc->add_child(_replace_container);
	}
}
	EditorFontImportDialog(EditorFontImportPlugin *p_plugin) {
		plugin=p_plugin;
		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);
		HBoxContainer *hbc = memnew( HBoxContainer);
		vbc->add_child(hbc);
		VBoxContainer *vbl = memnew( VBoxContainer );
		hbc->add_child(vbl);
		hbc->set_v_size_flags(SIZE_EXPAND_FILL);
		vbl->set_h_size_flags(SIZE_EXPAND_FILL);
		VBoxContainer *vbr = memnew( VBoxContainer );
		hbc->add_child(vbr);
		vbr->set_h_size_flags(SIZE_EXPAND_FILL);

		source = memnew( LineEditFileChooser );
		source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM);
		source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE);
		source->get_file_dialog()->add_filter("*.ttf;TrueType");
		source->get_file_dialog()->add_filter("*.otf;OpenType");
		source->get_line_edit()->connect("text_entered",this,"_src_changed");

		vbl->add_margin_child("Source Font:",source);
		font_size = memnew( SpinBox );
		vbl->add_margin_child("Source Font Size:",font_size);
		font_size->set_min(3);
		font_size->set_max(256);
		font_size->set_val(16);
		font_size->connect("value_changed",this,"_font_size_changed");
		dest = memnew( LineEditFileChooser );
		//
		List<String> fl;
		Ref<Font> font= memnew(Font);
		dest->get_file_dialog()->add_filter("*.fnt ; Font" );
		//ResourceSaver::get_recognized_extensions(font,&fl);
		//for(List<String>::Element *E=fl.front();E;E=E->next()) {
		//	dest->get_file_dialog()->add_filter("*."+E->get());
		//}

		vbl->add_margin_child("Dest Resource:",dest);
		HBoxContainer *testhb = memnew( HBoxContainer );
		test_string = memnew( LineEdit );
		test_string->set_text("The quick brown fox jumps over the lazy dog.");
		test_string->set_h_size_flags(SIZE_EXPAND_FILL);
		test_string->set_stretch_ratio(5);

		testhb->add_child(test_string);
		test_color = memnew( ColorPickerButton );
		test_color->set_color(get_color("font_color","Label"));
		test_color->set_h_size_flags(SIZE_EXPAND_FILL);
		test_color->set_stretch_ratio(1);
		test_color->connect("color_changed",this,"_update_text3");
		testhb->add_child(test_color);

		vbl->add_spacer();
		vbl->add_margin_child("Test: ",testhb);
		HBoxContainer *upd_hb = memnew( HBoxContainer );
//		vbl->add_child(upd_hb);
		upd_hb->add_spacer();
		Button *update = memnew( Button);
		upd_hb->add_child(update);
		update->set_text("Update");
		update->connect("pressed",this,"_update");

		options = memnew( _EditorFontImportOptions );
		prop_edit = memnew( PropertyEditor() );
		vbr->add_margin_child("Options:",prop_edit,true);
		options->connect("changed",this,"_prop_changed");

		prop_edit->hide_top_label();

		Panel *panel = memnew( Panel );
		vbc->add_child(panel);
		test_label = memnew( Label );
		test_label->set_autowrap(true);
		panel->add_child(test_label);
		test_label->set_area_as_parent_rect();
		panel->set_v_size_flags(SIZE_EXPAND_FILL);
		test_string->connect("text_changed",this,"_update_text2");
		set_title("Font Import");
		timer = memnew( Timer );
		add_child(timer);
		timer->connect("timeout",this,"_update");
		timer->set_wait_time(0.4);
		timer->set_one_shot(true);

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");

		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
		set_hide_on_ok(false);


	}
Example #16
0
CreateDialog::CreateDialog() {

	is_replace_mode = false;

	set_resizable(true);

	HSplitContainer *hsc = memnew(HSplitContainer);
	add_child(hsc);

	VSplitContainer *vsc = memnew(VSplitContainer);
	hsc->add_child(vsc);

	VBoxContainer *fav_vb = memnew(VBoxContainer);
	vsc->add_child(fav_vb);
	fav_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
	fav_vb->set_v_size_flags(SIZE_EXPAND_FILL);

	favorites = memnew(Tree);
	fav_vb->add_margin_child(TTR("Favorites:"), favorites, true);
	favorites->set_hide_root(true);
	favorites->set_hide_folding(true);
	favorites->connect("cell_selected", this, "_favorite_selected");
	favorites->connect("item_activated", this, "_favorite_activated");
	favorites->set_drag_forwarding(this);

	VBoxContainer *rec_vb = memnew(VBoxContainer);
	vsc->add_child(rec_vb);
	rec_vb->set_custom_minimum_size(Size2(150, 100) * EDSCALE);
	rec_vb->set_v_size_flags(SIZE_EXPAND_FILL);

	recent = memnew(Tree);
	rec_vb->add_margin_child(TTR("Recent:"), recent, true);
	recent->set_hide_root(true);
	recent->set_hide_folding(true);
	recent->connect("cell_selected", this, "_history_selected");
	recent->connect("item_activated", this, "_history_activated");

	VBoxContainer *vbc = memnew(VBoxContainer);
	hsc->add_child(vbc);
	vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
	vbc->set_h_size_flags(SIZE_EXPAND_FILL);
	HBoxContainer *search_hb = memnew(HBoxContainer);
	search_box = memnew(LineEdit);
	search_box->set_h_size_flags(SIZE_EXPAND_FILL);
	search_hb->add_child(search_box);
	favorite = memnew(Button);
	favorite->set_flat(true);
	favorite->set_toggle_mode(true);
	search_hb->add_child(favorite);
	favorite->connect("pressed", this, "_favorite_toggled");
	vbc->add_margin_child(TTR("Search:"), search_hb);
	search_box->connect("text_changed", this, "_text_changed");
	search_box->connect("gui_input", this, "_sbox_input");
	search_options = memnew(Tree);
	vbc->add_margin_child(TTR("Matches:"), search_options, true);
	get_ok()->set_disabled(true);
	register_text_enter(search_box);
	set_hide_on_ok(false);
	search_options->connect("item_activated", this, "_confirmed");
	search_options->connect("cell_selected", this, "_item_selected");
	base_type = "Object";
	preferred_search_result_type = "";

	help_bit = memnew(EditorHelpBit);
	vbc->add_margin_child(TTR("Description:"), help_bit);
	help_bit->connect("request_hide", this, "_closed");

	type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here
	type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix.

	EDITOR_DEF("interface/editors/derive_script_globals_by_name", true);
}
SpriteFramesEditor::SpriteFramesEditor() {

	//add_style_override("panel", get_stylebox("panel","Panel"));

	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);

	HBoxContainer *hbc = memnew( HBoxContainer );
	vbc->add_child(hbc);

	load = memnew( Button );
	load->set_tooltip("Load Resource");
	hbc->add_child(load);




	paste = memnew( Button );
	paste->set_text("Paste");
	hbc->add_child(paste);

	empty = memnew( Button );
	empty->set_text("Insert Empty (Before)");
	hbc->add_child(empty);

	empty2 = memnew( Button );
	empty2->set_text("Insert Empty (After)");
	hbc->add_child(empty2);

	move_up = memnew( Button );
	move_up->set_text("Up");
	hbc->add_child(move_up);

	move_down = memnew( Button );
	move_down->set_text("Down");
	hbc->add_child(move_down);

	_delete = memnew( Button );
	hbc->add_child(_delete);

	file = memnew( EditorFileDialog );
	add_child(file);


	tree = memnew( Tree );
	tree->set_columns(2);
	tree->set_column_min_width(0,3);
	tree->set_column_min_width(1,1);
	tree->set_column_expand(0,true);
	tree->set_column_expand(1,true);
	tree->set_v_size_flags(SIZE_EXPAND_FILL);

	vbc->add_child(tree);

	dialog = memnew( AcceptDialog );
	add_child( dialog );

	load->connect("pressed", this,"_load_pressed");
	_delete->connect("pressed", this,"_delete_pressed");
	paste->connect("pressed", this,"_paste_pressed");
	empty->connect("pressed", this,"_empty_pressed");
	empty2->connect("pressed", this,"_empty2_pressed");
	move_up->connect("pressed", this,"_up_pressed");
	move_down->connect("pressed", this,"_down_pressed");
	file->connect("files_selected", this,"_file_load_request");
	//dialog->connect("confirmed", this,"_delete_confirm_pressed");
	tree->connect("item_edited", this,"_item_edited");
	loading_scene=false;
	sel=-1;

}
Example #18
0
ScriptCreateDialog::ScriptCreateDialog() {

	/* SNAP DIALOG */

	VBoxContainer *vb = memnew( VBoxContainer );
	add_child(vb);
	set_child_rect(vb);


	class_name = memnew( LineEdit );
	VBoxContainer *vb2 = memnew( VBoxContainer );
	vb2->add_child(class_name);
	class_name->connect("text_changed", this,"_class_name_changed");
	error_label = memnew(Label);
	error_label->set_text("valid chars: a-z A-Z 0-9 _");
	error_label->set_align(Label::ALIGN_CENTER);
	vb2->add_child(error_label);
	vb->add_margin_child("Class Name:",vb2);

	parent_name = memnew( LineEdit );
	vb->add_margin_child("Inherits:",parent_name);
	parent_name->connect("text_changed", this,"_class_name_changed");

	language_menu = memnew( OptionButton );
	vb->add_margin_child("Language",language_menu);

	for(int i=0;i<ScriptServer::get_language_count();i++) {

		language_menu->add_item(ScriptServer::get_language(i)->get_name());
	}

	language_menu->select(0);
	language_menu->connect("item_selected",this,"_lang_changed");

	//parent_name->set_text();

	vb2 = memnew( VBoxContainer );
	path_vb = memnew( VBoxContainer );
	vb2->add_child(path_vb);

	HBoxContainer *hbc = memnew( HBoxContainer );
	file_path = memnew( LineEdit );
	file_path->connect("text_changed",this,"_path_changed");
	hbc->add_child(file_path);
	file_path->set_h_size_flags(SIZE_EXPAND_FILL);
	Button *b = memnew( Button );
	b->set_text(" .. ");
	b->connect("pressed",this,"_browse_path");
	hbc->add_child(b);
	path_vb->add_child(hbc);
	path_error_label = memnew( Label );
	path_vb->add_child( path_error_label );
	path_error_label->set_text("Error!");
	path_error_label->set_align(Label::ALIGN_CENTER);


	internal = memnew( CheckButton );
	internal->set_text("Built-In Script");
	vb2->add_child(internal);
	internal->connect("pressed",this,"_built_in_pressed");

	vb->add_margin_child("Path:",vb2);

	set_size(Size2(200,150));
	set_hide_on_ok(false);
	set_title("Create Script for Node");

	file_browse = memnew( EditorFileDialog );
	file_browse->connect("file_selected",this,"_file_selected");
	add_child(file_browse);
	get_ok()->set_text("Create");
	alert = memnew( AcceptDialog );
	add_child(alert);
	_lang_changed(0);
}
Example #19
0
GroupDialog::GroupDialog() {

	scene_tree = SceneTree::get_singleton();

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	HBoxContainer *hbc = memnew(HBoxContainer);
	vbc->add_child(hbc);
	hbc->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *vbc_left = memnew(VBoxContainer);
	hbc->add_child(vbc_left);
	vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *group_title = memnew(Label);
	group_title->set_text(TTR("Groups"));
	vbc_left->add_child(group_title);

	groups = memnew(Tree);
	vbc_left->add_child(groups);
	groups->set_hide_root(true);
	groups->set_v_size_flags(SIZE_EXPAND_FILL);
	groups->set_select_mode(Tree::SELECT_SINGLE);
	groups->set_allow_reselect(true);
	groups->set_allow_rmb_select(true);
	groups->connect("item_selected", this, "_group_selected");
	groups->connect("button_pressed", this, "_delete_group_pressed");
	groups->connect("item_edited", this, "_group_renamed");

	HBoxContainer *chbc = memnew(HBoxContainer);
	vbc_left->add_child(chbc);
	chbc->set_h_size_flags(SIZE_EXPAND_FILL);

	add_group_text = memnew(LineEdit);
	chbc->add_child(add_group_text);
	add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);

	Button *add_group_button = memnew(Button);
	add_group_button->set_text("Add");
	chbc->add_child(add_group_button);
	add_group_button->connect("pressed", this, "_add_group_pressed");

	VBoxContainer *vbc_add = memnew(VBoxContainer);
	hbc->add_child(vbc_add);
	vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *out_of_group_title = memnew(Label);
	out_of_group_title->set_text(TTR("Nodes not in Group"));
	vbc_add->add_child(out_of_group_title);

	nodes_to_add = memnew(Tree);
	vbc_add->add_child(nodes_to_add);
	nodes_to_add->set_hide_root(true);
	nodes_to_add->set_hide_folding(true);
	nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");

	HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
	add_filter_hbc->add_constant_override("separate", 0);
	vbc_add->add_child(add_filter_hbc);

	add_filter = memnew(LineEdit);
	add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	add_filter->set_placeholder(TTR("Filter nodes"));
	add_filter_hbc->add_child(add_filter);
	add_filter->connect("text_changed", this, "_add_filter_changed");

	VBoxContainer *vbc_buttons = memnew(VBoxContainer);
	hbc->add_child(vbc_buttons);
	vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
	vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);

	add_button = memnew(ToolButton);
	add_button->set_text(TTR("Add"));
	add_button->connect("pressed", this, "_add_pressed");

	vbc_buttons->add_child(add_button);
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();

	remove_button = memnew(ToolButton);
	remove_button->set_text(TTR("Remove"));
	remove_button->connect("pressed", this, "_removed_pressed");

	vbc_buttons->add_child(remove_button);

	VBoxContainer *vbc_remove = memnew(VBoxContainer);
	hbc->add_child(vbc_remove);
	vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *in_group_title = memnew(Label);
	in_group_title->set_text(TTR("Nodes in Group"));
	vbc_remove->add_child(in_group_title);

	nodes_to_remove = memnew(Tree);
	vbc_remove->add_child(nodes_to_remove);
	nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_remove->set_hide_root(true);
	nodes_to_remove->set_hide_folding(true);
	nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");

	HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
	remove_filter_hbc->add_constant_override("separate", 0);
	vbc_remove->add_child(remove_filter_hbc);

	remove_filter = memnew(LineEdit);
	remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	remove_filter->set_placeholder(TTR("Filter nodes"));
	remove_filter_hbc->add_child(remove_filter);
	remove_filter->connect("text_changed", this, "_remove_filter_changed");

	set_title("Group Editor");
	get_cancel()->hide();
	set_as_toplevel(true);
	set_resizable(true);

	error = memnew(ConfirmationDialog);
	add_child(error);
	error->get_ok()->set_text(TTR("Close"));
}
Example #20
0
ConnectDialog::ConnectDialog() {

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	HBoxContainer *main_hb = memnew(HBoxContainer);
	vbc->add_child(main_hb);
	main_hb->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *vbc_left = memnew(VBoxContainer);
	main_hb->add_child(vbc_left);
	vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);

	tree = memnew(SceneTreeEditor(false));
	tree->get_scene_tree()->connect("item_activated", this, "_ok");
	tree->connect("node_selected", this, "_tree_node_selected");

	vbc_left->add_margin_child(TTR("Connect To Node:"), tree, true);

	VBoxContainer *vbc_right = memnew(VBoxContainer);
	main_hb->add_child(vbc_right);
	vbc_right->set_h_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *add_bind_hb = memnew(HBoxContainer);

	type_list = memnew(OptionButton);
	type_list->set_h_size_flags(SIZE_EXPAND_FILL);
	add_bind_hb->add_child(type_list);
	type_list->add_item("bool", Variant::BOOL);
	type_list->add_item("int", Variant::INT);
	type_list->add_item("real", Variant::REAL);
	type_list->add_item("string", Variant::STRING);
	type_list->add_item("Vector2", Variant::VECTOR2);
	type_list->add_item("Rect2", Variant::RECT2);
	type_list->add_item("Vector3", Variant::VECTOR3);
	type_list->add_item("Plane", Variant::PLANE);
	type_list->add_item("Quat", Variant::QUAT);
	type_list->add_item("AABB", Variant::AABB);
	type_list->add_item("Basis", Variant::BASIS);
	type_list->add_item("Transform", Variant::TRANSFORM);
	type_list->add_item("Color", Variant::COLOR);
	type_list->select(0);

	Button *add_bind = memnew(Button);
	add_bind->set_text(TTR("Add"));
	add_bind_hb->add_child(add_bind);
	add_bind->connect("pressed", this, "_add_bind");

	Button *del_bind = memnew(Button);
	del_bind->set_text(TTR("Remove"));
	add_bind_hb->add_child(del_bind);
	del_bind->connect("pressed", this, "_remove_bind");

	vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb);

	bind_editor = memnew(EditorInspector);

	vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true);

	dst_path = memnew(LineEdit);
	vbc->add_margin_child(TTR("Path to Node:"), dst_path);

	HBoxContainer *dstm_hb = memnew(HBoxContainer);
	vbc->add_margin_child("Method In Node:", dstm_hb);

	dst_method = memnew(LineEdit);
	dst_method->set_h_size_flags(SIZE_EXPAND_FILL);
	dstm_hb->add_child(dst_method);

	/*
	dst_method_list = memnew( MenuButton );
	dst_method_list->set_text("List...");
	dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	dst_method_list->set_anchor( MARGIN_LEFT, ANCHOR_END );
	dst_method_list->set_anchor( MARGIN_TOP, ANCHOR_END );
	dst_method_list->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
	dst_method_list->set_begin( Point2( 70,59) );
	dst_method_list->set_end( Point2( 15,39  ) );
	*/

	make_callback = memnew(CheckButton);
	make_callback->set_toggle_mode(true);
	make_callback->set_pressed(EDITOR_DEF("text_editor/tools/create_signal_callbacks", true));
	make_callback->set_text(TTR("Make Function"));
	dstm_hb->add_child(make_callback);

	deferred = memnew(CheckButton);
	deferred->set_text(TTR("Deferred"));
	dstm_hb->add_child(deferred);

	oneshot = memnew(CheckButton);
	oneshot->set_text(TTR("Oneshot"));
	dstm_hb->add_child(oneshot);

	set_as_toplevel(true);

	cdbinds = memnew(ConnectDialogBinds);

	error = memnew(ConfirmationDialog);
	add_child(error);
	error->get_ok()->set_text(TTR("Close"));
	get_ok()->set_text(TTR("Connect"));
}
Example #21
0
EditorFileDialog::EditorFileDialog() {

	show_hidden_files=default_show_hidden_files;
	display_mode=default_display_mode;
	local_history_pos=0;
	disable_overwrite_warning=false;
	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);
	set_child_rect(vbc);

	mode=MODE_SAVE_FILE;
	set_title(TTR("Save a File"));

	ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT|KEY_LEFT);
	ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT|KEY_RIGHT);
	ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT|KEY_UP);
	ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_F5);
	ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD|KEY_H);
	ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT|KEY_F);
	ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT|KEY_V);
	ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD|KEY_N);
	ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD|KEY_D);
	ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD|KEY_UP);
	ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD|KEY_DOWN);

	HBoxContainer *pathhb = memnew( HBoxContainer );

	dir_prev = memnew( ToolButton );
	dir_next = memnew( ToolButton );
	dir_up = memnew( ToolButton );

	pathhb->add_child(dir_prev);
	pathhb->add_child(dir_next);
	pathhb->add_child(dir_up);

	dir_prev->connect("pressed",this,"_go_back");
	dir_next->connect("pressed",this,"_go_forward");
	dir_up->connect("pressed",this,"_go_up");

	dir = memnew(LineEdit);
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	refresh = memnew( ToolButton );
	refresh->connect("pressed",this,"_update_file_list");
	pathhb->add_child(refresh);

	favorite = memnew( ToolButton );
	favorite->set_toggle_mode(true);
	favorite->connect("toggled",this,"_favorite_toggled");
	pathhb->add_child(favorite);

	mode_thumbnails = memnew( ToolButton );
	mode_thumbnails->connect("pressed",this,"set_display_mode",varray(DISPLAY_THUMBNAILS));
	mode_thumbnails->set_toggle_mode(true);
	mode_thumbnails->set_pressed(display_mode==DISPLAY_THUMBNAILS);
	pathhb->add_child(mode_thumbnails);

	mode_list = memnew( ToolButton );
	mode_list->connect("pressed",this,"set_display_mode",varray(DISPLAY_LIST));
	mode_list->set_toggle_mode(true);
	mode_list->set_pressed(display_mode==DISPLAY_LIST);
	pathhb->add_child(mode_list);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text(TTR("Create Folder"));
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);

	list_hb = memnew( HBoxContainer );

	vbc->add_margin_child(TTR("Path:"),pathhb);
	vbc->add_child(list_hb);
	list_hb->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *fav_vb = memnew( VBoxContainer );
	list_hb->add_child(fav_vb);
	HBoxContainer *fav_hb = memnew( HBoxContainer );
	fav_vb->add_child(fav_hb);
	fav_hb->add_child(memnew(Label(TTR("Favorites:"))));
	fav_hb->add_spacer();
	fav_up = memnew( ToolButton );
	fav_hb->add_child(fav_up);
	fav_up->connect("pressed",this,"_favorite_move_up");
	fav_down = memnew( ToolButton );
	fav_hb->add_child(fav_down);
	fav_down->connect("pressed",this,"_favorite_move_down");
	fav_rm = memnew( ToolButton );
	fav_hb->add_child(fav_rm);
	fav_rm->hide(); // redundant

	MarginContainer *fav_mv = memnew( MarginContainer );
	fav_vb->add_child(fav_mv);
	fav_mv->set_v_size_flags(SIZE_EXPAND_FILL);
	favorites = memnew( ItemList );
	fav_mv->add_child(favorites);
	favorites->connect("item_selected",this,"_favorite_selected");

	recent = memnew( ItemList );
	fav_vb->add_margin_child(TTR("Recent:"),recent,true);
	recent->connect("item_selected",this,"_recent_selected");

	VBoxContainer *item_vb = memnew( VBoxContainer );
	list_hb->add_child(item_vb);
	item_vb->set_h_size_flags(SIZE_EXPAND_FILL);

	item_list = memnew( ItemList );
	item_list->set_v_size_flags(SIZE_EXPAND_FILL);
	item_vb->add_margin_child(TTR("Directories & Files:"),item_list,true);

	HBoxContainer* filter_hb = memnew( HBoxContainer );
	item_vb->add_child(filter_hb);

	VBoxContainer *filter_vb = memnew( VBoxContainer );
	filter_hb->add_child(filter_vb);
	filter_vb->set_h_size_flags(SIZE_EXPAND_FILL);

	preview_vb = memnew( VBoxContainer );
	filter_hb->add_child(preview_vb);
	CenterContainer *prev_cc = memnew( CenterContainer );
	preview_vb->add_margin_child(TTR("Preview:"),prev_cc);
	preview = memnew( TextureFrame );
	prev_cc->add_child(preview);
	preview_vb->hide();


	file = memnew(LineEdit);
	//add_child(file);
	filter_vb->add_margin_child(TTR("File:"),file);


	filter = memnew( OptionButton );
	//add_child(filter);
	filter_vb->add_margin_child(TTR("Filter:"),filter);
	filter->set_clip_text(true);//too many extensions overflow it

	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	access=ACCESS_RESOURCES;
	_update_drives();


	connect("confirmed", this,"_action_pressed");
	//cancel->connect("pressed", this,"_cancel_pressed");
	item_list->connect("item_selected", this,"_item_selected",varray(),CONNECT_DEFERRED);
	item_list->connect("item_activated", this,"_item_db_selected",varray());
	dir->connect("text_entered", this,"_dir_entered");
	file->connect("text_entered", this,"_file_entered");
	filter->connect("item_selected", this,"_filter_selected");


	confirm_save = memnew( ConfirmationDialog );
	confirm_save->set_as_toplevel(true);
	add_child(confirm_save);


	confirm_save->connect("confirmed", this,"_save_confirm_pressed");

	makedialog = memnew( ConfirmationDialog );
	makedialog->set_title(TTR("Create Folder"));
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);
	makedialog->set_child_rect(makevb);
	makedirname = memnew( LineEdit );
	makevb->add_margin_child(TTR("Name:"),makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text(TTR("Could not create folder."));
	add_child(mkdirerr);

	exterr = memnew( AcceptDialog );
	exterr->set_text(TTR("Must use a valid extension."));
	add_child(exterr);


	//update_file_list();
	update_filters();
	update_dir();

	set_hide_on_ok(false);
	vbox=vbc;


	invalidated=true;
	if (register_func)
		register_func(this);

	preview_wheel_timeout=0;
	preview_wheel_index=0;
	preview_waiting=false;

}
Example #22
0
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {

	editor = p_editor;
	set_name(TTR("Signals"));

	VBoxContainer *vbc = this;

	tree = memnew(Tree);
	tree->set_columns(1);
	tree->set_select_mode(Tree::SELECT_ROW);
	tree->set_hide_root(true);
	vbc->add_child(tree);
	tree->set_v_size_flags(SIZE_EXPAND_FILL);
	tree->set_allow_rmb_select(true);

	connect_button = memnew(Button);
	connect_button->set_text(TTR("Connect"));
	HBoxContainer *hb = memnew(HBoxContainer);
	vbc->add_child(hb);
	hb->add_spacer();
	hb->add_child(connect_button);
	connect_button->connect("pressed", this, "_connect_pressed");

	connect_dialog = memnew(ConnectDialog);
	connect_dialog->set_as_toplevel(true);
	add_child(connect_dialog);

	disconnect_all_dialog = memnew(ConfirmationDialog);
	disconnect_all_dialog->set_as_toplevel(true);
	add_child(disconnect_all_dialog);
	disconnect_all_dialog->connect("confirmed", this, "_disconnect_all");
	disconnect_all_dialog->set_text(TTR("Are you sure you want to remove all connections from this signal?"));

	signal_menu = memnew(PopupMenu);
	add_child(signal_menu);
	signal_menu->connect("id_pressed", this, "_handle_signal_menu_option");
	signal_menu->add_item(TTR("Connect..."), CONNECT);
	signal_menu->add_item(TTR("Disconnect All"), DISCONNECT_ALL);

	slot_menu = memnew(PopupMenu);
	add_child(slot_menu);
	slot_menu->connect("id_pressed", this, "_handle_slot_menu_option");
	slot_menu->add_item(TTR("Edit..."), EDIT);
	slot_menu->add_item(TTR("Go To Method"), GO_TO_SCRIPT);
	slot_menu->add_item(TTR("Disconnect"), DISCONNECT);

	/*
	node_only->set_anchor( MARGIN_TOP, ANCHOR_END );
	node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
	node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END );

	node_only->set_begin( Point2( 20,51) );
	node_only->set_end( Point2( 10,44) );
	*/

	connect_dialog->connect("connected", this, "_make_or_edit_connection");
	tree->connect("item_selected", this, "_tree_item_selected");
	tree->connect("item_activated", this, "_tree_item_activated");
	tree->connect("item_rmb_selected", this, "_rmb_pressed");

	add_constant_override("separation", 3 * EDSCALE);
}
Example #23
0
	NewProjectDialog() {


		VBoxContainer *vb = memnew( VBoxContainer );
		add_child(vb);
		set_child_rect(vb);

		Label* l = memnew(Label);
		l->set_text(TTR("Project Path:"));
		vb->add_child(l);
		pp=l;

		project_path = memnew( LineEdit );
		MarginContainer *mc = memnew( MarginContainer );
		vb->add_child(mc);
		HBoxContainer *pphb = memnew( HBoxContainer );
		mc->add_child(pphb);
		pphb->add_child(project_path);
		project_path->set_h_size_flags(SIZE_EXPAND_FILL);

		Button* browse = memnew( Button );
		pphb->add_child(browse);
		browse->set_text(TTR("Browse"));
		browse->connect("pressed", this,"_browse_path");

		l = memnew(Label);
		l->set_text(TTR("Project Name:"));
		l->set_pos(Point2(5,50));
		vb->add_child(l);
		pn=l;

		project_name = memnew( LineEdit );
		mc = memnew( MarginContainer );
		vb->add_child(mc);
		mc->add_child(project_name);
		project_name->set_text(TTR("New Game Project"));


		l = memnew(Label);
		l->set_text(TTR("That's a BINGO!"));
		vb->add_child(l);
		error=l;
		l->add_color_override("font_color",Color(1,0.4,0.3,0.8));
		l->set_align(Label::ALIGN_CENTER);

		DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
		project_path->set_text(d->get_current_dir());
		memdelete(d);

		fdialog = memnew( FileDialog );
		add_child(fdialog);
		fdialog->set_access(FileDialog::ACCESS_FILESYSTEM);
		fdialog->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") );
		project_name->connect("text_changed", this,"_text_changed");
		project_path->connect("text_changed", this,"_path_text_changed");
		fdialog->connect("dir_selected", this,"_path_selected");
		fdialog->connect("file_selected", this,"_file_selected");
		set_hide_on_ok(false);
		mode=MODE_NEW;

		dialog_error = memnew( AcceptDialog );
		add_child(dialog_error);
	}
Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {

	particles = NULL;
	editor = p_node;
	undo_redo = editor->get_undo_redo();

	toolbar = memnew(HBoxContainer);
	add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, toolbar);
	toolbar->hide();

	toolbar->add_child(memnew(VSeparator));

	menu = memnew(MenuButton);
	menu->get_popup()->add_item(TTR("Generate Visibility Rect"), MENU_GENERATE_VISIBILITY_RECT);
	menu->get_popup()->add_separator();
	menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
	//	menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
	menu->set_text(TTR("Particles"));
	toolbar->add_child(menu);

	file = memnew(EditorFileDialog);
	List<String> ext;
	ImageLoader::get_recognized_extensions(&ext);
	for (List<String>::Element *E = ext.front(); E; E = E->next()) {
		file->add_filter("*." + E->get() + "; " + E->get().to_upper());
	}
	file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
	toolbar->add_child(file);

	epoints = memnew(SpinBox);
	epoints->set_min(1);
	epoints->set_max(8192);
	epoints->set_step(1);
	epoints->set_value(512);
	file->get_vbox()->add_margin_child(TTR("Generated Point Count:"), epoints);

	generate_aabb = memnew(ConfirmationDialog);
	generate_aabb->set_title(TTR("Generate Visibility Rect"));
	VBoxContainer *genvb = memnew(VBoxContainer);
	generate_aabb->add_child(genvb);
	generate_seconds = memnew(SpinBox);
	genvb->add_margin_child(TTR("Generation Time (sec):"), generate_seconds);
	generate_seconds->set_min(0.1);
	generate_seconds->set_max(25);
	generate_seconds->set_value(2);

	toolbar->add_child(generate_aabb);

	generate_aabb->connect("confirmed", this, "_generate_visibility_rect");

	emission_mask = memnew(ConfirmationDialog);
	emission_mask->set_title(TTR("Generate Visibility Rect"));
	VBoxContainer *emvb = memnew(VBoxContainer);
	emission_mask->add_child(emvb);
	emission_mask_mode = memnew(OptionButton);
	emvb->add_margin_child(TTR("Emission Mask"), emission_mask_mode);
	emission_mask_mode->add_item("Solid Pixels", EMISSION_MODE_SOLID);
	emission_mask_mode->add_item("Border Pixels", EMISSION_MODE_BORDER);
	emission_mask_mode->add_item("Directed Border Pixels", EMISSION_MODE_BORDER_DIRECTED);
	emission_colors = memnew(CheckBox);
	emission_colors->set_text(TTR("Capture from Pixel"));
	emvb->add_margin_child(TTR("Emission Colors"), emission_colors);

	toolbar->add_child(emission_mask);

	emission_mask->connect("confirmed", this, "_generate_emission_mask");
}
Example #25
0
EditorSettingsDialog::EditorSettingsDialog() {

	set_title(TTR("Editor Settings"));
	set_resizable(true);

	tabs = memnew(TabContainer);
	tabs->set_tab_align(TabContainer::ALIGN_LEFT);
	add_child(tabs);
	//set_child_rect(tabs);

	VBoxContainer *vbc = memnew(VBoxContainer);
	tabs->add_child(vbc);
	vbc->set_name(TTR("General"));

	HBoxContainer *hbc = memnew(HBoxContainer);
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	Label *l = memnew(Label);
	l->set_text(TTR("Search:") + " ");
	hbc->add_child(l);

	search_box = memnew(LineEdit);
	search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(search_box);

	clear_button = memnew(ToolButton);
	hbc->add_child(clear_button);
	clear_button->connect("pressed", this, "_clear_search_box");

	property_editor = memnew(SectionedPropertyEditor);
	//property_editor->hide_top_label();
	property_editor->get_property_editor()->set_use_filter(true);
	property_editor->register_search_box(search_box);
	property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(property_editor);
	property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");

	vbc = memnew(VBoxContainer);
	tabs->add_child(vbc);
	vbc->set_name(TTR("Shortcuts"));

	hbc = memnew(HBoxContainer);
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	l = memnew(Label);
	l->set_text(TTR("Search:") + " ");
	hbc->add_child(l);

	shortcut_search_box = memnew(LineEdit);
	shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(shortcut_search_box);
	shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");

	shortcut_clear_button = memnew(ToolButton);
	hbc->add_child(shortcut_clear_button);
	shortcut_clear_button->connect("pressed", this, "_clear_shortcut_search_box");

	shortcuts = memnew(Tree);
	vbc->add_margin_child("Shortcut List:", shortcuts, true);
	shortcuts->set_columns(2);
	shortcuts->set_hide_root(true);
	//shortcuts->set_hide_folding(true);
	shortcuts->set_column_titles_visible(true);
	shortcuts->set_column_title(0, "Name");
	shortcuts->set_column_title(1, "Binding");
	shortcuts->connect("button_pressed", this, "_shortcut_button_pressed");

	press_a_key = memnew(ConfirmationDialog);
	press_a_key->set_focus_mode(FOCUS_ALL);
	add_child(press_a_key);

	l = memnew(Label);
	l->set_text(TTR("Press a Key.."));
	l->set_area_as_parent_rect();
	l->set_align(Label::ALIGN_CENTER);
	l->set_margin(MARGIN_TOP, 20);
	l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
	press_a_key_label = l;
	press_a_key->add_child(l);
	press_a_key->connect("gui_input", this, "_wait_for_key");
	press_a_key->connect("confirmed", this, "_press_a_key_confirm");

	//get_ok()->set_text("Apply");
	set_hide_on_ok(true);
	//get_cancel()->set_text("Close");

	timer = memnew(Timer);
	timer->set_wait_time(1.5);
	timer->connect("timeout", this, "_settings_save");
	timer->set_one_shot(true);
	add_child(timer);
	EditorSettings::get_singleton()->connect("settings_changed", this, "_settings_changed");
	get_ok()->set_text(TTR("Close"));

	updating = false;
}
Example #26
0
ProjectManager::ProjectManager() {

	int margin = get_constant("margin","Dialogs");
	int button_margin = get_constant("button_margin","Dialogs");

	// load settings
	if (!EditorSettings::get_singleton())
		EditorSettings::create();

	FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));

	set_area_as_parent_rect();

	Ref<Theme> theme = Ref<Theme>( memnew( Theme ) );
	set_theme(theme);
	editor_register_icons(theme);

	String global_font = EditorSettings::get_singleton()->get("global/font");
	if (global_font!="") {
		Ref<Font> fnt = ResourceLoader::load(global_font);
		if (fnt.is_valid()) {
			theme->set_default_theme_font(fnt);
		}
	}

	Panel *panel = memnew( Panel );
	add_child(panel);
	panel->set_area_as_parent_rect();

	VBoxContainer *vb = memnew( VBoxContainer );
	panel->add_child(vb);
	vb->set_area_as_parent_rect(20);

	OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)" - Project Manager");

	Label *l = memnew( Label );
	l->set_text(_MKSTR(VERSION_NAME)" - Project Manager");
	l->add_font_override("font",get_font("large","Fonts"));
	l->set_align(Label::ALIGN_CENTER);
	vb->add_child(l);
	l = memnew( Label );
	l->set_text("v" VERSION_MKSTRING);
	//l->add_font_override("font",get_font("bold","Fonts"));
	l->set_align(Label::ALIGN_CENTER);
	vb->add_child(l);
	vb->add_child(memnew(HSeparator));
	vb->add_margin_child("\n",memnew(Control));


	HBoxContainer *tree_hb = memnew( HBoxContainer);
	vb->add_margin_child("Recent Projects:",tree_hb,true);

	VBoxContainer *search_tree_vb = memnew(VBoxContainer);
	search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL);
	tree_hb->add_child(search_tree_vb);

	HBoxContainer *search_box = memnew(HBoxContainer);
	search_box->add_spacer(true);
	project_filter = memnew(ProjectListFilter);
	search_box->add_child(project_filter);
	project_filter->connect("filter_changed", this, "_load_recent_projects");
	project_filter->set_custom_minimum_size(Size2(250,10));
	search_tree_vb->add_child(search_box);

	PanelContainer *pc = memnew( PanelContainer);
	pc->add_style_override("panel",get_stylebox("bg","Tree"));
	search_tree_vb->add_child(pc);
	pc->set_v_size_flags(SIZE_EXPAND_FILL);

	scroll = memnew( ScrollContainer );
	pc->add_child(scroll);
	scroll->set_enable_h_scroll(false);

	VBoxContainer *tree_vb = memnew( VBoxContainer);
	tree_hb->add_child(tree_vb);
	scroll_childs = memnew( VBoxContainer );
	scroll_childs->set_h_size_flags(SIZE_EXPAND_FILL);
	scroll->add_child(scroll_childs);

	//HBoxContainer *hb = memnew( HBoxContainer );
	//vb->add_child(hb);

	Button *open = memnew( Button );
	open->set_text("Edit");
	tree_vb->add_child(open);
	open->connect("pressed", this,"_open_project");
	open_btn=open;

	Button *run = memnew( Button );
	run->set_text("Run");
	tree_vb->add_child(run);
	run->connect("pressed", this,"_run_project");
	run_btn=run;

	tree_vb->add_child(memnew( HSeparator ));

	Button *scan = memnew( Button );
	scan->set_text("Scan");
	tree_vb->add_child(scan);
	scan->connect("pressed", this,"_scan_projects");

	tree_vb->add_child(memnew( HSeparator ));

	scan_dir = memnew( FileDialog );
	scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM);
	scan_dir->set_mode(FileDialog::MODE_OPEN_DIR);
	scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") );
	add_child(scan_dir);
	scan_dir->connect("dir_selected",this,"_scan_begin");


	Button* create = memnew( Button );
	create->set_text("New Project");
	tree_vb->add_child(create);
	create->connect("pressed", this,"_new_project");

	Button* import = memnew( Button );
	import->set_text("Import");
	tree_vb->add_child(import);
	import->connect("pressed", this,"_import_project");


	Button* erase = memnew( Button );
	erase->set_text("Erase");
	tree_vb->add_child(erase);
	erase->connect("pressed", this,"_erase_project");
	erase_btn=erase;


	tree_vb->add_spacer();

	Button * cancel = memnew( Button );
	cancel->set_text("Exit");
	tree_vb->add_child(cancel);
	cancel->connect("pressed", this,"_exit_dialog");


	vb->add_margin_child("\n",memnew(Control));
	vb->add_child(memnew(HSeparator));

	l = memnew( Label );
	String cp;
	cp.push_back(0xA9);
	cp.push_back(0);
	l->set_text(cp+" 2008-2015 Juan Linietsky, Ariel Manzur.");
	l->set_align(Label::ALIGN_CENTER);
	vb->add_child(l);


	erase_ask = memnew( ConfirmationDialog );
	erase_ask->get_ok()->set_text("Erase");
	erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm");

	add_child(erase_ask);

	multi_open_ask = memnew( ConfirmationDialog );
	multi_open_ask->get_ok()->set_text("Edit");
	multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm");

	add_child(multi_open_ask);

	multi_run_ask = memnew( ConfirmationDialog );
	multi_run_ask->get_ok()->set_text("Run");
	multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm");

	add_child(multi_run_ask);

	OS::get_singleton()->set_low_processor_usage_mode(true);

	npdialog = memnew( NewProjectDialog );
	add_child(npdialog);

	npdialog->connect("project_created", this,"_load_recent_projects");
	_load_recent_projects();

	if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) {
		_scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") );
	}

	//get_ok()->set_text("Open");
	//get_ok()->set_text("Exit");

	last_clicked = "";
}
Example #27
0
EditorLog::EditorLog() {

	VBoxContainer *vb = memnew( VBoxContainer);
	add_child(vb);
	vb->set_v_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *hb = memnew( HBoxContainer );
	vb->add_child(hb);
	title = memnew( Label );
	title->set_text(" Output:");
	title->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(title);


	button = memnew( ToolButton );
	button->set_text_align(Button::ALIGN_LEFT);
	button->connect("pressed",this,"_flip_request");
	button->set_focus_mode(FOCUS_NONE);
	button->set_clip_text(true);
	button->set_tooltip("Open/Close output panel.");

	//pd = memnew( PaneDrag );
	//hb->add_child(pd);
	//pd->connect("dragged",this,"_dragged");
	//pd->set_default_cursor_shape(Control::CURSOR_MOVE);

	tb = memnew( TextureButton );
	hb->add_child(tb);
	tb->connect("pressed",this,"_close_request");


	ec = memnew( Control);
	vb->add_child(ec);
	ec->set_custom_minimum_size(Size2(0,100));
	ec->set_v_size_flags(SIZE_EXPAND_FILL);


	PanelContainer *pc = memnew( PanelContainer );
	pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
	ec->add_child(pc);
	pc->set_area_as_parent_rect();

	log = memnew( RichTextLabel );
	log->set_scroll_follow(true);
	log->set_selection_enabled(true);
	log->set_focus_mode(FOCUS_CLICK);
	pc->add_child(log);
	add_message(VERSION_FULL_NAME" (c) 2008-2014 Juan Linietsky, Ariel Manzur.");
	//log->add_text("Initialization Complete.\n"); //because it looks cool.
	add_style_override("panel",get_stylebox("panelf","Panel"));

	eh.errfunc=_error_handler;
	eh.userdata=this;
	add_error_handler(&eh);

	current=Thread::get_caller_ID();

	EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk,this);

	hide();

}
Example #28
0
EditorHelp::EditorHelp(EditorNode *p_editor) {

	editor=p_editor;

	VBoxContainer *vbc = this;

	HBoxContainer *panel_hb = memnew( HBoxContainer );

	Button *b = memnew( Button );
	b->set_text("Class List");
	panel_hb->add_child(b);
	vbc->add_child(panel_hb);
	b->set_toggle_mode(true);
	b->set_pressed(true);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_LIST));
	class_list_button=b;
	class_list_button->hide();

	b = memnew( Button );
	b->set_text("Class");
	panel_hb->add_child(b);
	edited_class=b;
	edited_class->hide();
	b->set_toggle_mode(true);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_DESC));
	edited_class->hide();

	b = memnew( Button );
	b->set_text("Search in Classes");
	panel_hb->add_child(b);
	b->connect("pressed",this,"_button_pressed",make_binds(CLASS_SEARCH));

	Control *expand = memnew( Control );
	expand->set_h_size_flags(SIZE_EXPAND_FILL);
	panel_hb->add_child(expand);

	b = memnew( Button );
	panel_hb->add_child(b);
	back=b;
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_PREV));

	b = memnew( Button );
	panel_hb->add_child(b);
	forward=b;
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_CLASS_NEXT));

	Separator *hs = memnew( VSeparator );
	panel_hb->add_child(hs);
	EmptyControl *ec = memnew( EmptyControl );
	ec->set_minsize(Size2(200,1));
	panel_hb->add_child(ec);
	search = memnew( LineEdit );
	ec->add_child(search);
	search->set_area_as_parent_rect();
	search->connect("text_entered",this,"_search");

	b = memnew( Button );
	b->set_text("Find");
	panel_hb->add_child(b);
	b->connect("pressed",this,"_button_pressed",make_binds(PAGE_SEARCH));

	hs = memnew( VSeparator );
	panel_hb->add_child(hs);

	h_split = memnew( HSplitContainer );
	h_split->set_v_size_flags(SIZE_EXPAND_FILL);


	vbc->add_child(h_split);

	class_list = memnew( Tree );
	h_split->add_child(class_list);
	//class_list->connect("meta_clicked",this,"_class_list_select");
	//class_list->set_selection_enabled(true);

	{
		PanelContainer *pc = memnew( PanelContainer );
		pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
		h_split->add_child(pc);
		class_desc = memnew( RichTextLabel );
		pc->add_child(class_desc);
		class_desc->connect("meta_clicked",this,"_class_desc_select");
	}

	class_desc->get_v_scroll()->connect("value_changed",this,"_scroll_changed");
	class_desc->set_selection_enabled(true);
	editor=p_editor;
	history_pos=0;
	scroll_locked=false;
	select_locked=false;
	set_process_unhandled_key_input(true);
	h_split->set_split_offset(200);
	class_list->connect("cell_selected",this,"_tree_item_selected");
	class_desc->hide();

	class_search = memnew( EditorHelpSearch(editor) );
	editor->get_gui_base()->add_child(class_search);
	class_search->connect("go_to_help",this,"_help_callback");
//	prev_search_page=-1;
}
Example #29
0
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {

	scene_tree_editor = p_scene_tree_editor;
	undo_redo = p_undo_redo;
	preview_node = NULL;

	set_title(TTR("Batch Rename"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	// -- Search/Replace Area

	GridContainer *grd_main = memnew(GridContainer);
	grd_main->set_columns(2);
	grd_main->set_v_size_flags(SIZE_EXPAND_FILL);
	vbc->add_child(grd_main);

	// ---- 1st & 2nd row

	Label *lbl_search = memnew(Label);
	lbl_search->set_text(TTR("Search"));

	lne_search = memnew(LineEdit);
	lne_search->set_placeholder(TTR("Search"));
	lne_search->set_name("lne_search");
	lne_search->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *lbl_replace = memnew(Label);
	lbl_replace->set_text(TTR("Replace"));

	lne_replace = memnew(LineEdit);
	lne_replace->set_placeholder(TTR("Replace"));
	lne_replace->set_name("lne_replace");
	lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);

	grd_main->add_child(lbl_search);
	grd_main->add_child(lbl_replace);
	grd_main->add_child(lne_search);
	grd_main->add_child(lne_replace);

	// ---- 3rd & 4th row

	Label *lbl_prefix = memnew(Label);
	lbl_prefix->set_text(TTR("Prefix"));

	lne_prefix = memnew(LineEdit);
	lne_prefix->set_placeholder(TTR("Prefix"));
	lne_prefix->set_name("lne_prefix");
	lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *lbl_suffix = memnew(Label);
	lbl_suffix->set_text(TTR("Suffix"));

	lne_suffix = memnew(LineEdit);
	lne_suffix->set_placeholder(TTR("Suffix"));
	lne_suffix->set_name("lne_suffix");
	lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);

	grd_main->add_child(lbl_prefix);
	grd_main->add_child(lbl_suffix);
	grd_main->add_child(lne_prefix);
	grd_main->add_child(lne_suffix);

	// -- Feature Tabs

	const int feature_min_height = 160;

	Ref<Theme> collapse_theme = create_editor_theme();
	collapse_theme->set_icon("checked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
	collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons"));

	CheckBox *chk_collapse_features = memnew(CheckBox);
	chk_collapse_features->set_text(TTR("Advanced options"));
	chk_collapse_features->set_theme(collapse_theme);
	chk_collapse_features->set_focus_mode(FOCUS_NONE);
	vbc->add_child(chk_collapse_features);

	tabc_features = memnew(TabContainer);
	tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
	vbc->add_child(tabc_features);

	// ---- Tab Substitute

	VBoxContainer *vbc_substitute = memnew(VBoxContainer);
	vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));

	vbc_substitute->set_name(TTR("Substitute"));
	tabc_features->add_child(vbc_substitute);

	cbut_substitute = memnew(CheckButton);
	cbut_substitute->set_text(TTR("Substitute"));
	vbc_substitute->add_child(cbut_substitute);

	GridContainer *grd_substitute = memnew(GridContainer);
	grd_substitute->set_columns(3);
	vbc_substitute->add_child(grd_substitute);

	// Name

	but_insert_name = memnew(Button);
	but_insert_name->set_text("NAME");
	but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name"));
	but_insert_name->set_focus_mode(FOCUS_NONE);
	but_insert_name->connect("pressed", this, "_insert_text", make_binds("${NAME}"));
	but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_name);

	// Parent

	but_insert_parent = memnew(Button);
	but_insert_parent->set_text("PARENT");
	but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available"));
	but_insert_parent->set_focus_mode(FOCUS_NONE);
	but_insert_parent->connect("pressed", this, "_insert_text", make_binds("${PARENT}"));
	but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_parent);

	// Type

	but_insert_type = memnew(Button);
	but_insert_type->set_text("TYPE");
	but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type"));
	but_insert_type->set_focus_mode(FOCUS_NONE);
	but_insert_type->connect("pressed", this, "_insert_text", make_binds("${TYPE}"));
	but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_type);

	// Scene

	but_insert_scene = memnew(Button);
	but_insert_scene->set_text("SCENE");
	but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name"));
	but_insert_scene->set_focus_mode(FOCUS_NONE);
	but_insert_scene->connect("pressed", this, "_insert_text", make_binds("${SCENE}"));
	but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_scene);

	// Root

	but_insert_root = memnew(Button);
	but_insert_root->set_text("ROOT");
	but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name"));
	but_insert_root->set_focus_mode(FOCUS_NONE);
	but_insert_root->connect("pressed", this, "_insert_text", make_binds("${ROOT}"));
	but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_root);

	// Count

	but_insert_count = memnew(Button);
	but_insert_count->set_text("COUNTER");
	but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
	but_insert_count->set_focus_mode(FOCUS_NONE);
	but_insert_count->connect("pressed", this, "_insert_text", make_binds("${COUNTER}"));
	but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_count);

	chk_per_level_counter = memnew(CheckBox);
	chk_per_level_counter->set_text(TTR("Per Level counter"));
	chk_per_level_counter->set_tooltip(TTR("If set the counter restarts for each group of child nodes"));
	vbc_substitute->add_child(chk_per_level_counter);

	HBoxContainer *hbc_count_options = memnew(HBoxContainer);
	vbc_substitute->add_child(hbc_count_options);

	Label *lbl_count_start = memnew(Label);
	lbl_count_start->set_text(TTR("Start"));
	lbl_count_start->set_tooltip(TTR("Initial value for the counter"));
	hbc_count_options->add_child(lbl_count_start);

	spn_count_start = memnew(SpinBox);
	spn_count_start->set_tooltip(TTR("Initial value for the counter"));
	spn_count_start->set_step(1);
	spn_count_start->set_min(0);
	hbc_count_options->add_child(spn_count_start);

	Label *lbl_count_step = memnew(Label);
	lbl_count_step->set_text(TTR("Step"));
	lbl_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
	hbc_count_options->add_child(lbl_count_step);

	spn_count_step = memnew(SpinBox);
	spn_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
	spn_count_step->set_step(1);
	hbc_count_options->add_child(spn_count_step);

	Label *lbl_count_padding = memnew(Label);
	lbl_count_padding->set_text(TTR("Padding"));
	lbl_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
	hbc_count_options->add_child(lbl_count_padding);

	spn_count_padding = memnew(SpinBox);
	spn_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
	spn_count_padding->set_step(1);
	hbc_count_options->add_child(spn_count_padding);

	// ---- Tab RegEx

	VBoxContainer *vbc_regex = memnew(VBoxContainer);
	vbc_regex->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_regex->set_name(TTR("Regular Expressions"));
	vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height));
	tabc_features->add_child(vbc_regex);

	cbut_regex = memnew(CheckButton);
	cbut_regex->set_text(TTR("Regular Expressions"));
	vbc_regex->add_child(cbut_regex);

	// ---- Tab Process

	VBoxContainer *vbc_process = memnew(VBoxContainer);
	vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_process->set_name(TTR("Post-Process"));
	vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
	tabc_features->add_child(vbc_process);

	cbut_process = memnew(CheckButton);
	cbut_process->set_text(TTR("Post-Process"));
	vbc_process->add_child(cbut_process);

	// ------ Style

	HBoxContainer *hbc_style = memnew(HBoxContainer);
	vbc_process->add_child(hbc_style);

	Label *lbl_style = memnew(Label);
	lbl_style->set_text(TTR("Style"));
	hbc_style->add_child(lbl_style);

	opt_style = memnew(OptionButton);
	opt_style->add_item(TTR("Keep"));
	opt_style->add_item(TTR("CamelCase to under_scored"));
	opt_style->add_item(TTR("under_scored to CamelCase"));
	hbc_style->add_child(opt_style);

	// ------ Case

	HBoxContainer *hbc_case = memnew(HBoxContainer);
	vbc_process->add_child(hbc_case);

	Label *lbl_case = memnew(Label);
	lbl_case->set_text(TTR("Case"));
	hbc_case->add_child(lbl_case);

	opt_case = memnew(OptionButton);
	opt_case->add_item(TTR("Keep"));
	opt_case->add_item(TTR("To Lowercase"));
	opt_case->add_item(TTR("To Uppercase"));
	hbc_case->add_child(opt_case);

	// -- Preview

	HSeparator *sep_preview = memnew(HSeparator);
	sep_preview->set_custom_minimum_size(Size2(10, 20));
	vbc->add_child(sep_preview);

	lbl_preview_title = memnew(Label);
	lbl_preview_title->set_text(TTR("Preview"));
	vbc->add_child(lbl_preview_title);

	lbl_preview = memnew(Label);
	lbl_preview->set_text("");
	lbl_preview->add_color_override("font_color", Color(1, 0.5f, 0, 1));
	vbc->add_child(lbl_preview);

	// ---- Dialog related

	set_custom_minimum_size(Size2(383, 0));
	set_as_toplevel(true);
	get_ok()->set_text(TTR("Rename"));
	Button *but_reset = add_button(TTR("Reset"));

	eh.errfunc = _error_handler;
	eh.userdata = this;

	// ---- Connections

	chk_collapse_features->connect("toggled", this, "_features_toggled");

	// Substitite Buttons

	lne_search->connect("focus_entered", this, "_update_substitute");
	lne_search->connect("focus_exited", this, "_update_substitute");
	lne_replace->connect("focus_entered", this, "_update_substitute");
	lne_replace->connect("focus_exited", this, "_update_substitute");
	lne_prefix->connect("focus_entered", this, "_update_substitute");
	lne_prefix->connect("focus_exited", this, "_update_substitute");
	lne_suffix->connect("focus_entered", this, "_update_substitute");
	lne_suffix->connect("focus_exited", this, "_update_substitute");

	// Preview

	lne_prefix->connect("text_changed", this, "_update_preview");
	lne_suffix->connect("text_changed", this, "_update_preview");
	lne_search->connect("text_changed", this, "_update_preview");
	lne_replace->connect("text_changed", this, "_update_preview");
	spn_count_start->connect("value_changed", this, "_update_preview_int");
	spn_count_step->connect("value_changed", this, "_update_preview_int");
	spn_count_padding->connect("value_changed", this, "_update_preview_int");
	opt_style->connect("item_selected", this, "_update_preview_int");
	opt_case->connect("item_selected", this, "_update_preview_int");
	cbut_substitute->connect("pressed", this, "_update_preview", varray(""));
	cbut_regex->connect("pressed", this, "_update_preview", varray(""));
	cbut_process->connect("pressed", this, "_update_preview", varray(""));

	but_reset->connect("pressed", this, "reset");

	reset();
	_features_toggled(false);
}
	EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title("Import Translation");

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);



		VBoxContainer *csvb = memnew( VBoxContainer );

		HBoxContainer *hbc = memnew( HBoxContainer );
		csvb->add_child(hbc);
		vbc->add_margin_child("Source CSV:",csvb);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);
		ignore_first = memnew( CheckButton );
		ignore_first->set_text("Ignore First Row");
		csvb->add_child(ignore_first);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		VBoxContainer *tcomp = memnew( VBoxContainer);
		hbc = memnew( HBoxContainer );
		tcomp->add_child(hbc);
		vbc->add_margin_child("Target Path:",tcomp);

		save_path = memnew( LineEdit );
		save_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(save_path);

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		compress = memnew( CheckButton);
		compress->set_pressed(true);
		compress->set_text("Compress");
		tcomp->add_child(compress);

		add_to_project = memnew( CheckButton);
		add_to_project->set_pressed(true);
		add_to_project->set_text("Add to Project (engine.cfg)");
		tcomp->add_child(add_to_project);

		file_select = memnew(FileDialog);
		file_select->set_access(FileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(FileDialog::MODE_OPEN_FILE);
		file_select->connect("file_selected", this,"_choose_file");
		file_select->add_filter("*.csv ; Translation CSV");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(FileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);

		columns = memnew( Tree );
		vbc->add_margin_child("Import Languages:",columns,true);
	}