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
This commit is contained in:
Ben Loftis 2012-12-14 17:21:44 +00:00
parent e5776d1a69
commit b8a8abeb8f
4 changed files with 21 additions and 27 deletions

View File

@ -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<AudioRegion> 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<AudioRegion> 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<AudioRegion> 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<AudioRegion> 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;
}

View File

@ -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<ARDOUR::AudioRegion> ar, framecnt_t);
void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, framecnt_t);
framepos_t get_fade_in_shape_width ();
framepos_t get_fade_out_shape_width ();

View File

@ -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<AudioRegion> 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<AudioRegion> 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);
}
}

View File

@ -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);