From: dwyip Date: Fri, 23 Jun 2006 03:58:46 +0000 (+0000) Subject: quick g_message UndoStackObserver for tracing calls to the undo system X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c73fd7fd8d1713c95ecf111e49dd068d4b9adf69;p=inkscape.git quick g_message UndoStackObserver for tracing calls to the undo system --- diff --git a/src/Makefile_insert b/src/Makefile_insert index a0f2ff527..f6c591d83 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -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 index 000000000..6aa49b727 --- /dev/null +++ b/src/console-output-undo-observer.cpp @@ -0,0 +1,48 @@ +/** + * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to + * sp_document_undo, sp_document_redo, sp_document_maybe_done + * + * Authors: + * David Yip + * + * Copyright (c) 2006 Authors + * + * Released under GNU GPL, see the file 'COPYING' for more information + */ + +#include + +#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 index 000000000..6ab299894 --- /dev/null +++ b/src/console-output-undo-observer.h @@ -0,0 +1,50 @@ +/** + * Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to + * sp_document_undo, sp_document_redo, sp_document_maybe_done + * + * Authors: + * David Yip + * + * 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 : diff --git a/src/document-private.h b/src/document-private.h index 34e61a9a0..549a4530f 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -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 diff --git a/src/document.cpp b/src/document.cpp index 71f607b65..e42f6c8cb 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -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() {