src/editmodes/abstractEditMode.h

changeset 1000
c064cc048f14
parent 970
c8aae45afd85
child 1006
a6b462051ae0
equal deleted inserted replaced
999:213a7c7a3ce4 1000:c064cc048f14
30 Draw, 30 Draw,
31 Rectangle, 31 Rectangle,
32 Circle, 32 Circle,
33 MagicWand, 33 MagicWand,
34 LinePath, 34 LinePath,
35 Curve,
35 }; 36 };
36 37
37 class AbstractEditMode : public QObject, public HierarchyElement 38 class AbstractEditMode : public QObject, public HierarchyElement
38 { 39 {
39 Q_OBJECT 40 Q_OBJECT
78 QBrush m_polybrush; 79 QBrush m_polybrush;
79 80
80 public: 81 public:
81 AbstractDrawMode (GLRenderer* renderer); 82 AbstractDrawMode (GLRenderer* renderer);
82 83
83 virtual bool allowFreeCamera() const override 84 void addDrawnVertex (const Vertex& pos);
84 { 85 virtual bool allowFreeCamera() const override final { return false; }
85 return false; 86 virtual void endDraw() {}
86 } 87 void drawLength (QPainter& painter,
87 88 const Vertex& v0, const Vertex& v1,
89 const QPointF& v0p, const QPointF& v1p) const;
90 void finishDraw (const LDObjectList& objs);
91 Vertex getCursorVertex() const;
92 bool keyReleased (QKeyEvent* ev) override;
93 virtual int maxVertices() const { return 0; }
88 bool mouseReleased (const AbstractEditMode::MouseEventData& data) override; 94 bool mouseReleased (const AbstractEditMode::MouseEventData& data) override;
89 void addDrawnVertex (const Vertex& pos); 95 virtual bool preAddVertex (Vertex const&) { return false; }
90 void finishDraw (const LDObjectList& objs); 96 void renderPolygon (QPainter& painter, const QVector<Vertex>& poly3d, bool withlengths, bool withangles) const;
91 void renderPolygon (QPainter& painter, const QVector<Vertex>& poly3d,
92 bool withlengths, bool withangles) const;
93 void drawLength (QPainter& painter, Vertex const& v0, Vertex const& v1,
94 const QPointF& v0p, const QPointF& v1p) const;
95 bool keyReleased (QKeyEvent* ev) override;
96
97 virtual bool preAddVertex (Vertex const&)
98 {
99 return false;
100 }
101 }; 97 };
102 98
103 // 99 //
104 // Base class for select-like edit modes 100 // Base class for select-like edit modes
105 // 101 //

mercurial