diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 885af4cd38..c277131618 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -87,7 +87,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView { } - AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, Gdk::Color const & basic_color, bool recording, TimeAxisViewItem::Visibility visibility) : RegionView (parent, tv, r, spu, basic_color, recording, visibility) @@ -554,6 +553,10 @@ AudioRegionView::reset_fade_in_shape () void AudioRegionView::reset_fade_in_shape_width (framecnt_t width) { + if (dragging()) { + return; + } + if (audio_region()->fade_in_is_xfade()) { fade_in_handle->hide (); fade_in_shape->hide (); @@ -655,6 +658,10 @@ AudioRegionView::reset_fade_out_shape () void AudioRegionView::reset_fade_out_shape_width (framecnt_t width) { + if (dragging()) { + return; + } + if (audio_region()->fade_out_is_xfade()) { fade_out_handle->hide (); fade_out_shape->hide (); @@ -1510,7 +1517,6 @@ void AudioRegionView::thaw_after_trim () { RegionView::thaw_after_trim (); - unhide_envelope (); } @@ -1518,6 +1524,8 @@ void AudioRegionView::redraw_start_xfade () { boost::shared_ptr ar (audio_region()); + + cerr << ":RSX\n"; if (!ar->fade_in() || ar->fade_in()->empty()) { return; @@ -1661,3 +1669,40 @@ AudioRegionView::redraw_end_xfade () delete points; } +void +AudioRegionView::drag_start () +{ + TimeAxisViewItem::drag_start (); + + if (start_xfade_in) { + start_xfade_in->hide(); + } + if (start_xfade_out) { + start_xfade_out->hide(); + } + if (end_xfade_in) { + end_xfade_in->hide(); + } + if (end_xfade_out) { + end_xfade_out->hide(); + } +} + +void +AudioRegionView::drag_end () +{ + TimeAxisViewItem::drag_end (); + + if (start_xfade_in) { + start_xfade_in->show(); + } + if (start_xfade_out) { + start_xfade_out->show(); + } + if (end_xfade_in) { + end_xfade_in->show(); + } + if (end_xfade_out) { + end_xfade_out->show(); + } +} diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 53070c85d3..1b55a02e3c 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -117,6 +117,9 @@ class AudioRegionView : public RegionView void thaw_after_trim (); + void drag_start (); + void drag_end (); + protected: /* this constructor allows derived types @@ -191,7 +194,6 @@ class AudioRegionView : public RegionView void redraw_end_xfade (); private: - void setup_fade_handle_positions (); /** A ScopedConnection for each PeaksReady callback (one per channel). Each member diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 7d10d0969c..66bb09980f 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -663,7 +663,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) if (first_move) { - rv->get_time_axis_view().hide_dependent_views (*rv); + rv->drag_start (); /* Absolutely no idea why this is necessary, but it is; without it, the region view disappears after the reparent. @@ -698,15 +698,15 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) if (tv->view()->layer_display() == Stacked) { tv->view()->set_layer_display (Expanded); } - + /* We're only allowed to go -ve in layer on Expanded views */ if (tv->view()->layer_display() != Expanded && (i->layer + this_delta_layer) < 0) { this_delta_layer = - i->layer; } - + /* Set height */ rv->set_height (tv->view()->child_height ()); - + /* Update show/hidden status as the region view may have come from a hidden track, or have moved to one. */ @@ -1063,7 +1063,7 @@ RegionMoveDrag::finished_no_copy ( rv->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item()); rv->get_canvas_group()->property_y() = i->initial_y; - rv->get_time_axis_view().reveal_dependent_views (*rv); + rv->drag_end (); /* just change the model */ @@ -1277,7 +1277,7 @@ RegionMotionDrag::aborted (bool) assert (rtv); rv->get_canvas_group()->reparent (*rtv->view()->canvas_item()); rv->get_canvas_group()->property_y() = 0; - rv->get_time_axis_view().reveal_dependent_views (*rv); + rv->drag_end (); rv->fake_set_opaque (false); rv->move (-_total_x_delta, 0); rv->set_height (rtv->view()->child_height ()); @@ -1706,6 +1706,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) if (arv) { arv->temporarily_hide_envelope (); + arv->drag_start (); } boost::shared_ptr pl = rv->region()->playlist(); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 03c50e7ccb..ba69b3b154 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -160,9 +160,6 @@ class TimeAxisView : public virtual AxisView virtual void show_timestretch (framepos_t start, framepos_t end); virtual void hide_timestretch (); - virtual void hide_dependent_views (TimeAxisViewItem&) {} - virtual void reveal_dependent_views (TimeAxisViewItem&) {} - /* editing operations */ virtual void cut_copy_clear (Selection&, Editing::CutCopyOp) {} diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 399672d9a6..0f184c1da7 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -103,6 +103,7 @@ TimeAxisViewItem::TimeAxisViewItem( , _height (1.0) , _recregion (recording) , _automation (automation) + , _dragging (false) { group = new ArdourCanvas::Group (parent); @@ -116,6 +117,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) , trackview (other.trackview) , _recregion (other._recregion) , _automation (other._automation) + , _dragging (other._dragging) { Gdk::Color c; @@ -132,10 +134,8 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) _selected = other._selected; - init ( - other.item_name, other.samples_per_unit, c, other.frame_position, - other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name - ); + init (other.item_name, other.samples_per_unit, c, other.frame_position, + other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name); } void diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index 1dc07c1526..3985b8ffd8 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -78,6 +78,10 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList double get_samples_per_unit(); + virtual void drag_start() { _dragging = true; } + virtual void drag_end() { _dragging = false; } + bool dragging() const { return _dragging; } + virtual void raise () { return; } virtual void raise_to_top () { return; } virtual void lower () { return; } @@ -240,6 +244,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList Visibility visibility; bool _recregion; bool _automation; ///< true if this is an automation region view + bool _dragging; private: