merge with dev
This commit is contained in:
@@ -11,6 +11,24 @@ using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int ID_LABREGION_HUE = 5;
|
||||
|
||||
inline bool hasMask(const std::vector<double> &dflt, const std::vector<double> &mask)
|
||||
{
|
||||
return !(mask.empty() || mask[0] == FCT_Linear || mask == dflt);
|
||||
}
|
||||
|
||||
|
||||
inline float round_ab(float v)
|
||||
{
|
||||
return int(v * 1000) / 1000.f;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLORTONING_LABEL"), false, true)
|
||||
{
|
||||
nextbw = 0;
|
||||
@@ -25,6 +43,7 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR
|
||||
method->append (M("TP_COLORTONING_SPLITCOCO"));
|
||||
method->append (M("TP_COLORTONING_SPLITLR"));
|
||||
method->append(M("TP_COLORTONING_LABGRID"));
|
||||
method->append(M("TP_COLORTONING_LABREGIONS"));
|
||||
method->set_active (0);
|
||||
method->set_tooltip_text (M("TP_COLORTONING_METHOD_TOOLTIP"));
|
||||
|
||||
@@ -320,22 +339,114 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR
|
||||
// LAB grid
|
||||
auto m = ProcEventMapper::getInstance();
|
||||
EvColorToningLabGridValue = m->newEvent(RGBCURVE, "HISTORY_MSG_COLORTONING_LABGRID_VALUE");
|
||||
labgridBox = Gtk::manage(new Gtk::HBox());
|
||||
labgrid = Gtk::manage(new LabGrid(EvColorToningLabGridValue));
|
||||
labgridBox->pack_start(*labgrid, true, true);
|
||||
labgridReset = Gtk::manage(new Gtk::Button ());
|
||||
labgridReset->add (*Gtk::manage(new RTImage ("undo-small.png", "redo-small.png")));
|
||||
setExpandAlignProperties(labgridReset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START);
|
||||
labgridReset->set_relief(Gtk::RELIEF_NONE);
|
||||
labgridReset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT"));
|
||||
labgridReset->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
|
||||
labgridReset->set_can_focus(false);
|
||||
labgridReset->set_size_request(-1, 20);
|
||||
labgridReset->signal_button_release_event().connect(sigc::mem_fun(*this, &ColorToning::resetPressed));
|
||||
labgridBox->pack_start(*labgridReset, false, false);
|
||||
pack_start(*labgridBox, Gtk::PACK_EXPAND_WIDGET, 4);
|
||||
labgrid = Gtk::manage(new LabGrid(EvColorToningLabGridValue, M("TP_COLORTONING_LABGRID_VALUES")));
|
||||
pack_start(*labgrid, Gtk::PACK_EXPAND_WIDGET, 4);
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// LAB regions
|
||||
|
||||
const auto add_button =
|
||||
[&](Gtk::Button *btn, Gtk::Box *box) -> void
|
||||
{
|
||||
setExpandAlignProperties(btn, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START);
|
||||
btn->set_relief(Gtk::RELIEF_NONE);
|
||||
btn->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
|
||||
btn->set_can_focus(false);
|
||||
btn->set_size_request(-1, 20);
|
||||
box->pack_start(*btn, false, false);
|
||||
};
|
||||
|
||||
EvLabRegionList = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_LIST");
|
||||
EvLabRegionAB = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_AB");
|
||||
EvLabRegionSaturation = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_SATURATION");
|
||||
EvLabRegionLightness = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_LIGHTNESS");
|
||||
EvLabRegionHueMask = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_HUEMASK");
|
||||
EvLabRegionChromaticityMask = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_CHROMATICITYMASK");
|
||||
EvLabRegionLightnessMask = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_LIGHTNESSMASK");
|
||||
EvLabRegionShowMask = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_COLORTONING_LABREGION_SHOWMASK");
|
||||
labRegionBox = Gtk::manage(new Gtk::VBox());
|
||||
|
||||
labRegionList = Gtk::manage(new Gtk::ListViewText(3));
|
||||
labRegionList->set_size_request(-1, 100);
|
||||
labRegionList->set_can_focus(false);
|
||||
labRegionList->set_column_title(0, "#");
|
||||
labRegionList->set_column_title(1, M("TP_COLORTONING_LABREGION_LIST_TITLE"));
|
||||
labRegionList->set_column_title(2, M("TP_COLORTONING_LABREGION_MASK"));
|
||||
labRegionList->set_activate_on_single_click(true);
|
||||
labRegionSelectionConn = labRegionList->get_selection()->signal_changed().connect(sigc::mem_fun(this, &ColorToning::onLabRegionSelectionChanged));
|
||||
Gtk::HBox *hb = Gtk::manage(new Gtk::HBox());
|
||||
hb->pack_start(*labRegionList, Gtk::PACK_EXPAND_WIDGET);
|
||||
Gtk::VBox *vb = Gtk::manage(new Gtk::VBox());
|
||||
labRegionAdd = Gtk::manage(new Gtk::Button());
|
||||
labRegionAdd->add(*Gtk::manage(new RTImage("add-small.png")));
|
||||
labRegionAdd->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionAddPressed));
|
||||
add_button(labRegionAdd, vb);
|
||||
labRegionRemove = Gtk::manage(new Gtk::Button());
|
||||
labRegionRemove->add(*Gtk::manage(new RTImage("remove-small.png")));
|
||||
labRegionRemove->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionRemovePressed));
|
||||
add_button(labRegionRemove, vb);
|
||||
labRegionUp = Gtk::manage(new Gtk::Button());
|
||||
labRegionUp->add(*Gtk::manage(new RTImage("arrow-up-small.png")));
|
||||
labRegionUp->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionUpPressed));
|
||||
add_button(labRegionUp, vb);
|
||||
labRegionDown = Gtk::manage(new Gtk::Button());
|
||||
labRegionDown->add(*Gtk::manage(new RTImage("arrow-down-small.png")));
|
||||
labRegionDown->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionDownPressed));
|
||||
add_button(labRegionDown, vb);
|
||||
hb->pack_start(*vb, Gtk::PACK_SHRINK);
|
||||
labRegionBox->pack_start(*hb, true, true);
|
||||
|
||||
labRegionAB = Gtk::manage(new LabGrid(EvLabRegionAB, M("TP_COLORTONING_LABREGION_ABVALUES"), false));
|
||||
labRegionBox->pack_start(*labRegionAB);
|
||||
|
||||
labRegionSaturation = Gtk::manage(new Adjuster(M("TP_COLORTONING_LABREGION_SATURATION"), -100, 100, 1, 0));
|
||||
labRegionSaturation->setAdjusterListener(this);
|
||||
labRegionBox->pack_start(*labRegionSaturation);
|
||||
labRegionLightness = Gtk::manage(new Adjuster(M("TP_COLORTONING_LABREGION_LIGHTNESS"), -100, 100, 1, 0));
|
||||
labRegionLightness->setAdjusterListener(this);
|
||||
labRegionBox->pack_start(*labRegionLightness);
|
||||
|
||||
CurveEditorGroup *labRegionEditorG = Gtk::manage(new CurveEditorGroup(options.lastColorToningCurvesDir, M("TP_COLORTONING_LABREGION_MASK")));
|
||||
labRegionEditorG->setCurveListener(this);
|
||||
|
||||
labRegionHueMask = static_cast<FlatCurveEditor *>(labRegionEditorG->addCurve(CT_Flat, M("TP_COLORTONING_LABREGION_HUEMASK"), nullptr, false, true));
|
||||
labRegionHueMask->setIdentityValue(0.);
|
||||
labRegionHueMask->setResetCurve(FlatCurveType(default_params.labregions[0].hueMask[0]), default_params.labregions[0].hueMask);
|
||||
labRegionHueMask->setCurveColorProvider(this, ID_LABREGION_HUE);
|
||||
labRegionHueMask->setBottomBarColorProvider(this, ID_LABREGION_HUE);
|
||||
labRegionHueMask->setEditID(EUID_Lab_HHCurve, BT_SINGLEPLANE_FLOAT);
|
||||
|
||||
labRegionChromaticityMask = static_cast<FlatCurveEditor *>(labRegionEditorG->addCurve(CT_Flat, M("TP_COLORTONING_LABREGION_CHROMATICITYMASK"), nullptr, false, false));
|
||||
labRegionChromaticityMask->setIdentityValue(0.);
|
||||
labRegionChromaticityMask->setResetCurve(FlatCurveType(default_params.labregions[0].chromaticityMask[0]), default_params.labregions[0].chromaticityMask);
|
||||
labRegionChromaticityMask->setBottomBarColorProvider(this, ID_LABREGION_HUE+1);
|
||||
labRegionChromaticityMask->setEditID(EUID_Lab_CCurve, BT_SINGLEPLANE_FLOAT);
|
||||
|
||||
labRegionLightnessMask = static_cast<FlatCurveEditor *>(labRegionEditorG->addCurve(CT_Flat, M("TP_COLORTONING_LABREGION_LIGHTNESSMASK"), nullptr, false, false));
|
||||
labRegionLightnessMask->setIdentityValue(0.);
|
||||
labRegionLightnessMask->setResetCurve(FlatCurveType(default_params.labregions[0].lightnessMask[0]), default_params.labregions[0].lightnessMask);
|
||||
labRegionLightnessMask->setBottomBarBgGradient(milestones);
|
||||
labRegionLightnessMask->setEditID(EUID_Lab_LCurve, BT_SINGLEPLANE_FLOAT);
|
||||
|
||||
labRegionData = default_params.labregions;
|
||||
labRegionSelected = 0;
|
||||
{
|
||||
auto n = labRegionList->append("1");
|
||||
labRegionList->set_text(n, 1, "a=0 b=0 s=0 l=0");
|
||||
}
|
||||
|
||||
labRegionEditorG->curveListComplete();
|
||||
labRegionEditorG->show();
|
||||
labRegionBox->pack_start(*labRegionEditorG, Gtk::PACK_SHRINK, 2);
|
||||
|
||||
labRegionShowMask = Gtk::manage(new Gtk::CheckButton(M("TP_COLORTONING_LABREGION_SHOWMASK")));
|
||||
labRegionShowMask->signal_toggled().connect(sigc::mem_fun(*this, &ColorToning::labRegionShowMaskChanged));
|
||||
labRegionBox->pack_start(*labRegionShowMask, Gtk::PACK_SHRINK, 4);
|
||||
|
||||
pack_start(*labRegionBox, Gtk::PACK_EXPAND_WIDGET, 4);
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
show_all();
|
||||
|
||||
disableListener();
|
||||
@@ -358,6 +469,7 @@ void ColorToning::setListener(ToolPanelListener *tpl)
|
||||
{
|
||||
ToolPanel::setListener(tpl);
|
||||
labgrid->setListener(tpl);
|
||||
labRegionAB->setListener(tpl);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -409,6 +521,20 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
clshape->setCurve (pp->colorToning.clcurve);
|
||||
cl2shape->setCurve (pp->colorToning.cl2curve);
|
||||
|
||||
labRegionData = pp->colorToning.labregions;
|
||||
if (labRegionData.empty()) {
|
||||
labRegionData.emplace_back(rtengine::ColorToningParams::LabCorrectionRegion());
|
||||
}
|
||||
if (pp->colorToning.labregionsShowMask >= 0) {
|
||||
labRegionSelected = pp->colorToning.labregionsShowMask;
|
||||
labRegionShowMask->set_active(true);
|
||||
} else {
|
||||
labRegionSelected = 0;
|
||||
labRegionShowMask->set_active(false);
|
||||
}
|
||||
labRegionPopulateList();
|
||||
labRegionShow(labRegionSelected);
|
||||
|
||||
if (pedited) {
|
||||
redlow->setEditedState (pedited->colorToning.redlow ? Edited : UnEdited);
|
||||
greenlow->setEditedState (pedited->colorToning.greenlow ? Edited : UnEdited);
|
||||
@@ -433,6 +559,9 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
lumamode->set_inconsistent (!pedited->colorToning.lumamode);
|
||||
|
||||
labgrid->setEdited(pedited->colorToning.labgridALow || pedited->colorToning.labgridBLow || pedited->colorToning.labgridAHigh || pedited->colorToning.labgridBHigh);
|
||||
|
||||
labRegionAB->setEdited(pedited->colorToning.labregions);
|
||||
labRegionShowMask->set_inconsistent(!pedited->colorToning.labregionsShowMask);
|
||||
}
|
||||
|
||||
redlow->setValue (pp->colorToning.redlow);
|
||||
@@ -464,7 +593,7 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
|
||||
lastLumamode = pp->colorToning.lumamode;
|
||||
|
||||
labgrid->setParams(pp->colorToning.labgridALow, pp->colorToning.labgridBLow, pp->colorToning.labgridAHigh, pp->colorToning.labgridBHigh, false);
|
||||
labgrid->setParams(pp->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, pp->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX, false);
|
||||
|
||||
if (pedited && !pedited->colorToning.method) {
|
||||
method->set_active (5);
|
||||
@@ -480,6 +609,8 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
|
||||
method->set_active (4);
|
||||
} else if (pp->colorToning.method == "LabGrid") {
|
||||
method->set_active(5);
|
||||
} else if (pp->colorToning.method == "LabRegions") {
|
||||
method->set_active(6);
|
||||
}
|
||||
|
||||
methodChanged();
|
||||
@@ -533,6 +664,19 @@ void ColorToning::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
pp->colorToning.strength = strength->getIntValue();
|
||||
|
||||
labgrid->getParams(pp->colorToning.labgridALow, pp->colorToning.labgridBLow, pp->colorToning.labgridAHigh, pp->colorToning.labgridBHigh);
|
||||
pp->colorToning.labgridALow *= ColorToningParams::LABGRID_CORR_MAX;
|
||||
pp->colorToning.labgridAHigh *= ColorToningParams::LABGRID_CORR_MAX;
|
||||
pp->colorToning.labgridBLow *= ColorToningParams::LABGRID_CORR_MAX;
|
||||
pp->colorToning.labgridBHigh *= ColorToningParams::LABGRID_CORR_MAX;
|
||||
|
||||
labRegionGet(labRegionSelected);
|
||||
labRegionShow(labRegionSelected, true);
|
||||
pp->colorToning.labregions = labRegionData;
|
||||
if (labRegionShowMask->get_active()) {
|
||||
pp->colorToning.labregionsShowMask = labRegionSelected;
|
||||
} else {
|
||||
pp->colorToning.labregionsShowMask = -1;
|
||||
}
|
||||
|
||||
if (pedited) {
|
||||
pedited->colorToning.redlow = redlow->getEditedState ();
|
||||
@@ -560,6 +704,9 @@ void ColorToning::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
pedited->colorToning.shadowsColSat = shadowsColSat->getEditedState ();
|
||||
|
||||
pedited->colorToning.labgridALow = pedited->colorToning.labgridBLow = pedited->colorToning.labgridAHigh = pedited->colorToning.labgridBHigh = labgrid->getEdited();
|
||||
|
||||
pedited->colorToning.labregions = labRegionAB->getEdited();
|
||||
pedited->colorToning.labregionsShowMask = !labRegionShowMask->get_inconsistent();
|
||||
}
|
||||
|
||||
if (method->get_active_row_number() == 0) {
|
||||
@@ -574,6 +721,8 @@ void ColorToning::write (ProcParams* pp, ParamsEdited* pedited)
|
||||
pp->colorToning.method = "Splitlr";
|
||||
} else if (method->get_active_row_number() == 5) {
|
||||
pp->colorToning.method = "LabGrid";
|
||||
} else if (method->get_active_row_number() == 6) {
|
||||
pp->colorToning.method = "LabRegions";
|
||||
}
|
||||
|
||||
if (twocolor->get_active_row_number() == 0) {
|
||||
@@ -630,7 +779,8 @@ void ColorToning::setDefaults (const ProcParams* defParams, const ParamsEdited*
|
||||
hlColSat->setDefault<int> (defParams->colorToning.hlColSat);
|
||||
shadowsColSat->setDefault<int> (defParams->colorToning.shadowsColSat);
|
||||
strength->setDefault (defParams->colorToning.strength);
|
||||
labgrid->setDefault(defParams->colorToning.labgridALow, defParams->colorToning.labgridBLow, defParams->colorToning.labgridAHigh, defParams->colorToning.labgridBHigh);
|
||||
labgrid->setDefault(defParams->colorToning.labgridALow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBLow / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridAHigh / ColorToningParams::LABGRID_CORR_MAX, defParams->colorToning.labgridBHigh / ColorToningParams::LABGRID_CORR_MAX);
|
||||
|
||||
|
||||
if (pedited) {
|
||||
redlow->setDefaultEditedState (pedited->colorToning.redlow ? Edited : UnEdited);
|
||||
@@ -649,6 +799,8 @@ void ColorToning::setDefaults (const ProcParams* defParams, const ParamsEdited*
|
||||
shadowsColSat->setDefaultEditedState (pedited->colorToning.shadowsColSat ? Edited : UnEdited);
|
||||
strength->setDefaultEditedState (pedited->colorToning.strength ? Edited : UnEdited);
|
||||
labgrid->setEdited((pedited->colorToning.labgridALow || pedited->colorToning.labgridBLow || pedited->colorToning.labgridAHigh || pedited->colorToning.labgridBHigh) ? Edited : UnEdited);
|
||||
|
||||
labRegionAB->setEdited(pedited->colorToning.labregions ? Edited : UnEdited);
|
||||
} else {
|
||||
redlow->setDefaultEditedState (Irrelevant);
|
||||
greenlow->setDefaultEditedState (Irrelevant);
|
||||
@@ -666,6 +818,7 @@ void ColorToning::setDefaults (const ProcParams* defParams, const ParamsEdited*
|
||||
shadowsColSat->setDefaultEditedState (Irrelevant);
|
||||
strength->setDefaultEditedState (Irrelevant);
|
||||
labgrid->setEdited(Edited);
|
||||
labRegionAB->setEdited(Edited);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +966,8 @@ void ColorToning::methodChanged ()
|
||||
{
|
||||
|
||||
if (!batchMode) {
|
||||
labgridBox->hide();
|
||||
labgrid->hide();
|
||||
labRegionBox->hide();
|
||||
|
||||
if (method->get_active_row_number() == 0) { // Lab
|
||||
colorSep->show();
|
||||
@@ -962,7 +1116,7 @@ void ColorToning::methodChanged ()
|
||||
chanMixerBox->hide();
|
||||
neutrHBox->hide();
|
||||
lumamode->show();
|
||||
} else if (method->get_active_row_number() == 5) { // Lab Grid
|
||||
} else if (method->get_active_row_number() == 5 || method->get_active_row_number() == 6) { // Lab Grid or Lab Regions
|
||||
colorSep->hide();
|
||||
colorCurveEditorG->hide();
|
||||
twocolor->hide();
|
||||
@@ -981,7 +1135,11 @@ void ColorToning::methodChanged ()
|
||||
neutrHBox->hide();
|
||||
lumamode->hide();
|
||||
|
||||
labgridBox->show();
|
||||
if (method->get_active_row_number() == 5) {
|
||||
labgrid->show();
|
||||
} else {
|
||||
labRegionBox->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,6 +1196,17 @@ void ColorToning::colorForValue (double valX, double valY, enum ColorCaller::Ele
|
||||
}
|
||||
} else if (callerId == 4) { // color curve vertical and horizontal crosshair
|
||||
Color::hsv2rgb01(float(valY), 1.0f, 0.5f, R, G, B);
|
||||
} else if (callerId == ID_LABREGION_HUE) {
|
||||
// TODO
|
||||
float x = valX - 1.f/6.f;
|
||||
if (x < 0.f) {
|
||||
x += 1.f;
|
||||
}
|
||||
x = log2lin(x, 3.f);
|
||||
// float x = valX;
|
||||
Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B);
|
||||
} else if (callerId == ID_LABREGION_HUE+1) {
|
||||
Color::hsv2rgb01(float(valY), float(valX), 0.5f, R, G, B);
|
||||
}
|
||||
|
||||
caller->ccRed = double(R);
|
||||
@@ -1057,6 +1226,12 @@ void ColorToning::curveChanged (CurveEditor* ce)
|
||||
listener->panelChanged (EvColorToningCLCurve, M("HISTORY_CUSTOMCURVE"));
|
||||
} else if (ce == cl2shape) {
|
||||
listener->panelChanged (EvColorToningLLCurve, M("HISTORY_CUSTOMCURVE"));
|
||||
} else if (ce == labRegionHueMask) {
|
||||
listener->panelChanged(EvLabRegionHueMask, M("HISTORY_CUSTOMCURVE"));
|
||||
} else if (ce == labRegionChromaticityMask) {
|
||||
listener->panelChanged(EvLabRegionChromaticityMask, M("HISTORY_CUSTOMCURVE"));
|
||||
} else if (ce == labRegionLightnessMask) {
|
||||
listener->panelChanged(EvLabRegionLightnessMask, M("HISTORY_CUSTOMCURVE"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1158,6 +1333,10 @@ void ColorToning::adjusterChanged(Adjuster* a, double newval)
|
||||
listener->panelChanged (EvColorToningSatProtection, a->getTextValue());
|
||||
} else if (a == strength) {
|
||||
listener->panelChanged (EvColorToningStrength, a->getTextValue());
|
||||
} else if (a == labRegionSaturation) {
|
||||
listener->panelChanged(EvLabRegionSaturation, a->getTextValue());
|
||||
} else if (a == labRegionLightness) {
|
||||
listener->panelChanged(EvLabRegionLightness, a->getTextValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1190,8 +1369,177 @@ void ColorToning::setBatchMode (bool batchMode)
|
||||
|
||||
}
|
||||
|
||||
bool ColorToning::resetPressed(GdkEventButton* event)
|
||||
|
||||
void ColorToning::onLabRegionSelectionChanged()
|
||||
{
|
||||
labgrid->reset(event->state & GDK_CONTROL_MASK);
|
||||
return false;
|
||||
auto s = labRegionList->get_selected();
|
||||
if (!s.empty()) {
|
||||
// update the selected values
|
||||
labRegionGet(labRegionSelected);
|
||||
labRegionSelected = s[0];
|
||||
labRegionShow(labRegionSelected);
|
||||
if (labRegionShowMask->get_active()) {
|
||||
labRegionShowMaskChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionGet(int idx)
|
||||
{
|
||||
if (idx < 0 || size_t(idx) >= labRegionData.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &r = labRegionData[idx];
|
||||
double la, lb;
|
||||
labRegionAB->getParams(la, lb, r.a, r.b);
|
||||
r.saturation = labRegionSaturation->getValue();
|
||||
r.lightness = labRegionLightness->getValue();
|
||||
r.hueMask = labRegionHueMask->getCurve();
|
||||
r.chromaticityMask = labRegionChromaticityMask->getCurve();
|
||||
r.lightnessMask = labRegionLightnessMask->getCurve();
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionAddPressed()
|
||||
{
|
||||
labRegionSelected = labRegionData.size();
|
||||
labRegionData.push_back(rtengine::ColorToningParams::LabCorrectionRegion());
|
||||
labRegionPopulateList();
|
||||
labRegionShow(labRegionSelected);
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLabRegionList, M("HISTORY_CHANGED"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionRemovePressed()
|
||||
{
|
||||
if (labRegionList->size() > 1) {
|
||||
labRegionData.erase(labRegionData.begin() + labRegionSelected);
|
||||
labRegionSelected = LIM(labRegionSelected-1, 0, int(labRegionData.size()-1));
|
||||
labRegionPopulateList();
|
||||
labRegionShow(labRegionSelected);
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLabRegionList, M("HISTORY_CHANGED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionUpPressed()
|
||||
{
|
||||
if (labRegionSelected > 0) {
|
||||
auto r = labRegionData[labRegionSelected];
|
||||
labRegionData.erase(labRegionData.begin() + labRegionSelected);
|
||||
--labRegionSelected;
|
||||
labRegionData.insert(labRegionData.begin() + labRegionSelected, r);
|
||||
labRegionPopulateList();
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLabRegionList, M("HISTORY_CHANGED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionDownPressed()
|
||||
{
|
||||
if (labRegionSelected < int(labRegionData.size()-1)) {
|
||||
auto r = labRegionData[labRegionSelected];
|
||||
labRegionData.erase(labRegionData.begin() + labRegionSelected);
|
||||
++labRegionSelected;
|
||||
labRegionData.insert(labRegionData.begin() + labRegionSelected, r);
|
||||
labRegionPopulateList();
|
||||
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLabRegionList, M("HISTORY_CHANGED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionShowMaskChanged()
|
||||
{
|
||||
if (listener) {
|
||||
listener->panelChanged(EvLabRegionShowMask, labRegionShowMask->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionPopulateList()
|
||||
{
|
||||
ConnectionBlocker b(labRegionSelectionConn);
|
||||
labRegionList->clear_items();
|
||||
rtengine::ColorToningParams::LabCorrectionRegion dflt;
|
||||
|
||||
for (size_t i = 0; i < labRegionData.size(); ++i) {
|
||||
auto &r = labRegionData[i];
|
||||
auto j = labRegionList->append(std::to_string(i+1));
|
||||
labRegionList->set_text(j, 1, Glib::ustring::compose("a=%1 b=%2 s=%3 l=%4", round_ab(r.a), round_ab(r.b), r.saturation, r.lightness));
|
||||
labRegionList->set_text(
|
||||
j, 2, Glib::ustring::compose(
|
||||
"%1%2%3",
|
||||
hasMask(dflt.hueMask, r.hueMask) ? "H" : "",
|
||||
hasMask(dflt.chromaticityMask, r.chromaticityMask) ? "C" : "",
|
||||
hasMask(dflt.lightnessMask, r.lightnessMask) ? "L" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::labRegionShow(int idx, bool list_only)
|
||||
{
|
||||
const bool disable = listener;
|
||||
if (disable) {
|
||||
disableListener();
|
||||
}
|
||||
rtengine::ColorToningParams::LabCorrectionRegion dflt;
|
||||
auto &r = labRegionData[idx];
|
||||
if (!list_only) {
|
||||
labRegionAB->setParams(0, 0, r.a, r.b, false);
|
||||
labRegionSaturation->setValue(r.saturation);
|
||||
labRegionLightness->setValue(r.lightness);
|
||||
labRegionHueMask->setCurve(r.hueMask);
|
||||
labRegionChromaticityMask->setCurve(r.chromaticityMask);
|
||||
labRegionLightnessMask->setCurve(r.lightnessMask);
|
||||
}
|
||||
labRegionList->set_text(idx, 1, Glib::ustring::compose("a=%1 b=%2 s=%3 l=%4", round_ab(r.a), round_ab(r.b), r.saturation, r.lightness));
|
||||
labRegionList->set_text(
|
||||
idx, 2, Glib::ustring::compose(
|
||||
"%1%2%3",
|
||||
hasMask(dflt.hueMask, r.hueMask) ? "H" : "",
|
||||
hasMask(dflt.chromaticityMask, r.chromaticityMask) ? "C" : "",
|
||||
hasMask(dflt.lightnessMask, r.lightnessMask) ? "L" : ""));
|
||||
Gtk::TreePath pth;
|
||||
pth.push_back(idx);
|
||||
labRegionList->get_selection()->select(pth);
|
||||
if (disable) {
|
||||
enableListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorToning::setEditProvider(EditDataProvider *provider)
|
||||
{
|
||||
labRegionHueMask->setEditProvider(provider);
|
||||
labRegionChromaticityMask->setEditProvider(provider);
|
||||
labRegionLightnessMask->setEditProvider(provider);
|
||||
}
|
||||
|
||||
|
||||
float ColorToning::blendPipetteValues(CurveEditor *ce, float chan1, float chan2, float chan3)
|
||||
{
|
||||
if (ce == labRegionChromaticityMask && chan1 > 0.f) {
|
||||
return lin2log(chan1, 10.f);
|
||||
} else if (ce == labRegionHueMask && chan1 > 0.f) {
|
||||
float x = chan1 + 1.f/6.f;
|
||||
if (x > 1.f) {
|
||||
x -= 1.f;
|
||||
}
|
||||
return lin2log(x, 3.f);
|
||||
}
|
||||
return CurveListener::blendPipetteValues(ce, chan1, chan2, chan3);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,19 @@ public:
|
||||
|
||||
void setListener(ToolPanelListener *tpl);
|
||||
|
||||
void setEditProvider(EditDataProvider *provider);
|
||||
float blendPipetteValues(CurveEditor *ce, float chan1, float chan2, float chan3);
|
||||
|
||||
private:
|
||||
bool resetPressed(GdkEventButton* event);
|
||||
void onLabRegionSelectionChanged();
|
||||
void labRegionAddPressed();
|
||||
void labRegionRemovePressed();
|
||||
void labRegionUpPressed();
|
||||
void labRegionDownPressed();
|
||||
void labRegionShowMaskChanged();
|
||||
void labRegionPopulateList();
|
||||
void labRegionShow(int idx, bool list_only=false);
|
||||
void labRegionGet(int idx);
|
||||
|
||||
//Gtk::HSeparator* satLimiterSep;
|
||||
Gtk::HSeparator* colorSep;
|
||||
@@ -113,9 +124,33 @@ private:
|
||||
sigc::connection lumamodeConn;
|
||||
|
||||
rtengine::ProcEvent EvColorToningLabGridValue;
|
||||
Gtk::Button *labgridReset;
|
||||
LabGrid *labgrid;
|
||||
Gtk::HBox *labgridBox;
|
||||
|
||||
rtengine::ProcEvent EvLabRegionList;
|
||||
rtengine::ProcEvent EvLabRegionAB;
|
||||
rtengine::ProcEvent EvLabRegionSaturation;
|
||||
rtengine::ProcEvent EvLabRegionLightness;
|
||||
rtengine::ProcEvent EvLabRegionHueMask;
|
||||
rtengine::ProcEvent EvLabRegionChromaticityMask;
|
||||
rtengine::ProcEvent EvLabRegionLightnessMask;
|
||||
rtengine::ProcEvent EvLabRegionShowMask;
|
||||
|
||||
Gtk::VBox *labRegionBox;
|
||||
Gtk::ListViewText *labRegionList;
|
||||
Gtk::Button *labRegionAdd;
|
||||
Gtk::Button *labRegionRemove;
|
||||
Gtk::Button *labRegionUp;
|
||||
Gtk::Button *labRegionDown;
|
||||
LabGrid *labRegionAB;
|
||||
Adjuster *labRegionSaturation;
|
||||
Adjuster *labRegionLightness;
|
||||
FlatCurveEditor *labRegionHueMask;
|
||||
FlatCurveEditor *labRegionChromaticityMask;
|
||||
FlatCurveEditor *labRegionLightnessMask;
|
||||
Gtk::CheckButton *labRegionShowMask;
|
||||
std::vector<rtengine::ColorToningParams::LabCorrectionRegion> labRegionData;
|
||||
int labRegionSelected;
|
||||
sigc::connection labRegionSelectionConn;
|
||||
|
||||
IdleRegister idle_register;
|
||||
};
|
||||
|
||||
145
rtgui/labgrid.cc
145
rtgui/labgrid.cc
@@ -41,29 +41,40 @@
|
||||
using rtengine::Color;
|
||||
|
||||
|
||||
bool LabGrid::notifyListener()
|
||||
//-----------------------------------------------------------------------------
|
||||
// LabGridArea
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool LabGridArea::notifyListener()
|
||||
{
|
||||
if (listener) {
|
||||
listener->panelChanged(evt, Glib::ustring::compose(M("TP_COLORTONING_LABGRID_VALUES"), int(low_a), int(low_b), int(high_a), int(high_b)));
|
||||
const auto round =
|
||||
[](float v) -> float
|
||||
{
|
||||
return int(v * 1000) / 1000.f;
|
||||
};
|
||||
listener->panelChanged(evt, Glib::ustring::compose(evtMsg, round(high_a), round(high_b), round(low_a), round(low_b)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
LabGrid::LabGrid(rtengine::ProcEvent evt):
|
||||
LabGridArea::LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low):
|
||||
Gtk::DrawingArea(),
|
||||
evt(evt), litPoint(NONE),
|
||||
evt(evt), evtMsg(msg),
|
||||
litPoint(NONE),
|
||||
low_a(0.f), high_a(0.f), low_b(0.f), high_b(0.f),
|
||||
defaultLow_a(0.f), defaultHigh_a(0.f), defaultLow_b(0.f), defaultHigh_b(0.f),
|
||||
listener(nullptr),
|
||||
edited(false),
|
||||
isDragged(false)
|
||||
isDragged(false),
|
||||
low_enabled(enable_low)
|
||||
{
|
||||
set_can_focus(true);
|
||||
add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
|
||||
}
|
||||
|
||||
void LabGrid::getParams(double &la, double &lb, double &ha, double &hb) const
|
||||
void LabGridArea::getParams(double &la, double &lb, double &ha, double &hb) const
|
||||
{
|
||||
la = low_a;
|
||||
ha = high_a;
|
||||
@@ -72,10 +83,10 @@ void LabGrid::getParams(double &la, double &lb, double &ha, double &hb) const
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::setParams(double la, double lb, double ha, double hb, bool notify)
|
||||
void LabGridArea::setParams(double la, double lb, double ha, double hb, bool notify)
|
||||
{
|
||||
const double lo = -rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
const double hi = rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
const double lo = -1.0;
|
||||
const double hi = 1.0;
|
||||
low_a = rtengine::LIM(la, lo, hi);
|
||||
low_b = rtengine::LIM(lb, lo, hi);
|
||||
high_a = rtengine::LIM(ha, lo, hi);
|
||||
@@ -86,7 +97,7 @@ void LabGrid::setParams(double la, double lb, double ha, double hb, bool notify)
|
||||
}
|
||||
}
|
||||
|
||||
void LabGrid::setDefault (double la, double lb, double ha, double hb)
|
||||
void LabGridArea::setDefault (double la, double lb, double ha, double hb)
|
||||
{
|
||||
defaultLow_a = la;
|
||||
defaultLow_b = lb;
|
||||
@@ -95,7 +106,7 @@ void LabGrid::setDefault (double la, double lb, double ha, double hb)
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::reset(bool toInitial)
|
||||
void LabGridArea::reset(bool toInitial)
|
||||
{
|
||||
if (toInitial) {
|
||||
setParams(defaultLow_a, defaultLow_b, defaultHigh_a, defaultHigh_b, true);
|
||||
@@ -105,32 +116,32 @@ void LabGrid::reset(bool toInitial)
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::setEdited(bool yes)
|
||||
void LabGridArea::setEdited(bool yes)
|
||||
{
|
||||
edited = yes;
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::getEdited() const
|
||||
bool LabGridArea::getEdited() const
|
||||
{
|
||||
return edited;
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::setListener(ToolPanelListener *l)
|
||||
void LabGridArea::setListener(ToolPanelListener *l)
|
||||
{
|
||||
listener = l;
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::on_style_updated ()
|
||||
void LabGridArea::on_style_updated ()
|
||||
{
|
||||
setDirty(true);
|
||||
queue_draw ();
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
bool LabGridArea::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
{
|
||||
Gtk::Allocation allocation = get_allocation();
|
||||
allocation.set_x(0);
|
||||
@@ -170,7 +181,7 @@ bool LabGrid::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
cr->translate(0, height);
|
||||
cr->scale(1., -1.);
|
||||
const int cells = 8;
|
||||
float step = rtengine::ColorToningParams::LABGRID_CORR_MAX / float(cells/2);
|
||||
float step = 12000.f / float(cells/2);
|
||||
for (int j = 0; j < cells; j++) {
|
||||
for (int i = 0; i < cells; i++) {
|
||||
float R, G, B;
|
||||
@@ -190,10 +201,10 @@ bool LabGrid::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
// drawing the connection line
|
||||
cr->set_antialias(Cairo::ANTIALIAS_DEFAULT);
|
||||
float loa, hia, lob, hib;
|
||||
loa = .5f * (width + width * low_a / rtengine::ColorToningParams::LABGRID_CORR_MAX);
|
||||
hia = .5f * (width + width * high_a / rtengine::ColorToningParams::LABGRID_CORR_MAX);
|
||||
lob = .5f * (height + height * low_b / rtengine::ColorToningParams::LABGRID_CORR_MAX);
|
||||
hib = .5f * (height + height * high_b / rtengine::ColorToningParams::LABGRID_CORR_MAX);
|
||||
loa = .5f * (width + width * low_a);
|
||||
hia = .5f * (width + width * high_a);
|
||||
lob = .5f * (height + height * low_b);
|
||||
hib = .5f * (height + height * high_b);
|
||||
cr->set_line_width(2.);
|
||||
cr->set_source_rgb(0.6, 0.6, 0.6);
|
||||
cr->move_to(loa, lob);
|
||||
@@ -201,13 +212,15 @@ bool LabGrid::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
cr->stroke();
|
||||
|
||||
// drawing points
|
||||
cr->set_source_rgb(0.1, 0.1, 0.1);
|
||||
if (litPoint == LOW) {
|
||||
cr->arc(loa, lob, 5, 0, 2. * rtengine::RT_PI);
|
||||
} else {
|
||||
cr->arc(loa, lob, 3, 0, 2. * rtengine::RT_PI);
|
||||
if (low_enabled) {
|
||||
cr->set_source_rgb(0.1, 0.1, 0.1);
|
||||
if (litPoint == LOW) {
|
||||
cr->arc(loa, lob, 5, 0, 2. * rtengine::RT_PI);
|
||||
} else {
|
||||
cr->arc(loa, lob, 3, 0, 2. * rtengine::RT_PI);
|
||||
}
|
||||
cr->fill();
|
||||
}
|
||||
cr->fill();
|
||||
|
||||
cr->set_source_rgb(0.9, 0.9, 0.9);
|
||||
if (litPoint == HIGH) {
|
||||
@@ -223,7 +236,7 @@ bool LabGrid::on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf)
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::on_button_press_event(GdkEventButton *event)
|
||||
bool LabGridArea::on_button_press_event(GdkEventButton *event)
|
||||
{
|
||||
if (event->button == 1) {
|
||||
if (event->type == GDK_2BUTTON_PRESS) {
|
||||
@@ -250,7 +263,7 @@ bool LabGrid::on_button_press_event(GdkEventButton *event)
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::on_button_release_event(GdkEventButton *event)
|
||||
bool LabGridArea::on_button_release_event(GdkEventButton *event)
|
||||
{
|
||||
if (event->button == 1) {
|
||||
isDragged = false;
|
||||
@@ -260,7 +273,7 @@ bool LabGrid::on_button_release_event(GdkEventButton *event)
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::on_motion_notify_event(GdkEventMotion *event)
|
||||
bool LabGridArea::on_motion_notify_event(GdkEventMotion *event)
|
||||
{
|
||||
if (isDragged && delayconn.connected()) {
|
||||
delayconn.disconnect();
|
||||
@@ -275,30 +288,30 @@ bool LabGrid::on_motion_notify_event(GdkEventMotion *event)
|
||||
const float mb = (2.0 * mouse_y - height) / (float)height;
|
||||
if (isDragged) {
|
||||
if (litPoint == LOW) {
|
||||
low_a = ma * rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
low_b = mb * rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
low_a = ma;
|
||||
low_b = mb;
|
||||
} else if (litPoint == HIGH) {
|
||||
high_a = ma * rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
high_b = mb * rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
high_a = ma;
|
||||
high_b = mb;
|
||||
}
|
||||
edited = true;
|
||||
grab_focus();
|
||||
if (options.adjusterMinDelay == 0) {
|
||||
notifyListener();
|
||||
} else {
|
||||
delayconn = Glib::signal_timeout().connect(sigc::mem_fun(*this, &LabGrid::notifyListener), options.adjusterMinDelay);
|
||||
delayconn = Glib::signal_timeout().connect(sigc::mem_fun(*this, &LabGridArea::notifyListener), options.adjusterMinDelay);
|
||||
}
|
||||
queue_draw();
|
||||
} else {
|
||||
litPoint = NONE;
|
||||
float la = low_a / rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
float lb = low_b / rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
float ha = high_a / rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
float hb = high_b / rtengine::ColorToningParams::LABGRID_CORR_MAX;
|
||||
float la = low_a;
|
||||
float lb = low_b;
|
||||
float ha = high_a;
|
||||
float hb = high_b;
|
||||
const float thrs = 0.05f;
|
||||
const float distlo = (la - ma) * (la - ma) + (lb - mb) * (lb - mb);
|
||||
const float disthi = (ha - ma) * (ha - ma) + (hb - mb) * (hb - mb);
|
||||
if (distlo < thrs * thrs && distlo < disthi) {
|
||||
if (low_enabled && distlo < thrs * thrs && distlo < disthi) {
|
||||
litPoint = LOW;
|
||||
} else if (disthi < thrs * thrs && disthi <= distlo) {
|
||||
litPoint = HIGH;
|
||||
@@ -311,20 +324,66 @@ bool LabGrid::on_motion_notify_event(GdkEventMotion *event)
|
||||
}
|
||||
|
||||
|
||||
Gtk::SizeRequestMode LabGrid::get_request_mode_vfunc() const
|
||||
Gtk::SizeRequestMode LabGridArea::get_request_mode_vfunc() const
|
||||
{
|
||||
return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::get_preferred_width_vfunc(int &minimum_width, int &natural_width) const
|
||||
void LabGridArea::get_preferred_width_vfunc(int &minimum_width, int &natural_width) const
|
||||
{
|
||||
minimum_width = 50;
|
||||
natural_width = 150; // same as GRAPH_SIZE from mycurve.h
|
||||
}
|
||||
|
||||
|
||||
void LabGrid::get_preferred_height_for_width_vfunc(int width, int &minimum_height, int &natural_height) const
|
||||
void LabGridArea::get_preferred_height_for_width_vfunc(int width, int &minimum_height, int &natural_height) const
|
||||
{
|
||||
minimum_height = natural_height = width;
|
||||
}
|
||||
|
||||
|
||||
bool LabGridArea::lowEnabled() const
|
||||
{
|
||||
return low_enabled;
|
||||
}
|
||||
|
||||
|
||||
void LabGridArea::setLowEnabled(bool yes)
|
||||
{
|
||||
if (low_enabled != yes) {
|
||||
low_enabled = yes;
|
||||
queue_draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LabGrid
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low):
|
||||
grid(evt, msg, enable_low)
|
||||
{
|
||||
Gtk::Button *reset = Gtk::manage(new Gtk::Button());
|
||||
reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT"));
|
||||
reset->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png")));
|
||||
reset->signal_button_release_event().connect(sigc::mem_fun(*this, &LabGrid::resetPressed));
|
||||
|
||||
setExpandAlignProperties(reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START);
|
||||
reset->set_relief(Gtk::RELIEF_NONE);
|
||||
reset->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT);
|
||||
reset->set_can_focus(false);
|
||||
reset->set_size_request(-1, 20);
|
||||
|
||||
pack_start(grid, true, true);
|
||||
pack_start(*reset, false, false);
|
||||
show_all_children();
|
||||
}
|
||||
|
||||
|
||||
bool LabGrid::resetPressed(GdkEventButton *event)
|
||||
{
|
||||
grid.reset(event->state & GDK_CONTROL_MASK);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,11 @@
|
||||
#include "toolpanel.h"
|
||||
|
||||
|
||||
class LabGrid: public Gtk::DrawingArea, public BackBuffer {
|
||||
class LabGridArea: public Gtk::DrawingArea, public BackBuffer {
|
||||
private:
|
||||
rtengine::ProcEvent evt;
|
||||
Glib::ustring evtMsg;
|
||||
|
||||
enum State { NONE, HIGH, LOW };
|
||||
State litPoint;
|
||||
float low_a;
|
||||
@@ -64,11 +66,14 @@ private:
|
||||
sigc::connection delayconn;
|
||||
static const int inset = 2;
|
||||
|
||||
bool grid_visible;
|
||||
bool low_enabled;
|
||||
|
||||
bool notifyListener();
|
||||
void getLitPoint();
|
||||
|
||||
public:
|
||||
LabGrid(rtengine::ProcEvent evt);
|
||||
LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true);
|
||||
|
||||
void getParams(double &la, double &lb, double &ha, double &hb) const;
|
||||
void setParams(double la, double lb, double ha, double hb, bool notify);
|
||||
@@ -78,6 +83,9 @@ public:
|
||||
void reset(bool toInitial);
|
||||
void setListener(ToolPanelListener *l);
|
||||
|
||||
bool lowEnabled() const;
|
||||
void setLowEnabled(bool yes);
|
||||
|
||||
bool on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf);
|
||||
void on_style_updated ();
|
||||
bool on_button_press_event(GdkEventButton *event);
|
||||
@@ -88,3 +96,24 @@ public:
|
||||
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
|
||||
};
|
||||
|
||||
|
||||
class LabGrid: public Gtk::HBox {
|
||||
private:
|
||||
LabGridArea grid;
|
||||
|
||||
bool resetPressed(GdkEventButton *event);
|
||||
|
||||
public:
|
||||
LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true);
|
||||
|
||||
void getParams(double &la, double &lb, double &ha, double &hb) const { return grid.getParams(la, lb, ha, hb); }
|
||||
void setParams(double la, double lb, double ha, double hb, bool notify) { grid.setParams(la, lb, ha, hb, notify); }
|
||||
void setDefault (double la, double lb, double ha, double hb) { grid.setDefault(la, lb, ha, hb); }
|
||||
void setEdited(bool yes) { grid.setEdited(yes); }
|
||||
bool getEdited() const { return grid.getEdited(); }
|
||||
void reset(bool toInitial) { grid.reset(toInitial); }
|
||||
void setListener(ToolPanelListener *l) { grid.setListener(l); }
|
||||
bool lowEnabled() const { return grid.lowEnabled(); }
|
||||
void setLowEnabled(bool yes) { grid.setLowEnabled(yes); }
|
||||
};
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ void ParamsEdited::set(bool v)
|
||||
colorToning.labgridBLow = v;
|
||||
colorToning.labgridAHigh = v;
|
||||
colorToning.labgridBHigh = v;
|
||||
colorToning.labregions = v;
|
||||
colorToning.labregionsShowMask = v;
|
||||
|
||||
sharpening.enabled = v;
|
||||
sharpening.contrast = v;
|
||||
@@ -818,6 +820,8 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
|
||||
colorToning.labgridBLow = colorToning.labgridBLow && p.colorToning.labgridBLow == other.colorToning.labgridBLow;
|
||||
colorToning.labgridAHigh = colorToning.labgridAHigh && p.colorToning.labgridAHigh == other.colorToning.labgridAHigh;
|
||||
colorToning.labgridBHigh = colorToning.labgridBHigh && p.colorToning.labgridBHigh == other.colorToning.labgridBHigh;
|
||||
colorToning.labregions = colorToning.labregions && p.colorToning.labregions == other.colorToning.labregions;
|
||||
colorToning.labregionsShowMask = colorToning.labregionsShowMask && p.colorToning.labregionsShowMask == other.colorToning.labregionsShowMask;
|
||||
sharpenEdge.enabled = sharpenEdge.enabled && p.sharpenEdge.enabled == other.sharpenEdge.enabled;
|
||||
sharpenEdge.passes = sharpenEdge.passes && p.sharpenEdge.passes == other.sharpenEdge.passes;
|
||||
sharpenEdge.amount = sharpenEdge.amount && p.sharpenEdge.amount == other.sharpenEdge.amount;
|
||||
@@ -1809,6 +1813,14 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
|
||||
toEdit.colorToning.labgridBHigh = mods.colorToning.labgridBHigh;
|
||||
}
|
||||
|
||||
if (colorToning.labregions) {
|
||||
toEdit.colorToning.labregions = mods.colorToning.labregions;
|
||||
}
|
||||
|
||||
if (colorToning.labregionsShowMask) {
|
||||
toEdit.colorToning.labregionsShowMask = mods.colorToning.labregionsShowMask;
|
||||
}
|
||||
|
||||
if (sharpenEdge.enabled) {
|
||||
toEdit.sharpenEdge.enabled = mods.sharpenEdge.enabled;
|
||||
}
|
||||
|
||||
@@ -178,6 +178,8 @@ public:
|
||||
bool labgridBLow;
|
||||
bool labgridAHigh;
|
||||
bool labgridBHigh;
|
||||
bool labregions;
|
||||
bool labregionsShowMask;
|
||||
};
|
||||
|
||||
class SharpenEdgeParamsEdited
|
||||
|
||||
@@ -37,7 +37,7 @@ PrSharpening::PrSharpening () : FoldableToolPanel(this, "prsharpening", M("TP_PR
|
||||
|
||||
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
|
||||
hb->show ();
|
||||
contrast = Gtk::manage(new Adjuster (M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 0));
|
||||
contrast = Gtk::manage(new Adjuster (M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 15));
|
||||
contrast->setAdjusterListener (this);
|
||||
pack_start(*contrast);
|
||||
contrast->show();
|
||||
|
||||
Reference in New Issue
Block a user