PixelPaint: Add a new "Rectangle Select" tool :^)

This patch only adds the tool along with a toolbar icon for it.
It doesn't do anything yet.
This commit is contained in:
Andreas Kling 2021-06-14 16:51:29 +02:00
parent ab840423a8
commit 4bd905de0e
Notes: sideshowbarker 2024-07-18 12:14:47 +09:00
5 changed files with 62 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

View file

@ -20,6 +20,7 @@ set(SOURCES
PickerTool.cpp
PixelPaintWindowGML.h
RectangleTool.cpp
RectangleSelectTool.cpp
SprayTool.cpp
ToolboxWidget.cpp
ToolPropertiesWidget.cpp

View file

@ -0,0 +1,35 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "RectangleSelectTool.h"
namespace PixelPaint {
RectangleSelectTool::RectangleSelectTool()
{
}
RectangleSelectTool::~RectangleSelectTool()
{
}
void RectangleSelectTool::on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent&)
{
}
void RectangleSelectTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent&)
{
}
void RectangleSelectTool::on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&)
{
}
void RectangleSelectTool::on_second_paint(Layer const&, GUI::PaintEvent&)
{
}
}

View file

@ -0,0 +1,24 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Tool.h"
namespace PixelPaint {
class RectangleSelectTool final : public Tool {
public:
RectangleSelectTool();
virtual ~RectangleSelectTool();
virtual void on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_second_paint(Layer const&, GUI::PaintEvent&) override;
};
}

View file

@ -13,6 +13,7 @@
#include "MoveTool.h"
#include "PenTool.h"
#include "PickerTool.h"
#include "RectangleSelectTool.h"
#include "RectangleTool.h"
#include "SprayTool.h"
#include "ZoomTool.h"
@ -77,6 +78,7 @@ void ToolboxWidget::setup_tools()
add_tool("Rectangle", "rectangle", { Mod_Ctrl | Mod_Shift, Key_R }, make<RectangleTool>());
add_tool("Ellipse", "circle", { Mod_Ctrl | Mod_Shift, Key_E }, make<EllipseTool>());
add_tool("Zoom", "zoom", { 0, Key_Z }, make<ZoomTool>());
add_tool("Rectangle Select", "rectangle-select", { 0, Key_R }, make<RectangleSelectTool>());
}
}