Code

Cmake: Fixed the extra -l in the link command, plus a add linking for all sub-libs...
[inkscape.git] / src / ui / view / view.cpp
index 04158ddbdd74595b759149661ca0839d0026bccf..1b498a846ec018112149d37bbeb6dd1ce5ded556 100644 (file)
@@ -23,6 +23,7 @@
 #include "message-stack.h"
 #include "message-context.h"
 #include "verbs.h"
+#include "inkscape-private.h"
 
 namespace Inkscape {
 namespace UI {
@@ -97,7 +98,11 @@ void View::_close() {
     if (_doc) {
         _document_uri_set_connection.disconnect();
         _document_resized_connection.disconnect();
-        _doc = 0;
+        if (inkscape_remove_document(_doc)) {
+            // this was the last view of this document, so delete it
+            delete _doc;
+        }
+        _doc = NULL;
     }
     
    Inkscape::Verb::delete_all_view (this);
@@ -108,9 +113,9 @@ void View::setPosition (double x, double y)
     _position_set_signal.emit (x,y);
 }
 
-void View::setPosition(NR::Point const &p) 
+void View::setPosition(Geom::Point const &p) 
 { 
-    setPosition (double(p[NR::X]), double(p[NR::Y])); 
+    setPosition (double(p[Geom::X]), double(p[Geom::Y])); 
 }
 
 void View::emitResized (double width, double height)
@@ -138,8 +143,14 @@ void View::setDocument(SPDocument *doc) {
     if (_doc) {
         _document_uri_set_connection.disconnect();
         _document_resized_connection.disconnect();
+        if (inkscape_remove_document(_doc)) {
+            // this was the last view of this document, so delete it
+            delete _doc;
+        }
     }
 
+    inkscape_add_document(doc);
+
     _doc = doc;
     _document_uri_set_connection = 
         _doc->connectURISet(sigc::bind(sigc::ptr_fun(&_onDocumentURISet), this));