a number of tweaks to make xfade GUI stuff better in several different ways, notable during region trims and region drags

git-svn-id: svn://localhost/ardour2/branches/3.0@12240 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-10 13:48:23 +00:00
parent 68e69a8b29
commit 916202ea64
4 changed files with 67 additions and 6 deletions

View File

@ -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<AudioRegion> 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<AudioTimeAxisView*> (&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 */
}

View File

@ -124,6 +124,9 @@ class AudioRegionView : public RegionView
void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
void redraw_start_xfade ();
void redraw_end_xfade ();
void hide_xfades ();
void show_xfades ();
protected:

View File

@ -532,6 +532,23 @@ AudioStreamView::hide_all_fades ()
}
}
void
AudioStreamView::hide_xfades_with (boost::shared_ptr<AudioRegion> ar)
{
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*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 ()
{

View File

@ -61,6 +61,8 @@ class AudioStreamView : public StreamView
void show_all_fades ();
void hide_all_fades ();
void hide_xfades_with (boost::shared_ptr<ARDOUR::AudioRegion> ar);
RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool);
private: