X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fforms%2Fcadtoolbarlines.cpp;h=dd5adfa7fbfd15d766d56a9c5555b40a719cf4ad;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=cd75a1e3a05d097cf57347aeab1f3a60aa2e2ef1;hpb=27d4a138d23453e93a833e9347444b828a971cb4;p=architektonas diff --git a/src/forms/cadtoolbarlines.cpp b/src/forms/cadtoolbarlines.cpp index cd75a1e..dd5adfa 100644 --- a/src/forms/cadtoolbarlines.cpp +++ b/src/forms/cadtoolbarlines.cpp @@ -1,152 +1,53 @@ // cadtoolbarlines.cpp // +// 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 // // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/10/2010 Created this file. :-) +// JLH 06/18/2010 Changed this class to use predefined actions instead of +// reinventing the wheel. Also changed construction to use +// type CadToolBar instead of QWidget. // #include "cadtoolbarlines.h" #include "cadtoolbar.h" -#include "qg_actionhandler.h" -#include "rs_debug.h" - -CadToolBarLines::CadToolBarLines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/): - QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL) -{ - ui.setupUi(this); +#include "createqtactions.h" + +CadToolBarLines::CadToolBarLines(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/): + QWidget((QWidget *)parent, flags) +{ + 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(actionDrawLine), 1, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineAngle), 1, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineHorizontal), 2, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineVertical), 2, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineRectangle), 3, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineBisector), 3, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineParallel), 4, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineParallelThrough), 4, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineTangent1), 5, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineTangent2), 5, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineOrthogonal), 6, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineRelAngle), 6, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLinePolygon), 7, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLinePolygon2), 7, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDrawLineFree), 8, 0, 1, 1); } CadToolBarLines::~CadToolBarLines() { } - -/*void CadToolBarLines::mousePressEvent(QMouseEvent* e) { - if (e->button()==RightButton && cadToolBar != NULL) { - cadToolBar->back(); - e->accept(); - } -}*/ - -void CadToolBarLines::contextMenuEvent(QContextMenuEvent * e) -{ - e->accept(); -} - -void CadToolBarLines::setCadToolBar(CadToolBar * tb) -{ - cadToolBar = tb; - - if (tb != NULL) - actionHandler = tb->getActionHandler(); - else - RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarLines::setCadToolBar(): No valid toolbar set."); -} - -void CadToolBarLines::drawLine() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLine(); -} - -void CadToolBarLines::drawLineAngle() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineAngle(); -} - -void CadToolBarLines::drawLineHorizontal() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineHorizontal(); -} - -void CadToolBarLines::drawLineHorVert() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineHorVert(); -} - -void CadToolBarLines::drawLineVertical() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineVertical(); -} - -void CadToolBarLines::drawLineParallel() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineParallel(); -} - -void CadToolBarLines::drawLineParallelThrough() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineParallelThrough(); -} - -void CadToolBarLines::drawLineRectangle() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineRectangle(); -} - -void CadToolBarLines::drawLineBisector() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineBisector(); -} - -void CadToolBarLines::drawLineTangent1() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineTangent1(); -} - -void CadToolBarLines::drawLineTangent2() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineTangent2(); -} - -void CadToolBarLines::drawLineOrthogonal() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineOrthogonal(); -} - -void CadToolBarLines::drawLineRelAngle() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineRelAngle(); -} - -void CadToolBarLines::drawLineFree() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLineFree(); -} - -void CadToolBarLines::drawLinePolygon() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLinePolygon(); -} - -void CadToolBarLines::drawLinePolygon2() -{ - if (cadToolBar != NULL && actionHandler != NULL) - actionHandler->slotDrawLinePolygon2(); -} - -void CadToolBarLines::back() -{ - if (cadToolBar != NULL) - cadToolBar->back(); -}