X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcomposite-undo-stack-observer.h;h=cd00d421115f8274b2861699d2957e281dfc3b8f;hb=42382dfb4164b919ffcdf03766da9f8be4e43b42;hp=908610135a11c829a61841653cf6c21fa12983c8;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/composite-undo-stack-observer.h b/src/composite-undo-stack-observer.h index 908610135..cd00d4211 100644 --- a/src/composite-undo-stack-observer.h +++ b/src/composite-undo-stack-observer.h @@ -14,25 +14,21 @@ #ifndef __COMPOSITE_UNDO_COMMIT_OBSERVER_H__ #define __COMPOSITE_UNDO_COMMIT_OBSERVER_H__ +#include "gc-alloc.h" +#include "gc-managed.h" #include "undo-stack-observer.h" #include namespace Inkscape { -namespace XML { - class Event; -} - -class UndoStackObserver; - /** * Aggregates UndoStackObservers for management and triggering in an SPDocument's undo/redo * system. */ -class CompositeUndoStackObserver { +class CompositeUndoStackObserver : public UndoStackObserver { public: /** @@ -62,7 +58,7 @@ public: * * \param log The event log generated by the redo event. */ - void issueRedo(XML::Event* log) + void issueRedo(Event* log) { this->_observer.notifyRedoEvent(log); } @@ -73,7 +69,7 @@ public: * * \param log The event log generated by the undo event. */ - void issueUndo(XML::Event* log) + void issueUndo(Event* log) { this->_observer.notifyUndoEvent(log); } @@ -84,24 +80,44 @@ public: * * \param log The event log being committed to the undo stack. */ - void issueUndoCommit(XML::Event* log) + void issueUndoCommit(Event* log) { this->_observer.notifyUndoCommitEvent(log); } + /** + * Issue a clear undo event to the UndoStackObserver + * that is associated with this + * UndoStackObserverRecord. + */ + void issueClearUndo() + { + this->_observer.notifyClearUndoEvent(); + } + + /** + * Issue a clear redo event to the UndoStackObserver + * that is associated with this + * UndoStackObserverRecord. + */ + void issueClearRedo() + { + this->_observer.notifyClearRedoEvent(); + } + private: UndoStackObserver& _observer; }; /// A list of UndoStackObserverRecords, used to aggregate multiple UndoStackObservers. - typedef std::list< UndoStackObserverRecord > UndoObserverRecordList; + typedef std::list< UndoStackObserverRecord, GC::Alloc< UndoStackObserverRecord, GC::MANUAL > > UndoObserverRecordList; /** * Constructor. */ CompositeUndoStackObserver(); - ~CompositeUndoStackObserver(); + virtual ~CompositeUndoStackObserver(); /** * Add an UndoStackObserver. @@ -122,21 +138,24 @@ public: * * \param log The event log generated by the undo event. */ - void notifyUndoEvent(XML::Event* log); + void notifyUndoEvent(Event* log); /** * Notify all registered UndoStackObservers of a redo event. * * \param log The event log generated by the redo event. */ - void notifyRedoEvent(XML::Event* log); + void notifyRedoEvent(Event* log); /** * Notify all registered UndoStackObservers of an event log being committed to the undo stack. * * \param log The event log being committed to the undo stack. */ - void notifyUndoCommitEvent(XML::Event* log); + void notifyUndoCommitEvent(Event* log); + + virtual void notifyClearUndoEvent(); + virtual void notifyClearRedoEvent(); private: // Remove an observer from a given list