Re: [guppi-list] Problems with gnome/guppi




On Tue, 8 Jun 1999, Jan-Oliver Wagner wrote:
> 
> - I need the width of canvas text items.
> 	In the corresponding module of libgnomeui
> 	a read-only argument "text_width" is listed.
> 	But how do I get this value?
> 	I thought there must be some function like
> 	gnome_canvas_item_get() as a brother
> 	of gnomer_canvas_item_set(), but I haven't
> 	found it. Any clues?
>

You will want to use gtk_object_getv(); here's an example (iit queries a
GtkContainer argument, but you should be able to extrapolate the way to do
it for the text item):

  GtkArg args[2];
    
  args[0].name = "GtkContainer::border_width";
  args[1].name = "GtkContainer::resize_mode";
  gtk_object_getv(GTK_OBJECT(button), 
                  2, 
                  args);

  g_assert(args[0].type == GTK_TYPE_ULONG);
  g_assert(args[1].type == GTK_TYPE_RESIZE_MODE);
  g_assert(GTK_FUNDAMENTAL_TYPE(args[1].type) == GTK_TYPE_ENUM);

  printf("Border width: %lu Resize mode: %d\n", 
         GTK_VALUE_ULONG(args[0]), GTK_VALUE_ENUM(args[1]));

For text_width you probably want GTK_VALUE_DOUBLE().

However, this may not be the best approach. Ideally, the layout will be
done in the PiePlotState object, which has no knowledge of the
GnomeCanvas. Remember that we will use the PiePlotState to print and so
on, so you need the layout information there.

Thus, instead of using the width of the canvas item, I would use 
VFont::string_width() in vfont.h You can get a font from the Frontend
returned by guppi_frontend() in util.h. 

You can just assume that the width of the text item will be the same as
the width of the VFont. It's possible that this won't be *exactly* true,
but it will be close enough.
 
> - Filling of polygons seems not to work properly,
> 	is that right?
> 

Well, it definitely seems to not work properly. I've CC'd Federico, but
he's well aware of the problem I think. Something is broken in the Canvas.

We could move to GnomeCanvasArc; it seems to have problems with libart
too, but if I move it into guppi we can use libguppi-mi instead for now
until libart is fixed.

> Now more special questions on guppi:
>  
> - How do I select another set of numbers from the list
> 	for plotting than the default=first one?
> 	I feel stupid on this problem.
> 

Do you mean another subset of a dataset, or another dataset? Right now,
you select a dataset by double-clicking the pie or bar chart; in the
future I want to do this like the XY plot, so you'll choose Properties
from the popup menu instead.

There's no way to choose a subset of a dataset right now; you need to add
this feature on a plot-by-plot basis. So for example PiePlotState might
have a "dataset range" property that stored a start and end index, or
maybe you want to store a list of indices instead. You would need to reset
the range with a good default anytime the dataset changed.

> - Starting guppi anew and trying to plot a piechart as
> 	the first action results in a segmentation fault.
> 	However, plotting first a barplot makes it possible
> 	to plot piecharts without problems.
> 	I have compared the barplot and pieplot all the way
> 	and I am pretty sure they do the same (except the plotting
> 	of course).
> 	What might be the reason for this behaviour?
> 

I've seen some of this random crashing. I think it's memory corruption; my
guess is that libart causes it, but it's possible that Guppi does.

Plan of action: I'll post the point() method of GnomeCanvasArc here, so
someone who knows more math than I do can fix it. I don't have a trig book
around and I don't remember what I need to know. Those of you with CVS
access can get this in the 'scratchpad' module.

If someone will fix this function, we'll put GnomeCanvasArc in Guppi and
temporarily hack it to work with libguppi-mi instead of libart. 
Then we'll see if the segfaults go away and we should have a working pie
chart.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]