214 path = fullPath(); |
214 path = fullPath(); |
215 |
215 |
216 // If the second object in the list holds the file name, update that now. |
216 // If the second object in the list holds the file name, update that now. |
217 LDObject* nameObject = getObject (1); |
217 LDObject* nameObject = getObject (1); |
218 |
218 |
219 if (nameObject and nameObject->type() == OBJ_Comment) |
219 if (nameObject and nameObject->type() == LDObjectType::Comment) |
220 { |
220 { |
221 LDComment* nameComment = static_cast<LDComment*> (nameObject); |
221 LDComment* nameComment = static_cast<LDComment*> (nameObject); |
222 |
222 |
223 if (nameComment->text().left (6) == "Name: ") |
223 if (nameComment->text().left (6) == "Name: ") |
224 { |
224 { |
267 print ("Reloading subfiles of %1", getDisplayName()); |
267 print ("Reloading subfiles of %1", getDisplayName()); |
268 |
268 |
269 // Go through all objects in the current file and reload the subfiles |
269 // Go through all objects in the current file and reload the subfiles |
270 for (LDObject* obj : objects()) |
270 for (LDObject* obj : objects()) |
271 { |
271 { |
272 if (obj->type() == OBJ_SubfileReference) |
272 if (obj->type() == LDObjectType::SubfileReference) |
273 { |
273 { |
274 LDSubfileReference* reference = static_cast<LDSubfileReference*> (obj); |
274 LDSubfileReference* reference = static_cast<LDSubfileReference*> (obj); |
275 LDDocument* fileInfo = m_documents->getDocumentByName (reference->fileInfo()->name()); |
275 LDDocument* fileInfo = m_documents->getDocumentByName (reference->fileInfo()->name()); |
276 |
276 |
277 if (fileInfo) |
277 if (fileInfo) |
280 emplaceReplacement<LDError>(reference, reference->asText(), format("Could not open %1", reference->fileInfo()->name())); |
280 emplaceReplacement<LDError>(reference, reference->asText(), format("Could not open %1", reference->fileInfo()->name())); |
281 } |
281 } |
282 |
282 |
283 // Reparse gibberish files. It could be that they are invalid because |
283 // Reparse gibberish files. It could be that they are invalid because |
284 // of loading errors. Circumstances may be different now. |
284 // of loading errors. Circumstances may be different now. |
285 if (obj->type() == OBJ_Error) |
285 if (obj->type() == LDObjectType::Error) |
286 replaceWithFromString(obj, static_cast<LDError*> (obj)->contents()); |
286 replaceWithFromString(obj, static_cast<LDError*> (obj)->contents()); |
287 } |
287 } |
288 |
288 |
289 m_needsRecache = true; |
289 m_needsRecache = true; |
290 |
290 |
358 Model model {m_documents}; |
358 Model model {m_documents}; |
359 inlineContents(model, true, true); |
359 inlineContents(model, true, true); |
360 |
360 |
361 for (LDObject* obj : model.objects()) |
361 for (LDObject* obj : model.objects()) |
362 { |
362 { |
363 if (obj->type() == OBJ_SubfileReference) |
363 if (obj->type() == LDObjectType::SubfileReference) |
364 { |
364 { |
365 print ("Warning: unable to inline %1 into %2", |
365 print ("Warning: unable to inline %1 into %2", |
366 static_cast<LDSubfileReference*> (obj)->fileInfo()->getDisplayName(), |
366 static_cast<LDSubfileReference*> (obj)->fileInfo()->getDisplayName(), |
367 getDisplayName()); |
367 getDisplayName()); |
368 continue; |
368 continue; |
428 if (not object->isScemantic()) |
428 if (not object->isScemantic()) |
429 continue; |
429 continue; |
430 |
430 |
431 // Got another sub-file reference, inline it if we're deep-inlining. If not, |
431 // Got another sub-file reference, inline it if we're deep-inlining. If not, |
432 // just add it into the objects normally. Yay, recursion! |
432 // just add it into the objects normally. Yay, recursion! |
433 if (deep and object->type() == OBJ_SubfileReference) |
433 if (deep and object->type() == LDObjectType::SubfileReference) |
434 static_cast<LDSubfileReference*>(object)->inlineContents(model, deep, renderinline); |
434 static_cast<LDSubfileReference*>(object)->inlineContents(model, deep, renderinline); |
435 else |
435 else |
436 model.addFromString(object->asText()); |
436 model.addFromString(object->asText()); |
437 } |
437 } |
438 } |
438 } |