Use toogleducksdial member pointer and do not expose the toggle buttons pointers...
[synfig.git] / synfig-studio / trunk / src / gtkmm / canvasview.cpp
index 0b532cd..c7db107 100644 (file)
@@ -959,7 +959,7 @@ CanvasView::create_time_bar()
        tooltips.set_tip(*timeslider,_("Changes the current time"));
        time_window_scroll->show();
        timeslider->show();
-       time_window_scroll->set_flags(Gtk::CAN_FOCUS);
+       //time_window_scroll->set_flags(Gtk::CAN_FOCUS); // Uncomment this produce bad render of the HScroll
        timeslider->set_flags(Gtk::CAN_FOCUS);
 
        //time_scroll->signal_value_changed().connect(sigc::mem_fun(*work_area, &studio::WorkArea::render_preview_hook));
@@ -1021,23 +1021,49 @@ CanvasView::create_time_bar()
        keyframedial->show();
        keyframebutton=keyframedial->get_lock_button();
 
-       Gtk::Table *table = manage(new class Gtk::Table(5, 3, false));
-       timebar = table;
+       // Setup the ToggleDuckDial widget
+       toggleducksdial = Gtk::manage(new class ToggleDucksDial());
 
-       //Attach widgets to the time bar table
-       table->attach(*manage(disp_audio), 1, 5, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
-       table->attach(*framedial, 0, 1, 2, 3,Gtk::SHRINK, Gtk::SHRINK);
-       table->attach(*current_time_widget, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-       table->attach(*timeslider, 1, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
-       table->attach(*time_window_scroll, 1, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
-       table->attach(*keyframedial, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-       table->attach(*animatebutton, 4, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-       //table->attach(*keyframebutton, 1, 2, 3, 4, Gtk::SHRINK, Gtk::SHRINK);
+       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)
+                       );
+       toggleducksdial->signal_ducks_vertex().connect(
+                       sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_VERTEX)
+                       );
+       toggleducksdial->signal_ducks_tangent().connect(
+                       sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_TANGENT)
+                       );
+       toggleducksdial->signal_ducks_radius().connect(
+                       sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_RADIUS)
+                       );
+       toggleducksdial->signal_ducks_width().connect(
+                       sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_WIDTH)
+                       );
+       toggleducksdial->signal_ducks_angle().connect(
+                       sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_ANGLE)
+                       );
+       toggleducksdial->show();
 
-       table->show();
+       timebar = manage(new class Gtk::Table(5, 4, false));
 
-       return table;
+       //Attach widgets to the timebar
+       timebar->attach(*manage(disp_audio), 1, 5, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+       timebar->attach(*framedial, 0, 1, 2, 3,Gtk::SHRINK, Gtk::SHRINK);
+       timebar->attach(*current_time_widget, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+       timebar->attach(*timeslider, 1, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+       timebar->attach(*time_window_scroll, 1, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+       timebar->attach(*keyframedial, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
+       timebar->attach(*animatebutton, 4, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
+       //timebar->attach(*keyframebutton, 1, 2, 3, 4, Gtk::SHRINK, Gtk::SHRINK);
+       timebar->attach(*toggleducksdial, 0, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+
+
+       timebar->show();
+
+       return timebar;
 }
 
 Gtk::Widget *
@@ -2580,10 +2606,11 @@ void
 CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode)
 {
        // If the animate flag was set in mode...
+       Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon");
        if(mode&synfigapp::MODE_ANIMATE)
        {
                Gtk::Image *icon;
-               icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),Gtk::ICON_SIZE_BUTTON));
+               icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),iconsize));
                animatebutton->remove();
                animatebutton->add(*icon);
                tooltips.set_tip(*animatebutton,_("In Animate Editing Mode"));
@@ -2593,7 +2620,7 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode)
        else
        {
                Gtk::Image *icon;
-               icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),Gtk::ICON_SIZE_BUTTON));
+               icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),iconsize));
                animatebutton->remove();
                animatebutton->add(*icon);
                tooltips.set_tip(*animatebutton,_("Not in Animate Editing Mode"));