From 49208837808e4c15f5458cd1d7584ad83efeb188 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sat, 18 Nov 2006 19:28:34 +0000 Subject: [PATCH] separate updating window from updating layers --- src/file.cpp | 4 ++-- src/interface.cpp | 1 + src/jabber_whiteboard/session-manager.cpp | 1 + src/sp-namedview.cpp | 4 ++++ src/sp-namedview.h | 1 + src/ui/view/edit-widget.cpp | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index 3a2301c6d..568d32572 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -106,6 +106,7 @@ sp_file_new(const Glib::ustring &templ) sp_create_window(dtw, TRUE); dt = static_cast(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)); diff --git a/src/interface.cpp b/src/interface.cpp index 99f6c394f..da734e671 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -213,6 +213,7 @@ sp_ui_new_view() sp_create_window(dtw, TRUE); sp_namedview_window_from_document(static_cast(dtw->view)); + sp_namedview_update_layers_from_document(static_cast(dtw->view)); } /* TODO: not yet working */ diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index 35d87b4b5..a5f2e2588 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -398,6 +398,7 @@ makeInkboardDesktop(SPDocument* doc) sp_create_window(dtw, TRUE); dt = static_cast(dtw->view); sp_namedview_window_from_document(dt); + sp_namedview_update_layers_from_document(dt); } return dt; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 97640c87a..1b973a6ba 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -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)); } diff --git a/src/sp-namedview.h b/src/sp-namedview.h index e16f7a0be..43913007e 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -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); diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 83566c199..0053ea1b7 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -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 -- 2.30.2