Merge branch 'lenscorrectiongui' into dev
This commit is contained in:
@@ -33,6 +33,7 @@ LensProfilePanel::LFDbHelper *LensProfilePanel::lf(nullptr);
|
||||
|
||||
LensProfilePanel::LensProfilePanel () :
|
||||
FoldableToolPanel(this, "lensprof", M("TP_LENSPROFILE_LABEL")),
|
||||
lcModeChanged(false),
|
||||
lcpFileChanged(false),
|
||||
useDistChanged(false),
|
||||
useVignChanged(false),
|
||||
@@ -122,10 +123,6 @@ LensProfilePanel::LensProfilePanel () :
|
||||
|
||||
hbLCPFile->pack_start(*fcbLCPFile);
|
||||
|
||||
btnReset = Gtk::manage(new Gtk::Button());
|
||||
btnReset->set_image (*Gtk::manage(new RTImage ("gtk-cancel.png")));
|
||||
hbLCPFile->pack_start(*btnReset, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
pack_start(*hbLCPFile, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
ckbUseDist = Gtk::manage (new Gtk::CheckButton (M("TP_LENSPROFILE_USEDIST")));
|
||||
@@ -136,7 +133,6 @@ LensProfilePanel::LensProfilePanel () :
|
||||
pack_start (*ckbUseCA, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
conLCPFile = fcbLCPFile->signal_file_set().connect( sigc::mem_fun(*this, &LensProfilePanel::onLCPFileChanged), true);
|
||||
btnReset->signal_clicked().connect( sigc::mem_fun(*this, &LensProfilePanel::onLCPFileReset), true);
|
||||
conUseDist = ckbUseDist->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseDistChanged) );
|
||||
ckbUseVign->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseVignChanged) );
|
||||
ckbUseCA->signal_toggled().connect( sigc::mem_fun(*this, &LensProfilePanel::onUseCAChanged) );
|
||||
@@ -163,32 +159,33 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
||||
}
|
||||
|
||||
corrLensfunAuto->set_sensitive(true);
|
||||
|
||||
if (pp->lensProf.useLensfun) {
|
||||
if (pp->lensProf.lfAutoMatch) {
|
||||
|
||||
switch(pp->lensProf.lcMode) {
|
||||
case procparams::LensProfParams::eLcMode::LC_LCP :
|
||||
corrLcpFile->set_active(true);
|
||||
break;
|
||||
case procparams::LensProfParams::eLcMode::LC_LENSFUNAUTOMATCH :
|
||||
corrLensfunAuto->set_active(true);
|
||||
} else {
|
||||
break;
|
||||
case procparams::LensProfParams::eLcMode::LC_LENSFUNMANUAL :
|
||||
corrLensfunManual->set_active(true);
|
||||
}
|
||||
} else if (!pp->lensProf.lcpFile.empty() && LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) {
|
||||
corrLcpFile->set_active(true);
|
||||
break;
|
||||
case procparams::LensProfParams::eLcMode::LC_NOCORRECTION :
|
||||
corrOff->set_active(true);
|
||||
}
|
||||
|
||||
if (pp->lensProf.lcpFile.empty()) {
|
||||
Glib::ustring lastFolder = fcbLCPFile->get_current_folder();
|
||||
fcbLCPFile->set_current_folder(lastFolder);
|
||||
fcbLCPFile->set_filename(lastFolder + "/.");
|
||||
bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir);
|
||||
updateDisabled(false);
|
||||
} else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) {
|
||||
fcbLCPFile->set_filename (pp->lensProf.lcpFile);
|
||||
updateDisabled(true);
|
||||
} else {
|
||||
Glib::ustring fname = fcbLCPFile->get_filename();
|
||||
|
||||
if (!pp->lensProf.lcpFile.empty()) {
|
||||
fcbLCPFile->unselect_filename(fname);
|
||||
} else {
|
||||
Glib::ustring lastFolder = fcbLCPFile->get_current_folder();
|
||||
fcbLCPFile->set_current_folder(lastFolder);
|
||||
fcbLCPFile->set_filename(lastFolder + "/.");
|
||||
bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir);
|
||||
}
|
||||
|
||||
fcbLCPFile->unselect_filename(fcbLCPFile->get_filename());
|
||||
updateDisabled(false);
|
||||
|
||||
corrOff->set_active(true);
|
||||
}
|
||||
|
||||
ckbUseDist->set_active (pp->lensProf.useDist);
|
||||
@@ -203,14 +200,14 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
||||
l = db->findLens(c, metadata->getLens());
|
||||
}
|
||||
|
||||
if (!setLensfunCamera(pp->lensProf.lfCameraMake, pp->lensProf.lfCameraModel) && pp->lensProf.lfAutoMatch) {
|
||||
if (!setLensfunCamera(pp->lensProf.lfCameraMake, pp->lensProf.lfCameraModel) && !pp->lensProf.lfManual()) {
|
||||
setLensfunCamera(c.getMake(), c.getModel());
|
||||
}
|
||||
if (!setLensfunLens(pp->lensProf.lfLens) && pp->lensProf.lfAutoMatch) {
|
||||
if (!setLensfunLens(pp->lensProf.lfLens) && !pp->lensProf.lfManual()) {
|
||||
setLensfunLens(l.getLens());
|
||||
}
|
||||
|
||||
lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false;
|
||||
lcModeChanged = lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false;
|
||||
useLensfunChanged = lensfunAutoChanged = lensfunCameraChanged = lensfunLensChanged = false;
|
||||
|
||||
if (!batchMode && !checkLensfunCanCorrect(true)) {
|
||||
@@ -276,7 +273,17 @@ void LensProfilePanel::setRawMeta(bool raw, const rtengine::ImageMetaData* pMeta
|
||||
|
||||
void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedited)
|
||||
{
|
||||
if (corrLcpFile->get_active() && LCPStore::getInstance()->isValidLCPFileName(fcbLCPFile->get_filename())) {
|
||||
if (corrLcpFile->get_active()) {
|
||||
pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LCP;
|
||||
} else if(corrLensfunManual->get_active()) {
|
||||
pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LENSFUNMANUAL;
|
||||
} else if(corrLensfunAuto->get_active()) {
|
||||
pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_LENSFUNAUTOMATCH;
|
||||
} else if(corrOff->get_active()) {
|
||||
pp->lensProf.lcMode = procparams::LensProfParams::eLcMode::LC_NOCORRECTION;
|
||||
}
|
||||
|
||||
if (LCPStore::getInstance()->isValidLCPFileName(fcbLCPFile->get_filename())) {
|
||||
pp->lensProf.lcpFile = fcbLCPFile->get_filename();
|
||||
} else {
|
||||
pp->lensProf.lcpFile = "";
|
||||
@@ -286,8 +293,6 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited
|
||||
pp->lensProf.useVign = ckbUseVign->get_active();
|
||||
pp->lensProf.useCA = ckbUseCA->get_active();
|
||||
|
||||
pp->lensProf.useLensfun = corrLensfunAuto->get_active() || corrLensfunManual->get_active();
|
||||
pp->lensProf.lfAutoMatch = corrLensfunAuto->get_active();
|
||||
auto itc = lensfunCameras->get_active();
|
||||
if (itc) {
|
||||
pp->lensProf.lfCameraMake = (*itc)[lf->lensfunModelCam.make];
|
||||
@@ -304,6 +309,7 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited
|
||||
}
|
||||
|
||||
if (pedited) {
|
||||
pedited->lensProf.lcMode = lcModeChanged;
|
||||
pedited->lensProf.lcpFile = lcpFileChanged;
|
||||
pedited->lensProf.useDist = useDistChanged;
|
||||
pedited->lensProf.useVign = useVignChanged;
|
||||
@@ -332,22 +338,6 @@ void LensProfilePanel::onLCPFileChanged()
|
||||
}
|
||||
}
|
||||
|
||||
void LensProfilePanel::onLCPFileReset()
|
||||
{
|
||||
lcpFileChanged = true;
|
||||
|
||||
fcbLCPFile->unselect_filename(fcbLCPFile->get_filename());
|
||||
updateDisabled(false);
|
||||
|
||||
|
||||
if (listener) {
|
||||
disableListener();
|
||||
corrOff->set_active(true);
|
||||
enableListener();
|
||||
listener->panelChanged (EvLCPFile, M("GENERAL_NONE"));
|
||||
}
|
||||
}
|
||||
|
||||
void LensProfilePanel::onUseDistChanged()
|
||||
{
|
||||
useDistChanged = true;
|
||||
@@ -563,7 +553,7 @@ void LensProfilePanel::onCorrModeChanged()
|
||||
|
||||
mode = M("GENERAL_UNCHANGED");
|
||||
}
|
||||
|
||||
lcModeChanged = true;
|
||||
updateLensfunWarning();
|
||||
|
||||
if (listener) {
|
||||
@@ -579,7 +569,6 @@ bool LensProfilePanel::checkLensfunCanCorrect(bool automatch)
|
||||
}
|
||||
rtengine::procparams::ProcParams lpp;
|
||||
write(&lpp);
|
||||
lpp.lensProf.lfAutoMatch = automatch;
|
||||
std::unique_ptr<LFModifier> mod(LFDatabase::findModifier(lpp.lensProf, metadata, 100, 100, lpp.coarse, -1));
|
||||
return mod.get() != nullptr;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,8 @@ protected:
|
||||
MyFileChooserButton *fcbLCPFile;
|
||||
Gtk::CheckButton *ckbUseDist, *ckbUseVign, *ckbUseCA;
|
||||
Gtk::HBox *hbLCPFile;
|
||||
Gtk::Button *btnReset;
|
||||
Gtk::Label *lLCPFileHead;
|
||||
bool lcpFileChanged, useDistChanged, useVignChanged, useCAChanged;
|
||||
bool lcModeChanged, lcpFileChanged, useDistChanged, useVignChanged, useCAChanged;
|
||||
sigc::connection conLCPFile, conUseDist, conUseVign, conUseCA;
|
||||
void updateDisabled(bool enable);
|
||||
bool allowFocusDep;
|
||||
@@ -98,7 +97,6 @@ public:
|
||||
void setRawMeta (bool raw, const rtengine::ImageMetaData* pMeta);
|
||||
|
||||
void onLCPFileChanged ();
|
||||
void onLCPFileReset ();
|
||||
void onUseDistChanged();
|
||||
void onUseVignChanged();
|
||||
void onUseCAChanged();
|
||||
|
||||
@@ -287,6 +287,7 @@ void ParamsEdited::set (bool v)
|
||||
commonTrans.autofill = v;
|
||||
rotate.degree = v;
|
||||
distortion.amount = v;
|
||||
lensProf.lcMode = v;
|
||||
lensProf.lcpFile = v;
|
||||
lensProf.useDist = v;
|
||||
lensProf.useVign = v;
|
||||
@@ -826,12 +827,13 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
|
||||
commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill;
|
||||
rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree;
|
||||
distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount;
|
||||
lensProf.lcMode = lensProf.lcMode && p.lensProf.lcMode == other.lensProf.lcMode;
|
||||
lensProf.lcpFile = lensProf.lcpFile && p.lensProf.lcpFile == other.lensProf.lcpFile;
|
||||
lensProf.useDist = lensProf.useDist && p.lensProf.useDist == other.lensProf.useDist;
|
||||
lensProf.useVign = lensProf.useVign && p.lensProf.useVign == other.lensProf.useVign;
|
||||
lensProf.useCA = lensProf.useCA && p.lensProf.useCA == other.lensProf.useCA;
|
||||
lensProf.useLensfun = lensProf.useLensfun && p.lensProf.useLensfun == other.lensProf.useLensfun;
|
||||
lensProf.lfAutoMatch = lensProf.lfAutoMatch && p.lensProf.lfAutoMatch == other.lensProf.lfAutoMatch;
|
||||
lensProf.useLensfun = lensProf.useLensfun && p.lensProf.useLensfun() == other.lensProf.useLensfun();
|
||||
lensProf.lfAutoMatch = lensProf.lfAutoMatch && p.lensProf.lfAutoMatch() == other.lensProf.lfAutoMatch();
|
||||
lensProf.lfCameraMake = lensProf.lfCameraMake && p.lensProf.lfCameraMake == other.lensProf.lfCameraMake;
|
||||
lensProf.lfCameraModel = lensProf.lfCameraModel && p.lensProf.lfCameraModel == other.lensProf.lfCameraModel;
|
||||
lensProf.lfLens = lensProf.lfLens && p.lensProf.lfLens == other.lensProf.lfLens;
|
||||
@@ -2062,6 +2064,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
toEdit.distortion.amount = dontforceSet && options.baBehav[ADDSET_DIST_AMOUNT] ? toEdit.distortion.amount + mods.distortion.amount : mods.distortion.amount;
|
||||
}
|
||||
|
||||
if (lensProf.lcMode) {
|
||||
toEdit.lensProf.lcMode = mods.lensProf.lcMode;
|
||||
}
|
||||
|
||||
if (lensProf.lcpFile) {
|
||||
toEdit.lensProf.lcpFile = mods.lensProf.lcpFile;
|
||||
}
|
||||
@@ -2078,14 +2084,6 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
|
||||
toEdit.lensProf.useCA = mods.lensProf.useCA;
|
||||
}
|
||||
|
||||
if (lensProf.useLensfun) {
|
||||
toEdit.lensProf.useLensfun = mods.lensProf.useLensfun;
|
||||
}
|
||||
|
||||
if (lensProf.lfAutoMatch) {
|
||||
toEdit.lensProf.lfAutoMatch = mods.lensProf.lfAutoMatch;
|
||||
}
|
||||
|
||||
if (lensProf.lfCameraMake) {
|
||||
toEdit.lensProf.lfCameraMake = mods.lensProf.lfCameraMake;
|
||||
}
|
||||
@@ -3053,7 +3051,7 @@ bool RAWParamsEdited::isUnchanged() const
|
||||
|
||||
bool LensProfParamsEdited::isUnchanged() const
|
||||
{
|
||||
return lcpFile && useVign && lfLens;
|
||||
return lcMode && lcpFile && useVign && lfLens;
|
||||
}
|
||||
|
||||
bool RetinexParamsEdited::isUnchanged() const
|
||||
|
||||
@@ -429,6 +429,7 @@ class LensProfParamsEdited
|
||||
public:
|
||||
bool lcpFile, useDist, useVign, useCA;
|
||||
bool useLensfun, lfAutoMatch, lfCameraMake, lfCameraModel, lfLens;
|
||||
bool lcMode;
|
||||
|
||||
bool isUnchanged() const;
|
||||
};
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
#define _PPVERSION_
|
||||
|
||||
// This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes
|
||||
#define PPVERSION 326
|
||||
#define PPVERSION 327
|
||||
#define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified
|
||||
|
||||
/*
|
||||
Log of version changes
|
||||
327 2017-09-15
|
||||
[Profiles Lens Correction] Added Lensfun
|
||||
326 2015-07-26
|
||||
[Exposure] Added 'Perceptual' tone curve mode
|
||||
325 2015-07-23
|
||||
|
||||
Reference in New Issue
Block a user