diff options
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/src/file.cpp b/src/file.cpp index f492017f8..a0c53a6ee 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1268,136 +1268,6 @@ sp_file_import(Gtk::Window &parentWindow) } - -/*###################### -## E X P O R T -######################*/ - - -#ifdef NEW_EXPORT_DIALOG - -/** - * Display an Export dialog, export as the selected type if OK pressed - */ -bool -sp_file_export_dialog(Gtk::Window &parentWindow) -{ - //# temp hack for 'doc' until we can switch to this dialog - SPDocument *doc = SP_ACTIVE_DOCUMENT; - - Glib::ustring export_path; - Glib::ustring export_loc; - - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Inkscape::Extension::Output *extension; - - //# Get the default extension name - Glib::ustring default_extension = prefs->getString("/dialogs/save_export/default"); - if(default_extension.empty()) { - // FIXME: Is this a good default? Should there be a macro for the string? - default_extension = "org.inkscape.output.png.cairo"; - } - //g_message("%s: extension name: '%s'", __FUNCTION__, default_extension); - - if (doc->uri == NULL) - { - Glib::ustring filename_extension = ".svg"; - extension = dynamic_cast<Inkscape::Extension::Output *> - (Inkscape::Extension::db.get(default_extension.c_str())); - //g_warning("%s: extension ptr: 0x%x", __FUNCTION__, (unsigned int)extension); - if (extension) - filename_extension = extension->get_extension(); - - Glib::ustring attr3 = prefs->getString("/dialogs/save_export/path"); - if (!attr3.empty()) - export_path = attr3; - - if (!Inkscape::IO::file_test(export_path.c_str(), - (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - export_path = Glib::ustring(""); - - if (export_path.empty()) - export_path = g_get_home_dir(); - - export_loc = export_path + G_DIR_SEPARATOR_S + _("drawing") + filename_extension; - - } - else - { - export_path = Glib::path_get_dirname(doc->uri); - } - - // convert save_loc from utf-8 to locale - // is this needed any more, now that everything is handled in - // Inkscape::IO? - Glib::ustring export_path_local = Glib::filename_from_utf8(export_path); - if (!export_path_local.empty()) - export_path = export_path_local; - - //# Show the Export dialog - Inkscape::UI::Dialog::FileExportDialog *exportDialogInstance = - Inkscape::UI::Dialog::FileExportDialog::create( - parentWindow, - export_path, - Inkscape::UI::Dialog::EXPORT_TYPES, - (char const *) _("Select file to export to"), - default_extension - ); - - bool success = exportDialogInstance->show(); - if (!success) { - delete exportDialogInstance; - return success; - } - - Glib::ustring fileName = exportDialogInstance->getFilename(); - - Inkscape::Extension::Extension *selectionType = - exportDialogInstance->getSelectionType(); - - delete exportDialogInstance; - exportDialogInstance = NULL; - - if (fileName.size() > 0) { - Glib::ustring newFileName = Glib::filename_to_utf8(fileName); - - if ( newFileName.size()>0 ) - fileName = newFileName; - else - g_warning( "Error converting save filename to UTF-8." ); - - success = file_save(parentWindow, doc, fileName, selectionType, TRUE, FALSE, Inkscape::Extension::FILE_SAVE_METHOD_EXPORT); - - if (success) { - Glib::RefPtr<Gtk::RecentManager> recent = Gtk::RecentManager::get_default(); - recent->add_item( doc->getDocumentURI() ); - } - - export_path = fileName; - prefs->setString("/dialogs/save_export/path", export_path); - - return success; - } - - - return false; -} - -#else - -/** - * TODO Delete - * This is now a dialog called from dialog manager - * -bool -sp_file_export_dialog(Gtk::Window &parentWindow) -{ - // sp_export_dialog(); - return true; -} -*/ -#endif - /*###################### ## E X P O R T T O O C A L ######################*/ |
