]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarmain.cpp
b2111e9a1f731fb02979ef6ad09925b9004f0616
[architektonas] / src / forms / cadtoolbarmain.cpp
1 // cadtoolbarmain.cpp
2 //
3 // Originally part of QCad Community Edition by Andrew Mustun
4 // Extensively rewritten and refactored by James L. Hammons
5 // (C) 2010 Underground Software
6 //
7 // JLH = James L. Hammons <jlhamm@acm.org>
8 //
9 // Who  When        What
10 // ---  ----------  -----------------------------------------------------------
11 // JLH  05/10/2010  Created this file. :-)
12 //
13
14 #include "cadtoolbarmain.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18
19 CadToolBarMain::CadToolBarMain(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
20         QWidget(parent, flags)
21 {
22         ui.setupUi(this);
23
24 // Ain't hidin' dis no mo'...
25 //#ifndef RS_PROF
26 //      ui.bMenuPolyline->hide();
27 //#endif
28 }
29
30 CadToolBarMain::~CadToolBarMain()
31 {
32 }
33
34 void CadToolBarMain::setCadToolBar(CadToolBar * tb)
35 {
36         QG_ActionHandler * ah = NULL;
37
38         if (tb != NULL)
39                 ah = tb->getActionHandler();
40         else
41                 RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarMain::setCadToolBar(): No valid toolbar set.");
42
43         if (ah != NULL)
44         {
45                 connect(ui.bMenuPoint, SIGNAL(clicked()), ah, SLOT(slotDrawPoint()));
46                 connect(ui.bMenuLine, SIGNAL(clicked()), tb, SLOT(showToolBarLines()));
47                 connect(ui.bMenuArc, SIGNAL(clicked()), tb, SLOT(showToolBarArcs()));
48                 connect(ui.bMenuCircle, SIGNAL(clicked()), tb, SLOT(showToolBarCircles()));
49                 connect(ui.bMenuEllipse, SIGNAL(clicked()), tb, SLOT(showToolBarEllipses()));
50                 connect(ui.bMenuSpline, SIGNAL(clicked()), ah, SLOT(slotDrawSpline()));
51                 connect(ui.bMenuPolyline, SIGNAL(clicked()), tb, SLOT(showToolBarPolylines()));
52
53                 connect(ui.bMenuText, SIGNAL(clicked()), ah, SLOT(slotDrawText()));
54                 connect(ui.bMenuDim, SIGNAL(clicked()), tb, SLOT(showToolBarDim()));
55                 connect(ui.bMenuHatch, SIGNAL(clicked()), ah, SLOT(slotDrawHatch()));
56                 connect(ui.bMenuImage, SIGNAL(clicked()), ah, SLOT(slotDrawImage()));
57
58                 connect(ui.bMenuModify, SIGNAL(clicked()), tb, SLOT(showToolBarModify()));
59                 connect(ui.bMenuInfo, SIGNAL(clicked()), tb, SLOT(showToolBarInfo()));
60
61                 connect(ui.bMenuBlock, SIGNAL(clicked()), ah, SLOT(slotBlocksCreate()));
62                 connect(ui.bMenuSelect, SIGNAL(clicked()), tb, SLOT(showToolBarSelect()));
63         }
64         else
65         {
66                 RS_DEBUG->print(RS_Debug::D_ERROR, "QG_CadToolBarMain::setCadToolBar(): No valid action handler set.");
67         }
68 }