X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcrossfade_view.cc;h=10792e0a9332abf7abf966577c861077ee01f248;hb=d7deaa21bb78222e25b820c9583942a47dbc8fac;hp=81f5f4173feb00814d686e809b8a21be5180a364;hpb=156f5e4a4258437fa1136dcb78780828de961dbf;p=ardour.git diff --git a/gtk2_ardour/crossfade_view.cc b/gtk2_ardour/crossfade_view.cc index 81f5f4173f..10792e0a93 100644 --- a/gtk2_ardour/crossfade_view.cc +++ b/gtk2_ardour/crossfade_view.cc @@ -25,6 +25,7 @@ #include "canvas-simplerect.h" #include "canvas-curve.h" #include "crossfade_view.h" +#include "global_signals.h" #include "gui_thread.h" #include "rgb_macros.h" #include "audio_time_axis.h" @@ -56,7 +57,8 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent, crossfade (xf), left_view (lview), right_view (rview), - _all_in_view (false) + _all_in_view (false), + _child_height (0) { _valid = true; _visible = true; @@ -108,13 +110,15 @@ CrossfadeView::reset_width_dependent_items (double pixel_width) } void -CrossfadeView::set_height (double h) +CrossfadeView::set_heights (double fade_height, double child_height) { - if (h > TimeAxisView::preset_height (HeightSmall)) { - h -= NAME_HIGHLIGHT_SIZE; + if (child_height > TimeAxisViewItem::NAME_HIGHLIGHT_THRESH) { + fade_height -= NAME_HIGHLIGHT_SIZE; + child_height -= NAME_HIGHLIGHT_SIZE; } - TimeAxisViewItem::set_height (h); + TimeAxisViewItem::set_height (fade_height); + _child_height = child_height; redraw_curves (); } @@ -178,7 +182,7 @@ CrossfadeView::redraw_curves () /* Hence the number of points that we will render */ int32_t const npoints = editor.frame_to_pixel (max_frames - min_frames); - + if (!_visible || !crossfade->active() || npoints < 3) { fade_in->hide(); fade_out->hide(); @@ -202,7 +206,9 @@ CrossfadeView::redraw_curves () for (int i = 0, pci = 0; i < npoints; ++i) { Art::Point &p = (*points)[pci++]; p.set_x (xoff + i + 1); - p.set_y (_height - ((_height - 2) * vec[i])); + + double const ho = crossfade->in()->layer() > crossfade->out()->layer() ? _child_height : _height; + p.set_y (ho - ((_child_height - 2) * vec[i])); } fade_in->property_points() = *points; @@ -212,9 +218,11 @@ CrossfadeView::redraw_curves () for (int i = 0, pci = 0; i < npoints; ++i) { Art::Point &p = (*points)[pci++]; p.set_x (xoff + i + 1); - p.set_y (_height - ((_height - 2) * vec[i])); + + double const ho = crossfade->in()->layer() < crossfade->out()->layer() ? _child_height : _height; + p.set_y (ho - ((_child_height - 2) * vec[i])); } - + fade_out->property_points() = *points; delete [] vec; @@ -252,16 +260,6 @@ CrossfadeView::set_valid (bool yn) _valid = yn; } -AudioRegionView& -CrossfadeView::upper_regionview () const -{ - if (left_view.region()->layer() > right_view.region()->layer()) { - return left_view; - } else { - return right_view; - } -} - void CrossfadeView::show () { @@ -297,7 +295,7 @@ CrossfadeView::horizontal_position_changed () the other case where the horizontal position change will uncover `undrawn' sections). */ - + if (!_all_in_view) { redraw_curves (); }