From: Carlos Lopez Date: Sat, 27 Jun 2009 07:30:59 +0000 (+0200) Subject: Use toogleducksdial member pointer and do not expose the toggle buttons pointers... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b11817a7154a704ce068400f22e7894e2e362ae0;p=synfig.git Use toogleducksdial member pointer and do not expose the toggle buttons pointers outide. Create member methods instead --- diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 72ce50a..c7db107 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -100,7 +100,6 @@ #include "audiocontainer.h" #include "widget_timeslider.h" #include "keyframedial.h" -#include "toggleducksdial.h" #include #include @@ -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) diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.h b/synfig-studio/trunk/src/gtkmm/canvasview.h index 2ed261e..182d3e6 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.h +++ b/synfig-studio/trunk/src/gtkmm/canvasview.h @@ -66,6 +66,7 @@ #include "dialog_waypoint.h" #include "dialog_keyframe.h" #include "framedial.h" +#include "toggleducksdial.h" #include "duckmatic.h" #include @@ -265,6 +266,7 @@ private: Gtk::Button *animatebutton; Gtk::Button *keyframebutton; FrameDial *framedial; + ToggleDucksDial *toggleducksdial; //! Shows current time and allows edition diff --git a/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp b/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp index 78aeab5..6dd67bc 100644 --- a/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp +++ b/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp @@ -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)); +} diff --git a/synfig-studio/trunk/src/gtkmm/toggleducksdial.h b/synfig-studio/trunk/src/gtkmm/toggleducksdial.h index d2e50f2..312e3fd 100644 --- a/synfig-studio/trunk/src/gtkmm/toggleducksdial.h +++ b/synfig-studio/trunk/src/gtkmm/toggleducksdial.h @@ -33,9 +33,11 @@ #include #include #include +#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 signal_ducks_position() { return ducks_position->signal_toggled(); } Glib::SignalProxy0 signal_ducks_vertex() { return ducks_vertex-> signal_toggled(); } Glib::SignalProxy0 signal_ducks_tangent() { return ducks_tangent-> signal_toggled(); } @@ -68,13 +71,6 @@ public: Glib::SignalProxy0 signal_ducks_width() { return ducks_width-> signal_toggled(); } Glib::SignalProxy0 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