]> Shamusworld >> Repos - architektonas/blob - src/actions/actionselectcontour.cpp
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / actions / actionselectcontour.cpp
1 // actionselectcontour.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/04/2010  Added this text. :-)
15 //
16
17 #include "actionselectcontour.h"
18
19 #include "debug.h"
20 #include "dialogfactory.h"
21 #include "graphicview.h"
22 #include "selection.h"
23
24 ActionSelectContour::ActionSelectContour(EntityContainer & container,
25         GraphicView & graphicView):
26         ActionInterface("Select Contours", container, graphicView)
27 {
28         en = NULL;
29 }
30
31 ActionSelectContour::~ActionSelectContour()
32 {
33 }
34
35 /*virtual*/ RS2::ActionType ActionSelectContour::rtti()
36 {
37         return RS2::ActionSelectContour;
38 }
39
40 void ActionSelectContour::trigger()
41 {
42         if (en)
43         {
44                 if (en->isAtomic())
45                 {
46                         Selection s(*container, graphicView);
47                         s.selectContour(en);
48
49                         if (DIALOGFACTORY)
50                                 DIALOGFACTORY->updateSelectionWidget(container->countSelected());
51                 }
52                 else if (DIALOGFACTORY)
53                         DIALOGFACTORY->commandMessage(tr("Entity must be an Atomic Entity."));
54         }
55         else
56                 DEBUG->print("ActionSelectContour::trigger: Entity is NULL\n");
57 }
58
59 void ActionSelectContour::mouseReleaseEvent(QMouseEvent * e)
60 {
61         if (e->button() == Qt::RightButton)
62                 init(getStatus() - 1);
63         else
64         {
65                 en = catchEntity(e);
66                 trigger();
67         }
68 }
69
70 void ActionSelectContour::updateMouseCursor()
71 {
72         graphicView->setMouseCursor(RS2::SelectCursor);
73 }