summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-05 21:02:31 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-05 21:02:31 +0100
commitcb627a3ada3b524fa66275315ba53d8f211cde39 (patch)
treeb6b9c75e96f5fa08b82089a614ca25023a743760 /DevTools
parent538d5f82c141536c3517ff8321be8ed7316fbd3a (diff)
downloadserenity-cb627a3ada3b524fa66275315ba53d8f211cde39.zip
HackStudio: Allow removing the current editor with Alt+Shift+E
Note that you are not allowed to remove the very last editor. These keybinds are all temporary while I figure out what the right ones should be. I'm not exactly sure how, but it'll reveal itself. :^)
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/HackStudio/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp
index a53a921479..93faa97390 100644
--- a/DevTools/HackStudio/main.cpp
+++ b/DevTools/HackStudio/main.cpp
@@ -166,6 +166,15 @@ int main(int argc, char** argv)
}
});
+ auto remove_current_editor = GAction::create("Remove current editor", { Mod_Alt | Mod_Shift, Key_E }, [&](auto&) {
+ if (g_all_editor_wrappers.size() <= 1)
+ return;
+ auto wrapper = g_current_editor_wrapper;
+ switch_to_next_editor->activate();
+ inner_splitter->remove_child(*wrapper);
+ g_all_editor_wrappers.remove_first_matching([&](auto& entry) { return entry == wrapper.ptr(); });
+ });
+
auto save_action = GAction::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
if (g_currently_open_file.is_empty())
return;
@@ -265,7 +274,9 @@ int main(int argc, char** argv)
auto view_menu = make<GMenu>("View");
view_menu->add_action(hide_action_tabs_action);
view_menu->add_action(open_locator_action);
+ view_menu->add_separator();
view_menu->add_action(add_editor_action);
+ view_menu->add_action(remove_current_editor);
menubar->add_menu(move(view_menu));
auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");