Merge branch master into gtk3

This commit is contained in:
Beep6581
2015-09-30 18:15:57 +02:00
5 changed files with 94 additions and 84 deletions

View File

@@ -814,7 +814,7 @@ const DCPProfile::HSBModify* DCPProfile::MakeHueSatMap(ColorTemp &wb, int prefer
return aDeltas;
}
DCPProfile::DCPProfile(Glib::ustring fname, bool isRTProfile)
DCPProfile::DCPProfile(Glib::ustring fname)
{
const int TIFFFloatSize = 4;
const int TagColorMatrix1 = 50721, TagColorMatrix2 = 50722, TagProfileHueSatMapDims = 50937;
@@ -989,7 +989,7 @@ DCPProfile::DCPProfile(Glib::ustring fname, bool isRTProfile)
// Read tone curve points, if any, but disable to RTs own profiles
tag = tagDir->getTag(TagProfileToneCurve);
if (tag != NULL && !isRTProfile) {
if (tag != NULL) {
std::vector<double> cPoints;
cPoints.push_back(double(DCT_Spline)); // The first value is the curve type
@@ -1760,7 +1760,7 @@ void DCPStore::init (Glib::ustring rtProfileDir)
}
}
DCPProfile* DCPStore::getProfile (Glib::ustring filename, bool isRTProfile)
DCPProfile* DCPStore::getProfile (Glib::ustring filename)
{
MyMutex::MyLock lock(mtx);
@@ -1771,7 +1771,7 @@ DCPProfile* DCPStore::getProfile (Glib::ustring filename, bool isRTProfile)
}
// Add profile
profileCache[filename] = new DCPProfile(filename, isRTProfile);
profileCache[filename] = new DCPProfile(filename);
return profileCache[filename];
}
@@ -1783,7 +1783,7 @@ DCPProfile* DCPStore::getStdProfile(Glib::ustring camShortName)
// Warning: do NOT use map.find(), since it does not seem to work reliably here
for (std::map<Glib::ustring, Glib::ustring>::iterator i = fileStdProfiles.begin(); i != fileStdProfiles.end(); i++)
if (name2 == (*i).first) {
return getProfile((*i).second, true);
return getProfile((*i).second);
}
return NULL;

View File

@@ -76,7 +76,7 @@ class DCPProfile
void HSDApply(const HSDTableInfo &ti, const HSBModify *tableBase, float &h, float &s, float &v) const;
public:
DCPProfile(Glib::ustring fname, bool isRTProfile);
DCPProfile(Glib::ustring fname);
~DCPProfile();
bool getHasToneCurve()
@@ -122,7 +122,7 @@ public:
bool isValidDCPFileName(Glib::ustring filename) const;
DCPProfile* getProfile(Glib::ustring filename, bool isRTProfile = false);
DCPProfile* getProfile(Glib::ustring filename);
DCPProfile* getStdProfile(Glib::ustring camShortName);
static DCPStore* getInstance();

View File

