From: Shamus Hammons Date: Wed, 9 Jun 2010 04:26:48 +0000 (+0000) Subject: Start of bringing back missing forms/dialogs X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f46c180da0806c9c263e6d87d0f1404632402da;p=architektonas Start of bringing back missing forms/dialogs --- diff --git a/architektonas.pro b/architektonas.pro index 7c4f4ba..48889a5 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -404,6 +404,9 @@ SOURCES += \ src/actions/rs_actionzoomwindow.cpp HEADERS += \ + src/forms/arcoptions.h \ + src/forms/arctangentialoptions.h \ + src/forms/beveloptions.h \ src/forms/blockdialog.h \ src/forms/cadtoolbar.h \ src/forms/cadtoolbararcs.h \ @@ -419,6 +422,7 @@ HEADERS += \ src/forms/cadtoolbarselect.h \ src/forms/cadtoolbarsnap.h \ src/forms/cadtoolbarsplines.h \ + src/forms/circleoptions.h \ src/forms/commandwidget.h \ src/forms/coordinatewidget.h \ src/forms/dlgattributes.h \ @@ -458,6 +462,9 @@ HEADERS += \ src/widgets/qg_widthbox.h SOURCES += \ + src/forms/arcoptions.cpp \ + src/forms/arctangentialoptions.cpp \ + src/forms/beveloptions.cpp \ src/forms/blockdialog.cpp \ src/forms/cadtoolbar.cpp \ src/forms/cadtoolbararcs.cpp \ @@ -473,6 +480,7 @@ SOURCES += \ src/forms/cadtoolbarselect.cpp \ src/forms/cadtoolbarsnap.cpp \ src/forms/cadtoolbarsplines.cpp \ + src/forms/circleoptions.cpp \ src/forms/commandwidget.cpp \ src/forms/coordinatewidget.cpp \ src/forms/dlgattributes.cpp \ @@ -511,10 +519,6 @@ SOURCES += \ #The following line was changed from FORMS to FORMS3 by qt3to4 #FORMS3 = \ -# ui/qg_arcoptions.ui \ -# ui/qg_arctangentialoptions.ui \ -# ui/qg_beveloptions.ui \ -# ui/qg_circleoptions.ui \ # ui/qg_dimensionlabeleditor.ui \ # ui/qg_dimlinearoptions.ui \ # ui/qg_dimoptions.ui \ @@ -547,9 +551,11 @@ SOURCES += \ # ui/qg_roundoptions.ui \ # ui/qg_snapdistoptions.ui \ # ui/qg_splineoptions.ui \ -# ui/qg_textoptions.ui \ # ui/qg_trimamountoptions.ui +# src/forms/arcoptions.ui \ +# src/forms/arctangentialoptions.ui \ +# FORMS = \ src/forms/blockdialog.ui \ src/forms/cadtoolbar.ui \ diff --git a/src/base/rs_eventhandler.cpp b/src/base/rs_eventhandler.cpp index 2961ff7..260998a 100644 --- a/src/base/rs_eventhandler.cpp +++ b/src/base/rs_eventhandler.cpp @@ -326,7 +326,6 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e) if (actionIndex >= 0 && currentActions[actionIndex] != NULL && !currentActions[actionIndex]->isFinished()) { -// int commaPos = cmd.find('<'); int commaPos = cmd.indexOf('<'); bool ok1, ok2; double r = RS_Math::eval(cmd.left(commaPos), &ok1); diff --git a/src/base/rs_snapper.cpp b/src/base/rs_snapper.cpp index cc58b1a..016b48d 100644 --- a/src/base/rs_snapper.cpp +++ b/src/base/rs_snapper.cpp @@ -464,7 +464,7 @@ void RS_Snapper::resume() void RS_Snapper::hideOptions() { if (snapMode == RS2::SnapDist) - if (RS_DIALOGFACTORY!=NULL) + if (RS_DIALOGFACTORY != NULL) RS_DIALOGFACTORY->requestSnapDistOptions(distance, false); } diff --git a/src/forms/arcoptions.cpp b/src/forms/arcoptions.cpp new file mode 100644 index 0000000..0f794e7 --- /dev/null +++ b/src/forms/arcoptions.cpp @@ -0,0 +1,84 @@ +// arcoptions.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/08/2010 Created this file. :-) +// JLH 06/08/2010 Fixed problem with widget not showing up in toolbar. +// + +#include "arcoptions.h" + +#include "rs_actiondrawarc.h" +#include "rs_actioninterface.h" +#include "settings.h" + +ArcOptions::ArcOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): + QWidget(parent, flags) +{ + QHBoxLayout * layout = new QHBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + + rbPos = new QRadioButton(this); + rbNeg = new QRadioButton(this); + + rbPos->setIcon(QIcon(":/res/qg_dirpos.xpm")); + rbNeg->setIcon(QIcon(":/res/qg_dirneg.xpm")); + + layout->addWidget(rbPos); + layout->addWidget(rbNeg); + + connect(rbPos, SIGNAL(toggled(bool)), this, SLOT(updateDirection(bool))); + connect(rbNeg, SIGNAL(toggled(bool)), this, SLOT(updateDirection(bool))); + + // 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); +} + +ArcOptions::~ArcOptions() +{ + settings.beginGroup("Draw"); + settings.setValue("ArcReversed", rbNeg->isChecked()); + settings.endGroup(); +} + +void ArcOptions::setAction(RS_ActionInterface * a, bool update) +{ + if (a != NULL && a->rtti() == RS2::ActionDrawArc) + { + action = (RS_ActionDrawArc *)a; + + bool reversed; + + if (update) + reversed = action->isReversed(); + else + { + settings.beginGroup("Draw"); + reversed = settings.value("ArcReversed", false).toBool(); + settings.endGroup(); + action->setReversed(reversed); + } + + rbNeg->setChecked(reversed); + } + else + { + RS_DEBUG->print(RS_Debug::D_ERROR, "QG_ArcOptions::setAction: wrong action type"); + action = NULL; + } +} + +void ArcOptions::updateDirection(bool /*pos*/) +{ + if (action != NULL) + action->setReversed(rbNeg->isChecked()); +} diff --git a/src/forms/arcoptions.h b/src/forms/arcoptions.h new file mode 100644 index 0000000..66f2eda --- /dev/null +++ b/src/forms/arcoptions.h @@ -0,0 +1,31 @@ +#ifndef __ARCOPTIONS_H__ +#define __ARCOPTIONS_H__ + +//#include "ui_arcoptions.h" +#include + +class RS_ActionDrawArc; +class RS_ActionInterface; + +class ArcOptions: public QWidget +{ + Q_OBJECT + + public: + ArcOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); + ~ArcOptions(); + + public slots: + void setAction(RS_ActionInterface * a, bool update); + void updateDirection(bool); + + protected: + RS_ActionDrawArc * action; + QRadioButton * rbPos; + QRadioButton * rbNeg; + + private: +// Ui::ArcOptions ui; +}; + +#endif // __ARCOPTIONS_H__ diff --git a/src/forms/arctangentialoptions.cpp b/src/forms/arctangentialoptions.cpp new file mode 100644 index 0000000..54a92f2 --- /dev/null +++ b/src/forms/arctangentialoptions.cpp @@ -0,0 +1,143 @@ +// arctangentialoptions.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/08/2010 Created this file. :-) +// + +#include "arctangentialoptions.h" + +#include "rs_actiondrawarctangential.h" +#include "settings.h" + +ArcTangentialOptions::ArcTangentialOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): + QWidget(parent, flags) +{ +#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); + layout->addWidget(leRadius); + + connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateRadius(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); +#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() +{ + settings.beginGroup("Draw"); + settings.setValue("ArcTangentialRadius", leRadius->text()); + settings.endGroup(); +} + +void ArcTangentialOptions::setAction(RS_ActionInterface * a, bool update) +{ + if (a != NULL && a->rtti() == RS2::ActionDrawArcTangential) + { + action = (RS_ActionDrawArcTangential *)a; + + QString sr; + + if (update) + sr = QString("%1").arg(action->getRadius()); + else + { + settings.beginGroup("Draw"); + sr = settings.value("ArcTangentialRadius", "1.0").toString(); + settings.endGroup(); + action->setRadius(sr.toDouble()); + } + leRadius->setText(sr); + } + else + { + RS_DEBUG->print(RS_Debug::D_ERROR, + "ArcTangentialOptions::setAction: wrong action type"); + action = NULL; + } +} + +/*void ArcTangentialOptions::init() { + data = NULL; + RS_SETTINGS->beginGroup("/Draw"); + bool reversed = RS_SETTINGS->readNumEntry("/ArcReversed", 0); + RS_SETTINGS->endGroup(); + + rbNeg->setChecked(reversed); + }*/ + +/*void ArcTangentialOptions::setData(RS_ArcData* d) { + data = d; + updateDirection(false); + }*/ + +void ArcTangentialOptions::updateRadius(const QString & s) +{ + if (action != NULL) + action->setRadius(RS_Math::eval(s)); +} + diff --git a/src/forms/arctangentialoptions.h b/src/forms/arctangentialoptions.h new file mode 100644 index 0000000..813116f --- /dev/null +++ b/src/forms/arctangentialoptions.h @@ -0,0 +1,32 @@ +#ifndef __ARCTANGENTIALOPTIONS_H__ +#define __ARCTANGENTIALOPTIONS_H__ + +//#include "ui_arctangentialoptions.h" +#include + +class RS_ActionDrawArcTangential; +class RS_ActionInterface; + +class ArcTangentialOptions: public QWidget +{ + Q_OBJECT + + public: + ArcTangentialOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); + ~ArcTangentialOptions(); + + public slots: + void setAction(RS_ActionInterface * a, bool update); + void updateRadius(const QString & s); + + protected: + RS_ActionDrawArcTangential * action; + QLabel * lRadius; + QLineEdit * leRadius; + QFrame * sep1; + + private: +// Ui::ArcTangentialOptions ui; +}; + +#endif // __ARCTANGENTIALOPTIONS_H__ diff --git a/src/forms/beveloptions.cpp b/src/forms/beveloptions.cpp new file mode 100644 index 0000000..94887b4 --- /dev/null +++ b/src/forms/beveloptions.cpp @@ -0,0 +1,109 @@ +// beveloptions.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/08/2010 Created this file. :-) +// + +#include "beveloptions.h" + +#include "rs.h" +#include "rs_actioninterface.h" +#include "rs_actionmodifybevel.h" +#include "settings.h" + +BevelOptions::BevelOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): + QWidget(parent, flags), + cbTrim(new QCheckBox(tr("Trim"))), + lLength1(new QLabel(tr("Length 1:"))), + lLength2(new QLabel(tr("Length 2:"))), + leLength1(new QLineEdit(this)), + leLength2(new QLineEdit(this)), + sep1(new QFrame(this)) +{ + QHBoxLayout * layout = new QHBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); + + leLength1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored)); + leLength2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored)); + sep1->setFrameShape(QFrame::VLine); + sep1->setFrameShadow(QFrame::Sunken); + + layout->addWidget(cbTrim); + layout->addWidget(sep1); + layout->addWidget(lLength1); + layout->addWidget(leLength1); + layout->addWidget(lLength2); + layout->addWidget(leLength2); + + connect(cbTrim, SIGNAL(toggled(bool)), this, SLOT(updateData())); + connect(leLength1, SIGNAL(textChanged(QString)), this, SLOT(updateData())); + connect(leLength2, 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); +} + +BevelOptions::~BevelOptions() +{ + settings.beginGroup("Modify"); + settings.setValue("BevelLength1", leLength1->text()); + settings.setValue("BevelLength2", leLength2->text()); + settings.setValue("BevelTrim", cbTrim->isChecked()); + settings.endGroup(); +} + +void BevelOptions::setAction(RS_ActionInterface * a, bool update) +{ + if (a != NULL && a->rtti() == RS2::ActionModifyBevel) + { + action = (RS_ActionModifyBevel *)a; + + QString sd1; + QString sd2; + bool st; + + if (update) + { + sd1 = QString("%1").arg(action->getLength1()); + sd2 = QString("%1").arg(action->getLength2()); + st = action->isTrimOn(); + } + else + { + settings.beginGroup("Modify"); + sd1 = settings.value("BevelLength1", "1.0").toString(); + sd2 = settings.value("BevelLength2", "1.0").toString(); + st = settings.value("BevelTrim", true).toBool(); + settings.endGroup(); + } + + leLength1->setText(sd1); + leLength2->setText(sd2); + cbTrim->setChecked(st); + } + else + { + RS_DEBUG->print(RS_Debug::D_ERROR, "BevelOptions::setAction: wrong action type"); + action = NULL; + } +} + +void BevelOptions::updateData() +{ + if (action != NULL) + { + action->setTrim(cbTrim->isChecked()); + action->setLength1(RS_Math::eval(leLength1->text())); + action->setLength2(RS_Math::eval(leLength2->text())); + } +} diff --git a/src/forms/beveloptions.h b/src/forms/beveloptions.h new file mode 100644 index 0000000..f98ead0 --- /dev/null +++ b/src/forms/beveloptions.h @@ -0,0 +1,33 @@ +#ifndef __BEVELOPTIONS_H__ +#define __BEVELOPTIONS_H__ + +#include + +class RS_ActionInterface; +class RS_ActionModifyBevel; + +class BevelOptions: public QWidget +{ + Q_OBJECT + + public: + BevelOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); + ~BevelOptions(); + + public slots: + void setAction(RS_ActionInterface * a, bool update); + void updateData(); + + protected: + RS_ActionModifyBevel * action; + + private: + QCheckBox * cbTrim; + QLabel * lLength1; + QLabel * lLength2; + QLineEdit * leLength1; + QLineEdit * leLength2; + QFrame * sep1; +}; + +#endif // __BEVELOPTIONS_H__ diff --git a/src/forms/cadtoolbar.cpp b/src/forms/cadtoolbar.cpp index 07a7aa3..4bfe299 100644 --- a/src/forms/cadtoolbar.cpp +++ b/src/forms/cadtoolbar.cpp @@ -1,5 +1,6 @@ // cadtoolbar.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 @@ -35,6 +36,9 @@ CadToolBar::CadToolBar(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): tbSelect(NULL), tbPolylines(NULL) { ui.setupUi(this); +//hm. here maybe? +if (parent) + ((QToolBar *)parent)->addWidget(this); } CadToolBar::~CadToolBar() diff --git a/src/forms/cadtoolbarmain.cpp b/src/forms/cadtoolbarmain.cpp index b2111e9..3cc4aa2 100644 --- a/src/forms/cadtoolbarmain.cpp +++ b/src/forms/cadtoolbarmain.cpp @@ -1,5 +1,6 @@ // cadtoolbarmain.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 @@ -16,6 +17,8 @@ #include "cadtoolbar.h" #include "qg_actionhandler.h" +#include "createqtactions.h" + CadToolBarMain::CadToolBarMain(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): QWidget(parent, flags) { @@ -25,6 +28,11 @@ CadToolBarMain::CadToolBarMain(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= //#ifndef RS_PROF // ui.bMenuPolyline->hide(); //#endif + +//hm. +//well, it looks like something else is messing with this... +// if (parent) +// ((QToolBar *)parent)->addWidget(this); } CadToolBarMain::~CadToolBarMain() @@ -35,12 +43,12 @@ void CadToolBarMain::setCadToolBar(CadToolBar * tb) { QG_ActionHandler * ah = NULL; - if (tb != NULL) + if (tb) ah = tb->getActionHandler(); else RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarMain::setCadToolBar(): No valid toolbar set."); - if (ah != NULL) + if (ah) { connect(ui.bMenuPoint, SIGNAL(clicked()), ah, SLOT(slotDrawPoint())); connect(ui.bMenuLine, SIGNAL(clicked()), tb, SLOT(showToolBarLines())); diff --git a/src/forms/cadtoolbarmain.ui b/src/forms/cadtoolbarmain.ui index 3f11b24..b20cf86 100644 --- a/src/forms/cadtoolbarmain.ui +++ b/src/forms/cadtoolbarmain.ui @@ -7,11 +7,11 @@ 0 0 86 - 336 + 224 - + 0 0 @@ -19,15 +19,27 @@ 56 - 336 + 200 Main + + 0 + + + 0 + + + + 0 + 0 + + Points @@ -38,10 +50,22 @@ :/res/qg_menupoint.xpm:/res/qg_menupoint.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Lines" @@ -52,10 +76,22 @@ :/res/qg_menuline.xpm:/res/qg_menuline.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Arcs" @@ -66,10 +102,22 @@ :/res/qg_menuarc.xpm:/res/qg_menuarc.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Circles" @@ -80,10 +128,22 @@ :/res/qg_menucircle.xpm:/res/qg_menucircle.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Ellipses" @@ -94,10 +154,22 @@ :/res/qg_menuellipse.xpm:/res/qg_menuellipse.xpm + + + 18 + 18 + + + + + 0 + 0 + + Splines @@ -108,10 +180,22 @@ :/res/qg_menuspline.xpm:/res/qg_menuspline.xpm + + + 18 + 18 + + + + + 0 + 0 + + Polylines @@ -122,12 +206,18 @@ :/res/qg_menupolyline.xpm:/res/qg_menupolyline.xpm + + + 18 + 18 + + - + 0 0 @@ -142,12 +232,18 @@ :/res/qg_menutext.xpm:/res/qg_menutext.xpm + + + 18 + 18 + + - + 0 0 @@ -162,12 +258,18 @@ :/res/qg_menudim.png:/res/qg_menudim.png + + + 18 + 18 + + - + 0 0 @@ -182,10 +284,22 @@ :/res/qg_menuhatch.xpm:/res/qg_menuhatch.xpm + + + 18 + 18 + + + + + 0 + 0 + + Raster Image @@ -196,10 +310,22 @@ :/res/qg_menuimage.xpm:/res/qg_menuimage.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Edit" @@ -210,10 +336,22 @@ :/res/qg_menuedit.xpm:/res/qg_menuedit.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Measure" @@ -224,10 +362,22 @@ :/res/qg_menumeasure.xpm:/res/qg_menumeasure.xpm + + + 18 + 18 + + + + + 0 + 0 + + Create Block @@ -238,10 +388,22 @@ :/res/qg_menublock.xpm:/res/qg_menublock.xpm + + + 18 + 18 + + + + + 0 + 0 + + Show menu "Select" @@ -252,29 +414,22 @@ :/res/qg_menuselect.xpm:/res/qg_menuselect.xpm - - - - - - Qt::Vertical - - + - 20 - 40 + 18 + 18 - + - + Qt::Horizontal - 40 + 8 20 diff --git a/src/forms/circleoptions.cpp b/src/forms/circleoptions.cpp new file mode 100644 index 0000000..9a0f65e --- /dev/null +++ b/src/forms/circleoptions.cpp @@ -0,0 +1,82 @@ +// circleoptions.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/08/2010 Created this file. :-) +// + +#include "circleoptions.h" + +#include "rs.h" +#include "rs_actioninterface.h" +#include "rs_actiondrawcirclecr.h" +#include "settings.h" + +CircleOptions::CircleOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): + QWidget(parent, flags) +{ + 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); + layout->addWidget(leRadius); + + connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateRadius(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); +} + +CircleOptions::~CircleOptions() +{ + settings.beginGroup("Draw"); + settings.setValue("CircleRadius", leRadius->text()); + settings.endGroup(); +} + +void CircleOptions::setAction(RS_ActionInterface * a, bool update) +{ + if (a != NULL && a->rtti() == RS2::ActionDrawCircleCR) + { + action = (RS_ActionDrawCircleCR *)a; + + QString sr; + + if (update) + sr = QString("%1").arg(action->getRadius()); + else + { + settings.beginGroup("Draw"); + sr = settings.value("CircleRadius", "1.0").toString(); + settings.endGroup(); + action->setRadius(sr.toDouble()); + } + + leRadius->setText(sr); + } + else + { + RS_DEBUG->print(RS_Debug::D_ERROR, + "CircleOptions::setAction: wrong action type"); + action = NULL; + } +} + +void CircleOptions::updateRadius(const QString & r) +{ + if (action != NULL) + action->setRadius(RS_Math::eval(r)); +} diff --git a/src/forms/circleoptions.h b/src/forms/circleoptions.h new file mode 100644 index 0000000..3af5d51 --- /dev/null +++ b/src/forms/circleoptions.h @@ -0,0 +1,29 @@ +#ifndef __CIRCLEOPTIONS_H__ +#define __CIRCLEOPTIONS_H__ + +#include + +class RS_ActionInterface; +class RS_ActionDrawCircleCR; + +class CircleOptions: public QWidget +{ + Q_OBJECT + + public: + CircleOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); + ~CircleOptions(); + + public slots: + void setAction(RS_ActionInterface * a, bool update); + void updateRadius(const QString & r); + + protected: + RS_ActionDrawCircleCR * action; + + private: + QLabel * lRadius; + QLineEdit * leRadius; +}; + +#endif // __CIRCLEOPTIONS_H__ diff --git a/src/forms/lineoptions.cpp b/src/forms/lineoptions.cpp index c625973..289d85a 100644 --- a/src/forms/lineoptions.cpp +++ b/src/forms/lineoptions.cpp @@ -1,5 +1,6 @@ // lineoptions.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 @@ -17,10 +18,15 @@ #include "rs_actiondrawline.h" #include "rs_actioninterface.h" -LineOptions::LineOptions(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): +LineOptions::LineOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): QWidget(parent, flags), action(NULL) { ui.setupUi(this); + + // 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); } LineOptions::~LineOptions() @@ -42,12 +48,12 @@ void LineOptions::setAction(RS_ActionInterface * a) void LineOptions::close() { - if (action != NULL) + if (action) action->close(); } void LineOptions::undo() { - if (action != NULL) + if (action) action->undo(); } diff --git a/src/forms/lineoptions.h b/src/forms/lineoptions.h index 80009f4..59ae119 100644 --- a/src/forms/lineoptions.h +++ b/src/forms/lineoptions.h @@ -5,13 +5,14 @@ class RS_ActionDrawLine; class RS_ActionInterface; +class QToolBar; class LineOptions: public QWidget { Q_OBJECT public: - LineOptions(QWidget * parent = 0, Qt::WindowFlags flags = 0); + LineOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); ~LineOptions(); public slots: diff --git a/src/forms/printpreviewoptions.cpp b/src/forms/printpreviewoptions.cpp index 036a13c..a88bbf2 100644 --- a/src/forms/printpreviewoptions.cpp +++ b/src/forms/printpreviewoptions.cpp @@ -16,36 +16,42 @@ #include "rs.h" #include "rs_actioninterface.h" #include "rs_actionprintpreview.h" +#include "rs_debug.h" +#include "rs_math.h" -PrintPreviewOptions::PrintPreviewOptions(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): +//PrintPreviewOptions::PrintPreviewOptions(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): +PrintPreviewOptions::PrintPreviewOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): QWidget(parent, flags), updateDisabled(false) { imperialScales - << "1\" = 1\"" - << "1\" = 2\"" - << "1\" = 4\"" - << "1\" = 8\"" - << "1\" = 16\"" - << "1\" = 32\"" - << "1\" = 64\"" - << "1\" = 128\"" - << "1\" = 256\""; + << "1\" = 1\"" + << "1\" = 2\"" + << "1\" = 4\"" + << "1\" = 8\"" + << "1\" = 16\"" + << "1\" = 32\"" + << "1\" = 64\"" + << "1\" = 128\"" + << "1\" = 256\""; metricScales - << "1:1" << "1:2" << "1:5" << "1:10" - << "1:20" << "1:25" << "1:50" << "1:75" << "1:100" - << "1:125" << "1:150" << "1:175" << "1:200" - << "1:250" << "1:500" << "1:750" << "1:1000" - << "1:2500" << "1:5000" << "1:7500" << "1:10000" - << "1:25000" << "1:50000" << "1:75000" << "1:100000" - << "2:1" << "5:1" << "10:1" - << "20:1" << "25:1" << "50:1" << "75:1" << "100:1" - << "125:1" << "150:1" << "175:1" << "200:1" - << "250:1" << "500:1" << "750:1" << "1000:1" - << "2500:1" << "5000:1" << "7500:1" << "10000:1" - << "25000:1" << "50000:1" << "75000:1" << "100000:1"; + << "1:1" << "1:2" << "1:5" << "1:10" + << "1:20" << "1:25" << "1:50" << "1:75" << "1:100" + << "1:125" << "1:150" << "1:175" << "1:200" + << "1:250" << "1:500" << "1:750" << "1:1000" + << "1:2500" << "1:5000" << "1:7500" << "1:10000" + << "1:25000" << "1:50000" << "1:75000" << "1:100000" + << "2:1" << "5:1" << "10:1" + << "20:1" << "25:1" << "50:1" << "75:1" << "100:1" + << "125:1" << "150:1" << "175:1" << "200:1" + << "250:1" << "500:1" << "750:1" << "1000:1" + << "2500:1" << "5000:1" << "7500:1" << "10000:1" + << "25000:1" << "50000:1" << "75000:1" << "100000:1"; ui.setupUi(this); + + if (parent) + parent->addWidget(this); } PrintPreviewOptions::~PrintPreviewOptions() @@ -58,7 +64,7 @@ PrintPreviewOptions::~PrintPreviewOptions() */ } -void PrintPreviewOptions::setAction(RS_ActionInterface* a, bool/*update*/) +void PrintPreviewOptions::setAction(RS_ActionInterface * a, bool/*update*/) { if (a != NULL && a->rtti() == RS2::ActionPrintPreview) { @@ -145,7 +151,6 @@ void PrintPreviewOptions::scale(const QString & s) { bool ok1 = false; bool ok2 = false; -// int i = s.find(':'); int i = s.indexOf(':'); double n = s.left(i).toDouble(&ok1); double d = s.mid(i + 1).toDouble(&ok2); @@ -156,7 +161,6 @@ void PrintPreviewOptions::scale(const QString & s) else if (s.contains('=')) { bool ok = false; -// int i = s.find('='); int i = s.indexOf('='); double d = s.mid(i + 2, s.length() - i - 3).toDouble(&ok); diff --git a/src/forms/printpreviewoptions.h b/src/forms/printpreviewoptions.h index 7c34ba5..3e9dd34 100644 --- a/src/forms/printpreviewoptions.h +++ b/src/forms/printpreviewoptions.h @@ -5,13 +5,15 @@ class RS_ActionInterface; class RS_ActionPrintPreview; +class QToolBar; class PrintPreviewOptions: public QWidget { Q_OBJECT public: - PrintPreviewOptions(QWidget * parent = 0, Qt::WindowFlags fl = 0); +// PrintPreviewOptions(QWidget * parent = 0, Qt::WindowFlags fl = 0); + PrintPreviewOptions(QToolBar * parent = 0, Qt::WindowFlags fl = 0); ~PrintPreviewOptions(); public slots: diff --git a/src/forms/printpreviewoptions.ui b/src/forms/printpreviewoptions.ui index 2193de4..096e7f2 100644 --- a/src/forms/printpreviewoptions.ui +++ b/src/forms/printpreviewoptions.ui @@ -66,8 +66,8 @@ - - xpm/qg_printbw.xpmxpm/qg_printbw.xpm + + :/res/qg_printbw.xpm:/res/qg_printbw.xpm true @@ -89,8 +89,8 @@ - - xpm/qg_printcenter.xpmxpm/qg_printcenter.xpm + + :/res/qg_printcenter.xpm:/res/qg_printcenter.xpm @@ -109,8 +109,8 @@ - - xpm/qg_printscale.xpmxpm/qg_printscale.xpm + + :/res/qg_printfit.xpm:/res/qg_printfit.xpm @@ -133,7 +133,9 @@ - + + + bCenter @@ -142,7 +144,7 @@ center() - 20 + 156 20 @@ -158,7 +160,7 @@ setBlackWhite(bool) - 20 + 126 20 @@ -206,7 +208,7 @@ fit() - 20 + 186 20 diff --git a/src/forms/res/architektonas.qrc b/src/forms/res/architektonas.qrc index 3675487..caca888 100644 --- a/src/forms/res/architektonas.qrc +++ b/src/forms/res/architektonas.qrc @@ -227,6 +227,7 @@ qg_tolerance2.xpm qg_widthbox.xpm redo2.png + splash.png splash_camexpert.xpm splash_qcad.xpm undo2.png diff --git a/src/forms/res/splash.png b/src/forms/res/splash.png new file mode 100644 index 0000000..06d72e3 Binary files /dev/null and b/src/forms/res/splash.png differ diff --git a/src/forms/textoptions.cpp b/src/forms/textoptions.cpp index 055de11..2190360 100644 --- a/src/forms/textoptions.cpp +++ b/src/forms/textoptions.cpp @@ -17,9 +17,15 @@ #include "rs_actiondrawtext.h" #include "rs_actioninterface.h" -TextOptions::TextOptions(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/) +TextOptions::TextOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): + QWidget(parent, flags) { ui.setupUi(this); + + // 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); } TextOptions::~TextOptions() diff --git a/src/forms/textoptions.h b/src/forms/textoptions.h index b997534..c701fd5 100644 --- a/src/forms/textoptions.h +++ b/src/forms/textoptions.h @@ -5,13 +5,14 @@ class RS_ActionInterface; class RS_ActionDrawText; +class QToolBar; class TextOptions: public QWidget { Q_OBJECT public: - TextOptions(QWidget * parent = 0, Qt::WindowFlags flags = 0); + TextOptions(QToolBar * parent = 0, Qt::WindowFlags flags = 0); ~TextOptions(); public slots: diff --git a/src/mainapp/main.cpp b/src/mainapp/main.cpp index 5bbc2eb..558465c 100644 --- a/src/mainapp/main.cpp +++ b/src/mainapp/main.cpp @@ -145,7 +145,8 @@ int main(int argc, char * argv[]) // QPixmap * pixmap = new QPixmap(qPixmapFromMimeSource(QC_CUSTOM_SPLASH)); //# else //// QPixmap * pixmap = new QPixmap(":/res/splash.xpm"); - QPixmap * pixmap = new QPixmap(":/res/splash_qcad.xpm"); +// QPixmap * pixmap = new QPixmap(":/res/splash_qcad.xpm"); + QPixmap * pixmap = new QPixmap(":/res/splash.png"); //# endif /* diff --git a/src/mainapp/qc_applicationwindow.cpp b/src/mainapp/qc_applicationwindow.cpp index 1c76255..9b173a3 100644 --- a/src/mainapp/qc_applicationwindow.cpp +++ b/src/mainapp/qc_applicationwindow.cpp @@ -17,7 +17,6 @@ #include "qc_applicationwindow.h" #include -#include "rs_application.h" #include "rs_actiondrawlinefree.h" #include "rs_actionprintpreview.h" #include "rs_creation.h" @@ -2972,19 +2971,6 @@ void QC_ApplicationWindow::slotScriptRun() void QC_ApplicationWindow::slotHelpAbout() { RS_DEBUG->print("QC_ApplicationWindow::slotHelpAbout()"); - - QString edition; - -#ifdef RS_DEMO - //demo; // = " [Demo]"; -#else -#ifdef RS_PROF - edition = " [Professional]"; -#else - edition = " [Community Edition]"; -#endif -#endif - QStringList modules; #ifdef RS_CAM @@ -3003,7 +2989,6 @@ void QC_ApplicationWindow::slotHelpAbout() modulesString = tr("None"); QMessageBox box(this); -// box.setCaption(tr("About...")); box.setWindowTitle(tr("About...")); box.setText(QString("") + // no center for main stream QCad #ifdef QC_ABOUT_HEADER @@ -3013,16 +2998,14 @@ void QC_ApplicationWindow::slotHelpAbout() //FAIL "

