Make colors for clip markers controllable by ardour.colors. Default

color is totally transparent. Thanks Torben!


git-svn-id: svn://localhost/ardour2/trunk@1656 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2007-04-02 21:18:15 +00:00
parent 54de497572
commit edfc81352e
8 changed files with 99 additions and 14 deletions

View File

@ -1,4 +1,5 @@
cWaveForm 0.0 0.0 0.0 0.80
cWaveFormClip 1.0 0.0 0.0 0.90
cMutedWaveForm 0.35 0.35 0.35 1.0
cSelectedFrameBase 0.71 0.57 0.66 1.0
cFrameBase 0.75 0.75 0.76 1.0
@ -70,6 +71,8 @@ cMeasureLineBar 0.55 0.55 0.60 0.55
cGhostTrackBaseOutline 0.00 0.00 0.00 1.00
cGhostTrackBaseFill 0.27 0.00 0.49 0.50
cGhostTrackWave 0.0 3.00 0.0 0.30
cGhostTrackWaveClip 1.0 0.0 0.0 0.0
cGhostTrackZeroLine 0.9 0.0 0.9 0.40
cImageTrackBase 0.87 0.87 0.85 1.00
cImageTrackOutline 0.00 0.00 0.00 1.00
cMarkerTrackBase 0.87 0.87 0.85 1.00

View File

