Synchronise toggle buttons with keyboard and menu actions.
authorCarlos Lopez <carlos@pcnuevo.(none)>
Sat, 27 Jun 2009 08:20:11 +0000 (10:20 +0200)
committerCarlos Lopez <carlos@pcnuevo.(none)>
Mon, 13 Jul 2009 18:07:39 +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 c7db107..2207d24 100644 (file)
@@ -704,6 +704,7 @@ CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigap
        layer_tree=0;
        children_tree=0;
        duck_refresh_flag=true;
+       toggling_ducks_=false;
 
        smach_.set_default_state(&state_normal);
 
@@ -3660,6 +3661,9 @@ CanvasView::on_keyframe_remove_pressed()
 void
 CanvasView::toggle_duck_mask(Duckmatic::Type type)
 {
+       if(toggling_ducks_)
+               return;
+       toggling_ducks_=true;
        bool is_currently_on(work_area->get_type_mask()&type);
 
        if(is_currently_on)
@@ -3668,6 +3672,15 @@ CanvasView::toggle_duck_mask(Duckmatic::Type type)
                work_area->set_type_mask(work_area->get_type_mask()|type);
 
        work_area->queue_draw();
+       try
+       {
+               toggleducksdial->update_toggles(work_area->get_type_mask());
+       }
+       catch(...)
+       {
+               toggling_ducks_=false;
+       }
+       toggling_ducks_=false;
 }
 
 void
index 182d3e6..826c8ea 100644 (file)
@@ -267,6 +267,7 @@ private:
        Gtk::Button *keyframebutton;
        FrameDial *framedial;
        ToggleDucksDial *toggleducksdial;
+       bool toggling_ducks_;
 
 
        //! Shows current time and allows edition
index 6dd67bc..8e07816 100644 (file)
@@ -83,7 +83,7 @@ ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *label,
 }
 
 void
-ToggleDucksDial::initiate_toggles(Duck::Type mask)
+ToggleDucksDial::update_toggles(Duck::Type mask)
 {
        ducks_position-> set_active((mask & Duck::TYPE_POSITION));
        ducks_vertex  -> set_active((mask & Duck::TYPE_VERTEX));
index 312e3fd..919b01a 100644 (file)
@@ -63,7 +63,7 @@ class ToggleDucksDial : public Gtk::Table
 public:
 
        ToggleDucksDial();
-       void initiate_toggles(Duck::Type mask);
+       void update_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(); }