From e0d9090420d2463a4a56ff75f4947a51481aff5b Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Mon, 13 Mar 2017 23:24:12 +0100 Subject: [PATCH 1/2] Changed "Processing profile operations -> Custom Profile Builder" to "Reset to default profile" The behaviour has changed slightly, so that clicking the menu item now resets to the default processing profile specified in the preferences. If this involves calling the custom profile builder, the behaviour is the same as before. But this is a bit more general, in that it might also simply reapply the static default profile, or regenerate the dynamic one (depending on the user's settings) --- rtdata/languages/default | 2 +- rtgui/filebrowser.cc | 8 ++++---- rtgui/filebrowser.h | 2 +- rtgui/thumbnail.cc | 13 +++++++++---- rtgui/thumbnail.h | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ec61230ff..9eba08b80 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -117,7 +117,7 @@ FILEBROWSER_DELETEDLGMSG;Are you sure you want to delete the selected %1 FILEBROWSER_DELETEDLGMSGINCLPROC;Are you sure you want to delete the selected %1 files including a queue-processed version? FILEBROWSER_EMPTYTRASH;Empty trash FILEBROWSER_EMPTYTRASHHINT;Permanently delete the files from trash. -FILEBROWSER_EXEC_CPB;Custom Profile Builder +FILEBROWSER_RESETDEFAULTPROFILE;Reset to default FILEBROWSER_EXTPROGMENU;Open with FILEBROWSER_FLATFIELD;Flat-Field FILEBROWSER_MOVETODARKFDIR;Move to dark-frames directory diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 5cbb5255b..3e8b2e7cf 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -340,7 +340,7 @@ FileBrowser::FileBrowser () p++; submenuProfileOperations->attach (*Gtk::manage(applypartprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE_PARTIAL"))), 0, 1, p, p + 1); p++; - submenuProfileOperations->attach (*Gtk::manage(execcustprof = new Gtk::MenuItem (M("FILEBROWSER_EXEC_CPB"))), 0, 1, p, p + 1); + submenuProfileOperations->attach (*Gtk::manage(resetdefaultprof = new Gtk::MenuItem (M("FILEBROWSER_RESETDEFAULTPROFILE"))), 0, 1, p, p + 1); p++; submenuProfileOperations->attach (*Gtk::manage(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p + 1); p++; @@ -358,7 +358,7 @@ FileBrowser::FileBrowser () p++; pmenu->attach (*Gtk::manage(applypartprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE_PARTIAL"))), 0, 1, p, p + 1); p++; - pmenu->attach (*Gtk::manage(execcustprof = new Gtk::MenuItem (M("FILEBROWSER_EXEC_CPB"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(resetdefaultprof = new Gtk::MenuItem (M("FILEBROWSER_RESETDEFAULTPROFILE"))), 0, 1, p, p + 1); p++; pmenu->attach (*Gtk::manage(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p + 1); p++; @@ -427,7 +427,7 @@ FileBrowser::FileBrowser () partpasteprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), partpasteprof)); applyprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), applyprof)); applypartprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), applypartprof)); - execcustprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), execcustprof)); + resetdefaultprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), resetdefaultprof)); clearprof->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), clearprof)); cachemenu->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), cachemenu)); @@ -960,7 +960,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) } queue_draw (); - } else if (m == execcustprof) { + } else if (m == resetdefaultprof) { if (!mselected.empty() && bppcl) { bppcl->beginBatchPParamsChange(mselected.size()); } diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index fdb08ba24..a7474d989 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -110,7 +110,7 @@ protected: Gtk::MenuItem* partpasteprof; Gtk::MenuItem* applyprof; Gtk::MenuItem* applypartprof; - Gtk::MenuItem* execcustprof; + Gtk::MenuItem* resetdefaultprof; Gtk::MenuItem* clearprof; Gtk::MenuItem* cachemenu; Gtk::MenuItem* clearFromCache; diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 62f543d4a..16f03761b 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -198,14 +198,13 @@ const ProcParams& Thumbnail::getProcParamsU () * The loaded profile may be partial, but it return a complete ProcParams (i.e. without ParamsEdited) * * @param returnParams Ask to return a pointer to a ProcParams object if true - * @param forceCPB True if the Custom Profile Builder has to be invoked, False if the CPB has to be invoked if the profile doesn't - * exist yet. It depends on other conditions too + * @param force True if the profile has to be re-generated even if it already exists * @param flaggingMode True if the ProcParams will be created because the file browser is being flagging an image * (rang, to trash, color labels). This parameter is passed to the CPB. * * @return Return a pointer to a ProcPamas structure to be updated if returnParams is true and if everything went fine, NULL otherwise. */ -rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool forceCPB, bool flaggingMode) +rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool force, bool flaggingMode) { static int index = 0; // Will act as unique identifier during the session @@ -217,7 +216,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu const CacheImageData* cfs = getCacheImageData(); Glib::ustring defaultPparamsPath = options.findProfilePath(defProf); - const bool create = (!hasProcParams() || forceCPB); + const bool create = (!hasProcParams() || force); const Glib::ustring outFName = (options.paramsLoadLocation == PLL_Input) ? @@ -239,6 +238,12 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu if (!err) { loadProcParams(); } + } else if (create && + defProf != DEFPROFILE_DYNAMIC && defProf != DEFPROFILE_INTERNAL){ + const PartialProfile *p = profileStore.getProfile(defProf); + if (p && !p->pparams->save(outFName)) { + loadProcParams(); + } } if (!options.CPBPath.empty() && !defaultPparamsPath.empty() && create && cfs && cfs->exifValid) { diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 8c7691ed2..e5b6a72b2 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -87,7 +87,7 @@ public: const rtengine::procparams::ProcParams& getProcParamsU (); // Unprotected version // Use this to create params on demand for update ; if flaggingMode=true, the procparams is created for a file being flagged (inTrash, rank, colorLabel) - rtengine::procparams::ProcParams* createProcParamsForUpdate (bool returnParams, bool forceCPB, bool flaggingMode = false); + rtengine::procparams::ProcParams* createProcParamsForUpdate (bool returnParams, bool force, bool flaggingMode = false); void setProcParams (const rtengine::procparams::ProcParams& pp, ParamsEdited* pe = nullptr, int whoChangedIt = -1, bool updateCacheNow = true); void clearProcParams (int whoClearedIt = -1); From fa433648cd9f5bc4078b530c994d43c22f021261 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 24 Mar 2017 14:52:31 +0100 Subject: [PATCH 2/2] make "Processing profiles -> Reset to default" work also when the default is "(Neutral)" --- rtgui/thumbnail.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 658721ebc..0bbefa298 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -238,8 +238,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu if (!err) { loadProcParams(); } - } else if (create && - defProf != DEFPROFILE_DYNAMIC && defProf != DEFPROFILE_INTERNAL){ + } else if (create && defProf != DEFPROFILE_DYNAMIC) { const PartialProfile *p = profileStore.getProfile(defProf); if (p && !p->pparams->save(outFName)) { loadProcParams();