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