Bugfix in LabGrid class + code refactoring

- suppressed trailing `_` char for class' parameters
- renamed function name (those not related to Gtk) to lowerCamelCase
- changed the mecanism of dragging point, to avoid throwing unecessary
`panelChange` event
- added a `reset` function, with support of `toInitial` to get back the
values at load time (CTRL+click on reset button)
- `on_draw` optimisation: now LabGrid IS A BackBuffer
This commit is contained in:
Hombre
2018-01-13 20:26:19 +01:00
parent 0498048ca0
commit 52be618963
8 changed files with 257 additions and 181 deletions

View File

@@ -43,33 +43,45 @@
#include "toolpanel.h"
class LabGrid: public Gtk::DrawingArea {
class LabGrid: public Gtk::DrawingArea, public BackBuffer {
private:
rtengine::ProcEvent evt_;
enum State { OFF, HIGH, LOW };
State selected_;
float low_a_;
float high_a_;
float low_b_;
float high_b_;
ToolPanelListener *listener_;
bool edited_;
sigc::connection delay_conn_;
rtengine::ProcEvent evt;
enum State { NONE, HIGH, LOW };
State litPoint;
float low_a;
float high_a;
float low_b;
float high_b;
float defaultLow_a;
float defaultHigh_a;
float defaultLow_b;
float defaultHigh_b;
ToolPanelListener *listener;
bool edited;
bool isDragged;
sigc::connection delayconn;
static const int inset = 2;
bool notify_listener();
bool notifyListener();
void getLitPoint();
public:
LabGrid(rtengine::ProcEvent evt);
void get_params(double &la, double &lb, double &ha, double &hb) const;
void set_params(double la, double lb, double ha, double hb, bool notify);
void set_edited(bool yes);
bool get_edited() const;
void set_listener(ToolPanelListener *l);
void getParams(double &la, double &lb, double &ha, double &hb) const;
void setParams(double la, double lb, double ha, double hb, bool notify);
void setDefault (double la, double lb, double ha, double hb);
void setEdited(bool yes);
bool getEdited() const;
void reset(bool toInitial);
void setListener(ToolPanelListener *l);
bool on_draw(const ::Cairo::RefPtr<Cairo::Context> &crf);
void on_style_updated ();
bool on_button_press_event(GdkEventButton *event);
bool on_button_release_event(GdkEventButton *event);
bool on_motion_notify_event(GdkEventMotion *event);
Gtk::SizeRequestMode get_request_mode_vfunc() const;
void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const;