From 1a9d4ffecfd59ec50d3067243436f41d42344624 Mon Sep 17 00:00:00 2001 From: electrikmilk Date: Tue, 23 Aug 2022 19:26:06 -0400 Subject: PixelPaint: Add more icons This adds menu item icons for Add Mask, Flatten Image, Fit Image To View, and Generic 5x5 Convolution. This modifies the menu item icon for Swap Colors to make the action more obvious and improve accessibility. --- Userland/Applications/PixelPaint/IconBag.cpp | 4 ++++ Userland/Applications/PixelPaint/IconBag.h | 4 ++++ Userland/Applications/PixelPaint/MainWidget.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'Userland/Applications') diff --git a/Userland/Applications/PixelPaint/IconBag.cpp b/Userland/Applications/PixelPaint/IconBag.cpp index 0cd63b08d4..c896106d30 100644 --- a/Userland/Applications/PixelPaint/IconBag.cpp +++ b/Userland/Applications/PixelPaint/IconBag.cpp @@ -22,6 +22,7 @@ ErrorOr IconBag::try_create() icon_bag.default_colors = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/default-colors.png"sv)); icon_bag.load_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/load-color-palette.png"sv)); icon_bag.save_color_palette = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/save-color-palette.png"sv)); + icon_bag.fit_image_to_view = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/fit-image-to-view.png"sv)); icon_bag.add_guide = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-guide.png"sv)); icon_bag.clear_guides = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/clear-guides.png"sv)); icon_bag.edit_flip_vertical = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png"sv)); @@ -36,11 +37,14 @@ ErrorOr IconBag::try_create() icon_bag.active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-up.png"sv)); icon_bag.active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/active-layer-down.png"sv)); icon_bag.delete_layer = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv)); + icon_bag.flatten_image = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/flatten-image.png"sv)); icon_bag.merge_visible = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-visible.png"sv)); icon_bag.merge_active_layer_up = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-up.png"sv)); icon_bag.merge_active_layer_down = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/merge-active-layer-down.png"sv)); icon_bag.filter = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/filter.png"sv)); + icon_bag.generic_5x5_convolution = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/generic-5x5-convolution.png"sv)); icon_bag.levels = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/levels.png"sv)); + icon_bag.add_mask = TRY(Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/add-mask.png"sv)); return icon_bag; } diff --git a/Userland/Applications/PixelPaint/IconBag.h b/Userland/Applications/PixelPaint/IconBag.h index 97e5615464..1f5d6d4e71 100644 --- a/Userland/Applications/PixelPaint/IconBag.h +++ b/Userland/Applications/PixelPaint/IconBag.h @@ -23,6 +23,7 @@ struct IconBag final { RefPtr default_colors { nullptr }; RefPtr load_color_palette { nullptr }; RefPtr save_color_palette { nullptr }; + RefPtr fit_image_to_view { nullptr }; RefPtr add_guide { nullptr }; RefPtr clear_guides { nullptr }; RefPtr edit_flip_vertical { nullptr }; @@ -37,10 +38,13 @@ struct IconBag final { RefPtr active_layer_up { nullptr }; RefPtr active_layer_down { nullptr }; RefPtr delete_layer { nullptr }; + RefPtr flatten_image { nullptr }; RefPtr merge_visible { nullptr }; RefPtr merge_active_layer_up { nullptr }; RefPtr merge_active_layer_down { nullptr }; RefPtr filter { nullptr }; + RefPtr generic_5x5_convolution { nullptr }; RefPtr levels { nullptr }; + RefPtr add_mask { nullptr }; }; } diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index f3de3a0f3d..0d63b9ed4b 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -450,7 +450,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_view_menu->add_action(*m_zoom_out_action); m_view_menu->add_action(*m_reset_zoom_action); m_view_menu->add_action(GUI::Action::create( - "Fit Image To &View", [&](auto&) { + "Fit Image To &View", g_icon_bag.fit_image_to_view, [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); editor->fit_image_to_view(); @@ -594,7 +594,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_layer_menu->add_separator(); m_layer_menu->add_action(GUI::Action::create( - "Add M&ask", { Mod_Ctrl | Mod_Shift, Key_M }, nullptr, [&](auto&) { + "Add M&ask", { Mod_Ctrl | Mod_Shift, Key_M }, g_icon_bag.add_mask, [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); auto active_layer = editor->active_layer(); @@ -691,7 +691,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) }; m_layer_menu->add_separator(); m_layer_menu->add_action(GUI::Action::create( - "Fl&atten Image", { Mod_Ctrl, Key_F }, [&](auto&) { + "Fl&atten Image", { Mod_Ctrl, Key_F }, g_icon_bag.flatten_image, [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); editor->image().flatten_all_layers(); @@ -784,7 +784,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) })); m_filter_menu->add_separator(); - m_filter_menu->add_action(GUI::Action::create("Generic 5x5 &Convolution", [&](auto&) { + m_filter_menu->add_action(GUI::Action::create("Generic 5x5 &Convolution", g_icon_bag.generic_5x5_convolution, [&](auto&) { auto* editor = current_image_editor(); VERIFY(editor); if (auto* layer = editor->active_layer()) { -- cgit v1.2.3