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