From 0c7475c4df0c82543a363e513891f46710f0e59f Mon Sep 17 00:00:00 2001 From: natureh 510 Date: Mon, 4 Feb 2013 00:36:56 +0100 Subject: [PATCH] Solving issue 1690: "ver 4.09.50 unable to save processing profiles". There is now 2 new shortcut places when loading/saving a profile, and 1 new place when "saving as.." an image in the dialog box. --- rtgui/editorpanel.cc | 4 ++-- rtgui/options.cc | 2 ++ rtgui/profilepanel.cc | 17 +++++++++++++++-- rtgui/profilepanel.h | 3 ++- rtgui/saveasdlg.cc | 6 ++++++ rtgui/saveasdlg.h | 1 + 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index e3dc326bf..833502d0c 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -392,7 +392,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { openThm->increaseRef (); fname=openThm->getFileName(); - //saveAsDialog->setInitialFileName (removeExtension (Glib::path_get_basename (fname))); lastSaveAsFileName = removeExtension (Glib::path_get_basename (fname)); previewHandler = new PreviewHandler (); @@ -420,7 +419,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { // initialize profile Glib::ustring defProf = openThm->getType()==FT_Raw ? options.defProfRaw : options.defProfImg; profilep->initProfile (defProf, ldprof); - profilep->setInitialFileName (Glib::path_get_basename (fname) + paramFileExtension); + profilep->setInitialFileName (fname); openThm->addThumbnailListener (this); info_toggled (); @@ -1064,6 +1063,7 @@ void EditorPanel::saveAsPressed () { saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight); saveAsDialog->setInitialFileName (lastSaveAsFileName); + saveAsDialog->setImagePath (fname); do { int result = saveAsDialog->run (); diff --git a/rtgui/options.cc b/rtgui/options.cc index 48b67fa69..1c3a13a71 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -157,6 +157,8 @@ void Options::updatePaths() { lastProfilingReferenceDir = preferredPath; if (lastVibranceCurvesDir.empty() || !safe_file_test (lastVibranceCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastVibranceCurvesDir, Glib::FILE_TEST_IS_DIR)) lastVibranceCurvesDir = preferredPath; + if (loadSaveProfilePath.empty() || !safe_file_test (loadSaveProfilePath, Glib::FILE_TEST_EXISTS) || !safe_file_test (loadSaveProfilePath, Glib::FILE_TEST_IS_DIR)) + loadSaveProfilePath = preferredPath; } Glib::ustring Options::getPreferredProfilePath() { diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index de02e9ae2..182fc8f9a 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -40,7 +40,7 @@ void ProfilePanel::cleanup () { delete partialProfileDlg; } -ProfilePanel::ProfilePanel (bool readOnly) : lastFilename("") { +ProfilePanel::ProfilePanel (bool readOnly) : lastFilename(""), imagePath("") { tpc = NULL; @@ -128,6 +128,11 @@ void ProfilePanel::save_clicked (GdkEventButton* event) { FileChooserLastFolderPersister persister( &dialog, options.loadSaveProfilePath ); dialog.set_current_name (lastFilename); + //Add the user's default (or global if multiuser=false) profile path to the Shortcut list + dialog.add_shortcut_folder(options.getPreferredProfilePath()); + //Add the image's path to the Shortcut list + dialog.add_shortcut_folder(imagePath); + //Add response buttons the the dialog: dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::StockID("gtk-save"), Gtk::RESPONSE_OK); @@ -245,6 +250,11 @@ void ProfilePanel::load_clicked (GdkEventButton* event) { Gtk::FileChooserDialog dialog(M("PROFILEPANEL_LOADDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN); FileChooserLastFolderPersister persister( &dialog, options.loadSaveProfilePath ); + //Add the user's default (or global if multiuser=false) profile path to the Shortcut list + dialog.add_shortcut_folder(options.getPreferredProfilePath()); + //Add the image's path to the Shortcut list + dialog.add_shortcut_folder(imagePath); + //Add response buttons the the dialog: dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::StockID("gtk-open"), Gtk::RESPONSE_OK); @@ -480,5 +490,8 @@ void ProfilePanel::initProfile (const Glib::ustring& profname, ProcParams* lastS } } - +void ProfilePanel::setInitialFileName (const Glib::ustring& filename) { + lastFilename = Glib::path_get_basename(filename) + paramFileExtension; + imagePath = Glib::path_get_dirname(filename); +} diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index e2bf6cd9c..dab365c18 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -32,6 +32,7 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener { private: Glib::ustring lastFilename; + Glib::ustring imagePath; protected: @@ -63,7 +64,7 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener { static void cleanup (); void initProfile (const Glib::ustring& profname, rtengine::procparams::ProcParams* lastSaved); - void setInitialFileName (const Glib::ustring& filename) {lastFilename = filename;} + void setInitialFileName (const Glib::ustring& filename); // PParamsChangeListener interface void procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited=NULL); diff --git a/rtgui/saveasdlg.cc b/rtgui/saveasdlg.cc index e5eccb67a..679814749 100644 --- a/rtgui/saveasdlg.cc +++ b/rtgui/saveasdlg.cc @@ -219,3 +219,9 @@ void SaveAsDialog::setInitialFileName (Glib::ustring fname) { fchooser->set_current_name(fname); } + +void SaveAsDialog::setImagePath (Glib::ustring ipath) { + + //Add the image's path to the Shortcut list + fchooser->add_shortcut_folder(Glib::path_get_dirname(ipath)); +} diff --git a/rtgui/saveasdlg.h b/rtgui/saveasdlg.h index 1570a95ab..a32e1cef9 100644 --- a/rtgui/saveasdlg.h +++ b/rtgui/saveasdlg.h @@ -52,6 +52,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener { int getSaveMethodNum (); void setInitialFileName (Glib::ustring iname); + void setImagePath (Glib::ustring ipath); void okPressed (); void cancelPressed ();