1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:45:06 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2019-11-05 21:02:31 +01:00
parent 538d5f82c1
commit cb627a3ada

View file

@ -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");