Formatted lensprofile.*
This commit is contained in:
@@ -119,6 +119,7 @@ LensProfilePanel::LensProfilePanel () :
|
|||||||
} else if (!options.lastLensProfileDir.empty()) {
|
} else if (!options.lastLensProfileDir.empty()) {
|
||||||
fcbLCPFile->set_current_folder(options.lastLensProfileDir);
|
fcbLCPFile->set_current_folder(options.lastLensProfileDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir);
|
bindCurrentFolder(*fcbLCPFile, options.lastLensProfileDir);
|
||||||
|
|
||||||
hbLCPFile->pack_start(*fcbLCPFile);
|
hbLCPFile->pack_start(*fcbLCPFile);
|
||||||
@@ -164,12 +165,15 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
case procparams::LensProfParams::LcMode::LCP :
|
case procparams::LensProfParams::LcMode::LCP :
|
||||||
corrLcpFile->set_active(true);
|
corrLcpFile->set_active(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case procparams::LensProfParams::LcMode::LENSFUNAUTOMATCH :
|
case procparams::LensProfParams::LcMode::LENSFUNAUTOMATCH :
|
||||||
corrLensfunAuto->set_active(true);
|
corrLensfunAuto->set_active(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case procparams::LensProfParams::LcMode::LENSFUNMANUAL :
|
case procparams::LensProfParams::LcMode::LENSFUNMANUAL :
|
||||||
corrLensfunManual->set_active(true);
|
corrLensfunManual->set_active(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case procparams::LensProfParams::LcMode::NONE :
|
case procparams::LensProfParams::LcMode::NONE :
|
||||||
corrOff->set_active(true);
|
corrOff->set_active(true);
|
||||||
}
|
}
|
||||||
@@ -182,6 +186,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
updateDisabled(false);
|
updateDisabled(false);
|
||||||
} else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) {
|
} else if (LCPStore::getInstance()->isValidLCPFileName(pp->lensProf.lcpFile)) {
|
||||||
fcbLCPFile->set_filename(pp->lensProf.lcpFile);
|
fcbLCPFile->set_filename(pp->lensProf.lcpFile);
|
||||||
|
|
||||||
if (corrLcpFile->get_active()) {
|
if (corrLcpFile->get_active()) {
|
||||||
updateDisabled(true);
|
updateDisabled(true);
|
||||||
}
|
}
|
||||||
@@ -199,6 +204,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
setLensfunCamera(c.getMake(), c.getModel());
|
setLensfunCamera(c.getMake(), c.getModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!setLensfunLens(pp->lensProf.lfLens) && !pp->lensProf.lfManual()) {
|
if (!setLensfunLens(pp->lensProf.lfLens) && !pp->lensProf.lfManual()) {
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
LFLens l = db->findLens(c, metadata->getLens());
|
LFLens l = db->findLens(c, metadata->getLens());
|
||||||
@@ -213,6 +219,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
if (corrLensfunAuto->get_active()) {
|
if (corrLensfunAuto->get_active()) {
|
||||||
corrOff->set_active(true);
|
corrOff->set_active(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
corrLensfunAuto->set_sensitive(false);
|
corrLensfunAuto->set_sensitive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,33 +241,43 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa
|
|||||||
void LensProfilePanel::updateLensfunWarning()
|
void LensProfilePanel::updateLensfunWarning()
|
||||||
{
|
{
|
||||||
warning->hide();
|
warning->hide();
|
||||||
|
|
||||||
if (corrLensfunManual->get_active() || corrLensfunAuto->get_active()) {
|
if (corrLensfunManual->get_active() || corrLensfunAuto->get_active()) {
|
||||||
const LFDatabase *db = LFDatabase::getInstance();
|
const LFDatabase *db = LFDatabase::getInstance();
|
||||||
|
|
||||||
auto itc = lensfunCameras->get_active();
|
auto itc = lensfunCameras->get_active();
|
||||||
|
|
||||||
if (!itc) {
|
if (!itc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model]);
|
LFCamera c = db->findCamera((*itc)[lf->lensfunModelCam.make], (*itc)[lf->lensfunModelCam.model]);
|
||||||
auto itl = lensfunLenses->get_active();
|
auto itl = lensfunLenses->get_active();
|
||||||
|
|
||||||
if (!itl) {
|
if (!itl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LFLens l = db->findLens(LFCamera(), (*itl)[lf->lensfunModelLens.lens]);
|
LFLens l = db->findLens(LFCamera(), (*itl)[lf->lensfunModelLens.lens]);
|
||||||
float lenscrop = l.getCropFactor();
|
float lenscrop = l.getCropFactor();
|
||||||
float camcrop = c.getCropFactor();
|
float camcrop = c.getCropFactor();
|
||||||
|
|
||||||
if (lenscrop <= 0 || camcrop <= 0 || lenscrop / camcrop >= 1.01f) {
|
if (lenscrop <= 0 || camcrop <= 0 || lenscrop / camcrop >= 1.01f) {
|
||||||
warning->show();
|
warning->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
ckbUseVign->set_sensitive(l.hasVignettingCorrection());
|
ckbUseVign->set_sensitive(l.hasVignettingCorrection());
|
||||||
ckbUseDist->set_sensitive(l.hasDistortionCorrection());
|
ckbUseDist->set_sensitive(l.hasDistortionCorrection());
|
||||||
ckbUseCA->set_sensitive(l.hasCACorrection());
|
ckbUseCA->set_sensitive(l.hasCACorrection());
|
||||||
|
|
||||||
if (!isRaw || !l.hasVignettingCorrection()) {
|
if (!isRaw || !l.hasVignettingCorrection()) {
|
||||||
ckbUseVign->set_active(false);
|
ckbUseVign->set_active(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l.hasDistortionCorrection()) {
|
if (!l.hasDistortionCorrection()) {
|
||||||
ckbUseDist->set_active(false);
|
ckbUseDist->set_active(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l.hasCACorrection()) {
|
if (!l.hasCACorrection()) {
|
||||||
ckbUseCA->set_active(false);
|
ckbUseCA->set_active(false);
|
||||||
}
|
}
|
||||||
@@ -307,6 +324,7 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited
|
|||||||
pp->lensProf.useCA = ckbUseCA->get_active();
|
pp->lensProf.useCA = ckbUseCA->get_active();
|
||||||
|
|
||||||
auto itc = lensfunCameras->get_active();
|
auto itc = lensfunCameras->get_active();
|
||||||
|
|
||||||
if (itc) {
|
if (itc) {
|
||||||
pp->lensProf.lfCameraMake = (*itc)[lf->lensfunModelCam.make];
|
pp->lensProf.lfCameraMake = (*itc)[lf->lensfunModelCam.make];
|
||||||
pp->lensProf.lfCameraModel = (*itc)[lf->lensfunModelCam.model];
|
pp->lensProf.lfCameraModel = (*itc)[lf->lensfunModelCam.model];
|
||||||
@@ -314,7 +332,9 @@ void LensProfilePanel::write( rtengine::procparams::ProcParams* pp, ParamsEdited
|
|||||||
pp->lensProf.lfCameraMake = "";
|
pp->lensProf.lfCameraMake = "";
|
||||||
pp->lensProf.lfCameraModel = "";
|
pp->lensProf.lfCameraModel = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto itl = lensfunLenses->get_active();
|
auto itl = lensfunLenses->get_active();
|
||||||
|
|
||||||
if (itl) {
|
if (itl) {
|
||||||
pp->lensProf.lfLens = (*itl)[lf->lensfunModelLens.lens];
|
pp->lensProf.lfLens = (*itl)[lf->lensfunModelLens.lens];
|
||||||
} else {
|
} else {
|
||||||
@@ -347,6 +367,7 @@ void LensProfilePanel::onLCPFileChanged()
|
|||||||
corrLcpFile->set_active(true);
|
corrLcpFile->set_active(true);
|
||||||
enableListener();
|
enableListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
listener->panelChanged(EvLCPFile, Glib::path_get_basename(fcbLCPFile->get_filename()));
|
listener->panelChanged(EvLCPFile, Glib::path_get_basename(fcbLCPFile->get_filename()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,6 +407,7 @@ void LensProfilePanel::updateDisabled(bool enable)
|
|||||||
void LensProfilePanel::setBatchMode(bool yes)
|
void LensProfilePanel::setBatchMode(bool yes)
|
||||||
{
|
{
|
||||||
FoldableToolPanel::setBatchMode(yes);
|
FoldableToolPanel::setBatchMode(yes);
|
||||||
|
|
||||||
if (yes) {
|
if (yes) {
|
||||||
corrUnchanged->show();
|
corrUnchanged->show();
|
||||||
corrUnchanged->set_active(true);
|
corrUnchanged->set_active(true);
|
||||||
@@ -399,6 +421,7 @@ bool LensProfilePanel::setLensfunCamera(const Glib::ustring &make, const Glib::u
|
|||||||
{
|
{
|
||||||
if (!make.empty() && !model.empty()) {
|
if (!make.empty() && !model.empty()) {
|
||||||
auto it = lensfunCameras->get_active();
|
auto it = lensfunCameras->get_active();
|
||||||
|
|
||||||
if (it && (*it)[lf->lensfunModelCam.make] == make && (*it)[lf->lensfunModelCam.model] == model) {
|
if (it && (*it)[lf->lensfunModelCam.make] == make && (*it)[lf->lensfunModelCam.model] == model) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -407,17 +430,21 @@ bool LensProfilePanel::setLensfunCamera(const Glib::ustring &make, const Glib::u
|
|||||||
for (auto row : lf->lensfunCameraModel->children()) {
|
for (auto row : lf->lensfunCameraModel->children()) {
|
||||||
if (row[lf->lensfunModelCam.make] == make) {
|
if (row[lf->lensfunModelCam.make] == make) {
|
||||||
auto &c = row.children();
|
auto &c = row.children();
|
||||||
|
|
||||||
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
||||||
auto &childrow = *it;
|
auto &childrow = *it;
|
||||||
|
|
||||||
if (childrow[lf->lensfunModelCam.model] == model) {
|
if (childrow[lf->lensfunModelCam.model] == model) {
|
||||||
lensfunCameras->set_active(it);
|
lensfunCameras->set_active(it);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lensfunCameras->set_active(-1);
|
lensfunCameras->set_active(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -427,21 +454,26 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
|
|||||||
{
|
{
|
||||||
if (!lens.empty()) {
|
if (!lens.empty()) {
|
||||||
auto it = lensfunLenses->get_active();
|
auto it = lensfunLenses->get_active();
|
||||||
|
|
||||||
if (it && (*it)[lf->lensfunModelLens.lens] == lens) {
|
if (it && (*it)[lf->lensfunModelLens.lens] == lens) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool first_maker_found = false;
|
bool first_maker_found = false;
|
||||||
|
|
||||||
for (auto row : lf->lensfunLensModel->children()) {
|
for (auto row : lf->lensfunLensModel->children()) {
|
||||||
if (lens.find(row[lf->lensfunModelLens.lens]) == 0) {
|
if (lens.find(row[lf->lensfunModelLens.lens]) == 0) {
|
||||||
auto &c = row.children();
|
auto &c = row.children();
|
||||||
|
|
||||||
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
for (auto it = c.begin(), end = c.end(); it != end; ++it) {
|
||||||
auto &childrow = *it;
|
auto &childrow = *it;
|
||||||
|
|
||||||
if (childrow[lf->lensfunModelLens.lens] == lens) {
|
if (childrow[lf->lensfunModelLens.lens] == lens) {
|
||||||
lensfunLenses->set_active(it);
|
lensfunLenses->set_active(it);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we do not break immediately here, because there might be multiple makers
|
// we do not break immediately here, because there might be multiple makers
|
||||||
// sharing the same prefix (e.g. "Leica" and "Leica Camera AG").
|
// sharing the same prefix (e.g. "Leica" and "Leica Camera AG").
|
||||||
// therefore, we break below when the lens doesn't match any of them
|
// therefore, we break below when the lens doesn't match any of them
|
||||||
@@ -451,6 +483,7 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lensfunLenses->set_active(-1);
|
lensfunLenses->set_active(-1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -533,6 +566,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton *rbChanged)
|
|||||||
LFLens l = db->findLens(c, metadata->getLens());
|
LFLens l = db->findLens(c, metadata->getLens());
|
||||||
setLensfunCamera(c.getMake(), c.getModel());
|
setLensfunCamera(c.getMake(), c.getModel());
|
||||||
setLensfunLens(l.getLens());
|
setLensfunLens(l.getLens());
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
enableListener();
|
enableListener();
|
||||||
}
|
}
|
||||||
@@ -590,6 +624,7 @@ bool LensProfilePanel::checkLensfunCanCorrect(bool automatch)
|
|||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtengine::procparams::ProcParams lpp;
|
rtengine::procparams::ProcParams lpp;
|
||||||
write(&lpp);
|
write(&lpp);
|
||||||
std::unique_ptr<LFModifier> mod(LFDatabase::findModifier(lpp.lensProf, metadata, 100, 100, lpp.coarse, -1));
|
std::unique_ptr<LFModifier> mod(LFDatabase::findModifier(lpp.lensProf, metadata, 100, 100, lpp.coarse, -1));
|
||||||
@@ -629,8 +664,10 @@ void LensProfilePanel::LFDbHelper::fillLensfunCameras()
|
|||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
std::cout << "LENSFUN, scanning cameras:" << std::endl;
|
std::cout << "LENSFUN, scanning cameras:" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Glib::ustring, std::set<Glib::ustring>> camnames;
|
std::map<Glib::ustring, std::set<Glib::ustring>> camnames;
|
||||||
auto camlist = LFDatabase::getInstance()->getCameras();
|
auto camlist = LFDatabase::getInstance()->getCameras();
|
||||||
|
|
||||||
for (auto &c : camlist) {
|
for (auto &c : camlist) {
|
||||||
camnames[c.getMake()].insert(c.getModel());
|
camnames[c.getMake()].insert(c.getModel());
|
||||||
|
|
||||||
@@ -638,10 +675,12 @@ void LensProfilePanel::LFDbHelper::fillLensfunCameras()
|
|||||||
std::cout << " found: " << c.getDisplayString().c_str() << std::endl;
|
std::cout << " found: " << c.getDisplayString().c_str() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &p : camnames) {
|
for (auto &p : camnames) {
|
||||||
Gtk::TreeModel::Row row = *(lensfunCameraModel->append());
|
Gtk::TreeModel::Row row = *(lensfunCameraModel->append());
|
||||||
row[lensfunModelCam.make] = p.first;
|
row[lensfunModelCam.make] = p.first;
|
||||||
row[lensfunModelCam.model] = p.first;
|
row[lensfunModelCam.model] = p.first;
|
||||||
|
|
||||||
for (auto &c : p.second) {
|
for (auto &c : p.second) {
|
||||||
Gtk::TreeModel::Row child = *(lensfunCameraModel->append(row.children()));
|
Gtk::TreeModel::Row child = *(lensfunCameraModel->append(row.children()));
|
||||||
child[lensfunModelCam.make] = p.first;
|
child[lensfunModelCam.make] = p.first;
|
||||||
@@ -656,8 +695,10 @@ void LensProfilePanel::LFDbHelper::fillLensfunLenses()
|
|||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
std::cout << "LENSFUN, scanning lenses:" << std::endl;
|
std::cout << "LENSFUN, scanning lenses:" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<Glib::ustring, std::set<Glib::ustring>> lenses;
|
std::map<Glib::ustring, std::set<Glib::ustring>> lenses;
|
||||||
auto lenslist = LFDatabase::getInstance()->getLenses();
|
auto lenslist = LFDatabase::getInstance()->getLenses();
|
||||||
|
|
||||||
for (auto &l : lenslist) {
|
for (auto &l : lenslist) {
|
||||||
auto name = l.getLens();
|
auto name = l.getLens();
|
||||||
auto make = l.getMake();
|
auto make = l.getMake();
|
||||||
@@ -667,13 +708,16 @@ void LensProfilePanel::LFDbHelper::fillLensfunLenses()
|
|||||||
std::cout << " found: " << l.getDisplayString().c_str() << std::endl;
|
std::cout << " found: " << l.getDisplayString().c_str() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &p : lenses) {
|
for (auto &p : lenses) {
|
||||||
Gtk::TreeModel::Row row = *(lensfunLensModel->append());
|
Gtk::TreeModel::Row row = *(lensfunLensModel->append());
|
||||||
row[lensfunModelLens.lens] = p.first;
|
row[lensfunModelLens.lens] = p.first;
|
||||||
row[lensfunModelLens.prettylens] = p.first;
|
row[lensfunModelLens.prettylens] = p.first;
|
||||||
|
|
||||||
for (auto &c : p.second) {
|
for (auto &c : p.second) {
|
||||||
Gtk::TreeModel::Row child = *(lensfunLensModel->append(row.children()));
|
Gtk::TreeModel::Row child = *(lensfunLensModel->append(row.children()));
|
||||||
child[lensfunModelLens.lens] = c;
|
child[lensfunModelLens.lens] = c;
|
||||||
|
|
||||||
if (c.find(p.first, p.first.size() + 1) == p.first.size() + 1) {
|
if (c.find(p.first, p.first.size() + 1) == p.first.size() + 1) {
|
||||||
child[lensfunModelLens.prettylens] = c.substr(p.first.size() + 1);
|
child[lensfunModelLens.prettylens] = c.substr(p.first.size() + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -50,18 +50,29 @@ protected:
|
|||||||
MyComboBox *lensfunLenses;
|
MyComboBox *lensfunLenses;
|
||||||
Gtk::Image *warning;
|
Gtk::Image *warning;
|
||||||
|
|
||||||
class LFDbHelper {
|
class LFDbHelper
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
class LFModelCam: public Gtk::TreeModel::ColumnRecord {
|
class LFModelCam: public Gtk::TreeModel::ColumnRecord
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
LFModelCam() { add(make); add(model); }
|
LFModelCam()
|
||||||
|
{
|
||||||
|
add(make);
|
||||||
|
add(model);
|
||||||
|
}
|
||||||
Gtk::TreeModelColumn<Glib::ustring> make;
|
Gtk::TreeModelColumn<Glib::ustring> make;
|
||||||
Gtk::TreeModelColumn<Glib::ustring> model;
|
Gtk::TreeModelColumn<Glib::ustring> model;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LFModelLens: public Gtk::TreeModel::ColumnRecord {
|
class LFModelLens: public Gtk::TreeModel::ColumnRecord
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
LFModelLens() { add(lens); add(prettylens); }
|
LFModelLens()
|
||||||
|
{
|
||||||
|
add(lens);
|
||||||
|
add(prettylens);
|
||||||
|
}
|
||||||
Gtk::TreeModelColumn<Glib::ustring> lens;
|
Gtk::TreeModelColumn<Glib::ustring> lens;
|
||||||
Gtk::TreeModelColumn<Glib::ustring> prettylens;
|
Gtk::TreeModelColumn<Glib::ustring> prettylens;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user