1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
/*
* SPDX-FileCopyrightText: 2005 Adrian Page <adrian@pagenet.plus.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KIS_TOOL_SHAPE_H_
#define KIS_TOOL_SHAPE_H_
#include <kritaui_export.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kis_painter.h>
#include "kis_tool_paint.h"
#include "KisSelectionToolFactoryBase.h"
#include "KisToolShapeUtils.h"
#include "ui_wdggeometryoptions.h"
class KoCanvasBase;
class KoPathShape;
class WdgGeometryOptions : public QWidget, public Ui::WdgGeometryOptions
{
Q_OBJECT
public:
WdgGeometryOptions(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* Base for tools specialized in drawing shapes
*/
class KRITAUI_EXPORT KisToolShape : public KisToolPaint
{
Q_OBJECT
public:
KisToolShape(KoCanvasBase * canvas, const QCursor & cursor);
~KisToolShape() override;
int flags() const override;
WdgGeometryOptions *m_shapeOptionsWidget;
public Q_SLOTS:
void activate(const QSet<KoShape*> &shapes) override;
virtual void outlineSettingChanged(int value);
virtual void fillSettingChanged(int value);
virtual void patternRotationSettingChanged(qreal value);
virtual void patternScaleSettingChanged(qreal value);
protected:
QWidget* createOptionWidget() override;
KisToolShapeUtils::FillStyle fillStyle();
KisToolShapeUtils::StrokeStyle strokeStyle();
QTransform fillTransform();
qreal currentStrokeWidth() const;
struct KRITAUI_EXPORT ShapeAddInfo {
bool shouldAddShape = false;
bool shouldAddSelectionShape = false;
void markAsSelectionShapeIfNeeded(KoShape *shape) const;
};
ShapeAddInfo shouldAddShape(KisNodeSP currentNode) const;
void addShape(KoShape* shape);
void addPathShape(KoPathShape* pathShape, const KUndo2MagicString& name);
/**
* Use these methods in subclassed to notify when the user starts and
* finishes making a shape, and override to be notified
*/
virtual void beginShape() {}
virtual void endShape() {}
KConfigGroup m_configGroup;
};
#endif // KIS_TOOL_SHAPE_H_
|