]> Shamusworld >> Repos - architektonas/commitdiff
Refactored CAD tool bars to use predefined actions.
authorShamus Hammons <jlhamm@acm.org>
Mon, 21 Jun 2010 03:44:08 +0000 (03:44 +0000)
committerShamus Hammons <jlhamm@acm.org>
Mon, 21 Jun 2010 03:44:08 +0000 (03:44 +0000)
51 files changed:
architektonas.pro
src/actions/rs_actionmodifymirror.cpp
src/actions/rs_actionselect.cpp
src/forms/cadtoolbar.cpp
src/forms/cadtoolbar.h
src/forms/cadtoolbararcs.cpp
src/forms/cadtoolbararcs.h
src/forms/cadtoolbarcircles.cpp
src/forms/cadtoolbarcircles.h
src/forms/cadtoolbardim.cpp
src/forms/cadtoolbardim.h
src/forms/cadtoolbarellipses.cpp
src/forms/cadtoolbarellipses.h
src/forms/cadtoolbarinfo.cpp
src/forms/cadtoolbarinfo.h
src/forms/cadtoolbarlines.ui [deleted file]
src/forms/cadtoolbarmodify.cpp
src/forms/cadtoolbarmodify.h
src/forms/cadtoolbarpoints.cpp
src/forms/cadtoolbarpoints.h
src/forms/cadtoolbarpolylines.cpp
src/forms/cadtoolbarpolylines.h
src/forms/cadtoolbarselect.cpp
src/forms/cadtoolbarselect.h
src/forms/cadtoolbarsnap.cpp
src/forms/cadtoolbarsnap.h
src/forms/cadtoolbarsplines.cpp
src/forms/cadtoolbarsplines.h
src/forms/res/architektonas.qrc
src/forms/res/qg_selectall.xpm [deleted file]
src/forms/res/qg_selectcontour.xpm [deleted file]
src/forms/res/qg_selectdoubles.xpm [deleted file]
src/forms/res/qg_selectinters.xpm [deleted file]
src/forms/res/qg_selectinvert.xpm [deleted file]
src/forms/res/qg_selectlayer.xpm [deleted file]
src/forms/res/qg_selectnothing.xpm [deleted file]
src/forms/res/qg_selectsingle.xpm [deleted file]
src/forms/res/qg_selectwindow.xpm [deleted file]
src/forms/res/select-all.xpm [new file with mode: 0644]
src/forms/res/select-contour.xpm [new file with mode: 0644]
src/forms/res/select-intersection.xpm [new file with mode: 0644]
src/forms/res/select-invert.xpm [new file with mode: 0644]
src/forms/res/select-layer.xpm [new file with mode: 0644]
src/forms/res/select-none.xpm [new file with mode: 0644]
src/forms/res/select-nonintersection.xpm [new file with mode: 0644]
src/forms/res/select-nonwindow.xpm [new file with mode: 0644]
src/forms/res/select-single.xpm [new file with mode: 0644]
src/forms/res/select-window.xpm [new file with mode: 0644]
src/mainapp/createqtactions.cpp
src/mainapp/createqtactions.h
src/widgets/qg_actionhandler.cpp

index a7952aafdf040db4e14c234f358b0c67963fb25b..9cb30c5b26930abec9153f87220a78f335bc3707 100644 (file)
@@ -582,20 +582,7 @@ SOURCES += \
 
 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 \
index ea2cd260efc9fef07cb7a340f7147a118b5bc8af..215a10efcada1331c3b9bf010a06244c5caba749 100644 (file)
@@ -38,7 +38,7 @@ void RS_ActionModifyMirror::trigger()
        RS_Modification m(*container, graphicView);
        m.mirror(data);
 
-       if (RS_DIALOGFACTORY != NULL)
+       if (RS_DIALOGFACTORY)
                RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
 }
 