@ -678,6 +678,9 @@ AudioRegionView::set_colors ()
} else {
waves[n]->property_wave_color() = color_map[cWaveForm];
}
waves[n]->property_clip_color() = color_map[cWaveFormClip];
waves[n]->property_zero_color() = color_map[cZeroLine];
}
}
@ -752,7 +755,7 @@ AudioRegionView::set_envelope_visible (bool yn)
void
AudioRegionView::create_waves ()
{
bool create_zero_line = true;
bool create_zero_line = false;
RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick
@ -786,7 +789,9 @@ AudioRegionView::create_waves ()
}
}
if (create_zero_line) {
// Blame torben
//if (create_zero_line) {
if (0) {
if (zero_line) {
delete zero_line;
}
@ -830,6 +835,8 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = _region->muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm];
wave->property_clip_color() = color_map[cWaveFormClip];
wave->property_zero_color() = color_map[cZeroLine];
wave->property_region_start() = _region->start();
wave->property_rectified() = (bool) (_flags & WaveformRectified);
wave->property_logscaled() = (bool) (_flags & WaveformLogScaled);
@ -868,6 +875,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
/* all waves created, don't hook into peaks ready anymore */
data_ready_connection.disconnect ();
if(0)
if (!zero_line) {
zero_line = new ArdourCanvas::SimpleLine (*group);
zero_line->property_x1() = (gdouble) 1.0;
@ -1075,6 +1083,8 @@ AudioRegionView::add_ghost (AutomationTimeAxisView& atv)
wave->property_samples_per_unit() = samples_per_unit;
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_wave_color() = color_map[cGhostTrackWave];
wave->property_clip_color() = color_map[cGhostTrackWaveClip];
wave->property_zero_color() = color_map[cGhostTrackZeroLine];
wave->property_region_start() = _region->start();
ghost->waves.push_back(wave);
@ -1159,6 +1169,10 @@ AudioRegionView::color_handler (ColorID id, uint32_t val)
switch (id) {
case cMutedWaveForm:
case cWaveForm:
case cWaveFormClip:
case cGhostTrackWave:
case cGhostTrackWaveClip:
case cZeroLine:
set_colors ();
break;
@ -1166,15 +1180,6 @@ AudioRegionView::color_handler (ColorID id, uint32_t val)
case cGainLine:
envelope_active_changed();
break;
case cZeroLine:
if (zero_line) {
zero_line->property_color_rgba() = (guint) color_map[cZeroLine];
}
break;
case cGhostTrackWave:
break;
default:
break;

View File

@ -30,6 +30,7 @@
#include "canvas-waveview.h"
#include "rgb_macros.h"
extern void c_stacktrace();
enum {
@ -49,6 +50,8 @@ enum {
PROP_Y,
PROP_HEIGHT,
PROP_WAVE_COLOR,
PROP_CLIP_COLOR,
PROP_ZERO_COLOR,
PROP_RECTIFIED,
PROP_REGION_START,
PROP_LOGSCALED,
@ -249,6 +252,20 @@ gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class)
0, G_MAXUINT, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property
(gobject_class,
PROP_CLIP_COLOR,
g_param_spec_uint ("clip_color", NULL, NULL,
0, G_MAXUINT, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property
(gobject_class,
PROP_ZERO_COLOR,
g_param_spec_uint ("zero_color", NULL, NULL,
0, G_MAXUINT, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property
(gobject_class,
PROP_RECTIFIED,
@ -326,6 +343,8 @@ gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview)
waveview->reload_cache_in_render = FALSE;
waveview->wave_color = RGBA_TO_UINT(44,35,126,255);
waveview->clip_color = RGBA_TO_UINT(44,0,0,100);
waveview->zero_color = RGBA_TO_UINT(44,0,128,100);
}
static void
@ -797,6 +816,20 @@ gnome_canvas_waveview_set_property (GObject *object,
}
break;
case PROP_CLIP_COLOR:
if (waveview->clip_color != g_value_get_uint(value)) {
waveview->clip_color = g_value_get_uint(value);
redraw = TRUE;
}
break;
case PROP_ZERO_COLOR:
if (waveview->zero_color != g_value_get_uint(value)) {
waveview->zero_color = g_value_get_uint(value);
redraw = TRUE;
}
break;
case PROP_RECTIFIED:
if (waveview->rectified != g_value_get_boolean(value)) {
waveview->rectified = g_value_get_boolean(value);
@ -909,6 +942,14 @@ gnome_canvas_waveview_get_property (GObject *object,
g_value_set_uint (value, waveview->wave_color);
break;
case PROP_CLIP_COLOR:
g_value_set_uint (value, waveview->clip_color);
break;
case PROP_ZERO_COLOR:
g_value_set_uint (value, waveview->zero_color);
break;
case PROP_RECTIFIED:
g_value_set_boolean (value, waveview->rectified);
break;
@ -969,6 +1010,8 @@ gnome_canvas_waveview_update (GnomeCanvasItem *item, double *affine, ArtSVP *cli
UINT_TO_RGBA (waveview->wave_color, &waveview->wave_r, &waveview->wave_g, &waveview->wave_b,
&waveview->wave_a);
UINT_TO_RGBA (waveview->clip_color, &waveview->clip_r, &waveview->clip_g, &waveview->clip_b,
&waveview->clip_a);
// check_cache (waveview, "end of update");
}
@ -1066,6 +1109,7 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
#define origin half_height
for (x = begin; x < end; x++) {
double max, min;
@ -1126,11 +1170,11 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
}
if (clip_max) {
PAINT_VERT(buf, 255, 0, 0, x, pymax, pymax+clip_length);
PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymax, pymax+clip_length);
}
if (clip_min) {
PAINT_VERT(buf, 255, 0, 0, x, pymin-clip_length, pymin);
PAINT_VERTA(buf, waveview->clip_r, waveview->clip_g, waveview->clip_b, waveview->clip_a, x, pymin-clip_length, pymin);
}
/* presto, we're done */
@ -1138,6 +1182,13 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item,
cache_index++;
}
// Paint zeroline.
//PAINT_HORIZA(buf, waveview->zero_r, waveview->zero_g, waveview->zero_b, waveview->zero_a, begin, endi-1, origin );
unsigned char zero_r, zero_g, zero_b, zero_a;
UINT_TO_RGBA( waveview->zero_color, &zero_r, &zero_g, &zero_b, &zero_a );
int zeroline_y = (int) rint ((item->y1 + origin) * item->canvas->pixels_per_unit);
PAINT_HORIZA(buf, zero_r, zero_g, zero_b, zero_a, begin, end, zeroline_y);
#undef origin
}

View File

@ -99,6 +99,8 @@ struct _GnomeCanvasWaveView
double height;
double half_height;
uint32_t wave_color;
uint32_t clip_color;
uint32_t zero_color;
char rectified;
char logscaled;
@ -113,6 +115,7 @@ struct _GnomeCanvasWaveView
int32_t bbox_lrx;
int32_t bbox_lry;
unsigned char wave_r, wave_g, wave_b, wave_a;
unsigned char clip_r, clip_g, clip_b, clip_a;
uint32_t samples;
uint32_t region_start;
int32_t reload_cache_in_render;

View File

@ -1,6 +1,7 @@
/* no guard clauses here */
COLORID(cWaveForm)
COLORID(cWaveFormClip)
COLORID(cMutedWaveForm)
COLORID(cSelectedFrameBase)
COLORID(cFrameBase)
@ -72,6 +73,8 @@ COLORID(cMeasureLineBar)
COLORID(cGhostTrackBaseOutline)
COLORID(cGhostTrackBaseFill)
COLORID(cGhostTrackWave)
COLORID(cGhostTrackWaveClip)
COLORID(cGhostTrackZeroLine)
COLORID(cImageTrackBase)
COLORID(cImageTrackOutline)
COLORID(cMarkerTrackBase)

View File

@ -130,7 +130,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame_position = start ;
item_duration = duration ;
name_connected = false;
fill_opacity = 130;
fill_opacity = 60;
position_locked = false ;
max_item_duration = ARDOUR::max_frames;
min_item_duration = 0 ;

View File

@ -251,6 +251,22 @@ Glib::PropertyProxy_ReadOnly<guint> WaveView::property_wave_color() const
{
return Glib::PropertyProxy_ReadOnly<guint> (this, "wave_color");
}
Glib::PropertyProxy<guint> WaveView::property_clip_color()
{
return Glib::PropertyProxy<guint> (this, "clip_color");
}
Glib::PropertyProxy_ReadOnly<guint> WaveView::property_clip_color() const
{
return Glib::PropertyProxy_ReadOnly<guint> (this, "clip_color");
}
Glib::PropertyProxy<guint> WaveView::property_zero_color()
{
return Glib::PropertyProxy<guint> (this, "zero_color");
}
Glib::PropertyProxy_ReadOnly<guint> WaveView::property_zero_color() const
{
return Glib::PropertyProxy_ReadOnly<guint> (this, "zero_color");
}
Glib::PropertyProxy<gint> WaveView::property_rectified()
{
return Glib::PropertyProxy<gint> (this, "rectified");

View File

@ -142,7 +142,11 @@ public:
Glib::PropertyProxy_ReadOnly<double> property_height() const;
Glib::PropertyProxy<guint> property_wave_color();
Glib::PropertyProxy_ReadOnly<guint> property_wave_color() const;
Glib::PropertyProxy<guint> property_clip_color();
Glib::PropertyProxy_ReadOnly<guint> property_clip_color() const;
Glib::PropertyProxy<gint> property_rectified();
Glib::PropertyProxy<guint> property_zero_color();
Glib::PropertyProxy_ReadOnly<guint> property_zero_color() const;
Glib::PropertyProxy_ReadOnly<gint> property_rectified() const;
Glib::PropertyProxy<guint> property_region_start();
Glib::PropertyProxy_ReadOnly<guint> property_region_start() const;