Modifications to store histogram settings across sessions
This commit is contained in:
parent
6b93927ea1
commit
85d55ebeb6
@ -2242,7 +2242,7 @@ void EditorPanel::histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & his
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (histogramPanel) {
|
if (histogramPanel) {
|
||||||
histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma);
|
histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI);
|
tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI);
|
||||||
|
@ -129,12 +129,12 @@ HistogramPanel::HistogramPanel ()
|
|||||||
|
|
||||||
buttonGrid = Gtk::manage (new Gtk::Grid ());
|
buttonGrid = Gtk::manage (new Gtk::Grid ());
|
||||||
buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
|
buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL);
|
||||||
showRed->set_active (true);
|
showRed->set_active (options.histogramRed);
|
||||||
showGreen->set_active (true);
|
showGreen->set_active (options.histogramGreen);
|
||||||
showBlue->set_active (true);
|
showBlue->set_active (options.histogramBlue);
|
||||||
showValue->set_active (false);//unactive by default
|
showValue->set_active (options.histogramLuma);
|
||||||
showChro->set_active (false);//unactive by default
|
showChro->set_active (options.histogramChroma);
|
||||||
showRAW->set_active (false);
|
showRAW->set_active (options.histogramRAW);
|
||||||
// no showMode->set_active(), as it's not a ToggleButton
|
// no showMode->set_active(), as it's not a ToggleButton
|
||||||
showBAR->set_active (options.histogramBar);
|
showBAR->set_active (options.histogramBar);
|
||||||
|
|
||||||
@ -297,12 +297,12 @@ void HistogramPanel::bar_toggled ()
|
|||||||
void HistogramPanel::rgbv_toggled ()
|
void HistogramPanel::rgbv_toggled ()
|
||||||
{
|
{
|
||||||
// Update Display
|
// Update Display
|
||||||
histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showChro->get_active(), options.histogramDrawMode);
|
histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), options.histogramDrawMode);
|
||||||
histogramArea->queue_draw ();
|
histogramArea->queue_draw ();
|
||||||
|
|
||||||
histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showBAR->get_active(), showChro->get_active());
|
histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), showBAR->get_active());
|
||||||
histogramRGBArea->updateBackBuffer (0, 0, 0);
|
histogramRGBArea->updateBackBuffer (0, 0, 0);
|
||||||
histogramArea->queue_draw ();
|
histogramRGBArea->queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramPanel::setHistRGBInvalid ()
|
void HistogramPanel::setHistRGBInvalid ()
|
||||||
@ -369,8 +369,11 @@ double HistogramScaling::log(double vsize, double val)
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// HistogramRGBArea
|
// HistogramRGBArea
|
||||||
HistogramRGBArea::HistogramRGBArea () ://needChroma unactive by default, luma too
|
HistogramRGBArea::HistogramRGBArea () :
|
||||||
val(0), r(0), g(0), b(0), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(false), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(false), parent(nullptr)
|
val(0), r(0), g(0), b(0), valid(false),
|
||||||
|
needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue),
|
||||||
|
needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW),
|
||||||
|
showMode(options.histogramBar), barDisplayed(options.histogramBar), parent(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
get_style_context()->add_class("drawingarea");
|
get_style_context()->add_class("drawingarea");
|
||||||
@ -583,28 +586,23 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh)
|
|||||||
idle_register.add(func, harih);
|
idle_register.add(func, harih);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool bar, bool c)
|
void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool bar)
|
||||||
{
|
{
|
||||||
|
|
||||||
needRed = r;
|
options.histogramRed = needRed = r;
|
||||||
needGreen = g;
|
options.histogramGreen = needGreen = g;
|
||||||
needBlue = b;
|
options.histogramBlue = needBlue = b;
|
||||||
needLuma = l;
|
options.histogramLuma = needLuma = l;
|
||||||
rawMode = raw;
|
options.histogramChroma = needChroma = c;
|
||||||
showMode = bar;
|
options.histogramRAW = rawMode = raw;
|
||||||
needChroma = c;
|
options.histogramBar = showMode = bar;
|
||||||
|
|
||||||
// Histogram RGB BAR button logic goes here
|
|
||||||
|
|
||||||
|
// Show/hide the RGB bar widget
|
||||||
if (bar && !barDisplayed) {
|
if (bar && !barDisplayed) {
|
||||||
// Toggled on, add (show) the widget
|
|
||||||
parent->add(*this);
|
parent->add(*this);
|
||||||
options.histogramBar = true;
|
|
||||||
barDisplayed = true;
|
barDisplayed = true;
|
||||||
} else if (!bar && barDisplayed) {
|
} else if (!bar && barDisplayed) {
|
||||||
// Toggled off, remove (hide) the widget
|
|
||||||
removeIfThere(parent, this, false);
|
removeIfThere(parent, this, false);
|
||||||
options.histogramBar = false;
|
|
||||||
barDisplayed = false;
|
barDisplayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,16 +659,18 @@ void HistogramRGBArea::factorChanged (double newFactor)
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// HistogramArea
|
// HistogramArea
|
||||||
HistogramArea::HistogramArea (DrawModeListener *fml) : //needChroma unactive by default, luma too
|
HistogramArea::HistogramArea (DrawModeListener *fml) :
|
||||||
valid(false), drawMode(options.histogramDrawMode), myDrawModeListener(fml),
|
valid(false), drawMode(options.histogramDrawMode), myDrawModeListener(fml),
|
||||||
oldwidth(-1), oldheight(-1), needLuma(false), needRed(true), needGreen(true), needBlue(true),
|
oldwidth(-1), oldheight(-1),
|
||||||
rawMode(false), needChroma(false), isPressed(false), movingPosition(0.0)
|
needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue),
|
||||||
|
needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW),
|
||||||
|
isPressed(false), movingPosition(0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
lhist(256);
|
|
||||||
rhist(256);
|
rhist(256);
|
||||||
ghist(256);
|
ghist(256);
|
||||||
bhist(256);
|
bhist(256);
|
||||||
|
lhist(256);
|
||||||
chist(256);
|
chist(256);
|
||||||
|
|
||||||
get_style_context()->add_class("drawingarea");
|
get_style_context()->add_class("drawingarea");
|
||||||
@ -724,32 +724,31 @@ void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minim
|
|||||||
get_preferred_width_vfunc (minimum_width, natural_width);
|
get_preferred_width_vfunc (minimum_width, natural_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode)
|
void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
needRed = r;
|
options.histogramRed = needRed = r;
|
||||||
needGreen = g;
|
options.histogramGreen = needGreen = g;
|
||||||
needBlue = b;
|
options.histogramBlue = needBlue = b;
|
||||||
needLuma = l;
|
options.histogramLuma = needLuma = l;
|
||||||
rawMode = raw;
|
options.histogramChroma = needChroma = c;
|
||||||
needChroma = c;
|
options.histogramRAW = rawMode = raw;
|
||||||
drawMode = mode;
|
options.histogramDrawMode = drawMode = mode;
|
||||||
|
|
||||||
updateBackBuffer ();
|
updateBackBuffer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma)
|
void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw)
|
||||||
{
|
{
|
||||||
if (histRed) {
|
if (histRed) {
|
||||||
lhist = histLuma;
|
|
||||||
chist = histChroma;
|
|
||||||
rhist = histRed;
|
rhist = histRed;
|
||||||
ghist = histGreen;
|
ghist = histGreen;
|
||||||
bhist = histBlue;
|
bhist = histBlue;
|
||||||
|
lhist = histLuma;
|
||||||
|
chist = histChroma;
|
||||||
rhistRaw = histRedRaw;
|
rhistRaw = histRedRaw;
|
||||||
ghistRaw = histGreenRaw;
|
ghistRaw = histGreenRaw;
|
||||||
bhistRaw = histBlueRaw;
|
bhistRaw = histBlueRaw;
|
||||||
|
|
||||||
valid = true;
|
valid = true;
|
||||||
} else {
|
} else {
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -70,10 +70,10 @@ protected:
|
|||||||
bool needGreen;
|
bool needGreen;
|
||||||
bool needBlue;
|
bool needBlue;
|
||||||
bool needLuma;
|
bool needLuma;
|
||||||
|
bool needChroma;
|
||||||
bool rawMode;
|
bool rawMode;
|
||||||
bool showMode;
|
bool showMode;
|
||||||
bool barDisplayed;
|
bool barDisplayed;
|
||||||
bool needChroma;
|
|
||||||
|
|
||||||
Gtk::Grid* parent;
|
Gtk::Grid* parent;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void update (int val, int rh, int gh, int bh);
|
void update (int val, int rh, int gh, int bh);
|
||||||
void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool show, bool c);
|
void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool show);
|
||||||
|
|
||||||
void on_realize();
|
void on_realize();
|
||||||
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
|
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
|
||||||
@ -104,7 +104,7 @@ private:
|
|||||||
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const;
|
void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const;
|
||||||
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
|
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
|
||||||
void get_preferred_width_for_height_vfunc (int h, int &minimum_width, int &natural_width) const;
|
void get_preferred_width_for_height_vfunc (int h, int &minimum_width, int &natural_width) const;
|
||||||
// Some ...
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawModeListener
|
class DrawModeListener
|
||||||
@ -124,15 +124,16 @@ private:
|
|||||||
type_signal_factor_changed sigFactorChanged;
|
type_signal_factor_changed sigFactorChanged;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LUTu lhist, rhist, ghist, bhist, chist;
|
LUTu rhist, ghist, bhist, lhist, chist;
|
||||||
LUTu lhistRaw, rhistRaw, ghistRaw, bhistRaw;
|
LUTu rhistRaw, ghistRaw, bhistRaw, lhistRaw; //lhistRaw is unused?
|
||||||
|
|
||||||
bool valid;
|
bool valid;
|
||||||
int drawMode;
|
int drawMode;
|
||||||
DrawModeListener *myDrawModeListener;
|
DrawModeListener *myDrawModeListener;
|
||||||
int oldwidth, oldheight;
|
int oldwidth, oldheight;
|
||||||
|
|
||||||
bool needLuma, needRed, needGreen, needBlue, rawMode, needChroma;
|
bool needRed, needGreen, needBlue, needLuma, needChroma;
|
||||||
|
bool rawMode;
|
||||||
bool isPressed;
|
bool isPressed;
|
||||||
double movingPosition;
|
double movingPosition;
|
||||||
|
|
||||||
@ -143,8 +144,8 @@ public:
|
|||||||
~HistogramArea();
|
~HistogramArea();
|
||||||
|
|
||||||
void updateBackBuffer ();
|
void updateBackBuffer ();
|
||||||
void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma);
|
void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw);
|
||||||
void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode);
|
void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode);
|
||||||
void on_realize();
|
void on_realize();
|
||||||
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
|
bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr);
|
||||||
bool on_button_press_event (GdkEventButton* event);
|
bool on_button_press_event (GdkEventButton* event);
|
||||||
@ -208,9 +209,9 @@ public:
|
|||||||
HistogramPanel ();
|
HistogramPanel ();
|
||||||
~HistogramPanel ();
|
~HistogramPanel ();
|
||||||
|
|
||||||
void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma)
|
void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw)
|
||||||
{
|
{
|
||||||
histogramArea->update (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma);
|
histogramArea->update (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw);
|
||||||
}
|
}
|
||||||
// pointermotionlistener interface
|
// pointermotionlistener interface
|
||||||
void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false);
|
void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false);
|
||||||
|
@ -419,6 +419,9 @@ void Options::setDefaults()
|
|||||||
mainNBVertical = true;
|
mainNBVertical = true;
|
||||||
multiDisplayMode = 0;
|
multiDisplayMode = 0;
|
||||||
histogramPosition = 1;
|
histogramPosition = 1;
|
||||||
|
histogramRed = true;
|
||||||
|
histogramGreen = true;
|
||||||
|
histogramBlue = true;
|
||||||
histogramBar = true;
|
histogramBar = true;
|
||||||
histogramHeight = 200;
|
histogramHeight = 200;
|
||||||
histogramDrawMode = 0;
|
histogramDrawMode = 0;
|
||||||
@ -1273,6 +1276,30 @@ void Options::readFromFile(Glib::ustring fname)
|
|||||||
histogramPosition = keyFile.get_integer("GUI", "HistogramPosition");
|
histogramPosition = keyFile.get_integer("GUI", "HistogramPosition");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramRed")) {
|
||||||
|
histogramRed = keyFile.get_boolean("GUI", "HistogramRed");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramGreen")) {
|
||||||
|
histogramGreen = keyFile.get_boolean("GUI", "HistogramGreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramBlue")) {
|
||||||
|
histogramBlue = keyFile.get_boolean("GUI", "HistogramBlue");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramLuma")) {
|
||||||
|
histogramLuma = keyFile.get_boolean("GUI", "HistogramLuma");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramChroma")) {
|
||||||
|
histogramChroma = keyFile.get_boolean("GUI", "HistogramChroma");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keyFile.has_key("GUI", "HistogramRAW")) {
|
||||||
|
histogramRAW = keyFile.get_boolean("GUI", "HistogramRAW");
|
||||||
|
}
|
||||||
|
|
||||||
if (keyFile.has_key("GUI", "HistogramBar")) {
|
if (keyFile.has_key("GUI", "HistogramBar")) {
|
||||||
histogramBar = keyFile.get_boolean("GUI", "HistogramBar");
|
histogramBar = keyFile.get_boolean("GUI", "HistogramBar");
|
||||||
}
|
}
|
||||||
@ -1994,6 +2021,12 @@ void Options::saveToFile(Glib::ustring fname)
|
|||||||
keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush);
|
keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush);
|
||||||
keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush);
|
keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush);
|
||||||
keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition);
|
keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramRed", histogramRed);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramGreen", histogramGreen);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramBlue", histogramBlue);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramLuma", histogramLuma);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramChroma", histogramChroma);
|
||||||
|
keyFile.set_boolean ("GUI", "HistogramRAW", histogramRAW);
|
||||||
keyFile.set_boolean ("GUI", "HistogramBar", histogramBar);
|
keyFile.set_boolean ("GUI", "HistogramBar", histogramBar);
|
||||||
keyFile.set_integer ("GUI", "HistogramHeight", histogramHeight);
|
keyFile.set_integer ("GUI", "HistogramHeight", histogramHeight);
|
||||||
keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode);
|
keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode);
|
||||||
|
@ -256,7 +256,8 @@ public:
|
|||||||
bool sndEnable;
|
bool sndEnable;
|
||||||
|
|
||||||
int histogramPosition; // 0=disabled, 1=left pane, 2=right pane
|
int histogramPosition; // 0=disabled, 1=left pane, 2=right pane
|
||||||
//int histogramWorking; // 0=disabled, 1=left pane, 2=right pane
|
bool histogramRed, histogramGreen, histogramBlue;
|
||||||
|
bool histogramLuma, histogramChroma, histogramRAW;
|
||||||
bool histogramBar;
|
bool histogramBar;
|
||||||
int histogramHeight;
|
int histogramHeight;
|
||||||
int histogramDrawMode;
|
int histogramDrawMode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user