Help!
- From: "Carlos Alberto Llano Rodriguez" <carlos_llano hotmail com>
- To: gtk-app-devel-list gnome org, owen gtk org
- Subject: Help!
- Date: Thu, 07 Feb 2002 17:24:41
Hello!!!
I have a problem and is that have a vector of points
that they describe me a curve, that vector itself it
step al GtkCurve the paints it but leaves it in free
type (GTK_CURVE_TYPE_FREE), what I need is that the
Too many errors encountered; the rest of the message is ignored:
GtkCurve paint it and leave it in lineal way
(GTK_CURVE_TYPE_LINEAR).
The codigo is the following one:
#include <stdlib.h
#include <string.h
gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
gtk_main_quit();
return(FALSE);
}//close_application
int main( int argc, char *argv[] )
{
GtkWidget *window, *curve;
int count = 0;
gfloat vec[256];
gint max;
gint i;
/**
* Create editor window
*/
gtk_init( &argc, &argv );
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window),
"GtkCurve Test");
gtk_signal_connect(GTK_OBJECT (window),
"delete_event",
GTK_SIGNAL_FUNC(close_application),
NULL);
gtk_container_set_border_width( GTK_CONTAINER
(window), 10 );
gtk_widget_show( window );
/**
* Create curve
*/
curve = gtk_curve_new ();
gtk_container_add (GTK_CONTAINER (window), curve);
gtk_widget_show (curve);
//init points
max = 127 + (count % 2)*128;
//Vector
for (i = 0; i < max; ++i)
vec[i] = (127 / sqrt (max)) * sqrt (i);
gtk_curve_set_range (GTK_CURVE (curve),0, max, 0,
max);
gtk_curve_set_vector (GTK_CURVE (curve),max, vec);
// GTK_CURVE
(curve)-curve_type=GTK_CURVE_TYPE_SPLINE;
//
GTK_CURVE(curve)-curve_type=GTK_CURVE_TYPE_LINEAR;
//gtk_curve_set_curve_type(GTK_CURVE(curve),GTK_CURVE_TYPE_FREE);
// gtk_curve_set_curve_type (GTK_CURVE (curve),
GTK_CURVE_TYPE_LINEAR);
/**
* Show window
*/
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
else if (count % 4 == 3)
{
gtk_widget_destroy (window);
window = NULL;
}
++count;
gtk_main();
return 0;
}//main
for compile:
gcc -Wall -g curve.c -o curve `gtk-config --cflags` \
`gtk-config --libs`
execution: ./curve
Al to try to change the type to lineal leaves this
error. As it can do?? Many
Thanks al that can help me
GLib-ERROR **: could not allocate -20 bytes
aborting...
Abort (core dumped)
Carlos Llano
Carlos Alberto Llano R.
IPTotal Software S.A
Work Telephone: (572)6829757
Email: carlos_llano hotmail com
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]