]> Shamusworld >> Repos - architektonas/blob - src/forms/cadtoolbarpolylines.cpp
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / forms / cadtoolbarpolylines.cpp
1 // cadtoolbarpolylines.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 "cadtoolbarpolylines.h"
15
16 #include "cadtoolbar.h"
17 #include "qg_actionhandler.h"
18 #include "rs_debug.h"
19
20 CadToolBarPolylines::CadToolBarPolylines(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21         QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
22 {
23         ui.setupUi(this);
24 }
25
26 CadToolBarPolylines::~CadToolBarPolylines()
27 {
28 }
29
30 void CadToolBarPolylines::mousePressEvent(QMouseEvent * e)
31 {
32         if (e->button() == Qt::RightButton && cadToolBar != NULL)
33         {
34                 cadToolBar->back();
35                 e->accept();
36         }
37 }
38
39 void CadToolBarPolylines::contextMenuEvent(QContextMenuEvent * e)
40 {
41         e->accept();
42 }
43
44 void CadToolBarPolylines::setCadToolBar(CadToolBar * tb)
45 {
46         cadToolBar = tb;
47
48         if (tb != NULL)
49                 actionHandler = tb->getActionHandler();
50         else
51                 RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarPolylines::setCadToolBar(): No valid toolbar set.");
52 }
53
54 void CadToolBarPolylines::drawPolyline()
55 {
56         if (cadToolBar != NULL && actionHandler != NULL)
57                 actionHandler->slotDrawPolyline();
58 }
59
60 void CadToolBarPolylines::polylineAdd()
61 {
62         if (cadToolBar != NULL && actionHandler != NULL)
63                 actionHandler->slotPolylineAdd();
64 }
65
66 void CadToolBarPolylines::polylineAppend()
67 {
68         if (cadToolBar != NULL && actionHandler != NULL)
69                 actionHandler->slotPolylineAppend();
70 }
71
72 void CadToolBarPolylines::polylineDel()
73 {
74         if (cadToolBar != NULL && actionHandler != NULL)
75                 actionHandler->slotPolylineDel();
76 }
77
78 void CadToolBarPolylines::polylineDelBetween()
79 {
80         if (cadToolBar != NULL && actionHandler != NULL)
81                 actionHandler->slotPolylineDelBetween();
82 }
83
84 void CadToolBarPolylines::polylineTrim()
85 {
86         if (cadToolBar != NULL && actionHandler != NULL)
87                 actionHandler->slotPolylineTrim();
88 }
89
90 void CadToolBarPolylines::back()
91 {
92         if (cadToolBar != NULL)
93                 cadToolBar->back();
94 }