diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-03-27 18:43:21 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-03-27 20:28:03 +0000 |
| commit | 9f542bb81f342cbc65a00aeadd084ab3945b02a5 (patch) | |
| tree | b1a7a318abcf538524bdf1b4b1ebd5e9cc5725c3 /src/ui/dialog/filedialogimpl-gtkmm.cpp | |
| parent | remove wrong from clipboard paste (diff) | |
| download | inkscape-9f542bb81f342cbc65a00aeadd084ab3945b02a5.tar.gz inkscape-9f542bb81f342cbc65a00aeadd084ab3945b02a5.zip | |
Remove unused code for NEW_EXPORT_DIALOG
Functionality seems to have been replaced by "Save a Copy" and the
PNG export dialog respectively.
Diffstat (limited to 'src/ui/dialog/filedialogimpl-gtkmm.cpp')
| -rw-r--r-- | src/ui/dialog/filedialogimpl-gtkmm.cpp | 343 |
1 files changed, 0 insertions, 343 deletions
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 688b286b4..de6b18489 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -851,349 +851,6 @@ void FileSaveDialogImplGtk::updateNameAndExtension() } -#ifdef NEW_EXPORT_DIALOG - -//######################################################################## -//# F I L E E X P O R T -//######################################################################## - -/** - * Callback for fileNameEntry widget - */ -void FileExportDialogImpl::fileNameEntryChangedCallback() -{ - if (!fileNameEntry) - return; - - Glib::ustring fileName = fileNameEntry->get_text(); - if (!Glib::get_charset()) // If we are not utf8 - fileName = Glib::filename_to_utf8(fileName); - - // g_message("User hit return. Text is '%s'\n", fileName.c_str()); - - if (!Glib::path_is_absolute(fileName)) { - // try appending to the current path - // not this way: fileName = get_current_folder() + "/" + fileName; - std::vector<Glib::ustring> pathSegments; - pathSegments.push_back(get_current_folder()); - pathSegments.push_back(fileName); - fileName = Glib::build_filename(pathSegments); - } - - // g_message("path:'%s'\n", fileName.c_str()); - - if (Glib::file_test(fileName, Glib::FILE_TEST_IS_DIR)) { - set_current_folder(fileName); - } else if (/*Glib::file_test(fileName, Glib::FILE_TEST_IS_REGULAR)*/ 1) { - // dialog with either (1) select a regular file or (2) cd to dir - // simulate an 'OK' - set_filename(fileName); - response(Gtk::RESPONSE_OK); - } -} - - - -/** - * Callback for fileNameEntry widget - */ -void FileExportDialogImpl::fileTypeChangedCallback() -{ - int sel = fileTypeComboBox.get_active_row_number(); - if ((sel < 0) || (sel >= (int)fileTypes.size())) - return; - - FileType type = fileTypes[sel]; - // g_message("selected: %s\n", type.name.c_str()); - Gtk::FileFilter filter; - filter.add_pattern(type.pattern); - set_filter(filter); -} - - - -void FileExportDialogImpl::createFileTypeMenu() -{ - Inkscape::Extension::DB::OutputList extension_list; - Inkscape::Extension::db.get_output_list(extension_list); - - for (Inkscape::Extension::DB::OutputList::iterator current_item = extension_list.begin(); - current_item != extension_list.end(); ++current_item) { - Inkscape::Extension::Output *omod = *current_item; - - // FIXME: would be nice to grey them out instead of not listing them - if (omod->deactivated()) - continue; - - FileType type; - type.name = (_(omod->get_filetypename())); - type.pattern = "*"; - Glib::ustring extension = omod->get_extension(); - fileDialogExtensionToPattern(type.pattern, extension); - type.extension = omod; - fileTypeComboBox.append_text(type.name); - fileTypes.push_back(type); - } - - //#Let user choose - FileType guessType; - guessType.name = _("Guess from extension"); - guessType.pattern = "*"; - guessType.extension = NULL; - fileTypeComboBox.append_text(guessType.name); - fileTypes.push_back(guessType); - - - fileTypeComboBox.set_active(0); - fileTypeChangedCallback(); // call at least once to set the filter -} - - -/** - * Constructor - */ -FileExportDialogImpl::FileExportDialogImpl(Gtk::Window &parentWindow, const Glib::ustring &dir, - FileDialogType fileTypes, const Glib::ustring &title, - const Glib::ustring & /*default_key*/) - : FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "/dialogs/export") - , sourceX0Spinner("X0", _("Left edge of source")) - , sourceY0Spinner("Y0", _("Top edge of source")) - , sourceX1Spinner("X1", _("Right edge of source")) - , sourceY1Spinner("Y1", _("Bottom edge of source")) - , sourceWidthSpinner("Width", _("Source width")) - , sourceHeightSpinner("Height", _("Source height")) - , destWidthSpinner("Width", _("Destination width")) - , destHeightSpinner("Height", _("Destination height")) - , destDPISpinner("DPI", _("Resolution (dots per inch)")) -{ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - append_extension = prefs->getBool("/dialogs/save_export/append_extension", true); - - /* One file at a time */ - set_select_multiple(false); - - set_local_only(false); - - /* Initialize to Autodetect */ - extension = NULL; - /* No filename to start out with */ - myFilename = ""; - - /* Set our dialog type (save, export, etc...)*/ - _dialogType = fileTypes; - - /* Set the pwd and/or the filename */ - if (dir.size() > 0) { - Glib::ustring udir(dir); - Glib::ustring::size_type len = udir.length(); - // leaving a trailing backslash on the directory name leads to the infamous - // double-directory bug on win32 - if ((len != 0) && (udir[len - 1] == '\\')) - udir.erase(len - 1); - set_current_folder(udir.c_str()); - } - - //######################################### - //## EXTRA WIDGET -- SOURCE SIDE - //######################################### - - //##### Export options buttons/spinners, etc - documentButton.set_label(_("Document")); - scopeBox.pack_start(documentButton); - scopeGroup = documentButton.get_group(); - - pageButton.set_label(_("Page")); - pageButton.set_group(scopeGroup); - scopeBox.pack_start(pageButton); - - selectionButton.set_label(_("Selection")); - selectionButton.set_group(scopeGroup); - scopeBox.pack_start(selectionButton); - - customButton.set_label(C_("Export dialog", "Custom")); - customButton.set_group(scopeGroup); - scopeBox.pack_start(customButton); - - sourceBox.pack_start(scopeBox); - - - - // dimension buttons - sourceTable.resize(3, 3); - sourceTable.attach(sourceX0Spinner, 0, 1, 0, 1); - sourceTable.attach(sourceY0Spinner, 1, 2, 0, 1); - sourceUnitsSpinner.setUnitType(UNIT_TYPE_LINEAR); - sourceTable.attach(sourceUnitsSpinner, 2, 3, 0, 1); - sourceTable.attach(sourceX1Spinner, 0, 1, 1, 2); - sourceTable.attach(sourceY1Spinner, 1, 2, 1, 2); - sourceTable.attach(sourceWidthSpinner, 0, 1, 2, 3); - sourceTable.attach(sourceHeightSpinner, 1, 2, 2, 3); - - sourceBox.pack_start(sourceTable); - sourceFrame.set_label(_("Source")); - sourceFrame.add(sourceBox); - exportOptionsBox.pack_start(sourceFrame); - - - //######################################### - //## EXTRA WIDGET -- SOURCE SIDE - //######################################### - - - destTable.resize(3, 3); - destTable.attach(destWidthSpinner, 0, 1, 0, 1); - destTable.attach(destHeightSpinner, 1, 2, 0, 1); - destUnitsSpinner.setUnitType(UNIT_TYPE_LINEAR); - destTable.attach(destUnitsSpinner, 2, 3, 0, 1); - destTable.attach(destDPISpinner, 0, 1, 1, 2); - - destBox.pack_start(destTable); - - - cairoButton.set_label(_("Cairo")); - otherOptionBox.pack_start(cairoButton); - - antiAliasButton.set_label(_("Antialias")); - otherOptionBox.pack_start(antiAliasButton); - - backgroundButton.set_label(_("Background")); - otherOptionBox.pack_start(backgroundButton); - - destBox.pack_start(otherOptionBox); - - - - //###### File options - //###### Do we want the .xxx extension automatically added? - fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically"))); - fileTypeCheckbox.set_active(append_extension); - destBox.pack_start(fileTypeCheckbox); - - //###### File type menu - createFileTypeMenu(); - fileTypeComboBox.set_size_request(200, 40); - fileTypeComboBox.signal_changed().connect(sigc::mem_fun(*this, &FileExportDialogImpl::fileTypeChangedCallback)); - - destBox.pack_start(fileTypeComboBox); - - destFrame.set_label(_("Destination")); - destFrame.add(destBox); - exportOptionsBox.pack_start(destFrame); - - //##### Put the two boxes and their parent onto the dialog - exportOptionsBox.pack_start(sourceFrame); - exportOptionsBox.pack_start(destFrame); - - set_extra_widget(exportOptionsBox); - - - - // Let's do some customization - fileNameEntry = NULL; - Gtk::Container *cont = get_toplevel(); - std::vector<Gtk::Entry *> entries; - findEntryWidgets(cont, entries); - // g_message("Found %d entry widgets\n", entries.size()); - if (!entries.empty()) { - // Catch when user hits [return] on the text field - fileNameEntry = entries[0]; - fileNameEntry->signal_activate().connect( - sigc::mem_fun(*this, &FileExportDialogImpl::fileNameEntryChangedCallback)); - } - - // Let's do more customization - std::vector<Gtk::Expander *> expanders; - findExpanderWidgets(cont, expanders); - // g_message("Found %d expander widgets\n", expanders.size()); - if (!expanders.empty()) { - // Always show the file list - Gtk::Expander *expander = expanders[0]; - expander->set_expanded(true); - } - - - // if (extension == NULL) - // checkbox.set_sensitive(FALSE); - - add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); - set_default(*add_button(_("_Save"), Gtk::RESPONSE_OK)); - - show_all_children(); -} - -/** - * Destructor - */ -FileExportDialogImpl::~FileExportDialogImpl() -{ -} - - - -/** - * Show this dialog modally. Return true if user hits [OK] - */ -bool FileExportDialogImpl::show() -{ - Glib::ustring s = Glib::filename_to_utf8(get_current_folder()); - if (s.length() == 0) { - s = getcwd(NULL, 0); - } - set_current_folder(Glib::filename_from_utf8(s)); // hack to force initial dir listing - set_modal(TRUE); // Window - sp_transientize(GTK_WIDGET(gobj())); // Make transient - gint b = run(); // Dialog - svgPreview.showNoPreview(); - hide(); - - if (b == Gtk::RESPONSE_OK) { - int sel = fileTypeComboBox.get_active_row_number(); - if (sel >= 0 && sel < (int)fileTypes.size()) { - FileType &type = fileTypes[sel]; - extension = type.extension; - } - myFilename = get_filename(); - - if (myFilename.empty()) { - myFilename = get_uri(); - } - - /* - - // FIXME: Why do we have more code - - append_extension = checkbox.get_active(); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/dialogs/save_export/append_extension", append_extension); - prefs->setBool("/dialogs/save_export/default", ( extension != NULL ? extension->get_id() : "" )); - */ - return true; - } else { - return false; - } -} - - -/** - * Get the file extension type that was selected by the user. Valid after an [OK] - */ -Inkscape::Extension::Extension *FileExportDialogImpl::getSelectionType() -{ - return extension; -} - - -/** - * Get the file name chosen by the user. Valid after an [OK] - */ -Glib::ustring FileExportDialogImpl::getFilename() -{ - return myFilename; -} - -#endif // NEW_EXPORT_DIALOG - - } // namespace Dialog } // namespace UI } // namespace Inkscape |
