]> Shamusworld >> Repos - architektonas/blobdiff - src/fileio.cpp
Fixed loading code, added "Base Unit" dialog.
[architektonas] / src / fileio.cpp
index 4a1c25f1de1c47bffd33280697acb425789eafe7..b64e5bd200fa05ac1223dd337133abe522c19896 100644 (file)
@@ -103,8 +103,8 @@ relationship between them by virtue of their connection.
 
 */
 
-enum ObjectType { OTContainer, OTContainerEnd, OTLine, OTCircle, OTArc, OTDimension,
-       OTPolygon, OTText, OTImage, OTBlock, OTEndOfFile };
+enum ObjectTypeFile { OTFContainer, OTFContainerEnd, OTFLine, OTFCircle, OTFArc, OTFDimension,
+       OTFPolygon, OTFText, OTFImage, OTFBlock, OTFEndOfFile };
 
 
 /*static*/ bool FileIO::SaveAtnsFile(FILE * file, Container * object)
@@ -157,17 +157,17 @@ enum ObjectType { OTContainer, OTContainerEnd, OTLine, OTCircle, OTArc, OTDimens
                // where the return value tells if it's a valid object, Object * returns the
                // reconstructed object and ObjectType * returns the object type.
 
-               if (objectType == OTEndOfFile)
+               if (objectType == OTFEndOfFile)
                {
 printf("Load: container size = %li\n", drawing->objects.size());
                        return true;
                }
-               else if (objectType == OTContainer)
+               else if (objectType == OTFContainer)
                {
                        containerStack.push_back(currentTopContainer);
                        currentTopContainer = new Container(Vector(0, 0), currentTopContainer);
                }
-               else if (objectType == OTContainerEnd)
+               else if (objectType == OTFContainerEnd)
                {
                        Container * containerToAdd = currentTopContainer;
                        currentTopContainer = containerStack.back();
@@ -203,7 +203,7 @@ printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.siz
                fscanf(file, "(%lf,%lf) (%lf,%lf)", &v1.x, &v1.y, &v2.x, &v2.y);
 //printf("      Number of params recognized: %i\n", n);
                *object = new Line(v1, v2, parent);
-               *objectType = OTLine;
+               *objectType = OTFLine;
        }
        else if (strcmp(buffer, "CIRCLE") == 0)
        {
@@ -212,7 +212,7 @@ printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.siz
                double r;
                fscanf(file, "(%lf,%lf) %lf", &v.x, &v.y, &r);
                *object = new Circle(v, r, parent);
-               *objectType = OTCircle;
+               *objectType = OTFCircle;
        }
        else if (strcmp(buffer, "ARC") == 0)
        {
@@ -221,7 +221,7 @@ printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.siz
                double r, a1, a2;
                fscanf(file, "(%lf,%lf) %lf, %lf, %lf", &v.x, &v.y, &r, &a1, &a2);
                *object = new Arc(v, r, a1, a2, parent);
-               *objectType = OTArc;
+               *objectType = OTFArc;
        }
        else if (strcmp(buffer, "DIMENSION") == 0)
        {
@@ -230,22 +230,22 @@ printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.siz
                DimensionType type;
                fscanf(file, "(%lf,%lf) (%lf,%lf) %i", &v1.x, &v1.y, &v2.x, &v2.y, &type);
                *object = new Dimension(v1, v2, type, parent);
-               *objectType = OTDimension;
+               *objectType = OTFDimension;
        }
        else if (strcmp(buffer, "CONTAINER") == 0)
        {
                recognized = true;
-               *objectType = OTContainer;
+               *objectType = OTFContainer;
        }
        else if (strcmp(buffer, "ENDCONTAINER") == 0)
        {
                recognized = true;
-               *objectType = OTContainerEnd;
+               *objectType = OTFContainerEnd;
        }
        else if (strcmp(buffer, "END") == 0)
        {
                recognized = true;
-               *objectType = OTEndOfFile;
+               *objectType = OTFEndOfFile;
        }
 
        return recognized;