summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-02-27 02:45:17 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-02-27 02:45:21 +0100
commit3e0846e65b2ca4a6c7289d092715bbdc16b3848a (patch)
tree4a857a48afc4eeec986f6d55b4f9c8eef1632c71
parent823fb59e107332de64dddd8e5d7f2fba92e95bb0 (diff)
Mono: Some editor usability improvements
- Move "Mono" popup menu from the top right corner to `Projects -> Tools` as a submenu. - Add "Build solution" button to the top right corner. Makes it more visible and quicker to access. - Fix build list in the bottom panel unselect an item when clicking on empty space. Previously it would hide the issues panel but the item would remain selected, making it impossible to display the issues panel again if there was only one item.
-rw-r--r--modules/mono/editor/godotsharp_editor.cpp22
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp7
-rw-r--r--modules/mono/editor/mono_bottom_panel.h4
3 files changed, 20 insertions, 13 deletions
diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp
index c3c9175726..5b68810017 100644
--- a/modules/mono/editor/godotsharp_editor.cpp
+++ b/modules/mono/editor/godotsharp_editor.cpp
@@ -167,9 +167,6 @@ void GodotSharpEditor::_remove_create_sln_menu_option() {
menu_popup->remove_item(menu_popup->get_item_index(MENU_CREATE_SLN));
- if (menu_popup->get_item_count() == 0)
- menu_button->hide();
-
bottom_panel_btn->show();
}
@@ -413,9 +410,12 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
editor->add_child(memnew(MonoReloadNode));
- menu_button = memnew(MenuButton);
- menu_button->set_text(TTR("Mono"));
- menu_popup = menu_button->get_popup();
+ menu_popup = memnew(PopupMenu);
+ menu_popup->hide();
+ menu_popup->set_as_toplevel(true);
+ menu_popup->set_pass_on_modal_close_click(false);
+
+ editor->add_tool_submenu_item("Mono", menu_popup);
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha
{
@@ -478,10 +478,12 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
menu_popup->connect("id_pressed", this, "_menu_option_pressed");
- if (menu_popup->get_item_count() == 0)
- menu_button->hide();
-
- editor->get_menu_hb()->add_child(menu_button);
+ ToolButton *build_button = memnew(ToolButton);
+ build_button->set_text("Build");
+ build_button->set_tooltip("Build solution");
+ build_button->set_focus_mode(Control::FOCUS_NONE);
+ build_button->connect("pressed", MonoBottomPanel::get_singleton(), "_build_project_pressed");
+ editor->get_menu_hb()->add_child(build_button);
// External editor settings
EditorSettings *ed_settings = EditorSettings::get_singleton();
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index cc9822e319..21ce9ca5c4 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -125,9 +125,14 @@ void MonoBottomPanel::_build_tabs_item_selected(int p_idx) {
void MonoBottomPanel::_build_tabs_nothing_selected() {
- if (build_tabs->get_tab_count() != 0) // just in case
+ if (build_tabs->get_tab_count() != 0) { // just in case
build_tabs->set_visible(false);
+ // This callback is called when clicking on the empty space of the list.
+ // ItemList won't deselect the items automatically, so we must do it ourselves.
+ build_tabs_list->unselect_all();
+ }
+
warnings_btn->set_visible(false);
errors_btn->set_visible(false);
view_log_btn->set_visible(false);
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
index d3109592a9..406e46f7ce 100644
--- a/modules/mono/editor/mono_bottom_panel.h
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -51,8 +51,8 @@ class MonoBottomPanel : public VBoxContainer {
ItemList *build_tabs_list;
TabContainer *build_tabs;
- Button *warnings_btn;
- Button *errors_btn;
+ ToolButton *warnings_btn;
+ ToolButton *errors_btn;
Button *view_log_btn;
void _update_build_tabs_list();