~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to krita/ui/tool/kis_tool.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <krita_export.h>
29
29
#include <kis_types.h>
30
30
 
 
31
#define PRESS_CONDITION(_event, _mode, _button, _modifier)              \
 
32
    (mode() == (_mode) && (_event)->button() == (_button) &&            \
 
33
     (_event)->modifiers() == (_modifier) && !specialModifierActive())
 
34
 
 
35
#define PRESS_CONDITION_WB(_event, _mode, _button, _modifier)            \
 
36
    (mode() == (_mode) && (_event)->button() & (_button) &&            \
 
37
     (_event)->modifiers() == (_modifier) && !specialModifierActive())
 
38
 
 
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())
 
44
 
 
45
#define RELEASE_CONDITION(_event, _mode, _button)               \
 
46
    (mode() == (_mode) && (_event)->button() == (_button))
 
47
 
 
48
#define RELEASE_CONDITION_WB(_event, _mode, _button)               \
 
49
    (mode() == (_mode) && (_event)->button() & (_button))
 
50
 
 
51
#define MOVE_CONDITION(_event, _mode) (mode() == (_mode))
 
52
 
31
53
class KoCanvasBase;
32
54
class KisPattern;
33
55
class KoAbstractGradient;
74
96
 
75
97
    virtual void resourceChanged(int key, const QVariant & res);
76
98
 
77
 
public:
 
99
protected:
78
100
 
79
 
    /// reimplemented from superclass
80
101
    virtual void mousePressEvent(KoPointerEvent *event);
81
 
 
82
 
    /// reimplemented from superclass
83
102
    virtual void mouseMoveEvent(KoPointerEvent *event);
84
 
 
85
 
    /// reimplemented from superclass
86
103
    virtual void mouseReleaseEvent(KoPointerEvent *event);
87
104
 
 
105
    virtual void keyPressEvent(QKeyEvent *event);
 
106
    virtual void keyReleaseEvent(QKeyEvent* event);
 
107
 
88
108
    /// reimplemented from superclass
89
109
    virtual void mouseDoubleClickEvent(KoPointerEvent *) {}  // when a krita tool is enabled, don't push double click on
90
110
 
 
111
    QPointF widgetCenterInWidgetPixels();
 
112
    QPointF convertDocumentToWidget(const QPointF& pt);
 
113
 
91
114
    /// Convert from native (postscript points) to image pixel
92
115
    /// coordinates.
93
116
    QPointF convertToPixelCoord(KoPointerEvent *e);
132
155
 
133
156
protected:
134
157
 
 
158
    bool specialModifierActive();
 
159
    virtual void gesture(const QPointF &offsetInDocPixels,
 
160
                         const QPointF &initialDocPoint);
 
161
 
135
162
    KisImageWSP image() const;
136
163
    QCursor cursor() const;
137
164
 
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();
 
199
    
 
200
    /// Sets the systemLocked for the current node, this will not deactivate the tool buttons
 
201
    void setCurrentNodeLocked(bool locked);
 
202
 
 
203
protected:
 
204
    enum ToolMode {
 
205
        HOVER_MODE,
 
206
        PAINT_MODE,
 
207
        SECONDARY_PAINT_MODE,
 
208
        GESTURE_MODE,
 
209
        PAN_MODE,
 
210
        OTHER // not used now
 
211
    };
 
212
 
 
213
    virtual void setMode(ToolMode mode);
 
214
    virtual ToolMode mode();
 
215
 
172
216
 
173
217
protected slots:
174
218
    /**
182
226
    void slotResetFgBg();
183
227
 
184
228
private:
 
229
    void initPan(const QPointF &docPoint);
 
230
    void pan(const QPointF &docPoint);
 
231
    void endPan();
 
232
 
 
233
    void initGesture(const QPointF &docPoint);
 
234
    void processGesture(const QPointF &docPoint);
 
235
    void endGesture();
 
236
 
 
237
private:
185
238
    PaintMode m_outlinePaintMode;
 
239
    ToolMode m_mode;
 
240
    QPointF m_lastPosition;
186
241
 
187
242
    struct Private;
188
243
    Private* const d;