From: pabs Date: Wed, 19 Dec 2007 03:07:39 +0000 (+0000) Subject: Allow the use of horizontal scrolling to adjust the current time in timeslider widget... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=75d9450af83a2fc392104c537aab2aed2f3d1142;p=synfig.git Allow the use of horizontal scrolling to adjust the current time in timeslider widgets. Currently it simply scrolls one frame at a time, this should perhaps be changed to something based on the size of the current time window. git-svn-id: http://svn.voria.com/code@1221 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp b/synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp index 4b87f3a..651cbe0 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp @@ -707,7 +707,42 @@ bool Widget_Timeslider::on_scroll_event(GdkEventScroll* event) //for zooming return true; } + + case GDK_SCROLL_RIGHT: + case GDK_SCROLL_LEFT: + { + double t = adj_timescale->get_value(); + double start = adj_timescale->get_lower(); + double end = adj_timescale->get_upper(); + /* + FIXME: be more intelligent about how far to scroll + Perhaps it should be based on the tickmarks? + for e.g. 1/4 of a tick mark per scroll event + Obviously this would need post-rounding to 1/fps + */ + double adj = 1.0/fps; + + if( event->direction == GDK_SCROLL_RIGHT ) + t += adj; + else + t -= adj; + + if( t < start ){ + adj_timescale->set_lower(t); + adj_timescale->set_upper(t+end-start); + } else if( t > end ){ + adj_timescale->set_upper(t); + adj_timescale->set_lower(t-end+start); + } + if(adj_timescale) + { + adj_timescale->set_value(t); + adj_timescale->value_changed(); + } + return true; + } + default: { return false;