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 \
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 \
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 \
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 \
#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 \
# 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 \
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);
void RS_Snapper::hideOptions()
{
if (snapMode == RS2::SnapDist)
- if (RS_DIALOGFACTORY!=NULL)
+ if (RS_DIALOGFACTORY != NULL)
RS_DIALOGFACTORY->requestSnapDistOptions(distance, false);
}
--- /dev/null
+// 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 <jlhamm@acm.org>
+//
+// 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());
+}
--- /dev/null
+#ifndef __ARCOPTIONS_H__
+#define __ARCOPTIONS_H__
+
+//#include "ui_arcoptions.h"
+#include <QtGui>
+
+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__
--- /dev/null
+// 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 <jlhamm@acm.org>
+//
+// 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));
+}
+
--- /dev/null
+#ifndef __ARCTANGENTIALOPTIONS_H__
+#define __ARCTANGENTIALOPTIONS_H__
+
+//#include "ui_arctangentialoptions.h"
+#include <QtGui>
+
+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__
--- /dev/null
+// 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 <jlhamm@acm.org>
+//
+// 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()));
+ }
+}
--- /dev/null
+#ifndef __BEVELOPTIONS_H__
+#define __BEVELOPTIONS_H__
+
+#include <QtGui>
+
+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__
// 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
tbSelect(NULL), tbPolylines(NULL)
{
ui.setupUi(this);
+//hm. here maybe?
+if (parent)
+ ((QToolBar *)parent)->addWidget(this);
}
CadToolBar::~CadToolBar()
// 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
#include "cadtoolbar.h"
#include "qg_actionhandler.h"
+#include "createqtactions.h"
+
CadToolBarMain::CadToolBarMain(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
QWidget(parent, 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()
{
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()));
<x>0</x>
<y>0</y>
<width>86</width>
- <height>336</height>
+ <height>224</height>
</rect>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="minimumSize">
<size>
<width>56</width>
- <height>336</height>
+ <height>200</height>
</size>
</property>
<property name="windowTitle">
<string>Main</string>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
<item row="0" column="0">
<widget class="QToolButton" name="bMenuPoint">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Points</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menupoint.xpm</normaloff>:/res/qg_menupoint.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="bMenuLine">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Lines"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuline.xpm</normaloff>:/res/qg_menuline.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="bMenuArc">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Arcs"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuarc.xpm</normaloff>:/res/qg_menuarc.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="bMenuCircle">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Circles"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menucircle.xpm</normaloff>:/res/qg_menucircle.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="bMenuEllipse">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Ellipses"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuellipse.xpm</normaloff>:/res/qg_menuellipse.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="bMenuSpline">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Splines</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuspline.xpm</normaloff>:/res/qg_menuspline.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="3" column="0">
<widget class="QToolButton" name="bMenuPolyline">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Polylines</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menupolyline.xpm</normaloff>:/res/qg_menupolyline.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="4" column="0">
<widget class="QToolButton" name="bMenuText">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menutext.xpm</normaloff>:/res/qg_menutext.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="4" column="1">
<widget class="QToolButton" name="bMenuDim">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menudim.png</normaloff>:/res/qg_menudim.png</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="5" column="0">
<widget class="QToolButton" name="bMenuHatch">
<property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuhatch.xpm</normaloff>:/res/qg_menuhatch.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="5" column="1">
<widget class="QToolButton" name="bMenuImage">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Raster Image</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuimage.xpm</normaloff>:/res/qg_menuimage.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="6" column="0">
<widget class="QToolButton" name="bMenuModify">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Edit"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuedit.xpm</normaloff>:/res/qg_menuedit.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="6" column="1">
<widget class="QToolButton" name="bMenuInfo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Measure"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menumeasure.xpm</normaloff>:/res/qg_menumeasure.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="7" column="0">
<widget class="QToolButton" name="bMenuBlock">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Create Block</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menublock.xpm</normaloff>:/res/qg_menublock.xpm</iconset>
</property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
</widget>
</item>
<item row="7" column="1">
<widget class="QToolButton" name="bMenuSelect">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Show menu "Select"</string>
</property>
<iconset resource="res/architektonas.qrc">
<normaloff>:/res/qg_menuselect.xpm</normaloff>:/res/qg_menuselect.xpm</iconset>
</property>
- </widget>
- </item>
- <item row="8" column="0" colspan="2">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
+ <property name="iconSize">
<size>
- <width>20</width>
- <height>40</height>
+ <width>18</width>
+ <height>18</height>
</size>
</property>
- </spacer>
+ </widget>
</item>
- <item row="3" column="2" rowspan="3">
+ <item row="4" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>40</width>
+ <width>8</width>
<height>20</height>
</size>
</property>
--- /dev/null
+// 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 <jlhamm@acm.org>
+//
+// 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));
+}
--- /dev/null
+#ifndef __CIRCLEOPTIONS_H__
+#define __CIRCLEOPTIONS_H__
+
+#include <QtGui>
+
+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__
// 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
#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()
void LineOptions::close()
{
- if (action != NULL)
+ if (action)
action->close();
}
void LineOptions::undo()
{
- if (action != NULL)
+ if (action)
action->undo();
}
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:
#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()
*/
}
-void PrintPreviewOptions::setAction(RS_ActionInterface* a, bool/*update*/)
+void PrintPreviewOptions::setAction(RS_ActionInterface * a, bool/*update*/)
{
if (a != NULL && a->rtti() == RS2::ActionPrintPreview)
{
{
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);
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);
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:
<string/>
</property>
<property name="icon">
- <iconset>
- <normaloff>xpm/qg_printbw.xpm</normaloff>xpm/qg_printbw.xpm</iconset>
+ <iconset resource="res/architektonas.qrc">
+ <normaloff>:/res/qg_printbw.xpm</normaloff>:/res/qg_printbw.xpm</iconset>
</property>
<property name="checkable">
<bool>true</bool>
<string/>
</property>
<property name="icon">
- <iconset>
- <normaloff>xpm/qg_printcenter.xpm</normaloff>xpm/qg_printcenter.xpm</iconset>
+ <iconset resource="res/architektonas.qrc">
+ <normaloff>:/res/qg_printcenter.xpm</normaloff>:/res/qg_printcenter.xpm</iconset>
</property>
</widget>
</item>
<string/>
</property>
<property name="icon">
- <iconset>
- <normaloff>xpm/qg_printscale.xpm</normaloff>xpm/qg_printscale.xpm</iconset>
+ <iconset resource="res/architektonas.qrc">
+ <normaloff>:/res/qg_printfit.xpm</normaloff>:/res/qg_printfit.xpm</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
- <resources/>
+ <resources>
+ <include location="res/architektonas.qrc"/>
+ </resources>
<connections>
<connection>
<sender>bCenter</sender>
<slot>center()</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
+ <x>156</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<slot>setBlackWhite(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
+ <x>126</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<slot>fit()</slot>
<hints>
<hint type="sourcelabel">
- <x>20</x>
+ <x>186</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<file>qg_tolerance2.xpm</file>
<file>qg_widthbox.xpm</file>
<file>redo2.png</file>
+ <file>splash.png</file>
<file>splash_camexpert.xpm</file>
<file>splash_qcad.xpm</file>
<file>undo2.png</file>
#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()
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:
// 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
/*
#include "qc_applicationwindow.h"
#include <fstream>
-#include "rs_application.h"
#include "rs_actiondrawlinefree.h"
#include "rs_actionprintpreview.h"
#include "rs_creation.h"
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
modulesString = tr("None");
QMessageBox box(this);
-// box.setCaption(tr("About..."));
box.setWindowTitle(tr("About..."));
box.setText(QString("<qt>") + // no center for main stream QCad
#ifdef QC_ABOUT_HEADER
//FAIL "<h2>"+ QC_APPNAME+ "</h2>" +
"<h2>Architektonas</h2>" +
#endif
- tr("Version: %1 %2").arg(QC_VERSION).arg(edition) + "<br>" +
+ tr("Version: %1").arg("1.0.0") + "<br>" +
tr("Date: %1").arg(__DATE__) + "<br>" +
- QString("(c) 2001-2005 by RibbonSoft,<br> Andrew Mustun") +
- "<br>" +
- tr("Modules: %1").arg(modulesString) + "<br>" +
- QString("http://www.ribbonsoft.com")
+ QString("© 2010 Underground Software,<br>James Hammons") +
+ "<br>"
#ifdef QC_ABOUT_ADD_COMPANY
+ QString("<br>") + QC_ABOUT_ADD_COMPANY
- + QString("</center>")
#endif
+ + QString("</center>")
);
#ifndef QC_ABOUT_HEADER
#warning "Failure..."
/**
* 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*/
#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)
{
}
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);
{
RS_GraphicView * gv = mainWindow->getGraphicView();
- if (gv != NULL)
+ if (gv)
return gv->getCurrentAction();
- else
- return NULL;
+
+ return NULL;
}
#if 0
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
/**
#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"),
#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"
#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"
* @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");
/**
* 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;
{
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);
}
}
*/
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");
}
}
-/**
- * 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.
*/
}
}
-/**
- * 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.
*/
}
}
-/**
- * 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.
*/
{
}
-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)
{
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);
}
}
{
}
-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)
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);
//! 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.
#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"