X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_region_view.cc;h=db5c609e7ce0724bb016af67a008fa9ada4a7e7e;hb=39eec5ac1b4d6c76e064ad7599d0d1efd626b146;hp=492def9ef00a7c2f0142c9e8628659a49bebd33a;hpb=f0536816ab35b5a6fd2f1b77b54e0ae15a5f937b;p=ardour.git diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 492def9ef0..db5c609e7c 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -91,6 +91,8 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView , _end_xfade_visible (false) , _amplitude_above_axis(1.0) , fade_color(0) + , trim_fade_in_drag_active(false) + , trim_fade_out_drag_active(false) { Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context()); } @@ -111,6 +113,8 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView , _end_xfade_visible (false) , _amplitude_above_axis(1.0) , fade_color(0) + , trim_fade_in_drag_active(false) + , trim_fade_out_drag_active(false) { Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context()); } @@ -129,6 +133,8 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt , _end_xfade_visible (false) , _amplitude_above_axis (other._amplitude_above_axis) , fade_color(0) + , trim_fade_in_drag_active(false) + , trim_fade_out_drag_active(false) { Gdk::Color c; int r,g,b,a; @@ -572,6 +578,11 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr ar, f fade_in_trim_handle->set_x1 (handle_size); } + if (fade_in_handle->visible()) { + //see comment for drag_start + entered(false); + } + if (pwidth < 5) { hide_start_xfade(); return; @@ -593,12 +604,10 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr ar, f /* points *MUST* be in anti-clockwise order */ Points points; - Points::size_type npoints; Points::size_type pi; boost::shared_ptr list (audio_region()->fade_in()); Evoral::ControlList::const_iterator x; double length = list->length(); - npoints = list->size(); points.assign (list->size(), Duple()); @@ -653,6 +662,10 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr ar, fade_out_trim_handle->set_x1 (1 + trim_handle_right); } + if (fade_out_handle->visible()) { + //see comment for drag_start + entered(false); + } /* don't show shape if its too small */ if (pwidth < 5) { @@ -676,12 +689,10 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr ar, /* points *MUST* be in anti-clockwise order */ Points points; - Points::size_type npoints; Points::size_type pi; boost::shared_ptr list (audio_region()->fade_out()); Evoral::ControlList::const_iterator x; double length = list->length(); - npoints = list->size(); points.assign (list->size(), Duple()); @@ -1331,12 +1342,22 @@ AudioRegionView::entered (bool internal_editing) fade_out_handle->raise_to_top (); } if (fade_in_trim_handle) { - fade_in_trim_handle->show (); - fade_in_trim_handle->raise_to_top (); + boost::shared_ptr ar (audio_region()); + if (!ar->locked() && (ar->fade_in()->back()->when > 64 || (ar->can_trim() & Trimmable::FrontTrimEarlier))) { + fade_in_trim_handle->show (); + fade_in_trim_handle->raise_to_top (); + } else { + fade_in_trim_handle->hide (); + } } if (fade_out_trim_handle) { - fade_out_trim_handle->show (); - fade_out_trim_handle->raise_to_top (); + boost::shared_ptr ar (audio_region()); + if (!ar->locked() && (ar->fade_out()->back()->when > 64 || (ar->can_trim() & Trimmable::EndTrimLater))) { + fade_out_trim_handle->show (); + fade_out_trim_handle->raise_to_top (); + } else { + fade_out_trim_handle->hide (); + } } } } @@ -1434,12 +1455,6 @@ AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave) ArdourCanvas::color_to_rgba (fill, r, g, b, a); fill = ArdourCanvas::rgba_to_color (r, g, b, 0.85); /* magic number, not user controllable */ outline = ARDOUR_UI::config()->get_canvasvar_WaveForm(); - - if (!Config->get_show_name_highlight()) { - /* recolor name text because it needs to contrast with - the waveform background, not the name highlight. - */ - } } wave->set_fill_color (fill); @@ -1470,17 +1485,19 @@ void AudioRegionView::set_fade_visibility (bool yn) { if (yn) { - if (fade_in_handle) { fade_in_handle->show(); } - if (fade_out_handle) { fade_out_handle->show(); } - if (fade_in_trim_handle) { fade_in_trim_handle->show(); } - if (fade_out_trim_handle) { fade_out_trim_handle->show(); } - if (start_xfade_rect) { start_xfade_rect->set_outline(true); } - if (end_xfade_rect) { end_xfade_rect->set_outline(true); } - } else { + if (start_xfade_curve) { start_xfade_curve->show (); } + if (end_xfade_curve) { end_xfade_curve->show (); } + if (start_xfade_rect) { start_xfade_rect->show (); } + if (end_xfade_rect) { end_xfade_rect->show (); } + } else { + if (start_xfade_curve) { start_xfade_curve->hide(); } + if (end_xfade_curve) { end_xfade_curve->hide(); } if (fade_in_handle) { fade_in_handle->hide(); } if (fade_out_handle) { fade_out_handle->hide(); } if (fade_in_trim_handle) { fade_in_trim_handle->hide(); } if (fade_out_trim_handle) { fade_out_trim_handle->hide(); } + if (start_xfade_rect) { start_xfade_rect->hide (); } + if (end_xfade_rect) { end_xfade_rect->hide (); } if (start_xfade_rect) { start_xfade_rect->set_outline (false); } if (end_xfade_rect) { end_xfade_rect->set_outline (false); } } @@ -1624,8 +1641,15 @@ void AudioRegionView::drag_end () { TimeAxisViewItem::drag_end (); - //see comment for drag_start + + if (fade_in_handle && fade_in_handle->visible()) { + // lenght of region or fade changed, re-check + // if fade_in_trim_handle or fade_out_trim_handle should + // be visible. -- If the fade_in_handle is visible + // we have focus and are not in internal edit mode. + entered(false); + } } void