summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgustav_b <gustav_b@users.sourceforge.net>2006-10-01 18:57:05 +0000
committergustav_b <gustav_b@users.sourceforge.net>2006-10-01 18:57:05 +0000
commita8c615d56eda3f3e6ee05e9b133151daaeafae72 (patch)
treec32b5f6a6661b332058a1fad5e23d7238188dcf4 /src
parentOther tools now also retain there specific statusbar text when pressing alt/s... (diff)
downloadinkscape-a8c615d56eda3f3e6ee05e9b133151daaeafae72.tar.gz
inkscape-a8c615d56eda3f3e6ee05e9b133151daaeafae72.zip
Moved EventLog from SPDocument to SPDesktop to prevent it from being
created when Inkscape is started in non-gui mode. Fixes a critical assertion caused by creation of a Gtk::TreeStore. (bzr r1749)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp5
-rw-r--r--src/desktop.h2
-rw-r--r--src/document-private.h3
-rw-r--r--src/document.cpp9
-rw-r--r--src/document.h2
-rw-r--r--src/event-log.cpp13
-rw-r--r--src/event-log.h4
-rw-r--r--src/sp-namedview.cpp2
-rw-r--r--src/ui/dialog/undo-history.cpp3
-rw-r--r--src/ui/dialog/undo-history.h2
10 files changed, 15 insertions, 30 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 57d89c5bc..722aa81e9 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -79,6 +79,7 @@
#include "xml/repr.h"
#include "message-context.h"
#include "layer-manager.h"
+#include "event-log.h"
namespace Inkscape { namespace XML { class Node; }}
@@ -287,6 +288,10 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
/* setup LayerManager */
// (Setting up after the connections are all in place, as it may use some of them)
layer_manager = new Inkscape::LayerManager( this );
+
+ /* setup EventLog */
+ event_log = new Inkscape::EventLog(document);
+ document->addUndoObserver(*event_log);
}
diff --git a/src/desktop.h b/src/desktop.h
index c9484f2fe..948fd53bc 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -52,6 +52,7 @@ namespace Inkscape {
class Selection;
class ObjectHierarchy;
class LayerManager;
+ class EventLog;
namespace UI {
namespace Dialog {
class DialogManager;
@@ -76,6 +77,7 @@ struct SPDesktop : public Inkscape::UI::View::View
Inkscape::Selection *selection;
SPEventContext *event_context;
Inkscape::LayerManager *layer_manager;
+ Inkscape::EventLog *event_log;
SPCanvasItem *acetate;
SPCanvasGroup *main;
diff --git a/src/document-private.h b/src/document-private.h
index 64b1174fd..c89948290 100644
--- a/src/document-private.h
+++ b/src/document-private.h
@@ -68,9 +68,6 @@ struct SPDocumentPrivate {
/* Undo listener */
Inkscape::CompositeUndoStackObserver undoStackObservers;
- /* Event log */
- Inkscape::EventLog event_log;
-
// XXX only for testing!
Inkscape::ConsoleOutputUndoObserver console_output_undo_observer;
};
diff --git a/src/document.cpp b/src/document.cpp
index f403f3aad..8731ee71c 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -107,9 +107,6 @@ SPDocument::SPDocument() {
p->undo = NULL;
p->redo = NULL;
- p->undoStackObservers.add(p->event_log);
- p->event_log.setDocument(this);
-
priv = p;
// XXX only for testing!
@@ -659,12 +656,6 @@ SPDocument::removeUndoObserver(Inkscape::UndoStackObserver& observer)
this->priv->undoStackObservers.remove(observer);
}
-Inkscape::EventLog&
-SPDocument::getEventLog() const
-{
- return priv->event_log;
-}
-
SPObject *SPDocument::getObjectById(gchar const *id) {
g_return_val_if_fail(id != NULL, NULL);
diff --git a/src/document.h b/src/document.h
index f957239c1..12848aa68 100644
--- a/src/document.h
+++ b/src/document.h
@@ -115,8 +115,6 @@ struct SPDocument : public Inkscape::GC::Managed<>,
void addUndoObserver(Inkscape::UndoStackObserver& observer);
void removeUndoObserver(Inkscape::UndoStackObserver& observer);
- Inkscape::EventLog& getEventLog() const;
-
bool _updateDocument();
private:
diff --git a/src/event-log.cpp b/src/event-log.cpp
index 496094318..751616d30 100644
--- a/src/event-log.cpp
+++ b/src/event-log.cpp
@@ -16,10 +16,10 @@
namespace Inkscape {
-EventLog::EventLog() :
+EventLog::EventLog(SPDocument* document) :
UndoStackObserver(),
_connected (false),
- _document (NULL),
+ _document (document),
_event_list_store (Gtk::TreeStore::create(_columns)),
_event_list_selection (NULL),
_event_list_view (NULL),
@@ -228,15 +228,6 @@ EventLog::notifyUndoCommitEvent(Event* log)
updateUndoVerbs();
}
-
-void
-EventLog::setDocument(SPDocument *document)
-{
- _document = document;
- updateUndoVerbs();
-}
-
-
void
EventLog::connectWithDialog(Gtk::TreeView *event_list_view, CallbackMap *callback_connections)
{
diff --git a/src/event-log.h b/src/event-log.h
index 16ecfd555..259731de2 100644
--- a/src/event-log.h
+++ b/src/event-log.h
@@ -44,7 +44,7 @@ public:
typedef Gtk::TreeModel::iterator iterator;
typedef Gtk::TreeModel::const_iterator const_iterator;
- EventLog();
+ EventLog(SPDocument* document);
~EventLog();
/**
@@ -85,8 +85,6 @@ public:
void setCurrEventParent(iterator event) { _curr_event_parent = event; }
void blockNotifications(bool status=true) { _notifications_blocked = status; }
- void setDocument(SPDocument *document);
-
/*
* Callback types for TreeView changes.
*/
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index 54805f872..fe6b805bc 100644
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -706,7 +706,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop)
}
// FIXME: find a better place to do this
- sp_desktop_document(desktop)->getEventLog().updateUndoVerbs();
+ desktop->event_log->updateUndoVerbs();
}
void sp_namedview_document_from_window(SPDesktop *desktop)
diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp
index e1b60f315..5cfba60f6 100644
--- a/src/ui/dialog/undo-history.cpp
+++ b/src/ui/dialog/undo-history.cpp
@@ -98,8 +98,9 @@ const CellRendererInt::Filter& CellRendererInt::no_filter = CellRendererInt::NoF
UndoHistory::UndoHistory()
: Dialog ("dialogs.undo-history", SP_VERB_DIALOG_UNDO_HISTORY),
+ _desktop (SP_ACTIVE_DESKTOP),
_document (SP_ACTIVE_DOCUMENT),
- _event_log (_document ? &_document->getEventLog() : NULL),
+ _event_log (_desktop ? _desktop->event_log : NULL),
_columns (_event_log ? &_event_log->getColumns() : NULL),
_event_list_selection (_event_list_view.get_selection())
{
diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h
index 19c5740a4..2857fb88a 100644
--- a/src/ui/dialog/undo-history.h
+++ b/src/ui/dialog/undo-history.h
@@ -29,6 +29,7 @@
#include <functional>
#include <sstream>
+#include "desktop.h"
#include "dialog.h"
#include "event-log.h"
@@ -123,6 +124,7 @@ public:
protected:
+ SPDesktop *_desktop;
SPDocument *_document;
EventLog *_event_log;