1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

PixelPaint: Make ImageEditor::image() return a reference (Image&)

In the new tabbed world, every ImageEditor always has an associated
Image, so this simplifies a bunch of things. :^)
This commit is contained in:
Andreas Kling 2021-06-15 21:35:04 +02:00
parent c6dd3377ee
commit 35456f035c
4 changed files with 19 additions and 31 deletions

View file

@ -91,20 +91,20 @@ void MoveTool::on_context_menu(Layer& layer, GUI::ContextMenuEvent& event)
m_context_menu = GUI::Menu::construct();
m_context_menu->add_action(GUI::CommonActions::make_move_to_front_action(
[this](auto&) {
m_editor->image()->move_layer_to_front(*m_context_menu_layer);
m_editor->image().move_layer_to_front(*m_context_menu_layer);
m_editor->layers_did_change();
},
m_editor));
m_context_menu->add_action(GUI::CommonActions::make_move_to_back_action(
[this](auto&) {
m_editor->image()->move_layer_to_back(*m_context_menu_layer);
m_editor->image().move_layer_to_back(*m_context_menu_layer);
m_editor->layers_did_change();
},
m_editor));
m_context_menu->add_separator();
m_context_menu->add_action(GUI::Action::create(
"&Delete Layer", Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"), [this](auto&) {
m_editor->image()->remove_layer(*m_context_menu_layer);
m_editor->image().remove_layer(*m_context_menu_layer);
// FIXME: This should not be done imperatively here. Perhaps a Image::Client interface that ImageEditor can implement?
if (m_editor->active_layer() == m_context_menu_layer)
m_editor->set_active_layer(nullptr);