]> Shamusworld >> Repos - architektonas/blob - src/actions/actionselectlayer.cpp
3bd91322c917565b3f6fa63edbd7f0fdcb3a7ff0
[architektonas] / src / actions / actionselectlayer.cpp
1 // actionselectlayer.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  06/05/2010  Added this text. :-)
13 //
14
15 #include "actionselectlayer.h"
16
17 #include "rs_dialogfactory.h"
18 #include "rs_selection.h"
19
20 ActionSelectLayer::ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView):
21         ActionInterface("Select Layers", container, graphicView)
22 {
23         en = NULL;
24 }
25
26 ActionSelectLayer::~ActionSelectLayer()
27 {
28 }
29
30 /*virtual*/ RS2::ActionType ActionSelectLayer::rtti()
31 {
32         return RS2::ActionSelectLayer;
33 }
34
35 void ActionSelectLayer::trigger()
36 {
37         if (en)
38         {
39                 RS_Selection s(*container, graphicView);
40                 s.selectLayer(en);
41
42                 if (RS_DIALOGFACTORY)
43                         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
44         }
45         else
46                 RS_DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n");
47 }
48
49 void ActionSelectLayer::mouseReleaseEvent(QMouseEvent * e)
50 {
51         if (e->button() == Qt::RightButton)
52                 init(getStatus() - 1);
53         else
54         {
55                 en = catchEntity(e);
56                 trigger();
57         }
58 }
59
60 void ActionSelectLayer::updateMouseCursor()
61 {
62         graphicView->setMouseCursor(RS2::SelectCursor);
63 }