NewProjectDialog() { VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); Label* l = memnew(Label); l->set_text("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("Browse"); browse->connect("pressed", this,"_browse_path"); l = memnew(Label); l->set_text("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("New Game Project"); l = memnew(Label); l->set_text("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); get_ok()->set_text("Create"); 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); 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); import_mode=false; }
OrphanResourcesDialog::OrphanResourcesDialog(){ VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); files = memnew( Tree ); files->set_columns(2); files->set_column_titles_visible(true); files->set_column_min_width(1,100); files->set_column_expand(0,true); files->set_column_expand(1,false); files->set_column_title(0,"Resource"); files->set_column_title(1,TTR("Owns")); files->set_hide_root(true); vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"),files,true); set_title(TTR("Orphan Resource Explorer")); delete_confirm = memnew( ConfirmationDialog ); delete_confirm->set_text(TTR("Delete selected files?")); get_ok()->set_text(TTR("Delete")); add_child(delete_confirm); dep_edit = memnew( DependencyEditor ); add_child(dep_edit); files->connect("button_pressed",this,"_button_pressed"); delete_confirm->connect("confirmed",this,"_delete_confirm"); set_hide_on_ok(false); }
VisualScriptPropertySelector::VisualScriptPropertySelector() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); //set_child_rect(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); 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_text(TTR("Open")); 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"); search_options->set_hide_root(true); search_options->set_hide_folding(true); virtuals_only = false; seq_connect = false; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); help_bit->connect("request_hide", this, "_closed"); search_options->set_columns(3); search_options->set_column_expand(1, false); search_options->set_column_expand(2, false); }
EditorHelpSearch::EditorHelpSearch(EditorNode *p_editor) { editor=p_editor; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *sb_hb = memnew( HBoxContainer); search_box = memnew( LineEdit ); sb_hb->add_child(search_box); search_box->set_h_size_flags(SIZE_EXPAND_FILL); Button *sb = memnew( Button("Search")); sb->connect("pressed",this,"_update_search"); sb_hb->add_child(sb); vbc->add_margin_child("Search:",sb_hb); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child("Matches:",search_options,true); get_ok()->set_text("View"); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); set_title("Search Classes"); // search_options->set_hide_root(true); }
EditorMeshImportDialog(EditorMeshImportPlugin *p_plugin) { plugin=p_plugin; set_title(TTR("Single Mesh Import")); set_hide_on_ok(false); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); //set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child(TTR("Source Mesh(es):"),hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); 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(TTR("Target Path:"),hbc); 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); file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES); file_select->add_filter("*.obj ; Wavefront OBJ"); add_child(file_select); file_select->connect("files_selected", this,"_choose_files"); save_select = memnew( EditorDirDialog ); add_child(save_select); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text(TTR("Import")); error_dialog = memnew( AcceptDialog ); add_child(error_dialog); options = memnew( _EditorMeshImportOptions ); option_editor = memnew( PropertyEditor ); option_editor->hide_top_label(); vbc->add_margin_child(TTR("Options:"),option_editor,true); }
CreateDialog::CreateDialog() { set_resizable(true); HSplitContainer *hbc = memnew(HSplitContainer); add_child(hbc); VBoxContainer *lvbc = memnew(VBoxContainer); hbc->add_child(lvbc); lvbc->set_custom_minimum_size(Size2(150, 0) * EDSCALE); favorites = memnew(Tree); lvbc->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); recent = memnew(Tree); lvbc->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); hbc->add_child(vbc); 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_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_text(TTR("Create")); 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"); //search_options->set_hide_root(true); base_type = "Object"; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); help_bit->connect("request_hide", this, "_closed"); }
EditorSubScene::EditorSubScene() { scene = NULL; is_root = false; set_title(TTR("Select Node(s) to Import")); set_hide_on_ok(false); VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); //set_child_rect(vb); HBoxContainer *hb = memnew(HBoxContainer); path = memnew(LineEdit); path->connect("text_entered", this, "_path_changed"); hb->add_child(path); path->set_h_size_flags(SIZE_EXPAND_FILL); Button *b = memnew(Button); b->set_text(" .. "); hb->add_child(b); b->connect("pressed", this, "_path_browse"); vb->add_margin_child(TTR("Scene Path:"), hb); tree = memnew(Tree); tree->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_margin_child(TTR("Import From Node:"), tree, true); tree->set_select_mode(Tree::SELECT_MULTI); tree->connect("multi_selected", this, "_item_multi_selected"); //tree->connect("nothing_selected", this, "_deselect_items"); tree->connect("cell_selected", this, "_selected_changed"); tree->connect("item_activated", this, "_ok", make_binds(), CONNECT_DEFERRED); file_dialog = memnew(EditorFileDialog); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene", &extensions); for (List<String>::Element *E = extensions.front(); E; E = E->next()) { file_dialog->add_filter("*." + E->get()); } file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); add_child(file_dialog); file_dialog->connect("file_selected", this, "_path_selected"); }
GotoLineDialog::GotoLineDialog() { set_title("Go to Line"); Label *l = memnew(Label); l->set_text("Line Number:"); l->set_pos(Point2(5,5)); add_child(l); line = memnew( LineEdit ); line->set_anchor( MARGIN_RIGHT, ANCHOR_END ); line->set_begin( Point2(15,22) ); line->set_end( Point2(15,35) ); add_child(line); register_text_enter(line); text_editor=NULL; set_hide_on_ok(false); }
EditorAssetInstaller::EditorAssetInstaller() { VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); tree = memnew(Tree); vb->add_margin_child("Package Contents:", tree, true); tree->connect("item_edited", this, "_item_edited"); error = memnew(AcceptDialog); add_child(error); get_ok()->set_text(TTR("Install")); set_title(TTR("Package Installer")); updating = false; set_hide_on_ok(true); }
ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) { editor=p_editor; set_title("Edit Connections.."); set_hide_on_ok(false); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); tree = memnew( Tree ); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_margin_child("Connections:",tree,true); // add_child(tree); connect_dialog = memnew( ConnectDialog ); connect_dialog->set_as_toplevel(true); add_child(connect_dialog); remove_confirm = memnew( ConfirmationDialog ); remove_confirm->set_as_toplevel(true); add_child(remove_confirm); /* 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) ); */ remove_confirm->connect("confirmed", this,"_remove_confirm"); connect_dialog->connect("connected", this,"_connect"); tree->connect("item_selected", this,"_something_selected"); get_cancel()->set_text("Close"); }
EditorQuickOpen::EditorQuickOpen() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child("Search:",search_box); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child("Matches:",search_options,true); get_ok()->set_text("Open"); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); search_options->set_hide_root(true); }
CreateDialog::CreateDialog() { VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); search_box = memnew( LineEdit ); vbc->add_margin_child(TTR("Search:"),search_box); search_box->connect("text_changed",this,"_text_changed"); search_box->connect("input_event",this,"_sbox_input"); search_options = memnew( Tree ); vbc->add_margin_child(TTR("Matches:"),search_options,true); get_ok()->set_text(TTR("Create")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); // search_options->set_hide_root(true); base_type="Object"; }
EditorSubScene::EditorSubScene() { set_title("Select Sub-Scene.."); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); HBoxContainer *hb = memnew( HBoxContainer ); path = memnew( LineEdit ); path->connect("text_entered",this,"_path_changed"); hb->add_child(path); path->set_h_size_flags(SIZE_EXPAND_FILL); Button *b = memnew( Button ); b->set_text(" .. "); hb->add_child(b); b->connect("pressed",this,"_path_browse"); vb->add_margin_child("Scene Path:",hb); tree = memnew( Tree ); tree->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_margin_child("Import From Node:",tree)->set_v_size_flags(SIZE_EXPAND_FILL); file_dialog = memnew( FileDialog ); List<String> extensions; ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); for(List<String>::Element *E = extensions.front();E;E=E->next() ) { file_dialog->add_filter("*."+E->get()); } file_dialog->set_mode(FileDialog::MODE_OPEN_FILE); add_child(file_dialog); file_dialog->connect("file_selected",this,"_path_selected"); scene=NULL; set_hide_on_ok(false); }
GotoLineDialog::GotoLineDialog() { set_title(TTR("Go to Line")); 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); Label *l = memnew(Label); l->set_text(TTR("Line Number:")); vbc->add_child(l); line = memnew(LineEdit); vbc->add_child(line); register_text_enter(line); text_editor = NULL; set_hide_on_ok(false); }
EditorDirDialog::EditorDirDialog() { updating = false; set_title(TTR("Choose a Directory")); set_hide_on_ok(false); tree = memnew(Tree); add_child(tree); tree->connect("item_activated", this, "_ok"); makedir = add_button(TTR("Create Folder"), OS::get_singleton()->get_swap_ok_cancel() ? true : false, "makedir"); makedir->connect("pressed", this, "_make_dir"); makedialog = memnew(ConfirmationDialog); makedialog->set_title(TTR("Create Folder")); add_child(makedialog); VBoxContainer *makevb = memnew(VBoxContainer); makedialog->add_child(makevb); //makedialog->set_child_rect(makevb); makedirname = memnew(LineEdit); makevb->add_margin_child(TTR("Name:"), makedirname); 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); get_ok()->set_text(TTR("Choose")); must_reload = false; }
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(TTR("Class Name:"),vb2); parent_name = memnew( LineEdit ); vb->add_margin_child(TTR("Inherits:"),parent_name); parent_name->connect("text_changed", this,"_class_name_changed"); language_menu = memnew( OptionButton ); vb->add_margin_child(TTR("Language"),language_menu); for(int i=0;i<ScriptServer::get_language_count();i++) { language_menu->add_item(ScriptServer::get_language(i)->get_name()); } editor_settings = EditorSettings::get_singleton(); String last_selected_language = editor_settings->get_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); break; } else 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(TTR("Error!")); path_error_label->set_align(Label::ALIGN_CENTER); internal = memnew( CheckButton ); internal->set_text(TTR("Built-In Script")); vb2->add_child(internal); internal->connect("pressed",this,"_built_in_pressed"); vb->add_margin_child(TTR("Path:"),vb2); set_size(Size2(200,150)); set_hide_on_ok(false); set_title(TTR("Attach Node Script")); 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 ); add_child(alert); _lang_changed(0); create_new=true; }
EditorSettingsDialog::EditorSettingsDialog() { set_title(TTR("Editor Settings")); set_resizable(true); undo_redo = memnew(UndoRedo); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); tabs->connect("tab_changed", this, "_tabs_tab_changed"); add_child(tabs); //set_child_rect(tabs); // General Tab tab_general = memnew(VBoxContainer); tabs->add_child(tab_general); tab_general->set_name(TTR("General")); HBoxContainer *hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); tab_general->add_child(hbc); search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(search_box); inspector = memnew(SectionedInspector); //inspector->hide_top_label(); inspector->get_inspector()->set_use_filter(true); inspector->register_search_box(search_box); inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL); inspector->get_inspector()->set_undo_redo(undo_redo); tab_general->add_child(inspector); inspector->get_inspector()->connect("property_edited", this, "_settings_property_edited"); inspector->get_inspector()->connect("restart_requested", this, "_editor_restart_request"); restart_container = memnew(PanelContainer); tab_general->add_child(restart_container); HBoxContainer *restart_hb = memnew(HBoxContainer); restart_container->add_child(restart_hb); restart_icon = memnew(TextureRect); restart_icon->set_v_size_flags(SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); restart_label->set_text(TTR("Editor must be restarted for changes to take effect")); restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); restart_button->connect("pressed", this, "_editor_restart"); restart_hb->add_child(restart_button); restart_button->set_text(TTR("Save & Restart")); restart_close_button = memnew(ToolButton); restart_close_button->connect("pressed", this, "_editor_restart_close"); restart_hb->add_child(restart_close_button); restart_container->hide(); // Shortcuts Tab tab_shortcuts = memnew(VBoxContainer); tabs->add_child(tab_shortcuts); tab_shortcuts->set_name(TTR("Shortcuts")); hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); tab_shortcuts->add_child(hbc); 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"); shortcuts = memnew(Tree); tab_shortcuts->add_child(shortcuts, true); shortcuts->set_v_size_flags(SIZE_EXPAND_FILL); 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, TTR("Name")); shortcuts->set_column_title(1, TTR("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); Label *l = memnew(Label); l->set_text(TTR("Press a Key...")); l->set_anchors_and_margins_preset(Control::PRESET_WIDE); 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; }
FindReplaceDialog::FindReplaceDialog() { set_self_opacity(0.8); VBoxContainer *vb = memnew( VBoxContainer ); add_child(vb); set_child_rect(vb); search_text = memnew( LineEdit ); vb->add_margin_child("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("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("Whole Words"); svb->add_child(whole_words); case_sensitive = memnew( CheckButton ); case_sensitive->set_text("Case Sensitive"); svb->add_child(case_sensitive); backwards = memnew( CheckButton ); backwards->set_text("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("Prompt On Replace"); rvb->add_child(prompt); prompt->connect("pressed", this,"_prompt_changed"); selection_only = memnew( CheckButton ); selection_only->set_text("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("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); }
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); }
EditorSampleImportDialog(EditorSampleImportPlugin *p_plugin) { plugin=p_plugin; set_title("Import Audio Samples"); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child("Source Sample(s):",hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); 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); 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(FileDialog); file_select->set_access(FileDialog::ACCESS_FILESYSTEM); add_child(file_select); file_select->set_mode(FileDialog::MODE_OPEN_FILES); file_select->connect("files_selected", this,"_choose_files"); file_select->add_filter("*.wav ; MS Waveform"); 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); options = memnew( _EditorSampleImportOptions ); option_editor = memnew( PropertyEditor ); option_editor->hide_top_label(); vbc->add_margin_child("Options:",option_editor,true); }
EditorSettingsDialog::EditorSettingsDialog() { set_title(TTR("Editor Settings")); tabs = memnew( TabContainer ); 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->get_property_editor()->register_text_enter(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("input_event",this,"_wait_for_key"); press_a_key->connect("confirmed",this,"_press_a_key_confirm"); //Button *load = memnew( Button ); //load->set_text("Load.."); //hbc->add_child(load); //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; }
FindReplaceDialog::FindReplaceDialog() { set_self_modulate(Color(1, 1, 1, 0.8)); VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); search_text = memnew(LineEdit); vb->add_margin_child(TTR("Search"), search_text); search_text->connect("text_entered", this, "_search_text_entered"); 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_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", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); vb->add_child(error_label); set_hide_on_ok(false); }
EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) { plugin=p_plugin; set_title(TTR("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(TTR("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(TTR("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(TTR("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(TTR("Compress")); tcomp->add_child(compress); add_to_project = memnew( CheckButton); add_to_project->set_pressed(true); add_to_project->set_text(TTR("Add to Project (engine.cfg)")); tcomp->add_child(add_to_project); file_select = memnew(EditorFileDialog); file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM); add_child(file_select); file_select->set_mode(EditorFileDialog::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(EditorFileDialog::MODE_OPEN_DIR); save_select->connect("dir_selected", this,"_choose_save_dir"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text(TTR("Import")); error_dialog = memnew ( ConfirmationDialog ); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); // error_dialog->get_cancel()->hide(); set_hide_on_ok(false); columns = memnew( Tree ); vbc->add_margin_child(TTR("Import Languages:"),columns,true); }
EditorFileDialog::EditorFileDialog() { show_hidden_files=default_show_hidden_files; display_mode=default_display_mode; local_history_pos=0; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); mode=MODE_SAVE_FILE; set_title(TTR("Save a File")); 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; }
EditorAbout::EditorAbout() { set_title(TTR("Thanks from the Godot community!")); get_ok()->set_text(TTR("Thanks!")); set_hide_on_ok(true); set_resizable(true); VBoxContainer *vbc = memnew(VBoxContainer); HBoxContainer *hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->set_alignment(BoxContainer::ALIGN_CENTER); hbc->add_constant_override("separation", 30 * EDSCALE); add_child(vbc); vbc->add_child(hbc); _logo = memnew(TextureRect); hbc->add_child(_logo); String hash = String(VERSION_HASH); if (hash.length() != 0) hash = "." + hash.left(7); Label *about_text = memnew(Label); about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER); about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n"); hbc->add_child(about_text); TabContainer *tc = memnew(TabContainer); tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE); tc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tc); // Authors List<String> dev_sections; dev_sections.push_back(TTR("Project Founders")); dev_sections.push_back(TTR("Lead Developer")); dev_sections.push_back(TTR("Project Manager")); dev_sections.push_back(TTR("Developers")); const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names }; tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src)); // Donors List<String> donor_sections; donor_sections.push_back(TTR("Platinum Sponsors")); donor_sections.push_back(TTR("Gold Sponsors")); donor_sections.push_back(TTR("Mini Sponsors")); donor_sections.push_back(TTR("Gold Donors")); donor_sections.push_back(TTR("Silver Donors")); donor_sections.push_back(TTR("Bronze Donors")); const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze }; tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src)); // License TextEdit *license = memnew(TextEdit); license->set_name(TTR("License")); license->set_h_size_flags(Control::SIZE_EXPAND_FILL); license->set_v_size_flags(Control::SIZE_EXPAND_FILL); license->set_wrap(true); license->set_readonly(true); license->set_text(String::utf8(about_license)); tc->add_child(license); // Thirdparty License VBoxContainer *license_thirdparty = memnew(VBoxContainer); license_thirdparty->set_name(TTR("Thirdparty License")); license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL); tc->add_child(license_thirdparty); Label *tpl_label = memnew(Label); tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); tpl_label->set_autowrap(true); tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms.")); license_thirdparty->add_child(tpl_label); HSplitContainer *tpl_hbc = memnew(HSplitContainer); tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL); tpl_hbc->set_split_offset(240 * EDSCALE); license_thirdparty->add_child(tpl_hbc); _tpl_tree = memnew(Tree); _tpl_tree->set_hide_root(true); TreeItem *root = _tpl_tree->create_item(); TreeItem *tpl_ti_all = _tpl_tree->create_item(root); tpl_ti_all->set_text(0, TTR("All Components")); TreeItem *tpl_ti_tp = _tpl_tree->create_item(root); tpl_ti_tp->set_text(0, TTR("Components")); tpl_ti_tp->set_selectable(0, false); TreeItem *tpl_ti_lc = _tpl_tree->create_item(root); tpl_ti_lc->set_text(0, TTR("Licenses")); tpl_ti_lc->set_selectable(0, false); int read_idx = 0; String long_text = ""; for (int i = 0; i < THIRDPARTY_COUNT; i++) { TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp); String thirdparty = String(about_thirdparty[i]); ti->set_text(0, thirdparty); String text = thirdparty + "\n"; long_text += "- " + thirdparty + "\n\n"; for (int j = 0; j < about_tp_copyright_count[i]; j++) { text += "\n Files:\n " + String(about_tp_file[read_idx]).replace("\n", "\n ") + "\n"; String copyright = String::utf8(" \u00A9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n \u00A9 ")); text += copyright; long_text += copyright; String license = "\n License: " + String(about_tp_license[read_idx]) + "\n"; text += license; long_text += license + "\n"; read_idx++; } ti->set_metadata(0, text); } for (int i = 0; i < LICENSE_COUNT; i++) { TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc); String licensename = String(about_license_name[i]); ti->set_text(0, licensename); long_text += "- " + licensename + "\n\n"; String licensebody = String(about_license_body[i]); ti->set_metadata(0, licensebody); long_text += " " + licensebody.replace("\n", "\n ") + "\n\n"; } tpl_ti_all->set_metadata(0, long_text); tpl_hbc->add_child(_tpl_tree); _tpl_text = memnew(TextEdit); _tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL); _tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); _tpl_text->set_wrap(true); _tpl_text->set_readonly(true); tpl_hbc->add_child(_tpl_text); _tpl_tree->connect("item_selected", this, "_license_tree_selected"); tpl_ti_all->select(0); _tpl_text->set_text(tpl_ti_all->get_metadata(0)); }
EditorBitMaskImportDialog(EditorBitMaskImportPlugin *p_plugin) { plugin = p_plugin; set_title(TTR("Import BitMasks")); VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); //set_child_rect(vbc); HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_margin_child(TTR("Source Texture(s):"), hbc); import_path = memnew(LineEdit); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); 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(TTR("Target Path:"), hbc); 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); file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES); file_select->connect("files_selected", this, "_choose_files"); List<String> extensions; ImageLoader::get_recognized_extensions(&extensions); file_select->clear_filters(); for (int i = 0; i<extensions.size(); i++) { file_select->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } 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(TTR("Import")); error_dialog = memnew(ConfirmationDialog); add_child(error_dialog); error_dialog->get_ok()->set_text(TTR("Accept")); //error_dialog->get_cancel()->hide(); set_hide_on_ok(false); }
EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSceneImportPlugin *p_plugin) { editor=p_editor; plugin=p_plugin; set_title("Import 3D Scene"); HBoxContainer *import_hb = memnew( HBoxContainer ); add_child(import_hb); set_child_rect(import_hb); VBoxContainer *vbc = memnew( VBoxContainer ); import_hb->add_child(vbc); vbc->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *hbc = memnew( HBoxContainer ); vbc->add_margin_child("Source Scene:",hbc); import_path = memnew( LineEdit ); import_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(import_path); 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 Scene:",hbc); 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"); texture_action = memnew( OptionButton ); texture_action->add_item("Same as Target Scene"); texture_action->add_item("Shared"); texture_action->select(0); vbc->add_margin_child("Target Texture Folder:",texture_action); import_options = memnew( Tree ); vbc->set_v_size_flags(SIZE_EXPAND_FILL); vbc->add_margin_child("Options:",import_options,true); 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"); save_select = memnew(EditorDirDialog); add_child(save_select); //save_select->set_mode(FileDialog::MODE_SAVE_FILE); save_select->connect("dir_selected", this,"_choose_save_file"); get_ok()->connect("pressed", this,"_import"); get_ok()->set_text("Import"); TreeItem *root = import_options->create_item(NULL); import_options->set_hide_root(true); TreeItem *importopts = import_options->create_item(root); importopts->set_text(0,"Import:"); const FlagInfo* fn=scene_flag_names; while(fn->text) { TreeItem *opt = import_options->create_item(importopts); opt->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); opt->set_checked(0,true); opt->set_editable(0,true); opt->set_text(0,fn->text); opt->set_metadata(0,fn->value); scene_flags.push_back(opt); fn++; } hbc = memnew( HBoxContainer ); vbc->add_margin_child("Post-Process Script:",hbc); script_path = memnew( LineEdit ); script_path->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(script_path); Button * script_choose = memnew( Button ); script_choose->set_text(" .. "); hbc->add_child(script_choose); script_choose->connect("pressed", this,"_browse_script"); script_select = memnew(FileDialog); add_child(script_select); for(int i=0;i<ScriptServer::get_language_count();i++) { ScriptLanguage *sl=ScriptServer::get_language(i); String ext = sl->get_extension(); if (ext=="") continue; script_select->add_filter("*."+ext+" ; "+sl->get_name()); } script_select->set_mode(FileDialog::MODE_OPEN_FILE); script_select->connect("file_selected", this,"_choose_script"); 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); 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)); import_hb->add_constant_override("separation",30); VBoxContainer *ovb = memnew( VBoxContainer); ovb->set_h_size_flags(SIZE_EXPAND_FILL); import_hb->add_child(ovb); texture_options = memnew( EditorImportTextureOptions ); ovb->add_child(texture_options); texture_options->set_v_size_flags(SIZE_EXPAND_FILL); //animation_options->set_flags(EditorImport:: texture_options->set_format(EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM); texture_options->set_flags( EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA | EditorTextureImportPlugin::IMAGE_FLAG_REPEAT | EditorTextureImportPlugin::IMAGE_FLAG_FILTER ); animation_options = memnew( EditorImportAnimationOptions ); ovb->add_child(animation_options); animation_options->set_v_size_flags(SIZE_EXPAND_FILL); animation_options->set_flags(EditorSceneAnimationImportPlugin::ANIMATION_DETECT_LOOP|EditorSceneAnimationImportPlugin::ANIMATION_KEEP_VALUE_TRACKS|EditorSceneAnimationImportPlugin::ANIMATION_OPTIMIZE); confirm_import = memnew( ConfirmationDialog ); add_child(confirm_import); VBoxContainer *cvb = memnew( VBoxContainer ); confirm_import->add_child(cvb); confirm_import->set_child_rect(cvb); PanelContainer *pc = memnew( PanelContainer ); pc->add_style_override("panel",get_stylebox("normal","TextEdit")); //ec->add_child(pc); missing_files = memnew( RichTextLabel ); cvb->add_margin_child("The Following Files are Missing:",pc,true); pc->add_child(missing_files); confirm_import->get_ok()->set_text("Import Anyway"); confirm_import->get_cancel()->set_text("Cancel"); confirm_import->connect("popup_hide",this,"_dialog_hid"); confirm_import->connect("confirmed",this,"_import_confirm"); confirm_import->set_hide_on_ok(false); add_button("Import & Open",!OS::get_singleton()->get_swap_ok_cancel())->connect("pressed",this,"_open_and_import"); confirm_open = memnew( ConfirmationDialog ); add_child(confirm_open); confirm_open->set_text("Edited scene has not been saved, open imported scene anyway?"); confirm_open->connect("confirmed",this,"_import",varray(true)); wip_import=NULL; wip_blocked=false; wip_open=false; //texture_options->set_format(EditorImport::IMAGE_FORMAT_C); }
FileDialog::FileDialog() { show_hidden_files=true; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); mode=MODE_SAVE_FILE; set_title("Save a File"); dir = memnew(LineEdit); HBoxContainer *pathhb = memnew( HBoxContainer ); pathhb->add_child(dir); dir->set_h_size_flags(SIZE_EXPAND_FILL); drives = memnew( OptionButton ); pathhb->add_child(drives); drives->connect("item_selected",this,"_select_drive"); makedir = memnew( Button ); makedir->set_text("Create Folder"); makedir->connect("pressed",this,"_make_dir"); pathhb->add_child(makedir); vbc->add_margin_child("Path:",pathhb); tree = memnew(Tree); tree->set_hide_root(true); vbc->add_margin_child("Directories & Files:",tree,true); file = memnew(LineEdit); //add_child(file); vbc->add_margin_child("File:",file); filter = memnew( OptionButton ); //add_child(filter); vbc->add_margin_child("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("Create Folder"); VBoxContainer *makevb= memnew( VBoxContainer ); makedialog->add_child(makevb); makedialog->set_child_rect(makevb); makedirname = memnew( LineEdit ); makevb->add_margin_child("Name:",makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); makedialog->connect("confirmed",this,"_make_dir_confirm"); mkdirerr = memnew( AcceptDialog ); mkdirerr->set_text("Could not create folder."); add_child(mkdirerr); exterr = memnew( AcceptDialog ); exterr->set_text("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); }
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", varray(true)); 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")); template_downloader->set_exclusive(true); add_child(template_downloader); template_downloader->connect("popup_hide", this, "_window_template_downloader_closed"); 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: (Shift+Click: Open in Browser)"), 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; }
ProjectSettings::ProjectSettings(EditorData *p_data) { singleton=this; set_title("Project Settings (engine.cfg)"); undo_redo=&p_data->get_undo_redo(); data=p_data; TabContainer *tab_container = memnew( TabContainer ); add_child(tab_container); set_child_rect(tab_container); //tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 ); //tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 ); //tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); Control *props_base = memnew( Control ); tab_container->add_child(props_base); props_base->set_name("General"); globals_editor = memnew( PropertyEditor ); props_base->add_child(globals_editor); globals_editor->set_area_as_parent_rect(); globals_editor->hide_top_label(); globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); globals_editor->set_capitalize_paths(false); globals_editor->get_tree()->connect("cell_selected",this,"_item_selected"); globals_editor->connect("property_toggled",this,"_item_checked"); globals_editor->connect("property_edited",this,"_settings_prop_edited"); Label *l = memnew( Label ); props_base->add_child(l); l->set_pos(Point2(6,5)); l->set_text("Category:"); l = memnew( Label ); l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); props_base->add_child(l); l->set_begin(Point2(0.21,5)); l->set_text("Property:"); l = memnew( Label ); l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); props_base->add_child(l); l->set_begin(Point2(0.51,5)); l->set_text("Type:"); category = memnew( LineEdit ); props_base->add_child(category); category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); category->set_begin( Point2(5,25) ); category->set_end( Point2(0.20,26) ); category->connect("text_entered",this,"_item_adds"); property = memnew( LineEdit ); props_base->add_child(property); property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); property->set_begin( Point2(0.21,25) ); property->set_end( Point2(0.50,26) ); property->connect("text_entered",this,"_item_adds"); type = memnew( OptionButton ); props_base->add_child(type); type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); type->set_begin( Point2(0.51,25) ); type->set_end( Point2(0.70,26) ); type->add_item("bool"); type->add_item("int"); type->add_item("float"); type->add_item("string"); Button *add = memnew( Button ); props_base->add_child(add); add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); add->set_begin( Point2(0.71,25) ); add->set_end( Point2(0.85,26) ); add->set_text("Add"); add->connect("pressed",this,"_item_add"); Button *del = memnew( Button ); props_base->add_child(del); del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); del->set_anchor(MARGIN_RIGHT,ANCHOR_END); del->set_begin( Point2(0.86,25) ); del->set_end( Point2(5,26) ); del->set_text("Del"); del->connect("pressed",this,"_item_del"); Button *save = memnew( Button ); props_base->add_child(save); save->set_anchor(MARGIN_LEFT,ANCHOR_END); save->set_anchor(MARGIN_RIGHT,ANCHOR_END); save->set_anchor(MARGIN_TOP,ANCHOR_END); save->set_anchor(MARGIN_BOTTOM,ANCHOR_END); save->set_begin( Point2(80,28) ); save->set_end( Point2(10,20) ); save->set_text("Save"); save->connect("pressed",this,"_save"); popup_platform = memnew( MenuButton ); popup_platform->set_text("Copy To Platform.."); popup_platform->set_disabled(true); props_base->add_child(popup_platform); popup_platform->set_anchor(MARGIN_LEFT,ANCHOR_BEGIN); popup_platform->set_anchor(MARGIN_RIGHT,ANCHOR_BEGIN); popup_platform->set_anchor(MARGIN_TOP,ANCHOR_END); popup_platform->set_anchor(MARGIN_BOTTOM,ANCHOR_END); popup_platform->set_begin( Point2(10,28) ); popup_platform->set_end( Point2(150,20) ); List<StringName> ep; EditorImportExport::get_singleton()->get_export_platforms(&ep); ep.sort_custom<StringName::AlphCompare>(); for(List<StringName>::Element *E=ep.front();E;E=E->next()) { popup_platform->get_popup()->add_item( E->get() ); } popup_platform->get_popup()->connect("item_pressed",this,"_copy_to_platform"); get_ok()->set_text("Close"); set_hide_on_ok(true); message = memnew( ConfirmationDialog ); add_child(message); // message->get_cancel()->hide(); message->set_hide_on_ok(true); Control *input_base = memnew( Control ); input_base->set_name("Input Map"); input_base->set_area_as_parent_rect();; tab_container->add_child(input_base); l = memnew( Label ); input_base->add_child(l); l->set_pos(Point2(6,5)); l->set_text("Action:"); action_name = memnew( LineEdit ); action_name->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO); action_name->set_begin( Point2(5,25) ); action_name->set_end( Point2(0.85,26) ); input_base->add_child(action_name); action_name->connect("text_entered",this,"_action_adds"); add = memnew( Button ); input_base->add_child(add); add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO); add->set_begin( Point2(0.86,25) ); add->set_anchor(MARGIN_RIGHT,ANCHOR_END); add->set_end( Point2(5,26) ); add->set_text("Add"); add->connect("pressed",this,"_action_add"); input_editor = memnew( Tree ); input_base->add_child(input_editor); input_editor->set_area_as_parent_rect(); input_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 ); input_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); input_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 ); input_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 ); input_editor->connect("item_edited",this,"_action_persist_toggle"); input_editor->connect("button_pressed",this,"_action_button_pressed"); popup_add = memnew( PopupMenu ); add_child(popup_add); popup_add->connect("item_pressed",this,"_add_item"); press_a_key = memnew( ConfirmationDialog ); press_a_key->set_focus_mode(FOCUS_ALL); add_child(press_a_key); l = memnew( Label ); l->set_text("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("input_event",this,"_wait_for_key"); press_a_key->connect("confirmed",this,"_press_a_key_confirm"); device_input=memnew( ConfirmationDialog ); add_child(device_input); device_input->get_ok()->set_text("Add"); device_input->connect("confirmed",this,"_device_input_add"); l = memnew( Label ); l->set_text("Device:"); l->set_pos(Point2(15,10)); device_input->add_child(l); l = memnew( Label ); l->set_text("Index:"); l->set_pos(Point2(90,10)); device_input->add_child(l); device_index_label=l; device_id = memnew( SpinBox ); device_id->set_pos(Point2(20,30)); device_id->set_size(Size2(70,10)); device_id->set_val(0); device_input->add_child(device_id); device_index = memnew( OptionButton ); device_index->set_pos(Point2(95,30)); device_index->set_size(Size2(300,10)); device_index->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10); device_input->add_child(device_index); save = memnew( Button ); input_base->add_child(save); save->set_anchor(MARGIN_LEFT,ANCHOR_END); save->set_anchor(MARGIN_RIGHT,ANCHOR_END); save->set_anchor(MARGIN_TOP,ANCHOR_END); save->set_anchor(MARGIN_BOTTOM,ANCHOR_END); save->set_begin( Point2(80,28) ); save->set_end( Point2(10,20) ); save->set_text("Save"); save->connect("pressed",this,"_save"); setting=false; //translations TabContainer *translations = memnew( TabContainer ); translations->set_name("Localization"); tab_container->add_child(translations); { VBoxContainer *tvb = memnew( VBoxContainer ); translations->add_child(tvb); tvb->set_name("Translations"); HBoxContainer *thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Translations:"))); thb->add_spacer(); Button *addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_file_open"); thb->add_child(addtr); MarginContainer *tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_list = memnew( Tree ); translation_list->set_v_size_flags(SIZE_EXPAND_FILL); tmc->add_child(translation_list); translation_file_open=memnew( FileDialog ); add_child(translation_file_open); translation_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_file_open->connect("file_selected",this,"_translation_add"); } { VBoxContainer *tvb = memnew( VBoxContainer ); translations->add_child(tvb); tvb->set_name("Remaps"); HBoxContainer *thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Resources:"))); thb->add_spacer(); Button *addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_res_file_open"); thb->add_child(addtr); MarginContainer *tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap = memnew( Tree ); translation_remap->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap->connect("cell_selected",this,"_translation_res_select"); tmc->add_child(translation_remap); translation_remap->connect("button_pressed",this,"_translation_res_delete"); translation_res_file_open=memnew( FileDialog ); add_child(translation_res_file_open); translation_res_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_res_file_open->connect("file_selected",this,"_translation_res_add"); thb = memnew( HBoxContainer); tvb->add_child(thb); thb->add_child( memnew( Label("Remaps by Locale:"))); thb->add_spacer(); addtr = memnew( Button("Add..") ); addtr->connect("pressed",this,"_translation_res_option_file_open"); translation_res_option_add_button=addtr; thb->add_child(addtr); tmc = memnew( MarginContainer ); tvb->add_child(tmc); tmc->set_v_size_flags(SIZE_EXPAND_FILL); translation_remap_options = memnew( Tree ); translation_remap_options->set_v_size_flags(SIZE_EXPAND_FILL); tmc->add_child(translation_remap_options); translation_remap_options->set_columns(2); translation_remap_options->set_column_title(0,"Path"); translation_remap_options->set_column_title(1,"Locale"); translation_remap_options->set_column_titles_visible(true); translation_remap_options->set_column_expand(0,true); translation_remap_options->set_column_expand(1,false); translation_remap_options->set_column_min_width(1,200); translation_remap_options->connect("item_edited",this,"_translation_res_option_changed"); translation_remap_options->connect("button_pressed",this,"_translation_res_option_delete"); translation_res_option_file_open=memnew( FileDialog ); add_child(translation_res_option_file_open); translation_res_option_file_open->set_mode(FileDialog::MODE_OPEN_FILE); translation_res_option_file_open->connect("file_selected",this,"_translation_res_option_add"); } { VBoxContainer *avb = memnew( VBoxContainer ); tab_container->add_child(avb); avb->set_name("AutoLoad"); HBoxContainer *ahb = memnew( HBoxContainer); avb->add_child(ahb); VBoxContainer *avb_name = memnew( VBoxContainer ); avb_name->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_name = memnew(LineEdit); avb_name->add_margin_child("Node Name:",autoload_add_name); ahb->add_child(avb_name); VBoxContainer *avb_path = memnew( VBoxContainer ); avb_path->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *ahb_path = memnew( HBoxContainer ); autoload_add_path = memnew(LineEdit); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); ahb_path->add_child(autoload_add_path); Button *browseaa = memnew( Button("..") ); ahb_path->add_child(browseaa); browseaa->connect("pressed",this,"_autoload_file_open"); Button *addaa = memnew( Button("Add") ); ahb_path->add_child(addaa); addaa->connect("pressed",this,"_autoload_add"); avb_path->add_margin_child("Path:",ahb_path); ahb->add_child(avb_path); autoload_list = memnew( Tree ); autoload_list->set_v_size_flags(SIZE_EXPAND_FILL); avb->add_margin_child("List:",autoload_list,true); autoload_file_open=memnew( FileDialog ); add_child(autoload_file_open); autoload_file_open->set_mode(FileDialog::MODE_OPEN_FILE); autoload_file_open->connect("file_selected",this,"_autoload_file_callback"); autoload_list->set_columns(2); autoload_list->set_column_titles_visible(true); autoload_list->set_column_title(0,"name"); autoload_list->set_column_title(1,"path"); autoload_list->connect("button_pressed",this,"_autoload_delete"); } timer = memnew( Timer ); timer->set_wait_time(1.5); timer->connect("timeout",Globals::get_singleton(),"save"); timer->set_one_shot(true); add_child(timer); updating_translations=false; /* Control * es = memnew( Control ); es->set_name("Export"); tab_container->add_child(es); export_settings = memnew( ProjectExportSettings ); es->add_child(export_settings); export_settings->set_area_as_parent_rect(); export_settings->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 ); */ }