FORMS = \
src/forms/blockdialog.ui \
- src/forms/cadtoolbar.ui \
- src/forms/cadtoolbararcs.ui \
- src/forms/cadtoolbarcircles.ui \
- src/forms/cadtoolbardim.ui \
- src/forms/cadtoolbarellipses.ui \
- src/forms/cadtoolbarinfo.ui \
- src/forms/cadtoolbarlines.ui \
src/forms/cadtoolbarmain.ui \
- src/forms/cadtoolbarmodify.ui \
- src/forms/cadtoolbarpoints.ui \
- src/forms/cadtoolbarpolylines.ui \
- src/forms/cadtoolbarselect.ui \
- src/forms/cadtoolbarsnap.ui \
- src/forms/cadtoolbarsplines.ui \
src/forms/commandwidget.ui \
src/forms/coordinatewidget.ui \
src/forms/dimensionlabeleditor.ui \
RS_Modification m(*container, graphicView);
m.mirror(data);
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
}
{
RS_DEBUG->print("RS_ActionModifyMirror::mouseMoveEvent begin");
- if (getStatus() == SetAxisPoint1
- || getStatus() == SetAxisPoint2)
+ if (getStatus() == SetAxisPoint1 || getStatus() == SetAxisPoint2)
{
Vector mouse = snapPoint(e);
clearPreview();
preview->addSelectionFrom(*container);
preview->mirror(axisPoint1, axisPoint2);
-
- preview->addEntity(new RS_Line(preview,
- RS_LineData(axisPoint1,
- axisPoint2)));
-
+ preview->addEntity(new RS_Line(preview,RS_LineData(axisPoint1,
+ axisPoint2)));
drawPreview();
}
break;
void RS_ActionModifyMirror::coordinateEvent(Vector * e)
{
- if (e == NULL)
+ if (!e)
return;
Vector mouse = *e;
setStatus(ShowDialog);
graphicView->moveRelativeZero(mouse);
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
if (RS_DIALOGFACTORY->requestMirrorDialog(data))
{
void RS_ActionModifyMirror::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
switch (getStatus())
{
}
}
}
-
-// EOF
#include "rs_dialogfactory.h"
#include "graphicview.h"
-RS_ActionSelect::RS_ActionSelect(RS_EntityContainer & container, GraphicView & graphicView, RS2::ActionType nextAction):
+RS_ActionSelect::RS_ActionSelect(RS_EntityContainer & container, GraphicView & graphicView,
+ RS2::ActionType nextAction):
RS_ActionInterface("Select Entities", container, graphicView)
{
this->nextAction = nextAction;
void RS_ActionSelect::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
if (!isFinished())
RS_DIALOGFACTORY->requestToolBarSelect(this, nextAction);
tbEllipses(NULL), tbArcs(NULL), tbModify(NULL), tbCircles(NULL), tbSnap(NULL),
tbSelect(NULL), tbPolylines(NULL)
{
- ui.setupUi(this);
+//hmm.
+#if 1
+ resize(86, 336);
+// QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding);
+// policy.setHorizontalStretch(0);
+// policy.setVerticalStretch(0);
+// policy.setHeightForWidth(sizePolicy().hasHeightForWidth());
+// setSizePolicy(policy);
+ setMinimumSize(QSize(56, 336));
+#endif
//hm. here maybe? Yesh!
-if (parent)
- ((QToolBar *)parent)->addWidget(this);
+ if (parent)
+ ((QToolBar *)parent)->addWidget(this);
}
CadToolBar::~CadToolBar()
currentTb = tbMain;
tbPoints = new CadToolBarPoints(this);
- tbPoints->setCadToolBar(this);
tbPoints->hide();
tbLines = new CadToolBarLines(this);
-// tbLines->setCadToolBar(this);
tbLines->hide();
tbArcs = new CadToolBarArcs(this);
- tbArcs->setCadToolBar(this);
tbArcs->hide();
tbCircles = new CadToolBarCircles(this);
- tbCircles->setCadToolBar(this);
tbCircles->hide();
tbEllipses = new CadToolBarEllipses(this);
- tbEllipses->setCadToolBar(this);
tbEllipses->hide();
tbSplines = new CadToolBarSplines(this);
- tbSplines->setCadToolBar(this);
tbSplines->hide();
tbPolylines = new CadToolBarPolylines(this);
- tbPolylines->setCadToolBar(this);
tbPolylines->hide();
tbDim = new CadToolBarDim(this);
- tbDim->setCadToolBar(this);
tbDim->hide();
tbInfo = new CadToolBarInfo(this);
- tbInfo->setCadToolBar(this);
tbInfo->hide();
tbModify = new CadToolBarModify(this);
- tbModify->setCadToolBar(this);
tbModify->hide();
tbSnap = new CadToolBarSnap(this);
- tbSnap->setCadToolBar(this);
tbSnap->hide();
tbSelect = new CadToolBarSelect(this);
- tbSelect->setCadToolBar(this);
tbSelect->hide();
}
#ifndef __CADTOOLBAR_H__
#define __CADTOOLBAR_H__
-#include "ui_cadtoolbar.h"
+//#include "ui_cadtoolbar.h"
+#include <QtGui>
class RS_ActionInterface;
class QG_ActionHandler;
CadToolBarSelect * tbSelect;
CadToolBarPolylines * tbPolylines;
- private:
- Ui::CadToolBar ui;
+// private:
+// Ui::CadToolBar ui;
};
#endif // __CADTOOLBAR_H__
#include "cadtoolbararcs.h"
+#if 0
#include "cadtoolbar.h"
#include "qg_actionhandler.h"
#include "rs_debug.h"
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)
+{
+ 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(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);
+}
+
+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
#ifndef __CADTOOLBARARCS_H__
#define __CADTOOLBARARCS_H__
-#include "ui_cadtoolbararcs.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarArcs: public QWidget
{
Q_OBJECT
public:
- CadToolBarArcs(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarArcs(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarArcs();
- public slots:
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawArc();
- void drawArc3P();
- void drawArcParallel();
- void drawArcTangential();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarArcs ui;
};
#endif // __CADTOOLBARARCS_H__
#include "cadtoolbarcircles.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarCircles::CadToolBarCircles(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarCircles::CadToolBarCircles(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
-
-CadToolBarCircles::~CadToolBarCircles()
-{
-}
-
-void CadToolBarCircles::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarCircles::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-void CadToolBarCircles::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
+ 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()));
- if (tb != NULL)
- {
- actionHandler = tb->getActionHandler();
- }
- else
- {
- RS_DEBUG->print(RS_Debug::D_ERROR,
- "CadToolBarCircles::setCadToolBar(): No valid toolbar set.");
- }
+ 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);
}
-void CadToolBarCircles::drawCircle()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawCircle();
-}
-
-void CadToolBarCircles::drawCircleCR()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawCircleCR();
-}
-
-void CadToolBarCircles::drawCircle2P()
+CadToolBarCircles::~CadToolBarCircles()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawCircle2P();
}
-void CadToolBarCircles::drawCircle3P()
+void CadToolBarCircles::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawCircle3P();
+ cadToolBar->back();
}
-void CadToolBarCircles::drawCircleParallel()
+QToolButton * CadToolBarCircles::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawCircleParallel();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarCircles::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARCIRCLES_H__
#define __CADTOOLBARCIRCLES_H__
-#include "ui_cadtoolbarcircles.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarCircles: public QWidget
{
Q_OBJECT
public:
- CadToolBarCircles(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarCircles(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarCircles();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawCircle();
- void drawCircleCR();
- void drawCircle2P();
- void drawCircle3P();
- void drawCircleParallel();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarCircles ui;
};
#endif // __CADTOOLBARCIRCLES_H__
#include "cadtoolbardim.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarDim::CadToolBarDim(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarDim::CadToolBarDim(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
-
-CadToolBarDim::~CadToolBarDim()
-{
-}
-
-void CadToolBarDim::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarDim::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarDim::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarDim::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarDim::drawDimAligned()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimAligned();
-}
-
-void CadToolBarDim::drawDimLinear()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimLinear();
-}
-
-void CadToolBarDim::drawDimLinearHor()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimLinearHor();
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-void CadToolBarDim::drawDimLinearVer()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimLinearVer();
-}
+ 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()));
-void CadToolBarDim::drawDimRadial()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimRadial();
+ 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);
}
-void CadToolBarDim::drawDimDiametric()
+CadToolBarDim::~CadToolBarDim()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimDiametric();
}
-void CadToolBarDim::drawDimAngular()
+void CadToolBarDim::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimAngular();
+ cadToolBar->back();
}
-void CadToolBarDim::drawDimLeader()
+QToolButton * CadToolBarDim::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDimLeader();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarDim::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARDIM_H__
#define __CADTOOLBARDIM_H__
-#include "ui_cadtoolbardim.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarDim: public QWidget
{
Q_OBJECT
public:
- CadToolBarDim(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarDim(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarDim();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawDimAligned();
- void drawDimLinear();
- void drawDimLinearHor();
- void drawDimLinearVer();
- void drawDimRadial();
- void drawDimDiametric();
- void drawDimAngular();
- void drawDimLeader();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarDim ui;
};
#endif // __CADTOOLBARDIM_H__
#include "cadtoolbarellipses.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarEllipses::CadToolBarEllipses(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarEllipses::CadToolBarEllipses(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-CadToolBarEllipses::~CadToolBarEllipses()
-{
-}
-
-void CadToolBarEllipses::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
+ 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()));
-void CadToolBarEllipses::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
+ gridLayout->addWidget(CreateToolButton(actionDrawEllipseAxis), 1, 0, 1, 1);
+ gridLayout->addWidget(CreateToolButton(actionDrawEllipseArcAxis), 1, 1, 1, 1);
}
-void CadToolBarEllipses::setCadToolBar(CadToolBar * tb)
+CadToolBarEllipses::~CadToolBarEllipses()
{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarEllipses::setCadToolBar(): No valid toolbar set.");
}
-void CadToolBarEllipses::drawEllipseAxis()
+void CadToolBarEllipses::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawEllipseAxis();
+ cadToolBar->back();
}
-void CadToolBarEllipses::drawEllipseArcAxis()
+QToolButton * CadToolBarEllipses::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawEllipseArcAxis();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarEllipses::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARELLIPSES_H__
#define __CADTOOLBARELLIPSES_H__
-#include "ui_cadtoolbarellipses.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarEllipses: public QWidget
{
Q_OBJECT
public:
- CadToolBarEllipses(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarEllipses(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarEllipses();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawEllipseAxis();
- void drawEllipseArcAxis();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarEllipses ui;
};
#endif // __CADTOOLBARELLIPSES_H__
#include "cadtoolbarinfo.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarInfo::CadToolBarInfo(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarInfo::CadToolBarInfo(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
-
-CadToolBarInfo::~CadToolBarInfo()
-{
-}
-
-void CadToolBarInfo::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarInfo::contextMenuEvent(QContextMenuEvent *e) {
- e->accept();
-}
-
-void CadToolBarInfo::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR,
- "CadToolBarInfo::setCadToolBar(): No valid toolbar set.");
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-void CadToolBarInfo::infoDist()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotInfoDist();
-}
+ 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()));
-void CadToolBarInfo::infoDist2()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotInfoDist2();
+ 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);
}
-void CadToolBarInfo::infoAngle()
+CadToolBarInfo::~CadToolBarInfo()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotInfoAngle();
}
-void CadToolBarInfo::infoTotalLength()
+void CadToolBarInfo::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotInfoTotalLength();
+ cadToolBar->back();
}
-void CadToolBarInfo::infoArea()
+QToolButton * CadToolBarInfo::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotInfoArea();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarInfo::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARINFO_H__
#define __CADTOOLBARINFO_H__
-#include "ui_cadtoolbarinfo.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarInfo: public QWidget
{
Q_OBJECT
public:
- CadToolBarInfo(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarInfo(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarInfo();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void infoDist();
- void infoDist2();
- void infoAngle();
- void infoTotalLength();
- void infoArea();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarInfo ui;
};
#endif // __CADTOOLBARINFO_H__
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CadToolBarLines</class>
- <widget class="QWidget" name="CadToolBarLines">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>56</width>
- <height>338</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>56</width>
- <height>336</height>
- </size>
- </property>
- <property name="windowTitle">
- <string>Lines</string>
- </property>
- <widget class="QToolButton" name="bBack">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>56</width>
- <height>20</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Back to main menu</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_back.xpm</normaloff>:res/qg_back.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bNormal">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>20</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Line with two points</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesnormal.xpm</normaloff>:res/qg_linesnormal.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bAngle">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>20</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Line with given angle</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesangle.xpm</normaloff>:res/qg_linesangle.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bHorizontal">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>48</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Horizontal lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_lineshor.xpm</normaloff>:res/qg_lineshor.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bVertical">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>48</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Vertical lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesver.xpm</normaloff>:res/qg_linesver.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bRectangle">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>76</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Rectangles</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesrect.xpm</normaloff>:res/qg_linesrect.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bBisector">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>76</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Bisectors</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesbisector.xpm</normaloff>:res/qg_linesbisector.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bParallel">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>104</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Parallels with distance</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linespara.xpm</normaloff>:res/qg_linespara.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bTangent1">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>132</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Tangents from point to circle</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linestan1.xpm</normaloff>:res/qg_linestan1.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bTangent2">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>132</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Tangents from circle to circle</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linestan2.xpm</normaloff>:res/qg_linestan2.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bOrthogonal">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>160</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Orthogonal lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesorthogonal.xpm</normaloff>:res/qg_linesorthogonal.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bRelAngle">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>160</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Lines with relative angles</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesrelativeangle.xpm</normaloff>:res/qg_linesrelativeangle.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bPolygon">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>188</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Polygons with Center and Corner</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linespolygon.xpm</normaloff>:res/qg_linespolygon.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bPolygon2">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>188</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Polygons with two Corners</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linespolygon2.xpm</normaloff>:res/qg_linespolygon2.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bFree">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>216</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Freehand lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesfree.xpm</normaloff>:res/qg_linesfree.xpm</iconset>
- </property>
- </widget>
- <widget class="QToolButton" name="bParallelThrough">
- <property name="geometry">
- <rect>
- <x>28</x>
- <y>104</y>
- <width>28</width>
- <height>28</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Parallels through point</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="res/architektonas.qrc">
- <normaloff>:res/qg_linesparathrough.xpm</normaloff>:res/qg_linesparathrough.xpm</iconset>
- </property>
- </widget>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections>
- <connection>
- <sender>bNormal</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLine()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bFree</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineFree()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bParallel</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineParallel()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bAngle</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineAngle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bHorizontal</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineHorizontal()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bBisector</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineBisector()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bTangent1</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineTangent1()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bTangent2</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineTangent2()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bRectangle</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineRectangle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bBack</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>back()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bRelAngle</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineRelAngle()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bVertical</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineVertical()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bOrthogonal</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineOrthogonal()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bPolygon</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLinePolygon()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bPolygon2</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLinePolygon2()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>bParallelThrough</sender>
- <signal>clicked()</signal>
- <receiver>CadToolBarLines</receiver>
- <slot>drawLineParallelThrough()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
#include "cadtoolbarmodify.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarModify::CadToolBarModify(QWidget * parent /*= 0*/, Qt::WindowFlags flags /*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarModify::CadToolBarModify(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
-
-CadToolBarModify::~CadToolBarModify()
-{
-}
-
-void CadToolBarModify::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarModify::contextMenuEvent(QContextMenuEvent *e)
-{
- e->accept();
-}
-
-void CadToolBarModify::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR,
- "CadToolBarModify::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarModify::modifyMove()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyMove();
-}
-
-void CadToolBarModify::modifyRotate()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyRotate();
-}
-
-void CadToolBarModify::modifyScale()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyScale();
-}
-
-void CadToolBarModify::modifyMirror()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyMirror();
-}
-
-void CadToolBarModify::modifyMoveRotate()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyMoveRotate();
-}
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
-void CadToolBarModify::modifyRotate2()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyRotate2();
-}
+ 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()));
-void CadToolBarModify::modifyTrim()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyTrim();
-}
+ 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);
-void CadToolBarModify::modifyTrim2()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyTrim2();
-}
+ gridLayout->addWidget(CreateToolButton(actionModifyTrim), 5, 0, 1, 1);
+ gridLayout->addWidget(CreateToolButton(actionModifyTrim2), 5, 1, 1, 1);
+ gridLayout->addWidget(CreateToolButton(actionModifyTrimAmount), 6, 0, 1, 1);
-void CadToolBarModify::modifyTrimAmount()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyTrimAmount();
-}
+ gridLayout->addWidget(CreateToolButton(actionModifyBevel), 8, 0, 1, 1);
+ gridLayout->addWidget(CreateToolButton(actionModifyRound), 8, 1, 1, 1);
-void CadToolBarModify::modifyCut()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyCut();
-}
+ gridLayout->addWidget(CreateToolButton(actionModifyCut), 10, 0, 1, 1);
+ gridLayout->addWidget(CreateToolButton(actionModifyStretch), 10, 1, 1, 1);
-void CadToolBarModify::modifyBevel()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyBevel();
-}
+ 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);
-void CadToolBarModify::modifyRound()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyRound();
+ gridLayout->addWidget(CreateToolButton(actionModifyExplodeText), 15, 0, 1, 1);
+#warning "!!! actionModifyEntityText is missing !!!"
+//EntityText
+// gridLayout->addWidget(CreateToolButton(actionModifyEntityText), 15, 1, 1, 1);
}
-void CadToolBarModify::modifyEntity()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyEntity();
-}
-
-void CadToolBarModify::modifyDelete()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyDelete();
-}
-
-void CadToolBarModify::modifyAttributes()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyAttributes();
-}
-
-void CadToolBarModify::modifyStretch()
+CadToolBarModify::~CadToolBarModify()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyStretch();
}
-void CadToolBarModify::modifyExplode()
+void CadToolBarModify::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotBlocksExplode();
+ cadToolBar->back();
}
-void CadToolBarModify::modifyExplodeText()
+QToolButton * CadToolBarModify::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotModifyExplodeText();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarModify::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
-
#ifndef __CADTOOLBARMODIFY_H__
#define __CADTOOLBARMODIFY_H__
-#include "ui_cadtoolbarmodify.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarModify: public QWidget
{
Q_OBJECT
public:
- CadToolBarModify(QWidget* parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarModify(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarModify();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void modifyMove();
- void modifyRotate();
- void modifyScale();
- void modifyMirror();
- void modifyMoveRotate();
- void modifyRotate2();
- void modifyTrim();
- void modifyTrim2();
- void modifyTrimAmount();
- void modifyCut();
- void modifyBevel();
- void modifyRound();
- void modifyEntity();
- void modifyDelete();
- void modifyAttributes();
- void modifyStretch();
- void modifyExplode();
- void modifyExplodeText();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarModify ui;
};
#endif // __CADTOOLBARMODIFY_H__
#include "cadtoolbarpoints.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarPoints::CadToolBarPoints(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarPoints::CadToolBarPoints(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
+ 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(actionDrawPoint), 1, 0, 1, 1);
}
CadToolBarPoints::~CadToolBarPoints()
{
}
-void CadToolBarPoints::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarPoints::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarPoints::setCadToolBar(CadToolBar * tb)
+void CadToolBarPoints::back()
{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarPoints::setCadToolBar(): No valid toolbar set.");
+ cadToolBar->back();
}
-void CadToolBarPoints::drawPoint()
+QToolButton * CadToolBarPoints::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawPoint();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarPoints::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARPOINTS_H__
#define __CADTOOLBARPOINTS_H__
-#include "ui_cadtoolbarpoints.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarPoints: public QWidget
{
Q_OBJECT
public:
- CadToolBarPoints(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarPoints(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarPoints();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawPoint();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarPoints ui;
};
#endif // __CADTOOLBARPOINTS_H__
#include "cadtoolbarpolylines.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarPolylines::CadToolBarPolylines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarPolylines::CadToolBarPolylines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
-}
-
-CadToolBarPolylines::~CadToolBarPolylines()
-{
-}
-
-void CadToolBarPolylines::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarPolylines::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarPolylines::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
+ QGridLayout * gridLayout = new QGridLayout(this);
+ gridLayout->setSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarPolylines::setCadToolBar(): No valid toolbar set.");
-}
+ 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()));
-void CadToolBarPolylines::drawPolyline()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawPolyline();
+ gridLayout->addWidget(CreateToolButton(actionDrawPolyline), 1, 0, 1, 1);
+ gridLayout->addWidget(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);
}
-void CadToolBarPolylines::polylineAdd()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineAdd();
-}
-
-void CadToolBarPolylines::polylineAppend()
-{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineAppend();
-}
-
-void CadToolBarPolylines::polylineDel()
+CadToolBarPolylines::~CadToolBarPolylines()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineDel();
}
-void CadToolBarPolylines::polylineDelBetween()
+void CadToolBarPolylines::back()
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineDelBetween();
+ cadToolBar->back();
}
-void CadToolBarPolylines::polylineTrim()
+QToolButton * CadToolBarPolylines::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotPolylineTrim();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarPolylines::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARPOLYLINES_H__
#define __CADTOOLBARPOLYLINES_H__
-#include "ui_cadtoolbarpolylines.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarPolylines: public QWidget
{
Q_OBJECT
public:
- CadToolBarPolylines(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarPolylines(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarPolylines();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawPolyline();
- void polylineAdd();
- void polylineAppend();
- void polylineDel();
- void polylineDelBetween();
- void polylineTrim();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarPolylines ui;
};
#endif // __CADTOOLBARPOLYLINES_H__
#include "cadtoolbarselect.h"
-#include "cadtoolbar.h"
#include "qg_actionhandler.h"
#include "rs_actioninterface.h"
-#include "rs_debug.h"
+#include "cadtoolbar.h"
+#include "createqtactions.h"
-CadToolBarSelect::CadToolBarSelect(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL), selectAction(NULL),
- nextAction(-1)
+CadToolBarSelect::CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent), actionHandler(NULL),
+ selectAction(NULL), nextAction(-1)
{
- ui.setupUi(this);
+ actionHandler = cadToolBar->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(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);
+
+ QAction * actionDoit = new QAction(QIcon(":/res/qg_forward"), tr("Forward"), this);
+ doit = new QToolButton(this);
+ doit->setDefaultAction(actionDoit);
+ doit->setSizePolicy(policy);
+ gridLayout->addWidget(doit, 6, 0, 1, 2);
+ connect(doit, SIGNAL(clicked()), this, SLOT(runNextAction()));
}
CadToolBarSelect::~CadToolBarSelect()
{
}
-void CadToolBarSelect::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarSelect::contextMenuEvent(QContextMenuEvent *e) {
- e->accept();
-}
-
-void CadToolBarSelect::setCadToolBar(CadToolBar * tb)
-{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- //actionHandler->setCadToolBarSelect(this);
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSelect::setCadToolBar(): No valid toolbar set.");
-}
-
-void CadToolBarSelect::selectSingle()
-{
- if (actionHandler!=NULL) {
- actionHandler->slotSelectSingle();
- }
-}
-
-void CadToolBarSelect::selectContour() {
- if (actionHandler!=NULL) {
- actionHandler->slotSelectContour();
- }
-}
-
-void CadToolBarSelect::deselectAll() {
- if (actionHandler!=NULL) {
- actionHandler->slotDeselectAll();
- }
-}
-
-void CadToolBarSelect::selectAll() {
- if (actionHandler!=NULL) {
- actionHandler->slotSelectAll();
- }
-}
-
-void CadToolBarSelect::selectWindow() {
- if (actionHandler!=NULL) {
- actionHandler->slotSelectWindow();
- }
-}
-
-void CadToolBarSelect::deselectWindow() {
- if (actionHandler!=NULL) {
- actionHandler->slotDeselectWindow();
- }
-}
-
-void CadToolBarSelect::selectIntersected() {
- if (actionHandler!=NULL) {
- actionHandler->slotSelectIntersected();
- }
-}
-
-void CadToolBarSelect::deselectIntersected() {
- if (actionHandler!=NULL) {
- actionHandler->slotDeselectIntersected();
- }
-}
-
-void CadToolBarSelect::selectInvert() {
- if (actionHandler!=NULL) {
- actionHandler->slotSelectInvert();
- }
-}
-
-void CadToolBarSelect::selectLayer()
-{
- if (actionHandler!=NULL)
- actionHandler->slotSelectLayer();
-}
-
+//hmm, should these three funcs be here???
void CadToolBarSelect::setSelectAction(RS_ActionInterface * selectAction)
{
this->selectAction = selectAction;
this->nextAction = nextAction;
if (nextAction == -1)
- ui.bDoit->hide();
+ doit->hide();
else
- ui.bDoit->show();
+ doit->show();
}
void CadToolBarSelect::runNextAction()
{
- if (selectAction != NULL)
+//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()
{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ cadToolBar->back();
+}
+
+QToolButton * CadToolBarSelect::CreateToolButton(QAction * action)
+{
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
+
+ return button;
}
#ifndef __CADTOOLBARSELECT_H__
#define __CADTOOLBARSELECT_H__
-#include "ui_cadtoolbarselect.h"
+#include <QtGui>
class CadToolBar;
class QG_ActionHandler;
Q_OBJECT
public:
- CadToolBarSelect(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarSelect();
+ void setSelectAction(RS_ActionInterface * selectAction);
+ void setNextAction(int nextAction);
+
public slots:
- virtual void mousePressEvent(QMouseEvent * e);
- virtual void contextMenuEvent(QContextMenuEvent * e);
- virtual void setCadToolBar(CadToolBar * tb);
- virtual void selectSingle();
- virtual void selectContour();
- virtual void deselectAll();
- virtual void selectAll();
- virtual void selectWindow();
- virtual void deselectWindow();
- virtual void selectIntersected();
- virtual void deselectIntersected();
- virtual void selectInvert();
- virtual void selectLayer();
- virtual void setSelectAction(RS_ActionInterface * selectAction);
- virtual void setNextAction(int nextAction);
- virtual void runNextAction();
- virtual void back();
+ void runNextAction();
+
+ protected slots:
+ void back();
+
+ private:
+ QToolButton * CreateToolButton(QAction * action);
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
private:
+ QToolButton * doit;
+ QG_ActionHandler * actionHandler;
RS_ActionInterface * selectAction;
int nextAction;
-
- private:
- Ui::CadToolBarSelect ui;
};
#endif // __CADTOOLBARSELECT_H__
#include "cadtoolbarsnap.h"
+#if 0
#include "cadtoolbar.h"
#include "qg_actionhandler.h"
#include "rs_debug.h"
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)
+{
+ 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(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(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(CreateToolButton(actionSetRelativeZero), 10, 0, 1, 1);
+ gridLayout->addWidget(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;
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 "cadtoolbarsplines.h"
#include "cadtoolbar.h"
-#include "qg_actionhandler.h"
-#include "rs_debug.h"
+#include "createqtactions.h"
-CadToolBarSplines::CadToolBarSplines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
- QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
+CadToolBarSplines::CadToolBarSplines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
+ QWidget((QWidget *)parent, flags), cadToolBar(parent)
{
- ui.setupUi(this);
+ 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(actionDrawSpline), 1, 0, 1, 1);
}
CadToolBarSplines::~CadToolBarSplines()
{
}
-void CadToolBarSplines::mousePressEvent(QMouseEvent * e)
-{
- if (e->button() == Qt::RightButton && cadToolBar != NULL)
- {
- cadToolBar->back();
- e->accept();
- }
-}
-
-void CadToolBarSplines::contextMenuEvent(QContextMenuEvent * e)
-{
- e->accept();
-}
-
-void CadToolBarSplines::setCadToolBar(CadToolBar * tb)
+void CadToolBarSplines::back()
{
- cadToolBar = tb;
-
- if (tb != NULL)
- actionHandler = tb->getActionHandler();
- else
- RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarSplines::setCadToolBar(): No valid toolbar set.");
+ cadToolBar->back();
}
-void CadToolBarSplines::drawSpline()
+QToolButton * CadToolBarSplines::CreateToolButton(QAction * action)
{
- if (cadToolBar != NULL && actionHandler != NULL)
- actionHandler->slotDrawSpline();
-}
+ QToolButton * button = new QToolButton(this);
+ button->setDefaultAction(action);
+ button->setIconSize(QSize(18, 18));
-void CadToolBarSplines::back()
-{
- if (cadToolBar != NULL)
- cadToolBar->back();
+ return button;
}
#ifndef __CADTOOLBARSPLINES_H__
#define __CADTOOLBARSPLINES_H__
-#include "ui_cadtoolbarsplines.h"
+#include <QtGui>
class CadToolBar;
-class QG_ActionHandler;
class CadToolBarSplines: public QWidget
{
Q_OBJECT
public:
- CadToolBarSplines(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ CadToolBarSplines(CadToolBar * parent, Qt::WindowFlags flags = 0);
~CadToolBarSplines();
- public slots:
- void mousePressEvent(QMouseEvent * e);
- void contextMenuEvent(QContextMenuEvent * e);
- void setCadToolBar(CadToolBar * tb);
- void drawSpline();
+ protected slots:
void back();
+ private:
+ QToolButton * CreateToolButton(QAction * action);
+
protected:
- QG_ActionHandler * actionHandler;
CadToolBar * cadToolBar;
-
- private:
- Ui::CadToolBarSplines ui;
};
#endif // __CADTOOLBARSPLINES_H__
<file>qg_restrictnothing.xpm</file>
<file>qg_restrictorthogonal.xpm</file>
<file>qg_restrictvertical.xpm</file>
- <file>qg_selectall.xpm</file>
- <file>qg_selectcontour.xpm</file>
- <file>qg_selectdoubles.xpm</file>
- <file>qg_selectinters.xpm</file>
- <file>qg_selectinvert.xpm</file>
- <file>qg_selectlayer.xpm</file>
- <file>qg_selectnothing.xpm</file>
- <file>qg_selectsingle.xpm</file>
- <file>qg_selectwindow.xpm</file>
<file>qg_snapcenter.xpm</file>
<file>qg_snapdist.xpm</file>
<file>qg_snapendpoint.xpm</file>
<file>qg_tolerance2.xpm</file>
<file>qg_widthbox.xpm</file>
<file>redo2.png</file>
+ <file>select-all.xpm</file>
+ <file>select-contour.xpm</file>
+ <file>select-intersection.xpm</file>
+ <file>select-invert.xpm</file>
+ <file>select-layer.xpm</file>
+ <file>select-none.xpm</file>
+ <file>select-nonintersection.xpm</file>
+ <file>select-nonwindow.xpm</file>
+ <file>select-single.xpm</file>
+ <file>select-window.xpm</file>
<file>splash.png</file>
- <file>splash_camexpert.xpm</file>
- <file>splash_qcad.xpm</file>
<file>undo2.png</file>
<file>viewdraft.png</file>
<file>viewdraft.xpm</file>
+++ /dev/null
-/* XPM */
-static const char *qg_selectall_xpm[] = {
-"18 16 2 1",
-"$ c None",
-"% c #ff0000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$%%%$$$$$$$$$%",
-"%$$$%$$$%$$$$$$$$%",
-"%$$$%$$$%$$$$%$$$%",
-"%$$$%$$$%$$$%%$$$%",
-"%$$$$%%%$$$%$%$$$%",
-"%$$$$$$$$$%$$%$$$%",
-"%$$$$$$$$%$$$%$$$%",
-"%%%%%%$$%%%%%%$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectcontour_xpm[] = {
-"18 16 3 1",
-"$ c None",
-"% c #ff0000",
-"& c #000000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$&&&$$$$$$$$$%",
-"%$$$&$$$&$$$$$$$$%",
-"%$$$&$$$&$$$$&$$$%",
-"%$$$&$$$&$$$&&$$$%",
-"%$$$$&&&$$$&$&$$$%",
-"%$$$$$$$$$&$$&$$$%",
-"%$$$$$$$$&$$$&$$$%",
-"%%%%%%$$&&&&&&$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectdoubles_xpm[] = {
-"18 16 3 1",
-"$ c None",
-"% c #000000",
-"& c #ff0000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%&&$$$$$$$$$&%",
-"$$%&&$$$$$$$$$$$&%",
-"$%&$$%%$$$$$$$$$&%",
-"$%&$%$$%$$$$$$$$&%",
-"%&$%$$$$%$$$$&$$&%",
-"%&$%$$$$%$$$&%$$&%",
-"%$$$%$$%$$$&%%$$&%",
-"%$$$$%%$$$&%$%$$&%",
-"%$$$$$$$$&%$$%$$&%",
-"%$$$$$$$&%$$$%$$&%",
-"%$$$$$$&%%%%%%$$&%",
-"%%%%%%$$$$$$$$$$&%",
-"$$$$$%$$$$$$$$$$&%",
-"$$$$$%$$$$$$$$$$&%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectinters_xpm[] = {
-"15 18 4 1",
-"$ c None",
-"% c #000000",
-"& c #ff0000",
-"' c #0000ff",
-"$$$$$$$$$%$$$$$",
-"$$$$$$$$%%%$$$$",
-"$$$$&&&&&'&&&&&",
-"$$%%$$$$$'$$$$%",
-"$%$$$$$$$'$$$$%",
-"$%$$%%%$$'$$$$%",
-"%$$%$$$%$'$$$$%",
-"%$$%$$$%$'$$$$%",
-"%$$%$$$%$'$&$$%",
-"%$$$%%%$$'&%$$%",
-"%$$$$$$$$'$%$$%",
-"%$$$$$$$&'$%$$%",
-"%%%%%$$&&'&&$$%",
-"$$$$%$$$$'$$$$%",
-"$$$$%$$$$'$$$$%",
-"$$$$&&&&&'&&&&&",
-"$$$$$$$$%%%$$$$",
-"$$$$$$$$$%$$$$$"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectinvert_xpm[] = {
-"18 16 4 1",
-"$ c None",
-"% c #0000ff",
-"& c #000000",
-"' c #ff0000",
-"%$$$$'''''''''''$$",
-"$%$''$$$$$$$$$$'$$",
-"$$%$$$$$$$$$$$$'$$",
-"$$'%$&&&$$$$$$$'$$",
-"$&$$%%$$&$$$$$$'$$",
-"$&$$'$%$&$$$$$$'$$",
-"$&$$'$$%&$$$&$$'$$",
-"$&$$$'''%$$&&$$'$$",
-"$&$$$$$$$%&$&$$'$$",
-"$&$$$$$$$'%$&$$'$$",
-"$&&&&&$$'''%&$$'$$",
-"$$$$$&$$$$$$%%$'$$",
-"$$$$$&$$$$$$$$%'$$",
-"$$$$$&&&&&&&&&&%$$",
-"$$$$$$$$$$$$$$$$%$",
-"$$$$$$$$$$$$$$$$$%"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectlayer_xpm[] = {
-"14 19 4 1",
-"$ c None",
-"% c #000000",
-"& c #ffffff",
-"' c #ff0000",
-"$$$$$$$$%%$$$$",
-"$$$$$$%%&%$$$$",
-"$$$$%%&&&%$$%%",
-"$$%%&&&%&%%%&%",
-"%%&&&%%&%%&&&%",
-"%&&%%&%%&&&&&%",
-"%&%&%%&&&&'&&%",
-"%&%&%&&&&&'&&%",
-"%&%&%&&&&''&&%",
-"%&%&%&&&&''&&%",
-"%&%&%&&&'&'&&%",
-"%&%%%&&&'&'&&%",
-"%&%&%&&'&''&&%",
-"%&&&%&&''&&&&%",
-"%&&&%&'&&&&&%%",
-"%&%%%&&&&&%%$$",
-"%%$$%&&&%%$$$$",
-"$$$$%&%%$$$$$$",
-"$$$$%%$$$$$$$$"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectnothing_xpm[] = {
-"18 16 2 1",
-"$ c None",
-"% c #000000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$%%%$$$$$$$$$%",
-"%$$$%$$$%$$$$$$$$%",
-"%$$$%$$$%$$$$%$$$%",
-"%$$$%$$$%$$$%%$$$%",
-"%$$$$%%%$$$%$%$$$%",
-"%$$$$$$$$$%$$%$$$%",
-"%$$$$$$$$%$$$%$$$%",
-"%%%%%%$$%%%%%%$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectsingle_xpm[] = {
-"15 18 4 1",
-"$ c None",
-"% c #000000",
-"& c #ffffff",
-"' c #ff0000",
-"$$$$$$$$$$$$$$'",
-"$$$$$$$$$$$$''$",
-"$$$$$$$$$$''$$$",
-"$$$$$$$$''$$$$$",
-"$$$$$$$'$$$$$$$",
-"$$$$$''%$$$$$$$",
-"$$$''$$%%$$$$$$",
-"$''$$$$%&%$$$$$",
-"'$$$$$$%&&%$$$$",
-"$$$$$$$%&&&%$$$",
-"$$$$$$$%&&&&%$$",
-"$$$$$$$%&&&%%%$",
-"$$$$$$$%&%&%$$$",
-"$$$$$$$%%%&&%$$",
-"$$$$$$$%$$%&%$$",
-"$$$$$$$$$$$%&%$",
-"$$$$$$$$$$$%&%$",
-"$$$$$$$$$$$$%$$"
-};
-
+++ /dev/null
-/* XPM */
-static const char *qg_selectwindow_xpm[] = {
-"18 16 4 1",
-"$ c None",
-"% c #000000",
-"& c #0000ff",
-"' c #ff0000",
-"$%$$$$$$$$$$$$$$$$",
-"%%%&&&&&&&&&&&&&&$",
-"$%$$$$$$$$$$$$$$&$",
-"$&$$$$$$$$$$$$$$&$",
-"$&$$$'''$$$$$$$$&$",
-"$&$$'$$$'$$$$$$$&$",
-"$&$$'$$$'$$$$'$$&$",
-"$&$$'$$$'$$$''$$&$",
-"$&$$$'''$$$'$'$$&$",
-"$&$$$$$$$$'$$'$$&$",
-"$&$$$$$$$'$$$'$$&$",
-"$&$$$$$$''''''$$&$",
-"$&$$$$$$$$$$$$$$&$",
-"$&$$$$$$$$$$$$$$%$",
-"$&&&&&&&&&&&&&&%%%",
-"$$$$$$$$$$$$$$$$%$"
-};
-
--- /dev/null
+/* XPM */
+static const char * image0_xpm[] = {
+"18 16 2 1",
+". c None",
+"# c #ff0000",
+".....#############",
+"...##............#",
+"..#..............#",
+".#...............#",
+".#...###.........#",
+"#...#...#........#",
+"#...#...#....#...#",
+"#...#...#...##...#",
+"#....###...#.#...#",
+"#.........#..#...#",
+"#........#...#...#",
+"######..######...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
--- /dev/null
+/* XPM */
+static const char * image7_xpm[] = {
+"18 16 3 1",
+". c None",
+"a c #000000",
+"# c #ff0000",
+".....#############",
+"...##............#",
+"..#..............#",
+".#...............#",
+".#...aaa.........#",
+"#...a...a........#",
+"#...a...a....a...#",
+"#...a...a...aa...#",
+"#....aaa...a.a...#",
+"#.........a..a...#",
+"#........a...a...#",
+"######..aaaaaa...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
--- /dev/null
+/* XPM */
+static const char * image2_xpm[] = {
+"15 18 4 1",
+". c None",
+"# c #000000",
+"b c #0000ff",
+"a c #ff0000",
+".........#.....",
+"........###....",
+"....aaaaabaaaaa",
+"..##.....b....#",
+".#.......b....#",
+".#..###..b....#",
+"#..#...#.b....#",
+"#..#...#.b....#",
+"#..#...#.b.a..#",
+"#...###..ba#..#",
+"#........b.#..#",
+"#.......ab.#..#",
+"#####..aabaa..#",
+"....#....b....#",
+"....#....b....#",
+"....aaaaabaaaaa",
+"........###....",
+".........#....."};
--- /dev/null
+/* XPM */
+static const char * image5_xpm[] = {
+"18 16 4 1",
+"# c None",
+"b c #000000",
+". c #0000ff",
+"a c #ff0000",
+".####aaaaaaaaaaa##",
+"#.#aa##########a##",
+"##.############a##",
+"##a.#bbb#######a##",
+"#b##..##b######a##",
+"#b##a#.#b######a##",
+"#b##a##.b###b##a##",
+"#b###aaa.##bb##a##",
+"#b#######.b#b##a##",
+"#b#######a.#b##a##",
+"#bbbbb##aaa.b##a##",
+"#####b######..#a##",
+"#####b########.a##",
+"#####bbbbbbbbbb.##",
+"################.#",
+"#################."};
--- /dev/null
+/* XPM */
+static const char * image6_xpm[] = {
+"14 19 4 1",
+". c None",
+"# c #000000",
+"b c #ff0000",
+"a c #ffffff",
+"........##....",
+"......##a#....",
+"....##aaa#..##",
+"..##aaa#a###a#",
+"##aaa##a##aaa#",
+"#aa##a##aaaaa#",
+"#a#a##aaaabaa#",
+"#a#a#aaaaabaa#",
+"#a#a#aaaabbaa#",
+"#a#a#aaaabbaa#",
+"#a#a#aaababaa#",
+"#a###aaababaa#",
+"#a#a#aababbaa#",
+"#aaa#aabbaaaa#",
+"#aaa#abaaaaa##",
+"#a###aaaaa##..",
+"##..#aaa##....",
+"....#a##......",
+"....##........"};
--- /dev/null
+/* XPM */
+static const char * image4_xpm[] = {
+"18 16 2 1",
+". c None",
+"# c #000000",
+".....#############",
+"...##............#",
+"..#..............#",
+".#...............#",
+".#...###.........#",
+"#...#...#........#",
+"#...#...#....#...#",
+"#...#...#...##...#",
+"#....###...#.#...#",
+"#.........#..#...#",
+"#........#...#...#",
+"######..######...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
--- /dev/null
+/* XPM */
+static const char * image3_xpm[] = {
+"15 18 4 1",
+". c None",
+"# c #000000",
+"b c #0000ff",
+"a c #ff0000",
+".........#.....",
+"........###....",
+"....a####b#####",
+"..aa.....b....a",
+".a.......b....a",
+".a..aaa..b....a",
+"a..a...a.b....a",
+"a..a...a.b....a",
+"a..a...a.b.#..a",
+"a...aaa..b#a..a",
+"a........b.a..a",
+"a.......#b.a..a",
+"aaaaa..##b##..a",
+"....a....b....a",
+"....a....b....a",
+"....#####b#####",
+"........###....",
+".........#....."};
--- /dev/null
+/* XPM */
+static const char * image9_xpm[] = {
+"18 17 3 1",
+". c None",
+"# c #000000",
+"a c #0000ff",
+".#................",
+"###aaaaaaaaaaaaaa.",
+".#..............a.",
+".a..............a.",
+".a...##.........a.",
+".a..#..#........a.",
+".a.#....#.......a.",
+".a.#....#....#..a.",
+".a..#..#....##..a.",
+".a...##....#.#..a.",
+".a........#..#..a.",
+".a.......#...#..a.",
+".a......######..a.",
+".a..............a.",
+".a..............#.",
+".aaaaaaaaaaaaaa###",
+"................#."};
--- /dev/null
+/* XPM */
+static const char * image8_xpm[] = {
+"15 18 4 1",
+". c None",
+"a c #000000",
+"# c #ff0000",
+"b c #ffffff",
+"..............#",
+"............##.",
+"..........##...",
+"........##.....",
+".......#.......",
+".....##a.......",
+"...##..aa......",
+".##....aba.....",
+"#......abba....",
+".......abbba...",
+".......abbbba..",
+".......abbbaaa.",
+".......ababa...",
+".......aaabba..",
+".......a..aba..",
+"...........aba.",
+"...........aba.",
+"............a.."};
--- /dev/null
+/* XPM */
+static const char * image10_xpm[] = {
+"18 16 4 1",
+". c None",
+"# c #000000",
+"a c #0000ff",
+"b c #ff0000",
+".#................",
+"###aaaaaaaaaaaaaa.",
+".#..............a.",
+".a..............a.",
+".a...bbb........a.",
+".a..b...b.......a.",
+".a..b...b....b..a.",
+".a..b...b...bb..a.",
+".a...bbb...b.b..a.",
+".a........b..b..a.",
+".a.......b...b..a.",
+".a......bbbbbb..a.",
+".a..............a.",
+".a..............#.",
+".aaaaaaaaaaaaaa###",
+"................#."};
QAction * actionModifyDelete;
QAction * actionModifyDeleteQuick;
QAction * actionModifyExplodeText;
-//QAction * actionModifyExplode;
+QAction * actionModifyExplode;
QAction * actionSnapFree;
QAction * actionSnapGrid;
actionViewStatusbar->setCheckable(true);
actionFocusCommandLine = CreateAction(tr("Focus on &Command Line"), tr("Focus on Command Line"), tr(""), QIcon(":/res/editclear.png"), QKeySequence(Qt::Key_Space), parent);
- actionDeselectAll = CreateAction2(tr("Deselect &all"), tr("Deselect all"), tr("Deselects all Entities"), QIcon(":/res/qg_selectnothing.xpm"), QKeySequence("t, n"), QKeySequence(Qt::CTRL + Qt::Key_K), parent);
- actionSelectAll = CreateAction2(tr("Select &All"), tr("Select All"), tr("Selects all Entities"), QIcon(":/res/qg_selectall.xpm"), QKeySequence("t, a"), QKeySequence(Qt::CTRL + Qt::Key_A), parent);
- actionSelectSingle = CreateAction(tr("(De-)&Select Entity"), tr("Select Entity"), tr("Selects single Entities"), QIcon(":/res/qg_selectsingle.xpm"), QKeySequence("t, s"), NULL);
- actionSelectContour = CreateAction(tr("(De-)Select &Contour"), tr("(De-)Select Contour"), tr("(De-)Selects connected entities"), QIcon(":/res/qg_selectcontour.xpm"), QKeySequence("t, c"), NULL);
- actionDeselectWindow = CreateAction(tr("Deselect &Window"), tr("Deselect Window"), tr("Deselects all Entities in a given Window"), QIcon(), QKeySequence("u, w"), NULL);
- actionSelectWindow = CreateAction(tr("Select &Window"), tr("Select Window"), tr("Selects all Entities in a given Window"), QIcon(":/res/qg_selectwindow.xpm"), QKeySequence("t, w"), NULL);
- actionSelectInvert = CreateAction(tr("&Invert Selection"), tr("Invert Selection"), tr("Inverts the current selection"), QIcon(":/res/qg_selectinvert.xpm"), QKeySequence("t, i"), NULL);
- actionSelectIntersected = CreateAction(tr("In&tersected Entities"), tr("Select Intersected Entities"), tr("Selects all entities intersected by a line"), QIcon(":/res/qg_selectinters.xpm"), QKeySequence("t, x"), NULL);
- actionDeselectIntersected = CreateAction(tr("Deselect Inte&rsected Entities"), tr("Deselect Intersected Entities"), tr("Deselects all entities intersected by a line"), QIcon(), QKeySequence("u, x"), NULL);
- actionSelectLayer = CreateAction(tr("(De-)Select Layer"), tr("(De-)Select Layer"), tr("(De-)Selects layers"), QIcon(":/res/qg_selectlayer.xpm"), QKeySequence("t, l"), NULL);
+ actionDeselectAll = CreateAction2(tr("Deselect &all"), tr("Deselect all"), tr("Deselects all Entities"), QIcon(":/res/select-none"), QKeySequence("t, n"), QKeySequence(Qt::CTRL + Qt::Key_K), parent);
+ actionSelectAll = CreateAction2(tr("Select &All"), tr("Select All"), tr("Selects all Entities"), QIcon(":/res/select-all"), QKeySequence("t, a"), QKeySequence(Qt::CTRL + Qt::Key_A), parent);
+ actionSelectSingle = CreateAction(tr("(De-)&Select Entity"), tr("Select Entity"), tr("Selects single Entities"), QIcon(":/res/select-single"), QKeySequence("t, s"), NULL);
+ actionSelectContour = CreateAction(tr("(De-)Select &Contour"), tr("(De-)Select Contour"), tr("(De-)Selects connected entities"), QIcon(":/res/select-contour"), QKeySequence("t, c"), NULL);
+ actionDeselectWindow = CreateAction(tr("Deselect &Window"), tr("Deselect Window"), tr("Deselects all Entities in a given Window"), QIcon(":/res/select-nonwindow"), QKeySequence("u, w"), NULL);
+ actionSelectWindow = CreateAction(tr("Select &Window"), tr("Select Window"), tr("Selects all Entities in a given Window"), QIcon(":/res/select-window"), QKeySequence("t, w"), NULL);
+ actionSelectInvert = CreateAction(tr("&Invert Selection"), tr("Invert Selection"), tr("Inverts the current selection"), QIcon(":/res/select-invert"), QKeySequence("t, i"), NULL);
+ actionSelectIntersected = CreateAction(tr("In&tersected Entities"), tr("Select Intersected Entities"), tr("Selects all entities intersected by a line"), QIcon(":/res/select-intersection"), QKeySequence("t, x"), NULL);
+ actionDeselectIntersected = CreateAction(tr("Deselect Inte&rsected Entities"), tr("Deselect Intersected Entities"), tr("Deselects all entities intersected by a line"), QIcon(":/res/select-nonintersection"), QKeySequence("u, x"), NULL);
+ actionSelectLayer = CreateAction(tr("(De-)Select Layer"), tr("(De-)Select Layer"), tr("(De-)Selects layers"), QIcon(":/res/select-layer"), QKeySequence("t, l"), NULL);
actionDrawPoint = CreateAction(tr("&Points"), tr("Points"), tr("Draw Points"), QIcon(":/res/qg_points.xpm"), QKeySequence("p, o"), NULL);
actionDrawLine = CreateAction(tr("&2 Points"), tr("Line: 2 Points"), tr("Draw lines"), QIcon(":/res/qg_linesnormal.xpm"), QKeySequence("l, i"), NULL);
#endif
), parent);
actionModifyExplodeText = CreateAction(tr("&Explode Text into Letters"), tr("Explode Text"), tr("Explodes Text Entities into single Letters"), QIcon(":/res/qg_modifyexplodetext.xpm"), QKeySequence("x, e"), NULL);
-// actionModifyExplode = CreateAction(tr("&Explode"), tr("Explode"), tr("Explode Blocks and other Entity Groups"), QIcon(":/res/qg_modifyexplode.xpm"), QKeySequence("x, p"), NULL);
+ actionModifyExplode = CreateAction(tr("&Explode"), tr("Explode"), tr("Explode Blocks and other Entity Groups"), QIcon(":/res/qg_modifyexplode.xpm"), QKeySequence("x, p"), NULL);
actionSnapFree = CreateAction(tr("&Free"), tr("Free"), tr("Free positioning"), QIcon(":/res/qg_snapfree.xpm"), QKeySequence("s, f"), parent);
actionSnapFree->setCheckable(true);
extern QAction * actionModifyDelete;
extern QAction * actionModifyDeleteQuick;
extern QAction * actionModifyExplodeText;
-//extern QAction * actionModifyExplode;
+extern QAction * actionModifyExplode;
extern QAction * actionSnapFree;
extern QAction * actionSnapGrid;
{
GraphicView * gv = mainWindow->getGraphicView();
- if (gv != NULL)
+ if (gv)
gv->killSelectActions();
}
return NULL;
}
- if (action != NULL)
+ if (action)
gv->setCurrentAction(action);
return action;
break;
}
- if (a != NULL)
+ if (a)
gv->setCurrentAction(a);
RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK");
{
RS_ActionInterface * currentAction = getCurrentAction();
- if (currentAction != NULL)
+ if (currentAction)
return currentAction->getAvailableCommands();
else
{
//RS_keycodeEvent e(cmd);
//GraphicView* gv = mainWindow->getGraphicView();
- //if (gv!=NULL) {
+ //if (gv) {
// gv->keycodeEvent(&e);
//}
{
GraphicView * gv = mainWindow->getGraphicView();
- if (gv != NULL)
+ if (gv)
gv->back();
RS_DEBUG->print("QG_ActionHandler::command: back");
GraphicView * gv = mainWindow->getGraphicView();
- if (gv != NULL)
+ if (gv)
{
RS_DEBUG->print("QG_ActionHandler::command: trigger command event in graphic view");
gv->commandEvent(&e);
{
disableSnaps();
- if (snapFree != NULL)
+ if (snapFree)
snapFree->setChecked(true);
-
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapFree);
-
+#endif
setCurrentAction(RS2::ActionSnapFree);
}
{
disableSnaps();
- if (snapGrid != NULL)
+ if (snapGrid)
snapGrid->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapGrid);
-
+#endif
setCurrentAction(RS2::ActionSnapGrid);
}
{
disableSnaps();
- if (snapEndpoint != NULL)
+ if (snapEndpoint)
snapEndpoint->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapEndpoint);
-
+#endif
setCurrentAction(RS2::ActionSnapEndpoint);
}
void QG_ActionHandler::slotSnapOnEntity()
{
disableSnaps();
- if (snapOnEntity!=NULL) {
+ if (snapOnEntity)
snapOnEntity->setChecked(true);
- }
-//#if QT_VERSION>=0x030000
- if (cadToolBarSnap!=NULL) {
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapOnEntity);
- }
-//#endif
+#endif
setCurrentAction(RS2::ActionSnapOnEntity);
}
{
disableSnaps();
- if (snapCenter != NULL)
+ if (snapCenter)
snapCenter->setChecked(true);
-//#if QT_VERSION>=0x030000
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapCenter);
-//#endif
+#endif
setCurrentAction(RS2::ActionSnapCenter);
}
{
disableSnaps();
- if (snapMiddle != NULL)
+ if (snapMiddle)
snapMiddle->setChecked(true);
-//#if QT_VERSION>=0x030000
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapMiddle);
-//#endif
+#endif
setCurrentAction(RS2::ActionSnapMiddle);
}
{
disableSnaps();
- if (snapDist != NULL)
+ if (snapDist)
snapDist->setChecked(true);
-//#if QT_VERSION>=0x030000
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapDist);
-//#endif
+#endif
setCurrentAction(RS2::ActionSnapDist);
}
{
disableSnaps();
- if (snapIntersection != NULL)
+ if (snapIntersection)
snapIntersection->setChecked(true);
-//#if QT_VERSION>=0x030000
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapMode(RS2::SnapIntersection);
-//#endif
+#endif
setCurrentAction(RS2::ActionSnapIntersection);
}
void QG_ActionHandler::slotSnapIntersectionManual()
{
//disableSnaps();
- /*if (snapIntersectionManual!=NULL) {
+ /*if (snapIntersectionManual) {
snapIntersectionManual->setChecked(true);
}*/
- /*if (cadToolBarSnap!=NULL) {
+ /*if (cadToolBarSnap) {
cadToolBarSnap->setSnapMode(RS2::SnapIntersectionManual);
}*/
setCurrentAction(RS2::ActionSnapIntersectionManual);
void QG_ActionHandler::disableSnaps()
{
- if (snapFree != NULL)
+ if (snapFree)
snapFree->setChecked(false);
- if (snapGrid != NULL)
+ if (snapGrid)
snapGrid->setChecked(false);
- if (snapEndpoint != NULL)
+ if (snapEndpoint)
snapEndpoint->setChecked(false);
- if (snapOnEntity != NULL)
+ if (snapOnEntity)
snapOnEntity->setChecked(false);
- if (snapCenter != NULL)
+ if (snapCenter)
snapCenter->setChecked(false);
- if (snapMiddle != NULL)
+ if (snapMiddle)
snapMiddle->setChecked(false);
- if (snapDist != NULL)
+ if (snapDist)
snapDist->setChecked(false);
- if (snapIntersection != NULL)
+ if (snapIntersection)
snapIntersection->setChecked(false);
- if (snapIntersectionManual != NULL)
+ if (snapIntersectionManual)
snapIntersectionManual->setChecked(false);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->disableSnaps();
+#endif
}
void QG_ActionHandler::slotRestrictNothing()
{
disableRestrictions();
- if (restrictNothing != NULL)
+ if (restrictNothing)
restrictNothing->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapRestriction(RS2::RestrictNothing);
-
+#endif
setCurrentAction(RS2::ActionRestrictNothing);
}
{
disableRestrictions();
- if (restrictOrthogonal != NULL)
+ if (restrictOrthogonal)
restrictOrthogonal->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapRestriction(RS2::RestrictOrthogonal);
-
+#endif
setCurrentAction(RS2::ActionRestrictOrthogonal);
}
{
disableRestrictions();
- if (restrictHorizontal != NULL)
+ if (restrictHorizontal)
restrictHorizontal->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapRestriction(RS2::RestrictHorizontal);
+#endif
setCurrentAction(RS2::ActionRestrictHorizontal);
}
{
disableRestrictions();
- if (restrictVertical != NULL)
+ if (restrictVertical)
restrictVertical->setChecked(true);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setSnapRestriction(RS2::RestrictVertical);
-
+#endif
setCurrentAction(RS2::ActionRestrictVertical);
}
void QG_ActionHandler::disableRestrictions()
{
- if (restrictNothing != NULL)
+ if (restrictNothing)
restrictNothing->setChecked(false);
- if (restrictOrthogonal != NULL)
+ if (restrictOrthogonal)
restrictOrthogonal->setChecked(false);
- if (restrictHorizontal != NULL)
+ if (restrictHorizontal)
restrictHorizontal->setChecked(false);
- if (restrictVertical != NULL)
+ if (restrictVertical)
restrictVertical->setChecked(false);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->disableRestrictions();
+#endif
}
/**
*/
void QG_ActionHandler::updateSnapMode()
{
- if (snapFree != NULL && snapFree->isChecked())
+ if (snapFree && snapFree->isChecked())
slotSnapFree();
- else if (snapGrid != NULL && snapGrid->isChecked())
+ else if (snapGrid && snapGrid->isChecked())
slotSnapGrid();
- else if (snapEndpoint != NULL && snapEndpoint->isChecked())
+ else if (snapEndpoint && snapEndpoint->isChecked())
slotSnapEndpoint();
- else if (snapOnEntity != NULL && snapOnEntity->isChecked())
+ else if (snapOnEntity && snapOnEntity->isChecked())
slotSnapOnEntity();
- else if (snapCenter != NULL && snapCenter->isChecked())
+ else if (snapCenter && snapCenter->isChecked())
slotSnapCenter();
- else if (snapMiddle != NULL && snapMiddle->isChecked())
+ else if (snapMiddle && snapMiddle->isChecked())
slotSnapMiddle();
- else if (snapDist != NULL && snapDist->isChecked())
+ else if (snapDist && snapDist->isChecked())
slotSnapDist();
- else if (snapIntersection != NULL && snapIntersection->isChecked())
+ else if (snapIntersection && snapIntersection->isChecked())
slotSnapIntersection();
// snap restricitons:
- if (restrictNothing != NULL && restrictNothing->isChecked())
+ if (restrictNothing && restrictNothing->isChecked())
slotRestrictNothing();
- else if (restrictOrthogonal != NULL && restrictOrthogonal->isChecked())
+ else if (restrictOrthogonal && restrictOrthogonal->isChecked())
slotRestrictOrthogonal();
- else if (restrictHorizontal != NULL && restrictHorizontal->isChecked())
+ else if (restrictHorizontal && restrictHorizontal->isChecked())
slotRestrictHorizontal();
- else if (restrictVertical != NULL && restrictVertical->isChecked())
+ else if (restrictVertical && restrictVertical->isChecked())
slotRestrictVertical();
// lock of relative zero:
- if (lockRelativeZero != NULL)
+ if (lockRelativeZero)
slotLockRelativeZero(lockRelativeZero->isChecked());
}
void QG_ActionHandler::slotLockRelativeZero(bool on)
{
- if (lockRelativeZero != NULL)
+ if (lockRelativeZero)
lockRelativeZero->setChecked(on);
if (on)
else
setCurrentAction(RS2::ActionUnlockRelativeZero);
- if (cadToolBarSnap != NULL)
+#if 0
+ if (cadToolBarSnap)
cadToolBarSnap->setLockRelativeZero(on);
+#endif
}
void QG_ActionHandler::slotInfoInside()
void QG_ActionHandler::slotFocusNormal()
{
//QG_GraphicView* gv = mainWindow->getGraphicView();
- //if (gv!=NULL) {
+ //if (gv) {
//gv->setFocus();
mainWindow->setFocus2();
//}