28
28
#include <krita_export.h>
29
29
#include <kis_types.h>
31
#define PRESS_CONDITION(_event, _mode, _button, _modifier) \
32
(mode() == (_mode) && (_event)->button() == (_button) && \
33
(_event)->modifiers() == (_modifier) && !specialModifierActive())
35
#define PRESS_CONDITION_WB(_event, _mode, _button, _modifier) \
36
(mode() == (_mode) && (_event)->button() & (_button) && \
37
(_event)->modifiers() == (_modifier) && !specialModifierActive())
39
#define PRESS_CONDITION_OM(_event, _mode, _button, _modifier) \
40
(mode() == (_mode) && (_event)->button() == (_button) && \
41
((_event)->modifiers() & (_modifier) || \
42
(_event)->modifiers() == Qt::NoModifier) && \
43
!specialModifierActive())
45
#define RELEASE_CONDITION(_event, _mode, _button) \
46
(mode() == (_mode) && (_event)->button() == (_button))
48
#define RELEASE_CONDITION_WB(_event, _mode, _button) \
49
(mode() == (_mode) && (_event)->button() & (_button))
51
#define MOVE_CONDITION(_event, _mode) (mode() == (_mode))
31
53
class KoCanvasBase;
33
55
class KoAbstractGradient;
75
97
virtual void resourceChanged(int key, const QVariant & res);
79
/// reimplemented from superclass
80
101
virtual void mousePressEvent(KoPointerEvent *event);
82
/// reimplemented from superclass
83
102
virtual void mouseMoveEvent(KoPointerEvent *event);
85
/// reimplemented from superclass
86
103
virtual void mouseReleaseEvent(KoPointerEvent *event);
105
virtual void keyPressEvent(QKeyEvent *event);
106
virtual void keyReleaseEvent(QKeyEvent* event);
88
108
/// reimplemented from superclass
89
109
virtual void mouseDoubleClickEvent(KoPointerEvent *) {} // when a krita tool is enabled, don't push double click on
111
QPointF widgetCenterInWidgetPixels();
112
QPointF convertDocumentToWidget(const QPointF& pt);
91
114
/// Convert from native (postscript points) to image pixel
93
116
QPointF convertToPixelCoord(KoPointerEvent *e);
158
bool specialModifierActive();
159
virtual void gesture(const QPointF &offsetInDocPixels,
160
const QPointF &initialDocPoint);
135
162
KisImageWSP image() const;
136
163
QCursor cursor() const;
169
196
/// Call after finishing use of native OpenGL commands when painting this tool's decorations.
170
197
/// This is a convenience method that calls endOpenGL() on the OpenGL canvas object.
171
198
void endOpenGL();
200
/// Sets the systemLocked for the current node, this will not deactivate the tool buttons
201
void setCurrentNodeLocked(bool locked);
207
SECONDARY_PAINT_MODE,
210
OTHER // not used now
213
virtual void setMode(ToolMode mode);
214
virtual ToolMode mode();
182
226
void slotResetFgBg();
229
void initPan(const QPointF &docPoint);
230
void pan(const QPointF &docPoint);
233
void initGesture(const QPointF &docPoint);
234
void processGesture(const QPointF &docPoint);
185
238
PaintMode m_outlinePaintMode;
240
QPointF m_lastPosition;
188
243
Private* const d;