Permalink
Browse files

added stride functionality

  • Loading branch information...
1 parent 74655fc commit c7d069da81bc5bad4631906bc5222ff00dfd984b @pchilds committed Sep 15, 2012
View
@@ -165,7 +165,7 @@ static void draw(GtkWidget *widget, cairo_t *cr)
GtkPlot *plt;
GtkAllocation alloc;
gint dtt, ft, hg, j, k, lt, st, tf, to, tn, tnn, tx, tz, wd, xa, xl, xr, xr2, xt, xu, xv, xvn, xw, ya, yl, yr, yr2, yu, yv, yvn, yw;
- gdouble av, delx, dely, dt, lr, lr2, vv, wv, zv;
+ gdouble av, delx, dely, dt, lr1, lr2, vv, wv, zv;
guint lr3;
gchar *str1=NULL;
gchar lbl[BFL];
@@ -4183,12 +4183,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
{(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
}
-void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
+void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
{
if (plot->xdata) g_array_free((plot->xdata), FALSE);
if (plot->ydata) g_array_free((plot->ydata), FALSE);
{(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
- gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
+ gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}
static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
View
@@ -71,7 +71,7 @@
gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
- void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
+ void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_linear_new(void);
G_END_DECLS
#endif
View
@@ -1758,10 +1758,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -2481,10 +2481,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -3290,10 +3290,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -4093,10 +4093,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -4897,10 +4897,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
{vv=g_array_index((plt->rd), gdouble, ft); wv=g_array_index((plt->gr), gdouble, ft); xv=g_array_index((plt->bl), gdouble, ft); yv=g_array_index((plt->al), gdouble, ft);}
cairo_set_source_rgba(cr, vv, wv, xv, yv);
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (j=ft+st; j<lt; j+=st)
{
r=g_array_index((plot->rdata), gdouble, j);
@@ -5546,12 +5546,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
{(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
}
-void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
+void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st)
{
if (plot->rdata) g_array_free((plot->rdata), FALSE);
if (plot->thdata) g_array_free((plot->thdata), FALSE);
{(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
- gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
+ gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}
static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
View
@@ -74,7 +74,7 @@
gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
- void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
+ void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_polar_new(void);
G_END_DECLS
#endif
@@ -512,8 +512,8 @@ void upg(GtkWidget *widget, gpointer data)
int main(int argc, char *argv[])
{
- AtkObject *atk_widget, *atk_label;
- GArray *caa, *cab, *cag, *car, *nx, *sz, *x, *y;
+ AtkObject *atk_label, *atk_widget;
+ GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
gdouble fll, val;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
View
@@ -510,8 +510,8 @@ void upg(GtkWidget *widget, gpointer data)
int main(int argc, char *argv[])
{
- AtkObject *atk_widget, *atk_label;
- GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
+ AtkObject *atk_label, *atk_widget;
+ GArray *x, *y, *st, *sz, *nx, *car, *cab, *cag, *caa;
gdouble fll, valx, valy;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
View
@@ -49,8 +49,8 @@
};
void gtk_plot_set_font(GtkPlot *plot, PangoFontDescription *lf, PangoFontDescription *af);
void gtk_plot_set_colour(GtkPlot *plot, GArray *cl);
- void gtk_plot_polar_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
- void gtk_plot_polar_set_index(GtkPlot *plot, GArray *nd);
+ void gtk_plot_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
+ void gtk_plot_set_index(GtkPlot *plot, GArray *nd);
GtkWidget *gtk_plot_new(void);
G_END_DECLS
#endif
View
@@ -4172,12 +4172,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
{(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
}
-void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
+void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
{
if (plot->xdata) g_array_free((plot->xdata), FALSE);
if (plot->ydata) g_array_free((plot->ydata), FALSE);
{(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
- gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
+ gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}
static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
View
@@ -71,7 +71,7 @@
gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
- void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
+ void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_linear_new(void);
G_END_DECLS
#endif
View
@@ -1755,10 +1755,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -2478,10 +2478,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -3287,10 +3287,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -4090,10 +4090,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
{
r=g_array_index((plot->rdata), gdouble, ft);
@@ -4894,10 +4894,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
vv=g_array_index((plt->cl), GdkRGBA, ft);
cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
ft=g_array_index((plt->ind), gint, k);
- if (ft>=(plot->ydata->len)) break;
+ if (ft>=(plot->rdata->len)) break;
st=g_array_index((plt->stride), gint, k);
lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
- if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
+ if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
for (j=ft; j<lt; j+=st)
{
r=g_array_index((plot->rdata), gdouble, j);
@@ -5533,12 +5533,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
{(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
}
-void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
+void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, Garray *st)
{
if (plot->rdata) g_array_free((plot->rdata), FALSE);
if (plot->thdata) g_array_free((plot->thdata), FALSE);
{(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
- gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
+ gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
}
static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
View
@@ -74,7 +74,7 @@
gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
- void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
+ void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
GtkWidget *gtk_plot_polar_new(void);
G_END_DECLS
#endif
View
@@ -465,13 +465,13 @@ int main(int argc, char *argv[])
AtkObject *atk_label, *atk_widget;
GArray *cla, *nx, *st, *sz, *x, *y;
GdkRGBA cl;
- guint j;
gdouble valx, valy;
GtkAccelGroup *accel_group=NULL;
GtkAdjustment *adj;
GtkPlot *pt;
GtkPlotPolar *plt;
GtkWidget *butt, *grid, *grid2, *label, *mnb, *mni, *mnu, *pane;
+ guint j;
gtk_init(&argc, &argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);

0 comments on commit c7d069d

Please sign in to comment.