diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_autoload_settings.cpp | 28 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 8 | ||||
-rw-r--r-- | editor/property_editor.cpp | 4 | ||||
-rw-r--r-- | editor/property_editor.h | 4 | ||||
-rw-r--r-- | editor/settings_config_dialog.cpp | 76 | ||||
-rw-r--r-- | editor/settings_config_dialog.h | 6 |
6 files changed, 81 insertions, 45 deletions
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index ae7ed7ce61..2796f776d7 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -548,34 +548,28 @@ EditorAutoloadSettings::EditorAutoloadSettings() { HBoxContainer *hbc = memnew(HBoxContainer); add_child(hbc); - VBoxContainer *vbc_path = memnew(VBoxContainer); - vbc_path->set_h_size_flags(SIZE_EXPAND_FILL); + Label *l = memnew(Label); + l->set_text(TTR("Path:")); + hbc->add_child(l); autoload_add_path = memnew(EditorLineEditFileChooser); autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL); - autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE); autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback"); + hbc->add_child(autoload_add_path); - vbc_path->add_margin_child(TTR("Path:"), autoload_add_path); - hbc->add_child(vbc_path); - - VBoxContainer *vbc_name = memnew(VBoxContainer); - vbc_name->set_h_size_flags(SIZE_EXPAND_FILL); - - HBoxContainer *hbc_name = memnew(HBoxContainer); + l = memnew(Label); + l->set_text(TTR("Node Name:")); + hbc->add_child(l); autoload_add_name = memnew(LineEdit); autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); - hbc_name->add_child(autoload_add_name); + hbc->add_child(autoload_add_name); Button *add_autoload = memnew(Button); add_autoload->set_text(TTR("Add")); - hbc_name->add_child(add_autoload); add_autoload->connect("pressed", this, "_autoload_add"); - - vbc_name->add_margin_child(TTR("Node Name:"), hbc_name); - hbc->add_child(vbc_name); + hbc->add_child(add_autoload); tree = memnew(Tree); tree->set_hide_root(true); @@ -606,5 +600,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { tree->connect("item_edited", this, "_autoload_edited"); tree->connect("button_pressed", this, "_autoload_button_pressed"); - add_margin_child(TTR("List:"), tree, true); + tree->set_v_size_flags(SIZE_EXPAND_FILL); + + add_child(tree, true); } diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 1a7b7f3575..6f8573cd70 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1690,13 +1690,13 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0); vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0); - l = memnew(Label); - vbc->add_child(l); - l->set_text(TTR("Action:")); - hbc = memnew(HBoxContainer); vbc->add_child(hbc); + l = memnew(Label); + hbc->add_child(l); + l->set_text(TTR("Action:")); + action_name = memnew(LineEdit); action_name->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(action_name); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 623b0e15ab..47feac9a12 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -4599,7 +4599,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() { sections->set_v_size_flags(SIZE_EXPAND_FILL); sections->set_hide_root(true); - left_vb->add_margin_child(TTR("Sections:"), sections, true); + left_vb->add_child(sections, true); VBoxContainer *right_vb = memnew(VBoxContainer); right_vb->set_h_size_flags(SIZE_EXPAND_FILL); @@ -4608,7 +4608,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() { filter = memnew(SectionedPropertyEditorFilter); editor = memnew(PropertyEditor); editor->set_v_size_flags(SIZE_EXPAND_FILL); - right_vb->add_margin_child(TTR("Properties:"), editor, true); + right_vb->add_child(editor, true); editor->get_scene_tree()->set_column_titles_visible(false); diff --git a/editor/property_editor.h b/editor/property_editor.h index f684f5768d..115ce07339 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -314,9 +314,9 @@ public: class SectionedPropertyEditorFilter; -class SectionedPropertyEditor : public HBoxContainer { +class SectionedPropertyEditor : public HSplitContainer { - GDCLASS(SectionedPropertyEditor, HBoxContainer); + GDCLASS(SectionedPropertyEditor, HSplitContainer); ObjectID obj; diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index fccd0c51aa..cc70a48f6f 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -100,6 +100,8 @@ void EditorSettingsDialog::popup_edit_settings() { } else { popup_centered_ratio(0.7); } + + _focus_current_search_box(); } void EditorSettingsDialog::_clear_search_box() { @@ -137,13 +139,18 @@ void EditorSettingsDialog::_notification(int p_what) { undo_redo->set_commit_notify_callback(_undo_redo_callback, this); } break; case NOTIFICATION_ENTER_TREE: { - clear_button->set_icon(get_icon("Close", "EditorIcons")); - shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons")); + _update_icons(); } break; case NOTIFICATION_POPUP_HIDE: { EditorSettings::get_singleton()->set("interface/dialogs/editor_settings_bounds", get_rect()); set_process_unhandled_input(false); } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + _update_icons(); + // Update theme colors. + property_editor->update_category_list(); + _update_shortcuts(); + } break; } } @@ -179,6 +186,14 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { } } +void EditorSettingsDialog::_update_icons() { + + search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons")); + shortcut_search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons")); + clear_button->set_icon(get_icon("Close", "EditorIcons")); + shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons")); +} + void EditorSettingsDialog::_update_shortcuts() { shortcuts->clear(); @@ -329,6 +344,26 @@ void EditorSettingsDialog::_press_a_key_confirm() { undo_redo->commit_action(); } +void EditorSettingsDialog::_tabs_tab_changed(int p_tab) { + + _focus_current_search_box(); +} + +void EditorSettingsDialog::_focus_current_search_box() { + + Control *tab = tabs->get_current_tab_control(); + LineEdit* current_search_box; + if (tab == tab_general) + current_search_box = search_box; + else if (tab == tab_shortcuts) + current_search_box = shortcut_search_box; + + if (current_search_box) { + current_search_box->grab_focus(); + current_search_box->select_all(); + } +} + void EditorSettingsDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorSettingsDialog::_unhandled_input); @@ -342,6 +377,7 @@ void EditorSettingsDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_shortcuts"), &EditorSettingsDialog::_update_shortcuts); ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &EditorSettingsDialog::_press_a_key_confirm); ClassDB::bind_method(D_METHOD("_wait_for_key"), &EditorSettingsDialog::_wait_for_key); + ClassDB::bind_method(D_METHOD("_tabs_tab_changed"), &EditorSettingsDialog::_tabs_tab_changed); } EditorSettingsDialog::EditorSettingsDialog() { @@ -352,20 +388,19 @@ EditorSettingsDialog::EditorSettingsDialog() { 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); - VBoxContainer *vbc = memnew(VBoxContainer); - tabs->add_child(vbc); - vbc->set_name(TTR("General")); + // 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); - vbc->add_child(hbc); - - Label *l = memnew(Label); - l->set_text(TTR("Search:") + " "); - hbc->add_child(l); + tab_general->add_child(hbc); search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -381,20 +416,18 @@ EditorSettingsDialog::EditorSettingsDialog() { property_editor->register_search_box(search_box); property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); property_editor->get_property_editor()->set_undo_redo(undo_redo); - vbc->add_child(property_editor); + tab_general->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")); + // 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); - vbc->add_child(hbc); - - l = memnew(Label); - l->set_text(TTR("Search:") + " "); - hbc->add_child(l); + tab_shortcuts->add_child(hbc); shortcut_search_box = memnew(LineEdit); shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -406,7 +439,8 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcut_clear_button->connect("pressed", this, "_clear_shortcut_search_box"); shortcuts = memnew(Tree); - vbc->add_margin_child(TTR("Shortcut List:"), shortcuts, true); + 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); @@ -419,7 +453,7 @@ EditorSettingsDialog::EditorSettingsDialog() { press_a_key->set_focus_mode(FOCUS_ALL); add_child(press_a_key); - l = memnew(Label); + 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); diff --git a/editor/settings_config_dialog.h b/editor/settings_config_dialog.h index a03b15c06d..64b8833821 100644 --- a/editor/settings_config_dialog.h +++ b/editor/settings_config_dialog.h @@ -41,6 +41,8 @@ class EditorSettingsDialog : public AcceptDialog { bool updating; TabContainer *tabs; + Control *tab_general; + Control *tab_shortcuts; LineEdit *search_box; LineEdit *shortcut_search_box; @@ -68,10 +70,14 @@ class EditorSettingsDialog : public AcceptDialog { void _unhandled_input(const Ref<InputEvent> &p_event); void _notification(int p_what); + void _update_icons(); void _press_a_key_confirm(); void _wait_for_key(const Ref<InputEvent> &p_event); + void _tabs_tab_changed(int p_tab); + void _focus_current_search_box(); + void _clear_shortcut_search_box(); void _clear_search_box(); |