From 75e20a5fd746c7749a460d29922683e7cd4c7553 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 14 Nov 2022 00:07:15 +0100 Subject: [PATCH] PixelPaint: Add the Pen tool as the default tool We now preselect the pen tool when PixelPaint is launched. --- Userland/Applications/PixelPaint/ToolboxWidget.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index 9f8a2d31f4..e6fd4379b5 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -52,7 +52,7 @@ ToolboxWidget::ToolboxWidget() void ToolboxWidget::setup_tools() { - auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr tool) { + auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr tool, bool is_default_tool = false) { auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(), [this, tool = tool.ptr()](auto& action) { if (action.is_checked()) { @@ -70,10 +70,15 @@ void ToolboxWidget::setup_tools() }; tool->set_action(action); m_tools.append(move(tool)); + if (is_default_tool) { + VERIFY(m_active_tool == nullptr); + m_active_tool = &m_tools[m_tools.size() - 1]; + action->set_checked(true); + } }; add_tool("move"sv, { 0, Key_M }, make()); - add_tool("pen"sv, { 0, Key_N }, make()); + add_tool("pen"sv, { 0, Key_N }, make(), true); add_tool("brush"sv, { 0, Key_P }, make()); add_tool("bucket"sv, { Mod_Shift, Key_B }, make()); add_tool("spray"sv, { Mod_Shift, Key_S }, make());