diff --git a/rtdata/themes/09-Gray-Orange.gtkrc b/rtdata/themes/09-Gray-Orange.gtkrc index 56a67711b..43f4f8f8a 100644 --- a/rtdata/themes/09-Gray-Orange.gtkrc +++ b/rtdata/themes/09-Gray-Orange.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/17-Gray-Red.gtkrc b/rtdata/themes/17-Gray-Red.gtkrc index 7e8d72a2c..ce12862c0 100644 --- a/rtdata/themes/17-Gray-Red.gtkrc +++ b/rtdata/themes/17-Gray-Red.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/21-Gray-Gray.gtkrc b/rtdata/themes/21-Gray-Gray.gtkrc index bc3e12f02..c1f236553 100644 --- a/rtdata/themes/21-Gray-Gray.gtkrc +++ b/rtdata/themes/21-Gray-Gray.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/21-Gray-Orange.gtkrc b/rtdata/themes/21-Gray-Orange.gtkrc index 78b033e96..dcf4762a0 100644 --- a/rtdata/themes/21-Gray-Orange.gtkrc +++ b/rtdata/themes/21-Gray-Orange.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/21-Gray-Purple.gtkrc b/rtdata/themes/21-Gray-Purple.gtkrc index dff49c820..7b94adf2d 100644 --- a/rtdata/themes/21-Gray-Purple.gtkrc +++ b/rtdata/themes/21-Gray-Purple.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/21-Gray-Red.gtkrc b/rtdata/themes/21-Gray-Red.gtkrc index faa48cfa1..4c27916d3 100644 --- a/rtdata/themes/21-Gray-Red.gtkrc +++ b/rtdata/themes/21-Gray-Red.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Gray.gtkrc b/rtdata/themes/25-Gray-Gray.gtkrc index 08a4f1a11..6dd8e7df9 100644 --- a/rtdata/themes/25-Gray-Gray.gtkrc +++ b/rtdata/themes/25-Gray-Gray.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Purple.gtkrc b/rtdata/themes/25-Gray-Purple.gtkrc index 9d4d245b4..d1a97c335 100644 --- a/rtdata/themes/25-Gray-Purple.gtkrc +++ b/rtdata/themes/25-Gray-Purple.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/25-Gray-Red.gtkrc b/rtdata/themes/25-Gray-Red.gtkrc index 741ee69a3..649876ca5 100644 --- a/rtdata/themes/25-Gray-Red.gtkrc +++ b/rtdata/themes/25-Gray-Red.gtkrc @@ -532,9 +532,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/37-Gray-Red-Textured.gtkrc b/rtdata/themes/37-Gray-Red-Textured.gtkrc index 0ef5fad92..0318f972a 100644 --- a/rtdata/themes/37-Gray-Red-Textured.gtkrc +++ b/rtdata/themes/37-Gray-Red-Textured.gtkrc @@ -877,9 +877,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/37-Gray-Red.gtkrc b/rtdata/themes/37-Gray-Red.gtkrc index 71e543630..8830f0703 100644 --- a/rtdata/themes/37-Gray-Red.gtkrc +++ b/rtdata/themes/37-Gray-Red.gtkrc @@ -534,9 +534,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/63-Gray-Cyan.gtkrc b/rtdata/themes/63-Gray-Cyan.gtkrc index efcd18e44..f7066607b 100644 --- a/rtdata/themes/63-Gray-Cyan.gtkrc +++ b/rtdata/themes/63-Gray-Cyan.gtkrc @@ -517,9 +517,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtdata/themes/92-Beige-DarkCyan.gtkrc b/rtdata/themes/92-Beige-DarkCyan.gtkrc index e5365f104..59108c6b0 100644 --- a/rtdata/themes/92-Beige-DarkCyan.gtkrc +++ b/rtdata/themes/92-Beige-DarkCyan.gtkrc @@ -512,9 +512,9 @@ widget "*.FramelessSpinButton" style "clearlooks-framelessspinbutton" widget "*.ThresholdSelector" style "clearlooks-thresholdselector" widget "*.MyExpanderTitle.*" style "clearlooks-expander" widget "*.MyExpanderTitle" style "clearlooks-expander" -widget "*.ToolPanel" style "clearlooks-toolFrame" -widget "*.ToolPanel.*.MyExpanderTitle" style "clearlooks-subexpander" -widget "*.ToolPanel.*.MyExpanderTitle.*" style "clearlooks-subexpander" +widget "*.ExpanderBox" style "clearlooks-toolFrame" +widget "*.ExpanderBox.*.MyExpanderTitle" style "clearlooks-subexpander" +widget "*.ExpanderBox.*.MyExpanderTitle.*" style "clearlooks-subexpander" # The window of the tooltip is called "gtk-tooltip" ################################################################## diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index 559b70d4f..f631225bb 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -364,6 +364,10 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB // tcmodeconn2 = afterCurveMode->signal_changed().connect( sigc::mem_fun(*this, &BlackWhite::curveMode1Changed2), true ); show_all(); + + disableListener(); + methodChanged(); + enableListener(); } BlackWhite::~BlackWhite () { delete luminanceCEG; @@ -1073,7 +1077,7 @@ void BlackWhite::updateRGBLabel () { Glib::ustring::format(std::fixed, std::setprecision(1), r*100.), Glib::ustring::format(std::fixed, std::setprecision(1), g*100.), Glib::ustring::format(std::fixed, std::setprecision(1), b*100.), - Glib::ustring::format(std::fixed, std::setprecision(0), ceil(kcorrec*100./*(r+g+b)*100.)*/))) + Glib::ustring::format(std::fixed, std::setprecision(0), ceil(kcorrec*100./*(r+g+b)*100.)*/))) ); // We have to update the RGB sliders too if preset values has been chosen if (sSetting != "RGB-Abs" && sSetting != "RGB-Rel" && sSetting != "ROYGCBPM-Abs" && sSetting != "ROYGCBPM-Rel") { @@ -1112,8 +1116,10 @@ void BlackWhite::setBatchMode (bool batchMode) { setting->append_text (M("GENERAL_UNCHANGED")); luminanceCEG->setBatchMode (batchMode); beforeCurveCEG->setBatchMode (batchMode); + beforeCurveCEG->show(); beforeCurveMode->append_text (M("GENERAL_UNCHANGED")); afterCurveCEG->setBatchMode (batchMode); + afterCurveCEG->show(); // afterCurveMode->append_text (M("GENERAL_UNCHANGED")); algo->append_text (M("GENERAL_UNCHANGED")); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index b1f03fdd9..9983a8653 100755 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -440,6 +440,7 @@ void EditorPanel::on_realize () { Gtk::VBox::on_realize (); // This line is needed to avoid autoexpansion of the window :-/ vboxright->set_size_request (options.toolPanelWidth, -1); + tpc->updateToolState(); } void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index f65b3e0a7..579a20006 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -139,6 +139,12 @@ FilePanel::~FilePanel () { delete inspectorPanel; } +void FilePanel::on_realize () { + Gtk::HPaned::on_realize (); + tpc->closeAllTools(); +} + + void FilePanel::setAspect () { int winW, winH; parent->get_size(winW, winH); diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index 07e6538ec..834564ba4 100755 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -82,6 +82,7 @@ class FilePanel : public Gtk::HPaned, void setParent (RTWindow* p) { parent = p; } void init (); // dont call it directly, the constructor calls it as idle source + void on_realize (); void setAspect(); void open (const Glib::ustring& d); // open a file or a directory void refreshEditedState (const std::set& efiles) { fileCatalog->refreshEditedState (efiles); } diff --git a/rtgui/gradient.cc b/rtgui/gradient.cc index 7ba81730b..0f3d0e28d 100644 --- a/rtgui/gradient.cc +++ b/rtgui/gradient.cc @@ -11,10 +11,14 @@ using namespace rtengine::procparams; Gradient::Gradient () : FoldableToolPanel(this, "gradient", M("TP_GRADIENT_LABEL"), false, true), EditSubscriber(ET_OBJECTS), lastObject(-1), draggedPointOldAngle(-1000.) { + + editHBox = Gtk::manage (new Gtk::HBox()); edit = Gtk::manage (new Gtk::ToggleButton()); edit->add (*Gtk::manage (new RTImage ("editmodehand.png"))); edit->set_tooltip_text(M("EDIT_OBJECT_TOOLTIP")); editConn = edit->signal_toggled().connect( sigc::mem_fun(*this, &Gradient::editToggled) ); + editHBox->pack_start(*edit, Gtk::PACK_SHRINK, 0); + pack_start (*editHBox, Gtk::PACK_SHRINK, 0); strength = Gtk::manage (new Adjuster (M("TP_GRADIENT_STRENGTH"), -5, 5, 0.01, 0)); strength->set_tooltip_text (M("TP_GRADIENT_STRENGTH_TOOLTIP")); @@ -36,11 +40,11 @@ Gradient::Gradient () : FoldableToolPanel(this, "gradient", M("TP_GRADIENT_LABEL centerY->set_tooltip_text (M("TP_GRADIENT_CENTER_Y_TOOLTIP")); centerY->setAdjusterListener (this); - pack_start (*strength); - pack_start (*degree); - pack_start (*feather); - pack_start (*centerX); - pack_start (*centerY); + pack_start (*strength, Gtk::PACK_SHRINK, 0); + pack_start (*degree, Gtk::PACK_SHRINK, 0); + pack_start (*feather, Gtk::PACK_SHRINK, 0); + pack_start (*centerX, Gtk::PACK_SHRINK, 0); + pack_start (*centerY, Gtk::PACK_SHRINK, 0); // Instantiating the Editing geometry; positions will be initialized later Line *hLine, *vLine, *featherLine[2]; @@ -266,7 +270,8 @@ void Gradient::trimValues (rtengine::procparams::ProcParams* pp) void Gradient::setBatchMode (bool batchMode) { - removeIfThere(this, edit, false); + editConn.disconnect(); + removeIfThere(this, editHBox, false); ToolPanel::setBatchMode (batchMode); degree->showEditedCB (); feather->showEditedCB (); diff --git a/rtgui/gradient.h b/rtgui/gradient.h index e1b71de9f..e27bebe3b 100644 --- a/rtgui/gradient.h +++ b/rtgui/gradient.h @@ -15,6 +15,7 @@ class Gradient : public ToolParamBlock, public AdjusterListener, public Foldable int lastObject; protected: + Gtk::HBox *editHBox; Gtk::ToggleButton* edit; Adjuster* degree; Adjuster* feather; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 0a4ec22e4..1aa4be64b 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -370,6 +370,36 @@ void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int cr->reset_clip (); } +bool ExpanderBox::on_expose_event(GdkEventExpose* event) { + bool retVal = Gtk::EventBox::on_expose_event(event); + + if (!options.useSystemTheme) { + Glib::RefPtr window = get_window(); + Glib::RefPtr style = get_style (); + Cairo::RefPtr cr = window->create_cairo_context(); + + int x_, y_, w_, h_, foo; + window->get_geometry(x_, y_, w_, h_, foo); + double x = 0.; + double y = 0.; + double w = double(w_); + double h = double(h_); + + cr->set_antialias (Cairo::ANTIALIAS_NONE); + + // draw a frame + cr->set_line_width (1.0); + Gdk::Color c = style->get_fg (Gtk::STATE_NORMAL); + cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->move_to(x+0.5, y+0.5); + cr->line_to(x+w, y+0.5); + cr->line_to(x+w, y+h); + cr->line_to(x+0.5, y+h); + cr->line_to(x+0.5, y+0.5); + cr->stroke (); + } + return retVal; +} void MyExpander::init() { inconsistentPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderInconsistent.png")); @@ -380,7 +410,7 @@ void MyExpander::init() { } MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : - enabled(false), inconsistent(false), flushEvent(false), + enabled(false), inconsistent(false), flushEvent(false), expBox(NULL), child(NULL), headerWidget(NULL), statusImage(NULL), label(NULL), useEnabled(useEnabled) { @@ -425,7 +455,7 @@ MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : } MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : - enabled(false), inconsistent(false), flushEvent(false), + enabled(false), inconsistent(false), flushEvent(false), expBox(NULL), child(NULL), headerWidget(NULL), statusImage(NULL), label(NULL), useEnabled(useEnabled) { @@ -473,6 +503,32 @@ MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave), false); } +ExpanderBox::ExpanderBox( Gtk::Container *p):pC(p) { + set_name ("ExpanderBox"); + updateStyle(); +} + +void ExpanderBox::on_style_changed (const Glib::RefPtr& style) { + updateStyle(); +} + +void ExpanderBox::updateStyle() { + set_border_width(options.slimUI ? 2 : 8); // Outer space around the tool's frame 2:7 +} + +void ExpanderBox::show_all() { + // ask childs to show themselves, but not us (remain unchanged) + Gtk::Container::show_all_children(true); +} + +void ExpanderBox::showBox() { + Gtk::EventBox::show(); +} + +void ExpanderBox::hideBox() { + Gtk::EventBox::hide(); +} + bool MyExpander::on_enter_leave (GdkEventCrossing* event) { if (is_sensitive()) { if (event->type == GDK_ENTER_NOTIFY) { @@ -492,7 +548,7 @@ void MyExpander::updateStyle() { headerHBox->set_border_width(options.slimUI ? 1 : 2); set_spacing(0); set_border_width(options.slimUI ? 0 : 1); - if (child) child->set_border_width(options.slimUI ? 2 : 8); // Outer space around the tool's frame 2:7 + if (expBox) expBox->updateStyle(); } void MyExpander::setLabel (Glib::ustring newLabel) { @@ -570,10 +626,10 @@ void MyExpander::setEnabledTooltipText(Glib::ustring tooltipText) { } void MyExpander::set_expanded( bool expanded ) { - if (!child) + if (!expBox) return; - bool isVisible = child->is_visible(); + bool isVisible = expBox->is_visible(); if (isVisible == expanded) return; @@ -584,17 +640,23 @@ void MyExpander::set_expanded( bool expanded ) { else statusImage->set(closedPBuf); } - child->set_visible(expanded); + if (expanded) + expBox->showBox(); + else + expBox->hideBox(); } bool MyExpander::get_expanded() { - return child ? child->get_visible() : false; + return expBox ? expBox->get_visible() : false; } void MyExpander::add (Gtk::Container& widget) { child = &widget; - pack_start(widget); - widget.show(); + expBox = Gtk::manage (new ExpanderBox (child)); + expBox->add (*child); + pack_start(*expBox, Gtk::PACK_SHRINK, 0); + child->show(); + expBox->hideBox(); } bool MyExpander::on_toggle(GdkEventButton* event) { @@ -603,17 +665,20 @@ bool MyExpander::on_toggle(GdkEventButton* event) { return false; } - if (!child || event->button != 1) + if (!expBox || event->button != 1) return false; - bool isVisible = child->is_visible(); + bool isVisible = expBox->is_visible(); if (!useEnabled) { if (isVisible) statusImage->set(closedPBuf); else statusImage->set(openedPBuf); } - child->set_visible(!isVisible); + if (isVisible) + expBox->hideBox(); + else + expBox->showBox(); return false; } diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index c732aa105..bc6c52b5e 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -76,6 +76,32 @@ public: } }; +/** + * @brief Glue box to control visibility of the MyExpender's content ; also handle the frame around it + */ +class ExpanderBox: public Gtk::EventBox +{ +private: + Gtk::Container *pC; + +public: + ExpanderBox( Gtk::Container *p); + ~ExpanderBox( ){ delete pC;} + + void updateStyle(); + + void show() {} + void show_all(); + void hide() {} + void set_visible(bool isVisible=true) {} + + void showBox(); + void hideBox(); + + void on_style_changed (const Glib::RefPtr& style); + bool on_expose_event(GdkEventExpose* event); +}; + /** * @brief A custom Expander class, that can handle widgets in the title bar * @@ -99,6 +125,7 @@ private: Gtk::EventBox *titleEvBox; /// EventBox of the title, to get a connector from it Gtk::HBox *headerHBox; bool flushEvent; /// Flag to control the weird event mechanism of Gtk (please prove me wrong!) + ExpanderBox* expBox; /// Frame that includes the child and control its visibility /// Triggered on opened/closed event bool on_toggle(GdkEventButton* event); @@ -114,7 +141,7 @@ private: protected: - Gtk::Container* child; /// Gtk::Contained to display below the expander's title + Gtk::Container* child; /// Gtk::Contained to display below the expander's title Gtk::Widget* headerWidget; /// Widget to display in the header, next to the arrow image ; can be NULL if the "string" version of the ctor has been used Gtk::Image* statusImage; /// Image to display the opened/closed status (if useEnabled is false) of the enabled/disabled status (if useEnabled is true) Gtk::Label* label; /// Text to display in the header, next to the arrow image ; can be NULL if the "widget" version of the ctor has been used diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index 55399fda6..db8e10d00 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -18,57 +18,11 @@ */ #include "toolpanel.h" #include "toolpanelcoord.h" +#include "guiutils.h" using namespace rtengine::procparams; -class Frame2: public Gtk::EventBox -{ - Gtk::Container *pC; - -public: - Frame2( Gtk::Container *p):pC(p){ updateStyle(); } - ~Frame2( ){ delete pC;} - - void updateStyle() { - set_border_width(options.slimUI ? 2 : 8); // Outer space around the tool's frame 2:7 - } - - void on_style_changed (const Glib::RefPtr& style) { updateStyle(); } - bool on_expose_event(GdkEventExpose* event); -}; - -bool Frame2::on_expose_event(GdkEventExpose* event) { - bool retVal = Gtk::EventBox::on_expose_event(event); - - if (!options.useSystemTheme) { - Glib::RefPtr window = get_window(); - Glib::RefPtr style = get_style (); - Cairo::RefPtr cr = window->create_cairo_context(); - - int x_, y_, w_, h_, foo; - window->get_geometry(x_, y_, w_, h_, foo); - double x = 0.; - double y = 0.; - double w = double(w_); - double h = double(h_); - - cr->set_antialias (Cairo::ANTIALIAS_NONE); - - // draw a frame - cr->set_line_width (1.0); - Gdk::Color c = style->get_fg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->move_to(x+0.5, y+0.5); - cr->line_to(x+w, y+0.5); - cr->line_to(x+w, y+h); - cr->line_to(x+0.5, y+h); - cr->line_to(x+0.5, y+0.5); - cr->stroke (); - } - return retVal; -} - ToolVBox::ToolVBox() { updateStyle(); } @@ -134,14 +88,7 @@ FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, exp->signal_button_release_event().connect_notify( sigc::mem_fun(this, &FoldableToolPanel::foldThemAll) ); enaConn = signal_enabled_toggled().connect( sigc::mem_fun(*this, &FoldableToolPanel::enabled_toggled) ); - Frame2* pframe = Gtk::manage (new Frame2 (content)); - - pframe->set_name ("ToolPanel"); - - pframe->add (*content); - - exp->add (*pframe); - pframe->show (); + exp->add (*content); exp->show (); } diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index f717f9040..8dd861ef8 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -416,14 +416,32 @@ void ToolPanelCoordinator::closeImage () { } } -void ToolPanelCoordinator::readOptions () { +void ToolPanelCoordinator::closeAllTools() { + + for (size_t i=0; iset_expanded (false); +} + +void ToolPanelCoordinator::openAllTools() { + + for (size_t i=0; iset_expanded (true); +} + +void ToolPanelCoordinator::updateToolState() { - crop->readOptions (); for (size_t i=0; iset_expanded (options.tpOpen.at(i)); } +void ToolPanelCoordinator::readOptions () { + + crop->readOptions (); +} + void ToolPanelCoordinator::writeOptions () { crop->writeOptions (); diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 475e21435..98301c36f 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -231,6 +231,10 @@ class ToolPanelCoordinator : public ToolPanelListener, void initImage (rtengine::StagedImageProcessor* ipc_, bool israw); void closeImage (); + // update the "expanded" state of the Tools + void updateToolState (); + void openAllTools (); + void closeAllTools (); // read/write the "expanded" state of the expanders & read/write the crop panel settings (ratio, guide type, etc.) void readOptions (); void writeOptions ();