From 5a08feee4899a8e7d9c8b1aaff47491201c35511 Mon Sep 17 00:00:00 2001 From: Oliver Duis Date: Fri, 26 Aug 2011 09:42:01 +0200 Subject: [PATCH] Custom profiler builder in partial pastes and context menu see issue 941 --- rtdata/languages/Deutsch | 3 ++- rtdata/languages/default | 1 + rtgui/editorpanel.cc | 2 +- rtgui/filebrowser.cc | 21 +++++++++++++++++---- rtgui/filebrowser.h | 1 + rtgui/thumbnail.cc | 8 ++++---- rtgui/thumbnail.h | 2 +- 7 files changed, 27 insertions(+), 11 deletions(-) diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index 92eb835d2..175da7501 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -1,4 +1,3 @@ - #00 Deutsch #01 (keenonkites; Aktualisierte Version für 2.3 beta2) #02 (phberlin; basiert auf keenonkites' Erstübersetzung) @@ -16,6 +15,7 @@ #14 05.12.2010, 3.0 alpha: Erweiterung und Korrekturen (Metex) #15 Jan-Jul 2011: Erweiterungen und Korrekturen (MaWe). Letzter Stand: 26.07.2011 #16 Erweiterung (oduis) +#17 Erweiterung (oduis) ABOUT_TAB_BUILD;Version ABOUT_TAB_CREDITS;Danksagungen ABOUT_TAB_LICENSE;Lizenz @@ -87,6 +87,7 @@ FILEBROWSER_DELETEDLGLABEL;Dateien löschen FILEBROWSER_DELETEDLGMSG;Möchten Sie wirklich %1 Datei(en) unwiderruflich löschen? FILEBROWSER_DELETEDLGMSGINCLPROC;Möchten Sie wirklich %1 Datei(en) unwiderruflich löschen, SAMT evtl. zugehörigen, aus der Stapelverarbeitung resultierenden Ausgabedateien? FILEBROWSER_EMPTYTRASH;Papierkorb leeren +FILEBROWSER_EXEC_CPB;Benutzerdef. Bildprofilgenerator ausführen FILEBROWSER_EMPTYTRASHHINT;Dateien endgültig aus Papierkorb löschen FILEBROWSER_EXIFFILTERAPPLY;Anwenden FILEBROWSER_EXIFFILTERAPPLYHINT;Ein-/Ausschalten des Exif Filters im Datei-Browser diff --git a/rtdata/languages/default b/rtdata/languages/default index ec3768bfd..7c761a8de 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -75,6 +75,7 @@ FILEBROWSER_DELETEDLGMSG;Are you sure you want to delete the selected %1 files? 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 of the trash +FILEBROWSER_EXEC_CPB;Run custom profile builder FILEBROWSER_EXIFFILTERAPPLY;Apply FILEBROWSER_EXIFFILTERAPPLYHINT;Switch on/off exif filter of the file browser FILEBROWSER_EXIFFILTERLABEL;Exif Filter diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 2aac8aafd..36a21b80d 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -397,7 +397,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { is->setProgressListener( this ); // try to load the last saved parameters from the cache or from the paramfile file - ProcParams* ldprof = openThm->createProcParamsForUpdate(); // will be freed by initProfile + ProcParams* ldprof = openThm->createProcParamsForUpdate(true,false); // will be freed by initProfile // initialize profile Glib::ustring defProf = openThm->getType()==FT_Raw ? options.defProfRaw : options.defProfImg; diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 3e374be8a..2ed5c318b 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -147,6 +147,7 @@ FileBrowser::FileBrowser () submenuProfileOperations->attach (*Gtk::manage(partpasteprof = new Gtk::MenuItem (M("FILEBROWSER_PARTIALPASTEPROFILE"))), 0, 1, p, p+1); p++; submenuProfileOperations->attach (*Gtk::manage(applyprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE"))), 0, 1, p, p+1); 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); p++; submenuProfileOperations->attach (*Gtk::manage(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p+1); p++; submenuProfileOperations->show_all (); @@ -158,6 +159,7 @@ FileBrowser::FileBrowser () pmenu->attach (*Gtk::manage(partpasteprof = new Gtk::MenuItem (M("FILEBROWSER_PARTIALPASTEPROFILE"))), 0, 1, p, p+1); p++; pmenu->attach (*Gtk::manage(applyprof = new Gtk::MenuItem (M("FILEBROWSER_APPLYPROFILE"))), 0, 1, p, p+1); 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); p++; pmenu->attach (*Gtk::manage(clearprof = new Gtk::MenuItem (M("FILEBROWSER_CLEARPROFILE"))), 0, 1, p, p+1); p++; } @@ -204,6 +206,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)); 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)); } @@ -588,8 +591,15 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) { for (int i=0; ithumbnail->clearProcParams (FILEBROWSER); queue_draw (); + } else if (m==execcustprof) { + for (int i=0; ithumbnail->createProcParamsForUpdate (false, true); + + // Empty run to update the thumb + rtengine::procparams::ProcParams params = mselected[i]->thumbnail->getProcParams (); + mselected[i]->thumbnail->setProcParams (params, FILEBROWSER); } - else if (m==clearFromCache) { + } else if (m==clearFromCache) { for (int i=0; iclearFromCacheRequested (mselected, false); //queue_draw (); @@ -634,6 +644,7 @@ void FileBrowser::partPasteProfile () { if (partialPasteDlg.run ()) { for (int i=0; ithumbnail->createProcParamsForUpdate(false,false); // this can execute customprofilebuilder to generate param file rtengine::procparams::ProcParams params = mselected[i]->thumbnail->getProcParams (); partialPasteDlg.applyPaste (¶ms, &clipboard.getProcParams()); mselected[i]->thumbnail->setProcParams (params, FILEBROWSER); @@ -726,6 +737,8 @@ void FileBrowser::applyPartialMenuItemActivated (Glib::ustring ppname) { if (partialPasteDlg.run ()) { for (int i=0; ithumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file + rtengine::procparams::ProcParams params = ((FileBrowserEntry*)selected[i])->thumbnail->getProcParams (); partialPasteDlg.applyPaste (¶ms, pparams); ((FileBrowserEntry*)selected[i])->thumbnail->setProcParams (params, FILEBROWSER); @@ -825,7 +838,7 @@ void FileBrowser::toTrashRequested (std::vector tbe) { for (int i=0; ithumbnail->createProcParamsForUpdate(); // this can execute customprofilebuilder to generate param file + tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file // no need to notify listeners as item goes to trash, likely to be deleted @@ -866,7 +879,7 @@ void FileBrowser::rankingRequested (std::vector tbe, int rank for (int i=0; ithumbnail->createProcParamsForUpdate(); // this can execute customprofilebuilder to generate param file + tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file // notify listeners TODO: should do this ONLY when params changed by customprofilebuilder? tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER); @@ -885,7 +898,7 @@ void FileBrowser::colorlabelRequested (std::vector tbe, int c for (int i=0; ithumbnail->createProcParamsForUpdate(); // this can execute customprofilebuilder to generate param file + tbe[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file // notify listeners TODO: should do this ONLY when params changed by customprofilebuilder? tbe[i]->thumbnail->notifylisterners_procParamsChanged(FILEBROWSER); diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index 57abad04e..bdaa8c1ed 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -87,6 +87,7 @@ class FileBrowser : public ThumbBrowserBase, public LWButtonListener { Gtk::MenuItem* partpasteprof; Gtk::MenuItem* applyprof; Gtk::MenuItem* applypartprof; + Gtk::MenuItem* execcustprof; Gtk::MenuItem* clearprof; Gtk::MenuItem* cachemenu; Gtk::MenuItem* clearFromCache; diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index ccfec3ae8..584817759 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -47,7 +47,7 @@ Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageDa // rank and inTrash were found in cache (old style), move them over to pparams // try to load the last saved parameters from the cache or from the paramfile file - createProcParamsForUpdate(); // this can execute customprofilebuilder to generate param file + createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file // TODO? should we call notifylisterners_procParamsChanged here? @@ -175,14 +175,14 @@ const ProcParams& Thumbnail::getProcParams () { } // Create default params on demand and returns a new updatable object -rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate() { +rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool returnParams, bool forceCPB) { // try to load the last saved parameters from the cache or from the paramfile file ProcParams* ldprof = NULL; Glib::ustring defProf = getType()==FT_Raw ? options.defProfRaw : options.defProfImg; const CacheImageData* cfs=getCacheImageData(); - if (!options.customProfileBuilder.empty() && !hasProcParams() && cfs && cfs->exifValid) { + if (!options.customProfileBuilder.empty() && (!hasProcParams() || forceCPB) && cfs && cfs->exifValid) { // For the filename etc. do NOT use streams, since they are not UTF8 safe Glib::ustring cmdLine=Glib::ustring("\"") + options.customProfileBuilder + Glib::ustring("\" \"") + fname + Glib::ustring("\" \"") + options.rtdir + Glib::ustring("/") + options.profilePath + Glib::ustring("/") + defProf + Glib::ustring(".pp3") + Glib::ustring("\" "); @@ -199,7 +199,7 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate() { if (success) loadProcParams(); } - if (hasProcParams()) { + if (returnParams && hasProcParams()) { ldprof = new ProcParams (); *ldprof = getProcParams (); } diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index 44ebb44bc..6d7992296 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -84,7 +84,7 @@ class Thumbnail { const rtengine::procparams::ProcParams& getProcParams (); // Use this to create params on demand for update - rtengine::procparams::ProcParams* createProcParamsForUpdate (); + rtengine::procparams::ProcParams* createProcParamsForUpdate (bool returnParams, bool forceCPB); void setProcParams (const rtengine::procparams::ProcParams& pp, int whoChangedIt=-1, bool updateCacheNow=true); void clearProcParams (int whoClearedIt=-1);