mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
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:
parent
ab840423a8
commit
4bd905de0e
5 changed files with 62 additions and 0 deletions
BIN
Base/res/icons/pixelpaint/rectangle-select.png
Normal file
BIN
Base/res/icons/pixelpaint/rectangle-select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 B |
|
@ -20,6 +20,7 @@ set(SOURCES
|
||||||
PickerTool.cpp
|
PickerTool.cpp
|
||||||
PixelPaintWindowGML.h
|
PixelPaintWindowGML.h
|
||||||
RectangleTool.cpp
|
RectangleTool.cpp
|
||||||
|
RectangleSelectTool.cpp
|
||||||
SprayTool.cpp
|
SprayTool.cpp
|
||||||
ToolboxWidget.cpp
|
ToolboxWidget.cpp
|
||||||
ToolPropertiesWidget.cpp
|
ToolPropertiesWidget.cpp
|
||||||
|
|
35
Userland/Applications/PixelPaint/RectangleSelectTool.cpp
Normal file
35
Userland/Applications/PixelPaint/RectangleSelectTool.cpp
Normal 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&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
Userland/Applications/PixelPaint/RectangleSelectTool.h
Normal file
24
Userland/Applications/PixelPaint/RectangleSelectTool.h
Normal 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,7 @@
|
||||||
#include "MoveTool.h"
|
#include "MoveTool.h"
|
||||||
#include "PenTool.h"
|
#include "PenTool.h"
|
||||||
#include "PickerTool.h"
|
#include "PickerTool.h"
|
||||||
|
#include "RectangleSelectTool.h"
|
||||||
#include "RectangleTool.h"
|
#include "RectangleTool.h"
|
||||||
#include "SprayTool.h"
|
#include "SprayTool.h"
|
||||||
#include "ZoomTool.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("Rectangle", "rectangle", { Mod_Ctrl | Mod_Shift, Key_R }, make<RectangleTool>());
|
||||||
add_tool("Ellipse", "circle", { Mod_Ctrl | Mod_Shift, Key_E }, make<EllipseTool>());
|
add_tool("Ellipse", "circle", { Mod_Ctrl | Mod_Shift, Key_E }, make<EllipseTool>());
|
||||||
add_tool("Zoom", "zoom", { 0, Key_Z }, make<ZoomTool>());
|
add_tool("Zoom", "zoom", { 0, Key_Z }, make<ZoomTool>());
|
||||||
|
add_tool("Rectangle Select", "rectangle-select", { 0, Key_R }, make<RectangleSelectTool>());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue