168 for (LDObject* obj : objects) |
168 for (LDObject* obj : objects) |
169 { |
169 { |
170 if (obj->type() == OBJ_SubfileReference) |
170 if (obj->type() == OBJ_SubfileReference) |
171 { |
171 { |
172 LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); |
172 LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); |
173 Model model; |
173 Model model {m_documents}; |
174 ref->inlineContents(model, true, false); |
174 ref->inlineContents(model, true, false); |
175 writeObjects(model.objects().toList(), f); |
175 writeObjects(model.objects().toList(), f); |
176 } |
176 } |
177 else if (obj->type() == OBJ_BezierCurve) |
177 else if (obj->type() == OBJ_BezierCurve) |
178 { |
178 { |
179 LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj); |
179 LDBezierCurve* curve = static_cast<LDBezierCurve*> (obj); |
180 Model model; |
180 Model model {m_documents}; |
181 curve->rasterize(model, grid()->bezierCurveSegments()); |
181 curve->rasterize(model, grid()->bezierCurveSegments()); |
182 writeObjects(model.objects().toList(), f); |
182 writeObjects(model.objects().toList(), f); |
183 } |
183 } |
184 else |
184 else |
185 f.write ((obj->asText() + "\r\n").toUtf8()); |
185 f.write ((obj->asText() + "\r\n").toUtf8()); |
321 return; |
321 return; |
322 } |
322 } |
323 |
323 |
324 // TODO: I don't like how I need to go to the document manager to load objects from a file... |
324 // TODO: I don't like how I need to go to the document manager to load objects from a file... |
325 // We're not loading this as a document so it shouldn't be necessary. |
325 // We're not loading this as a document so it shouldn't be necessary. |
326 Model model; |
326 Model model {m_documents}; |
327 m_documents->loadFileContents(&f, model, nullptr, nullptr); |
327 m_documents->loadFileContents(&f, model, nullptr, nullptr); |
328 |
328 |
329 // If we replace the objects, delete the selection now. |
329 // If we replace the objects, delete the selection now. |
330 if (replace) |
330 if (replace) |
331 m_window->deleteSelection(); |
331 m_window->deleteSelection(); |