]> Shamusworld >> Repos - architektonas/blobdiff - src/objectwidget.cpp
Minor updates to various files, removal of old cruft.
[architektonas] / src / objectwidget.cpp
index b4f2cda442077b293bc04d9e5c1b965b2b83198e..915e103bba199b111901b34054b46d0807102363 100644 (file)
@@ -1,7 +1,7 @@
 // objectwidget.cpp: Object tweaking widget
 //
 // Part of the Architektonas Project
-// (C) 2016 Underground Software
+// (C) 2020 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
 // JLH = James Hammons <jlhamm@acm.org>
 
 ObjectWidget::ObjectWidget(void): QWidget()
 {
-#if 0
-       QListWidget * qlw = new QListWidget;
-       QListWidgetItem * qli1 = new QListWidgetItem(qlw);
-       QListWidgetItem * qli2 = new QListWidgetItem(qlw);
-       QListWidgetItem * qli3 = new QListWidgetItem(qlw);
-       QListWidgetItem * qli4 = new QListWidgetItem(qlw);
-       QListWidgetItem * qli5 = new QListWidgetItem(qlw);
-#endif
        label = new QLabel;
 
-#if 0
-       QPushButton * pb1 = new QPushButton("+");
-       QPushButton * pb2 = new QPushButton("-");
-       QPushButton * pb3 = new QPushButton("Edit");
-       QPushButton * pb4 = new QPushButton("Import");
-#else
        QToolButton * pb1 = new QToolButton;
        QToolButton * pb2 = new QToolButton;
        QToolButton * pb3 = new QToolButton;
@@ -47,7 +33,6 @@ ObjectWidget::ObjectWidget(void): QWidget()
        pb2->setToolTip(tr("Remove block"));
        pb3->setToolTip(tr("Edit block"));
        pb4->setToolTip(tr("Import block"));
-#endif
 
        QHBoxLayout * hbox1 = new QHBoxLayout;
        hbox1->addWidget(pb1);
@@ -58,6 +43,7 @@ ObjectWidget::ObjectWidget(void): QWidget()
 
        QVBoxLayout * mainLayout = new QVBoxLayout;
        mainLayout->addWidget(label);
+       mainLayout->addStretch();
        mainLayout->addLayout(hbox1);
 
        setLayout(mainLayout);
@@ -71,19 +57,11 @@ ObjectWidget::~ObjectWidget()
 
 void ObjectWidget::ShowInfo(Object * obj)
 {
-       const char objName[OTCount][16] = {
-               "None", "Line", "Circle", "Ellipse", "Arc", "Polygon", "Dimension", "Spline", "Text", "Container"
-       };
-       const char dimName[DTCount][32] = {
-               "Linear", "Vertical", "Horizontal", "Radial", "Diametric",
-               "Circumferential", "Angular", "Leader"
-       };
-
        // Sanity check
        if (obj == NULL)
                return;
 
-       QString s = QString("%1<br><br>").arg(QString(objName[obj->type]));
+       QString s = QString("<b>%1</b><br><br>").arg(QString(objName[obj->type]));
 
        switch (obj->type)
        {
@@ -104,13 +82,16 @@ void ObjectWidget::ShowInfo(Object * obj)
        case OTArc:
                s += QString("Center: &lt;%1, %2&gt;<br>Radius: %3<br>Start: %4&#x00B0;<br>Span: %5&#x00B0;<br>").arg(obj->p[0].x).arg(obj->p[0].y).arg(obj->radius[0]).arg(obj->angle[0] * RADIANS_TO_DEGREES).arg(obj->angle[1] * RADIANS_TO_DEGREES);
                break;
-               break;
 
        case OTPolygon:
                break;
 
        case OTDimension:
+       {
+               Dimension * d = (Dimension *)obj;
+               s += QString("Type: %1<br>").arg(dimName[d->subtype]);
                break;
+       }
 
        case OTSpline:
                break;