Fixed Auto Levels Clip malfunction issue 2104
This commit is contained in:
@@ -44,10 +44,10 @@ ToneCurve::ToneCurve () : Gtk::VBox(), FoldableToolPanel(this) {
|
||||
autoconn = autolevels->signal_toggled().connect( sigc::mem_fun(*this, &ToneCurve::autolevels_toggled) );
|
||||
|
||||
sclip = Gtk::manage (new MySpinButton ());
|
||||
sclip->set_range (0.0, 0.9999);
|
||||
sclip->set_increments (0.001, 0.01);
|
||||
sclip->set_value (0.002);
|
||||
sclip->set_digits (4);
|
||||
sclip->set_range (0.0, 0.99);
|
||||
sclip->set_increments (0.01, 0.01);
|
||||
sclip->set_value (0.02);
|
||||
sclip->set_digits (2);
|
||||
sclip->set_tooltip_text (M("TP_EXPOSURE_CLIP_TIP"));
|
||||
sclip->signal_value_changed().connect( sigc::mem_fun(*this, &ToneCurve::clip_changed) );
|
||||
|
||||
@@ -64,16 +64,56 @@ ToneCurve::ToneCurve () : Gtk::VBox(), FoldableToolPanel(this) {
|
||||
abox->pack_end (*Gtk::manage (new Gtk::Label (M("TP_EXPOSURE_CLIP"))));
|
||||
pack_start (*abox);
|
||||
|
||||
pack_start (*Gtk::manage (new Gtk::HSeparator()));
|
||||
|
||||
//----------- Exposure Compensation ------------------------
|
||||
expcomp = Gtk::manage (new Adjuster (M("TP_EXPOSURE_EXPCOMP"), -5, 10, 0.05, 0));
|
||||
pack_start (*expcomp);
|
||||
hlcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 0));
|
||||
pack_start (*hlcompr);
|
||||
hlcomprthresh = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33));
|
||||
pack_start (*hlcomprthresh);
|
||||
pack_start (*Gtk::manage (new Gtk::Label (" "))); //spacer
|
||||
pack_start (*Gtk::manage (new Gtk::HSeparator()));
|
||||
|
||||
//--------------HLRecovery from HLREC and Hl compress
|
||||
hlrbox = Gtk::manage (new Gtk::HBox ());
|
||||
hlrbox->set_border_width (2);
|
||||
|
||||
Gtk::Label* hlrLabel = Gtk::manage (new Gtk::Label (M("TP_HLREC_LABEL")));
|
||||
|
||||
hrenabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLE")));
|
||||
|
||||
hrenabled->set_active (false);
|
||||
hrenabled->set_tooltip_markup (M("TP_HLREC_ENA_TOOLTIP"));
|
||||
hlrbox->pack_start (*hlrLabel,Gtk::PACK_SHRINK);
|
||||
|
||||
hlrbox->pack_end (*hrenabled, Gtk::PACK_SHRINK);
|
||||
hlrbox->pack_end (*Gtk::manage (new Gtk::Label (" "))); //spacer
|
||||
|
||||
pack_start (*hlrbox);
|
||||
|
||||
|
||||
method = Gtk::manage (new MyComboBoxText ());
|
||||
method->append_text (M("TP_HLREC_LUMINANCE"));
|
||||
method->append_text (M("TP_HLREC_CIELAB"));
|
||||
method->append_text (M("TP_HLREC_COLOR"));
|
||||
method->append_text (M("TP_HLREC_BLEND"));
|
||||
|
||||
method->set_active (0);
|
||||
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
|
||||
Gtk::Label* lab = Gtk::manage (new Gtk::Label (M("TP_HLREC_METHOD")));
|
||||
hb->pack_start (*lab, Gtk::PACK_SHRINK, 4);
|
||||
hb->pack_start (*method);
|
||||
pack_start (*hb);
|
||||
|
||||
enaconn = hrenabled->signal_toggled().connect( sigc::mem_fun(*this, &ToneCurve::hrenabledChanged) );
|
||||
methconn = method->signal_changed().connect ( sigc::mem_fun(*this, &ToneCurve::methodChanged) );
|
||||
pack_start (*Gtk::manage (new Gtk::Label (" "))); //spacer
|
||||
pack_start (*Gtk::manage (new Gtk::HSeparator()));
|
||||
|
||||
hlcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 0));
|
||||
pack_start (*hlcompr);
|
||||
hlcomprthresh = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33));
|
||||
pack_start (*hlcomprthresh);
|
||||
|
||||
|
||||
|
||||
//----------- Black Level ----------------------------------
|
||||
black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 50, 0));
|
||||
pack_start (*black);
|
||||
@@ -202,8 +242,28 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||
if (!pedited->toneCurve.curveMode2) {
|
||||
toneCurveMode2->set_active(4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (pedited)
|
||||
hrenabled->set_inconsistent (!pedited->toneCurve.hrenabled);
|
||||
enaconn.block (true);
|
||||
hrenabled->set_active (pp->toneCurve.hrenabled);
|
||||
enaconn.block (false);
|
||||
|
||||
if (pedited && !pedited->toneCurve.method)
|
||||
method->set_active (4);
|
||||
else if (pp->toneCurve.method=="Luminance")
|
||||
method->set_active (0);
|
||||
else if (pp->toneCurve.method=="CIELab blending")
|
||||
method->set_active (1);
|
||||
else if (pp->toneCurve.method=="Color")
|
||||
method->set_active (2);
|
||||
else if (pp->toneCurve.method=="Blend")
|
||||
method->set_active (3);
|
||||
|
||||
lasthrEnabled = pp->toneCurve.hrenabled;
|
||||
|
||||
autoconn.block (false);
|
||||
tcmode2conn.block(false);
|
||||
tcmodeconn.block(false);
|
||||
@@ -215,6 +275,22 @@ void ToneCurve::autoOpenCurve () {
|
||||
shape->openIfNonlinear();
|
||||
shape2->openIfNonlinear();
|
||||
}
|
||||
int HLChangedUI (void* data) {
|
||||
GThreadLock lock;
|
||||
(static_cast<ToneCurve*>(data))->HLComputed_ ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ToneCurve::HLChanged (bool hlrbool){
|
||||
nexthlrbool= hlrbool;
|
||||
g_idle_add (HLChangedUI, this);
|
||||
}
|
||||
bool ToneCurve::HLComputed_ () {
|
||||
enaconn.block (true);
|
||||
hrenabled->set_active (nexthlrbool);
|
||||
enaconn.block (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
|
||||
@@ -260,8 +336,69 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) {
|
||||
pedited->toneCurve.curveMode = toneCurveMode->get_active_row_number() != 4;
|
||||
pedited->toneCurve.curveMode2 = toneCurveMode2->get_active_row_number() != 4;
|
||||
}
|
||||
if (pedited) {
|
||||
pedited->toneCurve.method = method->get_active_row_number()!=4;
|
||||
pedited->toneCurve.hrenabled = !hrenabled->get_inconsistent();
|
||||
}
|
||||
|
||||
pp->toneCurve.hrenabled = hrenabled->get_active();
|
||||
if (method->get_active_row_number()==0)
|
||||
pp->toneCurve.method = "Luminance";
|
||||
else if (method->get_active_row_number()==1)
|
||||
pp->toneCurve.method = "CIELab blending";
|
||||
else if (method->get_active_row_number()==2)
|
||||
pp->toneCurve.method = "Color";
|
||||
else if (method->get_active_row_number()==3)
|
||||
pp->toneCurve.method = "Blend";
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ToneCurve::hrenabledChanged () {
|
||||
|
||||
if (batchMode) {
|
||||
if (hrenabled->get_inconsistent()) {
|
||||
hrenabled->set_inconsistent (false);
|
||||
enaconn.block (true);
|
||||
hrenabled->set_active (false);
|
||||
enaconn.block (false);
|
||||
}
|
||||
else if (lasthrEnabled)
|
||||
hrenabled->set_inconsistent (true);
|
||||
|
||||
lasthrEnabled = hrenabled->get_active ();
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
if (hrenabled->get_active ()){
|
||||
listener->panelChanged (EvHREnabled, M("GENERAL_ENABLED"));
|
||||
}
|
||||
else { // Switch off auto exposure if user changes enabled manually
|
||||
if (autolevels->get_active() ) {
|
||||
autoconn.block(true);
|
||||
autolevels->set_active (false);
|
||||
autoconn.block(false);
|
||||
autolevels->set_inconsistent (false);
|
||||
}
|
||||
listener->panelChanged (EvHREnabled, M("GENERAL_DISABLED"));}
|
||||
}
|
||||
}
|
||||
void ToneCurve::methodChanged () {
|
||||
|
||||
if (listener) {
|
||||
if (hrenabled->get_active ())
|
||||
listener->panelChanged (EvHRMethod, method->get_active_text ());
|
||||
}
|
||||
}
|
||||
void ToneCurve::setRaw (bool raw) {
|
||||
|
||||
disableListener ();
|
||||
method->set_sensitive (raw);
|
||||
hrenabled->set_sensitive (raw);
|
||||
enableListener ();
|
||||
}
|
||||
|
||||
|
||||
void ToneCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
|
||||
|
||||
expcomp->setDefault (defParams->toneCurve.expcomp);
|
||||
@@ -365,7 +502,7 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) {
|
||||
}
|
||||
|
||||
void ToneCurve::neutral_pressed () {
|
||||
// This method deselects auto levels
|
||||
// This method deselects auto levels and HL reconstruction auto
|
||||
// and sets neutral values to params in exposure panel
|
||||
|
||||
if (batchMode) {
|
||||
@@ -387,6 +524,7 @@ void ToneCurve::neutral_pressed () {
|
||||
brightness->setValue(0);
|
||||
black->setValue(0);
|
||||
shcompr->setValue(50);
|
||||
hrenabled->set_active (false);
|
||||
if (!black->getAddMode()) shcompr->set_sensitive(!((int)black->getValue ()==0)); //at black=0 shcompr value has no effect
|
||||
contrast->setValue(0);
|
||||
//saturation->setValue(0);
|
||||
@@ -425,6 +563,7 @@ void ToneCurve::autolevels_toggled () {
|
||||
hlcompr->setValue (0);
|
||||
if (hlcomprthresh->getAddMode())
|
||||
hlcomprthresh->setValue (0);
|
||||
|
||||
if (listener) {
|
||||
if (!autolevels->get_inconsistent()) {
|
||||
if (autolevels->get_active ())
|
||||
@@ -529,6 +668,11 @@ bool ToneCurve::autoExpComputed_ () {
|
||||
}
|
||||
|
||||
void ToneCurve::setBatchMode (bool batchMode) {
|
||||
//from HLrecovery
|
||||
ToolPanel::setBatchMode (batchMode);
|
||||
method->append_text (M("GENERAL_UNCHANGED"));
|
||||
//---------------
|
||||
|
||||
|
||||
removeIfThere (abox, autolevels, false);
|
||||
autolevels = Gtk::manage (new Gtk::CheckButton (M("TP_EXPOSURE_AUTOLEVELS")));
|
||||
|
Reference in New Issue
Block a user