Re: GtkExtra under windows 98!!

Richard Gipps <[email protected]> Tue, 27 Jun 2006 22:37:30 +1000
Newsgroups gmane.comp.scigraphica.gtkextra
Message-ID <[email protected]>
Hi Adrian,
             I would be more than happy to write an FAQ on using MinGW and 
gtkextra. It may take a few weeks though as I am busy trying to finish off 
a presentation for my software application (P-Syn) which uses gtkplot!

I will let you know when I have something to review - hang in there!

Regards,
Richard.

At 11:03 27/06/06, you wrote:
>Hi Richard!
>
>Thank you for helping out with this. I was wondering if you have some 
>spare time to write a short FAQ or step-by-step intructions of how to 
>compile gtkextra under MinGW (maybe you can also tell how to 
>install/compile dependencies, including gtk+). It would really be very 
>helpful, and the project would benefit greatly from that, including 
>SciGraphica.
>
>Let me know if you can. I would really appreciate it!
>Saludos!,
><ADRIAN>
>
>
>Richard Gipps wrote:
>
>>I could not get the file through as it was too big so I have just 
>>attached the C file and the make file.
>>
>>------------------------------------------------------------------------
>>
>>#####################################################
>># P-Syn Version 0.5.0 make file                     #
>># Written by Richard Gipps                          #
>>#                                                   #
>># Target: MS-Windows                                #
>>#####################################################
>>
>>#Path
>>VPATH= gtkextra
>>
>># Compiler
>>CC=gcc
>>
>># Parameters given to the compiler
>># -Wall turns all the error checking on.
>># -s removes all symbol table and relocation information from the executable.
>>CFLAGS= -s \
>>         -mms-bitfields \
>>         -Wall \
>>         -DG_DISABLE_CONST_RETURNS \
>>         -DSUL_LOG_DYNAMIC_MEMORY_USE \
>>         -I../../../MinGW/include \
>>         -I../../../MinGW/include/glib-2.0 \
>>         -I../../../MinGW/include/glib-2.0/glib \
>>         -I../../../MinGW/include/glib-2.0/gobject \
>>         -I../../../MinGW/include/gtk-2.0 \
>>         -I../../../MinGW/include/gtk-2.0/gtk \
>>         -I../../../MinGW/include/gtk-2.0/gdk \
>>         -I../../../MinGW/include/atk \
>>         -I../../../MinGW/include/cairo \
>>         -I../../../MinGW/include/pango \
>>         -Igtkextra \
>>         -Isrc
>>
>># Parameters passed to the linker
>># The -mwindows switch is needed to create Windows executables instead of 
>>console applications. It assures the appropriate Windows libraries are 
>>linked in for you.
>>LDFLAGS= -mwindows \
>>         ../../../MinGW/lib/gtk/libglib-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libgobject-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libgthread-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libgdk-win32-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libgtk-win32-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libgdk_pixbuf-2.0.dll.a \
>>         ../../../MinGW/lib/gtk/libpango-1.0.dll.a
>>         # Output filename (*.exe)
>>OUTPUT="test.exe"
>>
>># Object files (*.o)
>>OBJS =  gtkplotdt.o \
>>         gtkplotpc.o \
>>         gtkplotdata.o \
>>         gtkplotgdk.o \
>>         gtkplotarray.o \
>>         gtkplotcanvas.o \
>>         gtkplotcanvasplot.o \
>>         gtkplotsurface.o \
>>         gtkplotpolar.o \
>>         gtkextra-marshal.o \
>>         gtkplot3d.o \
>>         gtkplotps.o \
>>         gtkpsfont.o \
>>         gtkplot.o \
>>         gtkextra.o \
>>         test.o \
>>         rsrc.o
>>
>># Targets
>>all: $(OUTPUT)
>>
>>$(OUTPUT) : $(OBJS)
>>         $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
>>
>>%.o : %.c
>>         $(CC) $(CFLAGS) -c $<
>>
>>rsrc.o : rsrc.rc
>>         windres --include-dir D:/lang/MinGW/include --include-dir 
>> D:/lang/MinGW/include/g++ --use-temp-file -J rc -O coff -i rsrc.rc -o "rsrc.o"
>>
>>test: all
>>         $(OUTPUT)
>>
>>clean:
>>         del *.o
>>         del *.exe
>>
>>release: all
>>         copy P-Syn.exe .\Install
>>         del *.o
>>         del *.exe
>>
>>------------------------------------------------------------------------
>>
>>/* plot.c */
>>
>>#include "gtk.h"
>>#include "glib.h"
>>#include "gtkplot.h"
>>#include <fcntl.h>
>>#include "gtkplotcanvas.h"
>>#include "gtkplotcanvasplot.h"
>>#include "gtkplotdata.h"
>>
>>#define NPOINTS 11
>>
>>void quit()
>>{
>>   gtk_main_quit();
>>}
>>
>>int main(int argc, char *argv[])
>>{
>>   GtkWidget *window;
>>   GtkWidget *canvas;
>>   GtkWidget *plot;
>>   GtkPlotCanvasChild *child;
>>   GtkPlotData *dataset;
>>   GdkColor colour;
>>   GdkColor colour_magenta;
>>   GdkColor colour_RoyalBlue1;
>>   GdkColor colour_LightGray;
>>   GdkColor colour_black;
>>
>>   int error_fd;
>>
>>   error_fd = open("error.log",
>>                    O_CREAT|O_WRONLY|O_TRUNC, //create file|open for 
>> writing only|if the file exists, truncate it to zero length
>>                    0666); //The protection mode for the file
>>    dup2(error_fd,STDERR_FILENO);
>>
>>   gdouble px[NPOINTS];
>>   gdouble py[NPOINTS];
>>
>>   int i;
>>
>>   gtk_init(&argc, &argv);
>>
>>   //allocate colours
>>   gdk_color_parse("red",&colour);
>>   gdk_color_alloc(gdk_colormap_get_system(),&colour);
>>   gdk_color_parse("magenta",&colour_magenta);
>>   gdk_color_alloc(gdk_colormap_get_system(),&colour_magenta);
>>   gdk_color_parse("RoyalBlue1",&colour_RoyalBlue1);
>>   gdk_color_alloc(gdk_colormap_get_system(),&colour_RoyalBlue1);
>>   gdk_color_parse("LightGray",&colour_LightGray);
>>   gdk_color_alloc(gdk_colormap_get_system(),&colour_LightGray);
>>   gdk_color_parse("black",&colour_black);
>>   gdk_color_alloc(gdk_colormap_get_system(),&colour_black);
>>
>>   /* main window */
>>   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>>   gtk_window_set_title(GTK_WINDOW(window), "Plot");
>>   gtk_container_border_width(GTK_CONTAINER(window), 0);
>>   g_signal_connect(GTK_OBJECT(window), "destroy", G_CALLBACK(quit), NULL);
>>   gtk_widget_show(window);
>>
>>
>>   /* canvas */
>>   canvas = gtk_plot_canvas_new(450, 450, 1.0);//The 1.0 is the scale factor
>>   gtk_container_add(GTK_CONTAINER(window), canvas);
>>   gtk_widget_show(canvas);
>>
>>   /* plot */
>>   plot = gtk_plot_new(NULL);
>>   //gtk_plot_set_range(GtkPlot *plot,gdouble xmin,gdouble xmax,gdouble 
>> ymin,gdouble ymax)
>>   gtk_plot_set_range(GTK_PLOT(plot),0,10,0,100);
>>   //gtk_plot_set_ticks(GtkPlot *plot, GtkPlotOrientation orientation, 
>> gdouble major_step, gint 
>> nminor)                                                 gint nminor);
>>   gtk_plot_set_ticks(GTK_PLOT(plot),GTK_PLOT_AXIS_X,2,0);
>>   gtk_plot_set_ticks(GTK_PLOT(plot),GTK_PLOT_AXIS_Y,10,0);
>>   //gtk_plot_axis_show_ticks(GtkPlotAxis *axis,gint major_mask,gint 
>> minor_mask);
>>   gtk_plot_axis_show_ticks((GTK_PLOT(plot))->left,0,0);
>>      gtk_plot_axis_show_ticks((GTK_PLOT(plot))->right,0,0);
>>   gtk_plot_axis_show_labels((GTK_PLOT(plot))->right,0);
>>   gtk_plot_axis_show_ticks((GTK_PLOT(plot))->top,0,0);
>>   gtk_plot_axis_show_labels((GTK_PLOT(plot))->top,0);
>>   gtk_plot_axis_show_ticks((GTK_PLOT(plot))->bottom,0,0);
>>   //gtk_plot_grids_set_visible(GtkPlot *plot,gboolean vmajor,gboolean 
>> vminor,gboolean hmajor,gboolean hminor);
>>   gtk_plot_grids_set_visible(GTK_PLOT(plot),1,0,1,0);
>>   //Botttom X-axis settings
>>   gtk_plot_axis_set_attributes((GTK_PLOT(plot))->bottom,1.0,&colour_black);
>> 
>>gtk_plot_major_vgrid_set_attributes(GTK_PLOT(plot),GTK_PLOT_LINE_SOLID,1.0,&colour_LightGray);
>>   //Top X-axis settings
>>   gtk_plot_axis_set_attributes((GTK_PLOT(plot))->top,1.0,&colour_black);
>>   //Left Y-axis settings
>>   gtk_plot_axis_set_attributes((GTK_PLOT(plot))->left,1.0,&colour_black);
>> 
>>gtk_plot_major_hgrid_set_attributes(GTK_PLOT(plot),GTK_PLOT_LINE_SOLID,1.0,&colour_LightGray);
>>   //Right Y-axis settings
>>   gtk_plot_axis_set_attributes((GTK_PLOT(plot))->right,1.0,&colour_black);
>>
>>   //Titles
>>    gtk_plot_axis_hide_title((GTK_PLOT(plot))->right);
>>   //gtk_plot_axis_set_title(GtkPlotAxis *axis, const gchar *title);
>>    gtk_plot_axis_set_title((GTK_PLOT(plot))->bottom, "Frequency (MHz)");
>>
>>   /* plot dataset */
>>   child = gtk_plot_canvas_plot_new(GTK_PLOT(plot));
>>   gtk_plot_canvas_put_child(GTK_PLOT_CANVAS(canvas), child, 0.10, 0.10, 
>> 0.85, 0.85);
>>   gtk_widget_show(plot);
>>
>>   for (i = 0; i < NPOINTS; i++)
>>   {
>>     px[i] = i;
>>     py[i] = i*i;
>>   }
>>
>>   dataset = GTK_PLOT_DATA(gtk_plot_data_new());
>>   gtk_plot_add_data(GTK_PLOT(plot), dataset);
>>   //Legends
>>   gtk_plot_data_set_legend(dataset, "DB(|S21|) (L)");
>>   gtk_plot_data_set_points(dataset, px, py, NULL, NULL, NPOINTS);
>>   //gtk_plot_data_set_line_attributes(GtkPlotData *data,GtkPlotLineStyle 
>> style,GdkCapStyle cap_style,GdkJoinStyle join_style,gfloat width,const 
>> GdkColor *color);
>> 
>>gtk_plot_data_set_line_attributes(dataset,GTK_PLOT_LINE_SOLID,GDK_CAP_ROUND,GDK_JOIN_MITER,1.0,&colour_RoyalBlue1);
>>   gtk_plot_data_draw_points(dataset, 1);
>>   gtk_widget_show(GTK_WIDGET(dataset));
>>
>>   gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));
>>   gtk_plot_canvas_refresh(GTK_PLOT_CANVAS(canvas));
>>
>>   gtk_main();
>>
>>   return 0;
>>}
>>


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642