summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRay Koopa <raykoopa@users.noreply.github.com>2017-03-02 22:43:56 +0100
committerRay Koopa <raykoopa@users.noreply.github.com>2017-03-03 18:45:53 +0100
commit7623fd10bf10086f0b2b90bc6ceaa7e32279e645 (patch)
tree04c17c3b996e8b5f8a564aaa0a9eb5129a3aad84 /tools
parent74eace2b14b337e23d0dc552f3bc3e60f1710f65 (diff)
Make Editor, Export and Project settings dialogs resizable and store their bounds
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/project_export.cpp23
-rw-r--r--tools/editor/project_settings.cpp57
-rw-r--r--tools/editor/settings_config_dialog.cpp23
3 files changed, 67 insertions, 36 deletions
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index f6593a4895..fc6d8793d8 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -46,10 +46,14 @@
void ProjectExportDialog::_notification(int p_what) {
- if (p_what==NOTIFICATION_READY) {
- delete_preset->set_icon(get_icon("Del","EditorIcons"));
- connect("confirmed",this,"_export_pck_zip");
-
+ switch (p_what) {
+ case NOTIFICATION_READY: {
+ delete_preset->set_icon(get_icon("Del","EditorIcons"));
+ connect("confirmed",this,"_export_pck_zip");
+ } break;
+ case NOTIFICATION_POPUP_HIDE: {
+ EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
+ } break;
}
}
@@ -66,7 +70,13 @@ void ProjectExportDialog::popup_export() {
}
_update_presets();
- popup_centered_ratio();
+
+ // Restore valid window bounds or pop up at default size.
+ if (EditorSettings::get_singleton()->has("interface/dialogs/export_bounds")) {
+ popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds"));
+ } else {
+ popup_centered_ratio();
+ }
}
void ProjectExportDialog::_add_preset(int p_platform) {
@@ -664,6 +674,9 @@ void ProjectExportDialog::_bind_methods() {
}
ProjectExportDialog::ProjectExportDialog() {
+ set_title(TTR("Export"));
+ set_resizable(true);
+
HBoxContainer *hbox = memnew( HBoxContainer );
add_child(hbox);
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index ed3c59cc4a..15019b8ca8 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -73,34 +73,38 @@ static const char* _axis_names[JOY_AXIS_MAX*2] = {
void ProjectSettings::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ globals_editor->edit(GlobalConfig::get_singleton());
- globals_editor->edit(GlobalConfig::get_singleton());
+ search_button->set_icon(get_icon("Zoom","EditorIcons"));
+ clear_button->set_icon(get_icon("Close","EditorIcons"));
- search_button->set_icon(get_icon("Zoom","EditorIcons"));
- clear_button->set_icon(get_icon("Close","EditorIcons"));
+ translation_list->connect("button_pressed",this,"_translation_delete");
+ _update_actions();
+ popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation
+ popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON);
+ popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION);
+ popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON);
- translation_list->connect("button_pressed",this,"_translation_delete");
- _update_actions();
- popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation
- popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON);
- popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION);
- popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON);
+ List<String> tfn;
+ ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn);
+ for (List<String>::Element *E=tfn.front();E;E=E->next()) {
- List<String> tfn;
- ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn);
- for (List<String>::Element *E=tfn.front();E;E=E->next()) {
-
- translation_file_open->add_filter("*."+E->get());
- }
+ translation_file_open->add_filter("*."+E->get());
+ }
- List<String> rfn;
- ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn);
- for (List<String>::Element *E=rfn.front();E;E=E->next()) {
+ List<String> rfn;
+ ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn);
+ for (List<String>::Element *E=rfn.front();E;E=E->next()) {
- translation_res_file_open->add_filter("*."+E->get());
- translation_res_option_file_open->add_filter("*."+E->get());
- }
+ translation_res_file_open->add_filter("*."+E->get());
+ translation_res_option_file_open->add_filter("*."+E->get());
+ }
+ } break;
+ case NOTIFICATION_POPUP_HIDE: {
+ EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
+ } break;
}
}
@@ -579,8 +583,12 @@ void ProjectSettings::_update_actions() {
void ProjectSettings::popup_project_settings() {
- //popup_centered(Size2(500,400));
- popup_centered_ratio();
+ // Restore valid window bounds or pop up at default size.
+ if (EditorSettings::get_singleton()->has("interface/dialogs/project_settings_bounds")) {
+ popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds"));
+ } else {
+ popup_centered_ratio();
+ }
globals_editor->update_category_list();
_update_translations();
autoload_settings->update_autoload();
@@ -1224,6 +1232,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
singleton=this;
set_title(TTR("Project Settings (godot.cfg)"));
+ set_resizable(true);
undo_redo=&p_data->get_undo_redo();
data=p_data;
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index 6a62e035ec..7d8d6ffcec 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -93,10 +93,14 @@ void EditorSettingsDialog::popup_edit_settings() {
search_box->grab_focus();
_update_shortcuts();
- popup_centered_ratio(0.7);
-}
-
+ // Restore valid window bounds or pop up at default size.
+ if (EditorSettings::get_singleton()->has("interface/dialogs/editor_settings_bounds")) {
+ popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds"));
+ } else {
+ popup_centered_ratio(0.7);
+ }
+}
void EditorSettingsDialog::_clear_search_box() {
@@ -121,10 +125,14 @@ void EditorSettingsDialog::_filter_shortcuts(const String& p_filter) {
void EditorSettingsDialog::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- clear_button->set_icon(get_icon("Close","EditorIcons"));
- shortcut_clear_button->set_icon(get_icon("Close","EditorIcons"));
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE: {
+ clear_button->set_icon(get_icon("Close", "EditorIcons"));
+ shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons"));
+ } break;
+ case NOTIFICATION_POPUP_HIDE: {
+ EditorSettings::get_singleton()->set("interface/dialogs/editor_settings_bounds", get_rect());
+ } break;
}
}
@@ -305,6 +313,7 @@ void EditorSettingsDialog::_bind_methods() {
EditorSettingsDialog::EditorSettingsDialog() {
set_title(TTR("Editor Settings"));
+ set_resizable(true);
tabs = memnew( TabContainer );
add_child(tabs);