diff --git a/rtdata/languages/default b/rtdata/languages/default index 2dda8e28f..5c5cda989 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -759,8 +759,10 @@ TP_FLATFIELD_BT_HORIZONTAL;Horizontal TP_FLATFIELD_BT_VERTHORIZ;Vert. + Horiz. TP_FLATFIELD_BT_VERTICAL;Vertical TP_FLATFIELD_LABEL;Flat Field -TP_GAMMA_COMMENT;(output profile disabled except "default") TP_GAMMA_OUTPUT;Output gamma +TP_GAMMA_FREE;Free gamma +TP_GAMMA_CURV;gamma +TP_GAMMA_SLOP;slope (linear) TP_HLREC_CIELAB;CIELab Blending TP_HLREC_COLOR;Color Propagation TP_HLREC_LABEL;Highlight Reconstruction diff --git a/rtdata/profiles/crisp.pp3 b/rtdata/profiles/crisp.pp3 index 7e671d7d8..5c87a2b7e 100644 --- a/rtdata/profiles/crisp.pp3 +++ b/rtdata/profiles/crisp.pp3 @@ -146,6 +146,9 @@ ApplyGammaBeforeInputProfile=false WorkingProfile=sRGB OutputProfile=No ICM: sRGB output Gammafree=default +Freegamma=false +gampos=2.22 +slpos=4.5 [Equalizer] Enabled=false diff --git a/rtdata/profiles/default.pp3 b/rtdata/profiles/default.pp3 index 911d878e5..6f21a52a5 100644 --- a/rtdata/profiles/default.pp3 +++ b/rtdata/profiles/default.pp3 @@ -146,6 +146,9 @@ ApplyGammaBeforeInputProfile=false WorkingProfile=sRGB OutputProfile=No ICM: sRGB output Gammafree=default +Freegamma=false +gampos=2.22 +slpos=4.5 [Equalizer] Enabled=false diff --git a/rtdata/profiles/neutral.pp3 b/rtdata/profiles/neutral.pp3 index 608ec9259..a3a6c14a8 100644 --- a/rtdata/profiles/neutral.pp3 +++ b/rtdata/profiles/neutral.pp3 @@ -146,6 +146,9 @@ ApplyGammaBeforeInputProfile=false WorkingProfile=sRGB OutputProfile=No ICM: sRGB output Gammafree=default +Freegamma=false +gampos=2.22 +slpos=4.5 [Equalizer] Enabled=false diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 30c476e14..3334ae98e 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -898,6 +898,35 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) { b = ((rgb_xyz[2][0]*x + rgb_xyz[2][1]*y + rgb_xyz[2][2]*z)) ; } + +void ImProcFunctions::calcGamma (double pwr, double ts, int mode, int imax, double &gamma0, double &gamma1, double &gamma2, double &gamma3, double &gamma4, double &gamma5) { +{//from Dcraw (D.Coffin) + int i; + double g[6], bnd[2]={0,0}, r; + + g[0] = pwr; + g[1] = ts; + g[2] = g[3] = g[4] = 0; + bnd[g[1] >= 1] = 1; + if (g[1] && (g[1]-1)*(g[0]-1) <= 0) { + for (i=0; i < 48; i++) { + g[2] = (bnd[0] + bnd[1])/2; + if (g[0]) bnd[(pow(g[2]/g[1],-g[0]) - 1)/g[0] - 1/g[2] > -1] = g[2]; + else bnd[g[2]/exp(1-1/g[2]) < g[1]] = g[2]; + } + g[3] = g[2] / g[1]; + if (g[0]) g[4] = g[2] * (1/g[0] - 1); + } + if (g[0]) g[5] = 1 / (g[1]*SQR(g[3])/2 - g[4]*(1 - g[3]) + + (1 - pow(g[3],1+g[0]))*(1 + g[4])/(1 + g[0])) - 1; + else g[5] = 1 / (g[1]*SQR(g[3])/2 + 1 + - g[2] - g[3] - g[2]*g[3]*(log(g[3]) - 1)) - 1; + if (!mode--) { + gamma0=g[0];gamma1=g[1];gamma2=g[2];gamma3=g[3];gamma4=g[4];gamma5=g[5]; + return; + } +} +} void ImProcFunctions::Lab2XYZ(float L, float a, float b, float &x, float &y, float &z) { float fy = (0.00862069 * L) + 0.137932; // (L+16)/116 diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index b51f2489e..a5c5969d7 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -113,7 +113,7 @@ class ImProcFunctions { void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh, bool edges); Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile); - Image16* lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam);// for gamma output + Image16* lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos);// for gamma output Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);//without gamma ==>default bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1); @@ -130,6 +130,7 @@ class ImProcFunctions { void XYZ2Lab(float X, float Y, float Z, float &L, float &a, float &b); void Lab2Yuv(float L, float a, float b, float &Y, float &u, float &v); void Yuv2Lab(float Y, float u, float v, float &L, float &a, float &b, double wp[3][3]); + void calcGamma (double pwr, double ts, int mode, int imax, double &gamma0, double &gamma1, double &gamma2, double &gamma3, double &gamma4,double &gamma5); //void gamutmap(LabImage* ); void gamutmap(float &X, float &Y, float &Z, const double p[3][3]); diff --git a/rtengine/iplab2rgb.cc b/rtengine/iplab2rgb.cc index 47aee24d6..ce53608e5 100644 --- a/rtengine/iplab2rgb.cc +++ b/rtengine/iplab2rgb.cc @@ -309,7 +309,7 @@ Image16* ImProcFunctions::lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int // for gamma options (BT709...sRGB linear...) -Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam) { +Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos) { //gamutmap(lab); @@ -321,7 +321,14 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int Image16* image = new Image16 (cw, ch); cmsBool rc = TRUE; float p1,p2,p3,p4,p5,p6;//primaries - float ga0,ga1,ga2,ga3,ga4,ga5=0;//gamma parameters + double ga0,ga1,ga2,ga3,ga4,ga5=0.0,ga6=0.0;//gamma parameters + double g_a0,g_a1,g_a2,g_a3,g_a4,g_a5;//gamma parameters + double pwr; + double ts; + pwr=1.0/gampos; + ts=slpos; + int mode=0, imax=0; + int t50; int select_temp =1;//5003K double eps=0.000000001;// not divide by zero @@ -333,15 +340,22 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int else if (profi=="BruceRGB") {p1=0.6400; p2=0.3300; p3=0.2800; p4=0.6500; p5=0.1500; p6=0.0600;select_temp=2;} // Bruce primaries else if (profi=="Beta RGB") {p1=0.6888; p2=0.3112; p3=0.1986; p4=0.7551; p5=0.1265; p6=0.0352;select_temp=1;} // Beta primaries else if (profi=="BestRGB") {p1=0.7347; p2=0.2653; p3=0.2150; p4=0.7750; p5=0.1300; p6=0.0350;select_temp=1;} // Best primaries - + if (!freegamma) {//if Free gamma not selected // gamma : ga0,ga1,ga2,ga3,ga4,ga5 by calcul - if(gam=="BT709_g2.2_s4.5") {ga0=2.222;ga1=1./1.099258;ga2=0.099258/1.099258;ga3=1./4.5; ga4=0.01805;ga5=0;}//BT709 2.2 4.5 - my prefered as D.Coffin ga4=0.01805 + if(gam=="BT709_g2.2_s4.5") {ga0=2.222;ga1=1./1.099258;ga2=0.099258/1.099258;ga3=1./4.5; ga4=0.01805;ga5=0.0;}//BT709 2.2 4.5 - my prefered as D.Coffin ga4=0.01805 else if (gam=="sRGB_g2.4_s12.92") {ga0=2.3999 ; ga1=1./1.0550; ga2=0.0550/1.0550;ga3=1./12.92;ga4=0.039289;}//sRGB 2.4 12.92 - RT default as Lightroom else if (gam=="High_g1.3_s3.35") {ga0=1.3 ; ga1=1./1.001724; ga2=0.001724/1.001724;ga3=1./3.35;ga4=0.001715;}//for high dynamic images else if (gam== "Low_g2.6_s6.9") {ga0=2.6 ; ga1=1./1.12213; ga2=0.12213/1.12213;ga3=1./6.90;ga4=0.01;} //gamma 2.6 variable : for low contrast images else if (gam=="linear_g1.0") {ga0=1.0; ga1=1.;ga2=0.;ga3=1./eps;ga4=0.;}//gamma=1 linear : for high dynamic images (cf : D.Coffin...) else if (gam=="standard_g2.2") {ga0=2.2; ga1=1.;ga2=0.;ga3=1./eps;ga4=0.;}//gamma=2.2 (as gamma of Adobe, Widegamut...) else if (gam=="standard_g1.8") {ga0=1.8; ga1=1.;ga2=0.;ga3=1./eps;ga4=0.;}//gamma=1.8 (as gamma of Prophoto) + } + else //free gamma selected + { + if(slpos==0) slpos=eps; + calcGamma(pwr, ts, mode, imax,g_a0,g_a1,g_a2,g_a3,g_a4,g_a5);// call to calcGamma with selected gamma and slope : return parameters for LCMS2 + ga0=gampos;ga1=1./(1.0+g_a4);ga2=g_a4/(1.0 + g_a4);ga3=1./slpos; ga4=g_a3;ga5=0; + } if(select_temp==1) t50=5003;// for Widegamut, Prophoto Best, Beta D50 @@ -360,8 +374,8 @@ Image16* ImProcFunctions::lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int Parameters[3] = ga3; Parameters[4] = ga4; Parameters[5] = ga5; - Parameters[6] = 0; -// 6 parameters for smoother curves + Parameters[6] = ga6; +// 7 parameters for smoother curves cmsWhitePointFromTemp(&xyD, t50); GammaTRC[0] = GammaTRC[1] = GammaTRC[2] = cmsBuildParametricToneCurve(NULL, 5, Parameters);//5 = more smoother than 4 cmsHPROFILE oprofdef = cmsCreateRGBProfileTHR(NULL, &xyD, &Primaries, GammaTRC); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index a46ecd8e9..5bca0096d 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -155,7 +155,11 @@ enum ProcEvent { EvDPDNLumCurve=130, EvDPDNChromCurve=131, EvGAMMA=132, - NUMOFEVENTS=133 + EvGAMPOS=133, + EvGAMFREE=134, + EvSLPOS=135, + NUMOFEVENTS=136 + }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 59d35e411..944367efc 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -211,7 +211,10 @@ void ProcParams::setDefaults () { icm.working = "sRGB"; icm.output = "sRGB"; icm.gamma = "default"; - + icm.gampos =2.22; + icm.slpos=4.5; + icm.freegamma = false; + equalizer.enabled = false; for(int i = 0; i < 8; i ++) { @@ -429,6 +432,9 @@ int ProcParams::save (Glib::ustring fname) const { keyFile.set_string ("Color Management", "WorkingProfile", icm.working); keyFile.set_string ("Color Management", "OutputProfile", icm.output); keyFile.set_string ("Color Management", "Gammafree", icm.gamma); + keyFile.set_boolean ("Color Management", "Freegamma", icm.freegamma); + keyFile.set_double ("Color Management", "GammaValue", icm.gampos); + keyFile.set_double ("Color Management", "GammaSlope", icm.slpos); // save wavelet equalizer parameters keyFile.set_boolean ("Equalizer", "Enabled", equalizer.enabled); @@ -744,6 +750,9 @@ if (keyFile.has_group ("Color Management")) { if (keyFile.has_key ("Color Management", "WorkingProfile")) icm.working = keyFile.get_string ("Color Management", "WorkingProfile"); if (keyFile.has_key ("Color Management", "OutputProfile")) icm.output = keyFile.get_string ("Color Management", "OutputProfile"); if (keyFile.has_key ("Color Management", "Gammafree")) icm.gamma = keyFile.get_string ("Color Management", "Gammafree"); + if (keyFile.has_key ("Color Management", "Freegamma")) icm.freegamma = keyFile.get_boolean ("Color Management", "Freegamma"); + if (keyFile.has_key ("Color Management", "GammaVal")) icm.gampos = keyFile.get_double ("Color Management", "GammaVal"); + if (keyFile.has_key ("Color Management", "GammaSlope")) icm.slpos = keyFile.get_double ("Color Management", "GammaSlope"); } @@ -994,6 +1003,9 @@ bool ProcParams::operator== (const ProcParams& other) { && icm.working == other.icm.working && icm.output == other.icm.output && icm.gamma == other.icm.gamma + && icm.freegamma == other.icm.freegamma + && icm.gampos == other.icm.gampos + && icm.slpos == other.icm.slpos && equalizer == other.equalizer && dirpyrequalizer == other.dirpyrequalizer && hsvequalizer.hcurve == other.hsvequalizer.hcurve diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 24d9133ca..155c0b92a 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -332,6 +332,9 @@ class ColorManagementParams { Glib::ustring working; Glib::ustring output; Glib::ustring gamma; + double gampos; + double slpos; + bool freegamma; }; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index f1322fd9d..f7edfbb93 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -153,6 +153,10 @@ TRANSFORM, // EvAutoDIST, DIRPYRDENOISE, // EvDPDNLumCurve, DIRPYRDENOISE, // EvDPDNChromCurve, ALL, // EvGAMMA +ALL, // EvGAMPOS +ALL, //EvGAMFREE +ALL, //EvSLPOS + }; diff --git a/rtengine/settings.h b/rtengine/settings.h index 51e766118..4659d4ed1 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -34,13 +34,13 @@ namespace rtengine { Glib::ustring darkFramesPath; ///< The default directory for dark frames Glib::ustring flatFieldsPath; ///< The default directory for flat fields bool LCMSSafeMode; // If true, not OMP - Glib::ustring adobe; - Glib::ustring prophoto; - Glib::ustring widegamut; - Glib::ustring beta; - Glib::ustring best; - Glib::ustring bruce; - Glib::ustring srgb; + Glib::ustring adobe; // default name of AdobeRGB1998 + Glib::ustring prophoto; // default name of Prophoto + Glib::ustring widegamut; //default name of WidegamutRGB + Glib::ustring beta; // default name of BetaRGB + Glib::ustring best; // default name of BestRGB + Glib::ustring bruce; // default name of Bruce + Glib::ustring srgb; // default name of SRGB space profile /** Creates a new instance of Settings. * @return a pointer to the new Settings instance. */ diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 1bfba277a..5d881e84d 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -208,10 +208,11 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p cw = params.crop.w; ch = params.crop.h; } - - if(params.icm.gamma != "default") + if(params.icm.gamma != "default" || params.icm.freegamma) { // if select gamma output between BT709, sRGB, linear, low, high, 2.2 , 1.8 - Image16* readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma); + //or selected Free gamma + Image16* readyImg = ipf.lab2rgb16b (labView, cx, cy, cw, ch, params.icm.output, params.icm.working, params.icm.gamma, params.icm.freegamma, params.icm.gampos, params.icm.slpos); + delete labView; if (pl) pl->setProgress (0.70); @@ -330,7 +331,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p return readyImg; } else - {//if default mode : profil = selection by choice in list (Prophoto.icm, sRGB.icm, etc., etc.) , gamma = gamma of profile + {//if default mode : profil = selection by choice in list (Prophoto.icm, sRGB.icm, etc., etc.) , gamma = gamma of profile or not selected Free gamma + Image16* readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm.output); delete labView; if (pl) pl->setProgress (0.70); diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index dbeea3b4c..75d9917c7 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -93,18 +93,40 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), for (int i=0; iappend_text (wpnames[i]); + Gtk::HSeparator* hsep22 = Gtk::manage (new Gtk::HSeparator ()); pack_start (*hsep22, Gtk::PACK_SHRINK, 2); Gtk::Label* galab = Gtk::manage (new Gtk::Label ()); galab->set_alignment (0.0, 0.5); - //galab->set_markup (Glib::ustring("") + M("TP_GAMMA_OUTPUT") + "" +M("TP_GAMMA_COMMENT")); galab->set_markup (Glib::ustring("") + M("TP_GAMMA_OUTPUT") + ""); pack_start (*galab, Gtk::PACK_SHRINK, 4); wgamma = Gtk::manage (new Gtk::ComboBoxText ()); pack_start (*wgamma, Gtk::PACK_SHRINK, 4); + Gtk::HSeparator* hsep23 = Gtk::manage (new Gtk::HSeparator ()); + pack_start (*hsep23, Gtk::PACK_SHRINK, 2); + + freegamma = Gtk::manage(new Gtk::CheckButton((M("TP_GAMMA_FREE")))); + freegamma->set_active (false); + pack_start( *freegamma); + + g_ampos = Gtk::manage(new Adjuster (M("TP_GAMMA_CURV"),1,3.5,0.01,2.22)); + g_ampos->setAdjusterListener (this); + if (g_ampos->delay < 1000) g_ampos->delay = 1000; + g_ampos->show(); + s_lpos = Gtk::manage(new Adjuster (M("TP_GAMMA_SLOP"),0,15,0.01,4.5)); + s_lpos->setAdjusterListener (this); + if (s_lpos->delay < 1000) s_lpos->delay = 1000; + s_lpos->show(); + pack_start( *g_ampos, Gtk::PACK_SHRINK, 4);//gamma + pack_start( *s_lpos, Gtk::PACK_SHRINK, 4);//slope + + gamcsconn = freegamma->signal_toggled().connect ( sigc::mem_fun(*this, &ICMPanel::GamChanged)); + + + std::vector wpgamma = rtengine::getGamma (); for (int i=0; iappend_text (wpgamma[i]); @@ -188,8 +210,9 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) { onames->set_active_text (M("TP_ICM_NOICM")); igamma->set_active (pp->icm.gammaOnInput); - onames->set_sensitive(wgamma->get_active_row_number()==0); //"default" - //thanks to Michael + onames->set_sensitive(wgamma->get_active_row_number()==0 || freegamma->get_active()); //"default" + wgamma->set_sensitive(!freegamma->get_active()); + if (pedited) { iunchanged->set_active (!pedited->icm.input); igamma->set_sensitive (false); @@ -197,11 +220,24 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) { wnames->set_active_text(M("GENERAL_UNCHANGED")); if (!pedited->icm.output) onames->set_active_text(M("GENERAL_UNCHANGED")); - if (!pedited->icm.gamma) + if (!pedited->icm.gamma){ wgamma->set_active_text(M("GENERAL_UNCHANGED")); - + wgamma->set_active_text(M("GENERAL_UNCHANGED")); + } + g_ampos->setEditedState (pedited->icm.gampos ? Edited : UnEdited); + s_lpos->setEditedState (pedited->icm.slpos ? Edited : UnEdited); + } - + + gamcsconn.block (true); + freegamma->set_active (pp->icm.freegamma); + gamcsconn.block (false); + + lastgamfree = pp->icm.freegamma; + g_ampos->setValue (pp->icm.gampos); + s_lpos->setValue (pp->icm.slpos); + + ipc.block (false); enableListener (); @@ -225,14 +261,48 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited) { pp->icm.output = "No ICM: sRGB output"; else pp->icm.output = onames->get_active_text(); + pp->icm.freegamma = freegamma->get_active(); pp->icm.gammaOnInput = igamma->get_active (); - + pp->icm.gampos =(double) g_ampos->getValue(); + pp->icm.slpos =(double) s_lpos->getValue(); + if (pedited) { pedited->icm.input = !iunchanged->get_active (); pedited->icm.working = wnames->get_active_text()!=M("GENERAL_UNCHANGED"); pedited->icm.output = onames->get_active_text()!=M("GENERAL_UNCHANGED"); pedited->icm.gammaOnInput = !ifromfile->get_active (); pedited->icm.gamma = wgamma->get_active_text()!=M("GENERAL_UNCHANGED"); + pedited->icm.freegamma =!freegamma->get_inconsistent(); + pedited->icm.gampos = g_ampos->getEditedState (); + pedited->icm.slpos = s_lpos->getEditedState (); + + } +} +void ICMPanel::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { + g_ampos->setDefault (defParams->icm.gampos); + s_lpos->setDefault (defParams->icm.slpos); + + if (pedited) { + g_ampos->setDefaultEditedState (pedited->icm.gampos ? Edited : UnEdited); + s_lpos->setDefaultEditedState (pedited->icm.slpos ? Edited : UnEdited); + + } + else { + g_ampos->setDefaultEditedState (Irrelevant); + s_lpos->setDefaultEditedState (Irrelevant); + + } + } +void ICMPanel::adjusterChanged (Adjuster* a, double newval) { + + if (listener && freegamma->get_active()) { + + Glib::ustring costr = Glib::ustring::format ((int)a->getValue()); + + if (a==g_ampos) + listener->panelChanged (EvGAMPOS, costr); + else if (a==s_lpos) + listener->panelChanged (EvSLPOS, costr); } } @@ -242,13 +312,13 @@ void ICMPanel::wpChanged () { if (listener) listener->panelChanged (EvWProfile, wnames->get_active_text ()); } + void ICMPanel::gpChanged () { if (listener) {listener->panelChanged (EvGAMMA, wgamma->get_active_text ()); - onames->set_sensitive(wgamma->get_active_row_number()==0); //"default"//thanks to Michael + onames->set_sensitive(wgamma->get_active_row_number()==0); //"default" } - } void ICMPanel::ipChanged () { @@ -276,6 +346,33 @@ void ICMPanel::ipChanged () { oldip = profname; } +void ICMPanel::GamChanged() { + if (batchMode) { + if (freegamma->get_inconsistent()) { + freegamma->set_inconsistent (false); + gamcsconn.block (true); + freegamma->set_active (false); + gamcsconn.block (false); + } + else if (lastgamfree) + freegamma->set_inconsistent (true); + + lastgamfree = freegamma->get_active (); + } + + if (listener) { + if (freegamma->get_active()){ + listener->panelChanged (EvGAMFREE, M("GENERAL_ENABLED")); + onames->set_sensitive(!freegamma->get_active());//disabled choice + wgamma->set_sensitive(!freegamma->get_active()); + } + else { + listener->panelChanged (EvGAMFREE, M("GENERAL_DISABLED")); + onames->set_sensitive(!freegamma->get_active() && wgamma->get_active_row_number()==0); + wgamma->set_sensitive(!freegamma->get_active()); + } + } +} void ICMPanel::opChanged () { @@ -334,6 +431,9 @@ void ICMPanel::setBatchMode (bool batchMode) { onames->append_text (M("GENERAL_UNCHANGED")); wnames->append_text (M("GENERAL_UNCHANGED")); wgamma->append_text (M("GENERAL_UNCHANGED")); + g_ampos->showEditedCB (); + s_lpos->showEditedCB (); + } diff --git a/rtgui/icmpanel.h b/rtgui/icmpanel.h index 30c500aa9..c8ae03ae5 100644 --- a/rtgui/icmpanel.h +++ b/rtgui/icmpanel.h @@ -20,6 +20,8 @@ #define _ICMPANEL_ #include +#include + #include class ICMPanelListener { @@ -28,10 +30,18 @@ class ICMPanelListener { virtual void saveInputICCReference (Glib::ustring fname) {} }; -class ICMPanel : public Gtk::VBox, public FoldableToolPanel { +class ICMPanel : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel { + protected: + Adjuster* g_ampos; + Adjuster* s_lpos; + bool lastgamfree; + sigc::connection gamcsconn; + //bool freegamma; private: - Gtk::RadioButton* inone; + Gtk::CheckButton* freegamma; + Gtk::RadioButton* inone; + Gtk::RadioButton* iembedded; Gtk::RadioButton* icamera; Gtk::RadioButton* ifromfile; @@ -56,12 +66,14 @@ class ICMPanel : public Gtk::VBox, public FoldableToolPanel { void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited=NULL); void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL); void setBatchMode (bool batchMode); - + void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL); + void adjusterChanged (Adjuster* a, double newval); + void wpChanged (); void opChanged (); void ipChanged (); void gpChanged (); - + void GamChanged (); void ipSelectionChanged (); void setRaw (bool raw); diff --git a/rtgui/options.cc b/rtgui/options.cc index 12a9cad46..a2e2125f5 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -152,8 +152,8 @@ void Options::setDefaults () { rtSettings.monitorProfile = ""; rtSettings.autoMonitorProfile = false; rtSettings.LCMSSafeMode = true; - rtSettings.adobe = "AdobeRGB1998"; - rtSettings.prophoto = "ProPhoto"; + rtSettings.adobe = "AdobeRGB1998"; // put the name of yours profiles (here windows) + rtSettings.prophoto = "ProPhoto"; // these names appear in the menu "output profile" rtSettings.widegamut = "WideGamutRGB"; rtSettings.srgb = "sRGB Color Space Profile"; rtSettings.bruce = "Bruce"; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index a5cb644b8..2fffebd62 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -140,6 +140,10 @@ void ParamsEdited::set (bool v) { icm.gammaOnInput = v; icm.working = v; icm.output = v; + icm.gamma = v; + icm.freegamma = v; + icm.gampos = v; + icm.slpos = v; raw.ccSteps = v; raw.dmethod = v; raw.dcbIterations = v; @@ -301,6 +305,10 @@ void ParamsEdited::initFrom (const std::vector icm.gammaOnInput = icm.gammaOnInput && p.icm.gammaOnInput == other.icm.gammaOnInput; icm.working = icm.working && p.icm.working == other.icm.working; icm.output = icm.output && p.icm.output == other.icm.output; + icm.gamma = icm.gamma && p.icm.gamma == other.icm.gamma; + icm.freegamma = icm.freegamma && p.icm.freegamma == other.icm.freegamma; + icm.gampos = icm.gampos && p.icm.gampos == other.icm.gampos; + icm.slpos = icm.slpos && p.icm.slpos == other.icm.slpos; raw.ccSteps = raw.ccSteps && p.raw.ccSteps == other.raw.ccSteps; raw.dcbEnhance = raw.dcbEnhance && p.raw.dcb_enhance == other.raw.dcb_enhance; raw.dcbIterations = raw.dcbIterations && p.raw.dcb_iterations == other.raw.dcb_iterations; @@ -454,6 +462,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (icm.gammaOnInput) toEdit.icm.gammaOnInput = mods.icm.gammaOnInput; if (icm.working) toEdit.icm.working = mods.icm.working; if (icm.output) toEdit.icm.output = mods.icm.output; + if (icm.gampos) toEdit.icm.gampos = mods.icm.gampos; + if (icm.slpos) toEdit.icm.slpos = mods.icm.slpos; + if (icm.gamma) toEdit.icm.gamma = mods.icm.gamma; + if (icm.freegamma) toEdit.icm.freegamma = mods.icm.freegamma; if (raw.ccSteps) toEdit.raw.ccSteps = mods.raw.ccSteps; if (raw.dmethod) toEdit.raw.dmethod = mods.raw.dmethod; if (raw.dcbIterations) toEdit.raw.dcb_iterations = mods.raw.dcb_iterations; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 7fc9701db..1bdcd42dd 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -251,6 +251,10 @@ class ColorManagementParamsEdited { bool working; bool output; bool gamma; + bool gampos; + bool slpos; + bool gamfree; + bool freegamma; }; class EqualizerParamsEdited {