src/primitives.cpp

changeset 1340
ea1b3ea9a3ca
parent 1339
1f342d5abc85
child 1345
1e345ed80a1d
equal deleted inserted replaced
1339:1f342d5abc85 1340:ea1b3ea9a3ca
469 description = format("%1 %2%3 x %4", PrimitiveModel::typeName(spec.type), spacing, spec.ringNumber, fraction); 469 description = format("%1 %2%3 x %4", PrimitiveModel::typeName(spec.type), spacing, spec.ringNumber, fraction);
470 } 470 }
471 else 471 else
472 description = format("%1 %2", PrimitiveModel::typeName(spec.type), fraction); 472 description = format("%1 %2", PrimitiveModel::typeName(spec.type), fraction);
473 473
474 // Prepend "Hi-Res" if 48/ primitive. 474 // Prepend "Hi-Res" or "Lo-Res" as appropriate.
475 if (spec.divisions == HighResolution) 475 if (spec.divisions == HighResolution)
476 description.insert (0, "Hi-Res "); 476 description.insert (0, "Hi-Res ");
477 else if (spec.divisions == LowResolution)
478 description.insert (0, "Lo-Res ");
477 479
478 LDDocument* document = m_window->newDocument(); 480 LDDocument* document = m_window->newDocument();
479 document->setDefaultName(fileName); 481 document->setDefaultName(fileName);
480 482
481 QString author = APPNAME;
482 QString license = "";
483 bool hires = (spec.divisions == HighResolution);
484
485 if (not config::defaultName().isEmpty()) 483 if (not config::defaultName().isEmpty())
486 { 484 {
487 license = preferredLicenseText(); 485 document->header.license = LDHeader::defaultLicense();
488 author = format("%1 [%2]", config::defaultName(), config::defaultUser()); 486 document->header.author = format("%1 [%2]", config::defaultName(), config::defaultUser());
487 }
488 else
489 {
490 document->header.author = APPNAME;
489 } 491 }
490 492
491 document->setFrozen(false); 493 document->setFrozen(false);
492 document->history()->setIgnoring(false);
493 document->header.name = fileName; 494 document->header.name = fileName;
494 document->header.description = description; 495 document->header.description = description;
495 document->header.author = author; 496
496 497 if (spec.divisions == HighResolution)
497 if (hires)
498 document->header.type = LDHeader::Primitive_48; 498 document->header.type = LDHeader::Primitive_48;
499 else 499 else if (spec.divisions == LowResolution)
500 document->header.type = LDHeader::Primitive_8; 500 document->header.type = LDHeader::Primitive_8;
501 else
502 document->header.type = LDHeader::Primitive;
501 503
502 if (config::useCaLicense()) 504 if (config::useCaLicense())
503 document->header.license = LDHeader::CaLicense; 505 document->header.license = LDHeader::CaLicense;
504 else 506 else
505 document->header.license =LDHeader::UnspecifiedLicense; 507 document->header.license =LDHeader::UnspecifiedLicense;
506 508
507 document->setWinding(CounterClockwise); 509 document->setWinding(CounterClockwise);
508 spec.generateBody(*document); 510 spec.generateBody(*document);
509 document->addHistoryStep(); 511 document->history()->setIgnoring(false);
510 return document; 512 return document;
511 } 513 }
512 514
513 /* 515 /*
514 * PrimitiveManager :: getPrimitive 516 * PrimitiveManager :: getPrimitive

mercurial