Inkscape
Vector Graphics Editor
|
A simple log for maintaining a history of committed, undone and redone events along with their type. More...
#include <event-log.h>
Classes | |
struct | EventModelColumns |
Event datatype. More... | |
Public Types | |
enum | CallbackTypes { CALLB_SELECTION_CHANGE , CALLB_EXPAND , CALLB_COLLAPSE , CALLB_LAST } |
typedef Gtk::TreeModel::iterator | iterator |
typedef Gtk::TreeModel::const_iterator | const_iterator |
typedef std::map< const CallbackTypes, sigc::connection > | CallbackMap |
Public Member Functions | |
EventLog (SPDocument *document) | |
~EventLog () override | |
void | notifyUndoEvent (Event *log) override |
Modifies the log's entries and the view's selection when triggered. | |
void | notifyRedoEvent (Event *log) override |
Triggered when the user issues a redo command. | |
void | notifyUndoCommitEvent (Event *log) override |
Triggered when a set of transactions is committed to the undo log. | |
void | notifyUndoExpired (Event *log) override |
Triggered when undo items are removed from the back of the log (expired) | |
void | notifyClearUndoEvent () override |
Triggered when the undo log is cleared. | |
void | notifyClearRedoEvent () override |
Triggered when the redo log is cleared. | |
Glib::RefPtr< Gtk::TreeModel > | getEventListStore () const |
iterator | getCurrEvent () const |
iterator | getCurrEventParent () const |
void | setCurrEvent (iterator event) |
void | setCurrEventParent (iterator event) |
void | blockNotifications (bool status=true) |
void | rememberFileSave () |
void | addDialogConnection (Gtk::TreeView *event_list_view, CallbackMap *callback_connections) |
Connect with a TreeView. | |
void | removeDialogConnection (Gtk::TreeView *event_list_view, CallbackMap *callback_connections) |
Disconnect from a TreeView. | |
void | updateUndoVerbs () |
![]() | |
UndoStackObserver ()=default | |
virtual | ~UndoStackObserver ()=default |
Static Public Member Functions | |
static const EventModelColumns & | getColumns () |
Private Member Functions | |
const_iterator | _getUndoEvent () const |
const_iterator | _getRedoEvent () const |
void | _clearUndo () |
void | _clearRedo () |
void | checkForVirginity () |
EventLog (EventLog const &other)=delete | |
EventLog & | operator= (EventLog const &other)=delete |
Private Attributes | |
EventLogPrivate * | _priv |
SPDocument * | _document |
Glib::RefPtr< Gtk::TreeStore > | _event_list_store |
iterator | _first_event |
iterator | _curr_event |
iterator | _last_event |
iterator | _curr_event_parent |
iterator | _last_saved |
bool | _notifications_blocked |
A simple log for maintaining a history of committed, undone and redone events along with their type.
It implements the UndoStackObserver and should be registered with a CompositeUndoStackObserver for each document. The event log is then notified on all commit, undo and redo events and will store a representation of them in an internal Gtk::TreeStore.
Consecutive events of the same type are grouped with the first event as a parent and following as its children.
If a Gtk::TreeView is connected to the event log, the TreeView's selection and its nodes expanded/collapsed state will be updated as events are committed, undone and redone. Whenever this happens, the event log will block the TreeView's callbacks to prevent circular updates.
Definition at line 43 of file event-log.h.
typedef std::map<const CallbackTypes, sigc::connection> Inkscape::EventLog::CallbackMap |
Definition at line 102 of file event-log.h.
typedef Gtk::TreeModel::const_iterator Inkscape::EventLog::const_iterator |
Definition at line 48 of file event-log.h.
typedef Gtk::TreeModel::iterator Inkscape::EventLog::iterator |
Definition at line 47 of file event-log.h.
Enumerator | |
---|---|
CALLB_SELECTION_CHANGE | |
CALLB_EXPAND | |
CALLB_COLLAPSE | |
CALLB_LAST |
Definition at line 95 of file event-log.h.
Inkscape::EventLog::EventLog | ( | SPDocument * | document | ) |
Definition at line 173 of file event-log.cpp.
References _curr_event, _event_list_store, _first_event, _last_event, _last_saved, and getColumns().
|
override |
Definition at line 194 of file event-log.cpp.
References _event_list_store, and _priv.
|
privatedelete |
|
private |
Definition at line 469 of file event-log.cpp.
References _curr_event, _event_list_store, _last_event, and getColumns().
Referenced by notifyClearRedoEvent(), and notifyUndoCommitEvent().
|
private |
Definition at line 463 of file event-log.cpp.
Referenced by notifyClearUndoEvent().
|
private |
Definition at line 436 of file event-log.cpp.
References _curr_event, and _last_event.
Referenced by notifyRedoEvent(), and updateUndoVerbs().
|
private |
Definition at line 427 of file event-log.cpp.
References _curr_event, and _event_list_store.
Referenced by notifyUndoEvent(), and updateUndoVerbs().
void Inkscape::EventLog::addDialogConnection | ( | Gtk::TreeView * | event_list_view, |
CallbackMap * | callback_connections | ||
) |
Connect with a TreeView.
Definition at line 406 of file event-log.cpp.
References _curr_event, _event_list_store, and _priv.
Referenced by Inkscape::UI::Dialog::UndoHistory::connectEventLog().
|
inline |
Definition at line 90 of file event-log.h.
References _notifications_blocked.
Referenced by Inkscape::UI::Dialog::UndoHistory::_onCollapseEvent(), and Inkscape::UI::Dialog::UndoHistory::_onListSelectionChange().
|
private |
Definition at line 504 of file event-log.cpp.
References _curr_event, _document, _last_saved, and SPDocument::setModifiedSinceSave().
Referenced by notifyRedoEvent(), notifyUndoCommitEvent(), and notifyUndoEvent().
|
static |
Definition at line 167 of file event-log.cpp.
Referenced by _clearRedo(), EventLog(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), notifyUndoExpired(), and Inkscape::UI::Dialog::UndoHistory::UndoHistory().
|
inline |
Definition at line 85 of file event-log.h.
References _curr_event.
Referenced by Inkscape::UI::Dialog::UndoHistory::_onCollapseEvent(), Inkscape::UI::Dialog::UndoHistory::_onExpandEvent(), and Inkscape::UI::Dialog::UndoHistory::_onListSelectionChange().
|
inline |
Definition at line 86 of file event-log.h.
References _curr_event_parent.
|
inline |
Definition at line 83 of file event-log.h.
References _event_list_store.
Referenced by Inkscape::UI::Dialog::UndoHistory::connectEventLog().
|
overridevirtual |
Triggered when the redo log is cleared.
Implements Inkscape::UndoStackObserver.
Definition at line 400 of file event-log.cpp.
References _clearRedo(), and updateUndoVerbs().
|
overridevirtual |
Triggered when the undo log is cleared.
Implements Inkscape::UndoStackObserver.
Definition at line 393 of file event-log.cpp.
References _clearUndo(), and updateUndoVerbs().
|
overridevirtual |
Triggered when the user issues a redo command.
log | Pointer to an Event describing the redone event. |
Implements Inkscape::UndoStackObserver.
Definition at line 250 of file event-log.cpp.
References _curr_event, _curr_event_parent, _event_list_store, _getRedoEvent(), _notifications_blocked, _priv, checkForVirginity(), getColumns(), log(), and updateUndoVerbs().
|
overridevirtual |
Triggered when a set of transactions is committed to the undo log.
log | Pointer to an Event describing the committed events. |
Implements Inkscape::UndoStackObserver.
Definition at line 299 of file event-log.cpp.
References _clearRedo(), _curr_event, _curr_event_parent, _event_list_store, _last_event, _priv, checkForVirginity(), getColumns(), log(), and updateUndoVerbs().
|
overridevirtual |
Modifies the log's entries and the view's selection when triggered.
Implements Inkscape::UndoStackObserver.
Definition at line 203 of file event-log.cpp.
References _curr_event, _curr_event_parent, _event_list_store, _getUndoEvent(), _notifications_blocked, _priv, checkForVirginity(), getColumns(), log(), and updateUndoVerbs().
|
overridevirtual |
Triggered when undo items are removed from the back of the log (expired)
Implements Inkscape::UndoStackObserver.
Definition at line 347 of file event-log.cpp.
References _event_list_store, _first_event, getColumns(), log(), and parent.
|
inline |
Definition at line 91 of file event-log.h.
References _curr_event, and _last_saved.
Referenced by file_save().
void Inkscape::EventLog::removeDialogConnection | ( | Gtk::TreeView * | event_list_view, |
CallbackMap * | callback_connections | ||
) |
Disconnect from a TreeView.
Definition at line 411 of file event-log.cpp.
References _priv.
Referenced by Inkscape::UI::Dialog::UndoHistory::disconnectEventLog().
|
inline |
Definition at line 88 of file event-log.h.
References _curr_event.
Referenced by Inkscape::UI::Dialog::UndoHistory::_onCollapseEvent(), and Inkscape::UI::Dialog::UndoHistory::_onListSelectionChange().
|
inline |
Definition at line 89 of file event-log.h.
References _curr_event_parent.
Referenced by Inkscape::UI::Dialog::UndoHistory::_onCollapseEvent(), and Inkscape::UI::Dialog::UndoHistory::_onListSelectionChange().
void Inkscape::EventLog::updateUndoVerbs | ( | ) |
Definition at line 418 of file event-log.cpp.
References _document, _getRedoEvent(), _getUndoEvent(), and enable_undo_actions().
Referenced by Inkscape::UI::Dialog::UndoHistory::_onListSelectionChange(), Inkscape::UI::Tools::InteractiveBooleansTool::InteractiveBooleansTool(), notifyClearRedoEvent(), notifyClearUndoEvent(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), sp_namedview_update_layers_from_document(), and Inkscape::UI::Tools::InteractiveBooleansTool::~InteractiveBooleansTool().
|
private |
Definition at line 127 of file event-log.h.
Referenced by _clearRedo(), _getRedoEvent(), _getUndoEvent(), addDialogConnection(), checkForVirginity(), EventLog(), getCurrEvent(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), rememberFileSave(), and setCurrEvent().
|
private |
Definition at line 129 of file event-log.h.
Referenced by getCurrEventParent(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), and setCurrEventParent().
|
private |
Definition at line 122 of file event-log.h.
Referenced by checkForVirginity(), and updateUndoVerbs().
|
private |
Definition at line 124 of file event-log.h.
Referenced by _clearRedo(), _getUndoEvent(), addDialogConnection(), EventLog(), getEventListStore(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), notifyUndoExpired(), and ~EventLog().
|
private |
Definition at line 126 of file event-log.h.
Referenced by EventLog(), and notifyUndoExpired().
|
private |
Definition at line 128 of file event-log.h.
Referenced by _clearRedo(), _getRedoEvent(), EventLog(), and notifyUndoCommitEvent().
|
private |
Definition at line 131 of file event-log.h.
Referenced by checkForVirginity(), EventLog(), and rememberFileSave().
|
private |
Definition at line 133 of file event-log.h.
Referenced by blockNotifications(), notifyRedoEvent(), and notifyUndoEvent().
|
private |
Definition at line 120 of file event-log.h.
Referenced by addDialogConnection(), notifyRedoEvent(), notifyUndoCommitEvent(), notifyUndoEvent(), removeDialogConnection(), and ~EventLog().