mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 22:21:18 +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:
commit
2f1b10824b
2 changed files with 21 additions and 1 deletions
|
|
@ -1017,6 +1017,15 @@ void ScriptEditor::_close_other_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() {
|
||||
for (int i = tab_container->get_tab_count() - 1; i >= 0; i--) {
|
||||
script_close_queue.push_back(i);
|
||||
|
|
@ -1595,6 +1604,9 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
case CLOSE_OTHER_TABS: {
|
||||
_close_other_tabs();
|
||||
} break;
|
||||
case CLOSE_TABS_BELOW: {
|
||||
_close_tabs_below();
|
||||
} break;
|
||||
case CLOSE_ALL: {
|
||||
_close_all_tabs();
|
||||
} break;
|
||||
|
|
@ -1641,6 +1653,9 @@ void ScriptEditor::_menu_option(int p_option) {
|
|||
case CLOSE_OTHER_TABS: {
|
||||
_close_other_tabs();
|
||||
} break;
|
||||
case CLOSE_TABS_BELOW: {
|
||||
_close_tabs_below();
|
||||
} break;
|
||||
case CLOSE_ALL: {
|
||||
_close_all_tabs();
|
||||
} 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/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_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_separator();
|
||||
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_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_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_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);
|
||||
|
|
@ -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_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_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_separator();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue