From 93d01f3a82ce6ba1ef5388b94ae7f0a2cf3b6bae Mon Sep 17 00:00:00 2001 From: Hombre Date: Sun, 17 Jan 2016 04:45:01 +0100 Subject: [PATCH] GUI bugfix (histogram) + touchup - Fix the Histogram background and grid lines - Add 1 pixel of empty space between in the Histogram panel - Add a light grey color border for Gtk::DrawingArea oject, for those using the render_frame method - In the Toolbox, make the nested MyExpander and Gtk::Frame lighter, and adjust the Gtk::DrawingArea background color accordingly - All added class to the MyCurve has been removed, so that the Gtk::Drawing object's style is used - The Retinex Settings' expander is now level 2 for GUI consistency --- rtdata/themes/RawTherapee.css | 51 +++++++++++++++++++++++- rtgui/cropwindow.cc | 4 +- rtgui/histogrampanel.cc | 75 +++++++++++------------------------ rtgui/histogrampanel.h | 19 --------- rtgui/mycurve.cc | 13 +----- rtgui/mydiagonalcurve.cc | 5 --- rtgui/myflatcurve.cc | 5 --- rtgui/retinex.cc | 1 + 8 files changed, 78 insertions(+), 95 deletions(-) diff --git a/rtdata/themes/RawTherapee.css b/rtdata/themes/RawTherapee.css index 508d21b38..dd907f87d 100644 --- a/rtdata/themes/RawTherapee.css +++ b/rtdata/themes/RawTherapee.css @@ -97,6 +97,7 @@ GtkDrawingArea { padding: 0; margin: 0; background-color: #363636; + border: 1px solid #252525; } GtkDrawingArea:selected { @@ -183,13 +184,61 @@ GtkMenu { border-radius: 4px; } +#ExpanderBox GtkDrawingArea { + background-color: #363636; +} + +#ExpanderBox GtkFrame { + background-color: #3B3B3B; + border: 1px solid #2B2B2B; + border-radius: 4px; +} + +#ExpanderBox GtkFrame GtkDrawingArea { + background-color: #3B3B3B; +} + +#ExpanderBox GtkFrame GtkFrame { + background-color: #414141; + border: 1px solid #313131; + border-radius: 4px; +} + +#ExpanderBox GtkFrame GtkFrame GtkDrawingArea { + background-color: #414141; +} + /* Sub-tool (MyExpander) background */ #ExpanderBox2 { background-color: #3B3B3B; - border: 1px solid #505050; + border: 1px solid #484848; border-radius: 4px; } +#ExpanderBox2 GtkDrawingArea { + background-color: #3B3B3B; +} + +#ExpanderBox2 GtkFrame { + background-color: #414141; + border: 1px solid #565656; + border-radius: 4px; +} + +#ExpanderBox2 GtkFrame GtkDrawingArea { + background-color: #414141; +} + +#ExpanderBox2 GtkFrame GtkFrame { + background-color: #474747; + border: 1px solid #5C5C5C; + border-radius: 4px; +} + +#ExpanderBox2 GtkFrame GtkFrame GtkDrawingArea { + background-color: #474747; +} + #MyExpanderTitle { font-size: 120%; } diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index be78110a7..bb7204b1d 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -1057,7 +1057,7 @@ void CropWindow::expose (Cairo::RefPtr cr) options.bgcolor = backColor; if (backColor == 0) { - iarea->get_style_context()->render_background(cr, x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); + style->render_background(cr, x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); } else { if (backColor == 1) { cr->set_source_rgb (0, 0, 0); @@ -1661,6 +1661,8 @@ void CropWindow::expose (Cairo::RefPtr cr) } } + style->render_frame (cr, x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); + //t2.set (); // printf ("etime --> %d, %d\n", t2.etime (t1), t4.etime (t3)); } diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 7d4b0c235..edd81ceed 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -55,6 +55,8 @@ HistogramPanel::HistogramPanel () gfxGrid = Gtk::manage (new Gtk::Grid ()); gfxGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + gfxGrid->set_row_spacing(1); + gfxGrid->set_column_spacing(1); histogramRGBArea->setParent(gfxGrid); gfxGrid->add(*histogramArea); @@ -490,14 +492,10 @@ void HistogramRGBArea::updateBackBuffer (int r, int g, int b, Glib::ustring prof if (surface) { Cairo::RefPtr cc = Cairo::Context::create(surface); Glib::RefPtr style = get_style_context(); - Gdk::RGBA c; + + style->render_background (cc, 0, 0, surface->get_width(), surface->get_height()); cc->set_antialias(Cairo::ANTIALIAS_NONE); - cc->set_line_join(Cairo::LINE_JOIN_MITER); - cc->set_source_rgb (mgray.get_red(), mgray.get_green(), mgray.get_blue()); - cc->rectangle(0, 0, winw, winh); - cc->fill(); - cc->set_line_width (1.0); if ( r != -1 && g != -1 && b != -1 ) { @@ -548,6 +546,8 @@ void HistogramRGBArea::updateBackBuffer (int r, int g, int b, Glib::ustring prof } } } + + style->render_frame (cc, 0, 0, surface->get_width(), surface->get_height()); } setDirty(false); @@ -780,14 +780,6 @@ void HistogramRGBArea::on_realize () Gtk::DrawingArea::on_realize(); Glib::RefPtr window = get_window(); add_events(Gdk::BUTTON_PRESS_MASK); - - black = Gdk::RGBA ("black"); - red = Gdk::RGBA ("red"); - green = Gdk::RGBA ("green"); - blue = Gdk::RGBA ("blue"); - lgray = Gdk::RGBA ("gray75"); - mgray = Gdk::RGBA ("gray50"); - dgray = Gdk::RGBA ("gray25"); } bool HistogramRGBArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) @@ -815,13 +807,6 @@ bool HistogramRGBArea::on_button_press_event (GdkEventButton* event) return true; } -void HistogramRGBArea::on_style_updated () -{ - - white = get_style_context()->get_color(Gtk::STATE_FLAG_NORMAL); - queue_draw (); -} - // // // @@ -836,7 +821,7 @@ HistogramArea::HistogramArea (FullModeListener *fml) : //needChroma unactive by bhist(256); chist(256); - //set_size_request(100, -1); + Glib::RefPtr style = get_style_context(); haih = new HistogramAreaIdleHelper; haih->harea = this; @@ -968,11 +953,9 @@ void HistogramArea::updateBackBuffer () setDrawRectangle(window, 0, 0, winw, winh, true); Cairo::RefPtr cr = Cairo::Context::create(surface); + const Glib::RefPtr style = get_style_context(); - cr->set_antialias(Cairo::ANTIALIAS_NONE); - cr->set_source_rgb (white.get_red(), white.get_green(), white.get_blue()); - cr->rectangle(0, 0, w, h); - cr->fill(); + style->render_background(cr, 0, 0, surface->get_width(), surface->get_height()); if (valid) { // For RAW mode use the other hists @@ -1122,12 +1105,12 @@ void HistogramArea::updateBackBuffer () } } + Gdk::RGBA c = style->get_border_color(Gtk::STATE_FLAG_NORMAL); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->set_line_width (1.0); cr->set_antialias(Cairo::ANTIALIAS_NONE); - cr->set_line_join(Cairo::LINE_JOIN_BEVEL); - cr->set_source_rgb (mgray.get_red(), mgray.get_green(), mgray.get_blue()); - cr->rectangle(0.5, 0.5, w - 1, h - 1); - cr->stroke(); + // Draw the content cr->set_line_join(Cairo::LINE_JOIN_MITER); std::valarray ch_ds (1); ch_ds[0] = 4; @@ -1142,18 +1125,21 @@ void HistogramArea::updateBackBuffer () cr->move_to(3 * w / 4 + 0.5, 1.5); cr->line_to(3 * w / 4 + 0.5, h - 2); cr->stroke(); - cr->move_to(1.5, w / 4 + 0.5); - cr->line_to(w - 2, w / 4 + 0.5); + cr->move_to(1.5, h / 4 + 0.5); + cr->line_to(w - 2, h / 4 + 0.5); cr->stroke(); - cr->move_to(1.5, 2 * w / 4 + 0.5); - cr->line_to(w - 2, 2 * w / 4 + 0.5); + cr->move_to(1.5, 2 * h / 4 + 0.5); + cr->line_to(w - 2, 2 * h / 4 + 0.5); cr->stroke(); - cr->move_to(1.5, 3 * w / 4 + 0.5); - cr->line_to(w - 2, 3 * w / 4 + 0.5); + cr->move_to(1.5, 3 * h / 4 + 0.5); + cr->line_to(w - 2, 3 * h / 4 + 0.5); cr->stroke(); cr->unset_dash(); + // Draw the frame's border + style->render_frame(cr, 0, 0, surface->get_width(), surface->get_height()); + oldwidth = w; oldheight = h; @@ -1166,14 +1152,6 @@ void HistogramArea::on_realize () Gtk::DrawingArea::on_realize(); Glib::RefPtr window = get_window(); add_events(Gdk::BUTTON_PRESS_MASK); - - black = Gdk::RGBA ("black"); - red = Gdk::RGBA ("red"); - green = Gdk::RGBA ("green"); - blue = Gdk::RGBA ("blue"); - lgray = Gdk::RGBA ("gray75"); - mgray = Gdk::RGBA ("gray50"); - dgray = Gdk::RGBA ("gray25"); } void HistogramArea::drawCurve(Cairo::RefPtr &cr, @@ -1212,13 +1190,6 @@ void HistogramArea::drawMarks(Cairo::RefPtr &cr, cr->fill(); } -void HistogramArea::on_style_updated () -{ - - white = get_style_context()->get_color(Gtk::STATE_FLAG_NORMAL); - queue_draw (); -} - bool HistogramArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { @@ -1227,7 +1198,7 @@ bool HistogramArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) int winx, winy, winw, winh; window->get_geometry(winx, winy, winw, winh); - if (winw != oldwidth && winh != oldheight) { + if (winw != oldwidth || winh != oldheight || isDirty ()) { updateBackBuffer (); } diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 5d3fe9c0f..f049f77cb 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -50,15 +50,6 @@ class HistogramRGBArea : public Gtk::DrawingArea, public BackBuffer protected: - Gdk::RGBA black; - Gdk::RGBA white; - Gdk::RGBA red; - Gdk::RGBA green; - Gdk::RGBA blue; - Gdk::RGBA lgray; - Gdk::RGBA mgray; - Gdk::RGBA dgray; - int val; int r; int g; @@ -100,7 +91,6 @@ public: void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); - void on_style_updated (); private: void rgb2lab (Glib::ustring profile, Glib::ustring profileW, int r, int g, int b, float &LAB_l, float &LAB_a, float &LAB_b); Gtk::SizeRequestMode get_request_mode_vfunc () const; @@ -124,14 +114,6 @@ class HistogramArea : public Gtk::DrawingArea, public BackBuffer protected: - Gdk::RGBA black; - Gdk::RGBA white; - Gdk::RGBA red; - Gdk::RGBA green; - Gdk::RGBA blue; - Gdk::RGBA lgray; - Gdk::RGBA mgray; - Gdk::RGBA dgray; LUTu lhist, rhist, ghist, bhist, chist; LUTu lhistRaw, rhistRaw, ghistRaw, bhistRaw; @@ -155,7 +137,6 @@ public: void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); - void on_style_updated (); private: void drawCurve(Cairo::RefPtr &cr, LUTu & data, double scale, int hsize, int vsize); diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index e79e8f97b..f65a6d840 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -38,23 +38,12 @@ MyCurve::MyCurve () : pipetteR(-1.f), pipetteG(-1.f), pipetteB(-1.f), pipetteVal curveIsDirty = true; edited_point = -1; -//#if defined (__APPLE__) - // Workaround: disabling POINTER_MOTION_HINT_MASK as for gtk 2.24.22 the get_pointer() function is buggy for quartz and modifier mask is not updated correctly. - // This workaround should be removed when bug is fixed in GTK2 or when migrating to GTK3 - //add_events(Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); -//#else - add_events(Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); -//#endif + add_events(Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); mcih = new MyCurveIdleHelper; mcih->myCurve = this; mcih->destroyed = false; mcih->pending = 0; - - Glib::RefPtr style = get_style_context(); - style->add_class(GTK_STYLE_CLASS_BACKGROUND); - style->add_class(GTK_STYLE_CLASS_FLAT); - style->add_class(GTK_STYLE_CLASS_NOTEBOOK); } MyCurve::~MyCurve () diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 3ead70dbb..7fc2ac0c2 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -37,11 +37,6 @@ MyDiagonalCurve::MyDiagonalCurve () : activeParam(-1), bghistvalid(false) editedPos.resize(2); editedPos.at(0) = editedPos.at(1) = 0.0; - Glib::RefPtr style = get_style_context(); - style->add_class(GTK_STYLE_CLASS_FRAME); - //style->add_class(GTK_STYLE_CLASS_NOTEBOOK); - //style->add_class(GTK_STYLE_CLASS_FLAT); - signal_event().connect( sigc::mem_fun(*this, &MyDiagonalCurve::handleEvents) ); curve.type = DCT_Spline; diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index 5c92a2b0c..f96081377 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -41,11 +41,6 @@ MyFlatCurve::MyFlatCurve () editedPos.resize(4); editedPos.at(0) = editedPos.at(1) = editedPos.at(2) = editedPos.at(3) = 0.0; - Glib::RefPtr style = get_style_context(); - style->add_class(GTK_STYLE_CLASS_FRAME); - //style->add_class(GTK_STYLE_CLASS_NOTEBOOK); - //style->add_class(GTK_STYLE_CLASS_FLAT); - signal_event().connect( sigc::mem_fun(*this, &MyFlatCurve::handleEvents) ); // By default, we create a curve with 8 control points diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index c25ae8f9e..4847642df 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -328,6 +328,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*medianmap); medianmap->show (); expsettings->add(*settingsVBox); + expsettings->setLevel(2); neutrHBox = Gtk::manage (new Gtk::HBox ()); neutrHBox->set_border_width (2);