[SCM] calf/master: + Line graph: modify X scale, add grid line capability (without legend for now)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:38:28 UTC 2013
The following commit has been merged in the master branch:
commit 71608e6cb870fd1a9eefab01971c1fe8a2cfbc90
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Nov 15 21:41:23 2008 +0000
+ Line graph: modify X scale, add grid line capability (without legend for now)
diff --git a/src/calf/giface.h b/src/calf/giface.h
index fd9af85..e367854 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -157,6 +157,11 @@ struct line_graph_iface
/// @param subindex dot number (there may be multiple dots graphs for one parameter)
virtual bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_t *context) { return false; }
+ /// Obtain subindex'th dot of parameter 'index'
+ /// @param index parameter/dot number (usually tied to particular plugin control port)
+ /// @param subindex dot number (there may be multiple dots graphs for one parameter)
+ virtual bool get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context) { return false; }
+
/// Obtain subindex'th static graph of parameter index (static graphs are only dependent on parameter value, not plugin state)
/// @param index parameter/graph number (usually tied to particular plugin control port)
/// @param subindex graph number (there may be multiple overlaid graphs for one parameter, eg. for monosynth 2x12dB filters)
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 331bacf..9f8f6ca 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -58,9 +58,29 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
gdk_cairo_set_source_color(c, &sc);
cairo_rectangle(c, ox, oy, sx, sy);
+ cairo_clip_preserve(c);
cairo_fill(c);
if (lg->source) {
+ float pos = 0;
+ bool vertical = false;
+ cairo_set_line_width(c, 1);
+ for(int gn = 0; cairo_set_source_rgba(c, 1, 1, 1, 0.5), lg->source->get_gridline(lg->source_id, gn, pos, vertical, c); gn++)
+ {
+ if (vertical)
+ {
+ float x = floor(ox + pos * sx) + 0.5;
+ cairo_move_to(c, x, oy);
+ cairo_line_to(c, x, oy + sy);
+ }
+ else
+ {
+ float y = floor(oy + sy / 2 - (sy / 2 - 1) * pos) + 0.5;
+ cairo_move_to(c, ox, y);
+ cairo_line_to(c, ox + sx, y);
+ }
+ cairo_stroke(c);
+ }
float *data = new float[2 * sx];
GdkColor sc2 = { 0, 0, 65535, 0 };
gdk_cairo_set_source_color(c, &sc2);
@@ -71,8 +91,8 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
for (int i = 0; i < 2 * sx; i++)
{
int y = (int)(oy + sy / 2 - (sy / 2 - 1) * data[i]);
- if (y < oy) y = oy;
- if (y >= oy + sy) y = oy + sy - 1;
+ //if (y < oy) y = oy;
+ //if (y >= oy + sy) y = oy + sy - 1;
if (i)
cairo_line_to(c, ox + i * 0.5, y);
else
@@ -80,6 +100,7 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
}
cairo_stroke(c);
}
+ delete []data;
float x, y;
int size = 0;
GdkColor sc3 = { 0, 32767, 65535, 0 };
@@ -87,10 +108,9 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
for(int gn = 0; lg->source->get_dot(lg->source_id, gn, x, y, size = 3, c); gn++)
{
int yv = (int)(oy + sy / 2 - (sy / 2 - 1) * y);
- cairo_arc(c, ox + (x + 1) * sx / 2, yv, size, 0, 2 * M_PI);
+ cairo_arc(c, ox + x * sx, yv, size, 0, 2 * M_PI);
cairo_fill(c);
}
- delete []data;
}
cairo_destroy(c);
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list