move zoom controls down to lower left
[ardour.git] / gtk2_ardour / crossfade_view.cc
index 087af25e7317e9a59e172eaabe4eb7c4a8ca819a..3c3ef4ff91315b910d098a310e9546d6c2313532 100644 (file)
@@ -52,7 +52,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
                              
 
        : TimeAxisViewItem ("xfade" /*xf.name()*/, *parent, tv, spu, basic_color, xf.position(), 
-                           xf.overlap_length(), TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)),
+                           xf.length(), TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)),
          crossfade (xf),
          left_view (lview),
          right_view (rview)
@@ -89,7 +89,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
 
 CrossfadeView::~CrossfadeView ()
 {
-        GoingAway (this) ; /* EMIT_SIGNAL */
+       GoingAway (this) ; /* EMIT_SIGNAL */
 }
 
 void
@@ -108,8 +108,8 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
 void
 CrossfadeView::set_height (double height)
 {
-       if (height == TimeAxisView::Smaller ||
-               height == TimeAxisView::Small)
+       if (height == TimeAxisView::hSmaller ||
+           height == TimeAxisView::hSmall)
                TimeAxisViewItem::set_height (height - 3 );
        else
                TimeAxisViewItem::set_height (height - NAME_HIGHLIGHT_SIZE - 3 );
@@ -124,7 +124,11 @@ CrossfadeView::crossfade_changed (Change what_changed)
 
        if (what_changed & BoundsChanged) {
                set_position (crossfade.position(), this);
-               set_duration (crossfade.overlap_length(), this);
+               set_duration (crossfade.length(), this);
+               need_redraw_curves = true;
+       }
+
+       if (what_changed & Crossfade::FollowOverlapChanged) {
                need_redraw_curves = true;
        }
        
@@ -142,21 +146,25 @@ CrossfadeView::redraw_curves ()
        Points* points; 
        int32_t npoints;
        float* vec;
-       
        double h;
 
+       if (!crossfade.following_overlap()) {
+               /* curves should not be visible */
+               fade_in->hide ();
+               fade_out->hide ();
+               return;
+       }
+
        /*
         At "height - 3.0" the bottom of the crossfade touches the name highlight or the bottom of the track (if the
         track is either Small or Smaller.
         */
-       switch(get_time_axis_view().height) {
-               case TimeAxisView::Smaller:
-               case TimeAxisView::Small:
-                       h = get_time_axis_view().height - 3.0;
-                       break;
-
-               default:
-                       h = get_time_axis_view().height - NAME_HIGHLIGHT_SIZE - 3.0;
+       double tav_height = get_time_axis_view().height;
+       if (tav_height == TimeAxisView::hSmaller ||
+           tav_height == TimeAxisView::hSmall) {
+               h = tav_height - 3.0;
+       } else {
+               h = tav_height - NAME_HIGHLIGHT_SIZE - 3.0;
        }
 
        if (h < 0) {
@@ -227,7 +235,7 @@ CrossfadeView::set_valid (bool yn)
 AudioRegionView&
 CrossfadeView::upper_regionview () const
 {
-       if (left_view.region().layer() > right_view.region().layer()) {
+       if (left_view.region()->layer() > right_view.region()->layer()) {
                return left_view;
        } else {
                return right_view;