diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index bf2a39a791..edfd481636 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -45,6 +45,7 @@ #include "waveview.h" #include "public_editor.h" #include "audio_region_editor.h" +#include "audio_streamview.h" #include "region_gain_line.h" #include "control_point.h" #include "ghostregion.h" @@ -307,6 +308,7 @@ AudioRegionView::fade_out_changed () { reset_fade_out_shape (); } + void AudioRegionView::fade_in_active_changed () { @@ -1524,6 +1526,7 @@ AudioRegionView::thaw_after_trim () { RegionView::thaw_after_trim (); unhide_envelope (); + drag_end (); } void @@ -1535,6 +1538,15 @@ AudioRegionView::redraw_start_xfade () return; } + if (!ar->fade_in_is_xfade()) { + if (start_xfade_in) { + start_xfade_in->hide (); + start_xfade_out->hide (); + start_xfade_rect->hide (); + } + return; + } + redraw_start_xfade_to (ar, ar->fade_in()->back()->when); } @@ -1631,6 +1643,15 @@ AudioRegionView::redraw_end_xfade () return; } + if (!ar->fade_out_is_xfade()) { + if (end_xfade_in) { + end_xfade_in->hide (); + end_xfade_out->hide (); + end_xfade_rect->hide (); + } + return; + } + redraw_end_xfade_to (ar, ar->fade_out()->back()->when); } @@ -1722,10 +1743,8 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn } void -AudioRegionView::drag_start () +AudioRegionView::hide_xfades () { - TimeAxisViewItem::drag_start (); - if (start_xfade_in) { start_xfade_in->hide(); } @@ -1747,10 +1766,8 @@ AudioRegionView::drag_start () } void -AudioRegionView::drag_end () +AudioRegionView::show_xfades () { - TimeAxisViewItem::drag_end (); - if (start_xfade_in) { start_xfade_in->show(); } @@ -1771,3 +1788,25 @@ AudioRegionView::drag_end () } } +void +AudioRegionView::drag_start () +{ + TimeAxisViewItem::drag_start (); + AudioTimeAxisView* atav = dynamic_cast (&trackview); + + if (atav) { + AudioStreamView* av = atav->audio_view(); + if (av) { + /* this will hide our xfades too */ + av->hide_xfades_with (audio_region()); + } + } +} + +void +AudioRegionView::drag_end () +{ + TimeAxisViewItem::drag_end (); + /* fades will be redrawn if they changed */ +} + diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 5c4769d412..233b53475b 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -124,6 +124,9 @@ class AudioRegionView : public RegionView void redraw_end_xfade_to (boost::shared_ptr, framecnt_t); void redraw_start_xfade (); void redraw_end_xfade (); + + void hide_xfades (); + void show_xfades (); protected: diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index e9ee8fe647..be8601170f 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -532,6 +532,23 @@ AudioStreamView::hide_all_fades () } } +void +AudioStreamView::hide_xfades_with (boost::shared_ptr ar) +{ + for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { + AudioRegionView* const arv = dynamic_cast(*i); + if (arv) { + switch (arv->region()->coverage (ar->position(), ar->last_frame())) { + case Evoral::OverlapNone: + break; + default: + arv->hide_xfades (); + break; + } + } + } +} + void AudioStreamView::color_handler () { diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index 4812903a35..cb3175798e 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -61,6 +61,8 @@ class AudioStreamView : public StreamView void show_all_fades (); void hide_all_fades (); + void hide_xfades_with (boost::shared_ptr ar); + RegionView* create_region_view (boost::shared_ptr, bool, bool); private: