]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actioneditundo.cpp
Refactoring: Moved RS_GraphicView to GraphicView.
[architektonas] / src / actions / rs_actioneditundo.cpp
1 // rs_actioneditundo.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_actioneditundo.h"
16
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
19
20 /**
21  * Constructor.
22  *
23  * @param undo true for undo and false for redo.
24  */
25 RS_ActionEditUndo::RS_ActionEditUndo(bool undo, RS_EntityContainer & container, GraphicView & graphicView): RS_ActionInterface("Edit Undo", container, graphicView)
26 {
27         this->undo = undo;
28 }
29
30 RS_ActionEditUndo::~RS_ActionEditUndo()
31 {
32 }
33
34 void RS_ActionEditUndo::init(int status)
35 {
36         RS_ActionInterface::init(status);
37         trigger();
38 }
39
40 void RS_ActionEditUndo::trigger()
41 {
42         if (undo)
43                 document->undo();
44         else
45                 document->redo();
46
47         document->updateInserts();
48
49         graphicView->redraw();
50
51         finish();
52         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
53 }
54