src/actionsEdit.cc

changeset 850
a3d72b0e916d
parent 844
11587d419d2f
child 859
ebc7a186699c
equal deleted inserted replaced
849:4af6f977d04b 850:a3d72b0e916d
34 #include "ui_replcoords.h" 34 #include "ui_replcoords.h"
35 #include "ui_editraw.h" 35 #include "ui_editraw.h"
36 #include "ui_flip.h" 36 #include "ui_flip.h"
37 #include "ui_addhistoryline.h" 37 #include "ui_addhistoryline.h"
38 38
39 EXTERN_CFGENTRY (String, defaultUser) 39 EXTERN_CFGENTRY (String, DefaultUser)
40 40
41 CFGENTRY (Int, roundPosition, 3) 41 CFGENTRY (Int, RoundPosition, 3)
42 CFGENTRY (Int, roundMatrix, 4) 42 CFGENTRY (Int, RoundMatrix, 4)
43 CFGENTRY (Int, splitLinesSegments, 5) 43 CFGENTRY (Int, SplitLinesSegments, 5)
44 44
45 // ============================================================================= 45 // =============================================================================
46 // 46 //
47 static int copyToClipboard() 47 static int copyToClipboard()
48 { 48 {
529 { 529 {
530 Vertex v = mo->position(); 530 Vertex v = mo->position();
531 Matrix t = mo->transform(); 531 Matrix t = mo->transform();
532 532
533 // Note: matrix values are to be rounded to 4 decimals. 533 // Note: matrix values are to be rounded to 4 decimals.
534 v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::roundPosition); }); 534 v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::RoundPosition); });
535 applyToMatrix (t, [](int, double& a) { roundToDecimals (a, cfg::roundMatrix); }); 535 applyToMatrix (t, [](int, double& a) { roundToDecimals (a, cfg::RoundMatrix); });
536 536
537 mo->setPosition (v); 537 mo->setPosition (v);
538 mo->setTransform (t); 538 mo->setTransform (t);
539 num += 12; 539 num += 12;
540 } 540 }
541 else 541 else
542 { 542 {
543 for (int i = 0; i < obj->numVertices(); ++i) 543 for (int i = 0; i < obj->numVertices(); ++i)
544 { 544 {
545 Vertex v = obj->vertex (i); 545 Vertex v = obj->vertex (i);
546 v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::roundPosition); }); 546 v.apply ([](Axis, double& a) { roundToDecimals (a, cfg::RoundPosition); });
547 obj->setVertex (i, v); 547 obj->setVertex (i, v);
548 num += 3; 548 num += 3;
549 } 549 }
550 } 550 }
551 } 551 }
732 prevIsHistory = false; 732 prevIsHistory = false;
733 733
734 QDialog* dlg = new QDialog; 734 QDialog* dlg = new QDialog;
735 Ui_AddHistoryLine* ui = new Ui_AddHistoryLine; 735 Ui_AddHistoryLine* ui = new Ui_AddHistoryLine;
736 ui->setupUi (dlg); 736 ui->setupUi (dlg);
737 ui->m_username->setText (cfg::defaultUser); 737 ui->m_username->setText (cfg::DefaultUser);
738 ui->m_date->setDate (QDate::currentDate()); 738 ui->m_date->setDate (QDate::currentDate());
739 ui->m_comment->setFocus(); 739 ui->m_comment->setFocus();
740 740
741 if (not dlg->exec()) 741 if (not dlg->exec())
742 return; 742 return;
782 } 782 }
783 783
784 void MainWindow::slot_actionSplitLines() 784 void MainWindow::slot_actionSplitLines()
785 { 785 {
786 bool ok; 786 bool ok;
787 int segments = QInputDialog::getInt (g_win, APPNAME, "Amount of segments:", cfg::splitLinesSegments, 0, 787 int segments = QInputDialog::getInt (g_win, APPNAME, "Amount of segments:", cfg::SplitLinesSegments, 0,
788 std::numeric_limits<int>::max(), 1, &ok); 788 std::numeric_limits<int>::max(), 1, &ok);
789 789
790 if (not ok) 790 if (not ok)
791 return; 791 return;
792 792
793 cfg::splitLinesSegments = segments; 793 cfg::SplitLinesSegments = segments;
794 794
795 for (LDObjectPtr obj : selection()) 795 for (LDObjectPtr obj : selection())
796 { 796 {
797 if (obj->type() != OBJ_Line and obj->type() != OBJ_CondLine) 797 if (obj->type() != OBJ_Line and obj->type() != OBJ_CondLine)
798 continue; 798 continue;

mercurial