Lincoln's patch to tidy up region fade visuals. Fixes #3437.
git-svn-id: svn://localhost/ardour2/branches/3.0@7748 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b25da08b46
commit
18b99c1f44
|
@ -73,6 +73,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
|
|||
, fade_out_shape(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
, fade_position_line(0)
|
||||
, gain_line(0)
|
||||
, _amplitude_above_axis(1.0)
|
||||
, _flags(0)
|
||||
|
@ -90,6 +91,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
|
|||
, fade_out_shape(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
, fade_position_line(0)
|
||||
, gain_line(0)
|
||||
, _amplitude_above_axis(1.0)
|
||||
, _flags(0)
|
||||
|
@ -106,6 +108,7 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other)
|
|||
, fade_out_shape(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
, fade_position_line(0)
|
||||
, gain_line(0)
|
||||
, _amplitude_above_axis(1.0)
|
||||
, _flags(0)
|
||||
|
@ -127,6 +130,7 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt
|
|||
, fade_out_shape(0)
|
||||
, fade_in_handle(0)
|
||||
, fade_out_handle(0)
|
||||
, fade_position_line(0)
|
||||
, gain_line(0)
|
||||
, _amplitude_above_axis(1.0)
|
||||
, _flags(0)
|
||||
|
@ -195,6 +199,13 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
|||
fade_out_handle->property_outline_pixels() = 0;
|
||||
|
||||
fade_out_handle->set_data ("regionview", this);
|
||||
|
||||
fade_position_line = new ArdourCanvas::SimpleLine (*group);
|
||||
fade_position_line->property_color_rgba() = 0xBBBBBBAA;
|
||||
fade_position_line->property_y1() = 7;
|
||||
fade_position_line->property_y2() = _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1;
|
||||
|
||||
fade_position_line->hide();
|
||||
}
|
||||
|
||||
setup_fade_handle_positions ();
|
||||
|
@ -322,36 +333,24 @@ AudioRegionView::fade_out_changed ()
|
|||
void
|
||||
AudioRegionView::fade_in_active_changed ()
|
||||
{
|
||||
// uint32_t r,g,b,a;
|
||||
// uint32_t col;
|
||||
// UINT_TO_RGBA(fade_color,&r,&g,&b,&a);
|
||||
|
||||
if (audio_region()->fade_in_active()) {
|
||||
fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
|
||||
fade_in_shape->property_width_pixels() = 1;
|
||||
fade_in_shape->property_outline_color_rgba() = RGBA_TO_UINT(180,180,180,190); // FIXME make a themeable colour
|
||||
} else {
|
||||
fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
|
||||
fade_in_shape->property_width_pixels() = 1;
|
||||
fade_in_shape->property_outline_color_rgba() = RGBA_TO_UINT(45,45,45,150); // FIXME make a themeable colour
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::fade_out_active_changed ()
|
||||
{
|
||||
// uint32_t r,g,b,a;
|
||||
// uint32_t col;
|
||||
// UINT_TO_RGBA(fade_color,&r,&g,&b,&a);
|
||||
|
||||
if (audio_region()->fade_out_active()) {
|
||||
fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
|
||||
fade_out_shape->property_width_pixels() = 1;
|
||||
fade_out_shape->property_outline_color_rgba() = RGBA_TO_UINT(180,180,180,200); // FIXME make a themeable colour
|
||||
} else {
|
||||
fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
|
||||
fade_out_shape->property_width_pixels() = 1;
|
||||
fade_out_shape->property_outline_color_rgba() = RGBA_TO_UINT(45,45,45,200); // FIXME make a themeable colour
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,19 +435,13 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
|
|||
}
|
||||
|
||||
if (fade_in_handle) {
|
||||
if (pixel_width <= 6.0) {
|
||||
if (pixel_width <= 6.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
|
||||
fade_in_handle->hide();
|
||||
fade_out_handle->hide();
|
||||
} else {
|
||||
if (_height < 5.0) {
|
||||
fade_in_handle->hide();
|
||||
fade_out_handle->hide();
|
||||
} else {
|
||||
if (trackview.session()->config.get_show_region_fades()) {
|
||||
fade_in_handle->show();
|
||||
fade_out_handle->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fade_in_handle->show();
|
||||
fade_out_handle->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,6 +582,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
|
|||
width = std::max ((nframes_t) 64, width);
|
||||
|
||||
Points* points;
|
||||
|
||||
double pwidth = width / samples_per_unit;
|
||||
uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
|
||||
double h;
|
||||
|
@ -603,7 +597,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
|
|||
handle_center = pwidth;
|
||||
|
||||
if (handle_center > 7.0) {
|
||||
handle_center -= 3.0;
|
||||
handle_center -= 2.0;
|
||||
} else {
|
||||
handle_center = 3.0;
|
||||
}
|
||||
|
@ -626,7 +620,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width)
|
|||
points = get_canvas_points ("fade in shape", npoints + 3);
|
||||
|
||||
if (_height >= NAME_HIGHLIGHT_THRESH) {
|
||||
h = _height - NAME_HIGHLIGHT_SIZE;
|
||||
h = _height - NAME_HIGHLIGHT_SIZE - 2;
|
||||
} else {
|
||||
h = _height;
|
||||
}
|
||||
|
@ -694,7 +688,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
|
|||
handle_center = (_region->length() - width) / samples_per_unit;
|
||||
|
||||
if (handle_center > 7.0) {
|
||||
handle_center -= 3.0;
|
||||
handle_center -= 2.0;
|
||||
} else {
|
||||
handle_center = 3.0;
|
||||
}
|
||||
|
@ -717,7 +711,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
|
|||
audio_region()->fade_out()->curve().get_vector (0, audio_region()->fade_out()->back()->when, curve, npoints);
|
||||
|
||||
if (_height >= NAME_HIGHLIGHT_THRESH) {
|
||||
h = _height - NAME_HIGHLIGHT_SIZE;
|
||||
h = _height - NAME_HIGHLIGHT_SIZE - 2;
|
||||
} else {
|
||||
h = _height;
|
||||
}
|
||||
|
@ -730,7 +724,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width)
|
|||
double xdelta = pwidth/npoints;
|
||||
|
||||
for (pi = 0, pc = 0; pc < npoints; ++pc) {
|
||||
(*points)[pi].set_x(_pixel_width - 1 - pwidth + (pc*xdelta));
|
||||
(*points)[pi].set_x(_pixel_width - pwidth + (pc * xdelta));
|
||||
(*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
|
||||
}
|
||||
|
||||
|
@ -1428,6 +1422,23 @@ AudioRegionView::show_region_editor ()
|
|||
editor->show_all();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioRegionView::show_fade_line (nframes64_t pos)
|
||||
{
|
||||
fade_position_line->property_x1() = trackview.editor().frame_to_pixel (pos);
|
||||
fade_position_line->property_x2() = trackview.editor().frame_to_pixel (pos);
|
||||
fade_position_line->show ();
|
||||
fade_position_line->raise_to_top ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::hide_fade_line ()
|
||||
{
|
||||
fade_position_line->hide ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioRegionView::transients_changed ()
|
||||
{
|
||||
|
|
|
@ -102,7 +102,10 @@ class AudioRegionView : public RegionView
|
|||
|
||||
void reset_fade_in_shape_width (nframes_t);
|
||||
void reset_fade_out_shape_width (nframes_t);
|
||||
|
||||
|
||||
void show_fade_line(nframes64_t pos);
|
||||
void hide_fade_line();
|
||||
|
||||
void set_fade_visibility (bool);
|
||||
void update_coverage_frames (LayerDisplay);
|
||||
|
||||
|
@ -139,6 +142,7 @@ class AudioRegionView : public RegionView
|
|||
ArdourCanvas::Polygon* fade_out_shape;
|
||||
ArdourCanvas::SimpleRect* fade_in_handle; ///< fade in handle, or 0
|
||||
ArdourCanvas::SimpleRect* fade_out_handle; ///< fade out handle, or 0
|
||||
ArdourCanvas::SimpleLine* fade_position_line;
|
||||
|
||||
AudioRegionGainLine * gain_line;
|
||||
|
||||
|
@ -158,7 +162,7 @@ class AudioRegionView : public RegionView
|
|||
void region_resized (const PBD::PropertyChange&);
|
||||
void region_muted ();
|
||||
void region_scale_amplitude_changed ();
|
||||
void region_renamed ();
|
||||
void region_renamed ();
|
||||
|
||||
void create_one_wave (uint32_t, bool);
|
||||
void manage_zero_line ();
|
||||
|
|
|
@ -1980,12 +1980,13 @@ FadeInDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
{
|
||||
Drag::start_grab (event, cursor);
|
||||
|
||||
AudioRegionView* a = dynamic_cast<AudioRegionView*> (_primary);
|
||||
boost::shared_ptr<AudioRegion> const r = a->audio_region ();
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
|
||||
boost::shared_ptr<AudioRegion> const r = arv->audio_region ();
|
||||
|
||||
_pointer_frame_offset = grab_frame() - ((nframes64_t) r->fade_in()->back()->when + r->position());
|
||||
_editor->show_verbose_duration_cursor (r->position(), r->position() + r->fade_in()->back()->when, 10);
|
||||
|
||||
arv->show_fade_line((nframes64_t) r->fade_in()->back()->when);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2014,6 +2015,7 @@ FadeInDrag::motion (GdkEvent* event, bool)
|
|||
}
|
||||
|
||||
tmp->reset_fade_in_shape_width (fade_length);
|
||||
tmp->show_fade_line((nframes64_t) fade_length);
|
||||
}
|
||||
|
||||
_editor->show_verbose_duration_cursor (region->position(), region->position() + fade_length, 10);
|
||||
|
@ -2055,6 +2057,7 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
|
||||
tmp->audio_region()->set_fade_in_length (fade_length);
|
||||
tmp->audio_region()->set_fade_in_active (true);
|
||||
tmp->hide_fade_line();
|
||||
|
||||
XMLNode &after = alist->get_state();
|
||||
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
|
||||
|
@ -2074,6 +2077,7 @@ FadeInDrag::aborted ()
|
|||
}
|
||||
|
||||
tmp->reset_fade_in_shape_width (tmp->audio_region()->fade_in()->back()->when);
|
||||
tmp->hide_fade_line();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2088,11 +2092,13 @@ FadeOutDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
{
|
||||
Drag::start_grab (event, cursor);
|
||||
|
||||
AudioRegionView* a = dynamic_cast<AudioRegionView*> (_primary);
|
||||
boost::shared_ptr<AudioRegion> r = a->audio_region ();
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (_primary);
|
||||
boost::shared_ptr<AudioRegion> r = arv->audio_region ();
|
||||
|
||||
_pointer_frame_offset = grab_frame() - (r->length() - (nframes64_t) r->fade_out()->back()->when + r->position());
|
||||
_editor->show_verbose_duration_cursor (r->last_frame() - r->fade_out()->back()->when, r->last_frame(), 10);
|
||||
|
||||
arv->show_fade_line(r->length() - r->fade_out()->back()->when);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2123,6 +2129,7 @@ FadeOutDrag::motion (GdkEvent* event, bool)
|
|||
}
|
||||
|
||||
tmp->reset_fade_out_shape_width (fade_length);
|
||||
tmp->show_fade_line(region->length() - fade_length);
|
||||
}
|
||||
|
||||
_editor->show_verbose_duration_cursor (region->last_frame() - fade_length, region->last_frame(), 10);
|
||||
|
@ -2166,6 +2173,7 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
|
||||
tmp->audio_region()->set_fade_out_length (fade_length);
|
||||
tmp->audio_region()->set_fade_out_active (true);
|
||||
tmp->hide_fade_line();
|
||||
|
||||
XMLNode &after = alist->get_state();
|
||||
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
|
||||
|
@ -2185,6 +2193,7 @@ FadeOutDrag::aborted ()
|
|||
}
|
||||
|
||||
tmp->reset_fade_out_shape_width (tmp->audio_region()->fade_out()->back()->when);
|
||||
tmp->hide_fade_line();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1633,8 +1633,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
if (mouse_mode == MouseObject && !internal_editing()) {
|
||||
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
|
||||
if (rect) {
|
||||
rect->property_fill_color_rgba() = 0;
|
||||
rect->property_outline_pixels() = 1;
|
||||
rect->property_fill_color_rgba() = 0xBBBBBBAA;
|
||||
}
|
||||
track_canvas->get_window()->set_cursor (*fade_in_cursor);
|
||||
}
|
||||
|
@ -1644,8 +1643,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
|||
if (mouse_mode == MouseObject && !internal_editing()) {
|
||||
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
|
||||
if (rect) {
|
||||
rect->property_fill_color_rgba() = 0;
|
||||
rect->property_outline_pixels() = 1;
|
||||
rect->property_fill_color_rgba() = 0xBBBBBBAA;
|
||||
}
|
||||
track_canvas->get_window()->set_cursor (*fade_out_cursor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue