Set minimum and maximum zoom levels for the timescroller.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 6 Feb 2008 23:45:10 +0000 (23:45 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 6 Feb 2008 23:45:10 +0000 (23:45 +0000)
git-svn-id: http://svn.voria.com/code@1613 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/canvasview.cpp

index 2f1a372..d20c6ec 100644 (file)
@@ -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();