From 3cf6557aefb3bc21ff4d8ee301bd5f8187534609 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Apr 29 2012 20:15:25 +0000 Subject: Add a Widget_Time entry on the Time tab for the RendDesc dialog showing the duration of the animation. If the Duration is changed the end time is modified accordingly. Duration is end time less start time plus one frame. --- diff --git a/synfig-studio/src/gui/renddesc.cpp b/synfig-studio/src/gui/renddesc.cpp index 9cd73dd..d5d10c7 100644 --- a/synfig-studio/src/gui/renddesc.cpp +++ b/synfig-studio/src/gui/renddesc.cpp @@ -130,6 +130,8 @@ Widget_RendDesc::refresh() entry_start_time->set_value(rend_desc_.get_time_start()); entry_end_time->set_fps(rend_desc_.get_frame_rate()); entry_end_time->set_value(rend_desc_.get_time_end()); + entry_duration->set_fps(rend_desc_.get_frame_rate()); + entry_duration->set_value(rend_desc_.get_duration()); adjustment_fps.set_value(rend_desc_.get_frame_rate()); adjustment_span.set_value(rend_desc_.get_span()); @@ -264,27 +266,16 @@ Widget_RendDesc::on_end_time_changed() signal_changed()(); } -/* -void -Widget_RendDesc::on_start_frame_changed() -{ - if(update_lock)return; - UpdateLock lock(update_lock); - rend_desc_.set_frame_start((int)(adjustment_start_frame.get_value()+0.5)); - refresh(); - signal_changed()(); -} void -Widget_RendDesc::on_end_frame_changed() +Widget_RendDesc::on_duration_changed() { if(update_lock)return; UpdateLock lock(update_lock); - rend_desc_.set_frame_end((int)(adjustment_end_frame.get_value()+0.5)); + rend_desc_.set_duration(entry_duration->get_value()); refresh(); signal_changed()(); } -*/ void Widget_RendDesc::on_fps_changed() @@ -340,27 +331,12 @@ void Widget_RendDesc::disable_time_section() { time_frame->set_sensitive(false); - -/* - Gtk::Table::TableList &list=time_table->children(); - Gtk::Table::TableList::iterator iter; - for(iter=list.begin();iter!=list.end();iter++) - iter->get_widget()->set_sensitive(false); -*/ } void Widget_RendDesc::enable_time_section() { time_frame->set_sensitive(true); - -/* - Gtk::Table::TableList &list=time_table->children(); - Gtk::Table::TableList::iterator iter; - for(iter=list.begin();iter!=list.end();iter++) - iter->get_widget()->set_sensitive(true); - -*/ } void @@ -385,8 +361,7 @@ Widget_RendDesc::create_widgets() entry_fps=manage(new Gtk::SpinButton(adjustment_fps,1,5)); entry_start_time=manage(new Widget_Time()); entry_end_time=manage(new Widget_Time()); - //entry_start_frame=manage(new Gtk::SpinButton(adjustment_start_frame,1,0)); - //entry_end_frame=manage(new Gtk::SpinButton(adjustment_end_frame,1,0)); + entry_duration=manage(new Widget_Time()); entry_focus=manage(new Widget_Vector()); toggle_px_aspect=manage(new Gtk::CheckButton(_("_Pixel Aspect"), true)); toggle_px_aspect->set_alignment(0, 0.5); @@ -419,8 +394,7 @@ Widget_RendDesc::connect_signals() entry_fps->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_fps_changed)); entry_start_time->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_start_time_changed)); entry_end_time->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_end_time_changed)); - //entry_start_frame->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_start_frame_changed)); - //entry_end_frame->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_end_frame_changed)); + entry_duration->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_duration_changed)); entry_focus->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_RendDesc::on_focus_changed)); toggle_px_aspect->signal_toggled().connect(sigc::mem_fun(*this, &studio::Widget_RendDesc::on_lock_changed)); toggle_px_width->signal_toggled().connect(sigc::mem_fun(*this, &studio::Widget_RendDesc::on_lock_changed)); @@ -559,6 +533,11 @@ Widget_RendDesc::create_time_tab() timeFrameTable->attach(*timeEndLabel, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); timeFrameTable->attach(*entry_end_time, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + Gtk::Label *timeDurationLabel = manage(new Gtk::Label(_("_Duration"), 0, 0.5, true)); + timeDurationLabel->set_mnemonic_widget(*entry_duration); + timeFrameTable->attach(*timeDurationLabel, 0, 1, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + timeFrameTable->attach(*entry_duration, 1, 2, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); + paddedPanel->show_all(); return paddedPanel; } @@ -615,7 +594,3 @@ Widget_RendDesc::create_other_tab() paddedPanel->show_all(); return paddedPanel; } - -/* - * vim:ts=4:sw=4 - */ diff --git a/synfig-studio/src/gui/renddesc.h b/synfig-studio/src/gui/renddesc.h index 724ddac..c0726fd 100644 --- a/synfig-studio/src/gui/renddesc.h +++ b/synfig-studio/src/gui/renddesc.h @@ -59,10 +59,6 @@ class Widget_RendDesc : public Gtk::Notebook Gtk::Adjustment adjustment_phy_width; Gtk::Adjustment adjustment_phy_height; Gtk::Adjustment adjustment_fps; - //Gtk::Adjustment adjustment_start_time; - //Gtk::Adjustment adjustment_end_time; - //Gtk::Adjustment adjustment_start_frame; - //Gtk::Adjustment adjustment_end_frame; Gtk::Adjustment adjustment_span; Gtk::SpinButton *entry_width; @@ -72,10 +68,6 @@ class Widget_RendDesc : public Gtk::Notebook Gtk::SpinButton *entry_phy_width; Gtk::SpinButton *entry_phy_height; Gtk::SpinButton *entry_fps; -// Gtk::SpinButton *entry_start_time; -// Gtk::SpinButton *entry_end_time; -// Gtk::SpinButton *entry_start_frame; -// Gtk::SpinButton *entry_end_frame; Gtk::SpinButton *entry_span; Gtk::CheckButton *toggle_px_aspect; @@ -87,7 +79,6 @@ class Widget_RendDesc : public Gtk::Notebook Gtk::CheckButton *toggle_im_height; Gtk::CheckButton *toggle_im_span; - /* Gtk::Table *time_table; */ Gtk::Frame *time_frame; Widget_Vector *entry_tl; @@ -97,6 +88,7 @@ class Widget_RendDesc : public Gtk::Notebook Widget_Time *entry_start_time; Widget_Time *entry_end_time; + Widget_Time *entry_duration; mutable int update_lock; @@ -141,8 +133,7 @@ private: void on_fps_changed(); void on_start_time_changed(); void on_end_time_changed(); - //void on_start_frame_changed(); - //void on_end_frame_changed(); + void on_duration_changed(); void on_lock_changed(); void on_focus_changed(); void on_span_changed();