X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcanvasview.cpp;h=7c3aa0a43ebf81d4bd73826d6faf10802209d956;hb=f2a5ca9cf3c770c4eb236d0c5c1ae7ecab242787;hp=23407b081778a500e1f72dcc3ae7bd9bc138f6e1;hpb=15a3beef527c4f114f9d42836517accc8bd4db7a;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 23407b0..7c3aa0a 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -99,7 +99,7 @@ #include "preview.h" #include "audiocontainer.h" #include "widget_timeslider.h" -#include "framedial.h" +#include "keyframedial.h" #include #include @@ -967,14 +967,11 @@ CanvasView::create_time_bar() //time_scroll->set_update_policy(Gtk::UPDATE_DISCONTINUOUS); //Setup the Animation Mode Button and the Keyframe Lock button - NORMAL_BUTTON(animatebutton,"gtk-yes",_("Animate")); + Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); + SMALL_BUTTON(animatebutton,"gtk-yes",_("Animate")); animatebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_animate_button_pressed)); animatebutton->show(); - NORMAL_BUTTON(keyframebutton,"synfig-keyframe_lock_all",_("All Keyframes Locked")); - keyframebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed)); - keyframebutton->show(); - //Setup the audio display disp_audio->set_size_request(-1,32); //disp_audio->show(); disp_audio->set_time_adjustment(&time_adjustment()); @@ -994,15 +991,21 @@ CanvasView::create_time_bar() current_time_widget->signal_value_changed().connect( sigc::mem_fun(*this,&CanvasView::on_current_time_widget_changed) ); + current_time_widget->set_size_request(0,-1); // request horizontal shrink + tooltips.set_tip(*current_time_widget,_("Current time")); + current_time_widget->show(); //Setup the FrameDial widget - FrameDial *framedial = manage(new class FrameDial()); + framedial = manage(new class FrameDial()); framedial->signal_seek_begin().connect( sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time), Time::begin()) ); framedial->signal_seek_prev_frame().connect( sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), -1) ); + framedial->signal_play_stop().connect( + sigc::mem_fun(*this, &studio::CanvasView::on_play_stop_pressed) + ); framedial->signal_seek_next_frame().connect( sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), 1) ); @@ -1011,17 +1014,26 @@ CanvasView::create_time_bar() ); framedial->show(); - Gtk::Table *table = manage(new class Gtk::Table(4, 4, false)); + //Setup the KeyFrameDial widget + KeyFrameDial *keyframedial = Gtk::manage(new class KeyFrameDial()); + keyframedial->signal_seek_prev_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)); + keyframedial->signal_seek_next_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)); + keyframedial->signal_lock_keyframe().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed)); + keyframedial->show(); + keyframebutton=keyframedial->get_lock_button(); + + Gtk::Table *table = manage(new class Gtk::Table(5, 3, false)); timebar = table; //Attach widgets to the time bar table - table->attach(*manage(disp_audio), 1, 4, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); + 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, 4, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - table->attach(*time_window_scroll, 1, 4, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - table->attach(*animatebutton, 2, 3, 3, 4, Gtk::FILL, Gtk::SHRINK); - table->attach(*keyframebutton, 3, 4, 3, 4, Gtk::FILL, Gtk::SHRINK); + 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); table->show(); @@ -3144,8 +3156,8 @@ CanvasView::play() return; } } + on_play_stop_pressed(); is_playing_=false; - time_adjustment().set_value(endtime); time_adjustment().value_changed(); } @@ -3202,7 +3214,7 @@ void CanvasView::show_timebar() { timebar->show(); - current_time_widget->show(); + //current_time_widget->show(); // not needed now that belongs to the timebar //keyframe_tab_child->show(); if(layer_tree) @@ -3909,3 +3921,30 @@ CanvasView::on_delete_event(GdkEventAny* event __attribute__ ((unused))) return true; } + +//! Modify the play stop button apearence and play stop the animation +void +CanvasView::on_play_stop_pressed() +{ + Gtk::Image *icon; + Gtk::Button *stop_button; + stop_button=framedial->get_play_button(); + bool play_flag; + if(!is_playing()) + { + icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_STOP, Gtk::IconSize::from_name("synfig-small_icon"))); + stop_button->set_relief(Gtk::RELIEF_NORMAL); + play_flag=true; + } + else + { + icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_PLAY, Gtk::IconSize::from_name("synfig-small_icon"))); + stop_button->set_relief(Gtk::RELIEF_NONE); + play_flag=false; + } + stop_button->remove(); + stop_button->add(*icon); + icon->set_padding(0, 0); + icon->show(); + if(play_flag) play(); else stop(); +}