@@ -831,8 +831,8 @@ void ColorManagementParams::setDefaults()
{
input = "(cameraICC)";
blendCMSMatrix = false;
toneCurve = true;
applyLookTable = true;
toneCurve = false;
applyLookTable = false;
applyBaselineExposureOffset = true;
applyHueSatMap = true;
dcpIlluminant = 0;

View File

@@ -30,7 +30,7 @@ using namespace rtengine::procparams;
extern Options options;
ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunchanged(NULL), icmplistener(NULL), lastRefFilename("")
ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunchanged(NULL), icmplistener(NULL), lastRefFilename(""), camName("")
{
isBatchMode = lastToneCurve = lastApplyLookTable = lastApplyBaselineExposureOffset = lastApplyHueSatMap = lastBlendCMSMatrix = lastgamfree = false;
@@ -363,72 +363,76 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name)
dcpIll->set_sensitive (false);
dcpFrame->set_sensitive(false);
if (ifromfile->get_active() && dcpStore->isValidDCPFileName(dcp_name)) {
DCPProfile* dcp = dcpStore->getProfile(dcp_name, false);
DCPProfile* dcp = NULL;
if (dcp) {
dcpFrame->set_sensitive(true);
if(dcp_name == "(cameraICC)") {
dcp = dcpStore->getStdProfile(camName);
} else if (ifromfile->get_active() && dcpStore->isValidDCPFileName(dcp_name)) {
dcp = dcpStore->getProfile(dcp_name);
}
if (dcp->getHasToneCurve()) {
ckbToneCurve->set_sensitive (true);
if (dcp) {
dcpFrame->set_sensitive(true);
if (dcp->getHasToneCurve()) {
ckbToneCurve->set_sensitive (true);
}
if (dcp->getHasLookTable()) {
ckbApplyLookTable->set_sensitive (true);
}
if (dcp->getHasBaselineExposureOffset()) {
ckbApplyBaselineExposureOffset->set_sensitive (true);
}
if (dcp->getHasHueSatMap()) {
ckbApplyHueSatMap->set_sensitive (true);
}
int i1, i2;
double temp1, temp2;
bool willInterpolate;
dcp->getIlluminants(i1, temp1, i2, temp2, willInterpolate);
if (willInterpolate) {
if (dcpTemperatures[0] != temp1 || dcpTemperatures[1] != temp2) {
char tempstr1[64], tempstr2[64];
sprintf(tempstr1, "%.0fK", temp1);
sprintf(tempstr2, "%.0fK", temp2);
int curr_active = dcpIll->get_active_row_number();
ignoreDcpSignal = true;
dcpIll->remove_all ();
dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED"));
dcpIll->append (tempstr1);
dcpIll->append (tempstr2);
dcpTemperatures[0] = temp1;
dcpTemperatures[1] = temp2;
dcpIll->set_active (curr_active);
ignoreDcpSignal = false;
}
if (dcp->getHasLookTable()) {
ckbApplyLookTable->set_sensitive (true);
if (dcpIlluminant > 2) {
dcpIlluminant = 0;
}
if (dcp->getHasBaselineExposureOffset()) {
ckbApplyBaselineExposureOffset->set_sensitive (true);
if (dcpIll->get_active_row_number() == -1 && dcpIlluminant == -1) {
ignoreDcpSignal = true;
dcpIll->set_active(0);
ignoreDcpSignal = false;
} else if (dcpIlluminant >= 0 && dcpIlluminant != dcpIll->get_active_row_number()) {
ignoreDcpSignal = true;
dcpIll->set_active(dcpIlluminant);
ignoreDcpSignal = false;
}
if (dcp->getHasHueSatMap()) {
ckbApplyHueSatMap->set_sensitive (true);
}
int i1, i2;
double temp1, temp2;
bool willInterpolate;
dcp->getIlluminants(i1, temp1, i2, temp2, willInterpolate);
if (willInterpolate) {
if (dcpTemperatures[0] != temp1 || dcpTemperatures[1] != temp2) {
char tempstr1[64], tempstr2[64];
sprintf(tempstr1, "%.0fK", temp1);
sprintf(tempstr2, "%.0fK", temp2);
int curr_active = dcpIll->get_active_row_number();
ignoreDcpSignal = true;
dcpIll->remove_all ();
dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED"));
dcpIll->append (tempstr1);
dcpIll->append (tempstr2);
dcpTemperatures[0] = temp1;
dcpTemperatures[1] = temp2;
dcpIll->set_active (curr_active);
ignoreDcpSignal = false;
}
if (dcpIlluminant > 2) {
dcpIlluminant = 0;
}
if (dcpIll->get_active_row_number() == -1 && dcpIlluminant == -1) {
ignoreDcpSignal = true;
dcpIll->set_active(0);
ignoreDcpSignal = false;
} else if (dcpIlluminant >= 0 && dcpIlluminant != dcpIll->get_active_row_number()) {
ignoreDcpSignal = true;
dcpIll->set_active(dcpIlluminant);
ignoreDcpSignal = false;
}
dcpIll->set_sensitive (true);
dcpIllLabel->set_sensitive (true);
} else {
if (dcpIll->get_active_row_number() != -1) {
ignoreDcpSignal = true;
dcpIll->set_active(-1);
ignoreDcpSignal = false;
}
dcpIll->set_sensitive (true);
dcpIllLabel->set_sensitive (true);
} else {
if (dcpIll->get_active_row_number() != -1) {
ignoreDcpSignal = true;
dcpIll->set_active(-1);
ignoreDcpSignal = false;
}
}
}
@@ -482,7 +486,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited)
} else if ((pp->icm.input == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_INSENSITIVE) {
icameraICC->set_active (true);
ckbBlendCMSMatrix->set_sensitive (true);
updateDCP(pp->icm.dcpIlluminant, "");
updateDCP(pp->icm.dcpIlluminant, "(cameraICC)");
} else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() != Gtk::STATE_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_INSENSITIVE) {
// this is the case when (cameraICC) is instructed by packaged profiles, but ICC file is not found
// therefore falling back UI to explicitly reflect the (camera) option
@@ -493,7 +497,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited)
// If neither (camera) nor (cameraICC) are available, as is the case when loading a non-raw, activate (embedded).
iembedded->set_active (true);
ckbBlendCMSMatrix->set_sensitive (false);
updateDCP(pp->icm.dcpIlluminant, "");
updateDCP(pp->icm.dcpIlluminant, "(cameraICC)");
} else if ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() != Gtk::STATE_INSENSITIVE) {
icamera->set_active (true);
ckbBlendCMSMatrix->set_sensitive (false);
@@ -618,25 +622,29 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited)
pp->icm.freegamma = freegamma->get_active();
DCPProfile* dcp = NULL;
if (ifromfile->get_active() && pp->icm.input.substr(0, 5) == "file:" && dcpStore->isValidDCPFileName(pp->icm.input.substr(5))) {
DCPProfile* dcp = dcpStore->getProfile(pp->icm.input.substr(5), false);
dcp = dcpStore->getProfile(pp->icm.input.substr(5));
} else if(icameraICC->get_active()) {
dcp = dcpStore->getStdProfile(camName);
}
if (dcp) {
if (dcp->getHasToneCurve()) {
pp->icm.toneCurve = ckbToneCurve->get_active ();
}
if (dcp) {
if (dcp->getHasToneCurve()) {
pp->icm.toneCurve = ckbToneCurve->get_active ();
}
if (dcp->getHasLookTable()) {
pp->icm.applyLookTable = ckbApplyLookTable->get_active ();
}
if (dcp->getHasLookTable()) {
pp->icm.applyLookTable = ckbApplyLookTable->get_active ();
}
if (dcp->getHasBaselineExposureOffset()) {
pp->icm.applyBaselineExposureOffset = ckbApplyBaselineExposureOffset->get_active ();
}
if (dcp->getHasBaselineExposureOffset()) {
pp->icm.applyBaselineExposureOffset = ckbApplyBaselineExposureOffset->get_active ();
}
if (dcp->getHasHueSatMap()) {
pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active ();
}
if (dcp->getHasHueSatMap()) {
pp->icm.applyHueSatMap = ckbApplyHueSatMap->get_active ();
}
}
@@ -895,6 +903,7 @@ void ICMPanel::setRawMeta (bool raw, const rtengine::ImageData* pMeta)
icamera->set_active (raw);
iembedded->set_active (!raw);
icamera->set_sensitive (raw);
camName = pMeta->getCamera();
icameraICC->set_sensitive (raw && (iccStore->getStdProfile(pMeta->getCamera()) != NULL || dcpStore->getStdProfile(pMeta->getCamera()) != NULL));
iembedded->set_sensitive (!raw);

View File

@@ -93,6 +93,7 @@ private:
double dcpTemperatures[2];
bool enableLastICCWorkDirChange;
Glib::ustring lastRefFilename;
Glib::ustring camName;
void updateDCP(int dcpIlluminant, Glib::ustring dcp_name);
public:
ICMPanel ();