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