[genius] Wed Oct 02 17:35:09 2013 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Wed Oct 02 17:35:09 2013 Jiri (George) Lebl <jirka 5z com>
- Date: Wed, 2 Oct 2013 22:34:55 +0000 (UTC)
commit 20d42f689b5a464e73ff76aba4cebcba07f95eb9
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Wed Oct 2 17:35:12 2013 -0500
Wed Oct 02 17:35:09 2013 Jiri (George) Lebl <jirka 5z com>
* gtkextra/*: remove bunch of unused stuff to fix warnings.
* src/graphing.c: Allow setting color in LinePlotDrawLine as a
3-vector of RGB values in the range of 0 to 1.
* help/C/genius.xml: Document changes to LinePlotDrawLine and
rewrite part of that entry.
* src/graphing.c: Allow zooming by selecting when we just do
LinePlotDrawLine and not a LinePlot first.
ChangeLog | 13 ++++++
gtkextra/gtkplotcairo.c | 13 +-----
gtkextra/gtkplotcsurface.c | 3 -
gtkextra/gtkplotdata.c | 23 +++--------
gtkextra/gtkplotflux.c | 15 +-----
gtkextra/gtkplotgdk.c | 15 ++-----
gtkextra/gtkplotpc.c | 7 ---
gtkextra/gtkplotpixmap.c | 2 -
gtkextra/gtkplotpolar.c | 18 +-------
gtkextra/gtkplotps.c | 5 --
gtkextra/gtkplotsurface.c | 23 +++-------
help/C/genius.xml | 49 +++++++++++++++-------
src/graphing.c | 98 +++++++++++++++++++++++++++++++++----------
13 files changed, 147 insertions(+), 137 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 19128cd..f7cc633 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Wed Oct 02 17:35:09 2013 Jiri (George) Lebl <jirka 5z com>
+
+ * gtkextra/*: remove bunch of unused stuff to fix warnings.
+
+ * src/graphing.c: Allow setting color in LinePlotDrawLine as a
+ 3-vector of RGB values in the range of 0 to 1.
+
+ * help/C/genius.xml: Document changes to LinePlotDrawLine and
+ rewrite part of that entry.
+
+ * src/graphing.c: Allow zooming by selecting when we just do
+ LinePlotDrawLine and not a LinePlot first.
+
Tue Oct 01 21:35:09 2013 Jiri (George) Lebl <jirka 5z com>
* autogen.sh, configure.in: updates, for example we still refer
diff --git a/gtkextra/gtkplotcairo.c b/gtkextra/gtkplotcairo.c
index ee9ff11..e0c5147 100644
--- a/gtkextra/gtkplotcairo.c
+++ b/gtkextra/gtkplotcairo.c
@@ -185,18 +185,14 @@ gtk_plot_cairo_init (GtkPlotCairo *pc)
static void
gtk_plot_cairo_class_init (GtkPlotCairoClass *klass)
{
- GtkObjectClass *object_class;
GObjectClass *gobject_class;
GtkPlotPCClass *pc_class;
- GtkPlotCairoClass *cairo_class;
parent_class = g_type_class_ref (gtk_plot_pc_get_type ());
- object_class = (GtkObjectClass *) klass;
gobject_class = (GObjectClass *) klass;
pc_class = (GtkPlotPCClass *) klass;
- cairo_class = (GtkPlotCairoClass *) klass;
gobject_class->finalize = gtk_plot_cairo_finalize;
@@ -649,7 +645,8 @@ drawstring(GtkPlotPC *pc,
cairo_restore(cairo);
pango_font_description_free(font);
ret_value = (angle == 0 || angle == 180) ? rect.width : rect.height;
- return PANGO_PIXELS(rect.width);
+ /*return PANGO_PIXELS(rect.width);*/
+ return PANGO_PIXELS(ret_value);
}
static void
@@ -690,7 +687,6 @@ gtk_plot_cairo_draw_string (GtkPlotPC *pc,
gchar num[4];
PangoRectangle rect;
PangoLayout *layout = NULL;
- gint real_x, real_y, real_width, real_height;
GdkColor real_fg = *fg;
GdkColor real_bg = *bg;
gint sign_x = 1, sign_y = 0;
@@ -851,11 +847,6 @@ gtk_plot_cairo_draw_string (GtkPlotPC *pc,
}
}
- real_x = tx;
- real_y = ty;
- real_width = width;
- real_height = height;
-
if(!transparent){
gtk_plot_cairo_set_color(pc, &real_bg);
gtk_plot_cairo_draw_rectangle(pc, TRUE, old_tx, old_ty, old_width, old_height);
diff --git a/gtkextra/gtkplotcsurface.c b/gtkextra/gtkplotcsurface.c
index 216fe64..b448d78 100644
--- a/gtkextra/gtkplotcsurface.c
+++ b/gtkextra/gtkplotcsurface.c
@@ -369,13 +369,10 @@ update_data (GtkPlotData *data)
static void
gtk_plot_csurface_init (GtkPlotCSurface *dataset)
{
- GtkWidget *widget;
GtkPlotArray *dim;
gtk_widget_set_has_window(GTK_WIDGET(dataset), FALSE);
- widget = GTK_WIDGET(dataset);
-
GTK_PLOT_DATA(dataset)->show_gradient = TRUE;
GTK_PLOT_DATA(dataset)->show_labels = TRUE;
GTK_PLOT_DATA(dataset)->gradient_custom = TRUE;
diff --git a/gtkextra/gtkplotdata.c b/gtkextra/gtkplotdata.c
index 9b28d9c..cbf1549 100644
--- a/gtkextra/gtkplotdata.c
+++ b/gtkextra/gtkplotdata.c
@@ -2493,7 +2493,6 @@ gtk_plot_data_real_draw (GtkPlotData *dataset,
GtkWidget *widget;
GtkPlot *plot = NULL;
GtkPlotData *function;
- GdkRectangle area;
gdouble x, y, z = 0., a = 0.;
gdouble dx = 0., dy = 0., dz = 0., da = 0.;
gdouble *fx = NULL;
@@ -2519,10 +2518,6 @@ gtk_plot_data_real_draw (GtkPlotData *dataset,
gtk_plot_pc_gsave(plot->pc);
gtk_widget_get_allocation(widget, &allocation);
- area.x = allocation.x;
- area.y = allocation.y;
- area.width = allocation.width;
- area.height = allocation.height;
if(dataset->is_function)
{
@@ -3652,7 +3647,7 @@ gtk_plot_data_set_gradient_size(GtkPlotData *data, gint size)
{
GtkPlot *plot = NULL;
GtkPlotText legend;
- gint lascent = 0, ldescent = 0, lheight = 0, lwidth = 0;
+ gint lheight = 0, lwidth = 0;
gint tascent = 0, tdescent = 0, theight = 0, twidth = 0;
gint maxascent = 0, maxdescent = 0, maxheight = 0, maxwidth = 0;
gint minascent = 0, mindescent = 0, minheight = 0, minwidth = 0;
@@ -3705,8 +3700,6 @@ gtk_plot_data_set_gradient_size(GtkPlotData *data, gint size)
lwidth = MAX(minwidth, maxwidth);
lheight = MAX(minheight, maxheight);
- lascent = MAX(minascent, maxascent);
- ldescent = MAX(mindescent, maxdescent);
if(data->gradient_title_pos == GTK_PLOT_AXIS_LEFT ||
data->gradient_title_pos == GTK_PLOT_AXIS_RIGHT)
@@ -3774,7 +3767,7 @@ gtk_plot_data_get_gradient_size(GtkPlotData *data, gint *width, gint *height)
{
GtkPlot *plot = NULL;
GtkPlotText legend;
- gint lascent = 0, ldescent = 0, lheight = 0, lwidth = 0;
+ gint lheight = 0, lwidth = 0;
gint tascent = 0, tdescent = 0, theight = 0, twidth = 0;
gint maxascent = 0, maxdescent = 0, maxheight = 0, maxwidth = 0;
gint minascent = 0, mindescent = 0, minheight = 0, minwidth = 0;
@@ -3833,8 +3826,6 @@ gtk_plot_data_get_gradient_size(GtkPlotData *data, gint *width, gint *height)
lwidth = MAX(minwidth, maxwidth);
lheight = MAX(minheight, maxheight);
- lascent = MAX(minascent, maxascent);
- ldescent = MAX(mindescent, maxdescent);
if(data->gradient_title_pos == GTK_PLOT_AXIS_LEFT ||
data->gradient_title_pos == GTK_PLOT_AXIS_RIGHT)
@@ -3995,11 +3986,10 @@ gtk_plot_data_draw_symbol_private (GtkPlotData *data,
gdouble x, gdouble y,
GtkPlotSymbol symbol)
{
- GtkWidget *widget;
GtkPlot *plot;
gdouble x0, y0;
gdouble px0, py0;
- GdkRectangle clip_area;
+ //GdkRectangle clip_area;
gboolean filled;
gint size;
gdouble m;
@@ -4007,14 +3997,15 @@ gtk_plot_data_draw_symbol_private (GtkPlotData *data,
if(symbol.symbol_type == GTK_PLOT_SYMBOL_NONE) return;
plot = data->plot;
- widget = GTK_WIDGET(plot);
m = plot->magnification;
+ /*
clip_area.x = plot->internal_allocation.x;
clip_area.y = plot->internal_allocation.y;
clip_area.width = plot->internal_allocation.width;
clip_area.height = plot->internal_allocation.height;
+ */
/*
gdk_gc_set_clip_rectangle(gc, &clip_area);
@@ -4364,7 +4355,6 @@ gtk_plot_data_draw_errbars(GtkPlotData *dataset,
gdouble x, gdouble y, gdouble z,
gdouble dx, gdouble dy, gdouble dz)
{
- GtkWidget *widget;
GtkPlot *plot;
GtkPlotPoint errbar[6];
gdouble px, py;
@@ -4372,7 +4362,6 @@ gtk_plot_data_draw_errbars(GtkPlotData *dataset,
gdouble m;
plot = dataset->plot;
- widget = GTK_WIDGET(plot);
m = plot->magnification;
if(!dataset->show_xerrbars && !dataset->show_yerrbars && !dataset->show_zerrbars) return;
@@ -6693,7 +6682,7 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
*h = (g - b) / delta;
else if (g == max)
*h = 2.0 + (b - r) / delta;
- else if (b == max)
+ else /* if (b == max) */
*h = 4.0 + (r - g) / delta;
*h = *h * 60.0;
diff --git a/gtkextra/gtkplotflux.c b/gtkextra/gtkplotflux.c
index b5ccd82..f1a2994 100644
--- a/gtkextra/gtkplotflux.c
+++ b/gtkextra/gtkplotflux.c
@@ -109,14 +109,12 @@ static void
gtk_plot_flux_class_init (GtkPlotFluxClass *klass)
{
GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
GtkPlotDataClass *data_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
gobject_class->set_property = gtk_plot_flux_set_property;
@@ -276,13 +274,10 @@ gtk_plot_flux_class_init (GtkPlotFluxClass *klass)
static void
gtk_plot_flux_init (GtkPlotFlux *dataset)
{
- GtkWidget *widget;
GdkColor black, white;
GdkColormap *colormap;
GtkPlotArray *dim;
- widget = GTK_WIDGET(dataset);
-
colormap = gdk_colormap_get_system();
gdk_color_black(colormap, &black);
@@ -462,7 +457,7 @@ gtk_plot_flux_draw_symbol(GtkPlotData *dataset,
{
GtkPlot *plot;
GtkPlotFlux *flux = NULL;
- GdkRectangle area, clip_area;
+ GdkRectangle area; //, clip_area;
gdouble m;
gdouble x1 = 0.0, y1 = 0.0, x2 = 0.0, y2=0.0;
gdouble factor, size, xm;
@@ -484,25 +479,24 @@ gtk_plot_flux_draw_symbol(GtkPlotData *dataset,
area.width = allocation.width;
area.height = allocation.height;
+ /*
clip_area.x = area.x + roundint(plot->x * area.width);
clip_area.y = area.y + roundint(plot->y * area.height);
clip_area.width = roundint(plot->width * area.width);
clip_area.height = roundint(plot->height * area.height);
-/*
gtk_plot_pc_clip(plot->pc, &clip_area);
*/
if(GTK_IS_PLOT3D(plot)){
- gdouble z1, z2 = 0;
+ gdouble z1;
xm = sqrt(dx * dx + dy * dy + dz * dz);
factor = xm / flux->scale_max;
size = factor * flux->size_max;
x2 = size * dx / xm;
y2 = size * dy / xm;
- z2 = size * dz / xm;
gtk_plot3d_get_pixel(GTK_PLOT3D(plot), x, y, z,
&x1, &y1, &z1);
@@ -592,7 +586,6 @@ gtk_plot_flux_draw_legend(GtkPlotData *data, gint x, gint y)
GdkRectangle area;
gint lascent, ldescent, lheight, lwidth;
gdouble m;
- gint line_width;
gboolean centered;
GtkAllocation allocation;
@@ -624,8 +617,6 @@ gtk_plot_flux_draw_legend(GtkPlotData *data, gint x, gint y)
&lascent, &ldescent);
if(data->show_legend){
- line_width = plot->legends_line_width;
-
legend.x = (gdouble)(area.x + x) / (gdouble)area.width;
legend.y = (gdouble)(area.y + y + lascent) / (gdouble)area.height;
diff --git a/gtkextra/gtkplotgdk.c b/gtkextra/gtkplotgdk.c
index 0050049..a5c8d32 100644
--- a/gtkextra/gtkplotgdk.c
+++ b/gtkextra/gtkplotgdk.c
@@ -196,14 +196,12 @@ gtk_plot_gdk_init (GtkPlotGdk *pc)
static void
gtk_plot_gdk_class_init (GtkPlotGdkClass *klass)
{
- GtkObjectClass *object_class;
GObjectClass *gobject_class;
GtkPlotPCClass *pc_class;
GtkPlotGdkClass *gdk_class;
parent_class = g_type_class_ref (gtk_plot_pc_get_type ());
- object_class = (GtkObjectClass *) klass;
gobject_class = (GObjectClass *) klass;
pc_class = (GtkPlotPCClass *) klass;
@@ -597,7 +595,8 @@ drawstring(GtkPlotPC *pc,
}
if (font) pango_font_description_free(font);
ret_value = (angle == 0 || angle == 180) ? rect.width : rect.height;
- return PANGO_PIXELS(rect.width);
+ /*return PANGO_PIXELS(rect.width);*/
+ return PANGO_PIXELS(ret_value);
}
static void
@@ -639,7 +638,6 @@ gtk_plot_gdk_draw_string (GtkPlotPC *pc,
PangoRectangle rect;
PangoFontMetrics *metrics = NULL;
PangoLayout *layout = NULL;
- gint real_x, real_y, real_width, real_height;
GdkColor real_fg = *fg;
GdkColor real_bg = *bg;
PangoMatrix matrix = PANGO_MATRIX_INIT;
@@ -764,11 +762,6 @@ gtk_plot_gdk_draw_string (GtkPlotPC *pc,
}
}
- real_x = tx;
- real_y = ty;
- real_width = width;
- real_height = height;
-
pango_matrix_rotate (&matrix, angle);
pango_context_set_matrix (context, &matrix);
pango_layout_context_changed (layout);
@@ -1107,8 +1100,8 @@ scale_pixmap (GdkWindow *window, GdkPixmap *pixmap, gdouble scale_x, gdouble sca
new_pixmap = gdk_pixmap_new(pixmap, new_width, new_height, -1);
gdk_draw_pixbuf(new_pixmap, gc, aux_pixbuf, 0, 0, 0, 0, new_width, new_height, GDK_RGB_DITHER_MAX, 0, 0);
- gdk_pixbuf_unref(pixbuf);
- gdk_pixbuf_unref(aux_pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ g_object_unref (G_OBJECT (aux_pixbuf));
gdk_gc_unref(gc);
diff --git a/gtkextra/gtkplotpc.c b/gtkextra/gtkplotpc.c
index 6197b2e..4d9477f 100644
--- a/gtkextra/gtkplotpc.c
+++ b/gtkextra/gtkplotpc.c
@@ -66,14 +66,7 @@ gtk_plot_pc_get_type (void)
static void
gtk_plot_pc_class_init (GtkPlotPCClass *klass)
{
- GtkObjectClass *object_class;
- GtkPlotPCClass *pc_class;
-
parent_class = g_type_class_ref (gtk_object_get_type ());
-
- object_class = (GtkObjectClass *) klass;
- pc_class = (GtkPlotPCClass *) klass;
-
}
static void
diff --git a/gtkextra/gtkplotpixmap.c b/gtkextra/gtkplotpixmap.c
index 1c893b6..d7655c0 100644
--- a/gtkextra/gtkplotpixmap.c
+++ b/gtkextra/gtkplotpixmap.c
@@ -101,14 +101,12 @@ static void
gtk_plot_pixmap_class_init (GtkPlotPixmapClass *klass)
{
GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
GtkPlotDataClass *data_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
data_class->clone = gtk_plot_pixmap_clone;
diff --git a/gtkextra/gtkplotpolar.c b/gtkextra/gtkplotpolar.c
index 73b3b87..9e3e395 100644
--- a/gtkextra/gtkplotpolar.c
+++ b/gtkextra/gtkplotpolar.c
@@ -104,13 +104,11 @@ static void
gtk_plot_polar_class_init (GtkPlotPolarClass *klass)
{
GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
GtkPlotClass *plot_class;
parent_class = g_type_class_ref (gtk_plot_get_type ());
gobject_class = G_OBJECT_CLASS(klass);
- widget_class = (GtkWidgetClass *) klass;
plot_class = (GtkPlotClass *) klass;
gobject_class->set_property = gtk_plot_polar_set_property;
@@ -227,8 +225,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
{
GtkPlot *plot;
GtkPlotText *child_text;
- GtkStyle *style;
- GdkPixmap *pixmap;
+ //GdkPixmap *pixmap;
GList *dataset;
GList *text;
gint width, height;
@@ -244,9 +241,7 @@ gtk_plot_polar_real_paint (GtkWidget *widget)
width = plot->internal_allocation.width;
height = plot->internal_allocation.height;
- style = gtk_widget_get_style(widget);
-
- pixmap = plot->drawable;
+ //pixmap = plot->drawable;
gtk_plot_pc_gsave(plot->pc);
gtk_plot_pc_set_color(plot->pc, &plot->background);
@@ -401,17 +396,15 @@ gtk_plot_polar_construct_with_size(GtkPlotPolar *plot, GdkDrawable *drawable, gd
static void
gtk_plot_polar_draw_grids(GtkPlotPolar *polar)
{
- GtkWidget *widget;
GtkPlot *plot;
gdouble ix, iy;
gdouble x1, y1, x2, y2;
- gdouble width, height, size;
+ gdouble width, height;
gdouble xp, yp;
gint ntick;
gdouble ox, oy;
gdouble rotation;
- widget = GTK_WIDGET(polar);
plot = GTK_PLOT(polar);
rotation = polar->rotation;
@@ -423,7 +416,6 @@ gtk_plot_polar_draw_grids(GtkPlotPolar *polar)
ox = xp + width / 2.;
oy = yp + height / 2.;
- size = MIN(width, height) / 2.;
if(plot->bottom->show_minor_grid)
{
@@ -505,7 +497,6 @@ static void
gtk_plot_polar_draw_axis(GtkPlotPolar *polar,
GtkPlotAxis *axis, GtkPlotVector tick_direction)
{
- GtkWidget *widget;
GtkPlot *plot;
gdouble x, y;
gdouble xx, yy;
@@ -517,7 +508,6 @@ gtk_plot_polar_draw_axis(GtkPlotPolar *polar,
gdouble ox, oy;
gdouble x0, y0;
- widget = GTK_WIDGET(polar);
plot = GTK_PLOT(polar);
m = plot->magnification;
@@ -762,7 +752,6 @@ gtk_plot_polar_draw_circle(GtkPlotPolar *polar)
GtkPlotText tick;
gchar label[100];
gdouble x, y;
- gint line_width;
gdouble xp, yp, width, height, size;
gint ntick;
gdouble m;
@@ -795,7 +784,6 @@ gtk_plot_polar_draw_circle(GtkPlotPolar *polar)
axis = plot->bottom;
- line_width = axis->line.line_width;
gtk_plot_pc_set_color(plot->pc, &axis->line.color);
gtk_plot_pc_set_lineattr(plot->pc, axis->line.line_width, 0, 3, 0);
diff --git a/gtkextra/gtkplotps.c b/gtkextra/gtkplotps.c
index 1805a00..fcb0ee4 100644
--- a/gtkextra/gtkplotps.c
+++ b/gtkextra/gtkplotps.c
@@ -165,13 +165,11 @@ static void
gtk_plot_ps_class_init (GtkPlotPSClass *klass)
{
GtkObjectClass *object_class;
- GObjectClass *gobject_class;
GtkPlotPCClass *pc_class;
parent_class = g_type_class_ref (gtk_plot_pc_get_type ());
object_class = (GtkObjectClass *) klass;
- gobject_class = (GObjectClass *) klass;
pc_class = (GtkPlotPCClass *) klass;
pc_class->init = psinit;
@@ -908,7 +906,6 @@ psdrawstring (GtkPlotPC *pc,
const gchar *text)
{
- gchar *currfont;
const gchar *c;
GtkPSFont *psfont, *base_psfont, *latin_psfont = NULL;
gint curcnt = 0, offset = 0;
@@ -934,8 +931,6 @@ psdrawstring (GtkPlotPC *pc,
italic = psfont->italic;
bold = psfont->bold;
- currfont = psfont->psname;
-
if (psfont->i18n_latinfamily) {
latin_psfont = gtk_psfont_get_by_family(psfont->i18n_latinfamily, italic,
bold);
diff --git a/gtkextra/gtkplotsurface.c b/gtkextra/gtkplotsurface.c
index efb0126..bb2e3f6 100644
--- a/gtkextra/gtkplotsurface.c
+++ b/gtkextra/gtkplotsurface.c
@@ -143,7 +143,6 @@ static void
gtk_plot_surface_class_init (GtkPlotSurfaceClass *klass)
{
GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
GtkPlotDataClass *data_class;
GtkPlotSurfaceClass *surface_class;
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
@@ -151,7 +150,6 @@ gtk_plot_surface_class_init (GtkPlotSurfaceClass *klass)
parent_class = g_type_class_ref (gtk_plot_data_get_type ());
object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
data_class = (GtkPlotDataClass *) klass;
surface_class = (GtkPlotSurfaceClass *) klass;
@@ -787,7 +785,6 @@ gtk_plot_surface_draw_polygons (GtkPlotSurface *surface)
GtkPlotData *data;
GtkPlotPoint t[3];
GtkPlotDTtriangle *triangle;
- GdkDrawable *drawable;
gboolean visible = TRUE;
GtkPlotVector side1, side2, light, normal;
GdkColor color, real_color;
@@ -800,7 +797,6 @@ gtk_plot_surface_draw_polygons (GtkPlotSurface *surface)
data = GTK_PLOT_DATA(surface);
plot = GTK_PLOT(data->plot);
- drawable = plot->drawable;
gtk_plot_set_line_attributes(plot, surface->mesh_line);
array_a = gtk_plot_data_get_a(GTK_PLOT_DATA(surface), &n);
@@ -935,14 +931,11 @@ gtk_plot_surface_draw_polygons (GtkPlotSurface *surface)
static void
gtk_plot_surface_get_legend_size(GtkPlotData *data, gint *width, gint *height)
{
- GtkPlotSurface *surface;
GtkPlot *plot = NULL;
GtkPlotText legend;
gint lascent = 0, ldescent = 0, lheight = 0, lwidth = 0;
gdouble m;
- surface = GTK_PLOT_SURFACE(data);
-
g_return_if_fail(data->plot != NULL);
g_return_if_fail(GTK_IS_PLOT(data->plot));
@@ -1185,7 +1178,7 @@ rgb_to_hsv (gdouble r, gdouble g, gdouble b,
*h = (g - b) / delta;
else if (g == max)
*h = 2.0 + (b - r) / delta;
- else if (b == max)
+ else /* if (b == max) */
*h = 4.0 + (r - g) / delta;
*h = *h * 60.0;
@@ -1890,12 +1883,10 @@ gtk_plot_surface_real_build_mesh(GtkPlotSurface *surface)
{
GtkPlotData *data;
gdouble *array_x, *array_y, *array_z;
- GtkPlot *plot;
gint i;
data = GTK_PLOT_DATA(surface);
if(!data->plot) return;
- plot = data->plot;
if(data->num_points == 0) return;
@@ -2195,8 +2186,8 @@ compare_func (gpointer a, gpointer b)
for(i = 0; i < 3; i++){
gdouble n1[3], n2[3];
gdouble t1, t2, det;
- gdouble x1, x2;
- gdouble y1, y2;
+ //gdouble x1, x2;
+ //gdouble y1, y2;
gdouble z1, z2;
gint ia0 = naz[i];
gint ja0 = naz[i == 2 ? 0 : i+1];
@@ -2223,11 +2214,11 @@ compare_func (gpointer a, gpointer b)
t2 = (-n1[0]*c2+n1[1]*c1) / det;
if(t1 < -0.0001 || t2 < -0.0001) continue;
if(t1 > 1.0001 || t2 > 1.0001) continue;
- x1 = pax[ia0] + t1 * n1[0];
- y1 = pay[ia0] + t1 * n1[1];
+ //x1 = pax[ia0] + t1 * n1[0];
+ //y1 = pay[ia0] + t1 * n1[1];
z1 = paz[ia0] + t1 * n1[2];
- x2 = pbx[ib0] + t2 * n2[0];
- y2 = pby[ib0] + t2 * n2[1];
+ //x2 = pbx[ib0] + t2 * n2[0];
+ //y2 = pby[ib0] + t2 * n2[1];
z2 = pbz[ib0] + t2 * n2[2];
if(z1 < z2) return 1;
if(z2 < z1) return -1;
diff --git a/help/C/genius.xml b/help/C/genius.xml
index 0a57957..45941c2 100644
--- a/help/C/genius.xml
+++ b/help/C/genius.xml
@@ -3,8 +3,8 @@
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY app "<application>Genius Mathematics Tool</application>">
<!ENTITY appname "Genius">
- <!ENTITY appversion "1.0.17">
- <!ENTITY date "June 2013">
+ <!ENTITY appversion "1.0.18">
+ <!ENTITY date "October 2013">
<!ENTITY legal SYSTEM "legal.xml">
@@ -8263,23 +8263,41 @@ and has period <userinput>b-a</userinput>.</para>
</para>
<para>
Extra parameters can be added to specify line color, thickness,
- arrows, and the plotting window.
- You can do this by adding a string <userinput>"color"</userinput>,
+ arrows, the plotting window, or legend.
+ You can do this by adding an argument string <userinput>"color"</userinput>,
<userinput>"thickness"</userinput>,
- <userinput>"window"</userinput>, or
- <userinput>"arrow"</userinput>, and after it either
- the color string, the thicknes as an integer, the window
- as 4-vector, and for arrow either
+ <userinput>"window"</userinput>,
+ <userinput>"arrow"</userinput>, or <userinput>"legend"</userinput>, and after it specify
+ the color, the thicknes, the window
+ as 4-vector, type of arrow, or the legend.
+ </para>
+ <para>
+ The color should be either a string indicating the common english word for the color
+ that GTK will recognize such as
+ <userinput>"red"</userinput>, <userinput>"blue"</userinput>, <userinput>"yellow"</userinput>,
etc...
+ Alternatively the color can be specified in RGB format as
+ <userinput>"#rgb"</userinput>, <userinput>"#rrggbb"</userinput>, or
+ <userinput>"#rrrrggggbbbb"</userinput>, where the r, g, or b are hex digits of the red, green,
and blue
+ components of the color. Finally the color can also be specified as a real vector specifying the
red green
+ and blue components where the components are between 0 and 1.
+ </para>
+ <para>
+ The window should be given as usual as <userinput>[x1,x2,y1,y2]</userinput>, or
+ alternatively can be given as a string
+ <userinput>"fit"</userinput> in which case,
+ the x range will be set precisely and the y range will be set with
+ five percent borders around the line.
+ </para>
+ <para>
+ Arrow specification should be
<userinput>"origin"</userinput>,
<userinput>"end"</userinput>,
<userinput>"both"</userinput>, or
- <userinput>"none"</userinput>. For
- <userinput>"window"</userinput> we can specify
- <userinput>"fit"</userinput> rather than a vector in which case,
- the x range will be set precisely and the y range will be set with
- five percent borders around the line. Finally, the legend
- can be specified by adding
- <userinput>"legend"</userinput> and the string with the legend.
+ <userinput>"none"</userinput>.
+ </para>
+ <para>
+ Finally, legend should be a string that can be used as the legend in the
+ graph. That is, if legends are being printed.
</para>
<para>
Examples:
@@ -8287,6 +8305,7 @@ and has period <userinput>b-a</userinput>.</para>
<prompt>genius></prompt> <userinput>LinePlotDrawLine([0,0;1,-1;-1,-1])</userinput>
<prompt>genius></prompt> <userinput>LinePlotDrawLine([0,0;1,1],"arrow","end")</userinput>
<prompt>genius></prompt>
<userinput>LinePlotDrawLine(EulersMethodFull(`(x,y)=y,0,3,100),"color","blue","legend","The
Solution")</userinput>
+<prompt>genius></prompt> <userinput>for r=0.0 to 1.0 by 0.1 do
LinePlotDrawLine([0,0;1,r],"color",[r,(1-r),0.5],"window",[0,1,0,1])</userinput>
</screen>
</para>
</listitem>
diff --git a/src/graphing.c b/src/graphing.c
index 0a29ae9..426ae7a 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -1651,7 +1651,6 @@ plot_select_region (GtkPlotCanvas *canvas,
return;
}
-
/* only for line plots! */
if (plot_in_progress == 0 && line_plot != NULL) {
dozoom_xmin = xmin;
@@ -1717,6 +1716,9 @@ add_line_plot (void)
1.0-PROPORTION_OFFSETX,
1.0-PROPORTION_OFFSETY);
+ GTK_PLOT_CANVAS_SET_FLAGS (GTK_PLOT_CANVAS (plot_canvas),
+ GTK_PLOT_CANVAS_CAN_SELECT);
+
top = gtk_plot_get_axis (GTK_PLOT (line_plot), GTK_PLOT_AXIS_TOP);
right = gtk_plot_get_axis (GTK_PLOT (line_plot), GTK_PLOT_AXIS_RIGHT);
bottom = gtk_plot_get_axis (GTK_PLOT (line_plot), GTK_PLOT_AXIS_BOTTOM);
@@ -1779,6 +1781,9 @@ add_surface_plot (void)
0.8,
1.0-PROPORTION3D_OFFSET);
+ GTK_PLOT_CANVAS_UNSET_FLAGS (GTK_PLOT_CANVAS (plot_canvas),
+ GTK_PLOT_CANVAS_CAN_SELECT);
+
xy = gtk_plot3d_get_side (GTK_PLOT3D (surface_plot), GTK_PLOT_SIDE_XY);
xz = gtk_plot3d_get_side (GTK_PLOT3D (surface_plot), GTK_PLOT_SIDE_XZ);
yx = gtk_plot3d_get_side (GTK_PLOT3D (surface_plot), GTK_PLOT_SIDE_YX);
@@ -4536,9 +4541,6 @@ plot_functions (gboolean do_window_present,
add_line_plot ();
- GTK_PLOT_CANVAS_SET_FLAGS (GTK_PLOT_CANVAS (plot_canvas),
- GTK_PLOT_CANVAS_CAN_SELECT);
-
plot_in_progress ++;
plot_window_setup ();
gtk_plot_freeze (GTK_PLOT (line_plot));
@@ -4754,9 +4756,6 @@ plot_surface_functions (gboolean do_window_present, gboolean fit_function)
add_surface_plot ();
- GTK_PLOT_CANVAS_UNSET_FLAGS (GTK_PLOT_CANVAS (plot_canvas),
- GTK_PLOT_CANVAS_CAN_SELECT);
-
plot_in_progress ++;
plot_window_setup ();
@@ -8156,6 +8155,74 @@ draw_arrowhead (double xx1, double yy1, double xx2, double yy2,
draw_line (ax, ay, 3, thickness, color, NULL /*legend*/);
}
+static gboolean
+get_color (GelETree *a, GdkColor *c, const char *funcname)
+{
+ if (a == NULL) {
+ gel_errorout (_("%s: No color specified"),
+ funcname);
+ return FALSE;
+ } else if (a->type == GEL_STRING_NODE) {
+ if ( ! gdk_color_parse (a->str.str, c)) {
+ gel_errorout (_("%s: Cannot parse color '%s'"),
+ funcname, a->str.str);
+ return FALSE;
+ }
+ return TRUE;
+ } else if (a->type == GEL_IDENTIFIER_NODE) {
+ if ( ! gdk_color_parse (a->id.id->token, c)) {
+ gel_errorout (_("%s: Cannot parse color '%s'"),
+ funcname, a->id.id->token);
+ return FALSE;
+ }
+ return TRUE;
+ } else if (a->type == GEL_MATRIX_NODE) {
+ GelMatrixW *m = a->mat.matrix;
+ GelETree *t;
+ double r;
+ double g;
+ double b;
+
+ if G_UNLIKELY ( ! gel_is_matrix_value_only_real (m) ||
+ gel_matrixw_elements(m) != 3) {
+ gel_errorout (_("%s: A vector giving color should be a 3-vector of real numbers
between 0 and 1"),
+ funcname);
+ return FALSE;
+ }
+ /* we know we have 3 values, so we always get non-null t here that's a value node */
+ t = gel_matrixw_vindex (m, 0);
+ r = mpw_get_double (t->val.value);
+ t = gel_matrixw_vindex (m, 1);
+ g = mpw_get_double (t->val.value);
+ t = gel_matrixw_vindex (m, 2);
+ b = mpw_get_double (t->val.value);
+
+#define FUDGE 0.000001
+ if G_UNLIKELY ( r < -FUDGE || r > (1+FUDGE) ||
+ g < -FUDGE || g > (1+FUDGE) ||
+ b < -FUDGE || b > (1+FUDGE) ) {
+ gel_errorout (_("%s: Warning: Values for red, green, or blue out of range (0 to 1), I
will clip them to this interval"),
+ funcname);
+ }
+#undef FUDGE
+ r = MAX(MIN(r,1.0),0.0);
+ g = MAX(MIN(g,1.0),0.0);
+ b = MAX(MIN(b,1.0),0.0);
+
+ c->red = MAX(MIN(r*65535,65535),0);
+ c->green = MAX(MIN(g*65535,65535),0);
+ c->blue = MAX(MIN(b*65535,65535),0);
+
+ return TRUE;
+ }
+
+
+ gel_errorout (_("%s: Color must be a string or a three-vector of rgb values (between 0 and 1)"),
+ funcname);
+
+ return FALSE;
+}
+
static GelETree *
LinePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
@@ -8247,22 +8314,7 @@ LinePlotDrawLine_op (GelCtx *ctx, GelETree * * a, int *exception)
else
id = a[i]->id.id;
if (id == colorid) {
- if G_UNLIKELY (a[i+1] == NULL) {
- gel_errorout (_("%s: No color specified"),
- "LinePlotDrawLine");
- g_free (legend);
- g_free (x);
- g_free (y);
- return NULL;
- }
- /* FIXME: helper routine for getting color */
- if (a[i+1]->type == GEL_STRING_NODE) {
- gdk_color_parse (a[i+1]->str.str, &color);
- } else if (a[i+1]->type == GEL_IDENTIFIER_NODE) {
- gdk_color_parse (a[i+1]->id.id->token, &color);
- } else {
- gel_errorout (_("%s: Color must be a string"),
- "LinePlotDrawLine");
+ if G_UNLIKELY ( ! get_color (a[i+1], &color, "LinePlotDrawLine")) {
g_free (legend);
g_free (x);
g_free (y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]