Skip to content
This repository
Browse code

added stride functionality

  • Loading branch information...
commit c7d069da81bc5bad4631906bc5222ff00dfd984b 1 parent 74655fc
Paul Childs authored
6 gtk2plot/gtkplotlinear.c
@@ -165,7 +165,7 @@ static void draw(GtkWidget *widget, cairo_t *cr)
165 165 GtkPlot *plt;
166 166 GtkAllocation alloc;
167 167 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;
168   - gdouble av, delx, dely, dt, lr, lr2, vv, wv, zv;
  168 + gdouble av, delx, dely, dt, lr1, lr2, vv, wv, zv;
169 169 guint lr3;
170 170 gchar *str1=NULL;
171 171 gchar lbl[BFL];
@@ -4183,12 +4183,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
4183 4183 {(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
4184 4184 }
4185 4185
4186   -void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
  4186 +void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
4187 4187 {
4188 4188 if (plot->xdata) g_array_free((plot->xdata), FALSE);
4189 4189 if (plot->ydata) g_array_free((plot->ydata), FALSE);
4190 4190 {(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
4191   - gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
  4191 + gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
4192 4192 }
4193 4193
4194 4194 static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
2  gtk2plot/gtkplotlinear.h
@@ -71,7 +71,7 @@
71 71 gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
72 72 gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
73 73 void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
74   - void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
  74 + void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
75 75 GtkWidget *gtk_plot_linear_new(void);
76 76 G_END_DECLS
77 77 #endif
24 gtk2plot/gtkplotpolar.c
@@ -1758,10 +1758,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
1758 1758 {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);}
1759 1759 cairo_set_source_rgba(cr, vv, wv, xv, yv);
1760 1760 ft=g_array_index((plt->ind), gint, k);
1761   - if (ft>=(plot->ydata->len)) break;
  1761 + if (ft>=(plot->rdata->len)) break;
1762 1762 st=g_array_index((plt->stride), gint, k);
1763 1763 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
1764   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  1764 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
1765 1765 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
1766 1766 {
1767 1767 r=g_array_index((plot->rdata), gdouble, ft);
@@ -2481,10 +2481,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
2481 2481 {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);}
2482 2482 cairo_set_source_rgba(cr, vv, wv, xv, yv);
2483 2483 ft=g_array_index((plt->ind), gint, k);
2484   - if (ft>=(plot->ydata->len)) break;
  2484 + if (ft>=(plot->rdata->len)) break;
2485 2485 st=g_array_index((plt->stride), gint, k);
2486 2486 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
2487   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  2487 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
2488 2488 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
2489 2489 {
2490 2490 r=g_array_index((plot->rdata), gdouble, ft);
@@ -3290,10 +3290,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
3290 3290 {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);}
3291 3291 cairo_set_source_rgba(cr, vv, wv, xv, yv);
3292 3292 ft=g_array_index((plt->ind), gint, k);
3293   - if (ft>=(plot->ydata->len)) break;
  3293 + if (ft>=(plot->rdata->len)) break;
3294 3294 st=g_array_index((plt->stride), gint, k);
3295 3295 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
3296   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  3296 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
3297 3297 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
3298 3298 {
3299 3299 r=g_array_index((plot->rdata), gdouble, ft);
@@ -4093,10 +4093,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
4093 4093 {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);}
4094 4094 cairo_set_source_rgba(cr, vv, wv, xv, yv);
4095 4095 ft=g_array_index((plt->ind), gint, k);
4096   - if (ft>=(plot->ydata->len)) break;
  4096 + if (ft>=(plot->rdata->len)) break;
4097 4097 st=g_array_index((plt->stride), gint, k);
4098 4098 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
4099   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  4099 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
4100 4100 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
4101 4101 {
4102 4102 r=g_array_index((plot->rdata), gdouble, ft);
@@ -4897,10 +4897,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
4897 4897 {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);}
4898 4898 cairo_set_source_rgba(cr, vv, wv, xv, yv);
4899 4899 ft=g_array_index((plt->ind), gint, k);
4900   - if (ft>=(plot->ydata->len)) break;
  4900 + if (ft>=(plot->rdata->len)) break;
4901 4901 st=g_array_index((plt->stride), gint, k);
4902 4902 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
4903   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  4903 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
4904 4904 for (j=ft+st; j<lt; j+=st)
4905 4905 {
4906 4906 r=g_array_index((plot->rdata), gdouble, j);
@@ -5546,12 +5546,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
5546 5546 {(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
5547 5547 }
5548 5548
5549   -void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
  5549 +void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st)
5550 5550 {
5551 5551 if (plot->rdata) g_array_free((plot->rdata), FALSE);
5552 5552 if (plot->thdata) g_array_free((plot->thdata), FALSE);
5553 5553 {(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
5554   - gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
  5554 + gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
5555 5555 }
5556 5556
5557 5557 static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
2  gtk2plot/gtkplotpolar.h
@@ -74,7 +74,7 @@
74 74 gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
75 75 gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
76 76 void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
77   - void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
  77 + void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
78 78 GtkWidget *gtk_plot_polar_new(void);
79 79 G_END_DECLS
80 80 #endif
4 gtk2plot/testplotlinear.c
@@ -512,8 +512,8 @@ void upg(GtkWidget *widget, gpointer data)
512 512
513 513 int main(int argc, char *argv[])
514 514 {
515   - AtkObject *atk_widget, *atk_label;
516   - GArray *caa, *cab, *cag, *car, *nx, *sz, *x, *y;
  515 + AtkObject *atk_label, *atk_widget;
  516 + GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
517 517 gdouble fll, val;
518 518 GtkAccelGroup *accel_group=NULL;
519 519 GtkAdjustment *adj;
4 gtk2plot/testplotpolar.c
@@ -510,8 +510,8 @@ void upg(GtkWidget *widget, gpointer data)
510 510
511 511 int main(int argc, char *argv[])
512 512 {
513   - AtkObject *atk_widget, *atk_label;
514   - GArray *caa, *cab, *cag, *car, *nx, *st, *sz, *x, *y;
  513 + AtkObject *atk_label, *atk_widget;
  514 + GArray *x, *y, *st, *sz, *nx, *car, *cab, *cag, *caa;
515 515 gdouble fll, valx, valy;
516 516 GtkAccelGroup *accel_group=NULL;
517 517 GtkAdjustment *adj;
4 gtk3plot/gtkplot.h
@@ -49,8 +49,8 @@
49 49 };
50 50 void gtk_plot_set_font(GtkPlot *plot, PangoFontDescription *lf, PangoFontDescription *af);
51 51 void gtk_plot_set_colour(GtkPlot *plot, GArray *cl);
52   - void gtk_plot_polar_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
53   - void gtk_plot_polar_set_index(GtkPlot *plot, GArray *nd);
  52 + void gtk_plot_set_indices(GtkPlot *plot, GArray *nd, GArray *sz, GArray *st);
  53 + void gtk_plot_set_index(GtkPlot *plot, GArray *nd);
54 54 GtkWidget *gtk_plot_new(void);
55 55 G_END_DECLS
56 56 #endif
4 gtk3plot/gtkplotlinear.c
@@ -4172,12 +4172,12 @@ void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl)
4172 4172 {(plot->xlab)=g_strdup(xl); (plot->ylab)=g_strdup(yl);}
4173 4173 }
4174 4174
4175   -void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz)
  4175 +void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st)
4176 4176 {
4177 4177 if (plot->xdata) g_array_free((plot->xdata), FALSE);
4178 4178 if (plot->ydata) g_array_free((plot->ydata), FALSE);
4179 4179 {(plot->xdata)=g_array_ref(xd); (plot->ydata)=g_array_ref(yd);}
4180   - gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
  4180 + gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
4181 4181 }
4182 4182
4183 4183 static void gtk_plot_linear_finalise(GtkPlotLinear *plot)
2  gtk3plot/gtkplotlinear.h
@@ -71,7 +71,7 @@
71 71 gboolean gtk_plot_linear_print_png(GtkWidget *widget, gchar *fout);
72 72 gboolean gtk_plot_linear_print_svg(GtkWidget *widget, gchar *fout);
73 73 void gtk_plot_linear_set_label(GtkPlotLinear *plot, gchar *xl, gchar *yl);
74   - void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz);
  74 + void gtk_plot_linear_set_data(GtkPlotLinear *plot, GArray *xd, GArray *yd, GArray *nd, GArray *sz, GArray *st);
75 75 GtkWidget *gtk_plot_linear_new(void);
76 76 G_END_DECLS
77 77 #endif
24 gtk3plot/gtkplotpolar.c
@@ -1755,10 +1755,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
1755 1755 vv=g_array_index((plt->cl), GdkRGBA, ft);
1756 1756 cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
1757 1757 ft=g_array_index((plt->ind), gint, k);
1758   - if (ft>=(plot->ydata->len)) break;
  1758 + if (ft>=(plot->rdata->len)) break;
1759 1759 st=g_array_index((plt->stride), gint, k);
1760 1760 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
1761   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  1761 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
1762 1762 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
1763 1763 {
1764 1764 r=g_array_index((plot->rdata), gdouble, ft);
@@ -2478,10 +2478,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
2478 2478 vv=g_array_index((plt->cl), GdkRGBA, ft);
2479 2479 cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
2480 2480 ft=g_array_index((plt->ind), gint, k);
2481   - if (ft>=(plot->ydata->len)) break;
  2481 + if (ft>=(plot->rdata->len)) break;
2482 2482 st=g_array_index((plt->stride), gint, k);
2483 2483 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
2484   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  2484 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
2485 2485 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
2486 2486 {
2487 2487 r=g_array_index((plot->rdata), gdouble, ft);
@@ -3287,10 +3287,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
3287 3287 vv=g_array_index((plt->cl), GdkRGBA, ft);
3288 3288 cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
3289 3289 ft=g_array_index((plt->ind), gint, k);
3290   - if (ft>=(plot->ydata->len)) break;
  3290 + if (ft>=(plot->rdata->len)) break;
3291 3291 st=g_array_index((plt->stride), gint, k);
3292 3292 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
3293   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  3293 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
3294 3294 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
3295 3295 {
3296 3296 r=g_array_index((plot->rdata), gdouble, ft);
@@ -4090,10 +4090,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
4090 4090 vv=g_array_index((plt->cl), GdkRGBA, ft);
4091 4091 cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
4092 4092 ft=g_array_index((plt->ind), gint, k);
4093   - if (ft>=(plot->ydata->len)) break;
  4093 + if (ft>=(plot->rdata->len)) break;
4094 4094 st=g_array_index((plt->stride), gint, k);
4095 4095 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
4096   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  4096 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
4097 4097 for (ssx=MY_2PI; ssx>-10; ssx-=MY_2PI)
4098 4098 {
4099 4099 r=g_array_index((plot->rdata), gdouble, ft);
@@ -4894,10 +4894,10 @@ static void draw(GtkWidget *widget, cairo_t *cr)
4894 4894 vv=g_array_index((plt->cl), GdkRGBA, ft);
4895 4895 cairo_set_source_rgba(cr, (vv.red), (vv.green), (vv.blue), (vv.alpha));
4896 4896 ft=g_array_index((plt->ind), gint, k);
4897   - if (ft>=(plot->ydata->len)) break;
  4897 + if (ft>=(plot->rdata->len)) break;
4898 4898 st=g_array_index((plt->stride), gint, k);
4899 4899 lt=(g_array_index((plt->sizes), gint, k)*st)+ft;
4900   - if (lt>(plot->ydata->len)) lt=(plot->ydata->len);
  4900 + if (lt>(plot->rdata->len)) lt=(plot->rdata->len);
4901 4901 for (j=ft; j<lt; j+=st)
4902 4902 {
4903 4903 r=g_array_index((plot->rdata), gdouble, j);
@@ -5533,12 +5533,12 @@ void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl)
5533 5533 {(plot->rlab)=g_strdup(rl); (plot->thlab)=g_strdup(tl);}
5534 5534 }
5535 5535
5536   -void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz)
  5536 +void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, Garray *st)
5537 5537 {
5538 5538 if (plot->rdata) g_array_free((plot->rdata), FALSE);
5539 5539 if (plot->thdata) g_array_free((plot->thdata), FALSE);
5540 5540 {(plot->rdata)=g_array_ref(rd); (plot->thdata)=g_array_ref(td);}
5541   - gtk_plot_set_indices(GTK_PLOT(plot), nd, sz);
  5541 + gtk_plot_set_indices(GTK_PLOT(plot), nd, sz, st);
5542 5542 }
5543 5543
5544 5544 static void gtk_plot_polar_finalise(GtkPlotPolar *plot)
2  gtk3plot/gtkplotpolar.h
@@ -74,7 +74,7 @@
74 74 gboolean gtk_plot_polar_print_png(GtkWidget *widget, gchar *fout);
75 75 gboolean gtk_plot_polar_print_svg(GtkWidget *widget, gchar *fout);
76 76 void gtk_plot_polar_set_label(GtkPlotPolar *plot, gchar *rl, gchar *tl);
77   - void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz);
  77 + void gtk_plot_polar_set_data(GtkPlotPolar *plot, GArray *rd, GArray *td, GArray *nd, GArray *sz, GArray *st);
78 78 GtkWidget *gtk_plot_polar_new(void);
79 79 G_END_DECLS
80 80 #endif
2  gtk3plot/testplotpolar.c
@@ -465,13 +465,13 @@ int main(int argc, char *argv[])
465 465 AtkObject *atk_label, *atk_widget;
466 466 GArray *cla, *nx, *st, *sz, *x, *y;
467 467 GdkRGBA cl;
468   - guint j;
469 468 gdouble valx, valy;
470 469 GtkAccelGroup *accel_group=NULL;
471 470 GtkAdjustment *adj;
472 471 GtkPlot *pt;
473 472 GtkPlotPolar *plt;
474 473 GtkWidget *butt, *grid, *grid2, *label, *mnb, *mni, *mnu, *pane;
  474 + guint j;
475 475
476 476 gtk_init(&argc, &argv);
477 477 window=gtk_window_new(GTK_WINDOW_TOPLEVEL);

0 comments on commit c7d069d

Please sign in to comment.
Something went wrong with that request. Please try again.