#include "canvas/poly_line.h"
#include "canvas/line.h"
#include "canvas/text.h"
+#include "canvas/debug.h"
+#include "canvas/utils.h"
#include "streamview.h"
#include "audio_region_view.h"
create_waves ();
fade_in_shape = new ArdourCanvas::Polygon (group);
+ CANVAS_DEBUG_NAME (fade_in_shape, string_compose ("fade in shape for %1", region()->name()));
fade_in_shape->set_fill_color (fade_color);
fade_in_shape->set_data ("regionview", this);
fade_out_shape = new ArdourCanvas::Polygon (group);
+ CANVAS_DEBUG_NAME (fade_out_shape, string_compose ("fade out shape for %1", region()->name()));
fade_out_shape->set_fill_color (fade_color);
fade_out_shape->set_data ("regionview", this);
if (!_recregion) {
fade_in_handle = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name()));
fade_in_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
fade_in_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_in_handle->set_data ("regionview", this);
fade_out_handle = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name()));
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
setup_waveform_shape ();
setup_waveform_scale ();
+ if (frame_handle_start) {
+ frame_handle_start->raise_to_top ();
+ }
+ if (frame_handle_end) {
+ frame_handle_end->raise_to_top ();
+ }
+
/* XXX sync mark drag? */
}
interesting_stuff.add (ARDOUR::Properties::length);
if (what_changed.contains (interesting_stuff)) {
-
+
for (uint32_t n = 0; n < waves.size(); ++n) {
waves[n]->region_resized ();
- waves[n]->set_region_start (region()->start ());
}
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
(*w)->region_resized ();
- (*w)->set_region_start (region()->start ());
}
}
}
AudioRegionView::region_muted ()
{
RegionView::region_muted();
-
- for (uint32_t n=0; n < waves.size(); ++n) {
- if (_region->muted()) {
- waves[n]->set_outline_color (UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA));
- } else {
- waves[n]->set_outline_color (ARDOUR_UI::config()->get_canvasvar_WaveForm());
- }
- }
+ set_waveform_colors ();
}
void
if (!start_xfade_in) {
start_xfade_in = new ArdourCanvas::PolyLine (group);
- start_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_GainLine());
- start_xfade_in->set_outline_width (2.5);
+ CANVAS_DEBUG_NAME (start_xfade_in, string_compose ("xfade start in line for %1", region()->name()));
+ start_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ start_xfade_in->set_outline_width (1.5);
}
if (!start_xfade_out) {
start_xfade_out = new ArdourCanvas::PolyLine (group);
- uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_GainLine(), 128);
+ CANVAS_DEBUG_NAME (start_xfade_out, string_compose ("xfade start out line for %1", region()->name()));
+ uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
start_xfade_out->set_outline_color (col);
- start_xfade_out->set_outline_width (2.5);
+ start_xfade_out->set_outline_width (2.0);
}
if (!start_xfade_rect) {
start_xfade_rect = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name()));
start_xfade_rect->set_fill (true);
start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
start_xfade_rect->set_outline (false);
start_xfade_in->set (points);
start_xfade_in->show ();
- start_xfade_in->raise_to_top ();
/* fade out line */
start_xfade_out->set (ipoints);
start_xfade_out->show ();
- start_xfade_out->raise_to_top ();
-
- start_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
show_start_xfade();
}
if (!end_xfade_in) {
end_xfade_in = new ArdourCanvas::PolyLine (group);
- end_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_GainLine());
- end_xfade_in->set_outline_width (2.5);
+ CANVAS_DEBUG_NAME (end_xfade_in, string_compose ("xfade end in line for %1", region()->name()));
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ end_xfade_in->set_outline_color (col);
+ end_xfade_in->set_outline_width (1.5);
}
if (!end_xfade_out) {
end_xfade_out = new ArdourCanvas::PolyLine (group);
- uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_GainLine(), 128);
- end_xfade_out->set_outline_color (col);
- end_xfade_out->set_outline_width (2.5);
+ CANVAS_DEBUG_NAME (end_xfade_out, string_compose ("xfade end out line for %1", region()->name()));
+ end_xfade_out->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ end_xfade_out->set_outline_width (2.0);
}
if (!end_xfade_rect) {
end_xfade_rect = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name()));
end_xfade_rect->set_fill (true);
end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
end_xfade_rect->set_outline (0);
RegionView::set_colors();
if (gain_line) {
- gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->get_canvasvar_GainLine() : ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
+ gain_line->set_line_color (audio_region()->envelope_active() ?
+ ARDOUR_UI::config()->get_canvasvar_GainLine() :
+ ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
}
- for (uint32_t n=0; n < waves.size(); ++n) {
- if (_region->muted()) {
- waves[n]->set_outline_color (UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA));
- } else {
- waves[n]->set_outline_color (ARDOUR_UI::config()->get_canvasvar_WaveForm());
- }
+ set_waveform_colors ();
- waves[n]->set_clip_color (ARDOUR_UI::config()->get_canvasvar_WaveFormClip());
- waves[n]->set_zero_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
+ if (start_xfade_in) {
+ start_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ }
+ if (start_xfade_out) {
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ start_xfade_out->set_outline_color (col);
+ }
+ if (end_xfade_in) {
+ end_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ }
+ if (end_xfade_out) {
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ end_xfade_out->set_outline_color (col);
+ }
+
+ if (start_xfade_rect) {
+ start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
+ }
+ if (end_xfade_rect) {
+ end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
}
}
gdouble yoff = which * ht;
WaveView *wave = new WaveView (group, audio_region ());
-
+ CANVAS_DEBUG_NAME (wave, string_compose ("wave view for chn %1 of %2", which, get_item_name()));
+
wave->set_channel (which);
- wave->set_x_position (0);
wave->set_y_position (yoff);
wave->set_height (ht);
wave->set_samples_per_pixel (samples_per_pixel);
if (_recregion) {
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_RecWaveForm(), MUTED_ALPHA) : ARDOUR_UI::config()->get_canvasvar_RecWaveForm());
+
+
+
wave->set_fill_color (ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill());
} else {
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA) : ARDOUR_UI::config()->get_canvasvar_WaveForm());
- wave->set_fill_color (ARDOUR_UI::config()->get_canvasvar_WaveFormFill());
+
+ /* wave color is a saturated, whiter version of the frame's
+ * fill color
+ */
+
+ ArdourCanvas::Color c = frame->fill_color ();
+ double h, s, v;
+ ArdourCanvas::color_to_hsv (c, h, s, v);
+
+ /* full saturate */
+ s = 1.0;
+ /* head towards white */
+ v = min (1.0, v * 3.0);
+
+ c = ArdourCanvas::hsv_to_color (h, s, v, _region->muted() ? MUTED_ALPHA : 1.0);
+
+ wave->set_fill_color (c);
}
wave->set_clip_color (ARDOUR_UI::config()->get_canvasvar_WaveFormClip());
wave->set_zero_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
- // CAIROCANVAS
- // wave->property_zero_line() = true;
-
- wave->set_region_start (_region->start());
+ wave->set_show_zero_line (true);
switch (Config->get_waveform_shape()) {
case Rectified:
void
AudioRegionView::setup_waveform_scale ()
{
- for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
- (*wave)->set_logscaled (Config->get_waveform_scale() == Logarithmic);
- }
+ WaveView::set_global_logscaled (Config->get_waveform_scale() == Logarithmic);
}
-
GhostRegion*
AudioRegionView::add_ghost (TimeAxisView& tv)
{
}
WaveView *wave = new WaveView (ghost->group, audio_region());
+ CANVAS_DEBUG_NAME (wave, string_compose ("ghost wave for %1", get_item_name()));
wave->set_channel (n);
- wave->set_x_position (0);
wave->set_samples_per_pixel (samples_per_pixel);
wave->set_amplitude_above_axis (_amplitude_above_axis);
- wave->set_region_start (_region->start());
ghost->waves.push_back(wave);
}
AudioRegionView::envelope_active_changed ()
{
if (gain_line) {
- gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->get_canvasvar_GainLine() : ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
+ gain_line->set_line_color (audio_region()->envelope_active() ?
+ ARDOUR_UI::config()->get_canvasvar_GainLine() :
+ ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
}
}
}
void
-AudioRegionView::set_frame_color ()
+AudioRegionView::set_waveform_colors ()
{
- if (!frame) {
- return;
- }
-
- if (_region->opaque()) {
- fill_opacity = 130;
- } else {
- fill_opacity = 0;
- }
-
- TimeAxisViewItem::set_frame_color ();
-
- uint32_t wc;
- uint32_t fc;
-
+ ArdourCanvas::Color fill, outline, clip, zero;
+
if (_selected) {
if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm(), MUTED_ALPHA);
+ outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm(), MUTED_ALPHA);
} else {
- wc = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
+ outline = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
}
- fc = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
+ fill = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
} else {
if (_recregion) {
if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_RecWaveForm(), MUTED_ALPHA);
+ outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_RecWaveForm(), MUTED_ALPHA);
} else {
- wc = ARDOUR_UI::config()->get_canvasvar_RecWaveForm();
+ outline = ARDOUR_UI::config()->get_canvasvar_RecWaveForm();
}
- fc = ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill();
+ fill = ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill();
} else {
if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA);
+ outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA);
} else {
- wc = ARDOUR_UI::config()->get_canvasvar_WaveForm();
+ outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
}
- fc = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
+ fill = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
}
}
+ clip = ARDOUR_UI::config()->get_canvasvar_WaveFormClip();
+ zero = ARDOUR_UI::config()->get_canvasvar_ZeroLine();
+
for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
- (*w)->set_outline_color (wc);
- if (!_region->muted()) {
- (*w)->set_fill_color (fc);
- }
- }
+ (*w)->set_outline_color (outline);
+ (*w)->set_fill_color (fill);
+ (*w)->set_clip_color (clip);
+ (*w)->set_zero_color (zero);
+ }
+}
+
+void
+AudioRegionView::set_frame_color ()
+{
+ if (!frame) {
+ return;
+ }
+
+ if (_region->opaque()) {
+ fill_opacity = 130;
+ } else {
+ fill_opacity = 0;
+ }
+
+ TimeAxisViewItem::set_frame_color ();
+
+ set_waveform_colors ();
}
void
}
editor->present ();
- editor->set_position (Gtk::WIN_POS_MOUSE);
editor->show_all();
}
while (feature_lines.size() < analysis_features.size()) {
ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(group);
+ CANVAS_DEBUG_NAME (canvas_item, string_compose ("transient group for %1", region()->name()));
canvas_item->set (ArdourCanvas::Duple (-1.0, 2.0),
ArdourCanvas::Duple (1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));