# HG changeset patch # User Teemu Piippo # Date 1443966926 -10800 # Node ID 85fd352bae458b0c225f775ec0b7967675ce3950 # Parent 74cb432812d3d1def3e708c54a8c562c25124cf7 Fix rectangle mode for real Handle Bézier curves in external programs (rasterize them when passing them on) diff -r 74cb432812d3 -r 85fd352bae45 src/editmodes/rectangleMode.cpp --- a/src/editmodes/rectangleMode.cpp Sun Oct 04 16:45:30 2015 +0300 +++ b/src/editmodes/rectangleMode.cpp Sun Oct 04 16:55:26 2015 +0300 @@ -37,31 +37,19 @@ QVector ({renderer()->position3D()}), true, false); } -bool RectangleMode::mouseReleased (MouseEventData const& data) +void RectangleMode::endDraw() { - if (Super::mouseReleased (data)) - return true; - - if (data.releasedButtons & Qt::LeftButton) + if (m_drawedVerts.size() == 2) { - if (m_drawedVerts.size() == 2) - { - LDQuad* quad (LDSpawn()); - updateRectVerts(); + LDQuad* quad = LDSpawn(); + updateRectVerts(); - for (int i = 0; i < quad->numVertices(); ++i) - quad->setVertex (i, m_rectangleVerts[i]); + for (int i = 0; i < quad->numVertices(); ++i) + quad->setVertex (i, m_rectangleVerts[i]); - quad->setColor (MainColor); - finishDraw (LDObjectList ({quad})); - return true; - } - - addDrawnVertex (renderer()->position3D()); - return true; + quad->setColor (MainColor); + finishDraw (LDObjectList ({quad})); } - - return false; } // diff -r 74cb432812d3 -r 85fd352bae45 src/editmodes/rectangleMode.h --- a/src/editmodes/rectangleMode.h Sun Oct 04 16:45:30 2015 +0300 +++ b/src/editmodes/rectangleMode.h Sun Oct 04 16:55:26 2015 +0300 @@ -27,10 +27,11 @@ public: RectangleMode (GLRenderer* renderer); - virtual void render (QPainter& painter) const override; - virtual EditModeType type() const override; - virtual bool mouseReleased (MouseEventData const& data) override; - virtual bool mouseMoved (QMouseEvent*) override; + void render (QPainter& painter) const override; + EditModeType type() const override; + void endDraw() override; + bool mouseMoved (QMouseEvent*) override; + int maxVertices() const override { return 2; } private: void updateRectVerts(); diff -r 74cb432812d3 -r 85fd352bae45 src/toolsets/extprogramtoolset.cpp --- a/src/toolsets/extprogramtoolset.cpp Sun Oct 04 16:45:30 2015 +0300 +++ b/src/toolsets/extprogramtoolset.cpp Sun Oct 04 16:55:26 2015 +0300 @@ -170,7 +170,15 @@ { LDSubfile* ref = static_cast (obj); LDObjectList objs = ref->inlineContents (true, false); + writeObjects (objs, f); + for (LDObject* obj : objs) + obj->destroy(); + } + else if (obj->type() == OBJ_BezierCurve) + { + LDBezierCurve* curve = static_cast (obj); + LDObjectList objs = curve->rasterize(); writeObjects (objs, f); for (LDObject* obj : objs)