]> Shamusworld >> Repos - architektonas/blob - src/actions/actionselectlayer.cpp
Sanity check stage II: rename classes...
[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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  06/05/2010  Added this text. :-)
15 //
16
17 #include "actionselectlayer.h"
18
19 #include "rs_debug.h"
20 #include "rs_dialogfactory.h"
21 #include "graphicview.h"
22 #include "rs_selection.h"
23
24 ActionSelectLayer::ActionSelectLayer(RS_EntityContainer & container, GraphicView & graphicView):
25         ActionInterface("Select Layers", container, graphicView)
26 {
27         en = NULL;
28 }
29
30 ActionSelectLayer::~ActionSelectLayer()
31 {
32 }
33
34 /*virtual*/ RS2::ActionType ActionSelectLayer::rtti()
35 {
36         return RS2::ActionSelectLayer;
37 }
38
39 void ActionSelectLayer::trigger()
40 {
41         if (en)
42         {
43                 RS_Selection s(*container, graphicView);
44                 s.selectLayer(en);
45
46                 if (RS_DIALOGFACTORY)
47                         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
48         }
49         else
50                 RS_DEBUG->print("ActionSelectLayer::trigger: Entity is NULL\n");
51 }
52
53 void ActionSelectLayer::mouseReleaseEvent(QMouseEvent * e)
54 {
55         if (e->button() == Qt::RightButton)
56                 init(getStatus() - 1);
57         else
58         {
59                 en = catchEntity(e);
60                 trigger();
61         }
62 }
63
64 void ActionSelectLayer::updateMouseCursor()
65 {
66         graphicView->setMouseCursor(RS2::SelectCursor);
67 }