# HG changeset patch # User Teemu Piippo # Date 1424540143 -7200 # Node ID 0fef7bb7b7a29b2aaf1fab8a2ce2813f29b77784 # Parent 409b82a4765e3fff6c18642a95cd225011a17599 - removed the vertex object diff -r 409b82a4765e -r 0fef7bb7b7a2 icons/add-vertex.png Binary file icons/add-vertex.png has changed diff -r 409b82a4765e -r 0fef7bb7b7a2 icons/corner-verts.png Binary file icons/corner-verts.png has changed diff -r 409b82a4765e -r 0fef7bb7b7a2 icons/vertex.png Binary file icons/vertex.png has changed diff -r 409b82a4765e -r 0fef7bb7b7a2 ldforge.qrc --- a/ldforge.qrc Sat Feb 21 18:51:33 2015 +0200 +++ b/ldforge.qrc Sat Feb 21 19:35:43 2015 +0200 @@ -9,15 +9,14 @@ ./icons/add-radial.png ./icons/add-subfile.png ./icons/add-triangle.png - ./icons/add-vertex.png ./icons/arrow-down.png ./icons/arrow-left.png ./icons/arrow-right.png ./icons/arrow-up.png ./icons/autocolor.png ./icons/axes.png + ./icons/bfc-view.png ./icons/bfc.png - ./icons/bfc-view.png ./icons/bomb.png ./icons/brick-new.png ./icons/brick.png @@ -30,16 +29,15 @@ ./icons/camera-top.png ./icons/checkerboard.png ./icons/colorcursor.png + ./icons/colors.txt ./icons/colorselect.png - ./icons/colors.txt ./icons/comment.png ./icons/condline.png ./icons/copy.png - ./icons/corner-verts.png ./icons/coverer.png ./icons/cut.png + ./icons/del-line.png ./icons/delete.png - ./icons/del-line.png ./icons/empty.png ./icons/error.png ./icons/exit.png @@ -47,9 +45,9 @@ ./icons/file-import.png ./icons/file-new.png ./icons/file-open.png - ./icons/file.png ./icons/file-save-as.png ./icons/file-save.png + ./icons/file.png ./icons/flip.png ./icons/folder.png ./icons/grid-coarse.png @@ -84,8 +82,8 @@ ./icons/overlay.png ./icons/palette.png ./icons/paste.png + ./icons/quad-split.png ./icons/quad.png - ./icons/quad-split.png ./icons/radial-convert.png ./icons/radial.png ./icons/random-colors.png @@ -103,7 +101,6 @@ ./icons/triangle.png ./icons/uncolorize.png ./icons/undo.png - ./icons/vertex.png ./icons/visibility-hide.png ./icons/visibility-show.png ./icons/visibility-toggle.png diff -r 409b82a4765e -r 0fef7bb7b7a2 src/actions.cc --- a/src/actions.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/actions.cc Sat Feb 21 19:35:43 2015 +0200 @@ -226,13 +226,6 @@ // ============================================================================= // -void MainWindow::slot_actionNewVertex() -{ - AddObjectDialog::staticDialog (OBJ_Vertex, LDObjectPtr()); -} - -// ============================================================================= -// void MainWindow::slot_actionEdit() { if (Selection().size() != 1) diff -r 409b82a4765e -r 0fef7bb7b7a2 src/actionsEdit.cc --- a/src/actionsEdit.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/actionsEdit.cc Sat Feb 21 19:35:43 2015 +0200 @@ -293,33 +293,6 @@ // ============================================================================= // -void MainWindow::slot_actionCornerVerts() -{ - int num = 0; - - for (LDObjectPtr obj : Selection()) - { - if (obj->numVertices() < 2) - continue; - - int ln = obj->lineNumber(); - - for (int i = 0; i < obj->numVertices(); ++i) - { - QSharedPointer vert (LDSpawn()); - vert->pos = obj->vertex (i); - vert->setColor (obj->color()); - CurrentDocument()->insertObj (++ln, vert); - ++num; - } - } - - print (tr ("Added %1 vertices"), num); - refresh(); -} - -// ============================================================================= -// static void MoveSelection (const bool up) { LDObjectList objs = Selection(); diff -r 409b82a4765e -r 0fef7bb7b7a2 src/addObjectDialog.cc --- a/src/addObjectDialog.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/addObjectDialog.cc Sat Feb 21 19:35:43 2015 +0200 @@ -73,11 +73,6 @@ coordCount = 12; } break; - case OBJ_Vertex: - { - coordCount = 3; - } break; - case OBJ_BFC: { rb_bfcType = new RadioGroup ("Statement", {}, 0, Qt::Vertical); @@ -359,13 +354,6 @@ bfc->setStatement (BFCStatement (dlg.rb_bfcType->value())); } break; - case OBJ_Vertex: - { - LDVertexPtr vert = InitObject (obj); - vert->pos.apply ([&](Axis ax, double& value) { value = dlg.dsb_coords[ax]->value(); }); - } - break; - case OBJ_Subfile: { QString name = dlg.le_subfileName->text(); diff -r 409b82a4765e -r 0fef7bb7b7a2 src/editmodes/drawMode.cc --- a/src/editmodes/drawMode.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/editmodes/drawMode.cc Sat Feb 21 19:35:43 2015 +0200 @@ -91,14 +91,7 @@ switch (verts.size()) { case 1: - { - // 1 vertex - add a vertex object - LDVertexPtr obj = LDSpawn(); - obj->pos = verts[0]; - obj->setColor (MainColor()); - objs << obj; - break; - } + return; case 2: { diff -r 409b82a4765e -r 0fef7bb7b7a2 src/ldDocument.cc --- a/src/ldDocument.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/ldDocument.cc Sat Feb 21 19:35:43 2015 +0200 @@ -958,19 +958,7 @@ if (tokens.size() > 2 and tokens[1] == "!LDFORGE") { // Handle LDForge-specific types, they're embedded into comments too - if (tokens[2] == "VERTEX") - { - // Vertex (0 !LDFORGE VERTEX) - CheckTokenCount (tokens, 7); - CheckTokenNumbers (tokens, 3, 6); - - LDVertexPtr obj = LDSpawn(); - obj->setColor (LDColor::fromIndex (StringToNumber (tokens[3]))); - obj->pos.apply ([&](Axis ax, double& value) - { value = tokens[4 + ax].toDouble(); }); - return obj; - } - elif (tokens[2] == "OVERLAY") + if (tokens[2] == "OVERLAY") { CheckTokenCount (tokens, 9); CheckTokenNumbers (tokens, 5, 8); diff -r 409b82a4765e -r 0fef7bb7b7a2 src/ldObject.cc --- a/src/ldObject.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/ldObject.cc Sat Feb 21 19:35:43 2015 +0200 @@ -66,7 +66,6 @@ LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject) LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine) LDOBJ_DEFAULT_CTOR (LDQuad, LDObject) -LDOBJ_DEFAULT_CTOR (LDVertex, LDObject) LDOBJ_DEFAULT_CTOR (LDOverlay, LDObject) LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) LDOBJ_DEFAULT_CTOR (LDComment, LDObject) @@ -177,13 +176,6 @@ // ============================================================================= // -QString LDVertex::asText() const -{ - return format ("0 !LDFORGE VERTEX %1 %2", color(), pos); -} - -// ============================================================================= -// QString LDEmpty::asText() const { return ""; @@ -533,11 +525,6 @@ text += ", "; QString noun = format ("%1%2", typeName (objType), Plural (count)); - - // Plural of "vertex" is "vertices", correct that - if (objType == OBJ_Vertex and count != 1) - noun = "vertices"; - text += format ("%1 %2", count, noun); } @@ -610,11 +597,6 @@ LDMatrixObjectPtr mo = self().toStrongRef().dynamicCast(); mo->setPosition (mo->position() + vect); } - elif (type() == OBJ_Vertex) - { - // ugh - self().toStrongRef().staticCast()->pos += vect; - } else { for (int i = 0; i < numVertices(); ++i) @@ -637,7 +619,6 @@ case OBJ_Quad: return LDSpawn(); case OBJ_Empty: return LDSpawn(); case OBJ_Error: return LDSpawn(); - case OBJ_Vertex: return LDSpawn(); case OBJ_Overlay: return LDSpawn(); case OBJ_NumTypes: assert (false); } @@ -767,8 +748,6 @@ setVertex (1, tmp); } -void LDVertex::invert() {} - // ============================================================================= // LDLinePtr LDCondLine::toEdgeLine() @@ -944,8 +923,3 @@ { verts << fileInfo()->inlineVertices(); } - -void LDVertex::getVertices (QVector& verts) const -{ - verts.append (pos); -} diff -r 409b82a4765e -r 0fef7bb7b7a2 src/ldObject.h --- a/src/ldObject.h Sat Feb 21 18:51:33 2015 +0200 +++ b/src/ldObject.h Sat Feb 21 19:35:43 2015 +0200 @@ -68,7 +68,6 @@ OBJ_Triangle, // Object represents a triangle OBJ_Line, // Object represents a line OBJ_CondLine, // Object represents a conditional line - OBJ_Vertex, // Object is a vertex, LDForge extension object OBJ_BFC, // Object represents a BFC statement OBJ_Overlay, // Object contains meta-info about an overlay image. OBJ_Comment, // Object represents a comment @@ -540,32 +539,6 @@ using LDQuadWeakPtr = QWeakPointer; // -// 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 LDVertex : public LDObject -{ - LDOBJ (Vertex) - LDOBJ_NAME (vertex) - LDOBJ_VERTICES (0) // TODO: move pos to m_vertices[0] - LDOBJ_COLORED - LDOBJ_DEFAULTCOLOR (MainColor()) - LDOBJ_NON_SCEMANTIC - LDOBJ_NO_MATRIX - -public: - Vertex pos; - virtual void getVertices (QVector& verts) const override; -}; - -using LDVertexPtr = QSharedPointer; -using LDVertexWeakPtr = QWeakPointer; - -// // LDOverlay // // Overlay image meta, stored in the header of parts so as to preserve overlay diff -r 409b82a4765e -r 0fef7bb7b7a2 src/ldObjectMath.cpp --- a/src/ldObjectMath.cpp Sat Feb 21 18:51:33 2015 +0200 +++ b/src/ldObjectMath.cpp Sat Feb 21 19:35:43 2015 +0200 @@ -78,12 +78,5 @@ // Transform the matrix mo->setTransform (transform * mo->transform()); } - elif (obj->type() == OBJ_Vertex) - { - LDVertexPtr vert = obj.staticCast(); - Vertex v = vert->pos; - RotateVertex (v, rotpoint, transform); - vert->pos = v; - } } } diff -r 409b82a4765e -r 0fef7bb7b7a2 src/mainWindow.cc --- a/src/mainWindow.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/mainWindow.cc Sat Feb 21 19:35:43 2015 +0200 @@ -373,12 +373,6 @@ break; } - case OBJ_Vertex: - { - descr = obj.staticCast()->pos.toString (true); - break; - } - case OBJ_Subfile: { LDSubfilePtr ref = obj.staticCast(); diff -r 409b82a4765e -r 0fef7bb7b7a2 src/mainWindow.h --- a/src/mainWindow.h Sat Feb 21 18:51:33 2015 +0200 +++ b/src/mainWindow.h Sat Feb 21 19:35:43 2015 +0200 @@ -212,7 +212,6 @@ void slot_actionNewCLine(); void slot_actionNewComment(); void slot_actionNewBFC(); - void slot_actionNewVertex(); void slot_actionUndo(); void slot_actionRedo(); void slot_actionCut(); @@ -239,7 +238,6 @@ void slot_actionSplitQuads(); void slot_actionEditRaw(); void slot_actionBorders(); - void slot_actionCornerVerts(); void slot_actionRoundCoordinates(); void slot_actionVisibilityHide(); void slot_actionVisibilityReveal(); diff -r 409b82a4765e -r 0fef7bb7b7a2 src/version.cc --- a/src/version.cc Sat Feb 21 18:51:33 2015 +0200 +++ b/src/version.cc Sat Feb 21 19:35:43 2015 +0200 @@ -26,53 +26,55 @@ #include "version.h" #include "hginfo.h" -char g_versionString[64] = {'\0'}; -char g_fullVersionString[256] = {'\0'}; -char g_buildTime[256] = {'\0'}; - // ============================================================================= // const char* VersionString() { - if (g_versionString[0] == '\0') + static char result[64] = {'\0'}; + + if (result[0] == '\0') { #if VERSION_PATCH == 0 - sprintf (g_versionString, "%d.%d", VERSION_MAJOR, VERSION_MINOR); + sprintf (result, "%d.%d", VERSION_MAJOR, VERSION_MINOR); #else sprintf (g_versionString, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); #endif // VERSION_PATCH } - return g_versionString; + return result; } // ============================================================================= // const char* FullVersionString() { - if (g_fullVersionString[0] == '\0') + static char result[256] = {'\0'}; + + if (result[0] == '\0') { #if BUILD_ID != BUILD_RELEASE and defined (HG_NODE) - sprintf (g_fullVersionString, "%s-" HG_NODE, VersionString()); + sprintf (result, "%s-" HG_NODE, VersionString()); #else sprintf (g_fullVersionString, "%s", VersionString()); #endif } - return g_fullVersionString; + return result; } // ============================================================================= // const char* CommitTimeString() { + static char result[256] = {'\0'}; + #ifdef HG_DATE_TIME - if (g_buildTime[0] == '\0') + if (result[0] == '\0') { time_t timestamp = HG_DATE_TIME; - strftime (g_buildTime, sizeof g_buildTime, "%d %b %Y", localtime (×tamp)); + strftime (result, sizeof result, "%d %b %Y", localtime (×tamp)); } #endif - return g_buildTime; + return result; } diff -r 409b82a4765e -r 0fef7bb7b7a2 ui/ldforge.ui --- a/ui/ldforge.ui Sat Feb 21 18:51:33 2015 +0200 +++ b/ui/ldforge.ui Sat Feb 21 19:35:43 2015 +0200 @@ -6,7 +6,7 @@ 0 0 - 1010 + 1008 641 @@ -47,8 +47,8 @@ 0 0 - 237 - 414 + 234 + 428 @@ -75,8 +75,8 @@ 0 0 - 237 - 414 + 234 + 428 @@ -157,8 +157,8 @@ 0 0 - 237 - 414 + 234 + 428 @@ -193,8 +193,8 @@ 0 0 - 1010 - 26 + 1008 + 21 @@ -265,7 +265,6 @@ - @@ -314,7 +313,6 @@ - @@ -437,7 +435,6 @@ - @@ -517,7 +514,6 @@ - @@ -843,15 +839,6 @@ New BFC Statement - - - - :/icons/add-vertex.png:/icons/add-vertex.png - - - New Vertex - - @@ -1145,18 +1132,6 @@ Add borders around given polygons. - - - - :/icons/corner-verts.png:/icons/corner-verts.png - - - Make Corner Vertices - - - Adds vertex objects to the corners of the given polygons - -