Solving issue 1751: "When switching processing profiles, missing values should be taken from Neutral" ; also updates the French language file

This commit is contained in:
natureh 510
2013-04-08 22:23:10 +02:00
parent cdb71a3945
commit f76ccb6ac9
21 changed files with 1585 additions and 51 deletions

View File

@@ -398,6 +398,8 @@ void EditorPanel::rightPaneButtonReleased(GdkEventButton *event) {
}
void EditorPanel::writeOptions() {
if (profilep)
profilep->writeOptions();
if (tpc)
tpc->writeOptions();
}

View File

@@ -877,7 +877,7 @@ bool FileBrowser::keyPressed (GdkEventKey* event) {
void FileBrowser::applyMenuItemActivated (Glib::ustring ppname) {
rtengine::procparams::PartialProfile* partProfile = profileStore.getProfile (ppname);
const rtengine::procparams::PartialProfile* partProfile = profileStore.getProfile (ppname);
if (partProfile->pparams && !selected.empty()) {
for (size_t i=0; i<selected.size(); i++)
(static_cast<FileBrowserEntry*>(selected[i]))->thumbnail->setProcParams (*partProfile->pparams, partProfile->pedited, FILEBROWSER);
@@ -890,7 +890,7 @@ void FileBrowser::applyPartialMenuItemActivated (Glib::ustring ppname) {
if (!tbl || selected.empty())
return;
rtengine::procparams::PartialProfile* srcProfiles = profileStore.getProfile (ppname);
const rtengine::procparams::PartialProfile* srcProfiles = profileStore.getProfile (ppname);
if (srcProfiles->pparams) {
if (partialPasteDlg.run()==Gtk::RESPONSE_OK) {

View File

@@ -307,6 +307,8 @@ void Options::setDefaults () {
rgbDenoiseThreadLimit = 0;
filledProfile = false;
showProfileSelector = true;
FileBrowserToolbarSingleRow = false;
hideTPVScrollbar = false;
@@ -571,6 +573,7 @@ if (keyFile.has_group ("Profiles")) {
if (keyFile.has_key ("Profiles", "LoadSaveProfilePath")) loadSaveProfilePath = keyFile.get_string ("Profiles", "LoadSaveProfilePath");
if (keyFile.has_key ("Profiles", "RawDefault")) defProfRaw = keyFile.get_string ("Profiles", "RawDefault");
if (keyFile.has_key ("Profiles", "ImgDefault")) defProfImg = keyFile.get_string ("Profiles", "ImgDefault");
if (keyFile.has_key ("Profiles", "FilledProfile")) filledProfile = keyFile.get_boolean ("Profiles", "FilledProfile");
if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile");
if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache");
if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation");
@@ -869,6 +872,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_string ("Profiles", "LoadSaveProfilePath", loadSaveProfilePath);
keyFile.set_string ("Profiles", "RawDefault", defProfRaw);
keyFile.set_string ("Profiles", "ImgDefault", defProfImg);
keyFile.set_boolean ("Profiles", "FilledProfile", filledProfile);
keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile);
keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache);
keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation);

View File

@@ -108,8 +108,8 @@ class Options {
bool windowMaximized;
int dirBrowserWidth;
int dirBrowserHeight;
int preferencesWidth;
int preferencesHeight;
int preferencesWidth;
int preferencesHeight;
int lastScale;
int panAccelFactor;
int lastCropSize;
@@ -151,7 +151,7 @@ class Options {
Glib::ustring psDir;
Glib::ustring customEditorProg;
Glib::ustring customProfileBuilder;
int editorToSendTo;
int editorToSendTo;
int maxThumbnailHeight;
std::size_t maxCacheEntries;
ThFileType thumbnailFormat;
@@ -198,6 +198,8 @@ class Options {
// Performance options
int rgbDenoiseThreadLimit; // maximum number of threads for the denoising tool ; 0 = use the maximum available
bool filledProfile; // Used as reminder for the ProfilePanel "mode"
bool menuGroupRank;
bool menuGroupLabel;
bool menuGroupFileOperations;

View File

@@ -27,8 +27,6 @@
using namespace rtengine;
using namespace rtengine::procparams;
extern Glib::ustring argv0;
PartialPasteDlg* ProfilePanel::partialProfileDlg;
@@ -43,7 +41,15 @@ void ProfilePanel::cleanup () {
ProfilePanel::ProfilePanel (bool readOnly) : lastFilename(""), imagePath("") {
tpc = NULL;
profileFillModeOnImage = new RTImage("profile-filled.png");
profileFillModeOffImage = new RTImage("profile-partial.png");
fillMode = Gtk::manage (new Gtk::ToggleButton());
fillMode->set_active(options.filledProfile);
fillMode->add( options.filledProfile ? *profileFillModeOnImage : *profileFillModeOffImage );
fillMode->signal_toggled().connect ( sigc::mem_fun(*this, &ProfilePanel::profileFillModeToggled) );
fillMode->set_tooltip_text(M("PROFILEPANEL_MODE_TIP"));
profiles = Gtk::manage (new MyComboBoxText ());
Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox ());
hbox->show ();
@@ -60,6 +66,7 @@ ProfilePanel::ProfilePanel (bool readOnly) : lastFilename(""), imagePath("") {
paste = Gtk::manage (new Gtk::Button ());
paste->add (*Gtk::manage (new RTImage ("edit-paste.png")));
hbox->pack_start (*fillMode, Gtk::PACK_SHRINK, 1);
hbox->pack_start (*profiles);
hbox->pack_start (*load, Gtk::PACK_SHRINK, 1);
if (!readOnly) hbox->pack_start (*save, Gtk::PACK_SHRINK, 1);
@@ -93,6 +100,8 @@ ProfilePanel::~ProfilePanel () {
if (custom) { custom->deleteInstance(); delete custom; }
if (lastsaved) { lastsaved->deleteInstance(); delete lastsaved; }
delete profileFillModeOnImage;
delete profileFillModeOffImage;
}
void ProfilePanel::refreshProfileList () {
@@ -166,7 +175,7 @@ void ProfilePanel::save_clicked (GdkEventButton* event) {
lastFilename = Glib::path_get_basename (fname);
PartialProfile* toSave = NULL;
const PartialProfile* toSave;
if (profiles->get_active_text() == Glib::ustring("(") + M("PROFILEPANEL_PCUSTOM") + ")")
toSave = custom;
else if (profiles->get_active_text() == Glib::ustring("(") + M("PROFILEPANEL_PLASTSAVED") + ")")
@@ -221,7 +230,7 @@ void ProfilePanel::copy_clicked (GdkEventButton* event) {
if (event->button != 1)
return;
PartialProfile* toSave = NULL;
const PartialProfile* toSave;
if (profiles->get_active_text() == Glib::ustring("(") + M("PROFILEPANEL_PCUSTOM") + ")")
toSave = custom;
else if (profiles->get_active_text() == Glib::ustring("(") + M("PROFILEPANEL_PLASTSAVED") + ")")
@@ -379,7 +388,7 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) {
return;
}
void ProfilePanel::changeTo (PartialProfile* newpp, Glib::ustring profname) {
void ProfilePanel::changeTo (const PartialProfile* newpp, Glib::ustring profname) {
if (!newpp)
return;
@@ -398,9 +407,17 @@ void ProfilePanel::selection_changed () {
else if (profiles->get_active_text() == (entry = Glib::ustring("(") + M("PROFILEPANEL_PLASTSAVED") + ")"))
changeTo (lastsaved, entry);
else {
PartialProfile* s = profileStore.getProfile (profiles->get_active_text());
if (s)
changeTo (s, profiles->get_active_text());
const PartialProfile* s = profileStore.getProfile (profiles->get_active_text());
if (s) {
if (fillMode->get_active() && s->pedited) {
ParamsEdited pe;
pe.set(true);
PartialProfile s2(s->pparams, &pe, false);
changeTo (&s2, profiles->get_active_text()+"+");
}
else
changeTo (s, profiles->get_active_text());
}
}
old = profiles->get_active_text ();
dontupdate = false;
@@ -453,7 +470,7 @@ void ProfilePanel::initProfile (const Glib::ustring& profname, ProcParams* lastS
}
Glib::ustring defline = profname;
PartialProfile* defprofile = profileStore.getProfile (profname);
const PartialProfile* defprofile = profileStore.getProfile (profname);
if (lastsaved) {
defline = Glib::ustring("(") + M("PROFILEPANEL_PLASTSAVED") + ")";
@@ -475,18 +492,17 @@ void ProfilePanel::initProfile (const Glib::ustring& profname, ProcParams* lastS
tpc->profileChange (defprofile, EvPhotoLoaded, defline);
}
else {
bool dels = false;
// select first valid profile
old = "";
profiles->set_active (0);
PartialProfile* s = profileStore.getProfile (profiles->get_active_text());
const PartialProfile* s = profileStore.getProfile (profiles->get_active_text());
if (!s) {
changeconn.block (false);
s = new PartialProfile (true);
s->set(true);
dels = true; // we've created a temporary PartialProfile, so we set a flag to destroy it
PartialProfile s2(true);
s2.pedited->set(true);
if (tpc)
tpc->profileChange (s, EvPhotoLoaded, DEFPROFILE_INTERNAL);
tpc->profileChange (&s2, EvPhotoLoaded, DEFPROFILE_INTERNAL);
s2.deleteInstance();
}
else {
Glib::ustring cProfile = profiles->get_active_text();
@@ -494,11 +510,6 @@ void ProfilePanel::initProfile (const Glib::ustring& profname, ProcParams* lastS
if (tpc)
tpc->profileChange (s, EvPhotoLoaded, cProfile);
}
if (dels) {
s->deleteInstance();
delete s;
}
}
}
@@ -507,3 +518,18 @@ void ProfilePanel::setInitialFileName (const Glib::ustring& filename) {
imagePath = Glib::path_get_dirname(filename);
}
void ProfilePanel::profileFillModeToggled() {
if (fillMode->get_active()) {
// The button is pressed, we'll use the profileFillModeOnImage
fillMode->set_image(*profileFillModeOnImage);
}
else {
// The button is released, we'll use the profileFillModeOffImage
fillMode->set_image(*profileFillModeOffImage);
}
}
void ProfilePanel::writeOptions() {
options.filledProfile = fillMode->get_active();
}

View File

@@ -26,6 +26,7 @@
#include "profilechangelistener.h"
#include "partialpastedlg.h"
#include "guiutils.h"
#include "rtimage.h"
class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
@@ -33,6 +34,11 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
Glib::ustring lastFilename;
Glib::ustring imagePath;
RTImage *profileFillModeOnImage;
RTImage *profileFillModeOffImage;
Gtk::ToggleButton* fillMode;
void profileFillModeToggled();
protected:
@@ -50,7 +56,7 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
bool dontupdate;
sigc::connection changeconn;
void changeTo (rtengine::procparams::PartialProfile* newpp, Glib::ustring profname);
void changeTo (const rtengine::procparams::PartialProfile* newpp, Glib::ustring profname);
void refreshProfileList ();
public:
@@ -75,6 +81,7 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
void copy_clicked (GdkEventButton* event);
void paste_clicked (GdkEventButton* event);
void selection_changed ();
void writeOptions();
};
#endif

View File

@@ -143,7 +143,7 @@ void ProfileStore::parseDir (const Glib::ustring& pdir) {
}
}
PartialProfile* ProfileStore::getProfile (const Glib::ustring& profname) {
const PartialProfile* ProfileStore::getProfile (const Glib::ustring& profname) {
if (!init())
// I don't even know if this situation can occur
@@ -177,14 +177,14 @@ std::vector<Glib::ustring> ProfileStore::getProfileNames () {
* If the profile doesn't already exist in the profile list,
* it will add it with default internal values, so this method never fails
*/
ProcParams* ProfileStore::getDefaultProcParams (bool isRaw) {
const ProcParams* ProfileStore::getDefaultProcParams (bool isRaw) {
if (!init())
// I don't even know if this situation can occur
return NULL;
//Note: the mutex is locked in getProfile, called below
PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg);
const PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg);
// NOTE: pProf should not be NULL anymore, since init() should have created the default profiles already
return pProf->pparams;
}
@@ -194,14 +194,14 @@ ProcParams* ProfileStore::getDefaultProcParams (bool isRaw) {
* If it doesn't already exist in the profile list, it will add it with default internal values,
* so this method will never fails
*/
PartialProfile* ProfileStore::getDefaultPartialProfile (bool isRaw) {
const PartialProfile* ProfileStore::getDefaultPartialProfile (bool isRaw) {
if (!init())
// I don't even know if this situation can occur
return NULL;
//Note: the mutex is locked in getProfile, called below
PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg);
const PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg);
// NOTE: pProf should not be NULL anymore, since init() should have created the default profiles already
return pProf;
}

View File

@@ -46,10 +46,10 @@ class ProfileStore {
~ProfileStore();
bool init ();
void parseProfiles ();
rtengine::procparams::PartialProfile* getProfile (const Glib::ustring& profname);
std::vector<Glib::ustring> getProfileNames ();
rtengine::procparams::ProcParams* getDefaultProcParams (bool isRaw);
rtengine::procparams::PartialProfile* getDefaultPartialProfile (bool isRaw);
const rtengine::procparams::PartialProfile* getProfile (const Glib::ustring& profname);
std::vector<Glib::ustring> getProfileNames ();
const rtengine::procparams::ProcParams* getDefaultProcParams (bool isRaw);
const rtengine::procparams::PartialProfile* getDefaultPartialProfile (bool isRaw);
};
extern ProfileStore profileStore;

View File

@@ -233,7 +233,7 @@ void Thumbnail::loadProcParams () {
pparamsValid = false;
pparams.setDefaults();
PartialProfile *defaultPP = profileStore.getDefaultPartialProfile(getType()==FT_Raw);
const PartialProfile *defaultPP = profileStore.getDefaultPartialProfile(getType()==FT_Raw);
defaultPP->applyTo(&pparams);
if (options.paramsLoadLocation==PLL_Input) {