Merge pull request #26333 from neikeq/ayaya
Mono: Some editor usability improvements
This commit is contained in:
@ -167,9 +167,6 @@ void GodotSharpEditor::_remove_create_sln_menu_option() {
|
|||||||
|
|
||||||
menu_popup->remove_item(menu_popup->get_item_index(MENU_CREATE_SLN));
|
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();
|
bottom_panel_btn->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,43 +274,23 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int
|
|||||||
|
|
||||||
// TODO: Use initializer lists once C++11 is allowed
|
// TODO: Use initializer lists once C++11 is allowed
|
||||||
|
|
||||||
// Try with hint paths
|
static Vector<String> vscode_names;
|
||||||
static Vector<String> hint_paths;
|
if (vscode_names.empty()) {
|
||||||
#ifdef WINDOWS_ENABLED
|
vscode_names.push_back("code");
|
||||||
if (hint_paths.empty()) {
|
vscode_names.push_back("code-oss");
|
||||||
hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles") + "\\Microsoft VS Code\\Code.exe");
|
vscode_names.push_back("vscode");
|
||||||
if (sizeof(size_t) == 8) {
|
vscode_names.push_back("vscode-oss");
|
||||||
hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles(x86)") + "\\Microsoft VS Code\\Code.exe");
|
vscode_names.push_back("visual-studio-code");
|
||||||
}
|
vscode_names.push_back("visual-studio-code-oss");
|
||||||
}
|
}
|
||||||
#endif
|
for (int i = 0; i < vscode_names.size(); i++) {
|
||||||
for (int i = 0; i < hint_paths.size(); i++) {
|
vscode_path = path_which(vscode_names[i]);
|
||||||
vscode_path = hint_paths[i];
|
if (!vscode_path.empty()) {
|
||||||
if (FileAccess::exists(vscode_path)) {
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
static Vector<String> vscode_names;
|
|
||||||
if (vscode_names.empty()) {
|
|
||||||
vscode_names.push_back("code");
|
|
||||||
vscode_names.push_back("code-oss");
|
|
||||||
vscode_names.push_back("vscode");
|
|
||||||
vscode_names.push_back("vscode-oss");
|
|
||||||
vscode_names.push_back("visual-studio-code");
|
|
||||||
vscode_names.push_back("visual-studio-code-oss");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < vscode_names.size(); i++) {
|
|
||||||
vscode_path = path_which(vscode_names[i]);
|
|
||||||
if (!vscode_path.empty()) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
vscode_path.clear(); // Not found, clear so next time the empty() check is enough
|
vscode_path.clear(); // Not found, clear so next time the empty() check is enough
|
||||||
}
|
}
|
||||||
@ -433,9 +410,12 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
|
|||||||
|
|
||||||
editor->add_child(memnew(MonoReloadNode));
|
editor->add_child(memnew(MonoReloadNode));
|
||||||
|
|
||||||
menu_button = memnew(MenuButton);
|
menu_popup = memnew(PopupMenu);
|
||||||
menu_button->set_text(TTR("Mono"));
|
menu_popup->hide();
|
||||||
menu_popup = menu_button->get_popup();
|
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
|
// TODO: Remove or edit this info dialog once Mono support is no longer in alpha
|
||||||
{
|
{
|
||||||
@ -498,10 +478,12 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
|
|||||||
|
|
||||||
menu_popup->connect("id_pressed", this, "_menu_option_pressed");
|
menu_popup->connect("id_pressed", this, "_menu_option_pressed");
|
||||||
|
|
||||||
if (menu_popup->get_item_count() == 0)
|
ToolButton *build_button = memnew(ToolButton);
|
||||||
menu_button->hide();
|
build_button->set_text("Build");
|
||||||
|
build_button->set_tooltip("Build solution");
|
||||||
editor->get_menu_hb()->add_child(menu_button);
|
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
|
// External editor settings
|
||||||
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
EditorSettings *ed_settings = EditorSettings::get_singleton();
|
||||||
|
|||||||
@ -125,9 +125,14 @@ void MonoBottomPanel::_build_tabs_item_selected(int p_idx) {
|
|||||||
|
|
||||||
void MonoBottomPanel::_build_tabs_nothing_selected() {
|
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);
|
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);
|
warnings_btn->set_visible(false);
|
||||||
errors_btn->set_visible(false);
|
errors_btn->set_visible(false);
|
||||||
view_log_btn->set_visible(false);
|
view_log_btn->set_visible(false);
|
||||||
|
|||||||
@ -51,8 +51,8 @@ class MonoBottomPanel : public VBoxContainer {
|
|||||||
ItemList *build_tabs_list;
|
ItemList *build_tabs_list;
|
||||||
TabContainer *build_tabs;
|
TabContainer *build_tabs;
|
||||||
|
|
||||||
Button *warnings_btn;
|
ToolButton *warnings_btn;
|
||||||
Button *errors_btn;
|
ToolButton *errors_btn;
|
||||||
Button *view_log_btn;
|
Button *view_log_btn;
|
||||||
|
|
||||||
void _update_build_tabs_list();
|
void _update_build_tabs_list();
|
||||||
|
|||||||
Reference in New Issue
Block a user