Move "Dialog Bounds" from the Editor Settings to project's metadata

This commit is contained in:
Michael Alexsander Silva Dias 2018-12-04 13:52:56 -02:00
parent 9a8569d434
commit 63dc20a827
5 changed files with 20 additions and 16 deletions

View File

@ -89,8 +89,9 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
_save_and_update_favorite_list(); _save_and_update_favorite_list();
// Restore valid window bounds or pop up at default size. // Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) { Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds")); if (saved_size != Rect2()) {
popup(saved_size);
} else { } else {
Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 popup_size = Size2(900, 700) * editor_get_scale();
@ -415,7 +416,7 @@ void CreateDialog::_notification(int p_what) {
} }
} break; } break;
case NOTIFICATION_POPUP_HIDE: { case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/create_new_node_bounds", get_rect()); EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect());
} break; } break;
} }
} }

View File

@ -132,7 +132,7 @@ void EditorHelpSearch::_notification(int p_what) {
results_tree->clear(); results_tree->clear();
get_ok()->set_disabled(true); get_ok()->set_disabled(true);
EditorSettings::get_singleton()->set("interface/dialogs/search_help_bounds", get_rect()); EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
} break; } break;
case NOTIFICATION_PROCESS: { case NOTIFICATION_PROCESS: {
@ -177,8 +177,9 @@ void EditorHelpSearch::popup_dialog() {
void EditorHelpSearch::popup_dialog(const String &p_term) { void EditorHelpSearch::popup_dialog(const String &p_term) {
// Restore valid window bounds or pop up at default size. // Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/search_help_bounds")) Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "search_help", Rect2());
popup(EditorSettings::get_singleton()->get("interface/dialogs/search_help_bounds")); if (saved_size != Rect2())
popup(saved_size);
else else
popup_centered_ratio(0.5F); popup_centered_ratio(0.5F);

View File

@ -56,7 +56,7 @@ void ProjectExportDialog::_notification(int p_what) {
custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree")); custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree"));
} break; } break;
case NOTIFICATION_POPUP_HIDE: { case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect()); EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", get_rect());
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons")); duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
@ -84,8 +84,9 @@ void ProjectExportDialog::popup_export() {
} }
// Restore valid window bounds or pop up at default size. // Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) { Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "export", Rect2());
popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds")); if (saved_size != Rect2()) {
popup(saved_size);
} else { } else {
Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 popup_size = Size2(900, 700) * editor_get_scale();

View File

@ -115,10 +115,9 @@ void ProjectSettingsEditor::_notification(int p_what) {
} break; } break;
case NOTIFICATION_POPUP_HIDE: { case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect()); EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", get_rect());
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
search_button->set_icon(get_icon("Search", "EditorIcons")); search_button->set_icon(get_icon("Search", "EditorIcons"));
search_box->set_right_icon(get_icon("Search", "EditorIcons")); search_box->set_right_icon(get_icon("Search", "EditorIcons"));
search_box->set_clear_button_enabled(true); search_box->set_clear_button_enabled(true);
@ -788,8 +787,9 @@ void ProjectSettingsEditor::_update_actions() {
void ProjectSettingsEditor::popup_project_settings() { void ProjectSettingsEditor::popup_project_settings() {
// Restore valid window bounds or pop up at default size. // Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/project_settings_bounds")) { Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "project_settings", Rect2());
popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds")); if (saved_size != Rect2()) {
popup(saved_size);
} else { } else {
Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 popup_size = Size2(900, 700) * editor_get_scale();

View File

@ -94,8 +94,9 @@ void EditorSettingsDialog::popup_edit_settings() {
set_process_unhandled_input(true); set_process_unhandled_input(true);
// Restore valid window bounds or pop up at default size. // Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) { Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "editor_settings", Rect2());
popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds")); if (saved_size != Rect2()) {
popup(saved_size);
} else { } else {
Size2 popup_size = Size2(900, 700) * editor_get_scale(); Size2 popup_size = Size2(900, 700) * editor_get_scale();
@ -132,7 +133,7 @@ void EditorSettingsDialog::_notification(int p_what) {
_update_icons(); _update_icons();
} break; } break;
case NOTIFICATION_POPUP_HIDE: { case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/editor_settings_bounds", get_rect()); EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", get_rect());
set_process_unhandled_input(false); set_process_unhandled_input(false);
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {