From: dooglus Date: Wed, 6 Feb 2008 23:45:10 +0000 (+0000) Subject: Set minimum and maximum zoom levels for the timescroller. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=512dc35bea5b0ccdf5a7aeeddaef6c953e78d784;p=synfig.git Set minimum and maximum zoom levels for the timescroller. git-svn-id: http://svn.voria.com/code@1613 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 2f1a372..d20c6ec 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -2444,7 +2444,12 @@ CanvasView::on_time_changed() void CanvasView::time_zoom_in() { + float frame_rate = get_canvas()->rend_desc().get_frame_rate(); + Time min_page_size = 2/frame_rate; + time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()*0.75); + if (time_window_adjustment().get_page_size() < min_page_size) + time_window_adjustment().set_page_size(min_page_size); time_window_adjustment().changed(); refresh_time_window(); @@ -2453,7 +2458,12 @@ CanvasView::time_zoom_in() void CanvasView::time_zoom_out() { + Time length = (get_canvas()->rend_desc().get_time_end() - + get_canvas()->rend_desc().get_time_start()); + time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()/0.75); + if (time_window_adjustment().get_page_size() > length) + time_window_adjustment().set_page_size(length); time_window_adjustment().changed(); refresh_time_window();