X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fforms%2Fcadtoolbarselect.cpp;h=adf8a03c64379f1ef195900eff96574419d0aae2;hb=48105dec9198cf5a81dd9286010d0d45e28f70c3;hp=27eee4e9a09e22bf6d6364cf655b934f9afd4ee3;hpb=f7188d32d0beaef31fc3475be05daea2f018ebec;p=architektonas diff --git a/src/forms/cadtoolbarselect.cpp b/src/forms/cadtoolbarselect.cpp index 27eee4e..adf8a03 100644 --- a/src/forms/cadtoolbarselect.cpp +++ b/src/forms/cadtoolbarselect.cpp @@ -3,7 +3,9 @@ // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun // Extensively rewritten and refactored by James L. Hammons -// (C) 2010 Underground Software +// Portions copyright (C) 2001-2003 RibbonSoft +// Copyright (C) 2010 Underground Software +// See the README and GPLv2 files for licensing and warranty information // // JLH = James L. Hammons // @@ -14,43 +16,38 @@ #include "cadtoolbarselect.h" -#include "qg_actionhandler.h" -#include "rs_actioninterface.h" +#include "actionhandler.h" +#include "actioninterface.h" #include "cadtoolbar.h" #include "createqtactions.h" CadToolBarSelect::CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/): - QWidget((QWidget *)parent, flags), cadToolBar(parent), actionHandler(NULL), - selectAction(NULL), nextAction(-1) + QWidget((QWidget *)parent, flags), actionHandler(NULL), selectAction(NULL), + nextAction(-1) { - actionHandler = cadToolBar->getActionHandler(); + actionHandler = parent->getActionHandler(); QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setSpacing(0); gridLayout->setContentsMargins(0, 0, 0, 0); - QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this); - QToolButton * button = new QToolButton(this); - button->setDefaultAction(actionBack); - QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - button->setSizePolicy(policy); - gridLayout->addWidget(button, 0, 0, 1, 2); - connect(button, SIGNAL(clicked()), this, SLOT(back())); + gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2); - gridLayout->addWidget(CreateToolButton(actionDeselectAll), 1, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectAll), 1, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectSingle), 2, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectContour), 2, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionDeselectWindow), 3, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectWindow), 3, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectIntersected), 4, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectInvert), 5, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectLayer), 5, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectAll), 1, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectAll), 1, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectSingle), 2, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectContour), 2, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectWindow), 3, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectWindow), 3, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectIntersected), 4, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectInvert), 5, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectLayer), 5, 1, 1, 1); QAction * actionDoit = new QAction(QIcon(":/res/qg_forward"), tr("Forward"), this); doit = new QToolButton(this); doit->setDefaultAction(actionDoit); + QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); doit->setSizePolicy(policy); gridLayout->addWidget(doit, 6, 0, 1, 2); connect(doit, SIGNAL(clicked()), this, SLOT(runNextAction())); @@ -61,7 +58,7 @@ CadToolBarSelect::~CadToolBarSelect() } //hmm, should these three funcs be here??? -void CadToolBarSelect::setSelectAction(RS_ActionInterface * selectAction) +void CadToolBarSelect::setSelectAction(ActionInterface * selectAction) { this->selectAction = selectAction; } @@ -78,32 +75,15 @@ void CadToolBarSelect::setNextAction(int nextAction) void CadToolBarSelect::runNextAction() { -//printf("CadToolBarSelect::runNextAction(): Entered function...\n"); if (selectAction) { -//printf("CadToolBarSelect::runNextAction(): About to do selectAction...\n"); selectAction->finish(); selectAction = NULL; } if (nextAction != -1) { -//printf("CadToolBarSelect::runNextAction(): About to do nextAction...\n"); actionHandler->killSelectActions(); actionHandler->setCurrentAction((RS2::ActionType)nextAction); } } - -void CadToolBarSelect::back() -{ - cadToolBar->back(); -} - -QToolButton * CadToolBarSelect::CreateToolButton(QAction * action) -{ - QToolButton * button = new QToolButton(this); - button->setDefaultAction(action); - button->setIconSize(QSize(18, 18)); - - return button; -}