X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcanvasview.cpp;h=c7db107f66c7de9b9b6b5812dede9a681edfdc77;hb=b11817a7154a704ce068400f22e7894e2e362ae0;hp=44c8340729cbd7a0392d23492792b59cfa8ad9ed;hpb=1e706e54c01cd6baae01b1199c8997c48345ed8c;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 44c8340..c7db107 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 @@ -946,11 +946,11 @@ CanvasView::create_time_bar() { Gtk::Image *icon; + //Setup the Time Slider and the Time window scroll Gtk::HScrollbar *time_window_scroll = manage(new class Gtk::HScrollbar(time_window_adjustment())); //Gtk::HScrollbar *time_scroll = manage(new class Gtk::HScrollbar(time_adjustment())); //TIME BAR TEMPORARY POSITION //Widget_Timeslider *time_scroll = manage(new Widget_Timeslider); - timeslider->show(); timeslider->set_time_adjustment(&time_adjustment()); timeslider->set_bounds_adjustment(&time_window_adjustment()); //layout_table->attach(*timeslider, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); @@ -959,21 +959,19 @@ 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)); //time_scroll->set_update_policy(Gtk::UPDATE_DISCONTINUOUS); - NORMAL_BUTTON(animatebutton,"gtk-yes",_("Animate")); + //Setup the Animation Mode Button and the Keyframe Lock button + 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 + //Setup the audio display disp_audio->set_size_request(-1,32); //disp_audio->show(); disp_audio->set_time_adjustment(&time_adjustment()); disp_audio->signal_start_scrubbing().connect( @@ -985,14 +983,28 @@ CanvasView::create_time_bar() disp_audio->signal_stop_scrubbing().connect( sigc::mem_fun(*audio,&AudioContainer::stop_scrubbing) ); + //Setup the current time widget + current_time_widget=manage(new Widget_Time); + current_time_widget->set_value(get_time()); + current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate()); + 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(); - FrameDial *framedial = manage(new class FrameDial()); + //Setup the FrameDial widget + 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) ); @@ -1001,18 +1013,57 @@ CanvasView::create_time_bar() ); framedial->show(); - Gtk::Table *table = manage(new class Gtk::Table(4, 3, false)); - timebar = table; + //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(); + + // Setup the ToggleDuckDial widget + toggleducksdial = Gtk::manage(new class ToggleDucksDial()); + + 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(); + + timebar = manage(new class Gtk::Table(5, 4, false)); + + //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); - table->attach(*manage(disp_audio), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - table->attach(*framedial, 0, 1, 1, 2,Gtk::SHRINK, Gtk::SHRINK); - table->attach(*timeslider, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - table->attach(*time_window_scroll, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - table->attach(*animatebutton, 2, 3, 0, 3, Gtk::SHRINK, Gtk::SHRINK); - table->attach(*keyframebutton, 3, 4, 0, 3, Gtk::SHRINK, Gtk::SHRINK); - table->show(); - return table; + timebar->show(); + + return timebar; } Gtk::Widget * @@ -1036,7 +1087,7 @@ CanvasView::create_status_bar() cancel=false; // Create the status bar at the bottom of the window - Gtk::Table *statusbartable= manage(new class Gtk::Table(7, 1, false)); + Gtk::Table *statusbartable= manage(new class Gtk::Table(5, 1, false)); // statusbar = manage(new class Gtk::Statusbar()); // This is already done at construction progressbar =manage(new class Gtk::ProgressBar()); SMALL_BUTTON(stopbutton,"gtk-stop",_("Stop")); @@ -1048,18 +1099,10 @@ CanvasView::create_status_bar() // statusbartable->attach(*lowerbutton, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); // statusbartable->attach(*raisebutton, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - current_time_widget=manage(new Widget_Time); - current_time_widget->set_value(get_time()); - current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate()); - current_time_widget->signal_value_changed().connect( - sigc::mem_fun(*this,&CanvasView::on_current_time_widget_changed) - ); - - statusbartable->attach(*current_time_widget, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - statusbartable->attach(*statusbar, 3, 4, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - statusbartable->attach(*progressbar, 4, 5, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 0, 0); - statusbartable->attach(*refreshbutton, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - statusbartable->attach(*stopbutton, 6, 7, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + statusbartable->attach(*statusbar, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + statusbartable->attach(*progressbar, 2, 3, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 0, 0); + statusbartable->attach(*refreshbutton, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); + statusbartable->attach(*stopbutton, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); statusbar->set_has_resize_grip(false); statusbar->show(); stopbutton->show(); @@ -2563,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")); @@ -2576,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")); @@ -3138,8 +3182,8 @@ CanvasView::play() return; } } + on_play_stop_pressed(); is_playing_=false; - time_adjustment().set_value(endtime); time_adjustment().value_changed(); } @@ -3196,7 +3240,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) @@ -3209,7 +3253,7 @@ void CanvasView::hide_timebar() { timebar->hide(); - current_time_widget->hide(); + //current_time_widget->hide(); // not needed now that belongs to the timebar //keyframe_tab_child->hide(); if(layer_tree) layer_tree->set_show_timetrack(false); @@ -3221,7 +3265,7 @@ void CanvasView::set_sensitive_timebar(bool sensitive) { timebar->set_sensitive(sensitive); - current_time_widget->set_sensitive(sensitive); + //current_time_widget->set_sensitive(sensitive); //not needed now that belongs to timebar //keyframe_tab_child->set_sensitive(sensitive); if(layer_tree) layer_tree->set_sensitive(sensitive); @@ -3903,3 +3947,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(); +}