Sun, 18 Aug 2013 17:53:23 +0300
Cut the Object-suffix from LDObject types, it doesn't help things at all
src/addObjectDialog.cpp | file | annotate | diff | comparison | revisions | |
src/download.cpp | file | annotate | diff | comparison | revisions | |
src/extprogs.cpp | file | annotate | diff | comparison | revisions | |
src/file.cpp | file | annotate | diff | comparison | revisions | |
src/file.h | file | annotate | diff | comparison | revisions | |
src/gldraw.cpp | file | annotate | diff | comparison | revisions | |
src/gldraw.h | file | annotate | diff | comparison | revisions | |
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/gui_actions.cpp | file | annotate | diff | comparison | revisions | |
src/gui_editactions.cpp | file | annotate | diff | comparison | revisions | |
src/ldtypes.cpp | file | annotate | diff | comparison | revisions | |
src/ldtypes.h | file | annotate | diff | comparison | revisions | |
src/primitives.cpp | file | annotate | diff | comparison | revisions | |
src/types.cpp | file | annotate | diff | comparison | revisions |
--- a/src/addObjectDialog.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/addObjectDialog.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -60,7 +60,7 @@ case LDObject::Comment: le_comment = new QLineEdit; if (obj) - le_comment->setText (static_cast<LDCommentObject*> (obj)->text); + le_comment->setText (static_cast<LDComment*> (obj)->text); le_comment->setMinimumWidth (384); break; @@ -74,7 +74,7 @@ break; case LDObject::Quad: - case LDObject::CondLine: + case LDObject::CndLine: coordCount = 12; break; @@ -85,16 +85,16 @@ case LDObject::BFC: rb_bfcType = new RadioBox ("Statement", {}, 0, Qt::Vertical); - for (int i = 0; i < LDBFCObject::NumStatements; ++i) { + for (int i = 0; i < LDBFC::NumStatements; ++i) { // Separate these in two columns - if (i == LDBFCObject::NumStatements / 2) + if (i == LDBFC::NumStatements / 2) rb_bfcType->rowBreak(); - rb_bfcType->addButton (LDBFCObject::statements[i]); + rb_bfcType->addButton (LDBFC::statements[i]); } if (obj) - rb_bfcType->setValue ((int) static_cast<LDBFCObject*> (obj)->type); + rb_bfcType->setValue ((int) static_cast<LDBFC*> (obj)->type); break; case LDObject::Subfile: @@ -120,7 +120,7 @@ // If this primitive is the one the current object points to, // select it by default - if (obj && static_cast<LDSubfileObject*> (obj)->fileInfo()->name() == prim.name) + if (obj && static_cast<LDSubfile*> (obj)->fileInfo()->name() == prim.name) tw_subfileList->setCurrentItem (item); } @@ -133,7 +133,7 @@ le_subfileName->setFocus(); if (obj) { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); le_subfileName->setText (ref->fileInfo()->name()); } break; @@ -154,7 +154,7 @@ if (obj != null) colnum = obj->color(); else - colnum = (type == LDObject::CondLine || type == LDObject::Line) ? edgecolor : maincolor; + colnum = (type == LDObject::CndLine || type == LDObject::Line) ? edgecolor : maincolor; pb_color = new QPushButton; setButtonBackground (pb_color, colnum); @@ -173,7 +173,7 @@ switch (type) { case LDObject::Line: - case LDObject::CondLine: + case LDObject::CndLine: case LDObject::Triangle: case LDObject::Quad: // Apply coordinates @@ -332,7 +332,7 @@ switch (type) { case LDObject::Comment: { - LDCommentObject* comm = initObj<LDCommentObject> (obj); + LDComment* comm = initObj<LDComment> (obj); comm->text = dlg.le_comment->text(); } break; @@ -340,7 +340,7 @@ case LDObject::Line: case LDObject::Triangle: case LDObject::Quad: - case LDObject::CondLine: + case LDObject::CndLine: if (!obj) obj = LDObject::getDefault (type); @@ -355,14 +355,14 @@ case LDObject::BFC: { - LDBFCObject* bfc = initObj<LDBFCObject> (obj); - bfc->type = (LDBFCObject::Type) dlg.rb_bfcType->value(); + LDBFC* bfc = initObj<LDBFC> (obj); + bfc->type = (LDBFC::Type) dlg.rb_bfcType->value(); } break; case LDObject::Vertex: { - LDVertexObject* vert = initObj<LDVertexObject> (obj); + LDVertex* vert = initObj<LDVertex> (obj); for (const Axis ax : g_Axes) vert->pos[ax] = dlg.dsb_coords[ax]->value(); @@ -381,7 +381,7 @@ return; } - LDSubfileObject* ref = initObj<LDSubfileObject> (obj); + LDSubfile* ref = initObj<LDSubfile> (obj); for (const Axis ax : g_Axes) ref->setCoordinate (ax, dlg.dsb_coords[ax]->value());
--- a/src/download.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/download.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -412,7 +412,7 @@ // This is why downloading a part may end up downloading multiple files, as // it resolves dependencies. for (LDObject* obj : *f) { - LDErrorObject* err = dynamic_cast<LDErrorObject*> (obj); + LDError* err = dynamic_cast<LDError*> (obj); if (!err || err->fileRef().isEmpty()) continue;
--- a/src/extprogs.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/extprogs.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -151,8 +151,8 @@ void writeObjects (List<LDObject*>& objects, File& f) { for (LDObject* obj : objects) { if (obj->getType() == LDObject::Subfile) { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); - List<LDObject*> objs = ref->inlineContents (LDSubfileObject::DeepInline); + LDSubfile* ref = static_cast<LDSubfile*> (obj); + List<LDObject*> objs = ref->inlineContents (LDSubfile::DeepInline); writeObjects (objs, f);
--- a/src/file.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/file.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -279,7 +279,7 @@ // Check for parse errors and warn about tthem if (obj->getType() == LDObject::Error) { - log ("Couldn't parse line #%1: %2", m_progress + 1, static_cast<LDErrorObject*> (obj)->reason); + log ("Couldn't parse line #%1: %2", m_progress + 1, static_cast<LDError*> (obj)->reason); if (m_warningsPointer) (*m_warningsPointer)++; @@ -550,11 +550,11 @@ // If the second object in the list holds the file name, update that now. // Only do this if the file is explicitly open. If it's saved into a directory // called "s" or "48", prepend that into the name. - LDCommentObject* fpathComment = null; + LDComment* fpathComment = null; LDObject* first = object (1); if (!implicit() && first != null && first->getType() == LDObject::Comment) { - fpathComment = static_cast<LDCommentObject*> (first); + fpathComment = static_cast<LDComment*> (first); if (fpathComment->text.left (6) == "Name: ") { str newname; @@ -590,12 +590,12 @@ // ----------------------------------------------------------------------------- #define CHECK_TOKEN_COUNT(N) \ if (tokens.size() != N) \ - return new LDErrorObject (line, "Bad amount of tokens"); + return new LDError (line, "Bad amount of tokens"); #define CHECK_TOKEN_NUMBERS(MIN, MAX) \ for (ushort i = MIN; i <= MAX; ++i) \ if (!isNumber (tokens[i])) \ - return new LDErrorObject (line, fmt ("Token #%1 was `%2`, expected a number", (i + 1), tokens[i])); + return new LDError (line, fmt ("Token #%1 was `%2`, expected a number", (i + 1), tokens[i])); // ============================================================================= // ----------------------------------------------------------------------------- @@ -618,11 +618,11 @@ if (tokens.size() <= 0) { // Line was empty, or only consisted of whitespace - return new LDEmptyObject; + return new LDEmpty; } if (tokens[0].length() != 1 || tokens[0][0].isDigit() == false) - return new LDErrorObject (line, "Illogical line code"); + return new LDError (line, "Illogical line code"); int num = tokens[0][0].digitValue(); @@ -637,25 +637,25 @@ // Handle BFC statements if (tokens.size() > 2 && tokens[1] == "BFC") { - for (short i = 0; i < LDBFCObject::NumStatements; ++i) - if (comm == fmt ("BFC %1", LDBFCObject::statements [i])) - return new LDBFCObject ((LDBFCObject::Type) i); + for (short i = 0; i < LDBFC::NumStatements; ++i) + if (comm == fmt ("BFC %1", LDBFC::statements [i])) + return new LDBFC ((LDBFC::Type) i); // MLCAD is notorious for stuffing these statements in parts it // creates. The above block only handles valid statements, so we // need to handle MLCAD-style invertnext, clip and noclip separately. struct { const char* a; - LDBFCObject::Type b; + LDBFC::Type b; } BFCData[] = { - { "INVERTNEXT", LDBFCObject::InvertNext }, - { "NOCLIP", LDBFCObject::NoClip }, - { "CLIP", LDBFCObject::Clip } + { "INVERTNEXT", LDBFC::InvertNext }, + { "NOCLIP", LDBFC::NoClip }, + { "CLIP", LDBFC::Clip } }; for (const auto& i : BFCData) if (comm == fmt ("BFC CERTIFY %1", i.a)) - return new LDBFCObject (i.b); + return new LDBFC (i.b); } if (tokens.size() > 2 && tokens[1] == "!LDFORGE") { @@ -665,7 +665,7 @@ CHECK_TOKEN_COUNT (7) CHECK_TOKEN_NUMBERS (3, 6) - LDVertexObject* obj = new LDVertexObject; + LDVertex* obj = new LDVertex; obj->setColor (tokens[3].toLong()); for (const Axis ax : g_Axes) @@ -676,7 +676,7 @@ CHECK_TOKEN_COUNT (9); CHECK_TOKEN_NUMBERS (5, 8) - LDOverlayObject* obj = new LDOverlayObject; + LDOverlay* obj = new LDOverlay; obj->setFilename (tokens[3]); obj->setCamera (tokens[4].toLong()); obj->setX (tokens[5].toLong()); @@ -688,7 +688,7 @@ } // Just a regular comment: - LDCommentObject* obj = new LDCommentObject; + LDComment* obj = new LDComment; obj->text = comm; return obj; } @@ -707,12 +707,12 @@ // If we cannot open the file, mark it an error if (!load) { - LDErrorObject* obj = new LDErrorObject (line, fmt ("Could not open %1", tokens[14])); + LDError* obj = new LDError (line, fmt ("Could not open %1", tokens[14])); obj->setFileRef (tokens[14]); return obj; } - LDSubfileObject* obj = new LDSubfileObject; + LDSubfile* obj = new LDSubfile; obj->setColor (tokens[1].toLong()); obj->setPosition (parseVertex (tokens, 2)); // 2 - 4 @@ -731,7 +731,7 @@ CHECK_TOKEN_NUMBERS (1, 7) // Line - LDLineObject* obj = new LDLineObject; + LDLine* obj = new LDLine; obj->setColor (tokens[1].toLong()); for (short i = 0; i < 2; ++i) @@ -745,7 +745,7 @@ CHECK_TOKEN_NUMBERS (1, 10) // Triangle - LDTriangleObject* obj = new LDTriangleObject; + LDTriangle* obj = new LDTriangle; obj->setColor (tokens[1].toLong()); for (short i = 0; i < 3; ++i) @@ -763,9 +763,9 @@ LDObject* obj; if (num == 4) - obj = new LDQuadObject; + obj = new LDQuad; else - obj = new LDCondLineObject; + obj = new LDCndLine; obj->setColor (tokens[1].toLong()); @@ -776,7 +776,7 @@ } default: // Strange line we couldn't parse - return new LDErrorObject (line, "Unknown line code number"); + return new LDError (line, "Unknown line code number"); } } @@ -805,19 +805,19 @@ // Go through all objects in the current file and reload the subfiles for (LDObject* obj : LDFile::current()->objs()) { if (obj->getType() == LDObject::Subfile) { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); LDFile* fileInfo = getFile (ref->fileInfo()->name()); if (fileInfo) ref->setFileInfo (fileInfo); else - ref->replace (new LDErrorObject (ref->raw(), "Could not open referred file")); + ref->replace (new LDError (ref->raw(), "Could not open referred file")); } // Reparse gibberish files. It could be that they are invalid because // of loading errors. Circumstances may be different now. if (obj->getType() == LDObject::Error) - obj->replace (parseLine (static_cast<LDErrorObject*> (obj)->contents)); + obj->replace (parseLine (static_cast<LDError*> (obj)->contents)); } // Close all files left unused @@ -887,7 +887,7 @@ if (obj->getType() != LDObject::Subfile) continue; - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); filesUsed << ref->fileInfo(); filesUsed << getFilesUsed (ref->fileInfo()); } @@ -975,11 +975,11 @@ // ============================================================================= // ----------------------------------------------------------------------------- -List<LDObject*> LDFile::inlineContents (LDSubfileObject::InlineFlags flags) { +List<LDObject*> LDFile::inlineContents (LDSubfile::InlineFlags flags) { // Possibly substitute with logoed studs: // stud.dat -> stud-logo.dat // stud2.dat -> stud-logo2.dat - if (gl_logostuds && (flags & LDSubfileObject::RendererInline)) { + if (gl_logostuds && (flags & LDSubfile::RendererInline)) { if (name() == "stud.dat" && g_logoedStud) return g_logoedStud->inlineContents (flags); elif (name() == "stud2.dat" && g_logoedStud2) @@ -988,8 +988,8 @@ List<LDObject*> objs, objcache; - bool deep = flags & LDSubfileObject::DeepInline, - doCache = flags & LDSubfileObject::CacheInline; + bool deep = flags & LDSubfile::DeepInline, + doCache = flags & LDSubfile::CacheInline; // If we have this cached, just clone that if (deep && cache().size()) { @@ -1008,11 +1008,11 @@ // just add it into the objects normally. Also, we only cache immediate // subfiles and this is not one. Yay, recursion! if (deep && obj->getType() == LDObject::Subfile) { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); // We only want to cache immediate subfiles, so shed the caching // flag when recursing deeper in hierarchy. - List<LDObject*> otherobjs = ref->inlineContents (flags & ~(LDSubfileObject::CacheInline)); + List<LDObject*> otherobjs = ref->inlineContents (flags & ~(LDSubfile::CacheInline)); for (LDObject* otherobj : otherobjs) { // Cache this object, if desired
--- a/src/file.h Sun Aug 18 17:38:33 2013 +0300 +++ b/src/file.h Sun Aug 18 17:53:23 2013 +0300 @@ -130,7 +130,7 @@ static void closeInitialFile(); static int countExplicitFiles(); str getShortName(); - List<LDObject*> inlineContents (LDSubfileObject::InlineFlags flags); + List<LDObject*> inlineContents (LDSubfile::InlineFlags flags); private: static LDFile* m_curfile;
--- a/src/gldraw.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/gldraw.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -254,7 +254,7 @@ if ((list == BFCFrontList || list == BFCBackList) && obj->getType() != LDObject::Line && - obj->getType() != LDObject::CondLine) { + obj->getType() != LDObject::CndLine) { if (list == GL::BFCFrontList) qcol = QColor (40, 192, 0); @@ -708,7 +708,7 @@ void GLRenderer::compileSubObject (LDObject* obj, const GLenum gltype) { glBegin (gltype); - const short numverts = (obj->getType() != LDObject::CondLine) ? obj->vertices() : 2; + const short numverts = (obj->getType() != LDObject::CndLine) ? obj->vertices() : 2; if (g_glInvert == false) for (short i = 0; i < numverts; ++i) @@ -730,7 +730,7 @@ compileSubObject (obj, GL_LINES); break; - case LDObject::CondLine: + case LDObject::CndLine: // Draw conditional lines with a dash pattern - however, use a full // line when drawing a pick list to make selecting them easier. if (list != GL::PickList) { @@ -752,20 +752,20 @@ break; case LDObject::Subfile: { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); List<LDObject*> objs; objs = ref->inlineContents ( - LDSubfileObject::DeepInline | - LDSubfileObject::CacheInline | - LDSubfileObject::RendererInline); + LDSubfile::DeepInline | + LDSubfile::CacheInline | + LDSubfile::RendererInline); bool oldinvert = g_glInvert; if (ref->transform().determinant() < 0) g_glInvert = !g_glInvert; LDObject* prev = ref->prev(); - if (prev && prev->getType() == LDObject::BFC && static_cast<LDBFCObject*> (prev)->type == LDBFCObject::InvertNext) + if (prev && prev->getType() == LDObject::BFC && static_cast<LDBFC*> (prev)->type == LDBFC::InvertNext) g_glInvert = !g_glInvert; for (LDObject* obj : objs) { @@ -1223,7 +1223,7 @@ LDObject* obj = null; if (m_rectdraw) { - LDQuadObject* quad = new LDQuadObject; + LDQuad* quad = new LDQuad; // Copy the vertices from m_rectverts updateRectVerts(); @@ -1237,22 +1237,22 @@ switch (verts.size()) { case 1: // 1 vertex - add a vertex object - obj = new LDVertexObject; - static_cast<LDVertexObject*> (obj)->pos = verts[0]; + obj = new LDVertex; + static_cast<LDVertex*> (obj)->pos = verts[0]; obj->setColor (maincolor); break; case 2: // 2 verts - make a line - obj = new LDLineObject (verts[0], verts[1]); + obj = new LDLine (verts[0], verts[1]); obj->setColor (edgecolor); break; case 3: case 4: obj = (verts.size() == 3) ? - static_cast<LDObject*> (new LDTriangleObject) : - static_cast<LDObject*> (new LDQuadObject); + static_cast<LDObject*> (new LDTriangle) : + static_cast<LDObject*> (new LDQuad); obj->setColor (maincolor); for (ushort i = 0; i < obj->vertices(); ++i) @@ -1282,8 +1282,8 @@ for (int i = 0; i < obj->vertices(); ++i) verts << obj->getVertex (i); } elif (obj->getType() == LDObject::Subfile) { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); - List<LDObject*> objs = ref->inlineContents (LDSubfileObject::DeepCacheInline); + LDSubfile* ref = static_cast<LDSubfile*> (obj); + List<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline); for(LDObject* obj : objs) { verts << getVertices (obj); @@ -1605,12 +1605,12 @@ // ============================================================================= // ----------------------------------------------------------------------------- -LDOverlayObject* GLRenderer::findOverlayObject (GLRenderer::Camera cam) { - LDOverlayObject* ovlobj = null; +LDOverlay* GLRenderer::findOverlayObject (GLRenderer::Camera cam) { + LDOverlay* ovlobj = null; for (LDObject * obj : *file()) { - if (obj->getType() == LDObject::Overlay && static_cast<LDOverlayObject*> (obj)->camera() == cam) { - ovlobj = static_cast<LDOverlayObject*> (obj); + if (obj->getType() == LDObject::Overlay && static_cast<LDOverlay*> (obj)->camera() == cam) { + ovlobj = static_cast<LDOverlay*> (obj); break; } } @@ -1628,7 +1628,7 @@ continue; overlayMeta& meta = m_overlays[cam]; - LDOverlayObject* ovlobj = findOverlayObject (cam); + LDOverlay* ovlobj = findOverlayObject (cam); if (!ovlobj && meta.img) { delete meta.img; @@ -1646,7 +1646,7 @@ continue; overlayMeta& meta = m_overlays[cam]; - LDOverlayObject* ovlobj = findOverlayObject (cam); + LDOverlay* ovlobj = findOverlayObject (cam); if (!meta.img && ovlobj) { // If this is the last overlay image, we need to remove the empty space after it as well. @@ -1664,7 +1664,7 @@ } elif (meta.img && !ovlobj) { // Inverse case: image is there but the overlay object is // not, thus create the object. - ovlobj = new LDOverlayObject; + ovlobj = new LDOverlay; // Find a suitable position to place this object. We want to place // this into the header, which is everything up to the first scemantic @@ -1693,7 +1693,7 @@ file()->insertObj (i, ovlobj); if (found) - file()->insertObj (i + 1, new LDEmptyObject); + file()->insertObj (i + 1, new LDEmpty); } }
--- a/src/gldraw.h Sun Aug 18 17:38:33 2013 +0300 +++ b/src/gldraw.h Sun Aug 18 17:53:23 2013 +0300 @@ -150,7 +150,7 @@ void compileVertex (const vertex& vrt); // Compile a single vertex to a list vertex coordconv2_3 (const QPoint& pos2d, bool snap) const; // Convert a 2D point to a 3D point QPoint coordconv3_2 (const vertex& pos3d) const; // Convert a 3D point to a 2D point - LDOverlayObject* findOverlayObject (Camera cam); + LDOverlay* findOverlayObject (Camera cam); void updateRectVerts(); void pick (uint mouseX, uint mouseY); // Perform object selection void setObjectColor (LDObject* obj, const ListType list); // Set the color to an object list
--- a/src/gui.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/gui.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -238,7 +238,7 @@ LDFile::current()->obj (0)->getType() == LDObject::Comment) { // Append title - LDCommentObject* comm = static_cast<LDCommentObject*> (LDFile::current()->obj (0)); + LDComment* comm = static_cast<LDComment*> (LDFile::current()->obj (0)); title += fmt (": %1", comm->text); } @@ -290,7 +290,7 @@ switch (obj->getType()) { case LDObject::Comment: - descr = static_cast<LDCommentObject*> (obj)->text; + descr = static_cast<LDComment*> (obj)->text; // Remove leading whitespace while (descr[0] == ' ') @@ -303,7 +303,7 @@ case LDObject::Line: case LDObject::Triangle: case LDObject::Quad: - case LDObject::CondLine: + case LDObject::CndLine: for (short i = 0; i < obj->vertices(); ++i) { if (i != 0) descr += ", "; @@ -317,12 +317,12 @@ break; case LDObject::Vertex: - descr = static_cast<LDVertexObject*> (obj)->pos.stringRep (true); + descr = static_cast<LDVertex*> (obj)->pos.stringRep (true); break; case LDObject::Subfile: { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); descr = fmt ("%1 %2, (", ref->fileInfo()->name(), ref->position().stringRep (true)); @@ -336,12 +336,12 @@ break; case LDObject::BFC: - descr = LDBFCObject::statements[static_cast<LDBFCObject*> (obj)->type]; + descr = LDBFC::statements[static_cast<LDBFC*> (obj)->type]; break; case LDObject::Overlay: { - LDOverlayObject* ovl = static_cast<LDOverlayObject*> (obj); + LDOverlay* ovl = static_cast<LDOverlay*> (obj); descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()], basename (ovl->filename()), ovl->x(), ovl->y(), ovl->width(), ovl->height()); }
--- a/src/gui_actions.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/gui_actions.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -52,26 +52,26 @@ newFile(); - const LDBFCObject::Type BFCType = - ui.rb_bfc_ccw->isChecked() ? LDBFCObject::CertifyCCW : - ui.rb_bfc_cw->isChecked() ? LDBFCObject::CertifyCW : LDBFCObject::NoCertify; + const LDBFC::Type BFCType = + ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW : + ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : LDBFC::NoCertify; const str license = ui.rb_license_ca->isChecked() ? CALicense : ui.rb_license_nonca->isChecked() ? NonCALicense : ""; LDFile* f = LDFile::current(); - *f << new LDCommentObject (ui.le_title->text()); - *f << new LDCommentObject ("Name: <untitled>.dat" ); - *f << new LDCommentObject (fmt ("Author: %1", ui.le_author->text())); - *f << new LDCommentObject (fmt ("!LDRAW_ORG Unofficial_Part")); + *f << new LDComment (ui.le_title->text()); + *f << new LDComment ("Name: <untitled>.dat" ); + *f << new LDComment (fmt ("Author: %1", ui.le_author->text())); + *f << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")); if (license != "") - *f << new LDCommentObject (license); + *f << new LDComment (license); - *f << new LDEmptyObject; - *f << new LDBFCObject (BFCType); - *f << new LDEmptyObject; + *f << new LDEmpty; + *f << new LDBFC (BFCType); + *f << new LDEmpty; g_win->fullRefresh(); } @@ -180,7 +180,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- DEFINE_ACTION (NewCLine, 0) { - AddObjectDialog::staticDialog (LDObject::CondLine, null); + AddObjectDialog::staticDialog (LDObject::CndLine, null); } // ============================================================================= @@ -278,10 +278,10 @@ str refName; if (type == LDObject::Subfile) { - refName = static_cast<LDSubfileObject*> (g_win->sel()[0])->fileInfo()->name(); + refName = static_cast<LDSubfile*> (g_win->sel()[0])->fileInfo()->name(); for (LDObject* obj : g_win->sel()) - if (static_cast<LDSubfileObject*> (obj)->fileInfo()->name() != refName) + if (static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName) return; } @@ -290,7 +290,7 @@ if (obj->getType() != type) continue; - if (type == LDObject::Subfile && static_cast<LDSubfileObject*> (obj)->fileInfo()->name() != refName) + if (type == LDObject::Subfile && static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName) continue; g_win->sel() << obj;
--- a/src/gui_editactions.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/gui_editactions.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -120,10 +120,10 @@ List<LDObject*> objs; if (obj->getType() == LDObject::Subfile) - objs = static_cast<LDSubfileObject*> (obj)->inlineContents ( - (LDSubfileObject::InlineFlags) - ((deep) ? LDSubfileObject::DeepInline : 0) | - LDSubfileObject::CacheInline + objs = static_cast<LDSubfile*> (obj)->inlineContents ( + (LDSubfile::InlineFlags) + ((deep) ? LDSubfile::DeepInline : 0) | + LDSubfile::CacheInline ); else continue; @@ -171,14 +171,14 @@ if (index == -1) return; - List<LDTriangleObject*> triangles = static_cast<LDQuadObject*> (obj)->splitToTriangles(); + List<LDTriangle*> triangles = static_cast<LDQuad*> (obj)->splitToTriangles(); // Replace the quad with the first triangle and add the second triangle // after the first one. LDFile::current()->setObject (index, triangles[0]); LDFile::current()->insertObj (index + 1, triangles[1]); - for (LDTriangleObject * t : triangles) + for (LDTriangle * t : triangles) g_win->R()->compileObject (t); // Delete this quad now, it has been split. @@ -205,7 +205,7 @@ ui.code->setText (obj->raw()); if (obj->getType() == LDObject::Error) - ui.errorDescription->setText (static_cast<LDErrorObject*> (obj)->reason); + ui.errorDescription->setText (static_cast<LDError*> (obj)->reason); else { ui.errorDescription->hide(); ui.errorIcon->hide(); @@ -265,23 +265,23 @@ continue; short numLines; - LDLineObject* lines[4]; + LDLine* lines[4]; if (obj->getType() == LDObject::Quad) { numLines = 4; - LDQuadObject* quad = static_cast<LDQuadObject*> (obj); - lines[0] = new LDLineObject (quad->getVertex (0), quad->getVertex (1)); - lines[1] = new LDLineObject (quad->getVertex (1), quad->getVertex (2)); - lines[2] = new LDLineObject (quad->getVertex (2), quad->getVertex (3)); - lines[3] = new LDLineObject (quad->getVertex (3), quad->getVertex (0)); + LDQuad* quad = static_cast<LDQuad*> (obj); + lines[0] = new LDLine (quad->getVertex (0), quad->getVertex (1)); + lines[1] = new LDLine (quad->getVertex (1), quad->getVertex (2)); + lines[2] = new LDLine (quad->getVertex (2), quad->getVertex (3)); + lines[3] = new LDLine (quad->getVertex (3), quad->getVertex (0)); } else { numLines = 3; - LDTriangleObject* tri = static_cast<LDTriangleObject*> (obj); - lines[0] = new LDLineObject (tri->getVertex (0), tri->getVertex (1)); - lines[1] = new LDLineObject (tri->getVertex (1), tri->getVertex (2)); - lines[2] = new LDLineObject (tri->getVertex (2), tri->getVertex (0)); + LDTriangle* tri = static_cast<LDTriangle*> (obj); + lines[0] = new LDLine (tri->getVertex (0), tri->getVertex (1)); + lines[1] = new LDLine (tri->getVertex (1), tri->getVertex (2)); + lines[2] = new LDLine (tri->getVertex (2), tri->getVertex (0)); } for (short i = 0; i < numLines; ++i) { @@ -311,7 +311,7 @@ ulong idx = obj->getIndex(); for (short i = 0; i < obj->vertices(); ++i) { - LDVertexObject* vert = new LDVertexObject; + LDVertex* vert = new LDVertex; vert->pos = obj->getVertex (i); vert->setColor (obj->color()); @@ -460,7 +460,7 @@ // Transform the matrix mo->setTransform (mo->transform() * transform); } elif (obj->getType() == LDObject::Vertex) { - LDVertexObject* vert = static_cast<LDVertexObject*> (obj); + LDVertex* vert = static_cast<LDVertex*> (obj); vertex v = vert->pos; rotateVertex (v, rotpoint, transform); vert->pos = v; @@ -522,7 +522,7 @@ int col = maincolor; - if (obj->getType() == LDObject::Line || obj->getType() == LDObject::CondLine) + if (obj->getType() == LDObject::Line || obj->getType() == LDObject::CndLine) col = edgecolor; obj->setColor (col); @@ -616,10 +616,10 @@ int num = 0; for (LDObject* obj : sel) { - if (obj->getType() != LDObject::CondLine) + if (obj->getType() != LDObject::CndLine) continue; - LDLineObject* repl = static_cast<LDCondLineObject*> (obj)->demote(); + LDLine* repl = static_cast<LDCndLine*> (obj)->demote(); g_win->R()->compileObject (repl); ++num; } @@ -686,7 +686,7 @@ ui->m_username->text(), ui->m_comment->text()); - LDCommentObject* comm = new LDCommentObject (commentText); + LDComment* comm = new LDComment (commentText); // Find a spot to place the new comment for ( @@ -694,7 +694,7 @@ obj && obj->next() && !obj->next()->isScemantic(); obj = obj->next() ) { - LDCommentObject* comm = dynamic_cast<LDCommentObject*> (obj); + LDComment* comm = dynamic_cast<LDComment*> (obj); if (comm && comm->text.startsWith ("!HISTORY ")) ishistory = true; @@ -713,7 +713,7 @@ // If we're adding a history line right before a scemantic object, pad it // an empty line if (obj && obj->next() && obj->next()->isScemantic()) - LDFile::current()->insertObj (idx, new LDEmptyObject); + LDFile::current()->insertObj (idx, new LDEmpty); g_win->buildObjList(); delete ui;
--- a/src/ldtypes.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/ldtypes.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -87,17 +87,17 @@ setVertex (i, v); } -LDErrorObject::LDErrorObject() {} +LDError::LDError() {} // ============================================================================= // ----------------------------------------------------------------------------- -str LDCommentObject::raw() { +str LDComment::raw() { return fmt ("0 %1", text); } // ============================================================================= // ----------------------------------------------------------------------------- -str LDSubfileObject::raw() { +str LDSubfile::raw() { str val = fmt ("1 %1 %2 ", color(), position()); val += transform().stringRep(); val += ' '; @@ -107,7 +107,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDLineObject::raw() { +str LDLine::raw() { str val = fmt ("2 %1", color()); for (ushort i = 0; i < 2; ++i) @@ -118,7 +118,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDTriangleObject::raw() { +str LDTriangle::raw() { str val = fmt ("3 %1", color()); for (ushort i = 0; i < 3; ++i) @@ -129,7 +129,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDQuadObject::raw() { +str LDQuad::raw() { str val = fmt ("4 %1", color()); for (ushort i = 0; i < 4; ++i) @@ -140,7 +140,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDCondLineObject::raw() { +str LDCndLine::raw() { str val = fmt ("5 %1", color()); // Add the coordinates @@ -152,25 +152,25 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDErrorObject::raw() { +str LDError::raw() { return contents; } // ============================================================================= // ----------------------------------------------------------------------------- -str LDVertexObject::raw() { +str LDVertex::raw() { return fmt ("0 !LDFORGE VERTEX %1 %2", color(), pos); } // ============================================================================= // ----------------------------------------------------------------------------- -str LDEmptyObject::raw() { +str LDEmpty::raw() { return ""; } // ============================================================================= // ----------------------------------------------------------------------------- -const char* LDBFCObject::statements[] = { +const char* LDBFC::statements[] = { "CERTIFY CCW", "CCW", "CERTIFY CW", @@ -183,27 +183,27 @@ "NOCLIP", }; -str LDBFCObject::raw() { - return fmt ("0 BFC %1", LDBFCObject::statements[type]); +str LDBFC::raw() { + return fmt ("0 BFC %1", LDBFC::statements[type]); } // ============================================================================= // ----------------------------------------------------------------------------- -List<LDTriangleObject*> LDQuadObject::splitToTriangles() { +List<LDTriangle*> LDQuad::splitToTriangles() { // Create the two triangles based on this quadrilateral: // 0---3 0---3 3 // | | | / /| // | | ==> | / / | // | | |/ / | // 1---2 1 1---2 - LDTriangleObject* tri1 = new LDTriangleObject (getVertex (0), getVertex (1), getVertex (3)); - LDTriangleObject* tri2 = new LDTriangleObject (getVertex (1), getVertex (2), getVertex (3)); + LDTriangle* tri1 = new LDTriangle (getVertex (0), getVertex (1), getVertex (3)); + LDTriangle* tri2 = new LDTriangle (getVertex (1), getVertex (2), getVertex (3)); // The triangles also inherit the quad's color tri1->setColor (color()); tri2->setColor (color()); - List<LDTriangleObject*> triangles; + List<LDTriangle*> triangles; triangles << tri1; triangles << tri2; return triangles; @@ -237,7 +237,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -LDLineObject::LDLineObject (vertex v1, vertex v2) { +LDLine::LDLine (vertex v1, vertex v2) { setVertex (0, v1); setVertex (1, v2); } @@ -265,7 +265,7 @@ static void transformObject (LDObject* obj, matrix transform, vertex pos, short parentcolor) { switch (obj->getType()) { case LDObject::Line: - case LDObject::CondLine: + case LDObject::CndLine: case LDObject::Triangle: case LDObject::Quad: for (short i = 0; i < obj->vertices(); ++i) { @@ -278,7 +278,7 @@ case LDObject::Subfile: { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); matrix newMatrix = transform * ref->transform(); vertex newpos = ref->position(); @@ -298,7 +298,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -List<LDObject*> LDSubfileObject::inlineContents (InlineFlags flags) { +List<LDObject*> LDSubfile::inlineContents (InlineFlags flags) { List<LDObject*> objs = fileInfo()->inlineContents (flags); // Transform the objects @@ -452,47 +452,47 @@ // ============================================================================= // ----------------------------------------------------------------------------- void LDObject::move (vertex vect) { (void) vect; } -void LDEmptyObject::move (vertex vect) { (void) vect; } -void LDBFCObject::move (vertex vect) { (void) vect; } -void LDCommentObject::move (vertex vect) { (void) vect; } -void LDErrorObject::move (vertex vect) { (void) vect; } +void LDEmpty::move (vertex vect) { (void) vect; } +void LDBFC::move (vertex vect) { (void) vect; } +void LDComment::move (vertex vect) { (void) vect; } +void LDError::move (vertex vect) { (void) vect; } // ============================================================================= // ----------------------------------------------------------------------------- -void LDVertexObject::move (vertex vect) { +void LDVertex::move (vertex vect) { pos += vect; } // ============================================================================= // ----------------------------------------------------------------------------- -void LDSubfileObject::move (vertex vect) { +void LDSubfile::move (vertex vect) { setPosition (position() + vect); } // ============================================================================= // ----------------------------------------------------------------------------- -void LDLineObject::move (vertex vect) { +void LDLine::move (vertex vect) { for (short i = 0; i < 2; ++i) setVertex (i, getVertex (i) + vect); } // ============================================================================= // ----------------------------------------------------------------------------- -void LDTriangleObject::move (vertex vect) { +void LDTriangle::move (vertex vect) { for (short i = 0; i < 3; ++i) setVertex (i, getVertex (i) + vect); } // ============================================================================= // ----------------------------------------------------------------------------- -void LDQuadObject::move (vertex vect) { +void LDQuad::move (vertex vect) { for (short i = 0; i < 4; ++i) setVertex (i, getVertex (i) + vect); } // ============================================================================= // ----------------------------------------------------------------------------- -void LDCondLineObject::move (vertex vect) { +void LDCndLine::move (vertex vect) { for (short i = 0; i < 4; ++i) setVertex (i, getVertex (i) + vect); } @@ -501,13 +501,13 @@ // ----------------------------------------------------------------------------- #define CHECK_FOR_OBJ(N) \ if (type == LDObject::N) \ - return new LD##N##Object; + return new LD##N; LDObject* LDObject::getDefault (const LDObject::Type type) { CHECK_FOR_OBJ (Comment) CHECK_FOR_OBJ (BFC) CHECK_FOR_OBJ (Line) - CHECK_FOR_OBJ (CondLine) + CHECK_FOR_OBJ (CndLine) CHECK_FOR_OBJ (Subfile) CHECK_FOR_OBJ (Triangle) CHECK_FOR_OBJ (Quad) @@ -522,14 +522,14 @@ // ============================================================================= // ----------------------------------------------------------------------------- void LDObject::invert() {} -void LDBFCObject::invert() {} -void LDEmptyObject::invert() {} -void LDCommentObject::invert() {} -void LDErrorObject::invert() {} +void LDBFC::invert() {} +void LDEmpty::invert() {} +void LDComment::invert() {} +void LDError::invert() {} // ============================================================================= // ----------------------------------------------------------------------------- -void LDTriangleObject::invert() { +void LDTriangle::invert() { // Triangle goes 0 -> 1 -> 2, reversed: 0 -> 2 -> 1. // Thus, we swap 1 and 2. vertex tmp = getVertex (1); @@ -541,7 +541,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -void LDQuadObject::invert() { +void LDQuad::invert() { // Quad: 0 -> 1 -> 2 -> 3 // rev: 0 -> 3 -> 2 -> 1 // Thus, we swap 1 and 3. @@ -552,7 +552,7 @@ // ============================================================================= // ----------------------------------------------------------------------------- -void LDSubfileObject::invert() { +void LDSubfile::invert() { // Subfiles are inverted when they're prefixed with // a BFC INVERTNEXT statement. Thus we need to toggle this status. // For flat primitives it's sufficient that the determinant is @@ -562,9 +562,9 @@ ulong idx = getIndex(); if (idx > 0) { - LDBFCObject* bfc = dynamic_cast<LDBFCObject*> (prev()); + LDBFC* bfc = dynamic_cast<LDBFC*> (prev()); - if (bfc && bfc->type == LDBFCObject::InvertNext) { + if (bfc && bfc->type == LDBFC::InvertNext) { // This is prefixed with an invertnext, thus remove it. file()->forgetObject (bfc); delete bfc; @@ -573,7 +573,7 @@ } // Not inverted, thus prefix it with a new invertnext. - LDBFCObject* bfc = new LDBFCObject (LDBFCObject::InvertNext); + LDBFC* bfc = new LDBFC (LDBFC::InvertNext); file()->insertObj (idx, bfc); } @@ -587,20 +587,20 @@ line->setVertex (1, tmp); } -void LDLineObject::invert() { +void LDLine::invert() { invertLine (this); } -void LDCondLineObject::invert() { +void LDCndLine::invert() { invertLine (this); } -void LDVertexObject::invert() {} +void LDVertex::invert() {} // ============================================================================= // ----------------------------------------------------------------------------- -LDLineObject* LDCondLineObject::demote() { - LDLineObject* repl = new LDLineObject; +LDLine* LDCndLine::demote() { + LDLine* repl = new LDLine; for (int i = 0; i < repl->vertices(); ++i) repl->setVertex (i, getVertex (i)); @@ -623,16 +623,16 @@ // ============================================================================= // ----------------------------------------------------------------------------- -str LDOverlayObject::raw() { +str LDOverlay::raw() { return fmt ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6", filename(), camera(), x(), y(), width(), height()); } -void LDOverlayObject::move (vertex vect) { +void LDOverlay::move (vertex vect) { Q_UNUSED (vect) } -void LDOverlayObject::invert() {} +void LDOverlay::invert() {} // ============================================================================= // Hook the set accessors of certain properties to this changeProperty function.
--- a/src/ldtypes.h Sun Aug 18 17:38:33 2013 +0300 +++ b/src/ldtypes.h Sun Aug 18 17:53:23 2013 +0300 @@ -24,15 +24,15 @@ #define LDOBJ(T) \ public: \ - virtual ~LD##T##Object() {} \ + virtual ~LD##T() {} \ virtual LDObject::Type getType() const override { \ return LDObject::T; \ } \ virtual str raw(); \ - virtual LD##T##Object* clone() { \ - return new LD##T##Object (*this); \ + virtual LD##T* clone() { \ + return new LD##T (*this); \ } \ - virtual void move (vertex vVector); \ + virtual void move (vertex where); \ virtual void invert(); #define LDOBJ_NAME(N) virtual str typeName() const override { return #N; } @@ -50,7 +50,7 @@ #define LDOBJ_NO_MATRIX LDOBJ_SETMATRIX (false) class QListWidgetItem; -class LDSubfileObject; +class LDSubfile; class LDFile; // ============================================================================= @@ -76,7 +76,7 @@ Quad, // Object represents a quadrilateral Triangle, // Object represents a triangle Line, // Object represents a line - CondLine, // Object represents a conditional line + CndLine, // Object represents a conditional line Vertex, // Object is a vertex, LDForge extension object BFC, // Object represents a BFC statement Overlay, // Object contains meta-info about an overlay image. @@ -166,14 +166,14 @@ }; // ============================================================================= -// LDErrorObject +// LDError // // Represents a line in the LDraw file that could not be properly parsed. It is // represented by a (!) ERROR in the code view. It exists for the purpose of // allowing garbage lines be debugged and corrected within LDForge. The member // zContent contains the contents of the unparsable line. // ============================================================================= -class LDErrorObject : public LDObject { +class LDError : public LDObject { LDOBJ (Error) LDOBJ_NAME (error) LDOBJ_VERTICES (0) @@ -183,8 +183,8 @@ PROPERTY (str, fileRef, setFileRef) public: - LDErrorObject(); - LDErrorObject (str contents, str reason) : contents (contents), reason (reason) {} + LDError(); + LDError (str contents, str reason) : contents (contents), reason (reason) {} // Content of this unknown line str contents; @@ -194,11 +194,11 @@ }; // ============================================================================= -// LDEmptyObject +// LDEmpty // // Represents an empty line in the LDraw code file. // ============================================================================= -class LDEmptyObject : public LDObject { +class LDEmpty : public LDObject { LDOBJ (Empty) LDOBJ_VERTICES (0) LDOBJ_UNCOLORED @@ -207,12 +207,12 @@ }; // ============================================================================= -// LDCommentObject +// LDComment // // Represents a code-0 comment in the LDraw code file. Member text contains // the text of the comment. // ============================================================================= -class LDCommentObject : public LDObject { +class LDComment : public LDObject { LDOBJ (Comment) LDOBJ_NAME (comment) LDOBJ_VERTICES (0) @@ -221,19 +221,19 @@ LDOBJ_NO_MATRIX public: - LDCommentObject() {} - LDCommentObject (str text) : text (text) {} + LDComment() {} + LDComment (str text) : text (text) {} str text; // The text of this comment }; // ============================================================================= -// LDBFCObject +// LDBFC // // Represents a 0 BFC statement in the LDraw code. eStatement contains the type // of this statement. // ============================================================================= -class LDBFCObject : public LDObject { +class LDBFC : public LDObject { public: enum Type { CertifyCCW, @@ -257,8 +257,8 @@ LDOBJ_NO_MATRIX public: - LDBFCObject() {} - LDBFCObject (const LDBFCObject::Type type) : type (type) {} + LDBFC() {} + LDBFC (const LDBFC::Type type) : type (type) {} // Statement strings static const char* statements[]; @@ -267,11 +267,11 @@ }; // ============================================================================= -// LDSubfileObject +// LDSubfile // // Represents a single code-1 subfile reference. // ============================================================================= -class LDSubfileObject : public LDObject, public LDMatrixObject { +class LDSubfile : public LDObject, public LDMatrixObject { LDOBJ (Subfile) LDOBJ_NAME (subfile) LDOBJ_VERTICES (0) @@ -291,7 +291,7 @@ Q_DECLARE_FLAGS (InlineFlags, InlineFlag) - LDSubfileObject() { + LDSubfile() { setLinkPointer (this); } @@ -300,16 +300,16 @@ List<LDObject*> inlineContents (InlineFlags flags); }; -Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfileObject::InlineFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS (LDSubfile::InlineFlags) // ============================================================================= -// LDLineObject +// LDLine // // Represents a single code-2 line in the LDraw code file. v0 and v1 are the end // points of the line. The line is colored with dColor unless uncolored mode is // set. // ============================================================================= -class LDLineObject : public LDObject { +class LDLine : public LDObject { LDOBJ (Line) LDOBJ_NAME (line) LDOBJ_VERTICES (2) @@ -318,18 +318,18 @@ LDOBJ_NO_MATRIX public: - LDLineObject() {} - LDLineObject (vertex v1, vertex v2); + LDLine() {} + LDLine (vertex v1, vertex v2); }; // ============================================================================= -// LDCondLineObject +// LDCndLine // // Represents a single code-5 conditional line. The end-points v0 and v1 are // inherited from LDLine, c0 and c1 are the control points of this line. // ============================================================================= -class LDCondLineObject : public LDLineObject { - LDOBJ (CondLine) +class LDCndLine : public LDLine { + LDOBJ (CndLine) LDOBJ_NAME (condline) LDOBJ_VERTICES (4) LDOBJ_COLORED @@ -337,18 +337,18 @@ LDOBJ_NO_MATRIX public: - LDCondLineObject() {} - LDLineObject* demote(); + LDCndLine() {} + LDLine* demote(); }; // ============================================================================= -// LDTriangleObject +// LDTriangle // // Represents a single code-3 triangle in the LDraw code file. Vertices v0, v1 // and v2 contain the end-points of this triangle. dColor is the color the // triangle is colored with. // ============================================================================= -class LDTriangleObject : public LDObject { +class LDTriangle : public LDObject { LDOBJ (Triangle) LDOBJ_NAME (triangle) LDOBJ_VERTICES (3) @@ -357,8 +357,8 @@ LDOBJ_NO_MATRIX public: - LDTriangleObject() {} - LDTriangleObject (vertex v0, vertex v1, vertex v2) { + LDTriangle() {} + LDTriangle (vertex v0, vertex v1, vertex v2) { setVertex (0, v0); setVertex (1, v1); setVertex (2, v2); @@ -366,12 +366,12 @@ }; // ============================================================================= -// LDQuadObject +// LDQuad // // Represents a single code-4 quadrilateral. v0, v1, v2 and v3 are the end points // of the quad, dColor is the color used for the quad. // ============================================================================= -class LDQuadObject : public LDObject { +class LDQuad : public LDObject { public: LDOBJ (Quad) LDOBJ_NAME (quad) @@ -380,21 +380,21 @@ LDOBJ_SCEMANTIC LDOBJ_NO_MATRIX - LDQuadObject() {} + LDQuad() {} // Split this quad into two triangles (note: heap-allocated) - List<LDTriangleObject*> splitToTriangles(); + List<LDTriangle*> splitToTriangles(); }; // ============================================================================= -// LDVertexObject +// LDVertex // // The vertex is an LDForce-specific extension which represents a single // vertex which can be used as a parameter to tools or to store coordinates // with. Vertices are a part authoring tool and they should not appear in // finished parts. // ============================================================================= -class LDVertexObject : public LDObject { +class LDVertex : public LDObject { public: LDOBJ (Vertex) LDOBJ_NAME (vertex) @@ -403,18 +403,18 @@ LDOBJ_NON_SCEMANTIC LDOBJ_NO_MATRIX - LDVertexObject() {} + LDVertex() {} vertex pos; }; // ============================================================================= -// LDOverlayObject +// LDOverlay // // Overlay image meta, stored in the header of parts so as to preserve overlay // information. // ============================================================================= -class LDOverlayObject : public LDObject { +class LDOverlay : public LDObject { LDOBJ (Overlay) LDOBJ_NAME (overlay) LDOBJ_VERTICES (0)
--- a/src/primitives.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/primitives.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -311,7 +311,7 @@ vertex v0 (x0, 0.0f, z0), v1 (x1, 0.0f, z1); - LDLineObject* line = new LDLineObject; + LDLine* line = new LDLine; line->setVertex (0, v0); line->setVertex (1, v1); line->setColor (edgecolor); @@ -358,7 +358,7 @@ v2 (x2, y2, z2), v3 (x3, y3, z3); - LDQuadObject* quad = new LDQuadObject; + LDQuad* quad = new LDQuad; quad->setColor (maincolor); quad->setVertex (0, v0); quad->setVertex (1, v1); @@ -393,7 +393,7 @@ // Disc negatives need to go the other way around, otherwise // they'll end up upside-down. - LDTriangleObject* seg = new LDTriangleObject; + LDTriangle* seg = new LDTriangle; seg->setColor (maincolor); seg->setVertex (type == Disc ? 0 : 2, v0); seg->setVertex (1, v1); @@ -427,7 +427,7 @@ v0[Z] *= num; } - LDCondLineObject* line = new LDCondLineObject; + LDCndLine* line = new LDCndLine; line->setColor (edgecolor); line->setVertex (0, v0); line->setVertex (1, v1); @@ -524,14 +524,14 @@ LDFile* f = new LDFile; f->setName (QFileDialog::getSaveFileName (null, QObject::tr ("Save Primitive"), name)); - *f << new LDCommentObject (descr); - *f << new LDCommentObject (fmt ("Name: %1", name)); - *f << new LDCommentObject (fmt ("Author: LDForge")); - *f << new LDCommentObject (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : "")); - *f << new LDCommentObject (CALicense); - *f << new LDEmptyObject; - *f << new LDBFCObject (LDBFCObject::CertifyCCW); - *f << new LDEmptyObject; + *f << new LDComment (descr); + *f << new LDComment (fmt ("Name: %1", name)); + *f << new LDComment (fmt ("Author: LDForge")); + *f << new LDComment (fmt ("!LDRAW_ORG Unofficial_%1Primitive", divs == hires ? "48_" : "")); + *f << new LDComment (CALicense); + *f << new LDEmpty; + *f << new LDBFC (LDBFC::CertifyCCW); + *f << new LDEmpty; *f << makePrimitive (type, segs, divs, num); g_win->save (f, false);
--- a/src/types.cpp Sun Aug 18 17:38:33 2013 +0300 +++ b/src/types.cpp Sun Aug 18 17:53:23 2013 +0300 @@ -515,15 +515,15 @@ case LDObject::Line: case LDObject::Triangle: case LDObject::Quad: - case LDObject::CondLine: + case LDObject::CndLine: for (short i = 0; i < obj->vertices(); ++i) calcVertex (obj->getVertex (i)); break; case LDObject::Subfile: { - LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); - List<LDObject*> objs = ref->inlineContents (LDSubfileObject::DeepCacheInline); + LDSubfile* ref = static_cast<LDSubfile*> (obj); + List<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline); for (LDObject* obj : objs) { calcObject (obj);