Reintroduce crossfade views for tracks in stacked region mode.

git-svn-id: svn://localhost/ardour2/branches/3.0@5594 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-08-26 01:49:08 +00:00
parent ae6dbb836c
commit 8934ff7867
4 changed files with 45 additions and 31 deletions

View File

@ -313,7 +313,7 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
CrossfadeViewList::iterator i = crossfade_views.find (crossfade); CrossfadeViewList::iterator i = crossfade_views.find (crossfade);
if (i != crossfade_views.end()) { if (i != crossfade_views.end()) {
if (!crossfades_visible || _layer_display == Stacked) { if (!crossfades_visible) {
i->second->hide(); i->second->hide();
} else { } else {
i->second->show (); i->second->show ();
@ -344,9 +344,11 @@ AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
cv->set_valid (true); cv->set_valid (true);
crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade)); crossfade->Invalidated.connect (mem_fun (*this, &AudioStreamView::remove_crossfade));
crossfade_views[cv->crossfade] = cv; crossfade_views[cv->crossfade] = cv;
if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible || _layer_display == Stacked) { if (!_trackview.session().config.get_xfades_visible() || !crossfades_visible) {
cv->hide (); cv->hide ();
} }
update_content_height (cv);
} }
void void
@ -380,7 +382,7 @@ AudioStreamView::redisplay_diskstream ()
// Flag crossfade views as invalid // Flag crossfade views as invalid
for (xi = crossfade_views.begin(); xi != crossfade_views.end(); ++xi) { for (xi = crossfade_views.begin(); xi != crossfade_views.end(); ++xi) {
xi->second->set_valid (false); xi->second->set_valid (false);
if (xi->second->visible() && _layer_display != Stacked) { if (xi->second->visible()) {
xi->second->show (); xi->second->show ();
} }
} }
@ -771,7 +773,7 @@ void
AudioStreamView::reveal_xfades_involving (AudioRegionView& rv) AudioStreamView::reveal_xfades_involving (AudioRegionView& rv)
{ {
for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
if (i->second->crossfade->involves (rv.audio_region()) && i->second->visible() && _layer_display != Stacked) { if (i->second->crossfade->involves (rv.audio_region()) && i->second->visible()) {
i->second->show (); i->second->show ();
} }
} }
@ -799,14 +801,35 @@ void
AudioStreamView::update_contents_height () AudioStreamView::update_contents_height ()
{ {
StreamView::update_contents_height (); StreamView::update_contents_height ();
for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) { for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
if (_layer_display == Overlaid) { update_content_height (i->second);
i->second->show (); }
i->second->set_height (height); }
} else {
i->second->hide (); void
} AudioStreamView::update_content_height (CrossfadeView* cv)
{
cv->show ();
if (_layer_display == Overlaid) {
cv->set_y (0);
cv->set_height (height);
} else {
layer_t const inl = cv->crossfade->in()->layer ();
layer_t const outl = cv->crossfade->out()->layer ();
layer_t const high = max (inl, outl);
layer_t const low = min (inl, outl);
const double h = child_height ();
cv->set_y ((_layers - high - 1) * h);
cv->set_height ((high - low + 1) * h);
} }
} }

View File

@ -100,6 +100,7 @@ class AudioStreamView : public StreamView
void color_handler (); void color_handler ();
void update_contents_height (); void update_contents_height ();
void update_content_height (CrossfadeView *);
void parameter_changed (std::string const &); void parameter_changed (std::string const &);
void set_waveform_shape (ARDOUR::WaveformShape); void set_waveform_shape (ARDOUR::WaveformShape);

View File

@ -109,12 +109,16 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
void void
CrossfadeView::set_height (double height) CrossfadeView::set_height (double height)
{ {
double h = 0;
if (height <= TimeAxisView::hSmaller) { if (height <= TimeAxisView::hSmaller) {
TimeAxisViewItem::set_height (height - 3); h = height - 3;
} else { } else {
TimeAxisViewItem::set_height (height - NAME_HIGHLIGHT_SIZE - 3 ); h = height - NAME_HIGHLIGHT_SIZE - 3;
} }
TimeAxisViewItem::set_height (h);
_height = h;
redraw_curves (); redraw_curves ();
} }
@ -150,7 +154,6 @@ CrossfadeView::redraw_curves ()
Points* points; Points* points;
int32_t npoints; int32_t npoints;
float* vec; float* vec;
double h;
if (!crossfade->following_overlap()) { if (!crossfade->following_overlap()) {
/* curves should not be visible */ /* curves should not be visible */
@ -159,20 +162,7 @@ CrossfadeView::redraw_curves ()
return; return;
} }
/* if (_height < 0) {
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.
*/
double tav_height = get_time_axis_view().current_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) {
/* no space allocated yet */ /* no space allocated yet */
return; return;
} }
@ -197,7 +187,7 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++]; Art::Point &p = (*points)[pci++];
p.set_x(i); p.set_x(i);
p.set_y(2.0 + h - (h * vec[i])); p.set_y(2.0 + _height - (_height * vec[i]));
} }
fade_in->property_points() = *points; fade_in->property_points() = *points;
@ -205,7 +195,7 @@ CrossfadeView::redraw_curves ()
for (int i = 0, pci = 0; i < npoints; ++i) { for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++]; Art::Point &p = (*points)[pci++];
p.set_x(i); p.set_x(i);
p.set_y(2.0 + h - (h * vec[i])); p.set_y(2.0 + _height - (_height * vec[i]));
} }
fade_out->property_points() = *points; fade_out->property_points() = *points;

View File

@ -77,7 +77,7 @@ struct CrossfadeView : public TimeAxisViewItem
void crossfade_changed (ARDOUR::Change); void crossfade_changed (ARDOUR::Change);
void active_changed (); void active_changed ();
void redraw_curves (); void redraw_curves ();
void color_handler (); void color_handler ();
}; };