/*
* Authors:
* David Yip <yipdw@rose-hulman.edu>
*
* Copyright (c) 2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "inkgc/gc-alloc.h"
#include "undo-stack-observer.h"
#include <list>
struct Event;
/**
* system.
*
* Heavily inspired by Inkscape::XML::CompositeNodeObserver.
*/
/**
* Structure for tracking UndoStackObservers.
*/
struct UndoStackObserverRecord {
/**
* Constructor.
*
* \param o Reference to the UndoStackObserver that this UndoStackObserverRecord
* will track.
*/
bool to_remove;
/**
* Overloaded equality test operator to facilitate usage of STL find algorithms.
*/
{
}
/**
* Issue a redo event to the UndoStackObserver that is associated with this UndoStackObserverRecord.
*
* \param log The event log generated by the redo event.
*/
{
}
/**
* Issue an undo event to the UndoStackObserver that is associated with this
* UndoStackObserverRecord.
*
* \param log The event log generated by the undo event.
*/
{
}
/**
* Issues a committed event to the UndoStackObserver that is associated with this
* UndoStackObserverRecord.
*
* \param log The event log being committed to the undo stack.
*/
{
}
/**
* Issue a clear undo event to the UndoStackObserver
* that is associated with this
* UndoStackObserverRecord.
*/
void issueClearUndo()
{
}
/**
* Issue a clear redo event to the UndoStackObserver
* that is associated with this
* UndoStackObserverRecord.
*/
void issueClearRedo()
{
}
};
/// A list of UndoStackObserverRecords, used to aggregate multiple UndoStackObservers.
typedef std::list< UndoStackObserverRecord, GC::Alloc< UndoStackObserverRecord, GC::MANUAL > > UndoObserverRecordList;
/**
* Constructor.
*/
/**
* Add an UndoStackObserver.
*
* \param observer Reference to an UndoStackObserver to add.
*/
/**
* Remove an UndoStackObserver.
*
* \param observer Reference to an UndoStackObserver to remove.
*/
/**
* Notify all registered UndoStackObservers of an undo event.
*
* \param log The event log generated by the undo event.
*/
/**
* Notify all registered UndoStackObservers of a redo event.
*
* \param log The event log generated by the redo event.
*/
/**
* 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.
*/
virtual void notifyClearUndoEvent();
virtual void notifyClearRedoEvent();
// Remove an observer from a given list
// Mark an observer for removal from a given list
// Keep track of whether or not we are notifying observers
unsigned int _iterating;
// Observers in the active list
// Observers to be added
// Prevents the observer vector from modifications during
// iteration through the vector
void _unlock();
};
}
#endif // SEEN_COMPOSITE_UNDO_COMMIT_OBSERVER_H