Code

remove warning
[inkscape.git] / src / file.cpp
index acc6e101a8222aee149055ae6b4c255c65192f3e..4d96899da117579869922e3d0ff55e1db3d2d1d7 100644 (file)
@@ -130,7 +130,7 @@ sp_file_new_default()
             char *default_template = g_build_filename(dirname, _("default.svg"), NULL);
             if (Inkscape::IO::file_test(default_template, G_FILE_TEST_IS_REGULAR)) {
                 return sp_file_new(default_template);
-            } 
+            }
         }
         g_free(dirname);
         sources.pop_front();
@@ -179,11 +179,13 @@ sp_file_open(gchar const *uri, Inkscape::Extension::Extension *key, bool add_to_
 
     if (doc) {
         SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-        SPDocument *existing = desktop ? SP_DT_DOCUMENT(desktop) : NULL;
-        
+        SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL;
+
         if (existing && existing->virgin && replace_empty) {
             // If the current desktop is empty, open the document there
+            sp_document_ensure_up_to_date (doc);
             desktop->change_document(doc);
+            sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc));
         } else {
             if (!Inkscape::NSApplication::Application::getNewGui()) {
                 // create a whole new desktop and window
@@ -194,7 +196,7 @@ sp_file_open(gchar const *uri, Inkscape::Extension::Extension *key, bool add_to_
                 desktop = Inkscape::NSApplication::Editor::createDesktop (doc);
             }
         }
-        
+
         doc->virgin = FALSE;
         // everyone who cares now has a reference, get rid of ours
         sp_document_unref(doc);
@@ -230,7 +232,7 @@ sp_file_revert_dialog()
     SPDesktop  *desktop = SP_ACTIVE_DESKTOP;
     g_assert(desktop != NULL);
 
-    SPDocument *doc = SP_DT_DOCUMENT(desktop);
+    SPDocument *doc = sp_desktop_document(desktop);
     g_assert(doc != NULL);
 
     Inkscape::XML::Node     *repr = sp_document_repr_root(doc);
@@ -404,7 +406,7 @@ sp_file_open_dialog(gpointer object, gpointer data)
         {
 
 #ifdef INK_DUMP_FILENAME_CONV
-            g_message(" FileName: %s",(const char *)list->data);           
+            g_message(" FileName: %s",(const char *)list->data);
 #endif
 
             fileName=(gchar *)g_strdup((gchar *)list->data);
@@ -432,7 +434,7 @@ sp_file_open_dialog(gpointer object, gpointer data)
                     g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" );
                 }
 
-#ifdef INK_DUMP_FILENAME_CONV                
+#ifdef INK_DUMP_FILENAME_CONV
                 g_message("Opening File %s\n",fileName);
 #endif
 
@@ -443,7 +445,7 @@ sp_file_open_dialog(gpointer object, gpointer data)
             {
                 g_message("Cannot Open Directory %s\n",fileName);
             }
-            
+
             list=list->next;
         }
 
@@ -879,7 +881,7 @@ file_import(SPDocument *in_doc, gchar const *uri, Inkscape::Extension::Extension
 
         // select and move the imported item
         if (new_obj && SP_IS_ITEM(new_obj)) {
-            Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+            Inkscape::Selection *selection = sp_desktop_selection(desktop);
             selection->set(SP_ITEM(new_obj));
 
             // To move the imported object, we must temporarily set the "transform pattern with
@@ -887,7 +889,7 @@ file_import(SPDocument *in_doc, gchar const *uri, Inkscape::Extension::Extension
             {
                 int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1);
                 prefs_set_int_attribute("options.transform", "pattern", 1);
-                sp_document_ensure_up_to_date(SP_DT_DOCUMENT(desktop));
+                sp_document_ensure_up_to_date(sp_desktop_document(desktop));
                 NR::Point m( desktop->point() - selection->bounds().midpoint() );
                 sp_selection_move_relative(selection, m);
                 prefs_set_int_attribute("options.transform", "pattern", saved_pref);