You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #98847 from KoBeWi/illusion_wave
Add "Close Tabs Below" option to script editor context menu
This commit is contained in:
@@ -1017,6 +1017,15 @@ void ScriptEditor::_close_other_tabs() {
|
|||||||
_queue_close_tabs();
|
_queue_close_tabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptEditor::_close_tabs_below() {
|
||||||
|
int current_idx = tab_container->get_current_tab();
|
||||||
|
for (int i = tab_container->get_tab_count() - 1; i > current_idx; i--) {
|
||||||
|
script_close_queue.push_back(i);
|
||||||
|
}
|
||||||
|
_go_to_tab(current_idx);
|
||||||
|
_queue_close_tabs();
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptEditor::_close_all_tabs() {
|
void ScriptEditor::_close_all_tabs() {
|
||||||
for (int i = tab_container->get_tab_count() - 1; i >= 0; i--) {
|
for (int i = tab_container->get_tab_count() - 1; i >= 0; i--) {
|
||||||
script_close_queue.push_back(i);
|
script_close_queue.push_back(i);
|
||||||
@@ -1595,6 +1604,9 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
case CLOSE_OTHER_TABS: {
|
case CLOSE_OTHER_TABS: {
|
||||||
_close_other_tabs();
|
_close_other_tabs();
|
||||||
} break;
|
} break;
|
||||||
|
case CLOSE_TABS_BELOW: {
|
||||||
|
_close_tabs_below();
|
||||||
|
} break;
|
||||||
case CLOSE_ALL: {
|
case CLOSE_ALL: {
|
||||||
_close_all_tabs();
|
_close_all_tabs();
|
||||||
} break;
|
} break;
|
||||||
@@ -1641,6 +1653,9 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||||||
case CLOSE_OTHER_TABS: {
|
case CLOSE_OTHER_TABS: {
|
||||||
_close_other_tabs();
|
_close_other_tabs();
|
||||||
} break;
|
} break;
|
||||||
|
case CLOSE_TABS_BELOW: {
|
||||||
|
_close_tabs_below();
|
||||||
|
} break;
|
||||||
case CLOSE_ALL: {
|
case CLOSE_ALL: {
|
||||||
_close_all_tabs();
|
_close_all_tabs();
|
||||||
} break;
|
} break;
|
||||||
@@ -3457,8 +3472,9 @@ void ScriptEditor::_make_script_list_context_menu() {
|
|||||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS);
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/save_as"), FILE_SAVE_AS);
|
||||||
}
|
}
|
||||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_file"), FILE_CLOSE);
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_file"), FILE_CLOSE);
|
||||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_all"), CLOSE_ALL);
|
|
||||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_other_tabs"), CLOSE_OTHER_TABS);
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_other_tabs"), CLOSE_OTHER_TABS);
|
||||||
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_tabs_below"), CLOSE_TABS_BELOW);
|
||||||
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_all"), CLOSE_ALL);
|
||||||
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_docs"), CLOSE_DOCS);
|
context_menu->add_shortcut(ED_GET_SHORTCUT("script_editor/close_docs"), CLOSE_DOCS);
|
||||||
context_menu->add_separator();
|
context_menu->add_separator();
|
||||||
if (se) {
|
if (se) {
|
||||||
@@ -3484,6 +3500,7 @@ void ScriptEditor::_make_script_list_context_menu() {
|
|||||||
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() <= 0);
|
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_ALL), tab_container->get_tab_count() <= 0);
|
||||||
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
|
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_OTHER_TABS), tab_container->get_tab_count() <= 1);
|
||||||
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_DOCS), !_has_docs_tab());
|
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_DOCS), !_has_docs_tab());
|
||||||
|
context_menu->set_item_disabled(context_menu->get_item_index(CLOSE_TABS_BELOW), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
|
||||||
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_UP), tab_container->get_current_tab() <= 0);
|
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_UP), tab_container->get_current_tab() <= 0);
|
||||||
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
|
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_MOVE_DOWN), tab_container->get_current_tab() >= tab_container->get_tab_count() - 1);
|
||||||
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_SORT), tab_container->get_tab_count() <= 1);
|
context_menu->set_item_disabled(context_menu->get_item_index(WINDOW_SORT), tab_container->get_tab_count() <= 1);
|
||||||
@@ -4353,6 +4370,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTRC("Close"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTRC("Close"), KeyModifierMask::CMD_OR_CTRL | Key::W), FILE_CLOSE);
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTRC("Close All")), CLOSE_ALL);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTRC("Close All")), CLOSE_ALL);
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTRC("Close Other Tabs")), CLOSE_OTHER_TABS);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_other_tabs", TTRC("Close Other Tabs")), CLOSE_OTHER_TABS);
|
||||||
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_tabs_below", TTRC("Close Tabs Below")), CLOSE_TABS_BELOW);
|
||||||
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTRC("Close Docs")), CLOSE_DOCS);
|
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTRC("Close Docs")), CLOSE_DOCS);
|
||||||
|
|
||||||
file_menu->get_popup()->add_separator();
|
file_menu->get_popup()->add_separator();
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ class ScriptEditor : public PanelContainer {
|
|||||||
CLOSE_DOCS,
|
CLOSE_DOCS,
|
||||||
CLOSE_ALL,
|
CLOSE_ALL,
|
||||||
CLOSE_OTHER_TABS,
|
CLOSE_OTHER_TABS,
|
||||||
|
CLOSE_TABS_BELOW,
|
||||||
TOGGLE_FILES_PANEL,
|
TOGGLE_FILES_PANEL,
|
||||||
SHOW_IN_FILE_SYSTEM,
|
SHOW_IN_FILE_SYSTEM,
|
||||||
FILE_COPY_PATH,
|
FILE_COPY_PATH,
|
||||||
@@ -398,6 +399,7 @@ class ScriptEditor : public PanelContainer {
|
|||||||
void _close_discard_current_tab(const String &p_str);
|
void _close_discard_current_tab(const String &p_str);
|
||||||
void _close_docs_tab();
|
void _close_docs_tab();
|
||||||
void _close_other_tabs();
|
void _close_other_tabs();
|
||||||
|
void _close_tabs_below();
|
||||||
void _close_all_tabs();
|
void _close_all_tabs();
|
||||||
void _queue_close_tabs();
|
void _queue_close_tabs();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user