13
0

Don't show previously hidden xfades when finishing a region

drag; should fix #4982.


git-svn-id: svn://localhost/ardour2/branches/3.0@12987 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-07-04 21:09:32 +00:00
parent e35a84a32b
commit 392a7fd238
4 changed files with 85 additions and 12 deletions

View File

@ -79,9 +79,11 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
, start_xfade_in (0) , start_xfade_in (0)
, start_xfade_out (0) , start_xfade_out (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false)
, end_xfade_in (0) , end_xfade_in (0)
, end_xfade_out (0) , end_xfade_out (0)
, end_xfade_rect (0) , end_xfade_rect (0)
, _end_xfade_visible (false)
, _amplitude_above_axis(1.0) , _amplitude_above_axis(1.0)
, fade_color(0) , fade_color(0)
{ {
@ -100,9 +102,11 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
, start_xfade_in (0) , start_xfade_in (0)
, start_xfade_out (0) , start_xfade_out (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false)
, end_xfade_in (0) , end_xfade_in (0)
, end_xfade_out (0) , end_xfade_out (0)
, end_xfade_rect (0) , end_xfade_rect (0)
, _end_xfade_visible (false)
, _amplitude_above_axis(1.0) , _amplitude_above_axis(1.0)
, fade_color(0) , fade_color(0)
{ {
@ -119,9 +123,11 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt
, start_xfade_in (0) , start_xfade_in (0)
, start_xfade_out (0) , start_xfade_out (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false)
, end_xfade_in (0) , end_xfade_in (0)
, end_xfade_out (0) , end_xfade_out (0)
, end_xfade_rect (0) , end_xfade_rect (0)
, _end_xfade_visible (false)
, _amplitude_above_axis (other._amplitude_above_axis) , _amplitude_above_axis (other._amplitude_above_axis)
, fade_color(0) , fade_color(0)
{ {
@ -559,6 +565,7 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width)
start_xfade_in->hide (); start_xfade_in->hide ();
start_xfade_out->hide (); start_xfade_out->hide ();
start_xfade_rect->hide (); start_xfade_rect->hide ();
_start_xfade_visible = false;
} }
} }
@ -668,6 +675,7 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width)
end_xfade_in->hide (); end_xfade_in->hide ();
end_xfade_out->hide (); end_xfade_out->hide ();
end_xfade_rect->hide (); end_xfade_rect->hide ();
_end_xfade_visible = false;
} }
} }
@ -1455,6 +1463,7 @@ AudioRegionView::redraw_start_xfade ()
start_xfade_in->hide (); start_xfade_in->hide ();
start_xfade_out->hide (); start_xfade_out->hide ();
start_xfade_rect->hide (); start_xfade_rect->hide ();
_start_xfade_visible = false;
} }
return; return;
} }
@ -1544,6 +1553,8 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
start_xfade_out->show (); start_xfade_out->show ();
start_xfade_out->raise_to_top (); start_xfade_out->raise_to_top ();
_start_xfade_visible = true;
delete points; delete points;
} }
@ -1561,6 +1572,7 @@ AudioRegionView::redraw_end_xfade ()
end_xfade_in->hide (); end_xfade_in->hide ();
end_xfade_out->hide (); end_xfade_out->hide ();
end_xfade_rect->hide (); end_xfade_rect->hide ();
_end_xfade_visible = false;
} }
return; return;
} }
@ -1652,12 +1664,20 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
end_xfade_out->show (); end_xfade_out->show ();
end_xfade_out->raise_to_top (); end_xfade_out->raise_to_top ();
_end_xfade_visible = true;
delete points; delete points;
} }
void void
AudioRegionView::hide_xfades () AudioRegionView::hide_xfades ()
{
hide_start_xfade ();
hide_end_xfade ();
}
void
AudioRegionView::hide_start_xfade ()
{ {
if (start_xfade_in) { if (start_xfade_in) {
start_xfade_in->hide(); start_xfade_in->hide();
@ -1668,6 +1688,13 @@ AudioRegionView::hide_xfades ()
if (start_xfade_rect) { if (start_xfade_rect) {
start_xfade_rect->hide (); start_xfade_rect->hide ();
} }
_start_xfade_visible = false;
}
void
AudioRegionView::hide_end_xfade ()
{
if (end_xfade_in) { if (end_xfade_in) {
end_xfade_in->hide(); end_xfade_in->hide();
} }
@ -1677,10 +1704,12 @@ AudioRegionView::hide_xfades ()
if (end_xfade_rect) { if (end_xfade_rect) {
end_xfade_rect->hide (); end_xfade_rect->hide ();
} }
_end_xfade_visible = false;
} }
void void
AudioRegionView::show_xfades () AudioRegionView::show_start_xfade ()
{ {
if (start_xfade_in) { if (start_xfade_in) {
start_xfade_in->show(); start_xfade_in->show();
@ -1691,6 +1720,13 @@ AudioRegionView::show_xfades ()
if (start_xfade_rect) { if (start_xfade_rect) {
start_xfade_rect->show (); start_xfade_rect->show ();
} }
_start_xfade_visible = true;
}
void
AudioRegionView::show_end_xfade ()
{
if (end_xfade_in) { if (end_xfade_in) {
end_xfade_in->show(); end_xfade_in->show();
} }
@ -1700,6 +1736,15 @@ AudioRegionView::show_xfades ()
if (end_xfade_rect) { if (end_xfade_rect) {
end_xfade_rect->show (); end_xfade_rect->show ();
} }
_end_xfade_visible = true;
}
void
AudioRegionView::show_xfades ()
{
show_start_xfade ();
show_end_xfade ();
} }
void void
@ -1722,11 +1767,16 @@ AudioRegionView::drag_end ()
{ {
TimeAxisViewItem::drag_end (); TimeAxisViewItem::drag_end ();
for (list<AudioRegionView*>::iterator i = _hidden_xfades.begin(); i != _hidden_xfades.end(); ++i) { for (list<AudioRegionView*>::iterator i = _hidden_xfades.first.begin(); i != _hidden_xfades.first.end(); ++i) {
(*i)->show_xfades (); (*i)->show_start_xfade ();
} }
_hidden_xfades.clear (); for (list<AudioRegionView*>::iterator i = _hidden_xfades.second.begin(); i != _hidden_xfades.second.end(); ++i) {
(*i)->show_end_xfade ();
}
_hidden_xfades.first.clear ();
_hidden_xfades.second.clear ();
} }
void void

View File

@ -119,7 +119,19 @@ class AudioRegionView : public RegionView
void redraw_end_xfade (); void redraw_end_xfade ();
void hide_xfades (); void hide_xfades ();
void hide_start_xfade ();
void hide_end_xfade ();
void show_xfades (); void show_xfades ();
void show_start_xfade ();
void show_end_xfade ();
bool start_xfade_visible () const {
return _start_xfade_visible;
}
bool end_xfade_visible () const {
return _end_xfade_visible;
}
protected: protected:
@ -149,10 +161,12 @@ class AudioRegionView : public RegionView
ArdourCanvas::Line *start_xfade_in; ArdourCanvas::Line *start_xfade_in;
ArdourCanvas::Line *start_xfade_out; ArdourCanvas::Line *start_xfade_out;
ArdourCanvas::SimpleRect* start_xfade_rect; ArdourCanvas::SimpleRect* start_xfade_rect;
bool _start_xfade_visible;
ArdourCanvas::Line *end_xfade_in; ArdourCanvas::Line *end_xfade_in;
ArdourCanvas::Line *end_xfade_out; ArdourCanvas::Line *end_xfade_out;
ArdourCanvas::SimpleRect* end_xfade_rect; ArdourCanvas::SimpleRect* end_xfade_rect;
bool _end_xfade_visible;
boost::shared_ptr<AudioRegionGainLine> gain_line; boost::shared_ptr<AudioRegionGainLine> gain_line;
@ -203,8 +217,10 @@ private:
*/ */
std::vector<PBD::ScopedConnection*> _data_ready_connections; std::vector<PBD::ScopedConnection*> _data_ready_connections;
/** RegionViews that we hid the xfades for at the start of the current drag */ /** RegionViews that we hid the xfades for at the start of the current drag;
std::list<AudioRegionView*> _hidden_xfades; * first list is for start xfades, second list is for end xfades.
*/
std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
}; };
#endif /* __gtk_ardour_audio_region_view_h__ */ #endif /* __gtk_ardour_audio_region_view_h__ */

View File

@ -493,12 +493,14 @@ AudioStreamView::hide_all_fades ()
} }
/** Hide xfades for regions that overlap ar. /** Hide xfades for regions that overlap ar.
* @return AudioRegionViews that xfades were hidden for. * @return Pair of lists; first is the AudioRegionViews that start xfades were hidden for,
* second is the AudioRegionViews that end xfades were hidden for.
*/ */
list<AudioRegionView*> pair<list<AudioRegionView*>, list<AudioRegionView*> >
AudioStreamView::hide_xfades_with (boost::shared_ptr<AudioRegion> ar) AudioStreamView::hide_xfades_with (boost::shared_ptr<AudioRegion> ar)
{ {
list<AudioRegionView*> hidden; list<AudioRegionView*> start_hidden;
list<AudioRegionView*> end_hidden;
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
@ -507,14 +509,19 @@ AudioStreamView::hide_xfades_with (boost::shared_ptr<AudioRegion> ar)
case Evoral::OverlapNone: case Evoral::OverlapNone:
break; break;
default: default:
if (arv->start_xfade_visible ()) {
start_hidden.push_back (arv);
}
if (arv->end_xfade_visible ()) {
end_hidden.push_back (arv);
}
arv->hide_xfades (); arv->hide_xfades ();
hidden.push_back (arv);
break; break;
} }
} }
} }
return hidden; return make_pair (start_hidden, end_hidden);
} }
void void

View File

@ -59,7 +59,7 @@ class AudioStreamView : public StreamView
void show_all_fades (); void show_all_fades ();
void hide_all_fades (); void hide_all_fades ();
std::list<AudioRegionView*> hide_xfades_with (boost::shared_ptr<ARDOUR::AudioRegion> ar); std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > hide_xfades_with (boost::shared_ptr<ARDOUR::AudioRegion> ar);
RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool); RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool);