summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp11
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.h5
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.cpp9
-rw-r--r--Userland/Applications/PixelPaint/MainWidget.h1
4 files changed, 25 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp
index 0760ec80b9..f448f1b354 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.cpp
+++ b/Userland/Applications/PixelPaint/ImageEditor.cpp
@@ -101,7 +101,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
painter.draw_rect(m_editor_image_rect.inflated(2, 2), Color::Black);
m_image->paint_into(painter, m_editor_image_rect);
- if (m_active_layer) {
+ if (m_active_layer && m_show_active_layer_boundary) {
painter.draw_rect(enclosing_int_rect(image_rect_to_editor_rect(m_active_layer->relative_rect())).inflated(2, 2), Color::Black);
}
@@ -700,4 +700,13 @@ Result<void, String> ImageEditor::save_project_to_fd_and_close(int fd) const
return {};
}
+void ImageEditor::set_show_active_layer_boundary(bool show)
+{
+ if (m_show_active_layer_boundary == show)
+ return;
+
+ m_show_active_layer_boundary = show;
+ update();
+}
+
}
diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h
index 7c4a20de2b..526b5b39ad 100644
--- a/Userland/Applications/PixelPaint/ImageEditor.h
+++ b/Userland/Applications/PixelPaint/ImageEditor.h
@@ -107,6 +107,9 @@ public:
bool pixel_grid_visibility() const { return m_show_pixel_grid; }
void set_pixel_grid_visibility(bool show_pixel_grid);
+ bool show_active_layer_boundary() const { return m_show_active_layer_boundary; }
+ void set_show_active_layer_boundary(bool);
+
private:
explicit ImageEditor(NonnullRefPtr<Image>);
@@ -147,6 +150,8 @@ private:
bool m_show_rulers { true };
bool m_show_pixel_grid { true };
+ bool m_show_active_layer_boundary { true };
+
Tool* m_active_tool { nullptr };
Color m_primary_color { Color::Black };
diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp
index c414c17c0e..bc14a3f2f1 100644
--- a/Userland/Applications/PixelPaint/MainWidget.cpp
+++ b/Userland/Applications/PixelPaint/MainWidget.cpp
@@ -381,6 +381,15 @@ void MainWidget::initialize_menubar(GUI::Window& window)
m_show_rulers_action->set_checked(Config::read_bool("PixelPaint", "Rulers", "Show", true));
view_menu.add_action(*m_show_rulers_action);
+ m_show_active_layer_boundary_action = GUI::Action::create_checkable(
+ "Show Active Layer &Boundary", [&](auto& action) {
+ Config::write_bool("PixelPaint", "ImageEditor", "ShowActiveLayerBoundary", action.is_checked());
+ if (auto* editor = current_image_editor())
+ editor->set_show_active_layer_boundary(action.is_checked());
+ });
+ m_show_active_layer_boundary_action->set_checked(Config::read_bool("PixelPaint", "ImageEditor", "ShowActiveLayerBoundary", true));
+ view_menu.add_action(*m_show_active_layer_boundary_action);
+
auto& tool_menu = window.add_menu("&Tool");
m_toolbox->for_each_tool([&](auto& tool) {
if (tool.action())
diff --git a/Userland/Applications/PixelPaint/MainWidget.h b/Userland/Applications/PixelPaint/MainWidget.h
index 991bd8429f..23d57f9c5d 100644
--- a/Userland/Applications/PixelPaint/MainWidget.h
+++ b/Userland/Applications/PixelPaint/MainWidget.h
@@ -71,6 +71,7 @@ private:
RefPtr<GUI::Action> m_add_guide_action;
RefPtr<GUI::Action> m_show_guides_action;
RefPtr<GUI::Action> m_show_rulers_action;
+ RefPtr<GUI::Action> m_show_active_layer_boundary_action;
};
}