@@ -46,8 +46,7 @@ void RS_ActionModifyMirror::mouseMoveEvent(QMouseEvent * e)
 {
        RS_DEBUG->print("RS_ActionModifyMirror::mouseMoveEvent begin");
 
-       if (getStatus() == SetAxisPoint1
-           || getStatus() == SetAxisPoint2)
+       if (getStatus() == SetAxisPoint1 || getStatus() == SetAxisPoint2)
        {
                Vector mouse = snapPoint(e);
 
@@ -67,11 +66,8 @@ void RS_ActionModifyMirror::mouseMoveEvent(QMouseEvent * 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;
@@ -101,7 +97,7 @@ void RS_ActionModifyMirror::mouseReleaseEvent(QMouseEvent * e)
 
 void RS_ActionModifyMirror::coordinateEvent(Vector * e)
 {
-       if (e == NULL)
+       if (!e)
                return;
 
        Vector mouse = *e;
@@ -119,7 +115,7 @@ void RS_ActionModifyMirror::coordinateEvent(Vector * e)
                setStatus(ShowDialog);
                graphicView->moveRelativeZero(mouse);
 
-               if (RS_DIALOGFACTORY != NULL)
+               if (RS_DIALOGFACTORY)
                {
                        if (RS_DIALOGFACTORY->requestMirrorDialog(data))
                        {
@@ -140,7 +136,7 @@ void RS_ActionModifyMirror::coordinateEvent(Vector * e)
 
 void RS_ActionModifyMirror::updateMouseButtonHints()
 {
-       if (RS_DIALOGFACTORY != NULL)
+       if (RS_DIALOGFACTORY)
        {
                switch (getStatus())
                {
@@ -189,5 +185,3 @@ void RS_ActionModifyMirror::updateToolBar()
                }
        }
 }
-
-// EOF
index 1fe684a39549a57acbb3b7228d8d6be4d64d96fc..83077c7d54046ecce984ddf3331d36b74ac08b10 100644 (file)
@@ -18,7 +18,8 @@
 #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;
@@ -42,7 +43,7 @@ void RS_ActionSelect::mouseReleaseEvent(QMouseEvent * e)
 
 void RS_ActionSelect::updateToolBar()
 {
-       if (RS_DIALOGFACTORY != NULL)
+       if (RS_DIALOGFACTORY)
        {
                if (!isFinished())
                        RS_DIALOGFACTORY->requestToolBarSelect(this, nextAction);
index 2ae0746f427baeae21cd65f8d2a89c400e0deeda..fd44fc798609494bc8630502cbbd34a45c5d353a 100644 (file)
@@ -35,10 +35,19 @@ CadToolBar::CadToolBar(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
        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()
@@ -97,51 +106,39 @@ void CadToolBar::createSubToolBars(QG_ActionHandler * ah)
        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();
 }
 
index 52065fd95eb468452cbe60f98b3d801c5666453f..c593a286dfa56384f6d72b7a4cc4e6c3561de93e 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef __CADTOOLBAR_H__
 #define __CADTOOLBAR_H__
 
-#include "ui_cadtoolbar.h"
+//#include "ui_cadtoolbar.h"
+#include <QtGui>
 
 class RS_ActionInterface;
 class QG_ActionHandler;
@@ -72,8 +73,8 @@ class CadToolBar: public QWidget
                CadToolBarSelect * tbSelect;
                CadToolBarPolylines * tbPolylines;
 
-       private:
-               Ui::CadToolBar ui;
+//     private:
+//             Ui::CadToolBar ui;
 };
 
 #endif // __CADTOOLBAR_H__
index 6ea2bd0689ff4d56505c626ca9fc5b2803c4fb2e..98469c14bc02bdf648c528a7458b83afc76cee62 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "cadtoolbararcs.h"
 
+#if 0
 #include "cadtoolbar.h"
 #include "qg_actionhandler.h"
 #include "rs_debug.h"
@@ -79,3 +80,46 @@ 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)
+{
+       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
index 47dc709a706682f24dc12b64e02beab75c2f7e09..d29afc27ce5826ad8b929f61d91cdcf0920a9525 100644 (file)
@@ -1,34 +1,26 @@
 #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__
index 0ca00d6ab10360a03eeefc754d811df0a5be4ea9..17a3671a132507492a9281d43c398ddaf0ea68d8 100644 (file)
 #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;
 }
index 3383463457fb4c370ef7337317fb60f4b4bb1d44..edfe31e3ef1ed299123e80b270993cd3045f71f1 100644 (file)
@@ -1,36 +1,26 @@
 #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__
index b6eb56757ebc8cfe57a784f19e52b49f453f598d..8d7caf1ce2ced45245e32994176fec79bcd461dd 100644 (file)
 #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;
 }
index 4fad20686be920d643a7e04e394e7272ee835c14..2c80cb6142b39f2bde12cb8e2921cf1cbf27819f 100644 (file)
@@ -1,39 +1,26 @@
 #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__
index 6e385327fbe3d1fe09b2416d1a55788e40cefcf4..db170f6fc0c6e1565dc392a0c1b78d1fa90a6bee 100644 (file)
 #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;
 }
index a0008b1b5b7fe73693ddef6c180c3beeb3b5dd7f..7f778e93c6140cee82ed6e8a4d2bbb4b3f702105 100644 (file)
@@ -1,33 +1,26 @@
 #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__
index 98daa80c0f8c7fdd1b69e628653eeb2fc72ca0c8..383e9e6fadd2d138e1af9b0a661684e793fae119 100644 (file)
 #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;
 }
index 01ecced419b125ac0e0e863273e0e694f1d74dbf..f326cf41f1f4eae04c6bbaec3a2adca70b038be1 100644 (file)
@@ -1,36 +1,26 @@
 #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__
diff --git a/src/forms/cadtoolbarlines.ui b/src/forms/cadtoolbarlines.ui
deleted file mode 100644 (file)
index a8b25cf..0000000
+++ /dev/null
@@ -1,609 +0,0 @@
-<?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>
index faf53ae882753d0bb4e0602fe03a67fe231fc010..35edbce46be0601306ed5822d058069ee5a4c81a 100644 (file)
 #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;
 }
-
index 4a78abe58ef584bcd44c5f1e1a96c7fc3339189a..a42133ada581593bcb7ee19b26e7728f7c84b7f4 100644 (file)
@@ -1,49 +1,26 @@
 #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__
index 89758ab9c576dcf8b6e04666f56ef4f939f5c7e1..6c06233737937734d9d0a429ae456cdc03dcdbb6 100644 (file)
 #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;
 }
index 597f1973c4b36738625e50db51ebc53eaa6159a8..1dd8b999f4d2c714952c8d4405b631367ff2464f 100644 (file)
@@ -1,32 +1,26 @@
 #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__
index 17ab7bca37dd7fa64f29393c7d50bf3582a4a43a..6ff2ea185172f9baea9784d6b084f227e60eb945 100644 (file)
 #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;
 }
