X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faudio_region_view.cc;h=db5c609e7ce0724bb016af67a008fa9ada4a7e7e;hb=39eec5ac1b4d6c76e064ad7599d0d1efd626b146;hp=69daf76fb22c99d768a13e2fe7462ffcc12f2b1c;hpb=9decd39de98156f36ab8c8e54cc0859ab63e0a5f;p=ardour.git diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 69daf76fb2..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; @@ -417,6 +423,8 @@ AudioRegionView::reset_width_dependent_items (double pixel_width) 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->set_outline (false); } + if (end_xfade_rect) { end_xfade_rect->set_outline (false); } } AnalysisFeatureList analysis_features = _region->transients(); @@ -570,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; @@ -591,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()); @@ -651,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) { @@ -674,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()); @@ -744,13 +757,14 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr ar, frame CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name())); start_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine()); start_xfade_rect->set_fill (false); - start_xfade_rect->set_outline (true); + start_xfade_rect->set_outline (false); + start_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::RIGHT)); start_xfade_rect->set_outline_width (0.5); start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this)); start_xfade_rect->set_data ("regionview", this); } - start_xfade_rect->set (ArdourCanvas::Rect (0.0, 0.0, rect_width + TimeAxisViewItem::RIGHT_EDGE_SHIFT, effective_height)); + start_xfade_rect->set (ArdourCanvas::Rect (0.0, 0.0, rect_width, effective_height)); /* fade out line */ @@ -835,7 +849,8 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name())); end_xfade_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine()); end_xfade_rect->set_fill (false); - end_xfade_rect->set_outline (true); + end_xfade_rect->set_outline (false); + end_xfade_rect->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT)); end_xfade_rect->set_outline_width (0.5); end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this)); end_xfade_rect->set_data ("regionview", this); @@ -1312,6 +1327,12 @@ AudioRegionView::entered (bool internal_editing) } if (!internal_editing) { + if (start_xfade_rect) { + start_xfade_rect->set_outline (true); + } + if (end_xfade_rect) { + end_xfade_rect->set_outline (true); + } if (fade_in_handle) { fade_in_handle->show (); fade_in_handle->raise_to_top (); @@ -1321,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 (); + } } } } @@ -1345,6 +1376,8 @@ AudioRegionView::exited () 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->set_outline (false); } + if (end_xfade_rect) { end_xfade_rect->set_outline (false); } } void @@ -1422,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); @@ -1458,15 +1485,21 @@ 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(); } - } 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); } } } @@ -1608,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