From: Carlos Lopez Date: Wed, 24 Jun 2009 21:01:35 +0000 (+0200) Subject: Use Toggle buttons instead of Buttons for toggle ducks. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aa4b17d5d7bdbe76278ea25df74873007aaca852;p=synfig.git Use Toggle buttons instead of Buttons for toggle ducks. --- diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index caeb737..72ce50a 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -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) ); diff --git a/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp b/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp index b23acde..78aeab5 100644 --- a/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp +++ b/synfig-studio/trunk/src/gtkmm/toggleducksdial.cpp @@ -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; } diff --git a/synfig-studio/trunk/src/gtkmm/toggleducksdial.h b/synfig-studio/trunk/src/gtkmm/toggleducksdial.h index 510806f..d2e50f2 100644 --- a/synfig-studio/trunk/src/gtkmm/toggleducksdial.h +++ b/synfig-studio/trunk/src/gtkmm/toggleducksdial.h @@ -32,7 +32,7 @@ #include #include -#include +#include #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 signal_ducks_position() { return ducks_position->signal_clicked(); } - Glib::SignalProxy0 signal_ducks_vertex() { return ducks_vertex->signal_clicked(); } - Glib::SignalProxy0 signal_ducks_tangent() { return ducks_tangent->signal_clicked(); } - Glib::SignalProxy0 signal_ducks_radius() { return ducks_radius->signal_clicked(); } - Glib::SignalProxy0 signal_ducks_width() { return ducks_width->signal_clicked(); } - Glib::SignalProxy0 signal_ducks_angle() { return ducks_angle->signal_clicked(); } + 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(); } + Glib::SignalProxy0 signal_ducks_radius() { return ducks_radius-> signal_toggled(); } + 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