From: joncruz Date: Sun, 3 Aug 2008 05:56:45 +0000 (+0000) Subject: Fixed const-correctness and member access X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=70860961b13efbd553060efcdc5caf44d8fbc2ea;p=inkscape.git Fixed const-correctness and member access --- diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index c0aaaaa66..3da613416 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -107,8 +107,8 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _stroke_label (_("Stroke:")), _opacity_label (_("O:")), - _fill_place (SS_FILL), - _stroke_place (SS_STROKE), + _fill_place(this, SS_FILL), + _stroke_place(this, SS_STROKE), _fill_flag_place (), _stroke_flag_place (), @@ -118,7 +118,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_sb (0.02, 0), _stroke (), - _stroke_width_place(), + _stroke_width_place(this), _stroke_width (""), _opacity_blocked (false), @@ -379,10 +379,6 @@ SelectedStyle::SelectedStyle(bool /*layout*/) "drag_data_received", G_CALLBACK(dragDataReceived), _drop[SS_FILL]); - - _fill_place.parent = this; - _stroke_place.parent = this; - _stroke_width_place.parent = this; } SelectedStyle::~SelectedStyle() @@ -1155,12 +1151,16 @@ void SelectedStyle::on_opacity_changed () { /* ============================================= RotateableSwatch */ -RotateableSwatch::RotateableSwatch(guint mode) { - fillstroke = mode; - startcolor_set = false; - undokey = "ssrot1"; - cr = NULL; - cr_set = false; +RotateableSwatch::RotateableSwatch(SelectedStyle *parent, guint mode) : + fillstroke(mode), + parent(parent), + startcolor(0), + startcolor_set(false), + undokey("ssrot1"), + cr(0), + cr_set(false) + +{ } RotateableSwatch::~RotateableSwatch() { @@ -1332,11 +1332,14 @@ RotateableSwatch::do_release(double by, guint modifier) { /* ============================================= RotateableStrokeWidth */ -RotateableStrokeWidth::RotateableStrokeWidth() { - undokey = "swrot1"; - startvalue_set = false; - cr = NULL; - cr_set = false; +RotateableStrokeWidth::RotateableStrokeWidth(SelectedStyle *parent) : + parent(parent), + startvalue(0), + startvalue_set(false), + undokey("swrot1"), + cr(0), + cr_set(false) +{ } RotateableStrokeWidth::~RotateableStrokeWidth() { diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 482628166..0229364c7 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -59,9 +59,14 @@ class SelectedStyle; class RotateableSwatch: public Rotateable { public: - RotateableSwatch(guint mode); + RotateableSwatch(SelectedStyle *parent, guint mode); ~RotateableSwatch(); + double color_adjust (float *hsl, double by, guint32 cc, guint state); + virtual void do_motion (double by, guint state); + virtual void do_release (double by, guint state); + +private: guint fillstroke; SelectedStyle *parent; @@ -69,35 +74,32 @@ public: guint32 startcolor; bool startcolor_set; - gchar *undokey; + gchar const *undokey; GdkCursor *cr; bool cr_set; - - double color_adjust (float *hsl, double by, guint32 cc, guint state); - virtual void do_motion (double by, guint state); - virtual void do_release (double by, guint state); }; class RotateableStrokeWidth: public Rotateable { public: - RotateableStrokeWidth(); + RotateableStrokeWidth(SelectedStyle *parent); ~RotateableStrokeWidth(); + double value_adjust(double current, double by, guint modifier, bool final); + virtual void do_motion (double by, guint state); + virtual void do_release (double by, guint state); + +private: SelectedStyle *parent; double startvalue; bool startvalue_set; - gchar *undokey; + gchar const *undokey; GdkCursor *cr; bool cr_set; - - double value_adjust(double current, double by, guint modifier, bool final); - virtual void do_motion (double by, guint state); - virtual void do_release (double by, guint state); }; class SelectedStyle : public Gtk::HBox