FORMS = \
src/forms/blockdialog.ui \
- src/forms/cadtoolbarmain.ui \
src/forms/commandwidget.ui \
src/forms/coordinatewidget.ui \
src/forms/dimensionlabeleditor.ui \
* This class is an interface for classes that are interested in
* knowing about changes in the block list.
*/
-class RS_BlockListListener {
-public:
- RS_BlockListListener() {}
- virtual ~RS_BlockListListener() {}
-
- /**
- * Called when the active block changes.
- */
- virtual void blockActivated(RS_Block*) {}
-
- /**
- * Called when a new block is added to the list.
- */
- virtual void blockAdded(RS_Block*) {}
-
- /**
- * Called when a block is removed from the list.
- */
- virtual void blockRemoved(RS_Block*) {}
-
- /**
- * Called when a block's attributes are modified.
- */
- virtual void blockEdited(RS_Block*) {}
-
- /**
- * Called when a block's visibility is toggled.
- */
- virtual void blockToggled(RS_Block*) {}
-}
-;
+class RS_BlockListListener
+{
+ public:
+ RS_BlockListListener() {}
+ virtual ~RS_BlockListListener() {}
+
+ /**
+ * Called when the active block changes.
+ */
+ virtual void blockActivated(RS_Block*) {}
+
+ /**
+ * Called when a new block is added to the list.
+ */
+ virtual void blockAdded(RS_Block*) {}
+
+ /**
+ * Called when a block is removed from the list.
+ */
+ virtual void blockRemoved(RS_Block*) {}
+
+ /**
+ * Called when a block's attributes are modified.
+ */
+ virtual void blockEdited(RS_Block*) {}
+
+ /**
+ * Called when a block's visibility is toggled.
+ */
+ virtual void blockToggled(RS_Block*) {}
+};
#endif
#include "rs_preview.h"
#include "rs_entitycontainer.h"
-#include "rs_graphicview.h"
+#include "graphicview.h"
#include "rs_information.h"
#include "settings.h"
{
actionHandler = ah;
tbMain = new CadToolBarMain(this);
- tbMain->setCadToolBar(this);
currentTb = tbMain;
tbPoints = new CadToolBarPoints(this);
- tbPoints->hide();
-
tbLines = new CadToolBarLines(this);
- tbLines->hide();
-
tbArcs = new CadToolBarArcs(this);
- tbArcs->hide();
-
tbCircles = new CadToolBarCircles(this);
- tbCircles->hide();
-
tbEllipses = new CadToolBarEllipses(this);
- tbEllipses->hide();
-
tbSplines = new CadToolBarSplines(this);
- tbSplines->hide();
-
tbPolylines = new CadToolBarPolylines(this);
- tbPolylines->hide();
-
tbDim = new CadToolBarDim(this);
- tbDim->hide();
-
tbInfo = new CadToolBarInfo(this);
- tbInfo->hide();
-
tbModify = new CadToolBarModify(this);
- tbModify->hide();
-
tbSnap = new CadToolBarSnap(this);
- tbSnap->hide();
-
tbSelect = new CadToolBarSelect(this);
+
+ tbPoints->hide();
+ tbLines->hide();
+ tbArcs->hide();
+ tbCircles->hide();
+ tbEllipses->hide();
+ tbSplines->hide();
+ tbPolylines->hide();
+ tbDim->hide();
+ tbInfo->hide();
+ tbModify->hide();
+ tbSnap->hide();
tbSelect->hide();
}
void CadToolBar::showToolBarPolylines()
{
-//#ifdef RS_PROF
showToolBar(RS2::ToolBarPolylines);
-//#endif
}
void CadToolBar::showToolBarCircles()
tbSelect->setSelectAction(selectAction);
showToolBar(RS2::ToolBarSelect);
}
+
+QToolButton * CadToolBar::CreateBackButton(QWidget * widget)
+{
+ QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), widget);
+ QToolButton * button = new QToolButton(widget);
+ button->setDefaultAction(actionBack);
+ QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ button->setSizePolicy(policy);
+ connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+
+ return button;
+}
+
+QToolButton * CadToolBar::CreateToolButton(QAction * action)
+{
+ QToolButton * button = new QToolButton();
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
+
+ return button;
+}
#ifndef __CADTOOLBAR_H__
#define __CADTOOLBAR_H__
-//#include "ui_cadtoolbar.h"
#include <QtGui>
class RS_ActionInterface;
void showToolBarDim();
void showToolBarSelect();
void showToolBarSelect(RS_ActionInterface * selectAction, int nextAction);
+ QToolButton * CreateBackButton(QWidget *);
+ QToolButton * CreateToolButton(QAction * action);
signals:
void signalBack();
CadToolBarSnap * tbSnap;
CadToolBarSelect * tbSelect;
CadToolBarPolylines * tbPolylines;
-
-// private:
-// Ui::CadToolBar ui;
};
#endif // __CADTOOLBAR_H__
#include "cadtoolbararcs.h"
-#if 0
-#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
-
-CadToolBarArcs::CadToolBarArcs(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
-{
- ui.setupUi(this);
-}
-
-CadToolBarArcs::~CadToolBarArcs()
-{
-}
-
-/*void QG_CadToolBarArcs::mousePressEvent(QMouseEvent* e) {
- if (e->button()==RightButton && cadToolBar!=NULL) {
- cadToolBar->back();
- e->accept();
- }
-}*/
-
-void CadToolBarArcs::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarArcs::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarArcs::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarArcs::drawArc()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawArc();
-}
-
-void CadToolBarArcs::drawArc3P()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawArc3P();
-}
-
-void CadToolBarArcs::drawArcParallel()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawArcParallel();
-}
-
-void CadToolBarArcs::drawArcTangential()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawArcTangential();
-}
-
-void CadToolBarArcs::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
-}
-#else
#include "cadtoolbar.h"
#include "createqtactions.h"
CadToolBarArcs::CadToolBarArcs(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawArc), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawArc3P), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawArcParallel), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawArcTangential), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawArc), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawArc3P), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawArcParallel), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawArcTangential), 2, 1, 1, 1);
}
CadToolBarArcs::~CadToolBarArcs()
{
}
-
-void CadToolBarArcs::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarArcs::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
-#endif
class CadToolBarArcs: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarArcs(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarArcs();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARARCS_H__
#include "createqtactions.h"
CadToolBarCircles::CadToolBarCircles(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawCircle), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawCircleCR), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawCircle2P), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawCircle3P), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawCircleParallel), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawCircle), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawCircleCR), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawCircle2P), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawCircle3P), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawCircleParallel), 3, 0, 1, 1);
}
CadToolBarCircles::~CadToolBarCircles()
{
}
-
-void CadToolBarCircles::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarCircles::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarCircles: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarCircles(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarCircles();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARCIRCLES_H__
#include "createqtactions.h"
CadToolBarDim::CadToolBarDim(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDimAligned), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimLinear), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimLinearHor), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimLinearVer), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimRadial), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimDiametric), 3, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimAngular), 4, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDimLeader), 4, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimAligned), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimLinear), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimLinearHor), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimLinearVer), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimRadial), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimDiametric), 3, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimAngular), 4, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDimLeader), 4, 1, 1, 1);
}
CadToolBarDim::~CadToolBarDim()
{
}
-
-void CadToolBarDim::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarDim::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarDim: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarDim(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarDim();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARDIM_H__
#include "createqtactions.h"
CadToolBarEllipses::CadToolBarEllipses(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawEllipseAxis), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawEllipseArcAxis), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawEllipseAxis), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawEllipseArcAxis), 1, 1, 1, 1);
}
CadToolBarEllipses::~CadToolBarEllipses()
{
}
-
-void CadToolBarEllipses::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarEllipses::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarEllipses: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarEllipses(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarEllipses();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARELLIPSES_H__
#include "createqtactions.h"
CadToolBarInfo::CadToolBarInfo(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionInfoDist), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionInfoDist2), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionInfoAngle), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionInfoTotalLength), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionInfoArea), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionInfoDist), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionInfoDist2), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionInfoAngle), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionInfoTotalLength), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionInfoArea), 3, 0, 1, 1);
}
CadToolBarInfo::~CadToolBarInfo()
{
}
-
-void CadToolBarInfo::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarInfo::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarInfo: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarInfo(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarInfo();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARINFO_H__
#include "createqtactions.h"
CadToolBarLines::CadToolBarLines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
-
- gridLayout->addWidget(CreateToolButton(actionDrawLine), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineAngle), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineHorizontal), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineVertical), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineRectangle), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineBisector), 3, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineParallel), 4, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineParallelThrough), 4, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineTangent1), 5, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineTangent2), 5, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineOrthogonal), 6, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineRelAngle), 6, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLinePolygon), 7, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLinePolygon2), 7, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDrawLineFree), 8, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
+
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLine), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineAngle), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineHorizontal), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineVertical), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineRectangle), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineBisector), 3, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineParallel), 4, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineParallelThrough), 4, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineTangent1), 5, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineTangent2), 5, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineOrthogonal), 6, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineRelAngle), 6, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLinePolygon), 7, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLinePolygon2), 7, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawLineFree), 8, 0, 1, 1);
}
CadToolBarLines::~CadToolBarLines()
{
}
-
-void CadToolBarLines::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarLines::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarLines: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarLines(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarLines();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARLINES_H__
// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 05/10/2010 Created this file. :-)
+// JLH 06/22/2010 Refactored file to remove .ui dependency. This also results
+// in a much smaller, easier to manage file. ;-)
//
#include "cadtoolbarmain.h"
-#include "cadtoolbar.h"
#include "qg_actionhandler.h"
-#include "createqtactions.h"
-#include "rs_debug.h"
+#include "cadtoolbar.h"
-CadToolBarMain::CadToolBarMain(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags)
+CadToolBarMain::CadToolBarMain(CadToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags)
{
- ui.setupUi(this);
+ QG_ActionHandler * actionHandler = parent->getActionHandler();
+
+ gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
+
+ connect(CreateToolButton(0, 0, ":/res/qg_menupoint"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotDrawPoint()));
+ connect(CreateToolButton(0, 1, ":/res/qg_menuline"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarLines()));
+ connect(CreateToolButton(1, 0, ":/res/qg_menuarc"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarArcs()));
+ connect(CreateToolButton(1, 1, ":/res/qg_menucircle"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarCircles()));
+ connect(CreateToolButton(2, 0, ":/res/qg_menuellipse"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarEllipses()));
+ connect(CreateToolButton(2, 1, ":/res/qg_menuspline"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotDrawSpline()));
+ connect(CreateToolButton(3, 0, ":/res/qg_menupolyline"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarPolylines()));
+
+ connect(CreateToolButton(5, 0, ":/res/qg_menutext"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotDrawText()));
+ connect(CreateToolButton(5, 1, ":/res/qg_menudim"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarDim()));
+ connect(CreateToolButton(6, 0, ":/res/qg_menuhatch"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotDrawHatch()));
+ connect(CreateToolButton(6, 1, ":/res/qg_menuimage"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotDrawImage()));
-// Ain't hidin' dis no mo'...
-//#ifndef RS_PROF
-// ui.bMenuPolyline->hide();
-//#endif
+ connect(CreateToolButton(8, 0, ":/res/qg_menuedit"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarModify()));
+ connect(CreateToolButton(8, 1, ":/res/qg_menumeasure"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarInfo()));
-//hm.
-//well, it looks like something else is messing with this...
-// if (parent)
-// ((QToolBar *)parent)->addWidget(this);
+ connect(CreateToolButton(10, 0, ":/res/qg_menublock"), SIGNAL(clicked()),
+ actionHandler, SLOT(slotBlocksCreate()));
+ connect(CreateToolButton(10, 1, ":/res/qg_menuselect"), SIGNAL(clicked()),
+ parent, SLOT(showToolBarSelect()));
+#endif
}
CadToolBarMain::~CadToolBarMain()
{
}
-void CadToolBarMain::setCadToolBar(CadToolBar * tb)
+QToolButton * CadToolBarMain::CreateToolButton(int row, int col, QString iconName)
{
- QG_ActionHandler * ah = NULL;
-
- if (tb)
- ah = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarMain::setCadToolBar(): No valid toolbar set.");
-
- if (ah)
- {
- connect(ui.bMenuPoint, SIGNAL(clicked()), ah, SLOT(slotDrawPoint()));
- connect(ui.bMenuLine, SIGNAL(clicked()), tb, SLOT(showToolBarLines()));
- connect(ui.bMenuArc, SIGNAL(clicked()), tb, SLOT(showToolBarArcs()));
- connect(ui.bMenuCircle, SIGNAL(clicked()), tb, SLOT(showToolBarCircles()));
- connect(ui.bMenuEllipse, SIGNAL(clicked()), tb, SLOT(showToolBarEllipses()));
- connect(ui.bMenuSpline, SIGNAL(clicked()), ah, SLOT(slotDrawSpline()));
- connect(ui.bMenuPolyline, SIGNAL(clicked()), tb, SLOT(showToolBarPolylines()));
-
- connect(ui.bMenuText, SIGNAL(clicked()), ah, SLOT(slotDrawText()));
- connect(ui.bMenuDim, SIGNAL(clicked()), tb, SLOT(showToolBarDim()));
- connect(ui.bMenuHatch, SIGNAL(clicked()), ah, SLOT(slotDrawHatch()));
- connect(ui.bMenuImage, SIGNAL(clicked()), ah, SLOT(slotDrawImage()));
-
- connect(ui.bMenuModify, SIGNAL(clicked()), tb, SLOT(showToolBarModify()));
- connect(ui.bMenuInfo, SIGNAL(clicked()), tb, SLOT(showToolBarInfo()));
+ QToolButton * button = new QToolButton(this);
+ button->setIcon(QIcon(iconName));
+ button->setIconSize(QSize(18, 18));
+ gridLayout->addWidget(button, row, col, 1, 1);
- connect(ui.bMenuBlock, SIGNAL(clicked()), ah, SLOT(slotBlocksCreate()));
- connect(ui.bMenuSelect, SIGNAL(clicked()), tb, SLOT(showToolBarSelect()));
- }
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarMain::setCadToolBar(): No valid action handler set.");
+ return button;
}
#ifndef __CADTOOLBARMAIN_H__
#define __CADTOOLBARMAIN_H__
-#include "ui_cadtoolbarmain.h"
+#include <QtGui>
class CadToolBar;
class CadToolBarMain: public QWidget
{
- Q_OBJECT
-
public:
- CadToolBarMain(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarMain(CadToolBar * parent = 0, Qt::WindowFlags flags = 0);
~CadToolBarMain();
- public slots:
- void setCadToolBar(CadToolBar * tb);
+ private:
+ QToolButton * CreateToolButton(int row, int col, QString iconName);
private:
- Ui::CadToolBarMain ui;
+ QGridLayout * gridLayout;
};
#endif // __CADTOOLBARMAIN_H__
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CadToolBarMain</class>
- <widget class="QWidget" name="CadToolBarMain">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>86</width>
- <height>224</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>56</width>
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Texts</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Show menu "Dimensions"</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Hatches / Solid Fills</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <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>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:/res/qg_menuselect.xpm</normaloff>:/res/qg_menuselect.xpm</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>18</width>
- <height>18</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>8</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources>
- <include location="res/architektonas.qrc"/>
- </resources>
- <connections/>
-</ui>
#include "createqtactions.h"
CadToolBarModify::CadToolBarModify(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionModifyMove), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyRotate), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyScale), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyMirror), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyMoveRotate), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyRotate2), 3, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyMove), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyRotate), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyScale), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyMirror), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyMoveRotate), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyRotate2), 3, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyTrim), 5, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyTrim2), 5, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyTrimAmount), 6, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyTrim), 5, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyTrim2), 5, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyTrimAmount), 6, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyBevel), 8, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyRound), 8, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyBevel), 8, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyRound), 8, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyCut), 10, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyStretch), 10, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyCut), 10, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyStretch), 10, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyEntity), 12, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyAttributes), 12, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyDelete), 13, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyExplode), 13, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyEntity), 12, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyAttributes), 12, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyDelete), 13, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyExplode), 13, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionModifyExplodeText), 15, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionModifyExplodeText), 15, 0, 1, 1);
#warning "!!! actionModifyEntityText is missing !!!"
//EntityText
-// gridLayout->addWidget(CreateToolButton(actionModifyEntityText), 15, 1, 1, 1);
+// gridLayout->addWidget(parent->CreateToolButton(actionModifyEntityText), 15, 1, 1, 1);
}
CadToolBarModify::~CadToolBarModify()
{
}
-
-void CadToolBarModify::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarModify::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarModify: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarModify(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarModify();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARMODIFY_H__
#include "createqtactions.h"
CadToolBarPoints::CadToolBarPoints(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawPoint), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawPoint), 1, 0, 1, 1);
}
CadToolBarPoints::~CadToolBarPoints()
{
}
-
-void CadToolBarPoints::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarPoints::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarPoints: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarPoints(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarPoints();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARPOINTS_H__
#include "createqtactions.h"
CadToolBarPolylines::CadToolBarPolylines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawPolyline), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionPolylineAdd), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawPolyline), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineAdd), 1, 1, 1, 1);
#warning "!!! Missing actionPolylineAppend !!!"
-// gridLayout->addWidget(CreateToolButton(actionPolylineAppend), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionPolylineDel), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionPolylineDelBetween), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionPolylineTrim), 3, 1, 1, 1);
+// gridLayout->addWidget(parent->CreateToolButton(actionPolylineAppend), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineDel), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineDelBetween), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionPolylineTrim), 3, 1, 1, 1);
}
CadToolBarPolylines::~CadToolBarPolylines()
{
}
-
-void CadToolBarPolylines::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarPolylines::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarPolylines: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarPolylines(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarPolylines();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARPOLYLINES_H__
#include "createqtactions.h"
CadToolBarSelect::CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent), actionHandler(NULL),
- selectAction(NULL), nextAction(-1)
+ QWidget((QWidget *)parent, flags), actionHandler(NULL), selectAction(NULL),
+ nextAction(-1)
{
- actionHandler = cadToolBar->getActionHandler();
+ actionHandler = parent->getActionHandler();
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(clicked()), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDeselectAll), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectAll), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectSingle), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectContour), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDeselectWindow), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectWindow), 3, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectIntersected), 4, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectInvert), 5, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSelectLayer), 5, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDeselectAll), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectAll), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectSingle), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectContour), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDeselectWindow), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectWindow), 3, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectIntersected), 4, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectInvert), 5, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSelectLayer), 5, 1, 1, 1);
QAction * actionDoit = new QAction(QIcon(":/res/qg_forward"), tr("Forward"), this);
doit = new QToolButton(this);
doit->setDefaultAction(actionDoit);
+ QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
doit->setSizePolicy(policy);
gridLayout->addWidget(doit, 6, 0, 1, 2);
connect(doit, SIGNAL(clicked()), this, SLOT(runNextAction()));
void CadToolBarSelect::runNextAction()
{
-//printf("CadToolBarSelect::runNextAction(): Entered function...\n");
if (selectAction)
{
-//printf("CadToolBarSelect::runNextAction(): About to do selectAction...\n");
selectAction->finish();
selectAction = NULL;
}
if (nextAction != -1)
{
-//printf("CadToolBarSelect::runNextAction(): About to do nextAction...\n");
actionHandler->killSelectActions();
actionHandler->setCurrentAction((RS2::ActionType)nextAction);
}
}
-
-void CadToolBarSelect::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarSelect::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
public slots:
void runNextAction();
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
-
private:
QToolButton * doit;
QG_ActionHandler * actionHandler;
#include "cadtoolbarsnap.h"
-#if 0
-#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
-
-CadToolBarSnap::CadToolBarSnap(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
-{
- ui.setupUi(this);
-}
-
-CadToolBarSnap::~CadToolBarSnap()
-{
-}
-
-//void CadToolBarSnap::mousePressEvent(QMouseEvent* e) {
-// if (e->button()==RightButton && cadToolBar!=NULL) {
-//cadToolBar->back();
-// e->accept();
-// }
-//}
-
-void CadToolBarSnap::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarSnap::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb!=NULL)
- {
- actionHandler = tb->getActionHandler();
- actionHandler->setCadToolBarSnap(this);
- }
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSnap::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarSnap::snapFree()
-{
- if (actionHandler!=NULL)
- {
- disableSnaps();
- ui.bFree->setChecked(true);
- actionHandler->slotSnapFree();
- }
-}
-
-void CadToolBarSnap::snapGrid()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotSnapGrid();
- disableSnaps();
- ui.bGrid->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapEndpoint() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapEndpoint();
- disableSnaps();
- ui.bEndpoint->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapOnEntity() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapOnEntity();
- disableSnaps();
- ui.bOnEntity->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapCenter() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapCenter();
- disableSnaps();
- ui.bCenter->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapMiddle() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapMiddle();
- disableSnaps();
- ui.bMiddle->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapDist() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapDist();
- disableSnaps();
- ui.bDist->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapIntersection() {
- if (actionHandler!=NULL) {
- actionHandler->slotSnapIntersection();
- disableSnaps();
- ui.bIntersection->setChecked(true);
- }
-}
-
-void CadToolBarSnap::snapIntersectionManual()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotSnapIntersectionManual();
- //disableSnaps();
- //bIntersectionManual->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictNothing()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictNothing();
- disableRestrictions();
- ui.bResNothing->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictOrthogonal()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictOrthogonal();
- disableRestrictions();
- ui.bResOrthogonal->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictHorizontal()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictHorizontal();
- disableRestrictions();
- ui.bResHorizontal->setChecked(true);
- }
-}
-
-void CadToolBarSnap::restrictVertical()
-{
- if (actionHandler!=NULL)
- {
- actionHandler->slotRestrictVertical();
- disableRestrictions();
- ui.bResVertical->setChecked(true);
- }
-}
-
-void CadToolBarSnap::disableSnaps()
-{
- if (ui.bFree->isChecked())
- ui.bFree->setChecked(false);
-
- if (ui.bGrid->isChecked())
- ui.bGrid->setChecked(false);
-
- if (ui.bEndpoint->isChecked())
- ui.bEndpoint->setChecked(false);
-
- if (ui.bOnEntity->isChecked())
- ui.bOnEntity->setChecked(false);
-
- if (ui.bCenter->isChecked())
- ui.bCenter->setChecked(false);
-
- if (ui.bMiddle->isChecked())
- ui.bMiddle->setChecked(false);
-
- if (ui.bDist->isChecked())
- ui.bDist->setChecked(false);
-
- if (ui.bIntersection->isChecked())
- ui.bIntersection->setChecked(false);
-
- if (ui.bIntersectionManual->isChecked())
- ui.bIntersectionManual->setChecked(false);
-}
-
-void CadToolBarSnap::disableRestrictions()
-{
- if (ui.bResNothing->isChecked())
- ui.bResNothing->setChecked(false);
-
- if (ui.bResOrthogonal->isChecked())
- ui.bResOrthogonal->setChecked(false);
-
- if (ui.bResHorizontal->isChecked())
- ui.bResHorizontal->setChecked(false);
-
- if (ui.bResVertical->isChecked())
- ui.bResVertical->setChecked(false);
-}
-
-void CadToolBarSnap::setSnapMode(int sm)
-{
- switch (sm)
- {
- case RS2::SnapFree:
- ui.bFree->setChecked(true);
- break;
- case RS2::SnapEndpoint:
- ui.bEndpoint->setChecked(true);
- break;
- case RS2::SnapGrid:
- ui.bGrid->setChecked(true);
- break;
- case RS2::SnapOnEntity:
- ui.bOnEntity->setChecked(true);
- break;
- case RS2::SnapCenter:
- ui.bCenter->setChecked(true);
- break;
- case RS2::SnapMiddle:
- ui.bMiddle->setChecked(true);
- break;
- case RS2::SnapDist:
- ui.bDist->setChecked(true);
- break;
- case RS2::SnapIntersection:
- ui.bIntersection->setChecked(true);
- break;
- default:
- break;
- }
-}
-
-void CadToolBarSnap::setSnapRestriction(int sr)
-{
- switch (sr)
- {
- default:
- case RS2::RestrictNothing:
- ui.bResNothing->setChecked(true);
- break;
- case RS2::RestrictOrthogonal:
- ui.bResOrthogonal->setChecked(true);
- break;
- case RS2::RestrictHorizontal:
- ui.bResHorizontal->setChecked(true);
- break;
- case RS2::RestrictVertical:
- ui.bResVertical->setChecked(true);
- break;
- }
-}
-
-void CadToolBarSnap::setRelativeZero()
-{
- if (cadToolBar!=NULL && actionHandler!=NULL)
- actionHandler->slotSetRelativeZero();
-}
-
-void CadToolBarSnap::lockRelativeZero(bool on)
-{
- if (cadToolBar!=NULL && actionHandler!=NULL)
- actionHandler->slotLockRelativeZero(on);
-}
-
-void CadToolBarSnap::setLockRelativeZero(bool on)
-{
- ui.bLockRelZero->setChecked(on);
-}
-
-void CadToolBarSnap::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
-}
-#else
#include "cadtoolbar.h"
#include "createqtactions.h"
CadToolBarSnap::CadToolBarSnap(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionSnapFree), 1, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapGrid), 1, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapEndpoint), 2, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapOnEntity), 2, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapCenter), 3, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapMiddle), 3, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapDist), 4, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapIntersection), 4, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSnapIntersectionManual), 5, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapFree), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapGrid), 1, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapEndpoint), 2, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapOnEntity), 2, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapCenter), 3, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapMiddle), 3, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapDist), 4, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapIntersection), 4, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSnapIntersectionManual), 5, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionRestrictNothing), 7, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionRestrictOrthogonal), 7, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionRestrictHorizontal), 8, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionRestrictVertical), 8, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionRestrictNothing), 7, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionRestrictOrthogonal), 7, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionRestrictHorizontal), 8, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionRestrictVertical), 8, 1, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionSetRelativeZero), 10, 0, 1, 1);
- gridLayout->addWidget(CreateToolButton(actionLockRelativeZero), 10, 1, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionSetRelativeZero), 10, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionLockRelativeZero), 10, 1, 1, 1);
}
CadToolBarSnap::~CadToolBarSnap()
{
}
-
-void CadToolBarSnap::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarSnap::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
-#endif
#ifndef __CADTOOLBARSNAP_H__
#define __CADTOOLBARSNAP_H__
-#if 0
-#include "ui_cadtoolbarsnap.h"
-
-class CadToolBar;
-class QG_ActionHandler;
-
-class CadToolBarSnap: public QWidget
-{
- Q_OBJECT
-
- public:
- CadToolBarSnap(QWidget* parent = 0, Qt::WindowFlags flags = 0);
- ~CadToolBarSnap();
-
- public slots:
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void snapFree();
- void snapGrid();
- void snapEndpoint();
- void snapOnEntity();
- void snapCenter();
- void snapMiddle();
- void snapDist();
- void snapIntersection();
- void snapIntersectionManual();
- void restrictNothing();
- void restrictOrthogonal();
- void restrictHorizontal();
- void restrictVertical();
- void disableSnaps();
- void disableRestrictions();
- void setSnapMode(int sm);
- void setSnapRestriction(int sr);
- void setRelativeZero();
- void lockRelativeZero(bool on);
- void setLockRelativeZero(bool on);
- void back();
-
- protected:
- QG_ActionHandler * actionHandler;
- CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarSnap ui;
-};
-#else
#include <QtGui>
class CadToolBar;
class CadToolBarSnap: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarSnap(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarSnap();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
-#endif
#endif // __CADTOOLBARSNAP_H__
#include "createqtactions.h"
CadToolBarSplines::CadToolBarSplines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
- QWidget((QWidget *)parent, flags), cadToolBar(parent)
+ QWidget((QWidget *)parent, flags)
{
QGridLayout * gridLayout = new QGridLayout(this);
gridLayout->setSpacing(0);
gridLayout->setContentsMargins(0, 0, 0, 0);
- QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(actionBack);
- QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- button->setSizePolicy(policy);
- gridLayout->addWidget(button, 0, 0, 1, 2);
- connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
+ gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2);
- gridLayout->addWidget(CreateToolButton(actionDrawSpline), 1, 0, 1, 1);
+ gridLayout->addWidget(parent->CreateToolButton(actionDrawSpline), 1, 0, 1, 1);
}
CadToolBarSplines::~CadToolBarSplines()
{
}
-
-void CadToolBarSplines::back()
-{
- cadToolBar->back();
-}
-
-QToolButton * CadToolBarSplines::CreateToolButton(QAction * action)
-{
- QToolButton * button = new QToolButton(this);
- button->setDefaultAction(action);
- button->setIconSize(QSize(18, 18));
-
- return button;
-}
class CadToolBarSplines: public QWidget
{
- Q_OBJECT
-
public:
CadToolBarSplines(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarSplines();
-
- protected slots:
- void back();
-
- private:
- QToolButton * CreateToolButton(QAction * action);
-
- protected:
- CadToolBar * cadToolBar;
};
#endif // __CADTOOLBARSPLINES_H__
public:
MDIWindow(RS_Document * doc, QWidget * parent, const char * name = NULL,
-// Qt::WindowFlags wflags = Qt::WDestructiveClose);
Qt::WindowFlags wflags = Qt::SubWindow);
~MDIWindow();
void slotFilePrint();
public:
-// QC_GraphicView * getGraphicView();
QG_GraphicView * getGraphicView();
RS_Document * getDocument();
Drawing * getGraphic();
RS_EventHandler * getEventHandler();
-
void addChildWindow(MDIWindow * w);
void removeChildWindow(MDIWindow * w);
MDIWindow * getPrintPreview();
void setParentWindow(MDIWindow * p);
int getId();
-
bool closeMDI(bool force, bool ask = true);
-
void setForceClosing(bool on);
friend std::ostream & operator<<(std::ostream & os, MDIWindow & w);
static int idCounter;
/** Graphic view */
//let's see if we can get rid of this...
-// QC_GraphicView * graphicView;
QG_GraphicView * graphicView;
/** Document */
RS_Document * document;
//w->setEraseColor(QColor(255,0,0));
gridStatus = new QLabel("-", this);
gridStatus->setAlignment(Qt::AlignRight);
+// gridStatus->setAutoFillBackground(true);
// layout->addMultiCellWidget(gridStatus, 1, 1, 1, 2);
layout->addWidget(gridStatus, 1, 1, 1, 2);
// layout->addColSpacing(1, 50);
RS_DEBUG->print("QG_GraphicView::resizeEvent end");
}
+/*
+This is retarded. There is absolutely no reason to have this shit in here.
+This could be easily called from whoever calls this crap.
+*/
// Next three methods from RS_LayerListListener Interface:
void QG_GraphicView::layerEdited(RS_Layer *)
{
* Instances of this class can be linked to layer lists using
* addLayerListListener().
*/
-//class QG_GraphicView: public QWidget, public RS_GraphicView, //public Q3FilePreview,
class QG_GraphicView: public QWidget, public GraphicView, //public Q3FilePreview,
public RS_LayerListListener, public RS_BlockListListener
{