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