"+ QC_APPNAME+ "

" + "

Architektonas

" + #endif - tr("Version: %1 %2").arg(QC_VERSION).arg(edition) + "
" + + tr("Version: %1").arg("1.0.0") + "
" + tr("Date: %1").arg(__DATE__) + "
" + - QString("(c) 2001-2005 by RibbonSoft,
Andrew Mustun") + - "
" + - tr("Modules: %1").arg(modulesString) + "
" + - QString("http://www.ribbonsoft.com") + QString("© 2010 Underground Software,
James Hammons") + + "
" #ifdef QC_ABOUT_ADD_COMPANY + QString("
") + QC_ABOUT_ADD_COMPANY - + QString("") #endif + + QString("") ); #ifndef QC_ABOUT_HEADER #warning "Failure..." diff --git a/src/mainapp/qc_applicationwindow.h b/src/mainapp/qc_applicationwindow.h index 24dc780..c80ab1f 100644 --- a/src/mainapp/qc_applicationwindow.h +++ b/src/mainapp/qc_applicationwindow.h @@ -89,7 +89,7 @@ class QC_ApplicationWindow: public QMainWindow, public QG_MainWindowInterface /** * opens the given file. */ - void slotFileOpen(const QString& fileName, RS2::FormatType type); + void slotFileOpen(const QString & fileName, RS2::FormatType type); /** saves a document */ void slotFileSave(); /** saves a document under a different filename*/ diff --git a/src/mainapp/qc_dialogfactory.cpp b/src/mainapp/qc_dialogfactory.cpp index 414d31d..8a6c79a 100644 --- a/src/mainapp/qc_dialogfactory.cpp +++ b/src/mainapp/qc_dialogfactory.cpp @@ -16,7 +16,8 @@ #include "qc_applicationwindow.h" -QC_DialogFactory::QC_DialogFactory(QWidget * parent, QWidget * ow): QG_DialogFactory(parent, ow) +//QC_DialogFactory::QC_DialogFactory(QWidget * parent, QWidget * ow): QG_DialogFactory(parent, ow) +QC_DialogFactory::QC_DialogFactory(QWidget * parent, QToolBar * ow): QG_DialogFactory(parent, ow) { } diff --git a/src/mainapp/qc_dialogfactory.h b/src/mainapp/qc_dialogfactory.h index b5f456e..3ddd8d9 100644 --- a/src/mainapp/qc_dialogfactory.h +++ b/src/mainapp/qc_dialogfactory.h @@ -12,7 +12,8 @@ class QC_DialogFactory: public QG_DialogFactory { public: - QC_DialogFactory(QWidget * parent, QWidget * ow); +// QC_DialogFactory(QWidget * parent, QWidget * ow); + QC_DialogFactory(QWidget * parent, QToolBar * ow); virtual ~QC_DialogFactory(); virtual void requestEditBlockWindow(RS_BlockList * blockList = NULL); diff --git a/src/widgets/qg_actionhandler.cpp b/src/widgets/qg_actionhandler.cpp index 11d4b3f..5e86279 100644 --- a/src/widgets/qg_actionhandler.cpp +++ b/src/widgets/qg_actionhandler.cpp @@ -185,10 +185,10 @@ RS_ActionInterface * QG_ActionHandler::getCurrentAction() { RS_GraphicView * gv = mainWindow->getGraphicView(); - if (gv != NULL) + if (gv) return gv->getCurrentAction(); - else - return NULL; + + return NULL; } #if 0 @@ -214,6 +214,12 @@ Then you'd call it with: Hmmm.... We need gv & doc *before* we call this... +What you'd do then is have the form of the thing worked ahead of time and the function +itself would create the gv & doc. So for the EditUndo, we'd have: + FunctionCreateAction(bool); + FunctionCreateAction(void); + +Well... The problem is the action, they're all different... #endif /** diff --git a/src/widgets/qg_blockwidget.cpp b/src/widgets/qg_blockwidget.cpp index 9b9cbb4..e5f67e0 100644 --- a/src/widgets/qg_blockwidget.cpp +++ b/src/widgets/qg_blockwidget.cpp @@ -13,29 +13,12 @@ #include "qg_blockwidget.h" -/*#include "xpm/visibleblock.xpm" -#include "xpm/hiddenblock.xpm" -#include "xpm/blockadd.xpm" -#include "xpm/blockremove.xpm" -#include "xpm/blockedit.xpm" -#include "xpm/blockattributes.xpm" -#include "xpm/blockinsert.xpm"*/ - /** * Constructor. */ QG_BlockWidget::QG_BlockWidget(QG_ActionHandler * ah, QWidget * parent, const char * name, Qt::WFlags f): // QWidget(parent, name, f), QWidget(parent, f), -// pxmVisible(visibleblock_xpm), -// pxmHidden(hiddenblock_xpm), -// pxmAdd(blockadd_xpm), -// pxmRemove(blockremove_xpm), -// pxmAttributes(blockattributes_xpm), -// pxmEdit(blockedit_xpm), -// pxmInsert(blockinsert_xpm), -// pxmDefreezeAll(visibleblock_xpm), -// pxmFreezeAll(hiddenblock_xpm) pxmVisible(":/res/visibleblock.xpm"), pxmHidden(":/res/hiddenblock.xpm"), pxmAdd(":/res/blockadd.xpm"), diff --git a/src/widgets/qg_dialogfactory.cpp b/src/widgets/qg_dialogfactory.cpp index f698cdb..632ce8d 100644 --- a/src/widgets/qg_dialogfactory.cpp +++ b/src/widgets/qg_dialogfactory.cpp @@ -25,12 +25,12 @@ #include "rs_text.h" #if 0 -#include "ui/qg_arcoptions.h" -#include "ui/qg_arctangentialoptions.h" -#include "ui/qg_beveloptions.h" + #include "ui/qg_arcoptions.h" + #include "ui/qg_arctangentialoptions.h" + #include "ui/qg_beveloptions.h" #include "ui/qg_blockdialog.h" #include "ui/qg_cadtoolbar.h" -#include "ui/qg_circleoptions.h" + #include "ui/qg_circleoptions.h" #include "ui/qg_commandwidget.h" #include "ui/qg_coordinatewidget.h" #include "ui/qg_dimlinearoptions.h" @@ -77,8 +77,12 @@ #include "ui/qg_textoptions.h" #include "ui/qg_trimamountoptions.h" #endif +#include "arcoptions.h" +#include "arctangentialoptions.h" +#include "beveloptions.h" #include "blockdialog.h" #include "cadtoolbar.h" +#include "circleoptions.h" #include "commandwidget.h" #include "coordinatewidget.h" #include "dlgattributes.h" @@ -109,7 +113,8 @@ * @param parent Pointer to parent widget which can host dialogs. * @param ow Pointer to widget that can host option widgets. */ -QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow): +//QG_DialogFactory::QG_DialogFactory(QWidget * parent, QWidget * ow): +QG_DialogFactory::QG_DialogFactory(QWidget * parent, QToolBar * ow): RS_DialogFactoryInterface() { RS_DEBUG->print("QG_DialogFactory::QG_DialogFactory"); @@ -138,7 +143,8 @@ QG_DialogFactory::~QG_DialogFactory() /** * Links factory to a widget that can host tool options. */ -/*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow) +///*virtual*/ void QG_DialogFactory::setOptionWidget(QWidget * ow) +/*virtual*/ void QG_DialogFactory::setOptionWidget(QToolBar * ow) { RS_DEBUG->print("QG_DialogFactory::setOptionWidget"); optionWidget = ow; @@ -859,18 +865,19 @@ void QG_DialogFactory::requestPrintPreviewOptions(RS_ActionInterface * action, b { static PrintPreviewOptions * toolWidget = NULL; - if (optionWidget != NULL) + if (!optionWidget) + return; + + if (toolWidget) { - if (toolWidget != NULL) - { - delete toolWidget; - toolWidget = NULL; - } - if (on && toolWidget == NULL) - { - toolWidget = new PrintPreviewOptions(optionWidget); - toolWidget->setAction(action, update); - } + delete toolWidget; + toolWidget = NULL; + } + + if (on) + { + toolWidget = new PrintPreviewOptions(optionWidget); + toolWidget->setAction(action, update); } } @@ -879,21 +886,29 @@ void QG_DialogFactory::requestPrintPreviewOptions(RS_ActionInterface * action, b */ void QG_DialogFactory::requestLineOptions(RS_ActionInterface * action, bool on) { +/* +The way I see it, this is failure. We're constantly creating & deleting +these objects all the time when we could create them once, and then reuse +them over and over. May need to do some more refactoring based on this idea... +*/ + //ugh. static LineOptions * toolWidget = NULL; - if (optionWidget != NULL) + if (!optionWidget) + return; + + // Get rid of the LineOptions object if it exists... + if (toolWidget) { - if (toolWidget != NULL) - { - delete toolWidget; - toolWidget = NULL; - } + delete toolWidget; + toolWidget = NULL; + } - if (on == true && toolWidget == NULL) - { - toolWidget = new LineOptions(optionWidget); - toolWidget->setAction(action); - } + // Create a new one for the passed in action + if (on) + { + toolWidget = new LineOptions(optionWidget); + toolWidget->setAction(action); } RS_DEBUG->print("QG_DialogFactory::requestLineOptions: OK"); @@ -1065,68 +1080,6 @@ void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action, } } -/** - * Shows a widget for arc options. - */ -void QG_DialogFactory::requestArcOptions(RS_ActionInterface* action, - bool on, bool update) -{ - static QG_ArcOptions* toolWidget = NULL; - - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new QG_ArcOptions(optionWidget); - toolWidget->setAction(action, update); - //toolWidget->setData(&data); - } - } -} - -/** - * Shows a widget for tangential arc options. - */ -void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface* action, - bool on, bool update) -{ - static QG_ArcTangentialOptions* toolWidget = NULL; - - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new QG_ArcTangentialOptions(optionWidget); - toolWidget->setAction(action, update); - //toolWidget->setData(&data); - } - } -} - -/** - * Shows a widget for arc options. - */ -void QG_DialogFactory::requestCircleOptions(RS_ActionInterface* action, - bool on, bool update) -{ - static QG_CircleOptions* toolWidget = NULL; - - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new QG_CircleOptions(optionWidget); - toolWidget->setAction(action, update); - } - } -} - /** * Shows a widget for spline options. */ @@ -1147,26 +1100,6 @@ void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action, } } -/** - * Shows a widget for text options. - */ -void QG_DialogFactory::requestTextOptions(RS_ActionInterface* action, - bool on, bool update) -{ - static QG_TextOptions* toolWidget = NULL; - - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new QG_TextOptions(optionWidget); - toolWidget->setAction(action, update); - } - } -} - /** * Shows a widget for insert options. */ @@ -1308,26 +1241,6 @@ void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action, } } -/** - * Shows a widget for beveling options. - */ -void QG_DialogFactory::requestBevelOptions(RS_ActionInterface* action, - bool on, bool update) -{ - static QG_BevelOptions* toolWidget = NULL; - - if (optionWidget!=NULL) { - if (toolWidget!=NULL) { - delete toolWidget; - toolWidget = NULL; - } - if (on==true && toolWidget==NULL) { - toolWidget = new QG_BevelOptions(optionWidget); - toolWidget->setAction(action, update); - } - } -} - /** * Shows a widget for rounding options. */ @@ -1396,16 +1309,75 @@ void QG_DialogFactory::requestLinePolygon2Options(RS_ActionInterface* action, bo { } -void QG_DialogFactory::requestArcOptions(RS_ActionInterface* action, bool on, bool update) +/** + * Shows a widget for arc options. + */ +void QG_DialogFactory::requestArcOptions(RS_ActionInterface * action, bool on, bool update) { + static ArcOptions * toolWidget = NULL; + + if (optionWidget != NULL) + { + if (toolWidget != NULL) + { + delete toolWidget; + toolWidget = NULL; + } + + if (on && toolWidget == NULL) + { + toolWidget = new ArcOptions(optionWidget); + toolWidget->setAction(action, update); + //toolWidget->setData(&data); + } + } } -void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface* action, bool on, bool update) +/** + * Shows a widget for tangential arc options. + */ +void QG_DialogFactory::requestArcTangentialOptions(RS_ActionInterface * action, bool on, bool update) { + static ArcTangentialOptions * toolWidget = NULL; + + if (!optionWidget) + return; + + if (toolWidget) + { + delete toolWidget; + toolWidget = NULL; + } + + if (on) + { + toolWidget = new ArcTangentialOptions(optionWidget); + toolWidget->setAction(action, update); + //toolWidget->setData(&data); + } } -void QG_DialogFactory::requestCircleOptions(RS_ActionInterface* action, bool on, bool update) +/** + * Shows a widget for circle options. + */ +void QG_DialogFactory::requestCircleOptions(RS_ActionInterface * action, bool on, bool update) { + static CircleOptions * toolWidget = NULL; + + if (optionWidget) + { + if (toolWidget) + { + delete toolWidget; + toolWidget = NULL; + } + + if (on && toolWidget == NULL) + { + toolWidget = new CircleOptions(optionWidget); + toolWidget->setAction(action, update); + } + } } void QG_DialogFactory::requestSplineOptions(RS_ActionInterface* action, bool on, bool update) @@ -1419,19 +1391,19 @@ void QG_DialogFactory::requestTextOptions(RS_ActionInterface * action, bool on, { static TextOptions * toolWidget = NULL; - if (optionWidget != NULL) + if (!optionWidget) + return; + + if (toolWidget) { - if (toolWidget != NULL) - { - delete toolWidget; - toolWidget = NULL; - } + delete toolWidget; + toolWidget = NULL; + } - if (on == true && toolWidget == NULL) - { - toolWidget = new TextOptions(optionWidget); - toolWidget->setAction(action, update); - } + if (on) + { + toolWidget = new TextOptions(optionWidget); + toolWidget->setAction(action, update); } } @@ -1463,8 +1435,27 @@ void QG_DialogFactory::requestTrimAmountOptions(RS_ActionInterface* action, bool { } -void QG_DialogFactory::requestBevelOptions(RS_ActionInterface* action, bool on, bool update) +/** + * Shows a widget for beveling options. + */ +void QG_DialogFactory::requestBevelOptions(RS_ActionInterface * action, bool on, bool update) { + static BevelOptions * toolWidget = NULL; + + if (optionWidget != NULL) + { + if (toolWidget != NULL) + { + delete toolWidget; + toolWidget = NULL; + } + + if (on && toolWidget == NULL) + { + toolWidget = new BevelOptions(optionWidget); + toolWidget->setAction(action, update); + } + } } void QG_DialogFactory::requestRoundOptions(RS_ActionInterface* action, bool on, bool update) diff --git a/src/widgets/qg_dialogfactory.h b/src/widgets/qg_dialogfactory.h index aee54b5..d901cd7 100644 --- a/src/widgets/qg_dialogfactory.h +++ b/src/widgets/qg_dialogfactory.h @@ -24,11 +24,13 @@ class RS_Document; class QG_DialogFactory: public RS_DialogFactoryInterface { public: - QG_DialogFactory(QWidget * parent, QWidget * ow); +// QG_DialogFactory(QWidget * parent, QWidget * ow); + QG_DialogFactory(QWidget * parent, QToolBar * ow); virtual ~QG_DialogFactory(); protected: - virtual void setOptionWidget(QWidget * ow); +// virtual void setOptionWidget(QWidget * ow); + virtual void setOptionWidget(QToolBar * ow); public: virtual void setCoordinateWidget(CoordinateWidget * cw); @@ -127,7 +129,9 @@ class QG_DialogFactory: public RS_DialogFactoryInterface //! Pointer to the widget which can host dialogs QWidget * parent; //! Pointer to the widget which can host individual tool options - QWidget * optionWidget; +//[DONE]#warning "!!! Need to change optionWidget from class QWidget to QToolBar !!!" +// QWidget * optionWidget; + QToolBar * optionWidget; //! Pointer to the coordinate widget. CoordinateWidget * coordinateWidget; //! Pointer to the mouse widget. diff --git a/src/widgets/qg_graphicview.cpp b/src/widgets/qg_graphicview.cpp index c26d8af..0ecf480 100644 --- a/src/widgets/qg_graphicview.cpp +++ b/src/widgets/qg_graphicview.cpp @@ -19,6 +19,9 @@ #include "rs_actionzoomscroll.h" #include "rs_actionmodifydelete.h" #include "rs_actionselectsingle.h" +#include "rs_dialogfactory.h" +#include "rs_graphicview.h" +#include "rs_preview.h" #include "drawing.h" #include "settings.h" #include "rs_system.h"