Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/flake/kis_shape_layer_canvas.cpp
Show All 27 Lines | |||||
28 | #include <kis_paint_device.h> | 28 | #include <kis_paint_device.h> | ||
29 | #include <kis_image.h> | 29 | #include <kis_image.h> | ||
30 | #include <kis_layer.h> | 30 | #include <kis_layer.h> | ||
31 | #include <kis_painter.h> | 31 | #include <kis_painter.h> | ||
32 | #include <flake/kis_shape_layer.h> | 32 | #include <flake/kis_shape_layer.h> | ||
33 | #include <KoCompositeOpRegistry.h> | 33 | #include <KoCompositeOpRegistry.h> | ||
34 | #include <KoSelection.h> | 34 | #include <KoSelection.h> | ||
35 | #include <KoUnit.h> | 35 | #include <KoUnit.h> | ||
36 | #include "kis_image_view_converter.h" | ||||
36 | 37 | | |||
37 | #include <kis_debug.h> | 38 | #include <kis_debug.h> | ||
38 | 39 | | |||
39 | //#define DEBUG_REPAINT | 40 | //#define DEBUG_REPAINT | ||
40 | 41 | | |||
41 | KisShapeLayerCanvas::KisShapeLayerCanvas(KisShapeLayer *parent, KoViewConverter * viewConverter) | 42 | KisShapeLayerCanvas::KisShapeLayerCanvas(KisShapeLayer *parent, KisImageWSP image) | ||
42 | : QObject() | 43 | : QObject() | ||
43 | , KoCanvasBase(0) | 44 | , KoCanvasBase(0) | ||
44 | , m_isDestroying(false) | 45 | , m_isDestroying(false) | ||
45 | , m_viewConverter(viewConverter) | 46 | , m_viewConverter(new KisImageViewConverter(image)) | ||
46 | , m_shapeManager(new KoShapeManager(this)) | 47 | , m_shapeManager(new KoShapeManager(this)) | ||
47 | , m_projection(0) | 48 | , m_projection(0) | ||
48 | , m_parentLayer(parent) | 49 | , m_parentLayer(parent) | ||
49 | { | 50 | { | ||
50 | m_shapeManager->selection()->setActiveLayer(parent); | 51 | m_shapeManager->selection()->setActiveLayer(parent); | ||
51 | connect(this, SIGNAL(forwardRepaint()), SLOT(repaint()), Qt::QueuedConnection); | 52 | connect(this, SIGNAL(forwardRepaint()), SLOT(repaint()), Qt::QueuedConnection); | ||
52 | } | 53 | } | ||
53 | 54 | | |||
54 | KisShapeLayerCanvas::~KisShapeLayerCanvas() | 55 | KisShapeLayerCanvas::~KisShapeLayerCanvas() | ||
55 | { | 56 | { | ||
56 | delete m_shapeManager; | 57 | delete m_shapeManager; | ||
57 | } | 58 | } | ||
58 | 59 | | |||
60 | void KisShapeLayerCanvas::setImage(KisImageWSP image) | ||||
61 | { | ||||
62 | m_viewConverter->setImage(image); | ||||
63 | } | ||||
64 | | ||||
59 | void KisShapeLayerCanvas::prepareForDestroying() | 65 | void KisShapeLayerCanvas::prepareForDestroying() | ||
60 | { | 66 | { | ||
61 | m_isDestroying = true; | 67 | m_isDestroying = true; | ||
62 | } | 68 | } | ||
63 | 69 | | |||
64 | void KisShapeLayerCanvas::gridSize(QPointF *offset, QSizeF *spacing) const | 70 | void KisShapeLayerCanvas::gridSize(QPointF *offset, QSizeF *spacing) const | ||
65 | { | 71 | { | ||
66 | Q_ASSERT(false); // This should never be called as this canvas should have no tools. | 72 | Q_ASSERT(false); // This should never be called as this canvas should have no tools. | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | |||||
147 | } | 153 | } | ||
148 | 154 | | |||
149 | KoToolProxy * KisShapeLayerCanvas::toolProxy() const | 155 | KoToolProxy * KisShapeLayerCanvas::toolProxy() const | ||
150 | { | 156 | { | ||
151 | // Q_ASSERT(false); // This should never be called as this canvas should have no tools. | 157 | // Q_ASSERT(false); // This should never be called as this canvas should have no tools. | ||
152 | return 0; | 158 | return 0; | ||
153 | } | 159 | } | ||
154 | 160 | | |||
155 | KoViewConverter *KisShapeLayerCanvas::viewConverter() const | 161 | KoViewConverter* KisShapeLayerCanvas::viewConverter() const | ||
156 | { | 162 | { | ||
157 | return m_viewConverter; | 163 | return m_viewConverter.data(); | ||
158 | } | 164 | } | ||
159 | 165 | | |||
160 | QWidget* KisShapeLayerCanvas::canvasWidget() | 166 | QWidget* KisShapeLayerCanvas::canvasWidget() | ||
161 | { | 167 | { | ||
162 | return 0; | 168 | return 0; | ||
163 | } | 169 | } | ||
164 | 170 | | |||
165 | const QWidget* KisShapeLayerCanvas::canvasWidget() const | 171 | const QWidget* KisShapeLayerCanvas::canvasWidget() const | ||
Show All 10 Lines |