Restructure how tool data is stored

This commit is contained in:
Yousef Khadadeh 2025-08-02 20:10:33 +03:00
parent d07eaf4207
commit 90374da228
37 changed files with 790 additions and 801 deletions

View file

@ -0,0 +1,33 @@
#pragma once
#include <include/core/SkCanvas.h>
#include "../DrawData.hpp"
class DrawingProgram;
enum class DrawingProgramToolType : int {
BRUSH = 0,
ERASER,
LASSOSELECT,
RECTSELECT,
RECTANGLE,
ELLIPSE,
TEXTBOX,
INKDROPPER,
SCREENSHOT,
EDIT
};
class DrawingProgramToolBase {
public:
DrawingProgramToolBase(DrawingProgram& initDrawP);
virtual DrawingProgramToolType get_type() = 0;
virtual void gui_toolbox() = 0;
virtual void tool_update() = 0;
virtual void draw(SkCanvas* canvas, const DrawData& drawData) = 0;
virtual void reset_tool() = 0;
virtual bool prevent_undo_or_redo() = 0;
virtual ~DrawingProgramToolBase();
static std::unique_ptr<DrawingProgramToolBase> allocate_tool_type(DrawingProgram& drawP, DrawingProgramToolType t);
protected:
DrawingProgram& drawP;
};