Octave GTK+
Octave GTK+ is a project that aims to add GTK+ bindings to Octave by extending it, and build a GUI for Octave around these features of GTK+. You can download versions of Octave-GTK from here http://octave-gtk.sf.net.
Rationale
http://www.octave.org, as most you will be familiar with, is the scientific computation tool that is used for BLAS & Linear algebraic computations. Currently GNU Octave exists as a an interpreter written in C++, with support for a language Octave much similar to the language like Matlab. However it has severe limitation of not being able to integrate a GUI framework for Octave, and remains tied down to the simple Text UI. We are working towards a GTK+ binding for Octave.Adding GTK support to Octave would definitely add teeth to Octave by giving GUI + Scientific computation together like other non-free counterparts do. With GTK+ bindings it is now possible to access GUI & implement programswith a scientific engine & GUI easily.
Status
As of now Octave-GTK is in 0.3 version, maps GTK+ version 2.2+ and compiles out of the box, [Ofcourse you need Octave libraries & GTK-devel].
This package is autotooled and has a many of GTK-C API examples.
Progress
We have Unstable bindings for the following packages, as of release 0.3(Galadriel)
* GTK+
- gtk
- gdk
- pango
- atk
- glib
* Glade
- Libglade
gobject is missing, and the most important part, will get fixed sooner.
Documentation/Help
- Octave-GTK uses a typical, GTK C API like standards. But its possible to go for an OO PI, which we will be doing soon. As of this release its still in the GTK C API format.
A simple Octave-GTK+ program looks like this
%(C) Feb 2005 Muthiah Annamalai, Octave-GTK & Octave-libGlade gx=0 function on_spin_changed() global gx label=glade_xml_get_widget(gx,"label"); b=glade_xml_get_widget(gx,"spin"); count=gtk_spin_button_get_value_as_int(b); buffer=sprintf("%3d",count); gtk_label_set_text(label,buffer); end function main() global gx gtk() glade() gtk_init() gx=glade_xml_new("gnu.glade","window",""); glade_xml_signal_autoconnect(gx); w=glade_xml_get_widget(gx,"window"); g_signal_connect(w,"destroy","gtk_main_quit"); gtk_widget_show_all(w); gtk_main(); return end main() %gcc -o gnu -Wall gnu.c `pkg-config gtk+-2.0 --cflags --libs` -I/usr/include/libglade-2.0 -lxml -lglade-2.0
While your standard GTK-C API programs are no different, [actually otherway round], as you see here
#include<stdio.h> #include<gtk/gtk.h> #include<glade/glade.h> /* (C) Feb 2005 Muthiah Annamalai, Octave-GTK & Octave-libGlade */ void on_spin_activate(GtkSpinButton *b); void on_spin_changed(GtkSpinButton *b); GladeXML *gx; int main(int argc,char *argv[]) { GtkWidget *w; gtk_init(&argc,&argv); gx=glade_xml_new("gnu.glade",NULL,NULL); g_assert(gx != NULL); glade_xml_signal_autoconnect(gx); w=glade_xml_get_widget(gx,"window"); g_signal_connect(G_OBJECT(w),"destroy",G_CALLBACK(gtk_main_quit),NULL); gtk_widget_show_all(w); gtk_main(); return 0; } void on_spin_changed(GtkSpinButton *b) { gint count=0; char buffer[10]; GtkLabel *label=GTK_LABEL(glade_xml_get_widget(gx,"label")); count=gtk_spin_button_get_value_as_int(b); sprintf(buffer,"%3d",count); gtk_label_set_text(label,buffer); printf("changed: %s <=> %d\n",buffer,count); } void on_spin_activate(GtkSpinButton *b) { //Doesnt work. unsigned char count=0; char buffer[10]; GtkLabel *label=GTK_LABEL(glade_xml_get_widget(gx,"label")); count=gtk_spin_button_get_value_as_int(b); sprintf(buffer,"%d",count); gtk_label_set_text(label,buffer); printf("actiavted: %s <=> %d\n",buffer,count); } /** gcc -o gnu -Wall gnu.c `pkg-config gtk+-2.0 --cflags --libs` -I/usr/include/libglade-2.0 -lxml -lglade-2.0 */
Tutorial
A simple LibGlade development with Octave-GTK is covered here. octave_gtk_libglade.html.
This example re-generates the gnu.c C-LibGlade project in Octave-GTK+ as gnu.m. The original glade file is in gnu.glade and both the files present the same interface gnu.png
Developer Lists
There are two lists. octave-gtk-devel[At]lists[do]sf[t]net see http://sf.net/projects/octave-gtk.
Resources
There is a presentation on Octave-GTK project here octave_gtk_hack.sxi.
Download
Get this package from http://sf.net/projects/octave-gtk.