X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Ffile.cpp;h=0a81069d94f1e193cb8106c26b4a58cdade9d91b;hb=f062bd86cf676758d759503b6b5dc09dddcb42dd;hp=f4630719b27eb88f0343c1f25c6d3a6814c99483;hpb=dcb188b9e24a306e0cc433c93765d60a0614a381;p=inkscape.git diff --git a/src/file.cpp b/src/file.cpp index f4630719b..0a81069d9 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -283,7 +283,7 @@ void dump_str(gchar const *str, gchar const *prefix) } tmp += "]"; - g_message(tmp.c_str()); + g_message("%s", tmp.c_str()); } void dump_ustr(Glib::ustring const &ustr) @@ -344,7 +344,7 @@ void dump_ustr(Glib::ustring const &ustr) tmp += " "; } - g_message( tmp.c_str() ); + g_message( "%s", tmp.c_str() ); } } catch (...) { g_message("XXXXXXXXXXXXXXXXXX Exception" ); @@ -388,8 +388,11 @@ sp_file_open_dialog(gpointer object, gpointer data) open_path, Inkscape::UI::Dialog::SVG_TYPES, (char const *)_("Select file to open")); + // allow easy access to our examples folder + dynamic_cast(openDialogInstance)->add_shortcut_folder(INKSCAPE_EXAMPLESDIR); } + //# Show the dialog bool const success = openDialogInstance->show(); if (!success) @@ -618,6 +621,11 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) saveDialog->change_title(dialog_title); saveDialog->setSelectionType(extension); + // allow easy access to the user's own templates folder + gchar *templates = profile_path ("templates"); + dynamic_cast(saveDialog)->add_shortcut_folder(templates); + g_free (templates); + bool success = saveDialog->show(); if (!success) { delete saveDialog; @@ -755,12 +763,16 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // move imported defs to our document's defs SPObject *in_defs = SP_DOCUMENT_DEFS(in_doc); SPObject *defs = SP_DOCUMENT_DEFS(doc); + + Inkscape::IO::fixupHrefs(doc, in_doc->base, true); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + Inkscape::XML::Node *last_def = SP_OBJECT_REPR(in_defs)->lastChild(); for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child)) { // FIXME: in case of id conflict, newly added thing will be re-ided and thus likely break a reference to it from imported stuff - SP_OBJECT_REPR(in_defs)->addChild(SP_OBJECT_REPR(child)->duplicate(), last_def); + SP_OBJECT_REPR(in_defs)->addChild(SP_OBJECT_REPR(child)->duplicate(xml_doc), last_def); } guint items_count = 0; @@ -781,7 +793,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc)); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { - Inkscape::XML::Node *newchild = SP_OBJECT_REPR(child)->duplicate(); + Inkscape::XML::Node *newchild = SP_OBJECT_REPR(child)->duplicate(xml_doc); // convert layers to groups; FIXME: add "preserve layers" mode where each layer // from impot is copied to the same-named layer in host @@ -805,7 +817,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // just add one item for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc)); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { - Inkscape::XML::Node *newitem = SP_OBJECT_REPR(child)->duplicate(); + Inkscape::XML::Node *newitem = SP_OBJECT_REPR(child)->duplicate(xml_doc); newitem->setAttribute("inkscape:groupmode", NULL); if (desktop) { @@ -834,8 +846,11 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, 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_desktop_document(desktop)); - NR::Point m( desktop->point() - selection->bounds().midpoint() ); - sp_selection_move_relative(selection, m); + NR::Maybe sel_bbox = selection->bounds(); + if (sel_bbox) { + NR::Point m( desktop->point() - sel_bbox->midpoint() ); + sp_selection_move_relative(selection, m); + } prefs_set_int_attribute("options.transform", "pattern", saved_pref); } }