]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionmodifydelete.cpp
Last checkin before major refactor...
[architektonas] / src / actions / rs_actionmodifydelete.cpp
1 // rs_actionmodifydelete.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/04/2010  Added this text. :-)
13 //
14
15 #include "rs_actionmodifydelete.h"
16
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
19 #include "rs_modification.h"
20
21 RS_ActionModifyDelete::RS_ActionModifyDelete(RS_EntityContainer & container,
22         GraphicView & graphicView): RS_ActionInterface("Delete Entities",
23                 container, graphicView)
24 {
25 }
26
27 RS_ActionModifyDelete::~RS_ActionModifyDelete()
28 {
29 }
30
31 void RS_ActionModifyDelete::init(int status)
32 {
33         RS_ActionInterface::init(status);
34         trigger();
35 }
36
37 void RS_ActionModifyDelete::trigger()
38 {
39         RS_DEBUG->print("RS_ActionModifyDelete::trigger()");
40         RS_Modification m(*container, graphicView);
41         m.remove();
42         finish();
43
44         if (RS_DIALOGFACTORY != NULL)
45                 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
46 }
47
48 void RS_ActionModifyDelete::updateMouseButtonHints()
49 {
50         if (RS_DIALOGFACTORY != NULL)
51         {
52                 switch (getStatus())
53                 {
54                 //case Acknowledge:
55                 //    RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"),
56                 //      tr("Cancel"));
57                 //    break;
58                 default:
59                         RS_DIALOGFACTORY->updateMouseWidget("", "");
60                         break;
61                 }
62         }
63 }
64
65 void RS_ActionModifyDelete::updateMouseCursor()
66 {
67         graphicView->setMouseCursor(RS2::DelCursor);
68 }
69
70 void RS_ActionModifyDelete::updateToolBar()
71 {
72         if (RS_DIALOGFACTORY != NULL)
73         {
74                 if (!isFinished())
75                         RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
76                 else
77                         RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
78         }
79 }
80