Sat, 24 Oct 2015 13:19:27 +0300
Rename LDSubfile to LDSubfileReference
--- a/ldforge.qrc Sun Oct 04 22:54:17 2015 +0300 +++ b/ldforge.qrc Sat Oct 24 13:19:27 2015 +0300 @@ -8,7 +8,7 @@ <file>./icons/add-line.png</file> <file>./icons/add-quad.png</file> <file>./icons/add-radial.png</file> - <file>./icons/add-subfile.png</file> + <file>./icons/add-subfilereference.png</file> <file>./icons/add-triangle.png</file> <file>./icons/arrow-down.png</file> <file>./icons/arrow-left.png</file> @@ -98,7 +98,7 @@ <file>./icons/select-type.png</file> <file>./icons/set-contents.png</file> <file>./icons/settings.png</file> - <file>./icons/subfile.png</file> + <file>./icons/subfilereference.png</file> <file>./icons/triangle.png</file> <file>./icons/uncolorize.png</file> <file>./icons/undo.png</file>
--- a/src/addObjectDialog.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/addObjectDialog.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -90,12 +90,12 @@ rb_bfcType->setValue ((int) static_cast<LDBfc*> (obj)->statement()); } break; - case OBJ_Subfile: + case OBJ_SubfileReference: { coordCount = 3; tw_subfileList = new QTreeWidget(); tw_subfileList->setHeaderLabel (tr ("Primitives")); - populatePrimitivesTree (tw_subfileList, (obj ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : "")); + populatePrimitivesTree (tw_subfileList, (obj ? static_cast<LDSubfileReference*> (obj)->fileInfo()->name() : "")); connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged())); lb_subfileName = new QLabel ("File:"); @@ -104,7 +104,7 @@ if (obj) { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); le_subfileName->setText (ref->fileInfo()->name()); } } break; @@ -172,7 +172,7 @@ layout->addWidget (rb_bfcType, 0, 1); break; - case OBJ_Subfile: + case OBJ_SubfileReference: layout->addWidget (tw_subfileList, 1, 1, 1, 2); layout->addWidget (lb_subfileName, 2, 1); layout->addWidget (le_subfileName, 2, 2); @@ -303,7 +303,7 @@ if (dlg.exec() == QDialog::Rejected) return; - if (type == OBJ_Subfile) + if (type == OBJ_SubfileReference) { QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts); @@ -357,7 +357,7 @@ bfc->setStatement (BfcStatement (dlg.rb_bfcType->value())); } break; - case OBJ_Subfile: + case OBJ_SubfileReference: { QString name = dlg.le_subfileName->text(); @@ -372,7 +372,7 @@ return; } - LDSubfile* ref = InitObject<LDSubfile> (obj); + LDSubfileReference* ref = InitObject<LDSubfileReference> (obj); for_axes (ax) ref->setCoordinate (ax, dlg.dsb_coords[ax]->value());
--- a/src/basics.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/basics.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -259,8 +259,8 @@ calcVertex (obj->vertex (i)); break; - case OBJ_Subfile: - for (LDObject* it : static_cast<LDSubfile*> (obj)->inlineContents (true, false)) + case OBJ_SubfileReference: + for (LDObject* it : static_cast<LDSubfileReference*> (obj)->inlineContents (true, false)) { calcObject (it); it->destroy();
--- a/src/crashCatcher.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/crashCatcher.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -30,6 +30,7 @@ # include <sys/prctl.h> # endif + // Removes the signal handler from SIGABRT and then aborts. static void finalAbort() { @@ -40,7 +41,8 @@ abort(); } -static void HandleCrash (int sig) + +static void handleCrash (int sig) { static bool isActive = false; printf ("!! Caught signal %d, launching gdb\n", sig); @@ -91,6 +93,7 @@ finalAbort(); } + void initCrashCatcher() { // List of signals to catch and crash on @@ -102,7 +105,7 @@ }; struct sigaction sighandler; - sighandler.sa_handler = &HandleCrash; + sighandler.sa_handler = &handleCrash; sighandler.sa_flags = 0; sigemptyset (&sighandler.sa_mask);
--- a/src/editmodes/circleMode.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/editmodes/circleMode.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -108,7 +108,7 @@ for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) { refFile = GetPrimitive (::Ring, segments, divisions, cmp.num); - LDSubfile* ref = LDSpawn<LDSubfile>(); + LDSubfileReference* ref = LDSpawn<LDSubfileReference>(); ref->setFileInfo (refFile); ref->setTransform (getCircleDrawMatrix (cmp.scale)); ref->setPosition (m_drawedVerts[0]); @@ -161,7 +161,7 @@ if (circleOrDisc and refFile) { - LDSubfile* ref = LDSpawn<LDSubfile>(); + LDSubfileReference* ref = LDSpawn<LDSubfileReference>(); ref->setFileInfo (refFile); ref->setTransform (transform); ref->setPosition (m_drawedVerts[0]);
--- a/src/format.h Sun Oct 04 22:54:17 2015 +0300 +++ b/src/format.h Sat Oct 24 13:19:27 2015 +0300 @@ -20,10 +20,9 @@ #include "basics.h" #include "colors.h" -// + // Converts a given value into a string that can be retrieved with text(). // Used as the argument type to the formatting functions, hence its name. -// class StringFormatArg { public: @@ -71,9 +70,8 @@ QString m_text; }; -// -// Helper function for \c format -// + +// Helper function for format() template<typename Arg1, typename... Rest> void formatHelper (QString& str, Arg1 arg1, Rest... rest) { @@ -81,22 +79,18 @@ formatHelper (str, rest...); } -// -// Overload of \c formatHelper() with no template args -// + static void formatHelper (QString& str) __attribute__ ((unused)); static void formatHelper (QString& str) { (void) str; } -// + // Format the message with the given args. // -// The formatting ultimately uses String's arg() method to actually format -// the args so the format string should be prepared accordingly, with %1 -// referring to the first arg, %2 to the second, etc. -// +// The formatting ultimately uses String's arg() method to actually format the args so the format string should be +// prepared accordingly, with %1 referring to the first arg, %2 to the second, etc. template<typename... Args> QString format (QString fmtstr, Args... args) { @@ -104,25 +98,19 @@ return fmtstr; } -// -// From messageLog.cc - declared here so that I don't need to include -// messageLog.h here. Prints the given message to log. -// -void PrintToLog (const QString& msg); -// +// From messageLog.cc - declared here so that I don't need to include messageLog.h here. +void printToLog (const QString& msg); + + // Format and print the given args to the message log. -// template<typename... Args> void print (QString fmtstr, Args... args) { formatHelper (fmtstr, args...); - PrintToLog (fmtstr); + printToLog (fmtstr); } -// -// Format and print the given args to the given file descriptor -// template<typename... Args> void fprint (FILE* fp, QString fmtstr, Args... args) { @@ -130,9 +118,7 @@ fprintf (fp, "%s", qPrintable (fmtstr)); } -// -// Overload of fprint with a QIODevice -// + template<typename... Args> void fprint (QIODevice& dev, QString fmtstr, Args... args) { @@ -140,15 +126,14 @@ dev.write (fmtstr.toUtf8()); } -// + // Exactly like print() except no-op in release builds. -// template<typename... Args> #ifndef RELEASE void dprint (QString fmtstr, Args... args) { formatHelper (fmtstr, args...); - PrintToLog (fmtstr); + printToLog (fmtstr); } #else void dprint (QString, Args...) {}
--- a/src/glCompiler.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/glCompiler.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -50,8 +50,6 @@ // static QMap<LDObject*, String> g_objectOrigins; -// ============================================================================= -// void CheckGLErrorImpl (const char* file, int line) { QString errmsg; @@ -72,8 +70,7 @@ print ("OpenGL ERROR: at %1:%2: %3", Basename (QString (file)), line, errmsg); } -// ============================================================================= -// + GLCompiler::GLCompiler (GLRenderer* renderer) : HierarchyElement (renderer), m_renderer (renderer) @@ -82,8 +79,7 @@ memset (m_vboSizes, 0, sizeof m_vboSizes); } -// ============================================================================= -// + void GLCompiler::initialize() { initializeOpenGLFunctions(); @@ -91,16 +87,14 @@ CHECK_GL_ERROR(); } -// ============================================================================= -// + GLCompiler::~GLCompiler() { glDeleteBuffers (NumVbos, &m_vbo[0]); CHECK_GL_ERROR(); } -// ============================================================================= -// + QColor GLCompiler::indexColorForID (int id) const { // Calculate a color based from this index. This method caters for @@ -112,8 +106,7 @@ return QColor (r, g, b); } -// ============================================================================= -// + QColor GLCompiler::getColorForPolygon (LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const { QColor qcol; @@ -202,16 +195,14 @@ return qcol; } -// ============================================================================= -// + void GLCompiler::needMerge() { for (int i = 0; i < countof (m_vboChanged); ++i) m_vboChanged[i] = true; } -// ============================================================================= -// + void GLCompiler::stageForCompilation (LDObject* obj) { /* @@ -222,15 +213,13 @@ m_staged << obj; } -// ============================================================================= -// + void GLCompiler::unstage (LDObject* obj) { m_staged.remove (obj); } -// ============================================================================= -// + void GLCompiler::compileDocument (LDDocument* doc) { if (doc) @@ -240,8 +229,7 @@ } } -// ============================================================================= -// + void GLCompiler::compileStaged() { for (QSetIterator<LDObject*> it (m_staged); it.hasNext();) @@ -250,8 +238,7 @@ m_staged.clear(); } -// ============================================================================= -// + void GLCompiler::prepareVBO (int vbonum) { // Compile anything that still awaits it @@ -284,8 +271,7 @@ m_vboSizes[vbonum] = vbodata.size(); } -// ============================================================================= -// + void GLCompiler::dropObjectInfo (LDObject* obj) { if (m_objectInfo.contains (obj)) @@ -295,12 +281,9 @@ } } -// ============================================================================= -// + void GLCompiler::compileObject (LDObject* obj) { -// print ("Compile %1\n", g_objectOrigins[obj]); - if (obj == nullptr or obj->document() == nullptr or obj->document()->isCache()) return; @@ -310,12 +293,12 @@ switch (obj->type()) { - // Note: We cannot split quads into triangles here, it would mess up the - // wireframe view. Quads must go into separate vbos. - case OBJ_Triangle: - case OBJ_Quad: - case OBJ_Line: - case OBJ_CondLine: + // Note: We cannot split quads into triangles here, it would mess up the wireframe view. + // Quads must go into separate vbos. + case OBJ_Triangle: + case OBJ_Quad: + case OBJ_Line: + case OBJ_CondLine: { LDPolygon* poly = obj->getPolygon(); poly->id = obj->id(); @@ -324,9 +307,9 @@ break; } - case OBJ_Subfile: + case OBJ_SubfileReference: { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); auto data = ref->inlinePolygons(); for (LDPolygon& poly : data) @@ -348,16 +331,15 @@ } break; - default: - break; + default: + break; } m_objectInfo[obj] = info; needMerge(); } -// ============================================================================= -// + void GLCompiler::compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo) { SurfaceVboType surface; @@ -365,18 +347,18 @@ switch (poly.num) { - case 2: surface = LinesVbo; numverts = 2; break; - case 3: surface = TrianglesVbo; numverts = 3; break; - case 4: surface = QuadsVbo; numverts = 4; break; - case 5: surface = ConditionalLinesVbo; numverts = 2; break; - default: return; + case 2: surface = LinesVbo; numverts = 2; break; + case 3: surface = TrianglesVbo; numverts = 3; break; + case 4: surface = QuadsVbo; numverts = 4; break; + case 5: surface = ConditionalLinesVbo; numverts = 2; break; + default: return; } for (ComplementVboType complement = FirstVboComplement; complement < NumVboComplements; ++complement) { - const int vbonum = vboNumber (surface, complement); - QVector<GLfloat>& vbodata = objinfo->data[vbonum]; - const QColor color = getColorForPolygon (poly, topobj, complement); + const int vbonum = vboNumber (surface, complement); + QVector<GLfloat>& vbodata = objinfo->data[vbonum]; + const QColor color = getColorForPolygon (poly, topobj, complement); for (int vert = 0; vert < numverts; ++vert) { @@ -398,21 +380,25 @@ } } + void GLCompiler::setRenderer (GLRenderer* renderer) { m_renderer = renderer; } + int GLCompiler::vboNumber (SurfaceVboType surface, ComplementVboType complement) { return (surface * NumVboComplements) + complement; } + GLuint GLCompiler::vbo (int vbonum) const { return m_vbo[vbonum]; } + int GLCompiler::vboSize (int vbonum) const { return m_vboSizes[vbonum];
--- a/src/glRenderer.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/glRenderer.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -1591,7 +1591,7 @@ { PrimitiveTreeItem* item = static_cast<PrimitiveTreeItem*> (m_window->getPrimitivesTree()->currentItem()); QString primitiveName = item->primitive()->name; - LDSubfile* ref = LDSpawn<LDSubfile>(); + LDSubfileReference* ref = LDSpawn<LDSubfileReference>(); ref->setColor (MainColor); ref->setFileInfo (m_documents->getDocumentByName (primitiveName)); ref->setPosition (Origin);
--- a/src/ldDocument.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/ldDocument.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -325,8 +325,7 @@ static void CheckTokenNumbers (const QStringList& tokens, int min, int max) { bool ok; - - QRegExp scient ("\\-?[0-9]+\\.[0-9]+e\\-[0-9]+"); + QRegExp scientificRegex ("\\-?[0-9]+\\.[0-9]+e\\-[0-9]+"); for (int i = min; i <= max; ++i) { @@ -345,11 +344,11 @@ } // Check scientific notation, e.g. 7.99361e-15 - if (scient.exactMatch (tokens[i])) + if (scientificRegex.exactMatch (tokens[i])) return; throw QString (format ("Token #%1 was `%2`, expected a number (matched length: %3)", - (i + 1), tokens[i], scient.matchedLength())); + (i + 1), tokens[i], scientificRegex.matchedLength())); } } @@ -478,7 +477,7 @@ return obj; } - LDSubfile* obj = LDSpawn<LDSubfile>(); + LDSubfileReference* obj = LDSpawn<LDSubfileReference>(); obj->setColor (StringToNumber (tokens[1])); obj->setPosition (ParseVertex (tokens, 2)); // 2 - 4 @@ -564,9 +563,9 @@ // Go through all objects in the current file and reload the subfiles for (LDObject* obj : objects()) { - if (obj->type() == OBJ_Subfile) + if (obj->type() == OBJ_SubfileReference) { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); LDDocument* fileInfo = m_documents->getDocumentByName (ref->fileInfo()->name()); if (fileInfo) @@ -739,10 +738,10 @@ for (LDObject* obj : inlineContents (true, true)) { - if (obj->type() == OBJ_Subfile) + if (obj->type() == OBJ_SubfileReference) { print ("Warning: unable to inline %1 into %2", - static_cast<LDSubfile*> (obj)->fileInfo()->getDisplayName(), + static_cast<LDSubfileReference*> (obj)->fileInfo()->getDisplayName(), getDisplayName()); continue; } @@ -812,9 +811,9 @@ // Got another sub-file reference, inline it if we're deep-inlining. If not, // just add it into the objects normally. Yay, recursion! - if (deep == true and obj->type() == OBJ_Subfile) + if (deep == true and obj->type() == OBJ_SubfileReference) { - for (LDObject* otherobj : static_cast<LDSubfile*> (obj)->inlineContents (deep, renderinline)) + for (LDObject* otherobj : static_cast<LDSubfileReference*> (obj)->inlineContents (deep, renderinline)) objs << otherobj; } else
--- a/src/ldObject.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/ldObject.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -67,7 +67,7 @@ m_randomColor = QColor::fromHsv (rand() % 360, rand() % 256, rand() % 96 + 128); } -LDSubfile::LDSubfile (LDDocument* document) : +LDSubfileReference::LDSubfileReference (LDDocument* document) : LDMatrixObject (document) {} LDOBJ_DEFAULT_CTOR (LDEmpty, LDObject) @@ -96,7 +96,7 @@ // ============================================================================= // -QString LDSubfile::asText() const +QString LDSubfileReference::asText() const { QString val = format ("1 %1 %2 ", color(), position()); val += transform().toString(); @@ -351,9 +351,9 @@ } break; - case OBJ_Subfile: + case OBJ_SubfileReference: { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); Matrix newMatrix = transform * ref->transform(); Vertex newpos = ref->position(); newpos.transform (transform, pos); @@ -372,7 +372,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -LDObjectList LDSubfile::inlineContents (bool deep, bool render) +LDObjectList LDSubfileReference::inlineContents (bool deep, bool render) { LDObjectList objs = fileInfo()->inlineContents (deep, render); @@ -410,7 +410,7 @@ // ============================================================================= // -QList<LDPolygon> LDSubfile::inlinePolygons() +QList<LDPolygon> LDSubfileReference::inlinePolygons() { QList<LDPolygon> data = fileInfo()->inlinePolygons(); @@ -642,7 +642,7 @@ case OBJ_Bfc: return LDSpawn<LDBfc>(); case OBJ_Line: return LDSpawn<LDLine>(); case OBJ_CondLine: return LDSpawn<LDCondLine>(); - case OBJ_Subfile: return LDSpawn<LDSubfile>(); + case OBJ_SubfileReference: return LDSpawn<LDSubfileReference>(); case OBJ_Triangle: return LDSpawn<LDTriangle>(); case OBJ_Quad: return LDSpawn<LDQuad>(); case OBJ_Empty: return LDSpawn<LDEmpty>(); @@ -689,7 +689,7 @@ // ============================================================================= // -void LDSubfile::invert() +void LDSubfileReference::invert() { if (document() == nullptr) return; @@ -1180,12 +1180,12 @@ // ============================================================================= // -LDDocument* LDSubfile::fileInfo() const +LDDocument* LDSubfileReference::fileInfo() const { return m_fileInfo; } -void LDSubfile::setFileInfo (LDDocument* document) +void LDSubfileReference::setFileInfo (LDDocument* document) { changeProperty (this, &m_fileInfo, document); @@ -1205,7 +1205,7 @@ verts << vertex (i); } -void LDSubfile::getVertices (QVector<Vertex>& verts) const +void LDSubfileReference::getVertices (QVector<Vertex>& verts) const { verts << fileInfo()->inlineVertices(); } \ No newline at end of file
--- a/src/ldObject.h Sun Oct 04 22:54:17 2015 +0300 +++ b/src/ldObject.h Sat Oct 24 13:19:27 2015 +0300 @@ -52,7 +52,7 @@ #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX (false) class QListWidgetItem; -class LDSubfile; +class LDSubfileReference; class LDDocument; class LDBfc; @@ -62,20 +62,20 @@ // enum LDObjectType { - OBJ_Subfile, // Object represents a sub-file reference - OBJ_Quad, // Object represents a quadrilateral - OBJ_Triangle, // Object represents a triangle - OBJ_Line, // Object represents a line - OBJ_CondLine, // Object represents a conditional line - OBJ_Bfc, // Object represents a BFC statement - OBJ_Overlay, // Object contains meta-info about an overlay image. - OBJ_Comment, // Object represents a comment - OBJ_Error, // Object is the result of failed parsing - OBJ_Empty, // Object represents an empty line - OBJ_BezierCurve, // Object represents a Bézier curve + OBJ_SubfileReference, // Object represents a sub-file reference + OBJ_Quad, // Object represents a quadrilateral + OBJ_Triangle, // Object represents a triangle + OBJ_Line, // Object represents a line + OBJ_CondLine, // Object represents a conditional line + OBJ_Bfc, // Object represents a BFC statement + OBJ_Overlay, // Object contains meta-info about an overlay image. + OBJ_Comment, // Object represents a comment + OBJ_Error, // Object is the result of failed parsing + OBJ_Empty, // Object represents an empty line + OBJ_BezierCurve, // Object represents a Bézier curve - OBJ_NumTypes, // Amount of object types - OBJ_FirstType = OBJ_Subfile + OBJ_NumTypes, // Amount of object types + OBJ_FirstType = OBJ_SubfileReference }; MAKE_ITERABLE_ENUM (LDObjectType) @@ -303,14 +303,14 @@ }; // -// LDSubfile +// LDReference // // Represents a single code-1 subfile reference. // -class LDSubfile : public LDMatrixObject +class LDSubfileReference : public LDMatrixObject { - LDOBJ (Subfile) - LDOBJ_NAME (subfile) + LDOBJ (SubfileReference) + LDOBJ_NAME (subfilereference) LDOBJ_VERTICES (0) LDOBJ_COLORED LDOBJ_DEFAULTCOLOR (MainColor)
--- a/src/mainwindow.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/mainwindow.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -430,9 +430,9 @@ break; } - case OBJ_Subfile: + case OBJ_SubfileReference: { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); descr = format ("%1 %2, (", ref->fileInfo()->getDisplayName(), ref->position().toString (true)); @@ -731,7 +731,7 @@ for (LDObject* obj : selectedObjects()) { - if (obj->type() == OBJ_Subfile) + if (obj->type() == OBJ_SubfileReference) { hasSubfiles = true; break;
--- a/src/messageLog.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/messageLog.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -133,7 +133,7 @@ // ============================================================================= // -void PrintToLog (const QString& msg) +void printToLog (const QString& msg) { for (QString& a : msg.split ("\n", QString::SkipEmptyParts)) {
--- a/src/toolsets/algorithmtoolset.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/toolsets/algorithmtoolset.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -572,7 +572,7 @@ obj->destroy(); // Add a reference to the new subfile to where the selection was - LDSubfile* ref = LDSpawn<LDSubfile>(); + LDSubfileReference* ref = LDSpawn<LDSubfileReference>(); ref->setColor (MainColor); ref->setFileInfo (doc); ref->setPosition (Origin);
--- a/src/toolsets/basictoolset.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/toolsets/basictoolset.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -95,7 +95,7 @@ void BasicToolset::doInline (bool deep) { - for (LDSubfile* ref : filterByType<LDSubfile> (selectedObjects())) + for (LDSubfileReference* ref : filterByType<LDSubfileReference> (selectedObjects())) { // Get the index of the subfile so we know where to insert the // inlined contents. @@ -225,7 +225,7 @@ void BasicToolset::newSubfile() { - AddObjectDialog::staticDialog (OBJ_Subfile, nullptr); + AddObjectDialog::staticDialog (OBJ_SubfileReference, nullptr); } void BasicToolset::newLine()
--- a/src/toolsets/extprogramtoolset.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/toolsets/extprogramtoolset.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -166,9 +166,9 @@ { for (LDObject* obj : objects) { - if (obj->type() == OBJ_Subfile) + if (obj->type() == OBJ_SubfileReference) { - LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); LDObjectList objs = ref->inlineContents (true, false); writeObjects (objs, f);
--- a/src/toolsets/filetoolset.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/toolsets/filetoolset.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -179,7 +179,7 @@ { for (LDObject* obj : selectedObjects()) { - LDSubfile* ref = dynamic_cast<LDSubfile*> (obj); + LDSubfileReference* ref = dynamic_cast<LDSubfileReference*> (obj); if (ref and ref->fileInfo()->isCache()) ref->fileInfo()->openForEditing();
--- a/src/toolsets/viewtoolset.cpp Sun Oct 04 22:54:17 2015 +0300 +++ b/src/toolsets/viewtoolset.cpp Sat Oct 24 13:19:27 2015 +0300 @@ -72,8 +72,8 @@ { types << obj->type(); - if (types.last() == OBJ_Subfile) - subfilenames << static_cast<LDSubfile*> (obj)->fileInfo()->name(); + if (types.last() == OBJ_SubfileReference) + subfilenames << static_cast<LDSubfileReference*> (obj)->fileInfo()->name(); } removeDuplicates (types); @@ -88,7 +88,7 @@ continue; // For subfiles, type check is not enough, we check the name of the document as well. - if (type == OBJ_Subfile and not subfilenames.contains (static_cast<LDSubfile*> (obj)->fileInfo()->name())) + if (type == OBJ_SubfileReference and not subfilenames.contains (static_cast<LDSubfileReference*> (obj)->fileInfo()->name())) continue; obj->select();