src/toolsets/algorithmtoolset.cpp

changeset 1192
317f4ce38f3f
parent 1187
46dc716238fd
equal deleted inserted replaced
1191:26b3f1e80a9c 1192:317f4ce38f3f
163 Vertex v = mo->position(); 163 Vertex v = mo->position();
164 Matrix t = mo->transformationMatrix(); 164 Matrix t = mo->transformationMatrix();
165 165
166 v.apply ([&](Axis, double& a) 166 v.apply ([&](Axis, double& a)
167 { 167 {
168 roundToDecimals (a, m_config->roundPositionPrecision()); 168 roundToDecimals (a, configuration().roundPositionPrecision());
169 }); 169 });
170 170
171 applyToMatrix (t, [&](int, double& a) 171 applyToMatrix (t, [&](int, double& a)
172 { 172 {
173 roundToDecimals (a, m_config->roundMatrixPrecision()); 173 roundToDecimals (a, configuration().roundMatrixPrecision());
174 }); 174 });
175 175
176 mo->setPosition (v); 176 mo->setPosition (v);
177 mo->setTransformationMatrix (t); 177 mo->setTransformationMatrix (t);
178 num += 12; 178 num += 12;
182 for (int i = 0; i < obj->numVertices(); ++i) 182 for (int i = 0; i < obj->numVertices(); ++i)
183 { 183 {
184 Vertex v = obj->vertex (i); 184 Vertex v = obj->vertex (i);
185 v.apply ([&](Axis, double& a) 185 v.apply ([&](Axis, double& a)
186 { 186 {
187 roundToDecimals (a, m_config->roundPositionPrecision()); 187 roundToDecimals (a, configuration().roundPositionPrecision());
188 }); 188 });
189 obj->setVertex (i, v); 189 obj->setVertex (i, v);
190 num += 3; 190 num += 3;
191 } 191 }
192 } 192 }
335 bool prevIsHistory = false; 335 bool prevIsHistory = false;
336 336
337 QDialog dialog {m_window}; 337 QDialog dialog {m_window};
338 Ui_AddHistoryLine ui; 338 Ui_AddHistoryLine ui;
339 ui.setupUi(&dialog); 339 ui.setupUi(&dialog);
340 ui.m_username->setText (m_config->defaultUser()); 340 ui.m_username->setText (configuration().defaultUser());
341 ui.m_date->setDate (QDate::currentDate()); 341 ui.m_date->setDate (QDate::currentDate());
342 ui.m_comment->setFocus(); 342 ui.m_comment->setFocus();
343 343
344 if (not dialog.exec()) 344 if (not dialog.exec())
345 return; 345 return;
378 378
379 void AlgorithmToolset::splitLines() 379 void AlgorithmToolset::splitLines()
380 { 380 {
381 bool ok; 381 bool ok;
382 int numSegments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:", 382 int numSegments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:",
383 m_config->splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok); 383 configuration().splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
384 384
385 if (not ok) 385 if (not ok)
386 return; 386 return;
387 387
388 m_config->setSplitLinesSegments (numSegments); 388 configuration().setSplitLinesSegments (numSegments);
389 389
390 for (LDObject* obj : selectedObjects()) 390 for (LDObject* obj : selectedObjects())
391 { 391 {
392 if (not isOneOf (obj->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge)) 392 if (not isOneOf (obj->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge))
393 continue; 393 continue;
513 subfile->setName(LDDocument::shortenName(fullSubfileName)); 513 subfile->setName(LDDocument::shortenName(fullSubfileName));
514 514
515 Model header {m_documents}; 515 Model header {m_documents};
516 header.append<LDComment>(subfileTitle); 516 header.append<LDComment>(subfileTitle);
517 header.append<LDComment>("Name: "); // This gets filled in when the subfile is saved 517 header.append<LDComment>("Name: "); // This gets filled in when the subfile is saved
518 header.append<LDComment>(format("Author: %1 [%2]", m_config->defaultName(), m_config->defaultUser())); 518 header.append<LDComment>(format("Author: %1 [%2]", configuration().defaultName(), configuration().defaultUser()));
519 header.append<LDComment>("!LDRAW_ORG Unofficial_Subpart"); 519 header.append<LDComment>("!LDRAW_ORG Unofficial_Subpart");
520 520
521 QString license = preferredLicenseText(); 521 QString license = preferredLicenseText();
522 if (not license.isEmpty()) 522 if (not license.isEmpty())
523 header.append<LDComment>(license); 523 header.append<LDComment>(license);

mercurial