index 0814dea4692a371b1245568313999cae2a7ef0ff..1ae2265774832e19249339c07bde74b655067e5e 100644 (file)
@@ -1,37 +1,26 @@
 #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__
index 14fa5ddba9348eced15fc06bd182e5bdb3285345..27eee4e9a09e22bf6d6364cf655b934f9afd4ee3 100644 (file)
 
 #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;
@@ -125,21 +71,24 @@ void CadToolBarSelect::setNextAction(int nextAction)
        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);
        }
@@ -147,6 +96,14 @@ void CadToolBarSelect::runNextAction()
 
 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;
 }
index 6ab02980992c6171b53aea4ff53ab80a6c457c46..434ce946069661c68b8f575e14a7fa8400b61bb0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __CADTOOLBARSELECT_H__
 #define __CADTOOLBARSELECT_H__
 
-#include "ui_cadtoolbarselect.h"
+#include <QtGui>
 
 class CadToolBar;
 class QG_ActionHandler;
@@ -12,38 +12,29 @@ class CadToolBarSelect: public QWidget
        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__
index 9acce483b7b1008a3b5dc385a53c639e2aad8204..ff7fa81d2bd79cf4e6c6fe5a18d0b7a070bb5b77 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "cadtoolbarsnap.h"
 
+#if 0
 #include "cadtoolbar.h"
 #include "qg_actionhandler.h"
 #include "rs_debug.h"
@@ -291,3 +292,59 @@ 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)
+{
+       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
index b706293a3d7bfc638e197a3facd2688f0396f03f..2e0dfa0601b4b9d2ae1c61bd298a7379793eb076 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __CADTOOLBARSNAP_H__
 #define __CADTOOLBARSNAP_H__
 
+#if 0
 #include "ui_cadtoolbarsnap.h"
 
 class CadToolBar;
@@ -46,5 +47,28 @@ class CadToolBarSnap: public QWidget
        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__
index 6b6aff799d286b7fd0f3ecd6efd7e14b79edaf12..2ad19b040265a9a1a5e4c8b74ebcde331ab81337 100644 (file)
 #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;
 }
