summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2009-08-07 09:31:39 +0000
committercilix42 <cilix42@users.sourceforge.net>2009-08-07 09:31:39 +0000
commitc5b0b577134ed7c2df538ed019a6c07cb75bf38e (patch)
treef3dc9f3582bc21808ab86d1e8c59d45492df6c41 /src/ui
parentFix buglet: In the Save dialog the file extension should be automatically upd... (diff)
downloadinkscape-c5b0b577134ed7c2df538ed019a6c07cb75bf38e.tar.gz
inkscape-c5b0b577134ed7c2df538ed019a6c07cb75bf38e.zip
Store last used paths separately for the 'Save as ...' and 'Save a copy ...' dialogs and remember the last used file types in each case (closes LP #184655 and perhaps others; LP #386292 was fixed by the previous commit).
(bzr r8432)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/filedialog.cpp13
-rw-r--r--src/ui/dialog/filedialog.h3
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp30
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.h16
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp5
-rw-r--r--src/ui/dialog/filedialogimpl-win32.h7
6 files changed, 49 insertions, 25 deletions
diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp
index 172edf8a5..b1385195f 100644
--- a/src/ui/dialog/filedialog.cpp
+++ b/src/ui/dialog/filedialog.cpp
@@ -105,16 +105,17 @@ Glib::ustring FileOpenDialog::getFilename()
* Public factory method. Used in file.cpp
*/
FileSaveDialog *FileSaveDialog::create(Gtk::Window& parentWindow,
- const Glib::ustring &path,
+ const Glib::ustring &path,
FileDialogType fileTypes,
const char *title,
const Glib::ustring &default_key,
- const gchar *docTitle)
+ const gchar *docTitle,
+ const bool save_copy)
{
#ifdef WIN32
- FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle);
+ FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy);
#else
- FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle);
+ FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy);
#endif
return dialog;
}
@@ -168,8 +169,8 @@ void FileSaveDialog::appendExtension(Glib::ustring& path, Inkscape::Extension::O
/**
* Public factory method. Used in file.cpp
*/
- FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow,
- const Glib::ustring &path,
+FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow,
+ const Glib::ustring &path,
FileDialogType fileTypes,
const char *title,
const Glib::ustring &default_key)
diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h
index 52dcd1b23..6eab75a5b 100644
--- a/src/ui/dialog/filedialog.h
+++ b/src/ui/dialog/filedialog.h
@@ -163,7 +163,8 @@ public:
FileDialogType fileTypes,
const char *title,
const Glib::ustring &default_key,
- const gchar *docTitle);
+ const gchar *docTitle,
+ const bool save_copy);
/**
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 749a67b28..53faa075a 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -883,8 +883,10 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow,
FileDialogType fileTypes,
const Glib::ustring &title,
const Glib::ustring &/*default_key*/,
- const gchar* docTitle) :
- FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "/dialogs/save_as")
+ const gchar* docTitle,
+ const bool save_copy) :
+ FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, save_copy ? "/dialogs/save_copy" : "/dialogs/save_as"),
+ is_copy(save_copy)
{
FileSaveDialog::myDocTitle = docTitle;
@@ -922,7 +924,11 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow,
//###### Do we want the .xxx extension automatically added?
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically")));
- fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true));
+ if (save_copy) {
+ fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_copy/append_extension", true));
+ } else {
+ fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true));
+ }
createFileTypeMenu();
fileTypeComboBox.set_size_request(200,40);
@@ -1109,10 +1115,18 @@ FileSaveDialogImplGtk::show()
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
// Store changes of the "Append filename automatically" checkbox back to preferences.
- prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active());
+ if (is_copy) {
+ prefs->setBool("/dialogs/save_copy/append_extension", fileTypeCheckbox.get_active());
+ } else {
+ prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active());
+ }
// Store the last used save-as filetype to preferences.
- prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" ));
+ if (is_copy) {
+ prefs->setString("/dialogs/save_copy/default", ( extension != NULL ? extension->get_id() : "" ));
+ } else {
+ prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" ));
+ }
cleanup( true );
@@ -1356,7 +1370,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow,
destDPISpinner("DPI", _("Resolution (dots per inch)"))
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- append_extension = prefs->getBool("/dialogs/save_as/append_extension", true);
+ append_extension = prefs->getBool("/dialogs/save_export/append_extension", true);
/* One file at a time */
set_select_multiple(false);
@@ -1566,8 +1580,8 @@ FileExportDialogImpl::show()
append_extension = checkbox.get_active();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool("/dialogs/save_as/append_extension", append_extension);
- prefs->setBool("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" ));
+ prefs->setBool("/dialogs/save_export/append_extension", append_extension);
+ prefs->setBool("/dialogs/save_export/default", ( extension != NULL ? extension->get_id() : "" ));
*/
return TRUE;
}
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h
index 90dddce59..2a37aed2b 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.h
+++ b/src/ui/dialog/filedialogimpl-gtkmm.h
@@ -281,11 +281,12 @@ class FileSaveDialogImplGtk : public FileSaveDialog, public FileDialogBaseGtk
public:
FileSaveDialogImplGtk(Gtk::Window &parentWindow,
- const Glib::ustring &dir,
- FileDialogType fileTypes,
- const Glib::ustring &title,
- const Glib::ustring &default_key,
- const gchar* docTitle);
+ const Glib::ustring &dir,
+ FileDialogType fileTypes,
+ const Glib::ustring &title,
+ const Glib::ustring &default_key,
+ const gchar* docTitle,
+ const bool save_copy);
virtual ~FileSaveDialogImplGtk();
@@ -302,6 +303,11 @@ private:
void updateNameAndExtension();
/**
+ * Whether the dialog was invoked by "Save as ..." or "Save a copy ..."
+ */
+ bool is_copy;
+
+ /**
* Fix to allow the user to type the file name
*/
Gtk::Entry *fileNameEntry;
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 0d8f0de5f..c703d3c75 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -1497,8 +1497,9 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent,
FileDialogType fileTypes,
const char *title,
const Glib::ustring &/*default_key*/,
- const char *docTitle) :
- FileDialogBaseWin32(parent, dir, title, fileTypes, "dialogs.save_as"),
+ const char *docTitle,
+ const bool save_copy) :
+ FileDialogBaseWin32(parent, dir, title, fileTypes, save_copy ? "dialogs.save_copy" : "dialogs.save_as"),
_title_label(NULL),
_title_edit(NULL)
{
diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h
index bb026169a..f75133fe3 100644
--- a/src/ui/dialog/filedialogimpl-win32.h
+++ b/src/ui/dialog/filedialogimpl-win32.h
@@ -120,9 +120,10 @@ public:
/// @param title The title caption for the dialog in UTF-8
/// @param type The dialog type
FileOpenDialogImplWin32(Gtk::Window &parent,
- const Glib::ustring &dir,
- FileDialogType fileTypes,
- const char *title);
+ const Glib::ustring &dir,
+ FileDialogType fileTypes,
+ const char *title,
+ const bool save_copy);
/// Destructor
virtual ~FileOpenDialogImplWin32();