Full functional button now. Reverted a minor change from unsigned int to int.

This commit is contained in:
Thanatomanic
2018-06-15 23:22:23 +02:00
parent dec54d00ad
commit ab5ce7f130

View File

@@ -45,7 +45,7 @@ HistogramPanel::HistogramPanel ()
set_halign(Gtk::ALIGN_FILL); set_halign(Gtk::ALIGN_FILL);
set_name("HistogramPanel"); set_name("HistogramPanel");
histogramArea = Gtk::manage (new HistogramArea (/*this*/)); histogramArea = Gtk::manage (new HistogramArea (this));
histogramArea->set_hexpand(true); histogramArea->set_hexpand(true);
histogramArea->set_vexpand(true); histogramArea->set_vexpand(true);
histogramRGBArea = Gtk::manage (new HistogramRGBArea ()); histogramRGBArea = Gtk::manage (new HistogramRGBArea ());
@@ -402,11 +402,6 @@ void HistogramPanel::reorder (Gtk::PositionType align)
// DrawModeListener interface: // DrawModeListener interface:
void HistogramPanel::toggle_button_mode () void HistogramPanel::toggle_button_mode ()
{ {
// Does not seem to be called from HistogramArea::on_button_press_event ... why?
//
// printf("%i\n",options.histogramDrawMode);
// fflush(stdout);
if (options.histogramDrawMode == 0) if (options.histogramDrawMode == 0)
showMode->set_image(*modeImage); showMode->set_image(*modeImage);
else if (options.histogramDrawMode == 1) else if (options.histogramDrawMode == 1)
@@ -889,7 +884,7 @@ void HistogramArea::updateBackBuffer ()
// does not take into account 0 and 255 values // does not take into account 0 and 255 values
// them are handled separately // them are handled separately
int fullhistheight = 0; unsigned int fullhistheight = 0;
for (int i = 1; i < 255; i++) { for (int i = 1; i < 255; i++) {
if (needLuma && lhisttemp[i] > fullhistheight) { if (needLuma && lhisttemp[i] > fullhistheight) {
@@ -913,8 +908,10 @@ void HistogramArea::updateBackBuffer ()
} }
} }
if (fullhistheight < winh - 2) { int realhistheight = fullhistheight;
fullhistheight = winh - 2;
if (realhistheight < winh - 2) {
realhistheight = winh - 2;
} }
cr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL); cr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL);
@@ -924,57 +921,57 @@ void HistogramArea::updateBackBuffer ()
int ui = 0, oi = 0; int ui = 0, oi = 0;
if (needBlue) { if (needBlue) {
drawCurve(cr, bhchanged, fullhistheight, w, h); drawCurve(cr, bhchanged, realhistheight, w, h);
cr->set_source_rgba (0.0, 0.0, 1.0, 0.4); cr->set_source_rgba (0.0, 0.0, 1.0, 0.4);
cr->fill (); cr->fill ();
drawCurve(cr, bhchanged, fullhistheight, w, h); drawCurve(cr, bhchanged, realhistheight, w, h);
cr->set_source_rgba (0.0, 0.0, 1.0, 0.9); cr->set_source_rgba (0.0, 0.0, 1.0, 0.9);
cr->stroke (); cr->stroke ();
drawMarks(cr, bhchanged, fullhistheight, w, ui, oi); drawMarks(cr, bhchanged, realhistheight, w, ui, oi);
} }
if (needGreen) { if (needGreen) {
drawCurve(cr, ghchanged, fullhistheight, w, h); drawCurve(cr, ghchanged, realhistheight, w, h);
cr->set_source_rgba (0.0, 1.0, 0.0, 0.4); cr->set_source_rgba (0.0, 1.0, 0.0, 0.4);
cr->fill (); cr->fill ();
drawCurve(cr, ghchanged, fullhistheight, w, h); drawCurve(cr, ghchanged, realhistheight, w, h);
cr->set_source_rgba (0.0, 1.0, 0.0, 0.9); cr->set_source_rgba (0.0, 1.0, 0.0, 0.9);
cr->stroke (); cr->stroke ();
drawMarks(cr, ghchanged, fullhistheight, w, ui, oi); drawMarks(cr, ghchanged, realhistheight, w, ui, oi);
} }
if (needRed) { if (needRed) {
drawCurve(cr, rhchanged, fullhistheight, w, h); drawCurve(cr, rhchanged, realhistheight, w, h);
cr->set_source_rgba (1.0, 0.0, 0.0, 0.4); cr->set_source_rgba (1.0, 0.0, 0.0, 0.4);
cr->fill (); cr->fill ();
drawCurve(cr, rhchanged, fullhistheight, w, h); drawCurve(cr, rhchanged, realhistheight, w, h);
cr->set_source_rgba (1.0, 0.0, 0.0, 0.9); cr->set_source_rgba (1.0, 0.0, 0.0, 0.9);
cr->stroke (); cr->stroke ();
drawMarks(cr, rhchanged, fullhistheight, w, ui, oi); drawMarks(cr, rhchanged, realhistheight, w, ui, oi);
} }
cr->set_operator(Cairo::OPERATOR_SOURCE); cr->set_operator(Cairo::OPERATOR_SOURCE);
if (needLuma && !rawMode) { if (needLuma && !rawMode) {
drawCurve(cr, lhist, fullhistheight, w, h); drawCurve(cr, lhist, realhistheight, w, h);
cr->set_source_rgb (0.9, 0.9, 0.9); cr->set_source_rgb (0.9, 0.9, 0.9);
cr->stroke (); cr->stroke ();
drawMarks(cr, lhist, fullhistheight, w, ui, oi); drawMarks(cr, lhist, realhistheight, w, ui, oi);
} }
if (needChroma && !rawMode) { if (needChroma && !rawMode) {
drawCurve(cr, chist, fullhistheight, w, h); drawCurve(cr, chist, realhistheight, w, h);
cr->set_source_rgb (0.4, 0.4, 0.4); cr->set_source_rgb (0.4, 0.4, 0.4);
cr->stroke (); cr->stroke ();
drawMarks(cr, chist, fullhistheight, w, ui, oi); drawMarks(cr, chist, realhistheight, w, ui, oi);
} }
} }
@@ -1133,7 +1130,7 @@ bool HistogramArea::on_button_press_event (GdkEventButton* event)
drawMode = (drawMode + 1) % 3; drawMode = (drawMode + 1) % 3;
options.histogramDrawMode = (options.histogramDrawMode + 1) % 3; options.histogramDrawMode = (options.histogramDrawMode + 1) % 3;
if (myDrawModeListener) { // This doesn't seem te be work? Therefore no update of the button graphics... if (myDrawModeListener) {
myDrawModeListener->toggle_button_mode (); myDrawModeListener->toggle_button_mode ();
} }