src/forms/imageoptions.h \
src/forms/layerdialog.h \
src/forms/librarywidget.h \
+ src/forms/lineangleoptions.h \
+ src/forms/linebisectoroptions.h \
src/forms/lineoptions.h \
+ src/forms/lineparalleloptions.h \
+ src/forms/lineparallelthroughoptions.h \
+ src/forms/linepolygon2options.h \
+ src/forms/linepolygonoptions.h \
+ src/forms/linerelangleoptions.h \
src/forms/mousewidget.h \
+ src/forms/moverotateoptions.h \
src/forms/printpreviewoptions.h \
+ src/forms/roundoptions.h \
src/forms/selectionwidget.h \
+ src/forms/snapdistoptions.h \
src/forms/splineoptions.h \
src/forms/textoptions.h \
src/forms/trimamountoptions.h \
src/forms/imageoptions.cpp \
src/forms/layerdialog.cpp \
src/forms/librarywidget.cpp \
+ src/forms/lineangleoptions.cpp \
+ src/forms/linebisectoroptions.cpp \
src/forms/lineoptions.cpp \
+ src/forms/lineparalleloptions.cpp \
+ src/forms/lineparallelthroughoptions.cpp \
+ src/forms/linepolygon2options.cpp \
+ src/forms/linepolygonoptions.cpp \
+ src/forms/linerelangleoptions.cpp \
src/forms/mousewidget.cpp \
+ src/forms/moverotateoptions.cpp \
src/forms/printpreviewoptions.cpp \
+ src/forms/roundoptions.cpp \
src/forms/selectionwidget.cpp \
+ src/forms/snapdistoptions.cpp \
src/forms/splineoptions.cpp \
src/forms/textoptions.cpp \
src/forms/trimamountoptions.cpp \
# ui/qg_dlgspline.ui \
# ui/qg_insertoptions.ui \
# ui/qg_libraryinsertoptions.ui \
-# ui/qg_lineangleoptions.ui \
-# ui/qg_linebisectoroptions.ui \
-# ui/qg_lineparalleloptions.ui \
-# ui/qg_lineparallelthroughoptions.ui \
-# ui/qg_linepolygon2options.ui \
-# ui/qg_linepolygonoptions.ui \
-# ui/qg_linerelangleoptions.ui \
-# ui/qg_moverotateoptions.ui \
-# ui/qg_roundoptions.ui \
-# ui/qg_snapdistoptions.ui \
+# src/forms/lineangleoptions.ui \
+# src/forms/linebisectoroptions.ui \
+# src/forms/lineparalleloptions.ui \
+# src/forms/lineparallelthroughoptions.ui \
+# src/forms/linepolygon2options.ui \
+# src/forms/linepolygonoptions.ui \
+# src/forms/linerelangleoptions.ui \
+# src/forms/moverotateoptions.ui \
# src/forms/arcoptions.ui \
# src/forms/arctangentialoptions.ui \
# src/forms/dimlinearoptions.ui \
# src/forms/dimoptions.ui \
+# src/forms/roundoptions.ui \
+# src/forms/snapdistoptions.ui \
# src/forms/splineoptions.ui \
# src/forms/trimamountoptions.ui
#
#include "settings.h"
ArcTangentialOptions::ArcTangentialOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags)
+ QWidget(parent, flags),
+ lRadius(new QLabel(tr("Radius:"))),
+ leRadius(new QLineEdit(this))
{
-#if 1
QHBoxLayout * layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
- lRadius = new QLabel(tr("Radius:"));
- leRadius = new QLineEdit(this);
leRadius->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
layout->addWidget(lRadius);
// nothing will show up on the screen. :-)
if (parent)
parent->addWidget(this);
-#else
- if (objectName().isEmpty())
- setObjectName(QString::fromUtf8("ArcTangentialOptions"));
-
- resize(160, 24);
- QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- policy.setHorizontalStretch(0);
- policy.setVerticalStretch(0);
- policy.setHeightForWidth(sizePolicy().hasHeightForWidth());
- setSizePolicy(policy);
- setMinimumSize(QSize(160, 22));
-
- QHBoxLayout * hboxLayout = new QHBoxLayout(this);
- hboxLayout->setSpacing(6);
- hboxLayout->setContentsMargins(0, 0, 0, 0);
- hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
- lRadius = new QLabel(this);
- lRadius->setObjectName(QString::fromUtf8("lRadius"));
- lRadius->setWordWrap(false);
-
- hboxLayout->addWidget(lRadius);
-
- leRadius = new QLineEdit(this);
- leRadius->setObjectName(QString::fromUtf8("leRadius"));
- QSizePolicy sizePolicy1(QSizePolicy::Ignored, QSizePolicy::Fixed);
- sizePolicy1.setHorizontalStretch(0);
- sizePolicy1.setVerticalStretch(0);
- sizePolicy1.setHeightForWidth(leRadius->sizePolicy().hasHeightForWidth());
- leRadius->setSizePolicy(sizePolicy1);
-
- hboxLayout->addWidget(leRadius);
-
- sep1 = new QFrame(this);
- sep1->setObjectName(QString::fromUtf8("sep1"));
- QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Minimum);
- sizePolicy2.setHorizontalStretch(0);
- sizePolicy2.setVerticalStretch(0);
- sizePolicy2.setHeightForWidth(sep1->sizePolicy().hasHeightForWidth());
- sep1->setSizePolicy(sizePolicy2);
- sep1->setFrameShape(QFrame::VLine);
- sep1->setFrameShadow(QFrame::Sunken);
-
- hboxLayout->addWidget(sep1);
-
-// retranslateUi(ArcTangentialOptions);
- QObject::connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateRadius(QString)));
- QMetaObject::connectSlotsByName(this);
-#endif
}
ArcTangentialOptions::~ArcTangentialOptions()
--- /dev/null
+// dimoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/09/2010 Created this file. :-)
+//
+
+#include "dimoptions.h"
+
+#include "rs_actiondimension.h"
+#include "rs_actioninterface.h"
+#include "settings.h"
+
+DimOptions::DimOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lLabel(new QLabel(tr("Label:"))),
+ bDiameter(new QToolButton(this)),
+ leLabel(new QLineEdit(this)),
+ cbSymbol(new QComboBox(this)),
+ lTol1(new QLabel()),
+ leTol1(new QLineEdit(this)),
+ lTol2(new QLabel()),
+ leTol2(new QLineEdit(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leLabel->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+ leTol1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+ leTol2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+ bDiameter->setCheckable(true);
+ bDiameter->setIcon(QIcon(":/res/qg_dimdia"));
+ lTol1->setPixmap(QPixmap(":/res/qg_dimtol1"));
+ lTol2->setPixmap(QPixmap(":/res/qg_dimtol2"));
+
+ QStringList symbols;
+ symbols
+ << QString::fromUtf8("\303\270")
+ << QString::fromUtf8("\302\260")
+ << QString::fromUtf8("\302\261")
+ << QString::fromUtf8("\302\266")
+ << QString::fromUtf8("\303\227")
+ << QString::fromUtf8("\303\267");
+ cbSymbol->addItems(symbols);
+
+ layout->addWidget(lLabel);
+ layout->addWidget(bDiameter);
+ layout->addWidget(leLabel);
+ layout->addWidget(cbSymbol);
+ layout->addWidget(lTol1);
+ layout->addWidget(leTol1);
+ layout->addWidget(lTol2);
+ layout->addWidget(leTol2);
+
+ connect(leLabel, SIGNAL(textChanged(QString)), this, SLOT(updateLabel()));
+ connect(bDiameter, SIGNAL(toggled(bool)), this, SLOT(updateLabel()));
+ connect(leTol1, SIGNAL(textChanged(QString)), this, SLOT(updateLabel()));
+ connect(leTol2, SIGNAL(textChanged(QString)), this, SLOT(updateLabel()));
+ connect(cbSymbol, SIGNAL(activated(QString)), this, SLOT(insertSign(QString)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+DimOptions::~DimOptions()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("DimLabel", leLabel->text());
+ settings.setValue("DimTol1", leTol1->text());
+ settings.setValue("DimTol2", leTol2->text());
+ settings.endGroup();
+}
+
+void DimOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && RS_ActionDimension::isDimensionAction(a->rtti()))
+ {
+ action = (RS_ActionDimension *)a;
+
+ QString st;
+ QString stol1;
+ QString stol2;
+ bool diam;
+
+ if (update)
+ {
+ st = action->getLabel();
+ stol1 = action->getTol1();
+ stol2 = action->getTol2();
+ diam = action->getDiameter();
+ }
+ else
+ {
+ settings.beginGroup("Draw");
+ st = settings.value("DimLabel", "").toString();
+ stol1 = settings.value("DimTol1", "").toString();
+ stol2 = settings.value("DimTol2", "").toString();
+ diam = settings.value("DimDiameter", false).toBool();
+ settings.endGroup();
+ }
+
+ leLabel->setText(st);
+ leTol1->setText(stol1);
+ leTol2->setText(stol2);
+ bDiameter->setChecked(diam);
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "DimensionOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void DimOptions::updateLabel()
+{
+ if (!action)
+ return;
+
+ action->setText("");
+ action->setLabel(leLabel->text());
+ action->setDiameter(bDiameter->isChecked());
+ action->setTol1(leTol1->text());
+ action->setTol2(leTol2->text());
+ action->setText(action->getText());
+}
+
+void DimOptions::insertSign(const QString & c)
+{
+ leLabel->insert(c);
+}
--- /dev/null
+#ifndef __DIMOPTIONS_H__
+#define __DIMOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDimension;
+class RS_ActionInterface;
+
+class DimOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ DimOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~DimOptions();
+
+ public slots:
+ virtual void setAction(RS_ActionInterface * a, bool update);
+ virtual void updateLabel();
+ virtual void insertSign(const QString & c);
+
+ protected:
+ RS_ActionDimension * action;
+
+ private:
+ QLabel * lLabel;
+ QToolButton * bDiameter;
+ QLineEdit * leLabel;
+ QComboBox * cbSymbol;
+ QLabel * lTol1;
+ QLineEdit * leTol1;
+ QLabel * lTol2;
+ QLineEdit * leTol2;
+};
+
+#endif // __DIMOPTIONS_H__
--- /dev/null
+// lineangleoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "lineangleoptions.h"
+
+#include "rs_actiondrawlineangle.h"
+#include "settings.h"
+
+LineAngleOptions::LineAngleOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lAngle(new QLabel(tr("Angle:"))),
+ leAngle(new QLineEdit(this)),
+ lLength(new QLabel(tr("Length:"))),
+ leLength(new QLineEdit(this)),
+ lSnapPoint(new QLabel(tr("Snap Point:"))),
+ cbSnapPoint(new QComboBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ QStringList items;
+ items << "Start" << "Middle" << "End";
+ cbSnapPoint->addItems(items);
+
+ leAngle->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+ leLength->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lAngle);
+ layout->addWidget(leAngle);
+ layout->addWidget(lLength);
+ layout->addWidget(leLength);
+ layout->addWidget(lSnapPoint);
+ layout->addWidget(cbSnapPoint);
+
+ connect(leAngle, SIGNAL(textChanged(QString)), this, SLOT(updateAngle(QString)));
+ connect(leLength, SIGNAL(textChanged(QString)), this, SLOT(updateLength(QString)));
+ connect(cbSnapPoint, SIGNAL(activated(int)), this, SLOT(updateSnapPoint(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LineAngleOptions::~LineAngleOptions()
+{
+ if (action)
+ {
+ settings.beginGroup("Draw");
+
+ if (!action->hasFixedAngle())
+ settings.setValue("LineAngleAngle", RS_Math::rad2deg(action->getAngle()));
+
+ settings.setValue("LineAngleLength", action->getLength());
+ settings.setValue("LineAngleSnapPoint", action->getSnapPoint());
+ settings.endGroup();
+ }
+}
+
+void LineAngleOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLineAngle)
+ {
+ action = (RS_ActionDrawLineAngle *)a;
+
+ if (action->hasFixedAngle())
+ {
+ lAngle->hide();
+ leAngle->hide();
+ }
+
+ QString sa;
+ QString sl;
+ int sp;
+
+ // settings from action:
+ if (update)
+ {
+ sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sl = QString("%1").arg(action->getLength());
+ sp = action->getSnapPoint();
+ }
+ // settings from config file:
+ else
+ {
+ settings.beginGroup("Draw");
+
+ if (!action->hasFixedAngle())
+ sa = settings.value("LineAngleAngle", "30.0").toString();
+ else
+ sa = QString("%1").arg(action->getAngle());
+
+ sl = settings.value("LineAngleLength", "10.0").toString();
+ sp = settings.value("LineAngleSnapPoint", 0).toInt();
+ settings.endGroup();
+ action->setSnapPoint(sp);
+ }
+
+ leAngle->setText(sa);
+ leLength->setText(sl);
+ cbSnapPoint->setCurrentIndex(sp);
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LineAngleOptions::setAction: wrong action type");
+ this->action = NULL;
+ }
+}
+
+void LineAngleOptions::updateAngle(const QString & a)
+{
+ if (action != NULL && !action->hasFixedAngle())
+ action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+}
+
+void LineAngleOptions::updateLength(const QString & l)
+{
+ if (action != NULL)
+ action->setLength(RS_Math::eval(l));
+}
+
+void LineAngleOptions::updateSnapPoint(int sp)
+{
+ if (action != NULL)
+ action->setSnapPoint(sp);
+}
--- /dev/null
+#ifndef __LINEANGLEOPTIONS_H__
+#define __LINEANGLEOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLineAngle;
+class RS_ActionInterface;
+
+class LineAngleOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LineAngleOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LineAngleOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateAngle(const QString & a);
+ void updateLength(const QString & l);
+ void updateSnapPoint(int sp);
+
+ protected:
+ RS_ActionDrawLineAngle * action;
+
+ private:
+ QLabel * lAngle;
+ QLineEdit * leAngle;
+ QLabel * lLength;
+ QLineEdit * leLength;
+ QLabel * lSnapPoint;
+ QComboBox * cbSnapPoint;
+};
+
+#endif // __LINEANGLEOPTIONS_H__
--- /dev/null
+// linebisectoroptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "linebisectoroptions.h"
+
+#include "rs_actiondrawlinebisector.h"
+#include "settings.h"
+
+LineBisectorOptions::LineBisectorOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lLength(new QLabel(tr("Length:"))),
+ leLength(new QLineEdit(this)),
+ lNumber(new QLabel(tr("Number:"))),
+ sbNumber(new QSpinBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leLength->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lLength);
+ layout->addWidget(leLength);
+ layout->addWidget(lNumber);
+ layout->addWidget(sbNumber);
+
+ connect(leLength, SIGNAL(textChanged(QString)), this, SLOT(updateLength(QString)));
+ connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LineBisectorOptions::~LineBisectorOptions()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("LineBisectorLength", leLength->text());
+ settings.setValue("LineBisectorNumber", sbNumber->text());
+ settings.endGroup();
+}
+
+void LineBisectorOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLineBisector)
+ {
+ action = (RS_ActionDrawLineBisector *)a;
+
+ QString sl;
+ QString sn;
+
+ if (update)
+ {
+ sl = QString("%1").arg(action->getLength());
+ sn = QString("%1").arg(action->getNumber());
+ }
+ else
+ {
+ settings.beginGroup("Draw");
+ sl = settings.value("LineBisectorLength", "1.0").toString();
+ sn = settings.value("LineBisectorNumber", "1").toString();
+ settings.endGroup();
+ }
+
+ leLength->setText(sl);
+ sbNumber->setValue(sn.toInt());
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LineBisectorOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void LineBisectorOptions::updateLength(const QString & l)
+{
+ if (action != NULL)
+ action->setLength(RS_Math::eval(l));
+}
+
+void LineBisectorOptions::updateNumber(int n)
+{
+ if (action != NULL)
+ action->setNumber(n);
+}
--- /dev/null
+#ifndef __LINEBISECTOROPTIONS_H__
+#define __LINEBISECTOROPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLineBisector;
+class RS_ActionInterface;
+
+class LineBisectorOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LineBisectorOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LineBisectorOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateLength(const QString & l);
+ void updateNumber(int n);
+
+ protected:
+ RS_ActionDrawLineBisector * action;
+
+ private:
+ QLabel * lLength;
+ QLineEdit * leLength;
+ QLabel * lNumber;
+ QSpinBox * sbNumber;
+};
+
+#endif // __LINEBISECTOROPTIONS_H__
--- /dev/null
+// lineparalleloptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "lineparalleloptions.h"
+
+#include "rs_actiondrawlineparallel.h"
+#include "settings.h"
+
+LineParallelOptions::LineParallelOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lDist(new QLabel(tr("Distance:"))),
+ leDist(new QLineEdit(this)),
+ lNumber(new QLabel(tr("Number:"))),
+ sbNumber(new QSpinBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lDist);
+ layout->addWidget(leDist);
+ layout->addWidget(lNumber);
+ layout->addWidget(sbNumber);
+
+ connect(leDist, SIGNAL(textChanged(QString)), this, SLOT(updateDist(QString)));
+ connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LineParallelOptions::~LineParallelOptions()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("LineParallelDistance", leDist->text());
+ settings.setValue("LineParallelNumber", sbNumber->text());
+ settings.endGroup();
+}
+
+void LineParallelOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLineParallel)
+ {
+ action = (RS_ActionDrawLineParallel *)a;
+
+ QString sd;
+ QString sn;
+
+ if (update)
+ {
+ sd = QString("%1").arg(action->getDistance());
+ sn = QString("%1").arg(action->getNumber());
+ }
+ else
+ {
+ settings.beginGroup("Draw");
+ sd = settings.value("LineParallelDistance", "1.0").toString();
+ sn = settings.value("LineParallelNumber", "1").toString();
+ settings.endGroup();
+ }
+
+ leDist->setText(sd);
+ sbNumber->setValue(sn.toInt());
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void LineParallelOptions::updateDist(const QString & d)
+{
+ if (action != NULL)
+ action->setDistance(RS_Math::eval(d));
+}
+
+void LineParallelOptions::updateNumber(int n)
+{
+ if (action != NULL)
+ action->setNumber(n);
+}
--- /dev/null
+#ifndef __LINEPARALLELOPTIONS_H__
+#define __LINEPARALLELOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLineParallel;
+class RS_ActionInterface;
+
+class LineParallelOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LineParallelOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LineParallelOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateDist(const QString & d);
+ void updateNumber(int n);
+
+ protected:
+ RS_ActionDrawLineParallel * action;
+
+ private:
+ QLabel * lDist;
+ QLineEdit * leDist;
+ QLabel * lNumber;
+ QSpinBox * sbNumber;
+};
+
+#endif // __LINEPARALLELOPTIONS_H__
--- /dev/null
+// lineparallelthroughoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "lineparallelthroughoptions.h"
+
+#include "rs_actiondrawlineparallelthrough.h"
+#include "settings.h"
+
+LineParallelThroughOptions::LineParallelThroughOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lNumber(new QLabel(tr("Number:"))),
+ sbNumber(new QSpinBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+// leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lNumber);
+ layout->addWidget(sbNumber);
+
+ connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LineParallelThroughOptions::~LineParallelThroughOptions()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("LineParallelNumber", sbNumber->text());
+ settings.endGroup();
+}
+
+void LineParallelThroughOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLineParallelThrough)
+ {
+ action = (RS_ActionDrawLineParallelThrough *)a;
+
+ QString sn;
+
+ if (update)
+ sn = QString("%1").arg(action->getNumber());
+ else
+ {
+ settings.beginGroup("Draw");
+ sn = settings.value("LineParallelNumber", "1").toString();
+ settings.endGroup();
+ }
+
+ sbNumber->setValue(sn.toInt());
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelThroughOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void LineParallelThroughOptions::updateNumber(int n)
+{
+ if (action != NULL)
+ action->setNumber(n);
+}
--- /dev/null
+#ifndef __LINEPARALLELTHROUGHOPTIONS_H__
+#define __LINEPARALLELTHROUGHOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLineParallelThrough;
+class RS_ActionInterface;
+
+class LineParallelThroughOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LineParallelThroughOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LineParallelThroughOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateNumber(int n);
+
+ protected:
+ RS_ActionDrawLineParallelThrough * action;
+
+ private:
+ QLabel * lNumber;
+ QSpinBox * sbNumber;
+};
+
+#endif // __LINEPARALLELTHROUGHOPTIONS_H__
--- /dev/null
+// linepolygon2options.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "linepolygon2options.h"
+
+#include "rs_actiondrawlinepolygon2.h"
+#include "rs_debug.h"
+#include "settings.h"
+
+LinePolygon2Options::LinePolygon2Options(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lNumber(new QLabel(tr("Number:"))),
+ sbNumber(new QSpinBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+// leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lNumber);
+ layout->addWidget(sbNumber);
+
+ connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LinePolygon2Options::~LinePolygon2Options()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("LinePolygon2Number", sbNumber->text());
+ settings.endGroup();
+}
+
+void LinePolygon2Options::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLinePolygon2)
+ {
+ action = (RS_ActionDrawLinePolygon2 *)a;
+
+ QString sn;
+
+ if (update)
+ sn = QString("%1").arg(action->getNumber());
+ else
+ {
+ settings.beginGroup("Draw");
+ sn = settings.value("LinePolygon2Number", "3").toString();
+ settings.endGroup();
+ }
+
+ sbNumber->setValue(sn.toInt());
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LinePolygon2Options::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void LinePolygon2Options::updateNumber(int n)
+{
+ if (action != NULL)
+ action->setNumber(n);
+}
--- /dev/null
+#ifndef __LINEPOLYGON2OPTIONS_H__
+#define __LINEPOLYGON2OPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLinePolygon2;
+class RS_ActionInterface;
+
+class LinePolygon2Options: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LinePolygon2Options(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LinePolygon2Options();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateNumber(int n);
+
+ protected:
+ RS_ActionDrawLinePolygon2 * action;
+
+ private:
+ QLabel * lNumber;
+ QSpinBox * sbNumber;
+};
+
+#endif // __LINEPOLYGON2OPTIONS_H__
--- /dev/null
+// linepolygonoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "linepolygonoptions.h"
+
+#include "rs_actiondrawlinepolygon.h"
+#include "rs_debug.h"
+#include "settings.h"
+
+LinePolygonOptions::LinePolygonOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lNumber(new QLabel(tr("Number:"))),
+ sbNumber(new QSpinBox(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+// leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lNumber);
+ layout->addWidget(sbNumber);
+
+ connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LinePolygonOptions::~LinePolygonOptions()
+{
+ settings.beginGroup("Draw");
+ settings.setValue("LinePolygonNumber", sbNumber->text());
+ settings.endGroup();
+}
+
+void LinePolygonOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLinePolygon)
+ {
+ action = (RS_ActionDrawLinePolygon *)a;
+
+ QString sn;
+
+ if (update)
+ sn = QString("%1").arg(action->getNumber());
+ else
+ {
+ settings.beginGroup("Draw");
+ sn = settings.value("LinePolygonNumber", "3").toString();
+ settings.endGroup();
+ }
+
+ sbNumber->setValue(sn.toInt());
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LinePolygonOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void LinePolygonOptions::updateNumber(int n)
+{
+ if (action != NULL)
+ action->setNumber(n);
+}
--- /dev/null
+#ifndef __LINEPOLYGONOPTIONS_H__
+#define __LINEPOLYGONOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLinePolygon;
+class RS_ActionInterface;
+
+class LinePolygonOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LinePolygonOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LinePolygonOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateNumber(int n);
+
+ protected:
+ RS_ActionDrawLinePolygon * action;
+
+ private:
+ QLabel * lNumber;
+ QSpinBox * sbNumber;
+};
+
+#endif // __LINEPOLYGONOPTIONS_H__
--- /dev/null
+// linerelangleoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "linerelangleoptions.h"
+
+#include "rs_actiondrawlinerelangle.h"
+#include "settings.h"
+
+LineRelAngleOptions::LineRelAngleOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lAngle(new QLabel(tr("Angle:"))),
+ leAngle(new QLineEdit(this)),
+ lLength(new QLabel(tr("Length:"))),
+ leLength(new QLineEdit(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leAngle->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+ leLength->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lAngle);
+ layout->addWidget(leAngle);
+ layout->addWidget(lLength);
+ layout->addWidget(leLength);
+
+ connect(leAngle, SIGNAL(textChanged(QString)), this, SLOT(updateAngle(QString)));
+ connect(leLength, SIGNAL(textChanged(QString)), this, SLOT(updateLength(QString)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+LineRelAngleOptions::~LineRelAngleOptions()
+{
+ if (action != NULL)
+ {
+ settings.beginGroup("Draw");
+
+ if (!action->hasFixedAngle())
+ settings.value("LineRelAngleAngle", RS_Math::rad2deg(action->getAngle()));
+
+ settings.value("LineRelAngleLength", action->getLength());
+ settings.endGroup();
+ }
+}
+
+void LineRelAngleOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionDrawLineRelAngle)
+ {
+ action = (RS_ActionDrawLineRelAngle *)a;
+
+ if (action->hasFixedAngle())
+ {
+ lAngle->setDisabled(true);
+ leAngle->setDisabled(true);
+ }
+
+ QString sa;
+ QString sl;
+
+ // settings from action:
+ if (update)
+ {
+ sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ sl = QString("%1").arg(action->getLength());
+ }
+ // settings from config file:
+ else
+ {
+ settings.beginGroup("Draw");
+
+ if (!action->hasFixedAngle())
+ sa = settings.value("LineRelAngleAngle", "30.0").toString();
+ else
+ sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+
+ sl = settings.value("LineRelAngleLength", "10.0").toString();
+ settings.endGroup();
+ }
+
+ leAngle->setText(sa);
+ leLength->setText(sl);
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR,
+ "LineRelAngleOptions::setAction: wrong action type");
+ this->action = NULL;
+ }
+}
+
+void LineRelAngleOptions::updateAngle(const QString & a)
+{
+ if (action != NULL && !action->hasFixedAngle())
+ action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+}
+
+void LineRelAngleOptions::updateLength(const QString & l)
+{
+ if (action != NULL)
+ action->setLength(RS_Math::eval(l));
+}
--- /dev/null
+#ifndef __LINERELANGLEOPTIONS_H__
+#define __LINERELANGLEOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionDrawLineRelAngle;
+class RS_ActionInterface;
+
+class LineRelAngleOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ LineRelAngleOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~LineRelAngleOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateAngle(const QString & a);
+ void updateLength(const QString & l);
+
+ protected:
+ RS_ActionDrawLineRelAngle * action;
+
+ private:
+ QLabel * lAngle;
+ QLineEdit * leAngle;
+ QLabel * lLength;
+ QLineEdit * leLength;
+};
+
+#endif // __LINERELANGLEOPTIONS_H__
--- /dev/null
+// moverotateoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/09/2010 Created this file. :-)
+//
+
+#include "moverotateoptions.h"
+
+#include "rs_actionmodifymoverotate.h"
+#include "settings.h"
+
+MoveRotateOptions::MoveRotateOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lAngle(new QLabel(tr("Angle:"))),
+ leAngle(new QLineEdit(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leAngle->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lAngle);
+ layout->addWidget(leAngle);
+
+ connect(leAngle, SIGNAL(textChanged(QString)), this, SLOT(updateAngle(QString)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+MoveRotateOptions::~MoveRotateOptions()
+{
+ settings.beginGroup("Modify");
+ settings.setValue("MoveRotate", leAngle->text());
+ settings.endGroup();
+}
+
+void MoveRotateOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionModifyMoveRotate)
+ {
+ action = (RS_ActionModifyMoveRotate *)a;
+
+ QString sa;
+
+ if (update)
+ sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
+ else
+ {
+ settings.beginGroup("Modify");
+ sa = settings.value("MoveRotate", "30").toString();
+ settings.endGroup();
+ action->setAngle(RS_Math::deg2rad(sa.toDouble()));
+ }
+
+ leAngle->setText(sa);
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "CircleOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void MoveRotateOptions::updateAngle(const QString & a)
+{
+ if (action != NULL)
+ action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));
+}
+
--- /dev/null
+#ifndef __MOVEROTATEOPTIONS_H__
+#define __MOVEROTATEOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionInterface;
+class RS_ActionModifyMoveRotate;
+
+class MoveRotateOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ MoveRotateOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~MoveRotateOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateAngle(const QString & a);
+
+ protected:
+ RS_ActionModifyMoveRotate * action;
+
+ private:
+ QLabel * lAngle;
+ QLineEdit * leAngle;
+};
+
+#endif // __MOVEROTATEOPTIONS_H__
--- /dev/null
+// roundoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "roundoptions.h"
+
+#include "rs_actionmodifyround.h"
+#include "settings.h"
+
+RoundOptions::RoundOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ cbTrim(new QCheckBox(tr("Trim"))),
+ sep1(new QFrame(this)),
+ lRadius(new QLabel(tr("Radius:"))),
+ leRadius(new QLineEdit(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ sep1->setFrameShape(QFrame::VLine);
+ sep1->setFrameShadow(QFrame::Sunken);
+ leRadius->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(cbTrim);
+ layout->addWidget(sep1);
+ layout->addWidget(lRadius);
+ layout->addWidget(leRadius);
+
+ connect(cbTrim, SIGNAL(toggled(bool)), this, SLOT(updateData()));
+ connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateData()));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+RoundOptions::~RoundOptions()
+{
+ settings.beginGroup("Modify");
+ settings.setValue("RoundRadius", leRadius->text());
+ settings.setValue("RoundTrim", cbTrim->isChecked());
+ settings.endGroup();
+}
+
+void RoundOptions::setAction(RS_ActionInterface * a, bool update)
+{
+ if (a != NULL && a->rtti() == RS2::ActionModifyRound)
+ {
+ action = (RS_ActionModifyRound *)a;
+
+ QString sr;
+ bool st;
+
+ if (update)
+ {
+ sr = QString("%1").arg(action->getRadius());
+ st = action->isTrimOn();
+ }
+ else
+ {
+ settings.beginGroup("Modify");
+ sr = settings.value("RoundRadius", "1.0").toString();
+ st = settings.value("RoundTrim", true).toBool();
+ settings.endGroup();
+ }
+
+ leRadius->setText(sr);
+ cbTrim->setChecked(st);
+ }
+ else
+ {
+ RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelOptions::setAction: wrong action type");
+ action = NULL;
+ }
+}
+
+void RoundOptions::updateData()
+{
+ if (action != NULL)
+ {
+ action->setTrim(cbTrim->isChecked());
+ action->setRadius(RS_Math::eval(leRadius->text()));
+ }
+}
+
--- /dev/null
+#ifndef __ROUNDOPTIONS_H__
+#define __ROUNDOPTIONS_H__
+
+#include <QtGui>
+
+class RS_ActionInterface;
+class RS_ActionModifyRound;
+
+class RoundOptions: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ RoundOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~RoundOptions();
+
+ public slots:
+ void setAction(RS_ActionInterface * a, bool update);
+ void updateData();
+
+ protected:
+ RS_ActionModifyRound * action;
+
+ private:
+ QCheckBox * cbTrim;
+ QFrame * sep1;
+ QLabel * lRadius;
+ QLineEdit * leRadius;
+};
+
+#endif // __ROUNDOPTIONS_H__
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you wish to add, delete or rename functions or slots use
-** Qt Designer which will update this file, preserving your code. Create an
-** init() function in place of a constructor, and a destroy() function in
-** place of a destructor.
-*****************************************************************************/
-
-void QG_SnapDistOptions::destroy()
+// snapdistoptions.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who When What
+// --- ---------- -----------------------------------------------------------
+// JLH 06/10/2010 Created this file. :-)
+//
+
+#include "snapdistoptions.h"
+
+//#include "rs_actionmodifytrimamount.h"
+//#include "rs_actioninterface.h"
+//#include "rs_debug.h"
+#include "rs_math.h"
+#include "settings.h"
+
+SnapDistOptions::SnapDistOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget(parent, flags),
+ lDist(new QLabel(tr("Distance:"))),
+ leDist(new QLineEdit(this))
+{
+ QHBoxLayout * layout = new QHBoxLayout(this);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
+
+ layout->addWidget(lDist);
+ layout->addWidget(leDist);
+
+ connect(leDist, SIGNAL(textChanged(QString)), this, SLOT(updateDist(QString)));
+
+ // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
+ // nothing will show up on the screen. :-)
+ if (parent)
+ parent->addWidget(this);
+}
+
+SnapDistOptions::~SnapDistOptions()
{
- RS_SETTINGS->beginGroup("/Snap");
- RS_SETTINGS->writeEntry("/Distance", leDist->text());
- RS_SETTINGS->endGroup();
+ settings.beginGroup("Snap");
+ settings.setValue("Distance", leDist->text());
+ settings.endGroup();
}
-void QG_SnapDistOptions::setDist(double * d)
+void SnapDistOptions::setDist(double * d)
{
dist = d;
- RS_SETTINGS->beginGroup("/Snap");
- QString r = RS_SETTINGS->readEntry("/Distance", "1.0");
- RS_SETTINGS->endGroup();
+ settings.beginGroup("Snap");
+ QString r = settings.value("Distance", "1.0").toString();
+ settings.endGroup();
leDist->setText(r);
}
-void QG_SnapDistOptions::updateDist(const QString & d)
+void SnapDistOptions::updateDist(const QString & d)
{
if (dist != NULL)
*dist = RS_Math::eval(d, 1.0);
-#ifndef QG_SNAPDISTOPTIONS_H
-#define QG_SNAPDISTOPTIONS_H
+#ifndef __SNAPDISTOPTIONS_H__
+#define __SNAPDISTOPTIONS_H__
-#include <qvariant.h>
+#include <QtGui>
-#include <Qt3Support/Q3MimeSourceFactory>
-#include <QtCore/QVariant>
-#include <QtGui/QAction>
-#include <QtGui/QApplication>
-#include <QtGui/QButtonGroup>
-#include <QtGui/QFrame>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QHeaderView>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
-#include <QtGui/QWidget>
-#include "rs_circle.h"
-#include "rs_settings.h"
-
-QT_BEGIN_NAMESPACE
-
-class Ui_QG_SnapDistOptions
-{
- public:
- QHBoxLayout *hboxLayout;
- QLabel *lDist;
- QLineEdit *leDist;
- QFrame *sep1;
-
- void setupUi(QWidget *QG_SnapDistOptions)
- {
- if (QG_SnapDistOptions->objectName().isEmpty())
- QG_SnapDistOptions->setObjectName(QString::fromUtf8("QG_SnapDistOptions"));
- QG_SnapDistOptions->resize(150, 24);
- QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(4), static_cast<QSizePolicy::Policy>(0));
- sizePolicy.setHorizontalStretch(0);
- sizePolicy.setVerticalStretch(0);
- sizePolicy.setHeightForWidth(QG_SnapDistOptions->sizePolicy().hasHeightForWidth());
- QG_SnapDistOptions->setSizePolicy(sizePolicy);
- QG_SnapDistOptions->setMinimumSize(QSize(130, 22));
- QG_SnapDistOptions->setMaximumSize(QSize(150, 32767));
- hboxLayout = new QHBoxLayout(QG_SnapDistOptions);
- hboxLayout->setSpacing(6);
- hboxLayout->setContentsMargins(1, 1, 1, 1);
- hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
- lDist = new QLabel(QG_SnapDistOptions);
- lDist->setObjectName(QString::fromUtf8("lDist"));
- lDist->setWordWrap(false);
-
- hboxLayout->addWidget(lDist);
-
- leDist = new QLineEdit(QG_SnapDistOptions);
- leDist->setObjectName(QString::fromUtf8("leDist"));
-
- hboxLayout->addWidget(leDist);
-
- sep1 = new QFrame(QG_SnapDistOptions);
- sep1->setObjectName(QString::fromUtf8("sep1"));
- QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(1));
- sizePolicy1.setHorizontalStretch(0);
- sizePolicy1.setVerticalStretch(0);
- sizePolicy1.setHeightForWidth(sep1->sizePolicy().hasHeightForWidth());
- sep1->setSizePolicy(sizePolicy1);
- sep1->setFrameShape(QFrame::VLine);
- sep1->setFrameShadow(QFrame::Sunken);
-
- hboxLayout->addWidget(sep1);
-
- retranslateUi(QG_SnapDistOptions);
- QObject::connect(leDist, SIGNAL(textChanged(QString)), QG_SnapDistOptions, SLOT(updateDist(QString)));
-
- QMetaObject::connectSlotsByName(QG_SnapDistOptions);
- } // setupUi
-
- void retranslateUi(QWidget *QG_SnapDistOptions)
- {
- QG_SnapDistOptions->setWindowTitle(QApplication::translate("QG_SnapDistOptions", "Snap Distance Options", 0, QApplication::UnicodeUTF8));
- lDist->setText(QApplication::translate("QG_SnapDistOptions", "Distance:", 0, QApplication::UnicodeUTF8));
- } // retranslateUi
-};
-
-namespace Ui {
-class QG_SnapDistOptions: public Ui_QG_SnapDistOptions
-{
-};
-} // namespace Ui
-
-QT_END_NAMESPACE
-
-class QG_SnapDistOptions: public QWidget, public Ui::QG_SnapDistOptions
+class SnapDistOptions: public QWidget
{
Q_OBJECT
public:
- QG_SnapDistOptions(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags fl = 0);
- ~QG_SnapDistOptions();
+ SnapDistOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0);
+ ~SnapDistOptions();
public slots:
- virtual void setDist(double * d);
- virtual void updateDist(const QString & d);
+ void setDist(double * d);
+ void updateDist(const QString & d);
protected:
double * dist;
- protected slots:
- virtual void languageChange();
-
private:
- void destroy();
+ QLabel * lDist;
+ QLineEdit * leDist;
};
-#endif // QG_SNAPDISTOPTIONS_H
+#endif // __SNAPDISTOPTIONS_H__
#include "ui/qg_insertoptions.h"
#include "ui/qg_layerdialog.h"
#include "ui/qg_libraryinsertoptions.h"
-#include "ui/qg_lineangleoptions.h"
-#include "ui/qg_linebisectoroptions.h"
+ #include "ui/qg_lineangleoptions.h"
+ #include "ui/qg_linebisectoroptions.h"
#include "ui/qg_lineoptions.h"
-#include "ui/qg_lineparalleloptions.h"
-#include "ui/qg_lineparallelthroughoptions.h"
-#include "ui/qg_linepolygon2options.h"
-#include "ui/qg_linepolygonoptions.h"
-#include "ui/qg_linerelangleoptions.h"
+ #include "ui/qg_lineparalleloptions.h"
+ #include "ui/qg_lineparallelthroughoptions.h"
+ #include "ui/qg_linepolygon2options.h"
+ #include "ui/qg_linepolygonoptions.h"
+ #include "ui/qg_linerelangleoptions.h"
#include "ui/qg_mousewidget.h"
-#include "ui/qg_moverotateoptions.h"
+ #include "ui/qg_moverotateoptions.h"
#include "ui/qg_printpreviewoptions.h"
-#include "ui/qg_roundoptions.h"
+ #include "ui/qg_roundoptions.h"
#include "ui/qg_selectionwidget.h"
-#include "ui/qg_snapdistoptions.h"
+ #include "ui/qg_snapdistoptions.h"
#include "ui/qg_splineoptions.h"
#include "ui/qg_textoptions.h"
#include "ui/qg_trimamountoptions.h"
#include "dlgtext.h"
#include "imageoptions.h"
#include "layerdialog.h"
+#include "lineangleoptions.h"
+#include "linebisectoroptions.h"
#include "lineoptions.h"
+#include "lineparalleloptions.h"
+#include "lineparallelthroughoptions.h"
+#include "linepolygon2options.h"
+#include "linepolygonoptions.h"
+#include "linerelangleoptions.h"
#include "mousewidget.h"
+#include "moverotateoptions.h"
#include "printpreviewoptions.h"
+#include "roundoptions.h"
#include "selectionwidget.h"
+#include "snapdistoptions.h"
#include "splineoptions.h"
#include "textoptions.h"
#include "trimamountoptions.h"
void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool on, bool update)
{
#ifdef RS_PROF
- static QG_PolylineOptions * toolWidget = NULL;
+ static PolylineOptions * toolWidget = NULL;
if (optionWidget != NULL)
{
}
if (on && toolWidget == NULL)
{
- toolWidget = new QG_PolylineOptions(optionWidget);
+ toolWidget = new PolylineOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
#if 0
/**
- * Shows a widget for options for the action: "draw line parallel"
- */
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
-{
- static QG_LineParallelOptions* toolWidget = NULL;
-
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
- delete toolWidget;
- toolWidget = NULL;
- }
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LineParallelOptions(optionWidget);
- toolWidget->setAction(action, update);
- }
- }
-}
-
-/**
- * Shows a widget for options for the action: "draw line parallel through"
+ * Shows a widget for insert options.
*/
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
+ bool on, bool update)
{
- static QG_LineParallelThroughOptions* toolWidget = NULL;
+ static QG_InsertOptions* toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LineParallelThroughOptions(optionWidget);
+ toolWidget = new QG_InsertOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
}
/**
- * Shows a widget for options for the action: "line angle"
+ * Shows a widget for image options.
*/
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action,
+void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
bool on, bool update)
{
- static QG_LineAngleOptions* toolWidget = NULL;
+ static QG_ImageOptions* toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LineAngleOptions(optionWidget);
+ toolWidget = new QG_ImageOptions(optionWidget);
toolWidget->setAction(action, update);
- //toolWidget->setData(&angle, &length, fixedAngle, update);
}
}
}
/**
- * Shows a widget for options for the action: "line relative angle"
+ * Shows a widget for library insert options.
*/
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action,
+void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
bool on, bool update)
{
- static QG_LineRelAngleOptions* toolWidget = NULL;
+ static QG_LibraryInsertOptions* toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LineRelAngleOptions(optionWidget);
+ toolWidget = new QG_LibraryInsertOptions(optionWidget);
toolWidget->setAction(action, update);
- //toolWidget->setData(&angle, &length, fixedAngle, update);
}
}
}
-
+#else
/**
- * Shows a widget for options for the action: "line angle"
+ * Shows a widget for options for the action: "draw line parallel"
*/
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_LineBisectorOptions* toolWidget = NULL;
+ static LineParallelOptions * toolWidget = NULL;
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
+ if (optionWidget!=NULL)
+ {
+ if (toolWidget!=NULL)
+ {
delete toolWidget;
toolWidget = NULL;
}
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LineBisectorOptions(optionWidget);
+ if (on==true && toolWidget==NULL)
+ {
+ toolWidget = new LineParallelOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
}
/**
- * Shows a widget for options for the action: "draw polygon"
+ * Shows a widget for options for the action: "draw line parallel through"
*/
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_LinePolygonOptions* toolWidget = NULL;
+ static LineParallelThroughOptions * toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LinePolygonOptions(optionWidget);
+ toolWidget = new LineParallelThroughOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
}
/**
- * Shows a widget for options for the action: "draw polygon2"
+ * Shows a widget for options for the action: "line angle"
*/
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_LinePolygon2Options* toolWidget = NULL;
+ static LineAngleOptions * toolWidget = NULL;
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
- delete toolWidget;
- toolWidget = NULL;
- }
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LinePolygon2Options(optionWidget);
- toolWidget->setAction(action, update);
- }
- }
-}
+ if (!optionWidget)
+ return;
-/**
- * Shows a widget for insert options.
- */
-void QG_DialogFactory::requestInsertOptions(RS_ActionInterface* action,
- bool on, bool update)
-{
- static QG_InsertOptions* toolWidget = NULL;
+ if (toolWidget)
+ {
+ delete toolWidget;
+ toolWidget = NULL;
+ }
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
- delete toolWidget;
- toolWidget = NULL;
- }
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_InsertOptions(optionWidget);
- toolWidget->setAction(action, update);
- }
- }
+ if (on)
+ {
+ toolWidget = new LineAngleOptions(optionWidget);
+ toolWidget->setAction(action, update);
+ }
}
/**
- * Shows a widget for image options.
+ * Shows a widget for options for the action: "line relative angle"
*/
-void QG_DialogFactory::requestImageOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_ImageOptions* toolWidget = NULL;
+ static LineRelAngleOptions * toolWidget = NULL;
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
- delete toolWidget;
- toolWidget = NULL;
- }
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_ImageOptions(optionWidget);
- toolWidget->setAction(action, update);
- }
- }
-}
+ if (!optionWidget)
+ return;
-/**
- * Shows a widget for 'snap to a point with a given distance' options.
- */
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
-{
- static QG_SnapDistOptions* toolWidget = NULL;
+ if (toolWidget)
+ {
+ delete toolWidget;
+ toolWidget = NULL;
+ }
- if (optionWidget!=NULL) {
- if (toolWidget!=NULL) {
- delete toolWidget;
- toolWidget = NULL;
- }
- if (on==true && toolWidget==NULL) {
- toolWidget = new QG_SnapDistOptions(optionWidget);
- toolWidget->setDist(&dist);
- }
- }
+ if (on)
+ {
+ toolWidget = new LineRelAngleOptions(optionWidget);
+ toolWidget->setAction(action, update);
+ }
}
/**
- * Shows a widget for 'snap to a point with a given distance' options.
+ * Shows a widget for options for the action: "line angle"
*/
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_MoveRotateOptions* toolWidget = NULL;
+ static LineBisectorOptions * toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_MoveRotateOptions(optionWidget);
+ toolWidget = new LineBisectorOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
}
/**
- * Shows a widget for rounding options.
+ * Shows a widget for options for the action: "draw polygon"
*/
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface * action, bool on, bool update)
{
- static QG_RoundOptions* toolWidget = NULL;
+ static LinePolygonOptions * toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_RoundOptions(optionWidget);
+ toolWidget = new LinePolygonOptions(optionWidget);
toolWidget->setAction(action, update);
}
}
}
/**
- * Shows a widget for library insert options.
+ * Shows a widget for options for the action: "draw polygon2"
*/
-void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action,
- bool on, bool update)
+void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface * action, bool on, bool update)
{
- static QG_LibraryInsertOptions* toolWidget = NULL;
+ static LinePolygon2Options * toolWidget = NULL;
if (optionWidget!=NULL) {
if (toolWidget!=NULL) {
toolWidget = NULL;
}
if (on==true && toolWidget==NULL) {
- toolWidget = new QG_LibraryInsertOptions(optionWidget);
+ toolWidget = new LinePolygon2Options(optionWidget);
toolWidget->setAction(action, update);
}
}
}
-#else
-void QG_DialogFactory::requestLineParallelOptions(RS_ActionInterface * action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLineBisectorOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action, bool on, bool update)
-{
-}
-
-void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action, bool on, bool update)
-{
-}
/**
* Shows a widget for arc options.
}
}
-void QG_DialogFactory::requestSnapDistOptions(double& dist, bool on)
+/**
+ * Shows a widget for 'snap to a point with a given distance' options.
+ */
+void QG_DialogFactory::requestSnapDistOptions(double & dist, bool on)
{
+ static SnapDistOptions * toolWidget = NULL;
+
+ if (!optionWidget)
+ return;
+
+ if (toolWidget)
+ {
+ delete toolWidget;
+ toolWidget = NULL;
+ }
+
+ if (on)
+ {
+ toolWidget = new SnapDistOptions(optionWidget);
+ toolWidget->setDist(&dist);
+ }
}
-void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action, bool on, bool update)
+/**
+ * Shows a widget for 'snap to a point with a given distance' options.
+ */
+void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface * action, bool on, bool update)
{
+ static MoveRotateOptions * toolWidget = NULL;
+
+ if (!optionWidget)
+ return;
+
+ if (toolWidget)
+ {
+ delete toolWidget;
+ toolWidget = NULL;
+ }
+
+ if (on)
+ {
+ toolWidget = new MoveRotateOptions(optionWidget);
+ toolWidget->setAction(action, update);
+ }
}
/**
}
}
-void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, bool on, bool update)
+/**
+ * Shows a widget for rounding options.
+ */
+void QG_DialogFactory::requestRoundOptions(RS_ActionInterface * action, bool on, bool update)
{
+ static RoundOptions * toolWidget = NULL;
+
+ if (!optionWidget)
+ return;
+
+ if (toolWidget)
+ {
+ delete toolWidget;
+ toolWidget = NULL;
+ }
+
+ if (on)
+ {
+ toolWidget = new RoundOptions(optionWidget);
+ toolWidget->setAction(action, update);
+ }
}
void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action, bool on, bool update)