Code

separate updating window from updating layers
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 18 Nov 2006 19:28:34 +0000 (19:28 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 18 Nov 2006 19:28:34 +0000 (19:28 +0000)
src/file.cpp
src/interface.cpp
src/jabber_whiteboard/session-manager.cpp
src/sp-namedview.cpp
src/sp-namedview.h
src/ui/view/edit-widget.cpp

index 3a2301c6d5795a152387baed41910e995be722fe..568d32572874d523c83b69445f4ed41917d5c7b0 100644 (file)
@@ -106,6 +106,7 @@ sp_file_new(const Glib::ustring &templ)
         sp_create_window(dtw, TRUE);
         dt = static_cast<SPDesktop*>(dtw->view);
         sp_namedview_window_from_document(dt);
+        sp_namedview_update_layers_from_document(dt);
     }
     return dt;
 }
@@ -201,9 +202,8 @@ sp_file_open(const Glib::ustring &uri,
         // everyone who cares now has a reference, get rid of ours
         sp_document_unref(doc);
         // resize the window to match the document properties
-        // (this may be redundant for new windows... if so, move to the "virgin"
-        //  section above)
         sp_namedview_window_from_document(desktop);
+        sp_namedview_update_layers_from_document(desktop);
 
         if (add_to_recent) {
             prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc));
index 99f6c394fb2958f5c01e91aae1a5168bda772164..da734e671a059c8dacd20521a3ef28d65aba410a 100644 (file)
@@ -213,6 +213,7 @@ sp_ui_new_view()
 
     sp_create_window(dtw, TRUE);
     sp_namedview_window_from_document(static_cast<SPDesktop*>(dtw->view));
+    sp_namedview_update_layers_from_document(static_cast<SPDesktop*>(dtw->view));
 }
 
 /* TODO: not yet working */
index 35d87b4b5e3bc79719412aab17b2b2be3f054970..a5f2e25887be6a70648a2f366fedfdfaf1faca97 100644 (file)
@@ -398,6 +398,7 @@ makeInkboardDesktop(SPDocument* doc)
         sp_create_window(dtw, TRUE);
         dt = static_cast<SPDesktop*>(dtw->view);
         sp_namedview_window_from_document(dt);
+        sp_namedview_update_layers_from_document(dt);
     }
 
     return dt;
index 97640c87a1af6c53a54674c7aaa9fa0950ebb153..1b973a6ba0ea26cd4f8d7901b152328fe3658cdb 100644 (file)
@@ -685,9 +685,13 @@ void sp_namedview_window_from_document(SPDesktop *desktop)
         g_list_free(desktop->zooms_past);
         desktop->zooms_past = NULL;
     }
+}
 
+void sp_namedview_update_layers_from_document (SPDesktop *desktop)
+{
     SPObject *layer = NULL;
     SPDocument *document = desktop->doc();
+    SPNamedView *nv = desktop->namedview;
     if ( nv->default_layer_id != 0 ) {
         layer = document->getObjectById(g_quark_to_string(nv->default_layer_id));
     }
index e16f7a0beaac793b80a285eacfd1f562b68a4cf1..43913007e28a2d9ef1d8a21b9eab05edd3783266 100644 (file)
@@ -106,6 +106,7 @@ SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name);
 
 void sp_namedview_window_from_document(SPDesktop *desktop);
 void sp_namedview_document_from_window(SPDesktop *desktop);
+void sp_namedview_update_layers_from_document (SPDesktop *desktop);
 
 void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
 void sp_namedview_toggle_grid(SPDocument *doc, Inkscape::XML::Node *repr);
index 83566c1996798e12254e1a7cbf9d89e715108b54..0053ea1b767c8858c4cfff4e766cf835ea7cf90d 100644 (file)
@@ -1530,6 +1530,7 @@ EditWidget::initEdit (SPDocument *doc)
     _svg_canvas.init (_desktop);
     _desktop->init (_namedview, _svg_canvas.spobj());
     sp_namedview_window_from_document (_desktop);
+    sp_namedview_update_layers_from_document (_desktop);
     _dt2r = 1.0 / _namedview->doc_units->unittobase;
 
     /// \todo convert to sigc++ when SPObject hierarchy gets converted