Use toogleducksdial member pointer and do not expose the toggle buttons pointers...
authorCarlos Lopez <carlos@pcnuevo.(none)>
Sat, 27 Jun 2009 07:30:59 +0000 (09:30 +0200)
committerCarlos Lopez <carlos@pcnuevo.(none)>
Mon, 13 Jul 2009 18:07:38 +0000 (20:07 +0200)
synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/gtkmm/canvasview.h
synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp
synfig-studio/trunk/src/gtkmm/toggleducksdial.h

index 72ce50a..c7db107 100644 (file)
 #include "audiocontainer.h"
 #include "widget_timeslider.h"
 #include "keyframedial.h"
-#include "toggleducksdial.h"
 
 #include <synfigapp/main.h>
 #include <synfigapp/inputdevice.h>
@@ -1023,14 +1022,10 @@ CanvasView::create_time_bar()
        keyframebutton=keyframedial->get_lock_button();
 
        // Setup the ToggleDuckDial widget
-       ToggleDucksDial *toggleducksdial = Gtk::manage(new class ToggleDucksDial());
-
-       toggleducksdial->get_position_toggle()-> set_active(work_area->get_type_mask()&Duck::TYPE_POSITION);
-       toggleducksdial->get_vertex_toggle()  -> set_active(work_area->get_type_mask()&Duck::TYPE_VERTEX);
-       toggleducksdial->get_tangent_toggle() -> set_active(work_area->get_type_mask()&Duck::TYPE_TANGENT);
-       toggleducksdial->get_radius_toggle()  -> set_active(work_area->get_type_mask()&Duck::TYPE_RADIUS);
-       toggleducksdial->get_width_toggle()   -> set_active(work_area->get_type_mask()&Duck::TYPE_WIDTH);
-       toggleducksdial->get_angle_toggle()   -> set_active(work_area->get_type_mask()&Duck::TYPE_ANGLE);
+       toggleducksdial = Gtk::manage(new class ToggleDucksDial());
+
+       Duck::Type m = work_area->get_type_mask();
+       toggleducksdial->update_toggles(m);
 
        toggleducksdial->signal_ducks_position().connect(
                        sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_POSITION)
index 2ed261e..182d3e6 100644 (file)
@@ -66,6 +66,7 @@
 #include "dialog_waypoint.h"
 #include "dialog_keyframe.h"
 #include "framedial.h"
+#include "toggleducksdial.h"
 
 #include "duckmatic.h"
 #include <gtkmm/scale.h>
@@ -265,6 +266,7 @@ private:
        Gtk::Button *animatebutton;
        Gtk::Button *keyframebutton;
        FrameDial *framedial;
+       ToggleDucksDial *toggleducksdial;
 
 
        //! Shows current time and allows edition
index 78aeab5..6dd67bc 100644 (file)
@@ -81,3 +81,14 @@ ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *label,
 
        return tbutton;
 }
+
+void
+ToggleDucksDial::initiate_toggles(Duck::Type mask)
+{
+       ducks_position-> set_active((mask & Duck::TYPE_POSITION));
+       ducks_vertex  -> set_active((mask & Duck::TYPE_VERTEX));
+       ducks_tangent -> set_active((mask & Duck::TYPE_TANGENT));
+       ducks_radius  -> set_active((mask & Duck::TYPE_RADIUS));
+       ducks_width   -> set_active((mask & Duck::TYPE_WIDTH));
+       ducks_angle   -> set_active((mask & Duck::TYPE_ANGLE));
+}
index d2e50f2..312e3fd 100644 (file)
 #include <gtkmm/tooltips.h>
 #include <gtkmm/table.h>
 #include <gtkmm/togglebutton.h>
+#include "duckmatic.h"
 
 #include "general.h"
 
+
 /* === M A C R O S ========================================================= */
 
 /* === T Y P E D E F S ===================================================== */
@@ -61,6 +63,7 @@ class ToggleDucksDial : public Gtk::Table
 public:
 
        ToggleDucksDial();
+       void initiate_toggles(Duck::Type mask);
        Glib::SignalProxy0<void> signal_ducks_position()  { return ducks_position->signal_toggled(); }
        Glib::SignalProxy0<void> signal_ducks_vertex()    { return ducks_vertex->  signal_toggled(); }
        Glib::SignalProxy0<void> signal_ducks_tangent()   { return ducks_tangent-> signal_toggled(); }
@@ -68,13 +71,6 @@ public:
        Glib::SignalProxy0<void> signal_ducks_width()     { return ducks_width->   signal_toggled(); }
        Glib::SignalProxy0<void> signal_ducks_angle()     { return ducks_angle->   signal_toggled(); }
 
-       Gtk::ToggleButton * get_position_toggle() { return ducks_position; }
-       Gtk::ToggleButton * get_vertex_toggle()   { return ducks_vertex; }
-       Gtk::ToggleButton * get_tangent_toggle()  { return ducks_tangent; }
-       Gtk::ToggleButton * get_radius_toggle()   { return ducks_radius; }
-       Gtk::ToggleButton * get_width_toggle()    { return ducks_width; }
-       Gtk::ToggleButton * get_angle_toggle()    { return ducks_angle; }
-
 }; // END of class ToggleDucksDial
 
 }; // END of namespace studio