+/*static*/ bool FileIO::LoadVersion1_2(FILE * file, Container * drawing)
+{
+ int hidden, locked, props = 0;
+ char textBuffer[65536];
+
+ // Load drawing properties, if any, first
+ fscanf(file, "PROPERTIES %i\n", &props);
+
+ if (props == 4)
+ {
+ fscanf(file, "BASE_UNIT %i\n", &(drawing->baseUnit));
+ fscanf(file, "UNIT_STYLE %i\n", &(drawing->unitStyle));
+ fscanf(file, "DEC_PREC %i\n", &(drawing->decimalPrecision));
+ fscanf(file, "FRAC_PREC %i\n", &(drawing->fractionalPrecision));
+ }
+
+ // Load layer information next
+ fscanf(file, "LAYERS %i\n", &Global::numLayers);
+
+ for(int i=0; i<Global::numLayers; i++)
+ {
+ fscanf(file, "%i %i \"%[^\"]\"\n", &hidden, &locked, textBuffer);
+ Global::layerHidden.push_back(hidden ? true : false);
+ Global::layerLocked.push_back(locked ? true : false);
+ Global::layerName.push_back(textBuffer);
+ }
+
+ fscanf(file, "ACTIVE %i\n", &Global::activeLayer);
+
+ // Approach: read each object in the file, one by one. If the object is a
+ // Container, add objects to it until an "endContainer" marker is found.
+ // This will require a stack to maintain the current Container.
+ std::vector<Container *> containerStack;
+ Container * currentTopContainer = drawing;
+
+ while (!feof(file))
+ {
+ // Reconstruct the object (extended format!)
+ Object * obj = GetObjectFromFile(file, true, true);
+
+ // objectFileType is set in GetObjectFromFile()...
+ if (objectFileType == OTFObject)
+ {
+ if (obj == NULL)
+ return false;
+
+ currentTopContainer->objects.push_back(obj);
+//printf("Load: Adding object. Container size = %li (%li)\n", drawing->objects.size(), currentTopContainer->objects.size());