krita/ui
kis_canvas2.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KIS_CANVAS_H
00020 #define KIS_CANVAS_H
00021
00022 #include <QObject>
00023 #include <QWidget>
00024 #include <QSize>
00025 #include <QString>
00026
00027 #include <KoCanvasBase.h>
00028 #include <krita_export.h>
00029 #include <kis_types.h>
00030
00031 class KoToolProxy;
00032 class KoColorProfile;
00033
00034 class KisCanvasDecoration;
00035 class KisView2;
00036
00037 enum KisCanvasType {
00038 QPAINTER,
00039 OPENGL,
00040 MITSHM
00041 };
00042
00043 class KoViewConverter;
00044
00050 class KRITAUI_EXPORT KisCanvas2 : public QObject, public KoCanvasBase
00051 {
00052
00053 Q_OBJECT
00054
00055 public:
00056
00064 KisCanvas2(KoViewConverter * viewConverter, KisView2 * view, KoShapeControllerBase * sc);
00065
00066 virtual ~KisCanvas2();
00067
00068 void setCanvasWidget(QWidget * widget);
00069
00070 public:
00071
00072 void gridSize(qreal *horizontal, qreal *vertical) const;
00073
00074 bool snapToGrid() const;
00075
00076 void addCommand(QUndoCommand *command);
00077
00078 virtual void startMacro(const QString &title);
00079 virtual void stopMacro();
00080
00081 virtual QPoint documentOrigin() const;
00082 QPoint documentOffset() const;
00083
00090 KoShapeManager * shapeManager() const;
00091
00095 KoShapeManager * globalShapeManager() const;
00096
00097 void updateCanvas(const QRectF& rc);
00098
00099 virtual void updateInputMethodInfo();
00100
00101 virtual const KoViewConverter *viewConverter() const;
00102
00103 virtual QWidget* canvasWidget();
00104
00105 virtual const QWidget* canvasWidget() const;
00106
00107 virtual KoUnit unit() const;
00108
00109 virtual KoToolProxy* toolProxy() const;
00110
00111 KoColorProfile* monitorProfile();
00112
00117 void preScale();
00118
00119 void connectCurrentImage();
00120
00121 void disconnectCurrentImage();
00122
00123
00124
00125
00126 KisImageWSP currentImage();
00127
00128 public:
00129
00130 KisImageWSP image();
00131 KisView2* view();
00132
00133 bool usingHDRExposureProgram();
00134 void addDecoration(KisCanvasDecoration* deco);
00135 KisCanvasDecoration* decoration(const QString& id);
00136
00137 signals:
00138
00139 void documentOriginChanged();
00140
00141 void imageChanged(KisImageWSP image);
00142
00143 void canvasDestroyed(QWidget *);
00144
00145 public slots:
00146
00148 void updateCanvas();
00149
00152 void updateCanvasProjection(const QRect & rc);
00153
00154 void setImageSize(qint32 w, qint32 h);
00155
00157 void adjustOrigin();
00158
00160 void updateRulers();
00161
00162 private slots:
00163
00170 void documentOffsetMoved(const QPoint &documentOffset);
00171
00175 void slotConfigChanged();
00176
00180 void slotSetDisplayProfile(const KoColorProfile * profile);
00181
00182 private:
00183
00184 friend class KisView2;
00185
00186 void resetCanvas();
00187
00188 KisCanvas2(const KisCanvas2&);
00189
00190 void createCanvas();
00191 void createQPainterCanvas();
00192 void createOpenGLCanvas();
00193
00199 QRect viewRectFromDoc(const QRectF & docRect);
00200
00201 private:
00202
00203 class KisCanvas2Private;
00204 KisCanvas2Private * const m_d;
00205 };
00206
00207 #endif
|