]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgspline.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / forms / dlgspline.cpp
1 // dlgspline.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  06/10/2010  Added this file. :-)
15 //
16
17 #include "dlgspline.h"
18
19 #include "drawing.h"
20 #include "spline.h"
21
22 DlgSpline::DlgSpline(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
23         QDialog(parent, flags)
24 {
25         ui.setupUi(this);
26 }
27
28 DlgSpline::~DlgSpline()
29 {
30 }
31
32 void DlgSpline::setSpline(Spline & e)
33 {
34         spline = &e;
35         //pen = spline->getPen();
36         ui.wPen->setPen(spline->getPen(false), true, false, "Pen");
37         Drawing * graphic = spline->getGraphic();
38         Layer * lay = spline->getLayer(false);
39
40         if (graphic)
41                 ui.cbLayer->init(*(graphic->getLayerList()), false, false);
42
43         if (lay)
44                 ui.cbLayer->setLayer(*lay);
45
46         QString s;
47         s.setNum(spline->getDegree());
48         ui.cbDegree->setCurrentIndex(ui.cbDegree->findText(s));
49 //      cbDegree->setCurrentIndex(cbDegree->findText(QString("%1").arg(degree)));
50
51         ui.cbClosed->setChecked(spline->isClosed());
52 }
53
54 void DlgSpline::updateSpline()
55 {
56         spline->setDegree(Math::round(Math::eval(ui.cbDegree->currentText())));
57         spline->setClosed(ui.cbClosed->isChecked());
58         spline->setPen(ui.wPen->getPen());
59         spline->setLayer(ui.cbLayer->currentText());
60         spline->update();
61 }