diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-08-08 17:27:51 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-08-08 17:27:51 +0000 |
| commit | 60d3113d1f022a3de7cf04c7979d4751b3fe21f6 (patch) | |
| tree | ca33e2a9a1af6b5911598fa1c6a1d77087b71dd2 /src/document-undo.cpp | |
| parent | Minor cleanups (diff) | |
| parent | Add a constrained snap method that takes multiple constraints. This reduces t... (diff) | |
| download | inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.tar.gz inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.zip | |
merge from trunk
(bzr r9508.1.52)
Diffstat (limited to 'src/document-undo.cpp')
| -rw-r--r-- | src/document-undo.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/document-undo.cpp b/src/document-undo.cpp index ae1c82e71..e63fe8a52 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -125,11 +125,10 @@ sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring sp_document_maybe_done (doc, NULL, event_type, event_description); } -void -sp_document_reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) +void sp_document_reset_key( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GtkObject *base ) { - SPDocument *doc = (SPDocument *) base; - doc->actionkey = NULL; + SPDocument *doc = reinterpret_cast<SPDocument *>(base); + doc->actionkey.clear(); } namespace { @@ -171,6 +170,9 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev g_assert (doc != NULL); g_assert (doc->priv != NULL); g_assert (doc->priv->sensitive); + if ( key && !*key ) { + g_warning("Blank undo key specified."); + } Inkscape::Debug::EventTracker<CommitEvent> tracker(doc, key, event_type); @@ -188,7 +190,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev return; } - if (key && doc->actionkey && !strcmp (key, doc->actionkey) && doc->priv->undo) { + if (key && !doc->actionkey.empty() && (doc->actionkey == key) && doc->priv->undo) { ((Inkscape::Event *)doc->priv->undo->data)->event = sp_repr_coalesce_log (((Inkscape::Event *)doc->priv->undo->data)->event, log); } else { @@ -198,7 +200,11 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev doc->priv->undoStackObservers.notifyUndoCommitEvent(event); } - doc->actionkey = key; + if ( key ) { + doc->actionkey = key; + } else { + doc->actionkey.clear(); + } doc->virgin = FALSE; doc->setModifiedSinceSave(); @@ -257,7 +263,7 @@ sp_document_undo (SPDocument *doc) doc->priv->sensitive = FALSE; doc->priv->seeking = true; - doc->actionkey = NULL; + doc->actionkey.clear(); finish_incomplete_transaction(*doc); @@ -303,7 +309,7 @@ sp_document_redo (SPDocument *doc) doc->priv->sensitive = FALSE; doc->priv->seeking = true; - doc->actionkey = NULL; + doc->actionkey.clear(); finish_incomplete_transaction(*doc); |
