mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
PixelPaint: Add the Pen tool as the default tool
We now preselect the pen tool when PixelPaint is launched.
This commit is contained in:
parent
d8f25ad644
commit
75e20a5fd7
Notes:
sideshowbarker
2024-07-17 04:07:02 +09:00
Author: https://github.com/Baitinq Commit: https://github.com/SerenityOS/serenity/commit/75e20a5fd7 Pull-request: https://github.com/SerenityOS/serenity/pull/16058
|
@ -52,7 +52,7 @@ ToolboxWidget::ToolboxWidget()
|
|||
|
||||
void ToolboxWidget::setup_tools()
|
||||
{
|
||||
auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool) {
|
||||
auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> 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<MoveTool>());
|
||||
add_tool("pen"sv, { 0, Key_N }, make<PenTool>());
|
||||
add_tool("pen"sv, { 0, Key_N }, make<PenTool>(), true);
|
||||
add_tool("brush"sv, { 0, Key_P }, make<BrushTool>());
|
||||
add_tool("bucket"sv, { Mod_Shift, Key_B }, make<BucketTool>());
|
||||
add_tool("spray"sv, { Mod_Shift, Key_S }, make<SprayTool>());
|
||||
|
|
Loading…
Reference in a new issue