]> Shamusworld >> Repos - architektonas/blob - src/forms/dlgpoint.cpp
Final round of dialogs/forms needing to be converted from Qt3 to 4
[architektonas] / src / forms / dlgpoint.cpp
1 // dlgpoint.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 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  06/12/2010  Created this file. :-)
13 //
14
15 #include "dlgpoint.h"
16
17 #include "rs_point.h"
18 #include "drawing.h"
19 #include "rs_math.h"
20
21 DlgPoint::DlgPoint(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
22         QDialog(parent, flags)
23 {
24         ui.setupUi(this);
25 }
26
27 DlgPoint::~DlgPoint()
28 {
29 }
30
31 void DlgPoint::setPoint(RS_Point & p)
32 {
33         point = &p;
34
35         ui.wPen->setPen(point->getPen(false), true, false, "Pen");
36         Drawing * graphic = point->getGraphic();
37
38         if (graphic)
39                 ui.cbLayer->init(*(graphic->getLayerList()), false, false);
40
41         RS_Layer * lay = point->getLayer(false);
42
43         if (lay)
44                 ui.cbLayer->setLayer(*lay);
45
46         QString s;
47         s.setNum(point->getPos().x);
48         ui.lePosX->setText(s);
49         s.setNum(point->getPos().y);
50         ui.lePosY->setText(s);
51 }
52
53 void DlgPoint::updatePoint()
54 {
55         point->setPos(Vector(RS_Math::eval(ui.lePosX->text()),
56                 RS_Math::eval(ui.lePosY->text())));
57         point->setPen(ui.wPen->getPen());
58         point->setLayer(ui.cbLayer->currentText());
59 }