X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fforms%2Fcadtoolbarselect.cpp;h=6a70ceca0dd94923efc10aa0f983f21f2d09a75a;hb=d774c2655ba2c3657a565f325411144452392277;hp=14fa5ddba9348eced15fc06bd182e5bdb3285345;hpb=658ad9ec22e868cc5f575e6c4f3d38c153f6af51;p=architektonas diff --git a/src/forms/cadtoolbarselect.cpp b/src/forms/cadtoolbarselect.cpp index 14fa5dd..6a70cec 100644 --- a/src/forms/cadtoolbarselect.cpp +++ b/src/forms/cadtoolbarselect.cpp @@ -14,108 +14,49 @@ #include "cadtoolbarselect.h" -#include "cadtoolbar.h" #include "qg_actionhandler.h" -#include "rs_actioninterface.h" -#include "rs_debug.h" +#include "actioninterface.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), +CadToolBarSelect::CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/): + QWidget((QWidget *)parent, flags), actionHandler(NULL), selectAction(NULL), nextAction(-1) { - ui.setupUi(this); + actionHandler = parent->getActionHandler(); + + QGridLayout * gridLayout = new QGridLayout(this); + gridLayout->setSpacing(0); + gridLayout->setContentsMargins(0, 0, 0, 0); + + gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2); + + gridLayout->addWidget(parent->CreateToolButton(actionDeselectAll), 1, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectAll), 1, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectSingle), 2, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectContour), 2, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectWindow), 3, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectWindow), 3, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectIntersected), 4, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectInvert), 5, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectLayer), 5, 1, 1, 1); + + QAction * actionDoit = new QAction(QIcon(":/res/qg_forward"), tr("Forward"), this); + doit = new QToolButton(this); + doit->setDefaultAction(actionDoit); + QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + doit->setSizePolicy(policy); + gridLayout->addWidget(doit, 6, 0, 1, 2); + connect(doit, SIGNAL(clicked()), this, SLOT(runNextAction())); } 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(); -} - -void CadToolBarSelect::setSelectAction(RS_ActionInterface * selectAction) +//hmm, should these three funcs be here??? +void CadToolBarSelect::setSelectAction(ActionInterface * selectAction) { this->selectAction = selectAction; } @@ -125,14 +66,14 @@ 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) + if (selectAction) { selectAction->finish(); selectAction = NULL; @@ -144,9 +85,3 @@ void CadToolBarSelect::runNextAction() actionHandler->setCurrentAction((RS2::ActionType)nextAction); } } - -void CadToolBarSelect::back() -{ - if (cadToolBar != NULL) - cadToolBar->back(); -}