diff --git a/rtdata/themes/RawTherapee.css b/rtdata/themes/RawTherapee.css index ec74b17cf..8a64ae970 100644 --- a/rtdata/themes/RawTherapee.css +++ b/rtdata/themes/RawTherapee.css @@ -22,6 +22,10 @@ color: #AAAAAA; } +*:disabled { + color: #666666; +} + .view:selected { color: #262626; background-color: #AAAAAA @@ -41,20 +45,19 @@ background-color: #404040; } -box { - border-width: 0; - border-style: none; - border-radius: 0; - margin: 0; - padding: 0; +window > decoration { + box-shadow: none; + margin: 0px; } -grid { - margin: 2px; - padding: 0; +box, grid { border-width: 0; border-style: none; border-radius: 0; + margin: 1px; + padding: 0; + min-height: 5px; + min-width: 5px; } /* Affects all frames except in the toolbox */ @@ -147,13 +150,6 @@ combobox { margin-left: 2px; } -box { - padding: 0; - margin: 1px; - min-height: 5px; - min-width: 5px; -} - scale { padding: 0; min-height: 5px; @@ -170,10 +166,19 @@ scale slider { scale slider:hover { background-image: linear-gradient(#444444, #3E3E3E, #393939); } +scale:disabled slider { + background-image: none; + background-color: #444; + border-color: #282828; +} scale trough { margin: 6px 6px; /* have to be half of "scale slider / min-width min-height" */ background-color: #2A2A2A; } +scale:disabled trough { + background-color: #444; + border-color: #282828; +} /*.EditorTopPanel .button, .ToolBarPanelFileBrowser .button, .EditorZoomPanel .button {*/ .button { @@ -215,8 +220,12 @@ progressbar.horizontal trough progress { .drawingarea { border-radius: 0; - background-color: #363636; - border: 1px solid #252525; + background-color: #2A2A2A; + border: 1px solid #1D1D1D; +} +.drawingarea:disabled { + background-color: #444; + border-color: #282828; } .drawingarea:selected { @@ -268,7 +277,7 @@ button.Right { /* [1.23[-][+]] */ entry, spinbutton { - padding: 1px; + padding: 0; margin: 0; min-height: 10px; background-color: #262626; @@ -300,13 +309,17 @@ menuitem { min-height: 10px; } +#HistogramPanel { + margin: 2px 4px; +} + #MyExpander { margin: 0 5px 0 5px; padding: 0; } /* Tool background */ -#ExpanderBox > box { +#ExpanderBox > box, #ExpanderBox > grid { background-color: #363636; border-width: 1px; border-style: solid; @@ -320,7 +333,7 @@ menuitem { background-color: #363636; } -#ExpanderBox frame, +#ExpanderBox frame, #ExpanderBox2 frame, #ExpanderBox3 frame { padding: 2px 0 0 0; @@ -336,22 +349,22 @@ menuitem { padding: 3px; } -#ExpanderBox frame > label, #ExpanderBox frame frame > label, +#ExpanderBox frame > label, #ExpanderBox frame frame > label, #ExpanderBox2 frame > label, #ExpanderBox2 frame frame > label, #ExpanderBox3 frame > label, #ExpanderBox3 frame frame > label { margin-left: 7pt; margin-top: 0; } -#ExpanderBox frame > box, #ExpanderBox frame frame > box, -#ExpanderBox2 frame > box, #ExpanderBox2 frame frame > box, -#ExpanderBox3 frame > box, #ExpanderBox3 frame frame > box { +#ExpanderBox frame > box, #ExpanderBox frame frame > box, #ExpanderBox frame > grid, #ExpanderBox frame frame > grid, +#ExpanderBox2 frame > box, #ExpanderBox2 frame frame > box, #ExpanderBox2 frame > grid, #ExpanderBox2 frame frame > grid, +#ExpanderBox3 frame > box, #ExpanderBox3 frame frame > box, #ExpanderBox3 frame > grid, #ExpanderBox3 frame frame > grid { margin: 2px; } -#ExpanderBox > box > checkbutton, #ExpanderBox > box > box, -#ExpanderBox2 > box > checkbutton, #ExpanderBox2 > box > box, -#ExpanderBox3 > box > checkbutton, #ExpanderBox3 > box > box { - margin-top: 3px; +#ExpanderBox > box > checkbutton, #ExpanderBox > box > box, #ExpanderBox > grid > checkbutton, #ExpanderBox > box > grid, #ExpanderBox > grid > grid, #ExpanderBox frame > box > grid, #ExpanderBox frame > grid > grid, #ExpanderBox frame > grid > box, +#ExpanderBox2 > box > checkbutton, #ExpanderBox2 > box > box, #ExpanderBox2 > grid > checkbutton, #ExpanderBox2 > box > grid, #ExpanderBox2 > grid > grid, #ExpanderBox2 frame > box > grid, #ExpanderBox2 frame > grid > grid, #ExpanderBox2 frame > grid > box, +#ExpanderBox3 > box > checkbutton, #ExpanderBox3 > box > box, #ExpanderBox3 > grid > checkbutton, #ExpanderBox3 > box > grid, #ExpanderBox3 > grid > grid, #ExpanderBox3 frame > box > grid, #ExpanderBox3 frame > grid > grid, #ExpanderBox3 frame > grid > box { + margin-top: 2px; } #ExpanderBox frame drawingarea { @@ -371,7 +384,7 @@ menuitem { } /* Sub-tool (MyExpander) background */ -#ExpanderBox2 > box { +#ExpanderBox2 > box, #ExpanderBox2 > grid { background-color: #3B3B3B; border: 1px solid #2A2A2A; border-radius: 4px; @@ -510,7 +523,7 @@ notebook stack { margin: 0; } -paned box { +paned box, paned grid { padding: 0; margin: 0; border-style: none; @@ -601,7 +614,7 @@ paned > separator { } #PreviewWindow { - border-style: solid none; + border-style: solid none; } .tooltip { diff --git a/rtgui/coloredbar.cc b/rtgui/coloredbar.cc index aa5f873a0..9ec966d30 100644 --- a/rtgui/coloredbar.cc +++ b/rtgui/coloredbar.cc @@ -27,17 +27,22 @@ ColoredBar::ColoredBar (eRTOrientation orient) this->x = this->y = this->w = this->h = 0; } +bool ColoredBar::setDrawRectangle(int newX, int newY, int newW, int newH, bool updateBackBufferSize) +{ + return BackBuffer::setDrawRectangle(Cairo::FORMAT_ARGB32, newX, newY, newW, newH, updateBackBufferSize); +} + /* * Redraw the bar to a Cairo::ImageSurface */ -void ColoredBar::expose(Cairo::RefPtr destSurface) +void ColoredBar::expose(Gtk::DrawingArea &drawingArea, Cairo::RefPtr destSurface) { // look out if the Surface has to be redrawn if (!surfaceCreated() || !destSurface) { return; } - draw(); + updateBackBuffer(drawingArea); Gdk::Rectangle rect(x, y, w, h); copySurface(destSurface, &rect); } @@ -45,26 +50,26 @@ void ColoredBar::expose(Cairo::RefPtr destSurface) /* * Redraw the bar to a Gdk::Window */ -void ColoredBar::expose(Glib::RefPtr destWindow) +void ColoredBar::expose(Gtk::DrawingArea &drawingArea, Glib::RefPtr destWindow) { // look out if the Surface has to be redrawn if (!surfaceCreated() || !destWindow) { return; } - draw(); + updateBackBuffer(drawingArea); Gdk::Rectangle rect(x, y, w, h); copySurface(destWindow, &rect); } -void ColoredBar::expose(const Cairo::RefPtr< Cairo::Context> &cr) +void ColoredBar::expose(Gtk::DrawingArea &drawingArea, const Cairo::RefPtr< Cairo::Context> &cr) { // look out if the Surface has to be redrawn if (!surfaceCreated()) { return; } - draw(); + updateBackBuffer(drawingArea); Gdk::Rectangle rect(x, y, w, h); copySurface(cr, &rect); } @@ -72,19 +77,19 @@ void ColoredBar::expose(const Cairo::RefPtr< Cairo::Context> &cr) /* * Redraw the bar to a Gdk::Window */ -void ColoredBar::expose(BackBuffer *backBuffer) +void ColoredBar::expose(Gtk::DrawingArea &drawingArea, BackBuffer *backBuffer) { // look out if the Surface has to be redrawn if (!surfaceCreated() || !backBuffer) { return; } - draw(); + updateBackBuffer(drawingArea); Gdk::Rectangle rect(x, y, w, h); copySurface(backBuffer, &rect); } -void ColoredBar::draw() +void ColoredBar::updateBackBuffer(Gtk::DrawingArea &drawingArea) { if (isDirty()) { Cairo::RefPtr cr = getContext(); @@ -126,9 +131,7 @@ void ColoredBar::draw() } else { // ask the ColorProvider to provide colors :) for each pixels if (colorProvider) { - unsigned char *dst; unsigned char *surfaceData = surface->get_data(); - int surfW = getWidth(); cr->set_antialias(Cairo::ANTIALIAS_NONE); cr->set_line_width(1.); @@ -137,13 +140,14 @@ void ColoredBar::draw() case (RTO_Left2Right): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { + unsigned char *pixel = surfaceData + (py * w + px) * 4; double x_ = double( px); //double y_ = double((h-1)-py); unused double x01 = x_ / double(w - 1); double y01 = double(py) / double(h - 1); colorProvider->colorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + rtengine::poke01_d(pixel, ccRed, ccGreen, ccBlue); } } @@ -152,13 +156,14 @@ void ColoredBar::draw() case (RTO_Right2Left): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { + unsigned char *pixel = surfaceData + (py * w + px) * 4; //double x_ = double((w-1)-px); unused //double y_ = double((h-1)-py); unused double x01 = double(px) / double(w - 1); double y01 = double(py) / double(h - 1); colorProvider->colorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + rtengine::poke01_d(pixel, ccRed, ccGreen, ccBlue); } } @@ -167,13 +172,14 @@ void ColoredBar::draw() case (RTO_Bottom2Top): for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { + unsigned char *pixel = surfaceData + (py * w + px) * 4; //double x_ = double((w-1)-px); unused //double y_ = double((h-1)-py); unused double x01 = double(px) / double(w - 1); double y01 = double(py) / double(h - 1); colorProvider->colorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + rtengine::poke01_d(pixel, ccRed, ccGreen, ccBlue); } } @@ -183,91 +189,19 @@ void ColoredBar::draw() default: for (int py = 0; py < h; ++py) { for (int px = 0; px < w; ++px) { + unsigned char *pixel = surfaceData + (py * w + px) * 4; double x_ = double( px); double y_ = double( py); double x01 = x_ / double(w - 1); double y01 = y_ / double(h - 1); colorProvider->colorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + rtengine::poke01_d(pixel, ccRed, ccGreen, ccBlue); } } break; } - - - - /* - unsigned char *dst; - unsigned char *surfaceData = surface->get_data(); - int surfW = getWidth(); - - cr->set_antialias(Cairo::ANTIALIAS_NONE); - cr->set_line_width(1.); - switch (orientation) { - case (RTO_Left2Right): - for (int py=0; pycolorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); - } - } - break; - case (RTO_Right2Left): - for (int py=0; pycolorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); - } - } - break; - case (RTO_Bottom2Top): - for (int py=0; pycolorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); - } - } - break; - case (RTO_Top2Bottom): - default: - for (int py=0; pycolorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - - rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); - } - } - break; - } - - */ - - } } diff --git a/rtgui/coloredbar.h b/rtgui/coloredbar.h index a0c13b6d2..010d0dcb6 100644 --- a/rtgui/coloredbar.h +++ b/rtgui/coloredbar.h @@ -25,12 +25,17 @@ /* * Parent class for all colored bar type; a ColorProvider has to be set * thanks to "setColorProvider" to be able to display colors inside the bar + * + * WARNING: If the color has no gradient defined or can't get colors from the provider, + * the bar will have undefined data, and the calling class will have to draw + * the bar itself, i.e. use render_background (depending on its Gtk::Style) + * */ -class ColoredBar : public BackBuffer, public ColorCaller +class ColoredBar : private BackBuffer, public ColorCaller { private: - void draw(); + void updateBackBuffer(Gtk::DrawingArea &drawingArea); protected: eRTOrientation orientation; @@ -38,11 +43,12 @@ protected: public: explicit ColoredBar (eRTOrientation orient); + bool setDrawRectangle(int newX, int newY, int newW, int newH, bool updateBackBufferSize = true); - void expose(Glib::RefPtr destWindow); - void expose(Cairo::RefPtr destSurface); - void expose(BackBuffer *backBuffer); - void expose(const Cairo::RefPtr< Cairo::Context> &cr); + void expose(Gtk::DrawingArea &drawingArea, Glib::RefPtr destWindow); + void expose(Gtk::DrawingArea &drawingArea, Cairo::RefPtr destSurface); + void expose(Gtk::DrawingArea &drawingArea, BackBuffer *backBuffer); + void expose(Gtk::DrawingArea &drawingArea, const Cairo::RefPtr< Cairo::Context> &cr); bool canGetColors(); @@ -51,6 +57,10 @@ public: // by clearing the gradient, the ColorProvider will have to provide colors on a per pixel basis if a ColorProvider // has been set, through ColorProvider::colorForValue on next ColoredBar::expose void clearBgGradient (); + + void setDirty(bool isDirty) { + BackBuffer::setDirty(isDirty); + } }; #endif diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index b745642f0..f813919bb 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -26,12 +26,13 @@ #include "multilangmgr.h" #include "rtimage.h" -CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel) : curveDir(curveDir), curve_reset(nullptr), +CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel) : curveDir(curveDir), line(0), curve_reset(nullptr), displayedCurve(nullptr), flatSubGroup(nullptr), diagonalSubGroup(nullptr), cl(nullptr), numberOfPackedCurve(0) { // We set the label to the one provided as parameter, even if it's an empty string curveGroupLabel = Gtk::manage (new Gtk::Label (groupLabel + ":", Gtk::ALIGN_START)); + setExpandAlignProperties(curveGroupLabel, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); } CurveEditorGroup::~CurveEditorGroup() @@ -115,35 +116,45 @@ void CurveEditorGroup::newLine() { if (curveEditors.size() > numberOfPackedCurve) { - Gtk::HBox* headerBox = Gtk::manage (new Gtk::HBox ()); + Gtk::Grid* currLine = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(currLine, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + bool isHeader = false; + int x = 0; if (!numberOfPackedCurve) { - headerBox->pack_start(*curveGroupLabel, Gtk::PACK_SHRINK, 2); + isHeader = true; + currLine->attach(*curveGroupLabel, x++, 0, 1, 1); + } + for (int i = numberOfPackedCurve; i < (int)(curveEditors.size()); ++i) { + currLine->attach(*curveEditors[i]->curveType->buttonGroup, x++, 0, 1, 1); + + if (curveEditors[i]->relatedWidget != nullptr) { + currLine->attach(*curveEditors[i]->relatedWidget, x++, 0, 1, 1); + } + + numberOfPackedCurve++; + } + + if (isHeader) { curve_reset = Gtk::manage (new Gtk::Button ()); + setExpandAlignProperties(curve_reset, false, false, Gtk::ALIGN_END, Gtk::ALIGN_FILL); curve_reset->add (*Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png"))); curve_reset->set_relief (Gtk::RELIEF_NONE); curve_reset->set_tooltip_text (M("CURVEEDITOR_TOOLTIPLINEAR")); curve_reset->signal_clicked().connect( sigc::mem_fun(*this, &CurveEditorGroup::curveResetPressed) ); - headerBox->pack_end (*curve_reset, Gtk::PACK_SHRINK, 0); + currLine->attach(*curve_reset, x++, 0, 1, 1); } - int j = numberOfPackedCurve; - - for (int i = (int)(curveEditors.size()) - 1; i >= j; i--) { - if (curveEditors[i]->relatedWidget != nullptr) { - headerBox->pack_end (*curveEditors[i]->relatedWidget, Gtk::PACK_EXPAND_WIDGET, 2); - } - - headerBox->pack_end (*curveEditors[i]->curveType->buttonGroup, /*hasRelatedWidget ? Gtk::PACK_SHRINK :*/ Gtk::PACK_EXPAND_WIDGET, 2); - numberOfPackedCurve++; - } - - pack_start (*headerBox, Gtk::PACK_SHRINK, 2); + attach(*currLine, 0, line++, 1, 1); } +} - +void CurveEditorGroup::attachCurve (Gtk::Grid* curve) +{ + attach(*curve, 0, line, 1, 1); } /* diff --git a/rtgui/curveeditorgroup.h b/rtgui/curveeditorgroup.h index 4cecc498e..2b1da158f 100644 --- a/rtgui/curveeditorgroup.h +++ b/rtgui/curveeditorgroup.h @@ -39,7 +39,7 @@ class FlatCurveEditorSubGroup; * - to start a new line of curve button, use the 'newLine' method * - if you add more than one curve, you must add a "CurveEditor* ce" parameter to your listener */ -class CurveEditorGroup : public Gtk::VBox, public CurveListener +class CurveEditorGroup : public Gtk::Grid, public CurveListener { friend class CurveEditor; @@ -49,6 +49,7 @@ class CurveEditorGroup : public Gtk::VBox, public CurveListener private: Glib::ustring& curveDir; + int line; protected: Gtk::Label* curveGroupLabel; @@ -86,6 +87,7 @@ public: } //void on_realize (); CurveEditor* addCurve(CurveType cType, Glib::ustring curveLabel, Gtk::Widget *relatedWidget = nullptr, bool periodic = true); + void attachCurve (Gtk::Grid* curve); protected: //void curveTypeToggled (); diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index 2da9f57f9..8f81333d7 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -41,7 +41,6 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, Gtk::PositionType sideStart = options.curvebboxpos == 0 || options.curvebboxpos == 2 ? Gtk::POS_LEFT : Gtk::POS_TOP; Gtk::PositionType sideEnd = options.curvebboxpos == 0 || options.curvebboxpos == 2 ? Gtk::POS_RIGHT : Gtk::POS_BOTTOM; bool vExpand = options.curvebboxpos == 0 || options.curvebboxpos == 2; - bool hExpand = !vExpand; valLinear = (int)DCT_Linear; valUnchanged = (int)DCT_Unchanged; @@ -605,7 +604,7 @@ void DiagonalCurveEditorSubGroup::switchGUI() if (dCurve) { - // Initializing GUI values + repacking the appropriated widget + // Initializing GUI values + attaching the appropriated widget //dCurve->typeconn.block(true); // first we update the colored bar @@ -667,7 +666,7 @@ void DiagonalCurveEditorSubGroup::switchGUI() customCurve->setColoredBar(leftBar, bottomBar); customCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editCustom, editCustomConn); - parent->pack_start (*customCurveGrid); + parent->attachCurve (customCurveGrid); customCurveGrid->check_resize(); break; @@ -692,13 +691,13 @@ void DiagonalCurveEditorSubGroup::switchGUI() darks->setLabel(label[1]); shadows->setValue (dCurve->paramCurveEd.at(7)); shadows->setLabel(label[0]); - shcSelector->setColorProvider(barColorProvider, dCurve->getBottomBarCallerId()); - shcSelector->setBgGradient(bgGradient); + shcSelector->coloredBar.setColorProvider(barColorProvider, dCurve->getBottomBarCallerId()); + shcSelector->coloredBar.setBgGradient(bgGradient); shcSelector->setMargins( (leftBar ? CBAR_WIDTH + CBAR_MARGIN : RADIUS), RADIUS ); paramCurve->setColoredBar(leftBar, nullptr); paramCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editParam, editParamConn); - parent->pack_start (*paramCurveGrid); + parent->attachCurve (paramCurveGrid); break; } @@ -708,7 +707,7 @@ void DiagonalCurveEditorSubGroup::switchGUI() NURBSCurve->setColoredBar(leftBar, bottomBar); NURBSCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editNURBS, editNURBSConn); - parent->pack_start (*NURBSCurveGrid); + parent->attachCurve (NURBSCurveGrid); NURBSCurveGrid->check_resize(); break; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 9ae2630d5..6b961d6aa 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -49,9 +49,8 @@ private: private: void prepareProfileBox () { - profileBox.set_size_request (100, -1); profileBox.setPreferredWidth (90, 150); - setExpandAlignProperties (&profileBox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (&profileBox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); profileBox.append (M ("PREFERENCES_PROFILE_NONE")); #ifdef WIN32 @@ -75,7 +74,7 @@ private: intentBox.addEntry ("intent-perceptual.png", M ("PREFERENCES_INTENT_PERCEPTUAL")); intentBox.addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE")); intentBox.addEntry ("intent-absolute.png", M ("PREFERENCES_INTENT_ABSOLUTE")); - setExpandAlignProperties (intentBox.buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (intentBox.buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); intentBox.setSelected(1); intentBox.show (); @@ -455,24 +454,24 @@ EditorPanel::EditorPanel (FilePanel* filePanel) saveimgas = Gtk::manage (new Gtk::Button ()); saveimgas->add (*saveButtonImage); saveimgas->set_tooltip_markup (M ("MAIN_BUTTON_SAVE_TOOLTIP")); - setExpandAlignProperties (saveimgas, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (saveimgas, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); Gtk::Image *queueButtonImage = Gtk::manage (new RTImage ("processing.png")); queueimg = Gtk::manage (new Gtk::Button ()); queueimg->add (*queueButtonImage); queueimg->set_tooltip_markup (M ("MAIN_BUTTON_PUTTOQUEUE_TOOLTIP")); - setExpandAlignProperties (queueimg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (queueimg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); Gtk::Image *sendToEditorButtonImage = Gtk::manage (new RTImage ("image-editor.png")); sendtogimp = Gtk::manage (new Gtk::Button ()); sendtogimp->add (*sendToEditorButtonImage); sendtogimp->set_tooltip_markup (M ("MAIN_BUTTON_SENDTOEDITOR_TOOLTIP")); - setExpandAlignProperties (sendtogimp, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (sendtogimp, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); // Status box progressLabel = Gtk::manage (new MyProgressBar (300)); progressLabel->set_show_text (true); - setExpandAlignProperties (progressLabel, true, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + setExpandAlignProperties (progressLabel, true, false, Gtk::ALIGN_START, Gtk::ALIGN_FILL); progressLabel->set_fraction (0.0); // tbRightPanel_1 @@ -483,7 +482,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) tbRightPanel_1->set_active (true); tbRightPanel_1->set_tooltip_markup (M ("MAIN_TOOLTIP_SHOWHIDERP1")); tbRightPanel_1->set_image (*iRightPanel_1_Hide); - setExpandAlignProperties (tbRightPanel_1, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (tbRightPanel_1, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); // ShowHideSidePanels tbShowHideSidePanels = new Gtk::ToggleButton (); @@ -493,7 +492,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) tbShowHideSidePanels->set_active (false); tbShowHideSidePanels->set_tooltip_markup (M ("MAIN_BUTTON_SHOWHIDESIDEPANELS_TOOLTIP")); tbShowHideSidePanels->set_image (*iShowHideSidePanels); - setExpandAlignProperties (tbShowHideSidePanels, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (tbShowHideSidePanels, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); navPrev = navNext = navSync = nullptr; @@ -505,7 +504,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) navPrev->add (*navPrevImage); navPrev->set_relief (Gtk::RELIEF_NONE); navPrev->set_tooltip_markup (M ("MAIN_BUTTON_NAVPREV_TOOLTIP")); - setExpandAlignProperties (navPrev, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (navPrev, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); Gtk::Image *navNextImage = Gtk::manage (new RTImage ("nav-next.png")); navNextImage->set_padding (0, 0); @@ -513,7 +512,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) navNext->add (*navNextImage); navNext->set_relief (Gtk::RELIEF_NONE); navNext->set_tooltip_markup (M ("MAIN_BUTTON_NAVNEXT_TOOLTIP")); - setExpandAlignProperties (navNext, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (navNext, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); Gtk::Image *navSyncImage = Gtk::manage (new RTImage ("nav-sync.png")); navSyncImage->set_padding (0, 0); @@ -521,7 +520,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) navSync->add (*navSyncImage); navSync->set_relief (Gtk::RELIEF_NONE); navSync->set_tooltip_markup (M ("MAIN_BUTTON_NAVSYNC_TOOLTIP")); - setExpandAlignProperties (navSync, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties (navSync, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); } // ================== PACKING THE BOTTOM WIDGETS ================= diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index d5aea2ebe..2e690f32a 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -337,7 +337,7 @@ void FlatCurveEditorSubGroup::switchGUI() CPointsCurve->setColoredBar(leftBar, bottomBar); CPointsCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editCPoints, editCPointsConn); - parent->pack_start (*CPointsCurveGrid); + parent->attachCurve (CPointsCurveGrid); CPointsCurveGrid->check_resize(); break; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 0129a50dc..51c5f40e6 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -977,7 +977,7 @@ void MyComboBoxText::get_preferred_width_vfunc (int &minimum_width, int &natural natural_width = rtengine::max(naturalWidth, 10); minimum_width = rtengine::max(minimumWidth, 10); } -void MyComboBoxText::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void MyComboBoxText::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { natural_width = rtengine::max(naturalWidth, 10); minimum_width = rtengine::max(minimumWidth, 10); @@ -1023,7 +1023,7 @@ void MyComboBox::get_preferred_width_vfunc (int &minimum_width, int &natural_wid natural_width = rtengine::max(naturalWidth, 10); minimum_width = rtengine::max(minimumWidth, 10); } -void MyComboBox::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void MyComboBox::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { natural_width = rtengine::max(naturalWidth, 10); minimum_width = rtengine::max(minimumWidth, 10); @@ -1146,7 +1146,7 @@ void MyFileChooserButton::get_preferred_width_vfunc (int &minimum_width, int &na { minimum_width = natural_width = 35; } -void MyFileChooserButton::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void MyFileChooserButton::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { minimum_width = natural_width = 35; } @@ -1266,7 +1266,7 @@ void MyProgressBar::get_preferred_width_vfunc (int &minimum_width, int &natural_ natural_width = rtengine::max(w, 50); } -void MyProgressBar::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void MyProgressBar::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index ba7920743..bb96eae40 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -277,7 +277,7 @@ class MyComboBox : public Gtk::ComboBox bool on_scroll_event (GdkEventScroll* event); void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; - void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; public: MyComboBox (); @@ -294,7 +294,7 @@ class MyComboBoxText : public Gtk::ComboBoxText bool on_scroll_event (GdkEventScroll* event); void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; - void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; public: MyComboBoxText (); @@ -336,7 +336,7 @@ class MyFileChooserButton : public Gtk::FileChooserButton protected: bool on_scroll_event (GdkEventScroll* event); void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; - void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; public: MyFileChooserButton (const Glib::ustring& title, Gtk::FileChooserAction action = Gtk::FILE_CHOOSER_ACTION_OPEN); @@ -409,7 +409,7 @@ private: int w; void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; - void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; public: MyProgressBar(int width); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 23bb616d5..94fa2f24d 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -454,7 +454,7 @@ void HistogramRGBArea::get_preferred_height_for_width_vfunc (int width, int &min natural_height = bHeight; } -void HistogramRGBArea::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void HistogramRGBArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } @@ -882,7 +882,7 @@ void HistogramArea::get_preferred_height_for_width_vfunc (int width, int &minimu natural_height = gHeight; } -void HistogramArea::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 860ecd6f8..2f8eb6da5 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -97,7 +97,7 @@ private: void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int h, int &minimum_width, int &natural_width) const; // Some ... }; @@ -145,7 +145,7 @@ private: void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; }; class HistogramPanel : public Gtk::Grid, public PointerMotionListener, public FullModeListener diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 004027477..bddcf838b 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -720,3 +720,31 @@ int ImageArea::getSpotWBRectSize () return 1; } } + +Gtk::SizeRequestMode ImageArea::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; +} + +void ImageArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + minimum_height= 50; + natural_height = 300; +} + +void ImageArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 100; + natural_width = 400; +} + +void ImageArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + get_preferred_height_vfunc(minimum_height, natural_height); +} + +void ImageArea::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index 7200d02c0..ff51111d1 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -60,6 +60,12 @@ protected: ImageAreaToolListener* listener; CropWindow* getCropWindow (int x, int y); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int &minimum_height, int &natural_height) 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_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; + bool firstOpen; int fullImageWidth, fullImageHeight; public: diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 2253c35df..6de56e81b 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -296,3 +296,31 @@ void Inspector::setActive(bool state) active = state; } + +Gtk::SizeRequestMode Inspector::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; +} + +void Inspector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + minimum_height= 50; + natural_height = 300; +} + +void Inspector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 50; + natural_width = 200; +} + +void Inspector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + get_preferred_height_vfunc(minimum_height, natural_height); +} + +void Inspector::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + diff --git a/rtgui/inspector.h b/rtgui/inspector.h index 813094732..305558817 100644 --- a/rtgui/inspector.h +++ b/rtgui/inspector.h @@ -86,6 +86,13 @@ public: { return active; }; + + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; + }; #endif diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index 8c217f31b..c36ec1cc7 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -118,7 +118,7 @@ void MyCurve::get_preferred_height_for_width_vfunc (int width, int &minimum_heig natural_height = minimum_height; } -void MyCurve::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void MyCurve::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } diff --git a/rtgui/mycurve.h b/rtgui/mycurve.h index 48f195bef..0c27ba8b3 100644 --- a/rtgui/mycurve.h +++ b/rtgui/mycurve.h @@ -68,7 +68,7 @@ protected: ColoredBar *leftBar; ColoredBar *bottomBar; CursorShape cursor_type; - int graphX, graphY, graphW, graphH; /// position and dimensions of the graphic area, excluding surrounding space for the points of for the colored bar + int graphX, graphY, graphW, graphH; /// position and dimensions of the graphic area, excluding surrounding space for the points or for the colored bar int prevGraphW, prevGraphH; /// previous inner width and height of the editor Gdk::ModifierType mod_type; int cursorX; /// X coordinate in the graph of the cursor diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index e50f77106..aac021748 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -235,6 +235,8 @@ void MyDiagonalCurve::draw (int handle) cr->paint (); cr->set_operator (Cairo::OPERATOR_OVER); + style->render_background(cr, graphX, graphY-graphH, graphW, graphH); + Gdk::RGBA c; // histogram in the background @@ -426,8 +428,8 @@ void MyDiagonalCurve::draw (int handle) // first the background int bWidth = CBAR_WIDTH; BackBuffer *bb = this; - leftBar->setDrawRectangle(Cairo::FORMAT_ARGB32, 1, graphY - graphH + 1, bWidth - 2, graphH - 2); - leftBar->expose(bb); + leftBar->setDrawRectangle(1, graphY - graphH + 1, bWidth - 2, graphH - 2); + leftBar->expose(*this, bb); // now the border c = style->get_border_color(state); @@ -441,8 +443,8 @@ void MyDiagonalCurve::draw (int handle) // first the background int bWidth = CBAR_WIDTH; BackBuffer *bb = this; - bottomBar->setDrawRectangle(Cairo::FORMAT_ARGB32, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2); - bottomBar->expose(bb); + bottomBar->setDrawRectangle(graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2); + bottomBar->expose(*this, bb); // now the border c = style->get_border_color (state); @@ -511,8 +513,6 @@ bool MyDiagonalCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) } } - Glib::RefPtr style = get_style_context(); - style->render_background(cr, 0., 0., (double)get_width(), (double)get_height()); draw (lit_point); copySurface(cr); return false; diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index b0abb4e1f..a5f08b8ed 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -142,6 +142,8 @@ void MyFlatCurve::draw () cr->paint (); cr->set_operator (Cairo::OPERATOR_OVER); + style->render_background(cr, graphX, graphY-graphH, graphW, graphH); + Gdk::RGBA c; cr->set_line_width (1.0); @@ -167,8 +169,8 @@ void MyFlatCurve::draw () // first the background int bWidth = CBAR_WIDTH; BackBuffer *bb = this; - leftBar->setDrawRectangle(Cairo::FORMAT_ARGB32, 1, graphY - graphH + 1, bWidth - 2, graphH - 2); - leftBar->expose(bb); + leftBar->setDrawRectangle(1, graphY - graphH + 1, bWidth - 2, graphH - 2); + leftBar->expose(*this, bb); // now the border c = style->get_border_color(state); @@ -182,8 +184,8 @@ void MyFlatCurve::draw () // first the background int bWidth = CBAR_WIDTH; BackBuffer *bb = this; - bottomBar->setDrawRectangle(Cairo::FORMAT_ARGB32, graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2); - bottomBar->expose(bb); + bottomBar->setDrawRectangle(graphX + 1, graphY + CBAR_MARGIN + 1, graphW - 2, bWidth - 2); + bottomBar->expose(*this, bb); // now the border c = style->get_border_color(state); @@ -515,8 +517,6 @@ bool MyFlatCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) } } - Glib::RefPtr style = get_style_context(); - style->render_background(cr, 0., 0., (double)get_width(), (double)get_height()); draw (); copySurface(cr); return false; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 021bf03df..ecb235379 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -32,7 +32,6 @@ extern Options options; extern Glib::ustring argv0; -extern Glib::RefPtr cssForced; Glib::RefPtr css; Preferences::Preferences (RTWindow *rtwindow) @@ -1992,16 +1991,13 @@ void Preferences::switchThemeTo(Glib::ustring newTheme) if (!css) { css = Gtk::CssProvider::create(); } - bool loaded = true; try { css->load_from_path (filename); } catch (Glib::Error &err) { printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); - loaded = false; } catch (...) { printf("Error: Can't load css file \"%s\"\n", filename.c_str()); - loaded = false; } } diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index 6997a0eb2..0a0fd6b2a 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -290,3 +290,30 @@ bool PreviewWindow::on_button_release_event (GdkEventButton* event) return true; } + +Gtk::SizeRequestMode PreviewWindow::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; +} + +void PreviewWindow::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + minimum_height= 50; + natural_height = 100; +} + +void PreviewWindow::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 80; + natural_width = 120; +} + +void PreviewWindow::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + get_preferred_height_vfunc(minimum_height, natural_height); +} + +void PreviewWindow::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} diff --git a/rtgui/previewwindow.h b/rtgui/previewwindow.h index c1849e87c..a7b286202 100644 --- a/rtgui/previewwindow.h +++ b/rtgui/previewwindow.h @@ -56,6 +56,11 @@ public: bool on_motion_notify_event (GdkEventMotion* event); bool on_button_press_event (GdkEventButton* event); bool on_button_release_event(GdkEventButton* event); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; // PreviewListener interface void previewImageChanged (); diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index dbe357222..5f4c51937 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -516,6 +516,8 @@ ProfileStoreLabel::ProfileStoreLabel(const ProfileStoreEntry *entry) : Gtk::Labe ProfileStoreComboBox::ProfileStoreComboBox () { updateProfileList(); + Gtk::CellRendererText* cellRenderer = dynamic_cast(get_first_cell()); + cellRenderer->property_ellipsize() = Pango::ELLIPSIZE_MIDDLE; } Glib::ustring ProfileStoreComboBox::getCurrentLabel() diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 2f356b737..245a5bf7a 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -11,6 +11,7 @@ using namespace rtengine::procparams; Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), false, true) { CurveListener::setMulti(true); + std::vector defaultCurve; std::vector milestones; nextmin = 0.; nextmax = 0.; @@ -21,212 +22,77 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), nextminT = 0.; nextmaxT = 0.; - Gtk::VBox * retinexVBox = Gtk::manage ( new Gtk::VBox()); - retinexVBox->set_border_width(4); - retinexVBox->set_spacing(2); - Gtk::VBox * settingsVBox = Gtk::manage ( new Gtk::VBox()); - settingsVBox->set_border_width(4); - settingsVBox->set_spacing(2); - dhbox = Gtk::manage (new Gtk::HBox ()); + + // MAIN Expander ================================================================== + + + + + Gtk::Grid *retinexGrid = Gtk::manage ( new Gtk::Grid()); + setExpandAlignProperties(retinexGrid, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + dhgrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(dhgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + labmdh = Gtk::manage (new Gtk::Label (M("TP_RETINEX_METHOD") + ":")); - dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + setExpandAlignProperties(labmdh, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + dhgrid->attach(*labmdh, 0, 0, 1, 1); retinexMethod = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(retinexMethod, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); retinexMethod->append (M("TP_RETINEX_LOW")); retinexMethod->append (M("TP_RETINEX_UNIFORM")); retinexMethod->append (M("TP_RETINEX_HIGH")); retinexMethod->append (M("TP_RETINEX_HIGHLIG")); -// retinexMethod->append (M("TP_RETINEX_HIGHLIGPLUS")); +// retinexMethod->append (M("TP_RETINEX_HIGHLIGPLUS")); retinexMethod->set_active(0); retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) ); retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP")); + dhgrid->attach(*retinexMethod, 1, 0, 1, 1); retinexcolorspace = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(retinexcolorspace, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); retinexcolorspace->append (M("TP_RETINEX_LABSPACE")); retinexcolorspace->append (M("TP_RETINEX_HSLSPACE_LOG")); retinexcolorspace->append (M("TP_RETINEX_HSLSPACE_LIN")); retinexcolorspace->set_active(0); retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) ); - - dhbox->pack_start(*retinexMethod); - dhbox->pack_start(*retinexcolorspace); - retinexVBox->pack_start(*dhbox); - - Gtk::VBox *equalVBox = Gtk::manage (new Gtk::VBox()); - - equalFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_EQUAL"))); - - // Histogram equalizer Lab curve - curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB")); - curveEditorGD->setCurveListener (this); - cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); - cdshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22; - - milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshape->setBottomBarBgGradient(milestones22); - cdshape->setLeftBarBgGradient(milestones22); - - curveEditorGD->curveListComplete(); - - - // Histogram equalizer HSL curve - curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL")); - curveEditorGDH->setCurveListener (this); - cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); - cdshapeH->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22H; - - milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshapeH->setBottomBarBgGradient(milestones22H); - cdshapeH->setLeftBarBgGradient(milestones22H); - - curveEditorGDH->curveListComplete(); - - curveEditormap = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_MAP")); - curveEditormap->setCurveListener (this); - mapshape = static_cast(curveEditormap->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_MAP"))); - mapshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_MAP_TOOLTIP")); - std::vector milestones222; - milestones222.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones222.push_back( GradientMilestone(1., 1., 1., 1.) ); - mapshape->setBottomBarBgGradient(milestones222); - mapshape->setLeftBarBgGradient(milestones222); - - curveEditormap->curveListComplete(); - - // Transmission map curve - transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION")); - transmissionCurveEditorG->setCurveListener (this); - - std::vector defaultCurve; - rtengine::RetinexParams::getDefaulttransmissionCurve(defaultCurve); - transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", nullptr, false)); - transmissionShape->setIdentityValue(0.); - transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); - transmissionShape->setBottomBarBgGradient(milestones); - transmissionCurveEditorG->set_tooltip_markup (M("TP_RETINEX_TRANSMISSION_TOOLTIP")); - - transmissionCurveEditorG->curveListComplete(); - - gambox = Gtk::manage (new Gtk::HBox ()); - labgam = Gtk::manage (new Gtk::Label (M("TP_RETINEX_GAMMA") + ":")); - gambox->pack_start (*labgam, Gtk::PACK_SHRINK, 1); - - gammaretinex = Gtk::manage (new MyComboBoxText ()); - gammaretinex->append (M("TP_RETINEX_GAMMA_NONE")); - gammaretinex->append (M("TP_RETINEX_GAMMA_LOW")); - gammaretinex->append (M("TP_RETINEX_GAMMA_MID")); - gammaretinex->append (M("TP_RETINEX_GAMMA_HIGH")); - gammaretinex->append (M("TP_RETINEX_GAMMA_FREE")); - gammaretinex->set_active(0); - gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); - gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); - - gam = Gtk::manage (new Adjuster (M("TP_RETINEX_FREEGAMMA"), 0.6, 3.0, 0.01, 1.30)); - slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 1., 20., 0.1, 3.)); + dhgrid->attach(*retinexcolorspace, 2, 0, 1, 1); + retinexGrid->attach(*dhgrid, 0, 0, 1, 1); str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); - neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); - highl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT"), 1, 20, 1, 4)); - highl->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT_TOOLTIP")); - vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 200)); - vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); - - expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); - expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); - - retinexVBox->pack_start (*str); + setExpandAlignProperties(str, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + retinexGrid->attach(*str, 0, 1, 1, 1); str->show (); - retinexVBox->pack_start (*neigh); + neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); + setExpandAlignProperties(neigh, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + retinexGrid->attach(*neigh, 0, 2, 1, 1); neigh->show (); - retinexVBox->pack_start (*vart); + vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 200)); + setExpandAlignProperties(vart, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); + retinexGrid->attach(*vart, 0, 3, 1, 1); vart->show (); - retinexVBox->pack_start (*highl); + highl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT"), 1, 20, 1, 4)); + setExpandAlignProperties(highl, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + highl->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT_TOOLTIP")); + retinexGrid->attach(*highl, 0, 4, 1, 1); highl->show (); - mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); - mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP")); + viewgrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(viewgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); - transLabels->set_tooltip_markup (M("TP_RETINEX_TLABEL_TOOLTIP")); - transLabels2 = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); - - scal = Gtk::manage (new Adjuster (M("TP_RETINEX_SCALES"), -1, 6., 1., 3.)); - iter = Gtk::manage (new Adjuster (M("TP_RETINEX_ITER"), 1, 5., 1., 1.)); - grad = Gtk::manage (new Adjuster (M("TP_RETINEX_GRAD"), -2., 2., 1., 1.)); - grads = Gtk::manage (new Adjuster (M("TP_RETINEX_GRADS"), -2., 2., 1., 1.)); - gain = Gtk::manage (new Adjuster (M("TP_RETINEX_GAIN"), 20, 200, 1, 50)); - offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -1000, 5000, 1, 0)); -// vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); - limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); - baselog = Gtk::manage (new Adjuster (M("TP_RETINEX_BASELOG"), 1., 10., 1., 3.)); - skal = Gtk::manage (new Adjuster (M("TP_RETINEX_SKAL"), 1, 8, 1, 3)); - gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); - scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); - iter->set_tooltip_markup (M("TP_RETINEX_ITER_TOOLTIP")); - grad->set_tooltip_markup (M("TP_RETINEX_GRAD_TOOLTIP")); - grads->set_tooltip_markup (M("TP_RETINEX_GRADS_TOOLTIP")); -// vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); - limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); - baselog->set_tooltip_markup (M("TP_RETINEX_BASELOG_TOOLTIP")); - - // Gain Transmission map curve - gaintransmissionCurve = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_GAINTRANSMISSION")); - gaintransmissionCurve->setCurveListener (this); - -// std::vector defaultCurve; - rtengine::RetinexParams::getDefaultgaintransmissionCurve(defaultCurve); - gaintransmissionShape = static_cast(gaintransmissionCurve->addCurve(CT_Flat, "", nullptr, false)); - gaintransmissionShape->setIdentityValue(0.); - gaintransmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); - gaintransmissionShape->setBottomBarBgGradient(milestones); - gaintransmissionCurve->set_tooltip_markup (M("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); - - gaintransmissionCurve->curveListComplete(); - - - Gtk::Frame *p1Frame; - p1Frame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_LABEL_MASK")) ); - p1Frame->set_border_width(0); - p1Frame->set_label_align(0.025, 0.5); - - Gtk::VBox *p1VBox; - p1VBox = Gtk::manage ( new Gtk::VBox()); - p1VBox->set_border_width(4); - p1VBox->set_spacing(2); - - mapbox = Gtk::manage (new Gtk::HBox ()); - labmap = Gtk::manage (new Gtk::Label (M("TP_RETINEX_MAP") + ":")); - mapbox->pack_start (*labmap, Gtk::PACK_SHRINK, 1); - - mapMethod = Gtk::manage (new MyComboBoxText ()); - mapMethod->append (M("TP_RETINEX_MAP_NONE")); - mapMethod->append (M("TP_RETINEX_MAP_GAUS")); - mapMethod->append (M("TP_RETINEX_MAP_MAPP")); - mapMethod->append (M("TP_RETINEX_MAP_MAPT")); - mapMethod->set_active(0); - mapMethodConn = mapMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::mapMethodChanged) ); - mapMethod->set_tooltip_markup (M("TP_RETINEX_MAP_METHOD_TOOLTIP")); - - highlights = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HIGHLIGHTS"), 0, 100, 1, 0)); - h_tonalwidth = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HLTONALW"), 10, 100, 1, 80)); - shadows = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_SHADOWS"), 0, 100, 1, 0)); - s_tonalwidth = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_SHTONALW"), 10, 100, 1, 80)); - radius = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_RADIUS"), 5, 100, 1, 40)); - - viewbox = Gtk::manage (new Gtk::HBox ()); labview = Gtk::manage (new Gtk::Label (M("TP_RETINEX_VIEW") + ":")); - viewbox->pack_start (*labview, Gtk::PACK_SHRINK, 1); + setExpandAlignProperties(labview, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + viewgrid->attach(*labview, 0, 0, 1, 1); viewMethod = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(viewMethod, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); viewMethod->append (M("TP_RETINEX_VIEW_NONE")); viewMethod->append (M("TP_RETINEX_VIEW_UNSHARP")); viewMethod->append (M("TP_RETINEX_VIEW_MASK")); @@ -235,164 +101,386 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), viewMethod->set_active(0); viewMethodConn = viewMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::viewMethodChanged) ); viewMethod->set_tooltip_markup (M("TP_RETINEX_VIEW_METHOD_TOOLTIP")); + viewgrid->attach(*viewMethod, 1, 0, 1, 1); + retinexGrid->attach(*viewgrid, 0, 5, 1, 1); + //------------- + + pack_start (*retinexGrid); + + + // MAP (MASK) Frame --------------------------------------------------------------- + + + Gtk::Frame *maskFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_LABEL_MASK")) ); + setExpandAlignProperties(maskFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + Gtk::Grid *maskGrid = Gtk::manage ( new Gtk::Grid()); + setExpandAlignProperties(maskGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + // Map Method + mapgrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(mapgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + labmap = Gtk::manage (new Gtk::Label (M("TP_RETINEX_MAP") + ":")); + setExpandAlignProperties(labmap, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + mapgrid->attach(*labmap, 0, 0, 1, 1); + + mapMethod = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(mapMethod, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); + mapMethod->append (M("TP_RETINEX_MAP_NONE")); + mapMethod->append (M("TP_RETINEX_MAP_GAUS")); + mapMethod->append (M("TP_RETINEX_MAP_MAPP")); + mapMethod->append (M("TP_RETINEX_MAP_MAPT")); + mapMethod->set_active(0); + mapMethodConn = mapMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::mapMethodChanged) ); + mapMethod->set_tooltip_markup (M("TP_RETINEX_MAP_METHOD_TOOLTIP")); + mapgrid->attach(*mapMethod, 1, 0, 1, 1); + + maskGrid->attach(*mapgrid, 0, 0, 1, 1); + mapgrid->show(); + + // Map Equalizer + curveEditormap = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_MAP")); + setExpandAlignProperties(curveEditormap, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + curveEditormap->setCurveListener (this); + std::vector milestones222; + milestones222.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones222.push_back( GradientMilestone(1., 1., 1., 1.) ); + mapshape = static_cast(curveEditormap->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_MAP"))); + mapshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_MAP_TOOLTIP")); + mapshape->setBottomBarBgGradient(milestones222); + mapshape->setLeftBarBgGradient(milestones222); + curveEditormap->curveListComplete(); + maskGrid->attach(*curveEditormap, 0, 1, 1, 1); + curveEditormap->show(); + + // Adjusters + highlights = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HIGHLIGHTS"), 0, 100, 1, 0)); + setExpandAlignProperties(highlights, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + maskGrid->attach(*highlights, 0, 2, 1, 1); + highlights->show(); + + h_tonalwidth = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_HLTONALW"), 10, 100, 1, 80)); + setExpandAlignProperties(h_tonalwidth, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + maskGrid->attach(*h_tonalwidth, 0, 3, 1, 1); + h_tonalwidth->show(); + + shadows = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_SHADOWS"), 0, 100, 1, 0)); + setExpandAlignProperties(shadows, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + maskGrid->attach(*shadows, 0, 4, 1, 1); + shadows->show(); + + s_tonalwidth = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_SHTONALW"), 10, 100, 1, 80)); + setExpandAlignProperties(s_tonalwidth, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + maskGrid->attach(*s_tonalwidth, 0, 5, 1, 1); + s_tonalwidth->show(); + + radius = Gtk::manage (new Adjuster (M("TP_SHADOWSHLIGHTS_RADIUS"), 5, 100, 1, 40)); + setExpandAlignProperties(radius, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + maskGrid->attach(*radius, 0, 6, 1, 1); + radius->show(); + + //------------- + + maskFrame->add(*maskGrid); + pack_start (*maskFrame, Gtk::PACK_EXPAND_WIDGET, 4); + + + + + // SETTINGS Expander ============================================================== + + + + + expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); + setExpandAlignProperties(expsettings, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); + + Gtk::Grid *settingsGrid = Gtk::manage ( new Gtk::Grid()); + setExpandAlignProperties(settingsGrid, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + mMLabels = Gtk::manage(new Gtk::Label("---")); + setExpandAlignProperties(mMLabels, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); + mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP")); + settingsGrid->attach(*mMLabels, 0, 0, 1, 1); + mMLabels->show (); + + transLabels = Gtk::manage(new Gtk::Label("---")); + setExpandAlignProperties(transLabels, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); + transLabels->set_tooltip_markup (M("TP_RETINEX_TLABEL_TOOLTIP")); + settingsGrid->attach(*transLabels, 0, 1, 1, 1); + transLabels->show (); + + transLabels2 = Gtk::manage(new Gtk::Label("---")); + setExpandAlignProperties(transLabels2, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); + settingsGrid->attach(*transLabels2, 0, 2, 1, 1); + transLabels2->show (); + + + // EQUALIZER Frame ---------------------------------------------------------------- + + + equalFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_EQUAL"))); + setExpandAlignProperties(equalFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + Gtk::Grid *equalGrid = Gtk::manage (new Gtk::Grid()); + setExpandAlignProperties(equalGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + // Histogram equalizer Lab curve + curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB")); + setExpandAlignProperties(curveEditorGD, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + curveEditorGD->setCurveListener (this); + std::vector milestones22; + milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); + cdshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); + cdshape->setBottomBarBgGradient(milestones22); + cdshape->setLeftBarBgGradient(milestones22); + curveEditorGD->curveListComplete(); + equalGrid->attach(*curveEditorGD, 0, 0, 1, 1); + curveEditorGD->show(); + + // Histogram equalizer HSL curve + curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL")); + setExpandAlignProperties(curveEditorGDH, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + curveEditorGDH->setCurveListener (this); + std::vector milestones22H; + milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); + cdshapeH->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); + cdshapeH->setBottomBarBgGradient(milestones22H); + cdshapeH->setLeftBarBgGradient(milestones22H); + curveEditorGDH->curveListComplete(); + equalGrid->attach(*curveEditorGDH, 0, 1, 1, 1); + curveEditorGDH->show(); + + // Hue equalizer curveEditorGH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LH")); + setExpandAlignProperties(curveEditorGH, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); curveEditorGH->setCurveListener (this); - lhshape = static_cast(curveEditorGH->addCurve(CT_Flat, M("TP_RETINEX_CURVEEDITOR_LH"))); lhshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_LH_TOOLTIP")); lhshape->setCurveColorProvider(this, 4); - milestones.clear(); - for (int i = 0; i < 7; i++) { float R, G, B; float x = float(i) * (1.0f / 6.0); Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); milestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) ); } - lhshape->setBottomBarBgGradient(milestones); - curveEditorGH->curveListComplete(); - - medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); - medianmap->set_active (true); - medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) ); - - settingsVBox->pack_start (*mMLabels); - mMLabels->show (); - - settingsVBox->pack_start (*transLabels); - transLabels->show (); - - settingsVBox->pack_start (*transLabels2); - transLabels2->show (); - - equalVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); - curveEditorGD->show(); - - equalVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); - curveEditorGDH->show(); - - equalVBox->pack_start (*curveEditorGH, Gtk::PACK_SHRINK, 4); + equalGrid->attach(*curveEditorGH, 0, 2, 1, 1); curveEditorGH->show(); - gambox->pack_start(*gammaretinex); + // Gamma settings + gamgrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(gamgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - equalVBox->pack_start(*gambox); + labgam = Gtk::manage (new Gtk::Label (M("TP_RETINEX_GAMMA") + ":")); + setExpandAlignProperties(labgam, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + gamgrid->attach(*labgam, 0, 0, 1, 1); + + gammaretinex = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(gammaretinex, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); + gammaretinex->append (M("TP_RETINEX_GAMMA_NONE")); + gammaretinex->append (M("TP_RETINEX_GAMMA_LOW")); + gammaretinex->append (M("TP_RETINEX_GAMMA_MID")); + gammaretinex->append (M("TP_RETINEX_GAMMA_HIGH")); + gammaretinex->append (M("TP_RETINEX_GAMMA_FREE")); + gammaretinex->set_active(0); + gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); + gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); + gamgrid->attach(*gammaretinex, 1, 0, 1, 1); + equalGrid->attach(*gamgrid, 0, 3, 1, 1); gammaretinex->show(); - equalVBox->pack_start (*gam); + gam = Gtk::manage (new Adjuster (M("TP_RETINEX_FREEGAMMA"), 0.6, 3.0, 0.01, 1.30)); + setExpandAlignProperties(gam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + equalGrid->attach(*gam, 0, 4, 1, 1); gam->show (); - equalVBox->pack_start (*slope); + slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 1., 20., 0.1, 3.)); + setExpandAlignProperties(slope, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + equalGrid->attach(*slope, 0, 5, 1, 1); slope->show (); - equalFrame->add(*equalVBox); - settingsVBox->pack_start (*equalFrame); + //------------- + + equalFrame->add(*equalGrid); + settingsGrid->attach(*equalFrame, 0, 3, 1, 1); - Gtk::VBox *iterVBox = Gtk::manage (new Gtk::VBox()); + // TONE MAPPING Frame ------------------------------------------------------------- + iterFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_ITERF"))); + setExpandAlignProperties(iterFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - iterVBox->pack_start (*iter); + Gtk::Grid *iterGrid = Gtk::manage (new Gtk::Grid()); + setExpandAlignProperties(iterGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + iter = Gtk::manage (new Adjuster (M("TP_RETINEX_ITER"), 1, 5., 1., 1.)); + setExpandAlignProperties(iter, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + iter->set_tooltip_markup (M("TP_RETINEX_ITER_TOOLTIP")); + iterGrid->attach(*iter, 0, 0, 1, 1); iter->show (); - iterVBox->pack_start (*scal); + scal = Gtk::manage (new Adjuster (M("TP_RETINEX_SCALES"), -1, 6., 1., 3.)); + setExpandAlignProperties(scal, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); + iterGrid->attach(*scal, 0, 1, 1, 1); scal->show (); - iterVBox->pack_start (*grad); + grad = Gtk::manage (new Adjuster (M("TP_RETINEX_GRAD"), -2., 2., 1., 1.)); + setExpandAlignProperties(grad, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + grad->set_tooltip_markup (M("TP_RETINEX_GRAD_TOOLTIP")); + iterGrid->attach(*grad, 0, 2, 1, 1); grad->show (); - iterVBox->pack_start (*grads); + grads = Gtk::manage (new Adjuster (M("TP_RETINEX_GRADS"), -2., 2., 1., 1.)); + setExpandAlignProperties(grads, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + grads->set_tooltip_markup (M("TP_RETINEX_GRADS_TOOLTIP")); + iterGrid->attach(*grads, 0, 3, 1, 1); grads->show (); - iterFrame->add(*iterVBox); - settingsVBox->pack_start (*iterFrame); + //------------- + + iterFrame->add(*iterGrid); + settingsGrid->attach(*iterFrame, 0, 4, 1, 1); + + + // TRANSMISSION Frame ------------------------------------------------------------- - Gtk::VBox *tranVBox = Gtk::manage (new Gtk::VBox()); tranFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_TRANF"))); + setExpandAlignProperties(tranFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - tranVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); + Gtk::Grid *tranGrid = Gtk::manage (new Gtk::Grid()); + setExpandAlignProperties(tranGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + // Transmission map curve + transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION")); + setExpandAlignProperties(transmissionCurveEditorG, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + transmissionCurveEditorG->setCurveListener (this); + rtengine::RetinexParams::getDefaulttransmissionCurve(defaultCurve); + transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", nullptr, false)); + transmissionShape->setIdentityValue(0.); + transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + transmissionShape->setBottomBarBgGradient(milestones); + transmissionCurveEditorG->curveListComplete(); + transmissionCurveEditorG->set_tooltip_markup (M("TP_RETINEX_TRANSMISSION_TOOLTIP")); + tranGrid->attach( *transmissionCurveEditorG, 0, 0, 1, 1); transmissionCurveEditorG->show(); - tranVBox->pack_start (*skal); + // Scale + skal = Gtk::manage (new Adjuster (M("TP_RETINEX_SKAL"), 1, 8, 1, 3)); + setExpandAlignProperties(skal, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + tranGrid->attach(*skal, 0, 1, 1, 1); skal->show (); - tranVBox->pack_start (*limd); + // Threshold + limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); + setExpandAlignProperties(limd, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); + tranGrid->attach(*limd, 0, 2, 1, 1); limd->show (); - tranVBox->pack_start (*medianmap); + // Transmission median filter + medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); + setExpandAlignProperties(medianmap, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + medianmap->set_active (true); + medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) ); + tranGrid->attach(*medianmap, 0, 3, 1, 1); medianmap->show (); - tranFrame->add(*tranVBox); - settingsVBox->pack_start (*tranFrame); + //------------- + + tranFrame->add(*tranGrid); + settingsGrid->attach(*tranFrame, 0, 5, 1, 1); + + + // GAIN AND OFFSET Frame ---------------------------------------------------------- - Gtk::VBox *gainBox = Gtk::manage (new Gtk::VBox()); - Gtk::HSeparator *separator = Gtk::manage (new Gtk::HSeparator()); - settingsVBox->pack_start(*separator, Gtk::PACK_SHRINK, 2); gainFrame = Gtk::manage (new Gtk::Frame(M("TP_RETINEX_GAINOFFS"))); + setExpandAlignProperties(gainFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - gainBox->pack_start( *gaintransmissionCurve, Gtk::PACK_SHRINK, 2); + Gtk::Grid *gainGrid = Gtk::manage (new Gtk::Grid()); + setExpandAlignProperties(gainGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + + // Gain Transmission map curve + gaintransmissionCurve = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_GAINTRANSMISSION")); + setExpandAlignProperties(gaintransmissionCurve, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + gaintransmissionCurve->setCurveListener (this); + rtengine::RetinexParams::getDefaultgaintransmissionCurve(defaultCurve); + gaintransmissionShape = static_cast(gaintransmissionCurve->addCurve(CT_Flat, "", nullptr, false)); + gaintransmissionShape->setIdentityValue(0.); + gaintransmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + gaintransmissionShape->setBottomBarBgGradient(milestones); + gaintransmissionCurve->set_tooltip_markup (M("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); + gaintransmissionCurve->curveListComplete(); + + gainGrid->attach( *gaintransmissionCurve, 0, 0, 1, 1); gaintransmissionCurve->show(); - gainBox->pack_start (*offs); + gain = Gtk::manage (new Adjuster (M("TP_RETINEX_GAIN"), 20, 200, 1, 50)); // Unused !? + setExpandAlignProperties(gain, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); + + offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -1000, 5000, 1, 0)); + setExpandAlignProperties(offs, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + gainGrid->attach(*offs, 0, 1, 1, 1); offs->show (); - gainFrame->add(*gainBox); - settingsVBox->pack_start (*gainFrame); - viewbox->pack_start(*viewMethod); -// settingsVBox->pack_start(*viewbox); - retinexVBox->pack_start(*viewbox); - //settingsVBox->pack_start (*viewMethod); + //------------- - mapbox->pack_start(*mapMethod); - // settingsVBox->pack_start(*mapbox); - p1VBox->pack_start(*mapbox); - - p1VBox->pack_start (*curveEditormap, Gtk::PACK_SHRINK, 4); - curveEditormap->show(); - - p1VBox->pack_start (*highlights); - highlights->show(); - p1VBox->pack_start (*h_tonalwidth); - h_tonalwidth->show(); - p1VBox->pack_start (*shadows); - shadows->show(); - p1VBox->pack_start (*s_tonalwidth); - s_tonalwidth->show(); - p1VBox->pack_start (*radius); - radius->show(); + gainFrame->add(*gainGrid); + settingsGrid->attach(*gainFrame, 0, 6, 1, 1); -// settingsVBox->pack_start (*highl); -// highl->show (); + baselog = Gtk::manage (new Adjuster (M("TP_RETINEX_BASELOG"), 1., 10., 1., 3.)); // Unused !? + setExpandAlignProperties(baselog, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + baselog->set_tooltip_markup (M("TP_RETINEX_BASELOG_TOOLTIP")); +// settingsGrid->attach(*baselog, 0, 7, 1, 1); +// baselog->show (); -// settingsVBox->pack_start (*baselog); -// baselog->show (); + //-------------------------- - // settingsVBox->pack_start (*Gtk::manage (new Gtk::HSeparator())); - - - expsettings->add(*settingsVBox); + expsettings->add(*settingsGrid); expsettings->setLevel(2); + pack_start (*expsettings); - neutrHBox = Gtk::manage (new Gtk::HBox ()); - neutrHBox->set_border_width (2); + + + + // End of SETTINGS Expander ======================================================= + + + + + // Reset button neutral = Gtk::manage (new Gtk::Button (M("TP_RETINEX_NEUTRAL"))); + setExpandAlignProperties(neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); + setExpandAlignProperties(resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); neutral->set_image(*resetImg); neutral->set_tooltip_text (M("TP_RETINEX_NEUTRAL_TIP")); neutralconn = neutral->signal_pressed().connect( sigc::mem_fun(*this, &Retinex::neutral_pressed) ); neutral->show(); - neutrHBox->pack_start (*neutral); + //------------- + + pack_start (*neutral); + + + // Setting Adjusters'delay str->setAdjusterListener (this); @@ -516,13 +604,6 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), skal->delay = 200; } - pack_start (*retinexVBox); - p1Frame->add(*p1VBox); - pack_start (*p1Frame, Gtk::PACK_EXPAND_WIDGET, 4); - - pack_start (*expsettings); - pack_start (*neutrHBox); - disableListener(); retinexColorSpaceChanged(); gammaretinexChanged(); @@ -997,10 +1078,12 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) void Retinex::retinexMethodChanged() { - if(retinexMethod->get_active_row_number() == 3) { - highl->show(); - } else { - highl->hide(); + if (!batchMode) { + if(retinexMethod->get_active_row_number() == 3) { + highl->show(); + } else { + highl->hide(); + } } if (listener) { @@ -1013,28 +1096,30 @@ void Retinex::retinexMethodChanged() void Retinex::mapMethodChanged() { - if(mapMethod->get_active_row_number() == 1 /*|| mapMethod->get_active_row_number() == 2*/) { - curveEditormap->show(); - highlights->show(); - h_tonalwidth->show(); - shadows->show(); - s_tonalwidth->show(); - radius->show(); - } else if(mapMethod->get_active_row_number() == 2 || mapMethod->get_active_row_number() == 3) { - curveEditormap->show(); - highlights->show(); - h_tonalwidth->show(); - shadows->show(); - s_tonalwidth->show(); - radius->hide(); - } else { - curveEditormap->hide(); - highlights->hide(); - h_tonalwidth->hide(); - shadows->hide(); - s_tonalwidth->hide(); - radius->hide(); + if (!batchMode) { + if(mapMethod->get_active_row_number() == 1 /*|| mapMethod->get_active_row_number() == 2*/) { + curveEditormap->show(); + highlights->show(); + h_tonalwidth->show(); + shadows->show(); + s_tonalwidth->show(); + radius->show(); + } else if(mapMethod->get_active_row_number() == 2 || mapMethod->get_active_row_number() == 3) { + curveEditormap->show(); + highlights->show(); + h_tonalwidth->show(); + shadows->show(); + s_tonalwidth->show(); + radius->hide(); + } else { + curveEditormap->hide(); + highlights->hide(); + h_tonalwidth->hide(); + shadows->hide(); + s_tonalwidth->hide(); + radius->hide(); + } } if (listener) { @@ -1044,38 +1129,51 @@ void Retinex::mapMethodChanged() void Retinex::viewMethodChanged() { - if(viewMethod->get_active_row_number() == 1 || viewMethod->get_active_row_number() == 2) { - // vart->hide(); - gain->hide(); - offs->hide(); - limd->hide(); - transmissionCurveEditorG->hide(); - medianmap->hide(); - iter->hide(); - scal->hide(); - grad->hide(); - grads->hide(); - curveEditorGH->hide(); - } else if(viewMethod->get_active_row_number() == 3 || viewMethod->get_active_row_number() == 4) { - gain->hide(); - offs->hide(); - transmissionCurveEditorG->show(); - // vart->hide(); - curveEditorGH->hide(); - } else { - vart->show(); - neigh->show(); - gain->show(); - offs->show(); - limd->show(); - transmissionCurveEditorG->show(); - medianmap->show(); - iter->show(); - scal->show(); - grad->show(); - grads->show(); - curveEditorGH->show(); + if (!batchMode) { + if(viewMethod->get_active_row_number() == 1 || viewMethod->get_active_row_number() == 2) { + //vart->hide(); + gain->hide(); + offs->hide(); + limd->hide(); + transmissionCurveEditorG->hide(); + medianmap->hide(); + + iterFrame->hide(); + /* + iter->hide(); + scal->hide(); + grad->hide(); + grads->hide(); + */ + + curveEditorGH->hide(); + } else if(viewMethod->get_active_row_number() == 3 || viewMethod->get_active_row_number() == 4) { + gain->hide(); + offs->hide(); + transmissionCurveEditorG->show(); + + //vart->hide(); + curveEditorGH->hide(); + } else { + vart->show(); + neigh->show(); + gain->show(); + offs->show(); + limd->show(); + transmissionCurveEditorG->show(); + medianmap->show(); + + iterFrame->show(); + /* + iter->show(); + scal->show(); + grad->show(); + grads->show(); + */ + + curveEditorGH->show(); + } } if (listener) { diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 65602863a..da0ca3685 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -47,16 +47,15 @@ protected: MyExpander* expsettings; Gtk::Label* labmdh; - Gtk::HBox* dhbox; - Gtk::HBox* mapbox; + Gtk::Grid* dhgrid; + Gtk::Grid* mapgrid; Gtk::Label* labmap; - Gtk::HBox* viewbox; + Gtk::Grid* viewgrid; Gtk::Label* labview; Gtk::Label* labgam; - Gtk::HBox* gambox; + Gtk::Grid* gamgrid; Gtk::Button* neutral; - Gtk::HBox* neutrHBox; MyComboBoxText* retinexMethod; MyComboBoxText* retinexcolorspace; diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index ebfbf5006..2242cd3b0 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -125,7 +125,11 @@ RTWindow::RTWindow () } set_title_decorated(""); + set_resizable(true); + set_resize_mode(Gtk::ResizeMode::RESIZE_QUEUE); + set_decorated(true); set_default_size(options.windowWidth, options.windowHeight); + set_hide_titlebar_when_maximized(true); set_modal(false); if (options.windowMaximized) { diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index da165bccc..cc22814e6 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -21,7 +21,7 @@ #include "multilangmgr.h" #include "mycurve.h" -SHCSelector::SHCSelector() : ColoredBar(RTO_Left2Right), movingPosition(-1), tmpX(0.0), tmpPos(0.0), wslider(0.0), cl(nullptr) +SHCSelector::SHCSelector() : movingPosition(-1), tmpX(0.0), tmpPos(0.0), wslider(0.0), cl(nullptr), coloredBar(RTO_Left2Right) { positions[0] = defaults[0] = 0.25; @@ -31,11 +31,12 @@ SHCSelector::SHCSelector() : ColoredBar(RTO_Left2Right), movingPosition(-1), tmp rightMargin = RADIUS; Glib::RefPtr style = get_style_context(); - style->add_class(GTK_STYLE_CLASS_DEFAULT); - style->add_class(GTK_STYLE_CLASS_SCALE); - style->add_class(GTK_STYLE_CLASS_SLIDER); + style->add_class("drawingarea"); + style->add_class(GTK_STYLE_CLASS_TROUGH); + //style->add_class(GTK_STYLE_CLASS_SCALE); + //style->add_class(GTK_STYLE_CLASS_SLIDER); - // TODO: This is a hack :) ; change this name to a specific one and create a new entry in all gtkrc theme files + // TODO: This is a hack :) ; change this name to a specific one and create a new entry in all CSS theme files set_name("ThresholdSelector"); set_can_focus(false); set_tooltip_text(M("SHCSELECTOR_TOOLTIP")); @@ -43,7 +44,7 @@ SHCSelector::SHCSelector() : ColoredBar(RTO_Left2Right), movingPosition(-1), tmp Gtk::SizeRequestMode SHCSelector::get_request_mode_vfunc () const { - return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; } void SHCSelector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const @@ -65,7 +66,7 @@ void SHCSelector::get_preferred_height_for_width_vfunc (int width, int &minimum_ natural_height = minimum_height = 14; } -void SHCSelector::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void SHCSelector::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } @@ -109,10 +110,27 @@ void SHCSelector::on_realize() add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); } -bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +void SHCSelector::updateBackBuffer() { - Gdk::RGBA c; + if (!get_realized() || !isDirty() || !get_width() || !get_height()) { + return; + } + + // This will create or update the size of the BackBuffer::surface + setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, get_width(), get_height(), true); + + if (!surface) { + return; + } + + Cairo::RefPtr cr = Cairo::Context::create(surface); + Glib::RefPtr style = get_style_context(); + + cr->set_source_rgba (0., 0., 0., 0.); + cr->set_operator (Cairo::OPERATOR_CLEAR); + cr->paint (); + cr->set_operator (Cairo::OPERATOR_OVER); int w = get_width () - leftMargin - rightMargin; int h = get_height (); @@ -120,51 +138,33 @@ bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) wslider = std::max(int(h / 5), 10); double hwslider = double(wslider) / 2.; - Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; - Glib::RefPtr style = get_style_context(); - - - - - //style->render_background(cr, leftMargin, 0, w, h); - //return true; - - - - // clear bg + cr->set_source_rgba (0., 0., 0., 0.); + cr->set_operator (Cairo::OPERATOR_CLEAR); + cr->paint (); + cr->set_operator (Cairo::OPERATOR_OVER); + // set the box's colors cr->set_line_width (1.0); + cr->set_antialias(Cairo::ANTIALIAS_SUBPIXEL); cr->set_line_cap(Cairo::LINE_CAP_BUTT); - if (is_sensitive() && canGetColors()) { + if (is_sensitive() && coloredBar.canGetColors()) { // gradient background - Glib::RefPtr win = get_window(); - // this will eventually create/update the off-screen pixmap - setDrawRectangle(win, leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); + + // this will eventually create/update the off-screen BackBuffer + coloredBar.setDrawRectangle(leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); // that we're displaying here - ColoredBar::expose(cr); + coloredBar.expose(*this, cr); + } else { + style->render_background(cr, leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); } - - /* useless - else { - // solid background - // draw the box's background - style->render_background(cr, leftMargin+1, 1, w-2, int(float(h)*5.5f/7.f+0.5f)); - } - */ - // draw the box's borders - style->render_frame(cr, leftMargin + 0.5, 0.5, w - 1, int(float(h) * 5.5f / 7.f + 0.5f) + 1); - //cr->set_line_width (1.); - //c = style->get_border_color(state); - //cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - //cr->rectangle (leftMargin + 0.5, 0.5, w - 1, int(float(h) * 5.5f / 7.f + 0.5f) + 1); - //cr->stroke (); + style->render_frame(cr, leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); + // draw sliders - cr->set_line_width (1.); for (int i = 0; i < 3; i++) { if (i == movingPosition) { style->set_state(Gtk::STATE_FLAG_ACTIVE); @@ -179,7 +179,7 @@ bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) style->set_state(Gtk::STATE_FLAG_NORMAL); } - style->render_slider(cr, leftMargin + 0.5 + (w - 1)*positions[i] - hwslider, vb, wslider, h - vb, Gtk::ORIENTATION_HORIZONTAL); + style->render_slider(cr, leftMargin + 0.5 + (w - 1)*positions[i] - hwslider, vb, wslider, h - vb, Gtk::ORIENTATION_VERTICAL); style->set_state(Gtk::STATE_FLAG_NORMAL); } @@ -197,43 +197,37 @@ bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) cr->close_path(); if (i==movingPosition) { // moved (selected) - c = style->get_background_color(Gtk::STATE_FLAG_SELECTED); + Gdk::RGBA c = style->get_background_color(Gtk::STATE_FLAG_SELECTED); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->fill_preserve (); c = style->get_border_color (Gtk::STATE_FLAG_SELECTED); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->stroke (); } - */ - - /* - else if (i==litCursor) { - // prelight - c = style->get_background_color(Gtk::STATE_FLAG_PRELIGHT); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->fill_preserve (); - c = style->get_border_color (Gtk::STATE_FLAG_PRELIGHT); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->stroke (); - } - */ - - /* - else { - // normal - c = style->get_background_color(is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->fill_preserve (); - c = style->get_border_color (is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->stroke (); - } + /* + else if (i==litCursor) { + // prelight + Gdk::RGBA c = style->get_background_color(Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + * / + else { + // normal + Gdk::RGBA c = style->get_background_color(is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } } */ // draw text for the slider that is being moved - cr->set_line_width (0.5); - if (movingPosition >= 0) { int i = movingPosition; int offset; @@ -241,8 +235,7 @@ bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) Glib::RefPtr layout = create_pango_layout(Glib::ustring::format(std::setprecision(2), positions[i])); layout->get_pixel_size(layout_width, layout_height); offset = positions[i] > 0.5 ? -layout_width - 1 - hwslider : 1 + hwslider; - c = style->get_background_color(state); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->set_source_rgb (0., 0., 0.); cr->set_line_width(3.); cr->set_line_join(Cairo::LINE_JOIN_ROUND); @@ -251,10 +244,25 @@ bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) cr->move_to (leftMargin + w * positions[i] + offset, 0.); layout->add_to_cairo_context (cr); cr->stroke_preserve(); - c = style->get_color(Gtk::STATE_FLAG_PRELIGHT); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->set_line_width(0.5); + cr->set_source_rgb (1., 1., 1.); cr->fill (); } +} + +bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +{ + + // on_realize & updateBackBuffer have to be called before + if (get_realized() && get_width() && get_height()) { + if (isDirty()) { + updateBackBuffer(); + } + + if (surface) { + copySurface(cr); + } + } return true; } @@ -330,6 +338,7 @@ bool SHCSelector::on_motion_notify_event (GdkEventMotion* event) cl->shcChanged (); } + setDirty(true); queue_draw (); } @@ -339,6 +348,7 @@ bool SHCSelector::on_motion_notify_event (GdkEventMotion* event) void SHCSelector::styleChanged (const Glib::RefPtr& style) { + setDirty(true); queue_draw (); } @@ -352,6 +362,7 @@ bool SHCSelector::reset () // : movingPosition(-1), cl(NULL) { positions[0] = defaults[0]; positions[1] = defaults[1]; positions[2] = defaults[2]; + setDirty(true); queue_draw (); return true; } @@ -363,7 +374,6 @@ void SHCSelector::refresh() { setDirty(true); Glib::RefPtr win = get_window(); - if (win) { win->invalidate(true); } diff --git a/rtgui/shcselector.h b/rtgui/shcselector.h index 7f0368720..92d4c21ba 100644 --- a/rtgui/shcselector.h +++ b/rtgui/shcselector.h @@ -29,7 +29,7 @@ public: virtual void shcChanged () {} }; -class SHCSelector : public Gtk::DrawingArea, public ColoredBar +class SHCSelector : public Gtk::DrawingArea, BackBuffer { protected: @@ -47,7 +47,7 @@ protected: int rightMargin; const static int hb = 3; // horizontal border - const static int vb = 2; // vertical border + const static int vb = 4; // vertical border SHCListener* cl; @@ -55,15 +55,18 @@ protected: void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); bool on_button_release_event (GdkEventButton* event); bool on_motion_notify_event (GdkEventMotion* event); + void updateBackBuffer(); public: + ColoredBar coloredBar; + SHCSelector(); void setSHCListener (SHCListener* l) diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 782df7291..a1abf12f9 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -31,7 +31,6 @@ extern Glib::ustring versionSuffixString; SplashImage::SplashImage () { pixbuf = RTImage::createFromFile ("splash.png"); - set_size_request (pixbuf->get_width(), pixbuf->get_height()); } bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) @@ -75,6 +74,31 @@ bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) return true; } +Gtk::SizeRequestMode SplashImage::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; +} + +void SplashImage::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + minimum_height = natural_height = pixbuf ? pixbuf->get_height() : 100; +} + +void SplashImage::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = natural_width = pixbuf ? pixbuf->get_width() : 100; +} + +void SplashImage::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + get_preferred_height_vfunc (minimum_height, natural_height); +} + +void SplashImage::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, true) { @@ -91,7 +115,7 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t get_content_area()->pack_start (*bottomHBox, Gtk::PACK_SHRINK, 0); Glib::RefPtr localCSS = Gtk::CssProvider::create(); - localCSS->load_from_data ("GtkTextView { font-family: monospace; font-size: 8pt; }"); + localCSS->load_from_data ("textview { font-family: monospace; font-size: 8pt; }"); // Tab 1: the image splashImage = Gtk::manage(new SplashImage ()); diff --git a/rtgui/splash.h b/rtgui/splash.h index e46345227..3fea9fdd1 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -31,6 +31,11 @@ private: public: SplashImage (); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int &minimum_height, int &natural_height) 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_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; }; //class Splash : public Gtk::Window { diff --git a/rtgui/thresholdadjuster.h b/rtgui/thresholdadjuster.h index f022735ff..9c22eede4 100644 --- a/rtgui/thresholdadjuster.h +++ b/rtgui/thresholdadjuster.h @@ -140,11 +140,11 @@ public: } void setBgGradient (const std::vector &milestones) { - tSelector.setBgGradient (milestones); + tSelector.coloredBar.setBgGradient (milestones); } void setBgColorProvider (ColorProvider *cp, int i) { - tSelector.setColorProvider(cp, i); + tSelector.coloredBar.setColorProvider(cp, i); } void setUpdatePolicy (eUpdatePolicy policy) { diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 8dbfa8ec9..154cd6e84 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -25,7 +25,7 @@ ThresholdSelector::ThresholdSelector(double minValueBottom, double maxValueBottom, double defBottom, Glib::ustring labelBottom, unsigned int precisionBottom, double minValueTop, double maxValueTop, double defTop, Glib::ustring labelTop, unsigned int precisionTop, ThresholdCurveProvider* curveProvider) - : ColoredBar(RTO_Left2Right) + : coloredBar(RTO_Left2Right) { positions[TS_BOTTOMLEFT] = defPos[TS_BOTTOMLEFT] = defBottom; positions[TS_TOPLEFT] = defPos[TS_TOPLEFT] = defTop; @@ -51,7 +51,7 @@ ThresholdSelector::ThresholdSelector(double minValueBottom, double maxValueBotto ThresholdSelector::ThresholdSelector(double minValue, double maxValue, double defBottom, double defTop, unsigned int precision, bool startAtOne) - : ColoredBar(RTO_Left2Right) + : coloredBar(RTO_Left2Right) { positions[TS_BOTTOMLEFT] = defPos[TS_BOTTOMLEFT] = defBottom; positions[TS_TOPLEFT] = defPos[TS_TOPLEFT] = defTop; @@ -91,7 +91,7 @@ ThresholdSelector::ThresholdSelector(double minValue, double maxValue, double de ThresholdSelector::ThresholdSelector(double minValue, double maxValue, double defBottomLeft, double defTopLeft, double defBottomRight, double defTopRight, unsigned int precision, bool startAtOne) - : ColoredBar(RTO_Left2Right) + : coloredBar(RTO_Left2Right) { positions[TS_BOTTOMLEFT] = defPos[TS_BOTTOMLEFT] = defBottomLeft; positions[TS_TOPLEFT] = defPos[TS_TOPLEFT] = defTopLeft; @@ -142,9 +142,10 @@ void ThresholdSelector::initValues () secondaryMovedCursor = TS_UNDEFINED; Glib::RefPtr style = get_style_context(); - style->add_class(GTK_STYLE_CLASS_DEFAULT); - style->add_class(GTK_STYLE_CLASS_SCALE); - style->add_class(GTK_STYLE_CLASS_SLIDER); + style->add_class("drawingarea"); + style->add_class(GTK_STYLE_CLASS_TROUGH); + //style->add_class(GTK_STYLE_CLASS_SCALE); + //style->add_class(GTK_STYLE_CLASS_SLIDER); set_name("ThresholdSelector"); set_can_focus(false); @@ -155,7 +156,7 @@ void ThresholdSelector::initValues () Gtk::SizeRequestMode ThresholdSelector::get_request_mode_vfunc () const { - return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; } void ThresholdSelector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const @@ -168,7 +169,7 @@ void ThresholdSelector::get_preferred_height_vfunc (int &minimum_height, int &na void ThresholdSelector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 100; + minimum_width = 60; natural_width = 150; } @@ -177,12 +178,11 @@ void ThresholdSelector::get_preferred_height_for_width_vfunc (int width, int &mi natural_height = minimum_height = 23; } -void ThresholdSelector::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +void ThresholdSelector::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { get_preferred_width_vfunc (minimum_width, natural_width); } - /* * Set the position of the sliders without telling it to the listener */ @@ -246,10 +246,24 @@ void ThresholdSelector::on_realize() add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::LEAVE_NOTIFY_MASK); } -bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +void ThresholdSelector::updateBackBuffer() { - Gdk::RGBA c; + // This will create or update the size of the BackBuffer::surface + setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, get_width(), get_height(), true); + + if (!surface) { + return; + } + + Cairo::RefPtr cr = Cairo::Context::create(surface); + Glib::RefPtr style = get_style_context(); + + cr->set_source_rgba (0., 0., 0., 0.); + cr->set_operator (Cairo::OPERATOR_CLEAR); + cr->paint (); + cr->set_operator (Cairo::OPERATOR_OVER); + double positions01[4]; int w = get_width (); int h = get_height (); @@ -263,38 +277,21 @@ bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) positions01[TS_BOTTOMRIGHT] = to01(TS_BOTTOMRIGHT); positions01[TS_TOPRIGHT] = to01(TS_TOPRIGHT); - Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; - Glib::RefPtr style = get_style_context(); - // set the box's colors cr->set_line_width (1.0); cr->set_line_cap(Cairo::LINE_CAP_BUTT); - if (is_sensitive() && canGetColors()) { - // gradient background - Glib::RefPtr win = get_window(); + if (is_sensitive() && coloredBar.canGetColors()) { // this will eventually create/update the off-screen Surface for the gradient area only ! - setDrawRectangle(win, hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f)); + coloredBar.setDrawRectangle(Cairo::FORMAT_ARGB32, hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f)); // that we're displaying here - ColoredBar::expose(cr); + coloredBar.expose(*this, cr); + } else { + style->render_background(cr, hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f)); } - /* useless - else { - // solid background - - // draw the box's background - style->render_background(cr, hb+hwslider-0.5, double(int(float(h)*1.5f/7.f))+0.5, iw+1, double(int(float(h)*4.f/7.f))); - } - */ - // draw the box's borders - cr->set_line_width (1.); - cr->set_antialias(Cairo::ANTIALIAS_NONE); - c = style->get_border_color (state); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); - cr->rectangle (hb + hwslider - 0.5, double(int(float(h) * 1.5f / 7.f)) + 0.5, iw + 1, double(int(float(h) * 4.f / 7.f))); - cr->stroke (); + style->render_frame(cr, hb + hwslider - 0.5, double(int(float(h) * 1.5f / 7.f)) + 0.5, iw + 1, double(int(float(h) * 4.f / 7.f))); cr->set_line_width (1.); cr->set_antialias(Cairo::ANTIALIAS_NONE); @@ -375,21 +372,18 @@ bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) cr->set_antialias(Cairo::ANTIALIAS_SUBPIXEL); - if (is_sensitive() && bgGradient.size() > 1) { + if (is_sensitive() && coloredBar.canGetColors()) { // draw surrounding curve - c = style->get_background_color(state); - cr->set_source_rgb (c.get_red() * 0.85, c.get_green() * 0.85, c.get_blue() * 0.85); + cr->set_source_rgb (0., 0., 0.); cr->set_line_width (5.0); cr->stroke_preserve(); } // draw curve if (is_sensitive()) { - c = style->get_color(movedCursor != TS_UNDEFINED || litCursor != TS_UNDEFINED ? Gtk::STATE_FLAG_PRELIGHT : Gtk::STATE_FLAG_NORMAL); - cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->set_source_rgb (1., 1., 1.); } else { - c = style->get_background_color(Gtk::STATE_FLAG_INSENSITIVE); - cr->set_source_rgb (c.get_red() * 0.85, c.get_green() * 0.85, c.get_blue() * 0.85); + cr->set_source_rgba (0., 0., 0., 0.5); } cr->set_line_width (1.5); @@ -420,6 +414,9 @@ bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) style->set_state(currState); /* + * + Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; + cr->set_line_width (1.); for (int i=0; i<(doubleThresh?4:2); i++) { double posX = hb+hwslider+iw*positions01[i]+0.5; @@ -462,6 +459,21 @@ bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) } */ //} +} + +bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +{ + + // on_realize & updateBackBuffer have to be called before + if (get_realized() && get_width() && get_height()) { + if (isDirty()) { + updateBackBuffer(); + } + + if (surface) { + copySurface(cr); + } + } return true; } diff --git a/rtgui/thresholdselector.h b/rtgui/thresholdselector.h index 03b6bf554..f6caa4302 100644 --- a/rtgui/thresholdselector.h +++ b/rtgui/thresholdselector.h @@ -60,7 +60,7 @@ public: * have to provide through the ThresholdCurveProvider interface * */ -class ThresholdSelector : public Gtk::DrawingArea, public ColoredBar +class ThresholdSelector : public Gtk::DrawingArea, public BackBuffer { public: @@ -109,12 +109,13 @@ protected: void findBoundaries(double &min, double &max); double to01(ThreshCursorId cursorId); void updateTooltip(); + void updateBackBuffer(); Gtk::SizeRequestMode get_request_mode_vfunc () const; void get_preferred_height_vfunc (int& minimum_height, int& natural_height) 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_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; void on_realize (); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); @@ -124,6 +125,7 @@ protected: public: + ColoredBar coloredBar; sigc::signal signal_value_changed(); ThresholdSelector(double minValueBottom, double maxValueBottom, double defBottom, Glib::ustring labelBottom, unsigned int precisionBottom, diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 9b05c3b36..b06abe467 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -30,16 +30,12 @@ ThumbBrowserBase::ThumbBrowserBase () inW = -1; inH = -1; - Gtk::HBox* hb1 = Gtk::manage( new Gtk::HBox () ); - Gtk::HBox* hb2 = Gtk::manage( new Gtk::HBox () ); - hb1->pack_start (internal); - hb1->pack_end (vscroll, Gtk::PACK_SHRINK, 0); - - pack_start (*hb1); - - hb2->pack_start (hscroll); - - pack_start (*hb2, Gtk::PACK_SHRINK, 0); + setExpandAlignProperties(&internal, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); + setExpandAlignProperties(&hscroll, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + setExpandAlignProperties(&vscroll, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); + attach (internal, 0, 0, 1, 1); + attach (vscroll, 1, 0, 1, 1); + attach (hscroll, 0, 1, 1, 1); internal.setParent (this); @@ -876,6 +872,34 @@ bool ThumbBrowserBase::Internal::on_draw(const ::Cairo::RefPtr< Cairo::Context> return true; } +Gtk::SizeRequestMode ThumbBrowserBase::Internal::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_CONSTANT_SIZE; +} + +void ThumbBrowserBase::Internal::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + minimum_height = 20; + natural_height = 80; +} + +void ThumbBrowserBase::Internal::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 200; + natural_width = 1000; +} + +void ThumbBrowserBase::Internal::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + get_preferred_height_vfunc(minimum_height, natural_height); +} + +void ThumbBrowserBase::Internal::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + + bool ThumbBrowserBase::Internal::on_button_release_event (GdkEventButton* event) { // Gtk signals automatically acquire the GUI (i.e. this method is enclosed by gdk_thread_enter and gdk_thread_leave) diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index f4a5592bd..d4d7e63e2 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -29,7 +29,7 @@ /* * Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space */ -class ThumbBrowserBase : public Gtk::VBox +class ThumbBrowserBase : public Gtk::Grid { class Internal : public Gtk::DrawingArea @@ -52,6 +52,13 @@ class ThumbBrowserBase : public Gtk::VBox void on_realize(); void on_style_updated(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); + + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int &minimum_height, int &natural_height) 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_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; + bool on_button_press_event (GdkEventButton* event); bool on_button_release_event (GdkEventButton* event); bool on_motion_notify_event (GdkEventMotion* event); diff --git a/rtgui/zoompanel.cc b/rtgui/zoompanel.cc index 84910d805..7e88fb1b3 100644 --- a/rtgui/zoompanel.cc +++ b/rtgui/zoompanel.cc @@ -39,23 +39,23 @@ ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) zoomOut = Gtk::manage (new Gtk::Button()); zoomOut->add (*imageOut); zoomOut->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(zoomOut, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoomOut, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); zoomIn = Gtk::manage (new Gtk::Button()); zoomIn->add (*imageIn); zoomIn->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(zoomIn, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoomIn, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); zoomFit = Gtk::manage (new Gtk::Button()); zoomFit->add (*imageFit); zoomFit->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(zoomFit, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoomFit, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); zoomFitCrop = Gtk::manage (new Gtk::Button()); zoomFitCrop->add (*imageFitCrop); zoomFitCrop->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(zoomFitCrop, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoomFitCrop, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); zoom11 = Gtk::manage (new Gtk::Button()); zoom11->add (*image11); zoom11->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(zoom11, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoom11, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); attach_next_to (*zoomOut, Gtk::POS_RIGHT, 1, 1); attach_next_to (*zoomIn, Gtk::POS_RIGHT, 1, 1); @@ -64,7 +64,7 @@ ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) attach_next_to (*zoom11, Gtk::POS_RIGHT, 1, 1); zoomLabel = Gtk::manage (new Gtk::Label ()); - setExpandAlignProperties(zoomLabel, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(zoomLabel, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); attach_next_to (*zoomLabel, Gtk::POS_RIGHT, 1, 1); Gtk::Image* imageCrop = Gtk::manage (new RTImage ("new-detail-window.png")); @@ -72,7 +72,7 @@ ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) newCrop = Gtk::manage (new Gtk::Button()); newCrop->add (*imageCrop); newCrop->set_relief(Gtk::RELIEF_NONE); - setExpandAlignProperties(newCrop, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + setExpandAlignProperties(newCrop, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); attach_next_to (*newCrop, Gtk::POS_RIGHT, 1, 1); show_all_children ();