Use Toggle buttons instead of Buttons for toggle ducks.
authorCarlos Lopez <carlos@pcnuevo.(none)>
Wed, 24 Jun 2009 21:01:35 +0000 (23:01 +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/toggleducksdial.cpp
synfig-studio/trunk/src/gtkmm/toggleducksdial.h

index caeb737..72ce50a 100644 (file)
@@ -1024,6 +1024,14 @@ CanvasView::create_time_bar()
 
        // 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->signal_ducks_position().connect(
                        sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_POSITION)
                        );
index b23acde..78aeab5 100644 (file)
@@ -69,15 +69,15 @@ ToggleDucksDial::ToggleDucksDial(): Gtk::Table(1, 6, false)
        attach(*ducks_angle, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
 }
 
-Gtk::Button *
+Gtk::ToggleButton *
 ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *label,
                const char * tooltip)
 {
-       Gtk::Button *button = manage(new class Gtk::Button());
-       button->set_label(label);
-       tooltips.set_tip(*button, tooltip);
-       button->set_relief(Gtk::RELIEF_NONE);
-       button->show();
+       Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
+       tbutton->set_label(label);
+       tooltips.set_tip(*tbutton, tooltip);
+       //tbutton->set_relief(Gtk::RELIEF_NONE);
+       tbutton->show();
 
-       return button;
+       return tbutton;
 }
index 510806f..d2e50f2 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <gtkmm/tooltips.h>
 #include <gtkmm/table.h>
-#include <gtkmm/button.h>
+#include <gtkmm/togglebutton.h>
 
 #include "general.h"
 
@@ -49,24 +49,31 @@ class ToggleDucksDial : public Gtk::Table
 {
        Gtk::Tooltips tooltips;
 
-       Gtk::Button *ducks_position;
-       Gtk::Button *ducks_vertex;
-       Gtk::Button *ducks_tangent;
-       Gtk::Button *ducks_radius;
-       Gtk::Button *ducks_width;
-       Gtk::Button *ducks_angle;
+       Gtk::ToggleButton *ducks_position;
+       Gtk::ToggleButton *ducks_vertex;
+       Gtk::ToggleButton *ducks_tangent;
+       Gtk::ToggleButton *ducks_radius;
+       Gtk::ToggleButton *ducks_width;
+       Gtk::ToggleButton *ducks_angle;
 
-       Gtk::Button *create_label_button(Gtk::IconSize iconsize, const char * label, const char * tooltip);
+       Gtk::ToggleButton *create_label_button(Gtk::IconSize iconsize, const char * label, const char * tooltip);
 
 public:
 
        ToggleDucksDial();
-       Glib::SignalProxy0<void> signal_ducks_position()  { return ducks_position->signal_clicked(); }
-       Glib::SignalProxy0<void> signal_ducks_vertex()  { return ducks_vertex->signal_clicked(); }
-       Glib::SignalProxy0<void> signal_ducks_tangent()  { return ducks_tangent->signal_clicked(); }
-       Glib::SignalProxy0<void> signal_ducks_radius()  { return ducks_radius->signal_clicked(); }
-       Glib::SignalProxy0<void> signal_ducks_width()  { return ducks_width->signal_clicked(); }
-       Glib::SignalProxy0<void> signal_ducks_angle()  { return ducks_angle->signal_clicked(); }
+       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(); }
+       Glib::SignalProxy0<void> signal_ducks_radius()    { return ducks_radius->  signal_toggled(); }
+       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