22#include "viewmanager.h"
23#include "scribblearea.h"
24#include "strokeinterpolator.h"
25#include "pointerevent.h"
27QString BaseTool::TypeName(ToolType type)
29 static std::array<QString, TOOL_TYPE_COUNT> map;
33 map[PENCIL] =
tr(
"Pencil");
34 map[ERASER] =
tr(
"Eraser");
35 map[SELECT] =
tr(
"Select");
36 map[MOVE] =
tr(
"Move");
37 map[HAND] =
tr(
"Hand");
38 map[SMUDGE] =
tr(
"Smudge");
40 map[POLYLINE] =
tr(
"Polyline");
41 map[BUCKET] =
tr(
"Bucket");
42 map[EYEDROPPER] =
tr(
"Eyedropper");
43 map[BRUSH] =
tr(
"Brush");
50 mPropertyEnabled.insert(WIDTH,
false);
51 mPropertyEnabled.insert(FEATHER,
false);
52 mPropertyEnabled.insert(USEFEATHER,
false);
53 mPropertyEnabled.insert(PRESSURE,
false);
54 mPropertyEnabled.insert(INVISIBILITY,
false);
55 mPropertyEnabled.insert(PRESERVEALPHA,
false);
56 mPropertyEnabled.insert(BEZIER,
false);
57 mPropertyEnabled.insert(CLOSEDPATH,
false);
58 mPropertyEnabled.insert(ANTI_ALIASING,
false);
59 mPropertyEnabled.insert(FILL_MODE,
false);
60 mPropertyEnabled.insert(STABILIZATION,
false);
61 mPropertyEnabled.insert(CAMERAPATH,
false);
71 for (
auto& connection : mActiveConnections) {
73 mActiveConnections.removeOne(connection);
78void BaseTool::initialize(
Editor* editor)
82 mScribbleArea = editor->getScribbleArea();
83 Q_ASSERT(mScribbleArea);
103void BaseTool::pointerDoubleClickEvent(
PointerEvent* event)
105 pointerPressEvent(
event);
115 if (type() == ToolType::HAND || type() == ToolType::MOVE || type() == ToolType::CAMERA || type() == ToolType::SELECT )
127void BaseTool::setWidth(
const qreal width)
129 properties.width = width;
132void BaseTool::setFeather(
const qreal feather)
134 properties.feather = feather;
137void BaseTool::setUseFeather(
const bool usingFeather)
139 properties.useFeather = usingFeather;
142void BaseTool::setInvisibility(
const bool invisibility)
144 properties.invisibility = invisibility;
147void BaseTool::setBezier(
const bool _bezier_state)
149 properties.bezier_state = _bezier_state;
152void BaseTool::setClosedPath(
const bool closed)
154 properties.closedPolylinePath = closed;
157void BaseTool::setPressure(
const bool pressure)
159 properties.pressure = pressure;
162void BaseTool::setPreserveAlpha(
const bool preserveAlpha)
164 properties.preserveAlpha = preserveAlpha;
167void BaseTool::setVectorMergeEnabled(
const bool vectorMergeEnabled)
169 properties.vectorMergeEnabled = vectorMergeEnabled;
172void BaseTool::setAA(
const int useAA)
174 properties.useAA = useAA;
177void BaseTool::setFillMode(
const int mode)
179 properties.fillMode = mode;
182void BaseTool::setStabilizerLevel(
const int level)
184 properties.stabilizerLevel = level;
187void BaseTool::setTolerance(
const int tolerance)
189 properties.tolerance = tolerance;
192void BaseTool::setToleranceEnabled(
const bool enabled)
194 properties.toleranceEnabled = enabled;
197void BaseTool::setFillExpand(
const int fillExpandValue)
199 properties.bucketFillExpand = fillExpandValue;
202void BaseTool::setFillReferenceMode(
int referenceMode)
204 properties.bucketFillReferenceMode = referenceMode;
207void BaseTool::setFillExpandEnabled(
const bool enabled)
209 properties.bucketFillExpandEnabled = enabled;
212void BaseTool::setUseFillContour(
const bool useFillContour)
214 properties.useFillContour = useFillContour;
217void BaseTool::setShowSelectionInfo(
const bool b)
219 properties.showSelectionInfo = b;
222void BaseTool::setShowCameraPath(
const bool showCameraPath)
224 properties.cameraShowPath = showCameraPath;
227void BaseTool::setPathDotColorType(
const DotColorType dotColorType)
229 properties.cameraPathDotColorType = dotColorType;
232void BaseTool::resetCameraPath()
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual bool event(QEvent *e)
QString tr(const char *sourceText, const char *disambiguation, int n)