236 |
236 |
237 if (LDFile::current()->numObjs() > 0 && |
237 if (LDFile::current()->numObjs() > 0 && |
238 LDFile::current()->obj (0)->getType() == LDObject::Comment) |
238 LDFile::current()->obj (0)->getType() == LDObject::Comment) |
239 { |
239 { |
240 // Append title |
240 // Append title |
241 LDCommentObject* comm = static_cast<LDCommentObject*> (LDFile::current()->obj (0)); |
241 LDComment* comm = static_cast<LDComment*> (LDFile::current()->obj (0)); |
242 title += fmt (": %1", comm->text); |
242 title += fmt (": %1", comm->text); |
243 } |
243 } |
244 |
244 |
245 if (LDFile::current()->history().pos() != LDFile::current()->savePos()) |
245 if (LDFile::current()->history().pos() != LDFile::current()->savePos()) |
246 title += '*'; |
246 title += '*'; |
288 for (LDObject* obj : LDFile::current()->objs()) { |
288 for (LDObject* obj : LDFile::current()->objs()) { |
289 str descr; |
289 str descr; |
290 |
290 |
291 switch (obj->getType()) { |
291 switch (obj->getType()) { |
292 case LDObject::Comment: |
292 case LDObject::Comment: |
293 descr = static_cast<LDCommentObject*> (obj)->text; |
293 descr = static_cast<LDComment*> (obj)->text; |
294 |
294 |
295 // Remove leading whitespace |
295 // Remove leading whitespace |
296 while (descr[0] == ' ') |
296 while (descr[0] == ' ') |
297 descr.remove (0, 1); |
297 descr.remove (0, 1); |
298 break; |
298 break; |
301 break; // leave it empty |
301 break; // leave it empty |
302 |
302 |
303 case LDObject::Line: |
303 case LDObject::Line: |
304 case LDObject::Triangle: |
304 case LDObject::Triangle: |
305 case LDObject::Quad: |
305 case LDObject::Quad: |
306 case LDObject::CondLine: |
306 case LDObject::CndLine: |
307 for (short i = 0; i < obj->vertices(); ++i) { |
307 for (short i = 0; i < obj->vertices(); ++i) { |
308 if (i != 0) |
308 if (i != 0) |
309 descr += ", "; |
309 descr += ", "; |
310 |
310 |
311 descr += obj->getVertex (i).stringRep (true); |
311 descr += obj->getVertex (i).stringRep (true); |
315 case LDObject::Error: |
315 case LDObject::Error: |
316 descr = fmt ("ERROR: %1", obj->raw()); |
316 descr = fmt ("ERROR: %1", obj->raw()); |
317 break; |
317 break; |
318 |
318 |
319 case LDObject::Vertex: |
319 case LDObject::Vertex: |
320 descr = static_cast<LDVertexObject*> (obj)->pos.stringRep (true); |
320 descr = static_cast<LDVertex*> (obj)->pos.stringRep (true); |
321 break; |
321 break; |
322 |
322 |
323 case LDObject::Subfile: |
323 case LDObject::Subfile: |
324 { |
324 { |
325 LDSubfileObject* ref = static_cast<LDSubfileObject*> (obj); |
325 LDSubfile* ref = static_cast<LDSubfile*> (obj); |
326 |
326 |
327 descr = fmt ("%1 %2, (", ref->fileInfo()->name(), |
327 descr = fmt ("%1 %2, (", ref->fileInfo()->name(), |
328 ref->position().stringRep (true)); |
328 ref->position().stringRep (true)); |
329 |
329 |
330 for (short i = 0; i < 9; ++i) |
330 for (short i = 0; i < 9; ++i) |
334 descr += ')'; |
334 descr += ')'; |
335 } |
335 } |
336 break; |
336 break; |
337 |
337 |
338 case LDObject::BFC: |
338 case LDObject::BFC: |
339 descr = LDBFCObject::statements[static_cast<LDBFCObject*> (obj)->type]; |
339 descr = LDBFC::statements[static_cast<LDBFC*> (obj)->type]; |
340 break; |
340 break; |
341 |
341 |
342 case LDObject::Overlay: |
342 case LDObject::Overlay: |
343 { |
343 { |
344 LDOverlayObject* ovl = static_cast<LDOverlayObject*> (obj); |
344 LDOverlay* ovl = static_cast<LDOverlay*> (obj); |
345 descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()], |
345 descr = fmt ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()], |
346 basename (ovl->filename()), ovl->x(), ovl->y(), ovl->width(), ovl->height()); |
346 basename (ovl->filename()), ovl->x(), ovl->y(), ovl->width(), ovl->height()); |
347 } |
347 } |
348 break; |
348 break; |
349 |
349 |