summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1aa1a4e)
raw | patch | inline | side by side (parent: 1aa1a4e)
author | Jon A. Cruz <jon@joncruz.org> | |
Wed, 28 Jul 2010 05:07:32 +0000 (22:07 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Wed, 28 Jul 2010 05:07:32 +0000 (22:07 -0700) |
src/document-undo.cpp | patch | blob | history | |
src/document.cpp | patch | blob | history | |
src/document.h | patch | blob | history |
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index ae1c82e71f4e4d2e02b4ab2e6e480599ac26096f..e63fe8a529c552e19f12a82419d4ef6a1635f8f1 100644 (file)
--- 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();
doc->priv->sensitive = FALSE;
doc->priv->seeking = true;
- doc->actionkey = NULL;
+ doc->actionkey.clear();
finish_incomplete_transaction(*doc);
doc->priv->sensitive = FALSE;
doc->priv->seeking = true;
- doc->actionkey = NULL;
+ doc->actionkey.clear();
finish_incomplete_transaction(*doc);
diff --git a/src/document.cpp b/src/document.cpp
index eff6d6e818b86f9db51ef9a8e3f087e820deb9bf..3c9f7e5edc2a06272324aa8b422cae78914bbad3 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
base(0),
name(0),
priv(0), // reset in ctor
- actionkey(0),
+ actionkey(),
modified_id(0),
rerouting_handler_id(0),
profileManager(0), // deferred until after other initialization
inkscape_unref();
keepalive = FALSE;
}
-
//delete this->_whiteboard_session_manager;
}
void SPDocument::reset_key (void */*dummy*/)
{
- actionkey = NULL;
+ actionkey.clear();
}
SPDocument *
diff --git a/src/document.h b/src/document.h
index e70582006f92ac3d2327d69ab4a19284923b0c49..5810b535848b52626e917cd8ca6db10d97b7b5f6 100644 (file)
--- a/src/document.h
+++ b/src/document.h
SPDocumentPrivate *priv;
/// Last action key
- const gchar *actionkey;
+ Glib::ustring actionkey;
+
/// Handler ID
guint modified_id;