]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionselectall.cpp
Initial import
[architektonas] / src / actions / rs_actionselectall.cpp
1 // rs_actionselectall.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  05/22/2010  Added this text. :-)
13 //
14
15 #include "rs_actionselectall.h"
16 #include "rs_selection.h"
17
18 RS_ActionSelectAll::RS_ActionSelectAll(RS_EntityContainer& container,
19         RS_GraphicView& graphicView, bool select):
20         RS_ActionInterface("Select All Entities", container, graphicView)
21 {
22     this->select = select;
23 }
24
25 QAction * RS_ActionSelectAll::createGUIAction(RS2::ActionType type, QObject * parent)
26 {
27         QAction * action;
28
29         if (type == RS2::ActionSelectAll)
30         {
31                 action = new QAction(tr("Select &All"), parent);
32                 action->setShortcut(Qt::CTRL + Qt::Key_A);
33 //              action = new QAction(tr("Select All"), tr("Select &All"),
34 //                                                              CTRL+Key_A, parent);
35                 action->setStatusTip(tr("Selects all Entities"));
36         }
37         else
38         {
39                 action = new QAction(tr("Deselect &all"), parent);
40                 action->setShortcut(Qt::CTRL + Qt::Key_K);
41 //              action = new QAction(tr("Deselect all"), tr("Deselect &all"),
42 //                                                              CTRL+Key_K, parent);
43                 action->setStatusTip(tr("Deselects all Entities"));
44         }
45
46         return action;
47 }
48
49
50 void RS_ActionSelectAll::init(int status)
51 {
52         RS_ActionInterface::init(status);
53         trigger();
54         finish();
55 }
56
57 void RS_ActionSelectAll::trigger()
58 {
59         RS_Selection s(*container, graphicView);
60         s.selectAll(select);
61
62         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
63 }
64
65 // EOF