From 95a6dd28327cbd80f9221b1457e7edd4e7230169 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 10 Jun 2010 22:13:42 +0000 Subject: [PATCH] Added more missing forms... --- architektonas.pro | 40 ++- src/forms/arctangentialoptions.cpp | 55 +--- src/forms/dimoptions.cpp | 139 ++++++++++ src/forms/dimoptions.h | 36 +++ src/forms/lineangleoptions.cpp | 137 ++++++++++ src/forms/lineangleoptions.h | 35 +++ src/forms/linebisectoroptions.cpp | 96 +++++++ src/forms/linebisectoroptions.h | 32 +++ src/forms/lineparalleloptions.cpp | 96 +++++++ src/forms/lineparalleloptions.h | 32 +++ src/forms/lineparallelthroughoptions.cpp | 78 ++++++ src/forms/lineparallelthroughoptions.h | 29 ++ src/forms/linepolygon2options.cpp | 79 ++++++ src/forms/linepolygon2options.h | 29 ++ src/forms/linepolygonoptions.cpp | 79 ++++++ src/forms/linepolygonoptions.h | 29 ++ src/forms/linerelangleoptions.cpp | 117 +++++++++ src/forms/linerelangleoptions.h | 32 +++ src/forms/moverotateoptions.cpp | 80 ++++++ src/forms/moverotateoptions.h | 29 ++ src/forms/roundoptions.cpp | 96 +++++++ src/forms/roundoptions.h | 31 +++ src/forms/snapdistoptions.cpp | 70 +++-- src/forms/snapdistoptions.h | 108 +------- src/widgets/qg_dialogfactory.cpp | 321 +++++++++++------------ 25 files changed, 1559 insertions(+), 346 deletions(-) create mode 100644 src/forms/dimoptions.cpp create mode 100644 src/forms/dimoptions.h create mode 100644 src/forms/lineangleoptions.cpp create mode 100644 src/forms/lineangleoptions.h create mode 100644 src/forms/linebisectoroptions.cpp create mode 100644 src/forms/linebisectoroptions.h create mode 100644 src/forms/lineparalleloptions.cpp create mode 100644 src/forms/lineparalleloptions.h create mode 100644 src/forms/lineparallelthroughoptions.cpp create mode 100644 src/forms/lineparallelthroughoptions.h create mode 100644 src/forms/linepolygon2options.cpp create mode 100644 src/forms/linepolygon2options.h create mode 100644 src/forms/linepolygonoptions.cpp create mode 100644 src/forms/linepolygonoptions.h create mode 100644 src/forms/linerelangleoptions.cpp create mode 100644 src/forms/linerelangleoptions.h create mode 100644 src/forms/moverotateoptions.cpp create mode 100644 src/forms/moverotateoptions.h create mode 100644 src/forms/roundoptions.cpp create mode 100644 src/forms/roundoptions.h diff --git a/architektonas.pro b/architektonas.pro index b1d87fb..3eaaef6 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -437,10 +437,20 @@ HEADERS += \ 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 \ @@ -499,10 +509,20 @@ SOURCES += \ 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 \ @@ -546,21 +566,21 @@ SOURCES += \ # 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 # diff --git a/src/forms/arctangentialoptions.cpp b/src/forms/arctangentialoptions.cpp index 54a92f2..afce7fa 100644 --- a/src/forms/arctangentialoptions.cpp +++ b/src/forms/arctangentialoptions.cpp @@ -18,14 +18,13 @@ #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); @@ -37,54 +36,6 @@ ArcTangentialOptions::ArcTangentialOptions(QToolBar * parent/*= 0*/, Qt::WindowF // 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() diff --git a/src/forms/dimoptions.cpp b/src/forms/dimoptions.cpp new file mode 100644 index 0000000..6255912 --- /dev/null +++ b/src/forms/dimoptions.cpp @@ -0,0 +1,139 @@ +// 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 +// +// 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); +} diff --git a/src/forms/dimoptions.h b/src/forms/dimoptions.h new file mode 100644 index 0000000..c588693 --- /dev/null +++ b/src/forms/dimoptions.h @@ -0,0 +1,36 @@ +#ifndef __DIMOPTIONS_H__ +#define __DIMOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/lineangleoptions.cpp b/src/forms/lineangleoptions.cpp new file mode 100644 index 0000000..3695d98 --- /dev/null +++ b/src/forms/lineangleoptions.cpp @@ -0,0 +1,137 @@ +// 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 +// +// 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); +} diff --git a/src/forms/lineangleoptions.h b/src/forms/lineangleoptions.h new file mode 100644 index 0000000..a7b0978 --- /dev/null +++ b/src/forms/lineangleoptions.h @@ -0,0 +1,35 @@ +#ifndef __LINEANGLEOPTIONS_H__ +#define __LINEANGLEOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/linebisectoroptions.cpp b/src/forms/linebisectoroptions.cpp new file mode 100644 index 0000000..ac7a8db --- /dev/null +++ b/src/forms/linebisectoroptions.cpp @@ -0,0 +1,96 @@ +// 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 +// +// 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); +} diff --git a/src/forms/linebisectoroptions.h b/src/forms/linebisectoroptions.h new file mode 100644 index 0000000..ad64347 --- /dev/null +++ b/src/forms/linebisectoroptions.h @@ -0,0 +1,32 @@ +#ifndef __LINEBISECTOROPTIONS_H__ +#define __LINEBISECTOROPTIONS_H__ + +#include + +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__ diff --git a/src/forms/lineparalleloptions.cpp b/src/forms/lineparalleloptions.cpp new file mode 100644 index 0000000..f55bf96 --- /dev/null +++ b/src/forms/lineparalleloptions.cpp @@ -0,0 +1,96 @@ +// 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 +// +// 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); +} diff --git a/src/forms/lineparalleloptions.h b/src/forms/lineparalleloptions.h new file mode 100644 index 0000000..cac77f5 --- /dev/null +++ b/src/forms/lineparalleloptions.h @@ -0,0 +1,32 @@ +#ifndef __LINEPARALLELOPTIONS_H__ +#define __LINEPARALLELOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/lineparallelthroughoptions.cpp b/src/forms/lineparallelthroughoptions.cpp new file mode 100644 index 0000000..d5f994e --- /dev/null +++ b/src/forms/lineparallelthroughoptions.cpp @@ -0,0 +1,78 @@ +// 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 +// +// 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); +} diff --git a/src/forms/lineparallelthroughoptions.h b/src/forms/lineparallelthroughoptions.h new file mode 100644 index 0000000..925cd3d --- /dev/null +++ b/src/forms/lineparallelthroughoptions.h @@ -0,0 +1,29 @@ +#ifndef __LINEPARALLELTHROUGHOPTIONS_H__ +#define __LINEPARALLELTHROUGHOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/linepolygon2options.cpp b/src/forms/linepolygon2options.cpp new file mode 100644 index 0000000..1468a1c --- /dev/null +++ b/src/forms/linepolygon2options.cpp @@ -0,0 +1,79 @@ +// 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 +// +// 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); +} diff --git a/src/forms/linepolygon2options.h b/src/forms/linepolygon2options.h new file mode 100644 index 0000000..968ced2 --- /dev/null +++ b/src/forms/linepolygon2options.h @@ -0,0 +1,29 @@ +#ifndef __LINEPOLYGON2OPTIONS_H__ +#define __LINEPOLYGON2OPTIONS_H__ + +#include + +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__ diff --git a/src/forms/linepolygonoptions.cpp b/src/forms/linepolygonoptions.cpp new file mode 100644 index 0000000..c0b42cd --- /dev/null +++ b/src/forms/linepolygonoptions.cpp @@ -0,0 +1,79 @@ +// 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 +// +// 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); +} diff --git a/src/forms/linepolygonoptions.h b/src/forms/linepolygonoptions.h new file mode 100644 index 0000000..8a0672b --- /dev/null +++ b/src/forms/linepolygonoptions.h @@ -0,0 +1,29 @@ +#ifndef __LINEPOLYGONOPTIONS_H__ +#define __LINEPOLYGONOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/linerelangleoptions.cpp b/src/forms/linerelangleoptions.cpp new file mode 100644 index 0000000..dc92c13 --- /dev/null +++ b/src/forms/linerelangleoptions.cpp @@ -0,0 +1,117 @@ +// 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 +// +// 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)); +} diff --git a/src/forms/linerelangleoptions.h b/src/forms/linerelangleoptions.h new file mode 100644 index 0000000..7623de6 --- /dev/null +++ b/src/forms/linerelangleoptions.h @@ -0,0 +1,32 @@ +#ifndef __LINERELANGLEOPTIONS_H__ +#define __LINERELANGLEOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/moverotateoptions.cpp b/src/forms/moverotateoptions.cpp new file mode 100644 index 0000000..4a257e7 --- /dev/null +++ b/src/forms/moverotateoptions.cpp @@ -0,0 +1,80 @@ +// 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 +// +// 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))); +} + diff --git a/src/forms/moverotateoptions.h b/src/forms/moverotateoptions.h new file mode 100644 index 0000000..e26dfd1 --- /dev/null +++ b/src/forms/moverotateoptions.h @@ -0,0 +1,29 @@ +#ifndef __MOVEROTATEOPTIONS_H__ +#define __MOVEROTATEOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/roundoptions.cpp b/src/forms/roundoptions.cpp new file mode 100644 index 0000000..8c72258 --- /dev/null +++ b/src/forms/roundoptions.cpp @@ -0,0 +1,96 @@ +// 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 +// +// 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())); + } +} + diff --git a/src/forms/roundoptions.h b/src/forms/roundoptions.h new file mode 100644 index 0000000..f261c83 --- /dev/null +++ b/src/forms/roundoptions.h @@ -0,0 +1,31 @@ +#ifndef __ROUNDOPTIONS_H__ +#define __ROUNDOPTIONS_H__ + +#include + +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__ diff --git a/src/forms/snapdistoptions.cpp b/src/forms/snapdistoptions.cpp index 9f932cf..7355ace 100644 --- a/src/forms/snapdistoptions.cpp +++ b/src/forms/snapdistoptions.cpp @@ -1,31 +1,65 @@ -/**************************************************************************** -** 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 +// +// 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); diff --git a/src/forms/snapdistoptions.h b/src/forms/snapdistoptions.h index e706998..07c7a64 100644 --- a/src/forms/snapdistoptions.h +++ b/src/forms/snapdistoptions.h @@ -1,112 +1,26 @@ -#ifndef QG_SNAPDISTOPTIONS_H -#define QG_SNAPDISTOPTIONS_H +#ifndef __SNAPDISTOPTIONS_H__ +#define __SNAPDISTOPTIONS_H__ -#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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(4), static_cast(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(0), static_cast(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__ diff --git a/src/widgets/qg_dialogfactory.cpp b/src/widgets/qg_dialogfactory.cpp index 1238d8e..97b28e9 100644 --- a/src/widgets/qg_dialogfactory.cpp +++ b/src/widgets/qg_dialogfactory.cpp @@ -59,20 +59,20 @@ #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" @@ -93,10 +93,20 @@ #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" @@ -924,7 +934,7 @@ them over and over. May need to do some more refactoring based on this idea... 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) { @@ -935,7 +945,7 @@ void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool } if (on && toolWidget == NULL) { - toolWidget = new QG_PolylineOptions(optionWidget); + toolWidget = new PolylineOptions(optionWidget); toolWidget->setAction(action, update); } } @@ -944,31 +954,12 @@ void QG_DialogFactory::requestPolylineOptions(RS_ActionInterface * action, bool #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) { @@ -976,19 +967,19 @@ void QG_DialogFactory::requestLineParallelThroughOptions(RS_ActionInterface* act 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) { @@ -996,20 +987,19 @@ void QG_DialogFactory::requestLineAngleOptions(RS_ActionInterface* action, 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) { @@ -1017,40 +1007,40 @@ void QG_DialogFactory::requestLineRelAngleOptions(RS_ActionInterface* action, 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) { @@ -1058,98 +1048,64 @@ void QG_DialogFactory::requestLinePolygonOptions(RS_ActionInterface* action, 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) { @@ -1157,19 +1113,18 @@ void QG_DialogFactory::requestMoveRotateOptions(RS_ActionInterface* action, 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) { @@ -1177,19 +1132,18 @@ void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, 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) { @@ -1197,39 +1151,11 @@ void QG_DialogFactory::requestLibraryInsertOptions(RS_ActionInterface* action, 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. @@ -1394,12 +1320,50 @@ void QG_DialogFactory::requestDimLinearOptions(RS_ActionInterface * action, bool } } -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); + } } /** @@ -1448,8 +1412,27 @@ void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on, } } -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) -- 2.37.2