~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/ui/tool/kis_tool_paint.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:
27
27
#include <QEvent>
28
28
#include <QPaintEvent>
29
29
#include <QVariant>
 
30
#include <QTimer>
30
31
 
31
32
#include <KoResourceManager.h>
32
33
#include <KoToolBase.h>
52
53
 
53
54
class KoCanvasBase;
54
55
 
55
 
class KisCmbComposite;
56
56
class KisSliderSpinBox;
57
57
 
58
 
enum enumBrushMode {
59
 
    PAINT,
60
 
    HOVER,
61
 
    EDIT_BRUSH,
62
 
    PAN
63
 
};
 
58
// wacom 
 
59
const static int LEVEL_OF_PRESSURE_RESOLUTION = 1024;
64
60
 
65
61
class KRITAUI_EXPORT KisToolPaint
66
62
        : public KisTool
73
69
    virtual ~KisToolPaint();
74
70
 
75
71
 
76
 
public:
 
72
protected:
 
73
 
 
74
    void setMode(ToolMode mode);
77
75
 
78
76
    virtual void resourceChanged(int key, const QVariant & v);
79
77
 
80
78
    virtual void paint(QPainter& gc, const KoViewConverter &converter);
81
79
 
 
80
    virtual void mousePressEvent(KoPointerEvent *event);
82
81
    virtual void mouseReleaseEvent(KoPointerEvent *event);
 
82
    virtual void mouseMoveEvent(KoPointerEvent *event);
 
83
 
 
84
    virtual void keyPressEvent(QKeyEvent *event);
 
85
    virtual void keyReleaseEvent(QKeyEvent* event);
 
86
 
83
87
 
84
88
    /** If the paint tool support outline like brushes, set to true.
85
89
    *   If not (e.g. gradient tool), set to false. Default is false.
105
109
    virtual QString quickHelp() const {
106
110
        return QString();
107
111
    }
 
112
    
 
113
    /// Reimplemented
 
114
    virtual void setupPainter(KisPainter* painter);
108
115
 
109
116
    virtual void setupPaintAction(KisRecordedPaintAction* action);
110
117
 
 
118
    qreal pressureToCurve(qreal pressure){
 
119
        return m_pressureSamples.at( qRound(pressure * LEVEL_OF_PRESSURE_RESOLUTION) );
 
120
    }
 
121
    
 
122
    enum NodePaintAbility {
 
123
        NONE,
 
124
        PAINT,
 
125
        VECTOR
 
126
    };
 
127
    
 
128
    /// Checks if and how the tool can paint on the current node
 
129
    NodePaintAbility nodePaintAbility();
 
130
 
 
131
 
111
132
public slots:
112
133
    virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
113
134
 
114
135
private slots:
115
136
 
116
 
    void updateCompositeOpComboBox();
117
137
    void slotPopupQuickHelp();
118
138
    void slotSetOpacity(int opacityPerCent);
119
139
    void slotSetCompositeMode(const QString& compositeOp);
120
140
 
121
141
protected slots:
122
142
    virtual void resetCursorStyle();
 
143
    virtual void updateTabletPressureSamples();
123
144
 
124
145
 
125
146
protected:
127
148
    quint8 m_opacity;
128
149
    const KoCompositeOp * m_compositeOp;
129
150
    bool m_paintOutline;
 
151
    QVector<qreal> m_pressureSamples;
 
152
 
 
153
private:
 
154
    void pickColor(const QPointF &documentPixel, bool fromCurrentNode,
 
155
                   bool toForegroundColor);
130
156
 
131
157
private:
132
158
 
134
160
 
135
161
    QLabel *m_lbOpacity;
136
162
    KisSliderSpinBox *m_slOpacity;
137
 
    QLabel *m_lbComposite;
138
 
    KisCmbComposite *m_cmbComposite;
139
 
    KisNodeSP m_previousNode;
140
163
 
141
164
    bool m_supportOutline;
142
165
 
 
166
    /**
 
167
     * Used as a switch for pickColor
 
168
     */
 
169
    bool m_toForegroundColor;
 
170
    // used to skip some of the tablet events and don't update the colour that often
 
171
    QTimer m_colorPickerDelayTimer;
 
172
 
143
173
signals:
144
174
    void sigFavoritePaletteCalled(const QPoint&);
145
 
    void sigPainting();
 
175
    void sigPaintingFinished();
146
176
};
147
177
 
148
178
#endif // KIS_TOOL_PAINT_H_