Subdivide the space between labels on the timeslider sensibly. Don't divide a 5...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 6 Feb 2008 18:02:38 +0000 (18:02 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 6 Feb 2008 18:02:38 +0000 (18:02 +0000)
git-svn-id: http://svn.voria.com/code@1610 1f10aa63-cdf2-0310-b900-c93c546f37ac

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

index 9f299c9..7352bd2 100644 (file)
@@ -221,7 +221,6 @@ studio::render_time_point_to_window(
        if(selected)color=color_darken(color,1.3f);
        gc->set_rgb_fg_color(color);
 
-
        switch(tp.get_after())
        {
        case INTERPOLATION_TCB:
@@ -455,9 +454,6 @@ bool Widget_Timeslider::redraw(bool /*doublebuffer*/)
        //normal line/text color
        gc->set_rgb_fg_color(Gdk::Color("#333333"));
 
-       //draw these lines... (always 5 between) maybe 6?
-       const int subdiv = 4;
-
        int ifps = round_to_int(fps);
        if (ifps < 1) ifps = 1;
 
@@ -506,14 +502,15 @@ bool Widget_Timeslider::redraw(bool /*doublebuffer*/)
        if (next == ranges.end()) next--;
 
        if (abs(*next - midrange) < abs(*iter - midrange))
-               scale = *next;
-       else
-               scale = *iter;
+               iter = next;
 
-       //synfig::info("Range found: (l %.2lf,u %.2lf - m %.2lf) -> %.2lf",lowerrange,upperrange,midrange,scale);
-
-       //search around this area to get the right one
+       scale = *iter;
+       if (iter != ranges.begin()) iter--;
+       if (iter != ranges.begin()) iter--;
+       if (iter != ranges.begin()) iter--;
 
+       // subdivide into this many tick marks (8 or less)
+       const int subdiv = round_to_int(scale / *iter);
 
        //get first valid line and its position in pixel space
        double time = 0;
@@ -596,7 +593,6 @@ bool Widget_Timeslider::on_motion_notify_event(GdkEventMotion* event) //for drag
                double  start = adj_timescale->get_lower(),
                                end = adj_timescale->get_upper();
 
-
                if(dragscroll)
                {
                        if(event->time-last_event_time<30)