Bring back the remembering feature of the expanded/collapsed status of the tools. See issue 2648. Additionnally, correct a GUI bug of the B&W tool: the display wasn't initialized correctly when opening a new editor.

This commit is contained in:
Hombrenatureh.510
2015-03-15 12:28:27 +01:00
parent 682e6b9017
commit 4fbd3af156
24 changed files with 197 additions and 116 deletions

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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"
##################################################################

View File

@@ -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;
@@ -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"));

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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<Glib::ustring>& efiles) { fileCatalog->refreshEditedState (efiles); }

View File

@@ -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 ();

View File

@@ -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;

View File

@@ -370,6 +370,36 @@ void drawCrop (Cairo::RefPtr<Cairo::Context> 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<Gdk::Window> window = get_window();
Glib::RefPtr<Gtk::Style> style = get_style ();
Cairo::RefPtr<Cairo::Context> 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<Gtk::Style>& 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;
}

View File

@@ -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<Gtk::Style>& 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

View File

@@ -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<Gtk::Style>& 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<Gdk::Window> window = get_window();
Glib::RefPtr<Gtk::Style> style = get_style ();
Cairo::RefPtr<Cairo::Context> 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 ();
}

View File

@@ -416,14 +416,32 @@ void ToolPanelCoordinator::closeImage () {
}
}
void ToolPanelCoordinator::readOptions () {
void ToolPanelCoordinator::closeAllTools() {
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
expList.at(i)->set_expanded (false);
}
void ToolPanelCoordinator::openAllTools() {
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
expList.at(i)->set_expanded (true);
}
void ToolPanelCoordinator::updateToolState() {
crop->readOptions ();
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
expList.at(i)->set_expanded (options.tpOpen.at(i));
}
void ToolPanelCoordinator::readOptions () {
crop->readOptions ();
}
void ToolPanelCoordinator::writeOptions () {
crop->writeOptions ();

View File

@@ -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 ();