13
0

visually indicate peak-file rebuild

Not yet a checker pattern, but closing it :)
This commit is contained in:
Robin Gareus 2015-09-15 00:19:02 +02:00
parent 8a4bf386a4
commit 7e1baa70e4
2 changed files with 33 additions and 17 deletions

View File

@ -74,6 +74,8 @@ using namespace ArdourCanvas;
static double const handle_size = 10; /* height of fade handles */ static double const handle_size = 10; /* height of fade handles */
Cairo::RefPtr<Cairo::Pattern> AudioRegionView::pending_peak_pattern;
AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu, AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
uint32_t basic_color) uint32_t basic_color)
: RegionView (parent, tv, r, spu, basic_color) : RegionView (parent, tv, r, spu, basic_color)
@ -82,6 +84,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxis
, fade_out_handle(0) , fade_out_handle(0)
, fade_in_trim_handle(0) , fade_in_trim_handle(0)
, fade_out_trim_handle(0) , fade_out_trim_handle(0)
, pending_peak_data(0)
, start_xfade_curve (0) , start_xfade_curve (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false) , _start_xfade_visible (false)
@ -103,6 +106,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Container *parent, RouteTimeAxis
, fade_out_handle(0) , fade_out_handle(0)
, fade_in_trim_handle(0) , fade_in_trim_handle(0)
, fade_out_trim_handle(0) , fade_out_trim_handle(0)
, pending_peak_data(0)
, start_xfade_curve (0) , start_xfade_curve (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false) , _start_xfade_visible (false)
@ -122,6 +126,7 @@ AudioRegionView::AudioRegionView (const AudioRegionView& other, boost::shared_pt
, fade_out_handle(0) , fade_out_handle(0)
, fade_in_trim_handle(0) , fade_in_trim_handle(0)
, fade_out_trim_handle(0) , fade_out_trim_handle(0)
, pending_peak_data(0)
, start_xfade_curve (0) , start_xfade_curve (0)
, start_xfade_rect (0) , start_xfade_rect (0)
, _start_xfade_visible (false) , _start_xfade_visible (false)
@ -143,6 +148,23 @@ AudioRegionView::init (bool wfd)
// FIXME: Some redundancy here with RegionView::init. Need to figure out // FIXME: Some redundancy here with RegionView::init. Need to figure out
// where order is important and where it isn't... // where order is important and where it isn't...
if (!pending_peak_pattern) {
cairo_pattern_t* pat = cairo_pattern_create_radial (4.0, 4.0, 1.0, 4.0, 4.0, 4.0);
cairo_pattern_add_color_stop_rgba (pat, 0.0, 0, 0, 0, 1.0);
cairo_pattern_add_color_stop_rgba (pat, 0.6, 0, 0, 0, 0.0);
cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT);
Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (pat, false));
pending_peak_pattern = p;
}
// needs to be created first, RegionView::init() calls set_height()
pending_peak_data = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (pending_peak_data, string_compose ("pending peak rectangle for %1", region()->name()));
pending_peak_data->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 0.0));
pending_peak_data->set_pattern (pending_peak_pattern);
pending_peak_data->set_data ("regionview", this);
pending_peak_data->hide ();
RegionView::init (wfd); RegionView::init (wfd);
_amplitude_above_axis = 1.0; _amplitude_above_axis = 1.0;
@ -232,6 +254,8 @@ AudioRegionView::init (bool wfd)
setup_waveform_visibility (); setup_waveform_visibility ();
pending_peak_data->raise_to_top ();
if (frame_handle_start) { if (frame_handle_start) {
frame_handle_start->raise_to_top (); frame_handle_start->raise_to_top ();
} }
@ -407,6 +431,8 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
RegionView::reset_width_dependent_items(pixel_width); RegionView::reset_width_dependent_items(pixel_width);
assert(_pixel_width == pixel_width); assert(_pixel_width == pixel_width);
pending_peak_data->set_x1(pixel_width);
if (pixel_width <= 20.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) { if (pixel_width <= 20.0 || _height < 5.0 || !trackview.session()->config.get_show_region_fades()) {
if (fade_in_handle) { fade_in_handle->hide(); } if (fade_in_handle) { fade_in_handle->hide(); }
if (fade_out_handle) { fade_out_handle->hide(); } if (fade_out_handle) { fade_out_handle->hide(); }
@ -475,6 +501,7 @@ void
AudioRegionView::set_height (gdouble height) AudioRegionView::set_height (gdouble height)
{ {
RegionView::set_height (height); RegionView::set_height (height);
pending_peak_data->set_y1 (height);
uint32_t wcnt = waves.size(); uint32_t wcnt = waves.size();
@ -984,17 +1011,6 @@ AudioRegionView::set_amplitude_above_axis (gdouble a)
} }
} }
uint32_t
AudioRegionView::get_fill_color() const
{
ArdourCanvas::Color c = TimeAxisViewItem::get_fill_color();
if (!tmp_waves.empty()) {
// peak-data is not ready.
c &= 0xffffff1f; // TODO: themable color or pattern?
}
return c;
}
void void
AudioRegionView::set_colors () AudioRegionView::set_colors ()
{ {
@ -1122,9 +1138,7 @@ AudioRegionView::create_waves ()
// cerr << "\tdata is not ready\n"; // cerr << "\tdata is not ready\n";
// we'll get a PeaksReady signal from the source in the future // we'll get a PeaksReady signal from the source in the future
// and will call create_one_wave(n) then. // and will call create_one_wave(n) then.
pending_peak_data->show ();
// hightlight track, missing peaks
set_colors ();
} }
} else { } else {
@ -1225,8 +1239,8 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
waves = tmp_waves; waves = tmp_waves;
tmp_waves.clear (); tmp_waves.clear ();
/* set color to indicate peak-completed */ /* indicate peak-completed */
set_colors (); pending_peak_data->hide ();
} }
/* channel wave created, don't hook into peaks ready anymore */ /* channel wave created, don't hook into peaks ready anymore */

View File

@ -160,6 +160,9 @@ class AudioRegionView : public RegionView
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0 ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Rectangle* fade_in_trim_handle; ///< fade in trim handle, or 0 ArdourCanvas::Rectangle* fade_in_trim_handle; ///< fade in trim handle, or 0
ArdourCanvas::Rectangle* fade_out_trim_handle; ///< fade out trim handle, or 0 ArdourCanvas::Rectangle* fade_out_trim_handle; ///< fade out trim handle, or 0
ArdourCanvas::Rectangle* pending_peak_data;
static Cairo::RefPtr<Cairo::Pattern> pending_peak_pattern;
ArdourCanvas::XFadeCurve* start_xfade_curve; ArdourCanvas::XFadeCurve* start_xfade_curve;
ArdourCanvas::Rectangle* start_xfade_rect; ArdourCanvas::Rectangle* start_xfade_rect;
@ -194,7 +197,6 @@ class AudioRegionView : public RegionView
void reset_width_dependent_items (double pixel_width); void reset_width_dependent_items (double pixel_width);
void set_frame_color (); void set_frame_color ();
uint32_t get_fill_color() const;
void color_handler (); void color_handler ();
void transients_changed(); void transients_changed();