Code

quick g_message UndoStackObserver for tracing calls to the undo system
authordwyip <dwyip@users.sourceforge.net>
Fri, 23 Jun 2006 03:58:46 +0000 (03:58 +0000)
committerdwyip <dwyip@users.sourceforge.net>
Fri, 23 Jun 2006 03:58:46 +0000 (03:58 +0000)
src/Makefile_insert
src/console-output-undo-observer.cpp [new file with mode: 0644]
src/console-output-undo-observer.h [new file with mode: 0644]
src/document-private.h
src/document.cpp

index a0f2ff527be1728bf8ed2bf3cfa5a01f393229a5..f6c591d831546b22a565ce7b2598df9bce2eb8c8 100644 (file)
@@ -49,6 +49,7 @@ libinkpre_a_SOURCES = \
        conn-avoid-ref.cpp conn-avoid-ref.h     \
        connector-context.cpp connector-context.h       \
        connection-pool.h \
+       console-output-undo-observer.h console-output-undo-observer.cpp \
        context-fns.cpp context-fns.h \
        desktop-affine.cpp desktop-affine.h     \
        desktop-events.cpp desktop-events.h     \
diff --git a/src/console-output-undo-observer.cpp b/src/console-output-undo-observer.cpp
new file mode 100644 (file)
index 0000000..6aa49b7
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to
+ * sp_document_undo, sp_document_redo, sp_document_maybe_done
+ *
+ * Authors:
+ * David Yip <yipdw@alumni.rose-hulman.edu>
+ *
+ * Copyright (c) 2006 Authors
+ *
+ * Released under GNU GPL, see the file 'COPYING' for more information
+ */
+
+#include <glibmm.h>
+
+#include "console-output-undo-observer.h"
+
+namespace Inkscape {
+
+void
+ConsoleOutputUndoObserver::notifyUndoEvent(XML::Event* log)
+{
+       g_message("notifyUndoEvent (sp_document_undo) called; log=%p\n", log);
+}
+
+void
+ConsoleOutputUndoObserver::notifyRedoEvent(XML::Event* log)
+{
+       g_message("notifyRedoEvent (sp_document_redo) called; log=%p\n", log);
+}
+
+void
+ConsoleOutputUndoObserver::notifyUndoCommitEvent(XML::Event* log)
+{
+       g_message("notifyUndoCommitEvent (sp_document_maybe_done) called; log=%p\n", log);
+}
+
+}
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/console-output-undo-observer.h b/src/console-output-undo-observer.h
new file mode 100644 (file)
index 0000000..6ab2998
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to
+ * sp_document_undo, sp_document_redo, sp_document_maybe_done
+ *
+ * Authors:
+ * David Yip <yipdw@alumni.rose-hulman.edu>
+ *
+ * Copyright (c) 2006 Authors
+ *
+ * Released under GNU GPL, see the file 'COPYING' for more information
+ */
+
+#ifndef __INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H__
+#define __INKSCAPE_CONSOLE_OUTPUT_UNDO_OBSERVER_H__
+
+#include "undo-stack-observer.h"
+
+namespace Inkscape {
+
+namespace XML {
+
+class Event;
+
+}
+
+class ConsoleOutputUndoObserver : public UndoStackObserver {
+public:
+       ConsoleOutputUndoObserver() : UndoStackObserver() { }
+       ~ConsoleOutputUndoObserver() { }
+
+       void notifyUndoEvent(XML::Event* log);
+       void notifyRedoEvent(XML::Event* log);
+       void notifyUndoCommitEvent(XML::Event* log);
+
+};
+
+}
+
+#endif
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
index 34e61a9a06a9055a88def6716594fa01e92a946c..549a4530f49985a752cc6a69f33ac18987afb3da 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "composite-undo-stack-observer.h"
 
+// XXX only for testing!
+#include "console-output-undo-observer.h"
+
 #define SP_DOCUMENT_DEFS(d) ((SPObject *) SP_ROOT (SP_DOCUMENT_ROOT (d))->defs)
 
 namespace Inkscape {
@@ -62,6 +65,8 @@ struct SPDocumentPrivate {
        /* Undo listener */
        Inkscape::CompositeUndoStackObserver undoStackObservers;
 
+       // XXX only for testing!
+       Inkscape::ConsoleOutputUndoObserver console_output_undo_observer;
 };
 
 #endif
index 71f607b6524dcdc2e88a1c974c565243c1d830fc..e42f6c8cb57029c2b55e4225e76582c0b50c596e 100644 (file)
@@ -106,6 +106,9 @@ SPDocument::SPDocument() {
     p->redo = NULL;
 
     priv = p;
+
+    // XXX only for testing!
+    priv->undoStackObservers.add(p->console_output_undo_observer);
 }
 
 SPDocument::~SPDocument() {