Linked red and blue exponent adjuster to the green adjuster, in order to maintain the ratio between exponents if the user moves the green adjuster (master).

Switched back to vector sort for median calculations: the results of the histogram search function diverge more and more from the simple median calculation as the exponents increase.
At 2.0 the test picture is already impossible to WB as the multipliers are too far off (2.78226e+08 histo vs 9.7927e+11 sort), and the normal WB sliders can't compensate for those huge factors.
This commit is contained in:
rom9
2019-06-10 22:05:54 +02:00
parent 91565728e5
commit b95bdb1aea
3 changed files with 36 additions and 15 deletions

View File

@@ -34,7 +34,7 @@ FilmNegative::FilmNegative () : FoldableToolPanel(this, "filmnegative", M("TP_FI
{
auto mkExponentAdjuster = [this](Glib::ustring label, double defaultVal) {
Adjuster *adj = Gtk::manage(new Adjuster (label, 0.3, 3, 0.01, defaultVal)); //exponent
Adjuster *adj = Gtk::manage(new Adjuster (label, 0.3, 5, 0.001, defaultVal)); //exponent
adj->setAdjusterListener (this);
if (adj->delay < options.adjusterMaxDelay) {
@@ -49,6 +49,9 @@ FilmNegative::FilmNegative () : FoldableToolPanel(this, "filmnegative", M("TP_FI
greenExp = mkExponentAdjuster(M("TP_FILMNEGATIVE_GREEN"), 1.0);
blueExp = mkExponentAdjuster(M("TP_FILMNEGATIVE_BLUE"), 0.86);
redRatio = redExp->getValue() / greenExp->getValue();
blueRatio = blueExp->getValue() / greenExp->getValue();
auto m = ProcEventMapper::getInstance();
EvFilmNegativeEnabled = m->newEvent(ALL, "HISTORY_MSG_FILMNEGATIVE_ENABLED");
EvFilmNegativeExponents = m->newEvent(ALL, "HISTORY_MSG_FILMNEGATIVE_EXPONENTS");
@@ -139,10 +142,23 @@ void FilmNegative::enabledChanged()
void FilmNegative::adjusterChanged(Adjuster* a, double newval)
{
if (listener && getEnabled()) {
if (listener) {
if(a == redExp || a == greenExp || a == blueExp) {
listener->panelChanged (EvFilmNegativeExponents, Glib::ustring::compose (
"R=%1 ; G=%2 ; B=%3", redExp->getTextValue(), greenExp->getTextValue(), blueExp->getTextValue()));
disableListener();
if(a == greenExp) {
redExp->setValue(a->getValue() * redRatio);
blueExp->setValue(a->getValue() * blueRatio);
} else if(a == redExp) {
redRatio = newval / greenExp->getValue();
} else if(a == blueExp) {
blueRatio = newval / greenExp->getValue();
}
enableListener();
if(getEnabled()) {
listener->panelChanged (EvFilmNegativeExponents, Glib::ustring::compose (
"R=%1 ; G=%2 ; B=%3", redExp->getTextValue(), greenExp->getTextValue(), blueExp->getTextValue()));
}
}
}
}

View File

@@ -54,6 +54,8 @@ private:
Gtk::ToggleButton* spotbutton;
sigc::connection spotConn;
double redRatio, blueRatio;
void editToggled ();
public: