From b8a8abeb8f35b092deee46179190611ad16deae5 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Fri, 14 Dec 2012 17:21:44 +0000 Subject: [PATCH] code cleanup; crossfade shape drawing is now more closely associated with the fade-in shape rather than a separate thing. could probably be consolidated into fewer functions, but this is an interim step for testing. Also remove the use-current-fade-shape option which is not meaningful in new model git-svn-id: svn://localhost/ardour2/branches/3.0@13669 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/audio_region_view.cc | 21 +++++++++++---------- gtk2_ardour/audio_region_view.h | 4 ++-- gtk2_ardour/editor_drag.cc | 18 ++++++------------ gtk2_ardour/session_option_editor.cc | 5 ++--- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index b1ffbd7d4b..26bcad68f8 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -522,14 +522,12 @@ AudioRegionView::reset_fade_shapes () void AudioRegionView::reset_fade_in_shape () { - reset_fade_in_shape_width ((framecnt_t) audio_region()->fade_in()->back()->when); + reset_fade_in_shape_width (audio_region(), (framecnt_t) audio_region()->fade_in()->back()->when); } void -AudioRegionView::reset_fade_in_shape_width (framecnt_t width) +AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr ar, framecnt_t width) { - redraw_start_xfade (); - if (fade_in_handle == 0) { return; } @@ -602,19 +600,20 @@ AudioRegionView::reset_fade_in_shape_width (framecnt_t width) if (frame_handle_start) { frame_handle_start->raise_to_top(); } + + redraw_start_xfade_to ( ar, width); + } void AudioRegionView::reset_fade_out_shape () { - reset_fade_out_shape_width ((framecnt_t) audio_region()->fade_out()->back()->when); + reset_fade_out_shape_width (audio_region(), (framecnt_t) audio_region()->fade_out()->back()->when); } void -AudioRegionView::reset_fade_out_shape_width (framecnt_t width) +AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr ar, framecnt_t width) { - redraw_end_xfade (); - if (fade_out_handle == 0) { return; } @@ -691,6 +690,8 @@ AudioRegionView::reset_fade_out_shape_width (framecnt_t width) if (frame_handle_end) { frame_handle_end->raise_to_top(); } + + redraw_end_xfade_to (ar, width); } framepos_t @@ -1411,7 +1412,7 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr ar, frame if (!start_xfade_out) { start_xfade_out = new ArdourCanvas::Line (*group); start_xfade_out->property_width_pixels() = 1; - uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 255); + uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128); start_xfade_out->property_fill_color_rgba() = col; } @@ -1519,7 +1520,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr ar, framecn if (!end_xfade_out) { end_xfade_out = new ArdourCanvas::Line (*group); end_xfade_out->property_width_pixels() = 1; - uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 255); + uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128); end_xfade_out->property_fill_color_rgba() = col; } diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index 6f6d76d06b..10159d0cfb 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -91,8 +91,8 @@ class AudioRegionView : public RegionView GhostRegion* add_ghost (TimeAxisView&); - void reset_fade_in_shape_width (framecnt_t); - void reset_fade_out_shape_width (framecnt_t); + void reset_fade_in_shape_width (boost::shared_ptr ar, framecnt_t); + void reset_fade_out_shape_width (boost::shared_ptr ar, framecnt_t); framepos_t get_fade_in_shape_width (); framepos_t get_fade_out_shape_width (); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 6db252c2d0..a8e9a78dc5 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1735,8 +1735,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) len = ar->fade_in()->back()->when; new_length = len - _editor->unit_to_frame (distance); new_length = ar->verify_xfade_bounds (new_length, true /*START*/ ); - arv->reset_fade_in_shape_width (new_length); //the grey shape - arv->redraw_start_xfade_to (ar, new_length); //the green lines & blue rect + arv->reset_fade_in_shape_width (ar, new_length); //the grey shape } } } @@ -1756,8 +1755,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move) len = ar->fade_out()->back()->when; new_length = len - _editor->unit_to_frame (distance); new_length = ar->verify_xfade_bounds (new_length, false /*END*/ ); - arv->reset_fade_out_shape_width (new_length); //the grey shape - arv->redraw_end_xfade_to (ar, new_length); //the green lines & blue rect (must do this after) + arv->reset_fade_out_shape_width (ar, new_length); //the grey shape } } } @@ -2349,9 +2347,7 @@ FadeInDrag::motion (GdkEvent* event, bool) continue; } - tmp->reset_fade_in_shape_width (fade_length); - boost::shared_ptr ar (tmp->audio_region()); - tmp->redraw_start_xfade_to (ar, fade_length); + tmp->reset_fade_in_shape_width (tmp->audio_region(), fade_length); } show_verbose_cursor_duration (region->position(), region->position() + fade_length, 32); @@ -2411,7 +2407,7 @@ FadeInDrag::aborted (bool) continue; } - tmp->reset_fade_in_shape_width (tmp->audio_region()->fade_in()->back()->when); + tmp->reset_fade_in_shape_width (tmp->audio_region(), tmp->audio_region()->fade_in()->back()->when); } } @@ -2467,9 +2463,7 @@ FadeOutDrag::motion (GdkEvent* event, bool) continue; } - tmp->reset_fade_out_shape_width (fade_length); - boost::shared_ptr ar (tmp->audio_region()); - tmp->redraw_end_xfade_to (ar, fade_length); + tmp->reset_fade_out_shape_width (tmp->audio_region(), fade_length); } show_verbose_cursor_duration (region->last_frame() - fade_length, region->last_frame()); @@ -2531,7 +2525,7 @@ FadeOutDrag::aborted (bool) continue; } - tmp->reset_fade_out_shape_width (tmp->audio_region()->fade_out()->back()->when); + tmp->reset_fade_out_shape_width (tmp->audio_region(), tmp->audio_region()->fade_out()->back()->when); } } diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index aa2a7c9ccd..9470dd8a8d 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -138,9 +138,8 @@ SessionOptionEditor::SessionOptionEditor (Session* s) sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice) ); - cfc->add (ConstantPowerMinus3dB, _("constant power (-3dB)")); - cfc->add (ConstantPowerMinus6dB, _("constant power (-6dB)")); - cfc->add (RegionFades, _("use existing region fade shape")); + cfc->add (ConstantPowerMinus3dB, _("Constant power (-3dB) crossfade")); + cfc->add (ConstantPowerMinus6dB, _("Linear (-6dB) crossfade")); add_option (_("Fades"), cfc);