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
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/02/2010 Added this text. :-)
19 #include "undocycle.h"
22 * Default constructor.
30 * Destructor. Makes sure that this undoable is removed from
31 * its undo cycle before it is deleted.
36 cycle->removeUndoable(this);
40 * Runtime type identification for undoables.
41 * Note that this is voluntarily. The default implementation
42 * returns RS2::UndoableUnknown.
44 /*virtual*/ RS2::UndoableType Undoable::undoRtti()
46 return RS2::UndoableUnknown;
50 * Sets the undo cycle this entity is in. This is necessary to
51 * make sure the entity can remove itself from the cycle before
54 void Undoable::setUndoCycle(UndoCycle * cycle)
60 * The undoable thing gets activated if it was undone and
61 * deactivated otherwise.
63 void Undoable::changeUndoState()
65 toggleFlag(RS2::FlagUndone);
66 undoStateChanged(isUndone());
70 * Undoes or redoes an undoable.
72 void Undoable::setUndoState(bool undone)
75 setFlag(RS2::FlagUndone);
77 delFlag(RS2::FlagUndone);
79 undoStateChanged(isUndone());
83 * Is this entity in the Undo memory and not active?
85 bool Undoable::isUndone() const
87 return getFlag(RS2::FlagUndone);
91 * Can be overwriten by the implementing class to be notified
92 * when the undo state changes (the undoable becomes visible / invisible).
94 /*virtual*/ void Undoable::undoStateChanged(bool /*undone*/)