Code

Draw perspective lines for infinite VPs, too (they are updated during scrolling or...
[inkscape.git] / src / xml / event.cpp
index dd71678743749b5c6572a9bfc17e7a4bbb16e0a0..40f3029e14f04014367b83d0a3596d0e0d3b4467 100644 (file)
@@ -26,8 +26,6 @@ using Inkscape::Util::reverse_list;
 
 int Inkscape::XML::Event::_next_serial=0;
 
-using Inkscape::XML::Session;
-
 void
 sp_repr_begin_transaction (Inkscape::XML::Document *doc)
 {
@@ -38,9 +36,7 @@ sp_repr_begin_transaction (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("begin-transaction");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->beginTransaction();
+       doc->beginTransaction();
 }
 
 void
@@ -53,9 +49,7 @@ sp_repr_rollback (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("rollback");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->rollback();
+       doc->rollback();
 }
 
 void
@@ -68,9 +62,7 @@ sp_repr_commit (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("commit");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->commit();
+       doc->commit();
 }
 
 Inkscape::XML::Event *
@@ -83,9 +75,7 @@ sp_repr_commit_undoable (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("commit");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       return session->commitUndoable();
+       return doc->commitUndoable();
 }
 
 namespace {
@@ -114,15 +104,15 @@ public:
        }
 
        void notifyAttributeChanged(Node &node, GQuark name,
-                                   Inkscape::Util::shared_ptr<char> old_value,
-                                   Inkscape::Util::shared_ptr<char> new_value)
+                                   Inkscape::Util::ptr_shared<char> old_value,
+                                   Inkscape::Util::ptr_shared<char> new_value)
        {
                node.setAttribute(g_quark_to_string(name), new_value);
        }
 
        void notifyContentChanged(Node &node,
-                                 Inkscape::Util::shared_ptr<char> old_value,
-                                 Inkscape::Util::shared_ptr<char> new_value)
+                                 Inkscape::Util::ptr_shared<char> old_value,
+                                 Inkscape::Util::ptr_shared<char> new_value)
        {
                node.setContent(new_value);
        }
@@ -148,8 +138,8 @@ sp_repr_undo_log (Inkscape::XML::Event *log)
 
        EventTracker<SimpleEvent<Event::XML> > tracker("undo-log");
 
-       if (log) {
-               g_assert(!log->repr->session()->inTransaction());
+       if (log && log->repr) {
+               g_assert(!log->repr->document()->inTransaction());
        }
 
        Inkscape::XML::undo_log_to_observer(log, LogPerformer::instance());
@@ -206,12 +196,8 @@ sp_repr_replay_log (Inkscape::XML::Event *log)
        EventTracker<SimpleEvent<Event::XML> > tracker("replay-log");
 
        if (log) {
-               // Nodes created by the whiteboard deserializer tend to not 
-               // have an associated session.  This conditional hacks a way around that,
-               // but what's the best way to fix the whiteboard code so that new nodes
-               // will have an associated session? -- yipdw
-               if (log->repr->session()) {
-                       g_assert(!log->repr->session()->inTransaction());
+               if (log->repr->document()) {
+                       g_assert(!log->repr->document()->inTransaction());
                }
        }
 
@@ -458,8 +444,8 @@ public:
        }
 
        void notifyAttributeChanged(Node &node, GQuark name,
-                                   Inkscape::Util::shared_ptr<char> old_value,
-                                   Inkscape::Util::shared_ptr<char> new_value)
+                                   Inkscape::Util::ptr_shared<char> old_value,
+                                   Inkscape::Util::ptr_shared<char> new_value)
        {
                if (new_value) {
                        g_warning("Event: Set attribute %s to \"%s\" on %s", g_quark_to_string(name), new_value.pointer(), node_to_string(node).c_str());
@@ -469,8 +455,8 @@ public:
        }
 
        void notifyContentChanged(Node &node,
-                                 Inkscape::Util::shared_ptr<char> old_value,
-                                 Inkscape::Util::shared_ptr<char> new_value)
+                                 Inkscape::Util::ptr_shared<char> old_value,
+                                 Inkscape::Util::ptr_shared<char> new_value)
        {
                if (new_value) {
                        g_warning("Event: Set content of %s to \"%s\"", node_to_string(node).c_str(), new_value.pointer());