]> Shamusworld >> Repos - architektonas/blob - src/actions/actionmodifydelete.cpp
Bugfixes related to removing Snapper class.
[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 "debug.h"
20 #include "dialogfactory.h"
21 #include "graphicview.h"
22 #include "modification.h"
23
24 ActionModifyDelete::ActionModifyDelete(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         DEBUG->print("ActionModifyDelete::trigger()");
43         Modification m(*container, graphicView);
44         m.remove();
45         finish();
46
47         if (DIALOGFACTORY != NULL)
48                 DIALOGFACTORY->updateSelectionWidget(container->countSelected());
49 }
50
51 void ActionModifyDelete::updateMouseButtonHints()
52 {
53         if (DIALOGFACTORY != NULL)
54         {
55                 switch (getStatus())
56                 {
57                 //case Acknowledge:
58                 //    DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"),
59                 //      tr("Cancel"));
60                 //    break;
61                 default:
62                         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 (DIALOGFACTORY != NULL)
76         {
77                 if (!isFinished())
78                         DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
79                 else
80                         DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
81         }
82 }