src/primitives.cpp

changeset 1090
ed73c4f48ca4
parent 1086
621c2e5853bb
child 1117
efcb47c64a72
equal deleted inserted replaced
1089:97a539057536 1090:ed73c4f48ca4
469 { 469 {
470 license = preferredLicenseText(); 470 license = preferredLicenseText();
471 author = format("%1 [%2]", m_config->defaultName(), m_config->defaultUser()); 471 author = format("%1 [%2]", m_config->defaultName(), m_config->defaultUser());
472 } 472 }
473 473
474 document->openForEditing(); 474 document->setFrozen(false);
475 document->history()->setIgnoring(false); 475 document->history()->setIgnoring(false);
476 document->emplace<LDComment>(description); 476 document->emplace<LDComment>(description);
477 document->emplace<LDComment>(format("Name: %1", fileName)); 477 document->emplace<LDComment>(format("Name: %1", fileName));
478 document->emplace<LDComment>(format("Author: %1", author)); 478 document->emplace<LDComment>(format("Author: %1", author));
479 document->emplace<LDComment>(format("!LDRAW_ORG Unofficial_%1Primitive", hires ? "48_" : "")); 479 document->emplace<LDComment>(format("!LDRAW_ORG Unofficial_%1Primitive", hires ? "48_" : ""));
494 LDDocument* PrimitiveManager::getPrimitive(const PrimitiveModel& model) 494 LDDocument* PrimitiveManager::getPrimitive(const PrimitiveModel& model)
495 { 495 {
496 QString name = model.makeFileName(); 496 QString name = model.makeFileName();
497 LDDocument* document = m_window->documents()->getDocumentByName (name); 497 LDDocument* document = m_window->documents()->getDocumentByName (name);
498 498
499 if (document) 499 if (not document)
500 return document; 500 {
501 else 501 document = generatePrimitive(model);
502 return generatePrimitive(model); 502 m_window->openDocumentForEditing(document);
503 }
504
505 return document;
503 } 506 }
504 507
505 /* 508 /*
506 * PrimitiveManager :: populateTreeWidget 509 * PrimitiveManager :: populateTreeWidget
507 * 510 *

mercurial