index aeaf8b8ed6fdcf0f38c57c15015fc0b389632166..1c4e1eeeb83ab13c3cedd9c7fb06163b017096ef 100644 (file)
@@ -1,32 +1,26 @@
 #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__
index 8f82e28cafcf76988c280c22b6118d94350a52eb..4aa18a6ef3f2912d6e70412c9a70636fb444172b 100644 (file)
                <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>
diff --git a/src/forms/res/qg_selectall.xpm b/src/forms/res/qg_selectall.xpm
deleted file mode 100644 (file)
index 9d37a55..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *qg_selectall_xpm[] = {
-"18 16 2 1",
-"$ c None",
-"% c #ff0000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$%%%$$$$$$$$$%",
-"%$$$%$$$%$$$$$$$$%",
-"%$$$%$$$%$$$$%$$$%",
-"%$$$%$$$%$$$%%$$$%",
-"%$$$$%%%$$$%$%$$$%",
-"%$$$$$$$$$%$$%$$$%",
-"%$$$$$$$$%$$$%$$$%",
-"%%%%%%$$%%%%%%$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
diff --git a/src/forms/res/qg_selectcontour.xpm b/src/forms/res/qg_selectcontour.xpm
deleted file mode 100644 (file)
index 3cd5752..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char *qg_selectcontour_xpm[] = {
-"18 16 3 1",
-"$ c None",
-"% c #ff0000",
-"& c #000000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$&&&$$$$$$$$$%",
-"%$$$&$$$&$$$$$$$$%",
-"%$$$&$$$&$$$$&$$$%",
-"%$$$&$$$&$$$&&$$$%",
-"%$$$$&&&$$$&$&$$$%",
-"%$$$$$$$$$&$$&$$$%",
-"%$$$$$$$$&$$$&$$$%",
-"%%%%%%$$&&&&&&$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
diff --git a/src/forms/res/qg_selectdoubles.xpm b/src/forms/res/qg_selectdoubles.xpm
deleted file mode 100644 (file)
index bc31700..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char *qg_selectdoubles_xpm[] = {
-"18 16 3 1",
-"$ c None",
-"% c #000000",
-"& c #ff0000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%&&$$$$$$$$$&%",
-"$$%&&$$$$$$$$$$$&%",
-"$%&$$%%$$$$$$$$$&%",
-"$%&$%$$%$$$$$$$$&%",
-"%&$%$$$$%$$$$&$$&%",
-"%&$%$$$$%$$$&%$$&%",
-"%$$$%$$%$$$&%%$$&%",
-"%$$$$%%$$$&%$%$$&%",
-"%$$$$$$$$&%$$%$$&%",
-"%$$$$$$$&%$$$%$$&%",
-"%$$$$$$&%%%%%%$$&%",
-"%%%%%%$$$$$$$$$$&%",
-"$$$$$%$$$$$$$$$$&%",
-"$$$$$%$$$$$$$$$$&%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
diff --git a/src/forms/res/qg_selectinters.xpm b/src/forms/res/qg_selectinters.xpm
deleted file mode 100644 (file)
index 3dbcfaf..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-static const char *qg_selectinters_xpm[] = {
-"15 18 4 1",
-"$ c None",
-"% c #000000",
-"& c #ff0000",
-"' c #0000ff",
-"$$$$$$$$$%$$$$$",
-"$$$$$$$$%%%$$$$",
-"$$$$&&&&&'&&&&&",
-"$$%%$$$$$'$$$$%",
-"$%$$$$$$$'$$$$%",
-"$%$$%%%$$'$$$$%",
-"%$$%$$$%$'$$$$%",
-"%$$%$$$%$'$$$$%",
-"%$$%$$$%$'$&$$%",
-"%$$$%%%$$'&%$$%",
-"%$$$$$$$$'$%$$%",
-"%$$$$$$$&'$%$$%",
-"%%%%%$$&&'&&$$%",
-"$$$$%$$$$'$$$$%",
-"$$$$%$$$$'$$$$%",
-"$$$$&&&&&'&&&&&",
-"$$$$$$$$%%%$$$$",
-"$$$$$$$$$%$$$$$"
-};
-
diff --git a/src/forms/res/qg_selectinvert.xpm b/src/forms/res/qg_selectinvert.xpm
deleted file mode 100644 (file)
index 5e6f17f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-static const char *qg_selectinvert_xpm[] = {
-"18 16 4 1",
-"$ c None",
-"% c #0000ff",
-"& c #000000",
-"' c #ff0000",
-"%$$$$'''''''''''$$",
-"$%$''$$$$$$$$$$'$$",
-"$$%$$$$$$$$$$$$'$$",
-"$$'%$&&&$$$$$$$'$$",
-"$&$$%%$$&$$$$$$'$$",
-"$&$$'$%$&$$$$$$'$$",
-"$&$$'$$%&$$$&$$'$$",
-"$&$$$'''%$$&&$$'$$",
-"$&$$$$$$$%&$&$$'$$",
-"$&$$$$$$$'%$&$$'$$",
-"$&&&&&$$'''%&$$'$$",
-"$$$$$&$$$$$$%%$'$$",
-"$$$$$&$$$$$$$$%'$$",
-"$$$$$&&&&&&&&&&%$$",
-"$$$$$$$$$$$$$$$$%$",
-"$$$$$$$$$$$$$$$$$%"
-};
-
diff --git a/src/forms/res/qg_selectlayer.xpm b/src/forms/res/qg_selectlayer.xpm
deleted file mode 100644 (file)
index 0dab69a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* XPM */
-static const char *qg_selectlayer_xpm[] = {
-"14 19 4 1",
-"$ c None",
-"% c #000000",
-"& c #ffffff",
-"' c #ff0000",
-"$$$$$$$$%%$$$$",
-"$$$$$$%%&%$$$$",
-"$$$$%%&&&%$$%%",
-"$$%%&&&%&%%%&%",
-"%%&&&%%&%%&&&%",
-"%&&%%&%%&&&&&%",
-"%&%&%%&&&&'&&%",
-"%&%&%&&&&&'&&%",
-"%&%&%&&&&''&&%",
-"%&%&%&&&&''&&%",
-"%&%&%&&&'&'&&%",
-"%&%%%&&&'&'&&%",
-"%&%&%&&'&''&&%",
-"%&&&%&&''&&&&%",
-"%&&&%&'&&&&&%%",
-"%&%%%&&&&&%%$$",
-"%%$$%&&&%%$$$$",
-"$$$$%&%%$$$$$$",
-"$$$$%%$$$$$$$$"
-};
-
diff --git a/src/forms/res/qg_selectnothing.xpm b/src/forms/res/qg_selectnothing.xpm
deleted file mode 100644 (file)
index e69d443..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char *qg_selectnothing_xpm[] = {
-"18 16 2 1",
-"$ c None",
-"% c #000000",
-"$$$$$%%%%%%%%%%%%%",
-"$$$%%$$$$$$$$$$$$%",
-"$$%$$$$$$$$$$$$$$%",
-"$%$$$$$$$$$$$$$$$%",
-"$%$$$%%%$$$$$$$$$%",
-"%$$$%$$$%$$$$$$$$%",
-"%$$$%$$$%$$$$%$$$%",
-"%$$$%$$$%$$$%%$$$%",
-"%$$$$%%%$$$%$%$$$%",
-"%$$$$$$$$$%$$%$$$%",
-"%$$$$$$$$%$$$%$$$%",
-"%%%%%%$$%%%%%%$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%$$$$$$$$$$$%",
-"$$$$$%%%%%%%%%%%%%"
-};
-
diff --git a/src/forms/res/qg_selectsingle.xpm b/src/forms/res/qg_selectsingle.xpm
deleted file mode 100644 (file)
index 7b13b41..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-static const char *qg_selectsingle_xpm[] = {
-"15 18 4 1",
-"$ c None",
-"% c #000000",
-"& c #ffffff",
-"' c #ff0000",
-"$$$$$$$$$$$$$$'",
-"$$$$$$$$$$$$''$",
-"$$$$$$$$$$''$$$",
-"$$$$$$$$''$$$$$",
-"$$$$$$$'$$$$$$$",
-"$$$$$''%$$$$$$$",
-"$$$''$$%%$$$$$$",
-"$''$$$$%&%$$$$$",
-"'$$$$$$%&&%$$$$",
-"$$$$$$$%&&&%$$$",
-"$$$$$$$%&&&&%$$",
-"$$$$$$$%&&&%%%$",
-"$$$$$$$%&%&%$$$",
-"$$$$$$$%%%&&%$$",
-"$$$$$$$%$$%&%$$",
-"$$$$$$$$$$$%&%$",
-"$$$$$$$$$$$%&%$",
-"$$$$$$$$$$$$%$$"
-};
-
diff --git a/src/forms/res/qg_selectwindow.xpm b/src/forms/res/qg_selectwindow.xpm
deleted file mode 100644 (file)
index 42d4e71..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-static const char *qg_selectwindow_xpm[] = {
-"18 16 4 1",
-"$ c None",
-"% c #000000",
-"& c #0000ff",
-"' c #ff0000",
-"$%$$$$$$$$$$$$$$$$",
-"%%%&&&&&&&&&&&&&&$",
-"$%$$$$$$$$$$$$$$&$",
-"$&$$$$$$$$$$$$$$&$",
-"$&$$$'''$$$$$$$$&$",
-"$&$$'$$$'$$$$$$$&$",
-"$&$$'$$$'$$$$'$$&$",
-"$&$$'$$$'$$$''$$&$",
-"$&$$$'''$$$'$'$$&$",
-"$&$$$$$$$$'$$'$$&$",
-"$&$$$$$$$'$$$'$$&$",
-"$&$$$$$$''''''$$&$",
-"$&$$$$$$$$$$$$$$&$",
-"$&$$$$$$$$$$$$$$%$",
-"$&&&&&&&&&&&&&&%%%",
-"$$$$$$$$$$$$$$$$%$"
-};
-
diff --git a/src/forms/res/select-all.xpm b/src/forms/res/select-all.xpm
new file mode 100644 (file)
index 0000000..fc74cad
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * image0_xpm[] = {
+"18 16 2 1",
+". c None",
+"# c #ff0000",
+".....#############",
+"...##............#",
+"..#..............#",
+".#...............#",
+".#...###.........#",
+"#...#...#........#",
+"#...#...#....#...#",
+"#...#...#...##...#",
+"#....###...#.#...#",
+"#.........#..#...#",
+"#........#...#...#",
+"######..######...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
diff --git a/src/forms/res/select-contour.xpm b/src/forms/res/select-contour.xpm
new file mode 100644 (file)
index 0000000..6e3d361
--- /dev/null
@@ -0,0 +1,22 @@
+/* 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...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
diff --git a/src/forms/res/select-intersection.xpm b/src/forms/res/select-intersection.xpm
new file mode 100644 (file)
index 0000000..23d6970
--- /dev/null
@@ -0,0 +1,25 @@
+/* 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",
+"........###....",
+".........#....."};
diff --git a/src/forms/res/select-invert.xpm b/src/forms/res/select-invert.xpm
new file mode 100644 (file)
index 0000000..53d521e
--- /dev/null
@@ -0,0 +1,23 @@
+/* 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.##",
+"################.#",
+"#################."};
diff --git a/src/forms/res/select-layer.xpm b/src/forms/res/select-layer.xpm
new file mode 100644 (file)
index 0000000..4912b96
--- /dev/null
@@ -0,0 +1,26 @@
+/* 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##......",
+"....##........"};
diff --git a/src/forms/res/select-none.xpm b/src/forms/res/select-none.xpm
new file mode 100644 (file)
index 0000000..26df387
--- /dev/null
@@ -0,0 +1,21 @@
+/* XPM */
+static const char * image4_xpm[] = {
+"18 16 2 1",
+". c None",
+"# c #000000",
+".....#############",
+"...##............#",
+"..#..............#",
+".#...............#",
+".#...###.........#",
+"#...#...#........#",
+"#...#...#....#...#",
+"#...#...#...##...#",
+"#....###...#.#...#",
+"#.........#..#...#",
+"#........#...#...#",
+"######..######...#",
+".....#...........#",
+".....#...........#",
+".....#...........#",
+".....#############"};
diff --git a/src/forms/res/select-nonintersection.xpm b/src/forms/res/select-nonintersection.xpm
new file mode 100644 (file)
index 0000000..783a72d
--- /dev/null
@@ -0,0 +1,25 @@
+/* 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#####",
+"........###....",
+".........#....."};
diff --git a/src/forms/res/select-nonwindow.xpm b/src/forms/res/select-nonwindow.xpm
new file mode 100644 (file)
index 0000000..ccf1d51
--- /dev/null
@@ -0,0 +1,23 @@
+/* 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###",
+"................#."};
diff --git a/src/forms/res/select-single.xpm b/src/forms/res/select-single.xpm
new file mode 100644 (file)
index 0000000..0e2236b
--- /dev/null
@@ -0,0 +1,25 @@
+/* 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.."};
diff --git a/src/forms/res/select-window.xpm b/src/forms/res/select-window.xpm
new file mode 100644 (file)
index 0000000..f7c67bf
--- /dev/null
@@ -0,0 +1,23 @@
+/* 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###",
+"................#."};
index 2e8fb8c21d2ca507a1b98c9b6d6a3b726aad7667..55e52618f304f1151d1a9006e7d2b910da894d78 100644 (file)
@@ -128,7 +128,7 @@ QAction * actionModifyAttributes;
 QAction * actionModifyDelete;
 QAction * actionModifyDeleteQuick;
 QAction * actionModifyExplodeText;
-//QAction * actionModifyExplode;
+QAction * actionModifyExplode;
 
 QAction * actionSnapFree;
 QAction * actionSnapGrid;
@@ -235,16 +235,16 @@ void CreateQtActions(QWidget * parent)
        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);
@@ -326,7 +326,7 @@ void CreateQtActions(QWidget * parent)
 #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);
index 713e489bba5c151313d94cbf2a214462bca8aef5..e90dd0277706abed5944fc5f45b8bafe635cbe0b 100644 (file)
@@ -119,7 +119,7 @@ extern QAction * actionModifyAttributes;
 extern QAction * actionModifyDelete;
 extern QAction * actionModifyDeleteQuick;
 extern QAction * actionModifyExplodeText;
-//extern QAction * actionModifyExplode;
+extern QAction * actionModifyExplode;
 
 extern QAction * actionSnapFree;
 extern QAction * actionSnapGrid;
index d0d6210f0244af98adce32e4e94a25d21eb0ef2a..58ee599f99ebccc89ce22bcf044aa32e7b818f3c 100644 (file)
@@ -176,7 +176,7 @@ void QG_ActionHandler::killSelectActions()
 {
        GraphicView * gv = mainWindow->getGraphicView();
 
-       if (gv != NULL)
+       if (gv)
                gv->killSelectActions();
 }
 
@@ -206,7 +206,7 @@ RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS_ActionInterface * act
                return NULL;
        }
 
-       if (action != NULL)
+       if (action)
                gv->setCurrentAction(action);
 
        return action;
@@ -778,7 +778,7 @@ RS_ActionInterface * QG_ActionHandler::setCurrentAction(RS2::ActionType id)
                break;
        }
 
-       if (a != NULL)
+       if (a)
                gv->setCurrentAction(a);
 
        RS_DEBUG->print("QG_ActionHandler::setCurrentAction(): OK");
@@ -793,7 +793,7 @@ QStringList QG_ActionHandler::getAvailableCommands()
 {
        RS_ActionInterface * currentAction = getCurrentAction();
 
-       if (currentAction != NULL)
+       if (currentAction)
                return currentAction->getAvailableCommands();
        else
        {
@@ -819,7 +819,7 @@ bool QG_ActionHandler::keycode(const QString & code)
        //RS_keycodeEvent e(cmd);
 
        //GraphicView* gv = mainWindow->getGraphicView();
-       //if (gv!=NULL) {
+       //if (gv) {
        //    gv->keycodeEvent(&e);
        //}
 
@@ -901,7 +901,7 @@ bool QG_ActionHandler::command(const QString & cmd)
        {
                GraphicView * gv = mainWindow->getGraphicView();
 
-               if (gv != NULL)
+               if (gv)
                        gv->back();
 
                RS_DEBUG->print("QG_ActionHandler::command: back");
@@ -913,7 +913,7 @@ bool QG_ActionHandler::command(const QString & cmd)
 
        GraphicView * gv = mainWindow->getGraphicView();
 
-       if (gv != NULL)
+       if (gv)
        {
                RS_DEBUG->print("QG_ActionHandler::command: trigger command event in graphic view");
                gv->commandEvent(&e);
@@ -1418,12 +1418,12 @@ void QG_ActionHandler::slotSnapFree()
 {
        disableSnaps();
 
-       if (snapFree != NULL)
+       if (snapFree)
                snapFree->setChecked(true);
-
-       if (cadToolBarSnap != NULL)
+#if 0
+       if (cadToolBarSnap)
                cadToolBarSnap->setSnapMode(RS2::SnapFree);
-
+#endif
        setCurrentAction(RS2::ActionSnapFree);
 }
 
@@ -1431,12 +1431,13 @@ void QG_ActionHandler::slotSnapGrid()
 {
        disableSnaps();
 
-       if (snapGrid != NULL)
+       if (snapGrid)
                snapGrid->setChecked(true);
 
-       if (cadToolBarSnap != NULL)
+#if 0
+       if (cadToolBarSnap)
                cadToolBarSnap->setSnapMode(RS2::SnapGrid);
-
+#endif
        setCurrentAction(RS2::ActionSnapGrid);
 }
 
@@ -1444,26 +1445,25 @@ void QG_ActionHandler::slotSnapEndpoint()
 {
        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);
 }
 
@@ -1471,13 +1471,13 @@ void QG_ActionHandler::slotSnapCenter()
 {
        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);
 }
@@ -1486,13 +1486,13 @@ void QG_ActionHandler::slotSnapMiddle()
 {
        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);
 }
@@ -1501,13 +1501,13 @@ void QG_ActionHandler::slotSnapDist()
 {
        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);
 }
@@ -1516,13 +1516,13 @@ void QG_ActionHandler::slotSnapIntersection()
 {
        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);
 }
@@ -1530,10 +1530,10 @@ void QG_ActionHandler::slotSnapIntersection()
 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);
@@ -1541,47 +1541,50 @@ void QG_ActionHandler::slotSnapIntersectionManual()
 
 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);
 }
 
@@ -1589,12 +1592,13 @@ void QG_ActionHandler::slotRestrictOrthogonal()
 {
        disableRestrictions();
 
-       if (restrictOrthogonal != NULL)
+       if (restrictOrthogonal)
                restrictOrthogonal->setChecked(true);
 
-       if (cadToolBarSnap != NULL)
+#if 0
+       if (cadToolBarSnap)
                cadToolBarSnap->setSnapRestriction(RS2::RestrictOrthogonal);
-
+#endif
        setCurrentAction(RS2::ActionRestrictOrthogonal);
 }
 
@@ -1602,11 +1606,13 @@ void QG_ActionHandler::slotRestrictHorizontal()
 {
        disableRestrictions();
 
-       if (restrictHorizontal != NULL)
+       if (restrictHorizontal)
                restrictHorizontal->setChecked(true);
 
-       if (cadToolBarSnap != NULL)
+#if 0
+       if (cadToolBarSnap)
                cadToolBarSnap->setSnapRestriction(RS2::RestrictHorizontal);
+#endif
 
        setCurrentAction(RS2::ActionRestrictHorizontal);
 }
@@ -1615,31 +1621,34 @@ void QG_ActionHandler::slotRestrictVertical()
 {
        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
 }
 
 /**
@@ -1648,35 +1657,35 @@ void QG_ActionHandler::disableRestrictions()
  */
 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());
 }
 
@@ -1687,7 +1696,7 @@ void QG_ActionHandler::slotSetRelativeZero()
 
 void QG_ActionHandler::slotLockRelativeZero(bool on)
 {
-       if (lockRelativeZero != NULL)
+       if (lockRelativeZero)
                lockRelativeZero->setChecked(on);
 
        if (on)
@@ -1695,8 +1704,10 @@ void QG_ActionHandler::slotLockRelativeZero(bool on)
        else
                setCurrentAction(RS2::ActionUnlockRelativeZero);
 
-       if (cadToolBarSnap != NULL)
+#if 0
+       if (cadToolBarSnap)
                cadToolBarSnap->setLockRelativeZero(on);
+#endif
 }
 
 void QG_ActionHandler::slotInfoInside()
@@ -1838,7 +1849,7 @@ void QG_ActionHandler::slotCamReorder()
 void QG_ActionHandler::slotFocusNormal()
 {
        //QG_GraphicView* gv = mainWindow->getGraphicView();
-       //if (gv!=NULL) {
+       //if (gv) {
                //gv->setFocus();
        mainWindow->setFocus2();
        //}