50#include <glibmm/ustring.h>
78 g_assert (doc !=
nullptr);
96 g_assert(document !=
nullptr);
102 Glib::ustring
const &event_description,
103 Glib::ustring
const &icon_name,
104 unsigned int object_modified_tag)
107 maybeDone(doc,
nullptr, event_description, icon_name, object_modified_tag);
127typedef SimpleEvent<Event::INTERACTION> InteractionEvent;
129class CommitEvent :
public InteractionEvent {
132 CommitEvent(
SPDocument *doc,
const gchar *
key,
const gchar* event_description,
const gchar *icon_name)
133 : InteractionEvent(
"commit")
135 _addProperty(
"timestamp", timestamp());
136 _addProperty(
"document", doc->
serial());
139 _addProperty(
"merge-key",
key);
142 if (event_description) {
143 _addProperty(
"description", event_description);
147 _addProperty(
"icon-name", icon_name);
158 Glib::ustring
const &event_description,
159 Glib::ustring
const &icon_name,
160 unsigned int object_modified_tag)
162 g_assert (doc !=
nullptr);
165 g_warning(
"Blank undo key specified.");
172 assert(undo_size > 0);
196 doc->
undo.push_back(event);
220 while (limit_undo && (
int)doc->
undo.size() > undo_size) {
223 doc->
undo.pop_front();
231 g_assert (doc !=
nullptr);
233 done(doc,
"undozone",
"");
235 if (!doc->
undo.empty() && doc->
undo.back()->description ==
"undozone") {
245 g_warning (
"Incomplete undo transaction (added to next undo):");
247 if (!doc.
undo.empty()) {
265 if (update_log !=
nullptr) {
266 g_warning(
"Document was modified while being updated after undo operation");
270 if (!doc.
undo.empty()) {
286 EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker(
"undo");
287 g_assert (doc !=
nullptr);
295 finish_incomplete_transaction(*doc);
296 if (! doc->
undo.empty()) {
298 doc->
undo.pop_back();
300 perform_document_update(*doc);
313 if (ret) INKSCAPE.external_change();
324 EventTracker<SimpleEvent<Inkscape::Debug::Event::DOCUMENT> > tracker(
"redo");
326 g_assert (doc !=
nullptr);
332 finish_incomplete_transaction(*doc);
333 if (! doc->
redo.empty()) {
335 doc->
redo.pop_back();
338 perform_document_update(*doc);
352 INKSCAPE.external_change();
360 if (! doc->
undo.empty())
362 while (! doc->
undo.empty()) {
364 doc->
undo.pop_back();
371 if (!doc->
redo.empty())
374 while (! doc->
redo.empty()) {
376 doc->
redo.pop_back();
void undo(SPDocument *document)
void notifyUndoCommitEvent(Event *log) override
Notify all registered UndoStackObservers of an event log being committed to the undo stack.
void notifyRedoEvent(Event *log) override
Notify all registered UndoStackObservers of a redo event.
void notifyClearUndoEvent() override
Triggered when the undo log is cleared.
void notifyUndoExpired(Event *log) override
Notify all registered UndoStackObservers of an event log being expired from the back of the undo stac...
void notifyClearRedoEvent() override
Triggered when the redo log is cleared.
void notifyUndoEvent(Event *log) override
Notify all registered UndoStackObservers of an undo event.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void setKeyExpires(SPDocument *document, double timeout)
Set the timeout for the last maybeDone call.
static bool getUndoSensitive(SPDocument const *document)
static void setUndoSensitive(SPDocument *doc, bool sensitive)
Set undo sensitivity.
static void maybeDone(SPDocument *document, const gchar *keyconst, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static gboolean redo(SPDocument *document)
static void perform_document_update(SPDocument &document)
static void finish_incomplete_transaction(SPDocument &document)
static gboolean undo(SPDocument *document)
static void cancel(SPDocument *document)
static void clearRedo(SPDocument *document)
static void resetKey(SPDocument *document)
static void clearUndo(SPDocument *document)
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
int getInt(Glib::ustring const &pref_path, int def=0)
Retrieve an integer.
Enumeration of all XML event types.
Typed SVG document implementation.
Inkscape::XML::Document * rdoc
Our Inkscape::XML::Document.
Inkscape::XML::Event * partial
SPDocument::CommitSignal commit_signal
Inkscape::CompositeUndoStackObserver undoStackObservers
void setModifiedSinceSave(bool const modified=true)
Indicate to the user if the document has been modified since the last save by displaying a "*" in fro...
SPDocument::BeforeCommitSignal before_commit_signal
unsigned long serial() const
std::deque< Inkscape::Event * > redo
bool virgin
Has the document never been touched?
void emitReconstructionFinish()
std::deque< Inkscape::Event * > undo
int ensureUpToDate(unsigned int object_modified_tag=0)
Repeatedly works on getting the document updated, since sometimes it takes more than one pass to get ...
TODO: insert short description here.
TODO: insert short description here.
void sp_repr_undo_log(Inkscape::XML::Event *log)
Inkscape::XML::Event * sp_repr_commit_undoable(Inkscape::XML::Document *doc)
void sp_repr_replay_log(Inkscape::XML::Event *log)
void sp_repr_debug_print_log(Inkscape::XML::Event const *log)
Inkscape::XML::Event * sp_repr_coalesce_log(Inkscape::XML::Event *a, Inkscape::XML::Event *b)
void sp_repr_free_log(Inkscape::XML::Event *log)
void sp_repr_begin_transaction(Inkscape::XML::Document *doc)
std::shared_ptr< std::string > timestamp()
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Piecewise< SBasis > log(Interval in)
Base class for live path effect items.
SPRoot: SVG <svg> implementation.