Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on gtk. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/gtk.e> # or at <http://angg.twu.net/e/gtk.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # (find-status "libgtk2.0-dev") # (find-vldifile "libgtk2.0-dev.list") # (find-udfile "libgtk2.0-dev/") # (find-status "libgtk2.0-doc") # (find-vldifile "libgtk2.0-doc.list") # (find-udfile "libgtk2.0-doc/") # (code-c-d "gtktut" "/usr/share/doc/libgtk2.0-doc/gtk-tutorial/") # (code-c-d "gtkref" "/usr/share/doc/libgtk2.0-doc/gtk/") # (eev "firefox /usr/share/doc/libgtk2.0-doc/gtk-tutorial/ &") # (eev "firefox /usr/share/doc/libgtk2.0-doc/gtk/ &") (defun find-html-file (dir pagestem tag) (find-sh0 (format "firefox %s%s%s" dir (if pagestem (concat pagestem ".html") "") (if tag (concat "#" tag) "")))) (defun find-gtkref (&optional pagestem tag) (interactive) (find-html-file "/usr/share/doc/libgtk2.0-doc/gtk/" pagestem tag)) (defun find-gtktut (&optional pagestem tag) (interactive) (find-html-file "/usr/share/doc/libgtk2.0-doc/gtk-tutorial/" pagestem tag)) #* # (find-gtktutfile "") # (find-fline "/tmp/gtktut/") # (find-fline "/tmp/gtktut/c58") rm -Rv /tmp/gtktut/ mkdir /tmp/gtktut/ cd /usr/share/doc/libgtk2.0-doc/gtk-tutorial/ for i in *.html; do echo $i unhtml < $i | tr \\r \\n > /tmp/gtktut/$(basename $i .html) done #* ##### # # Getting started # 2004nov18 # ##### #* # (find-gtktut "c58") eegcc $(pkg-config --cflags --libs gtk+-2.0) <<'%%%' #include <gtk/gtk.h> int main( int argc, char *argv[] ) { GtkWidget *window; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_show (window); gtk_main (); return 0; } %%% eec #* ##### # # first widgets (adapted from packbox.c) # 2004nov18 # ##### #* # The original packbox.c: (find-gtktut "x405") # Index: (find-gtkref "ix01") # (find-fline "/tmp/pack.c") eegcc $(pkg-config --cflags --libs gtk+-2.0) -Wall <<'%%%' #include <stdio.h> #include <stdlib.h> #include "gtk/gtk.h" int main(int argc, char *argv[]) { GtkWidget *window, *box1, *box2, *quitbox; GtkWidget *button, *label, *separator; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); box1 = gtk_vbox_new (FALSE, 0); box2 = gtk_hbox_new (FALSE, 0); quitbox = gtk_hbox_new (FALSE, 0); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("buttton"); gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE,0); gtk_widget_show (button); label = gtk_label_new ("end"); gtk_box_pack_end (GTK_BOX (box2), label, FALSE, FALSE, 0); gtk_widget_show (label); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0); gtk_widget_show (box2); separator = gtk_hseparator_new (); gtk_widget_set_size_request (separator, 400, 5); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5); gtk_widget_show (separator); button = gtk_button_new_with_label ("Quit"); g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (gtk_main_quit), G_OBJECT (window)); gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (button); gtk_widget_show (quitbox); gtk_widget_show (box1); gtk_widget_show (window); gtk_main (); return 0; } %%% eec #* # Scribble: (find-gtktut "c2442") # DrawingArea: (find-gtktut "x2490") # DrawingArea: (find-gtktutdocfile "") # (find-gtkref "GtkDrawingArea") (find-gtktutdocw3m "x2452.html") (find-gtktutdocw3m "x2491.html") (find-gtktutdocw3m "x2550.html") (find-gtktutdocw3m "x498.html") eegcc $(pkg-config --cflags --libs gtk+-2.0) <<'%%%' #include <gtk/gtk.h> int main( int argc, char *argv[] ) { GtkWidget *widg; widg = gtk_drawing_area_new(); void gtk_drawing_area_size (GtkDrawingArea *darea, 320, 200); GdkPixmap* gdk_pixmap_new (GdkWindow *window, 320, 200, -1); /* Backing pixmap for drawing area */ static GdkPixmap *pixmap = NULL; /* Create a new backing pixmap of the appropriate size */ static gboolean configure_event( GtkWidget *widget, GdkEventConfigure *event ) { if (pixmap) gdk_pixmap_unref(pixmap); pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, widget->allocation.height, -1); gdk_draw_rectangle (pixmap, widget->style->white_gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height); return TRUE; } /* Redraw the screen from the backing pixmap */ static gboolean expose_event( GtkWidget *widget, GdkEventExpose *event ) { gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], pixmap, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); return FALSE; } /* Draw a rectangle on the screen */ static void draw_brush (GtkWidget *widget, gdouble x, gdouble y) { GdkRectangle update_rect; update_rect.x = x - 5; update_rect.y = y - 5; update_rect.width = 10; update_rect.height = 10; gdk_draw_rectangle (pixmap, widget->style->black_gc, TRUE, update_rect.x, update_rect.y, update_rect.width, update_rect.height); gtk_widget_draw (widget, &update_rect); } void gtk_widget_draw (GtkWidget *widget,GdkRectangle *area); ##### # # gtk # 2000sep30 # ##### pdsc $SDEBIAN/dists/potato/main/source/libs/gtk+1.2_1.2.7-1.dsc cd /usr/src/gtk+1.2-1.2.7/ debian/rules binary |& tee odrb dpkg -i /usr/src/libgtk1.2-doc_1.2.7-1_all.deb # (code-c-d "gtk" "/usr/src/gtk+1.2-1.2.7/") # (find-gtkfile "") # (find-gtkfile "examples/") # (find-status "libgtk1.2") # (find-vldifile "libgtk1.2.list") # (find-fline "/usr/doc/libgtk1.2/") # (find-status "libgtk1.2-dev") # (find-vldifile "libgtk1.2-dev.list") # (find-fline "/usr/doc/libgtk1.2-dev/") # (find-status "libgtk1.2-doc") # (find-vldifile "libgtk1.2-doc.list") # (find-fline "/usr/doc/libgtk1.2-doc/") # (find-fline "/usr/doc/libgtk1.2-doc/gtk_tut.txt.gz") # (find-w3 "/usr/doc/libgtk1.2-doc/gtk-tutorial-html/gtk_tut.html") # (find-node "(gtk)Top") # (find-node "(gdk)Top") ##### # # gqview # 2000sep30 # ##### #* pdsc $SDEBIAN/dists/potato/main/source/graphics/gqview_0.7.0e1-1.dsc cd /usr/src/gqview-0.7.0e1/ debian/rules binary |& tee odrb # (code-c-d "gqview" "/usr/src/gqview-0.7.0e1/") # (find-gqviewfile "") # (find-gqviewfile "odrb" " -g") # (find-status "gqview") # (find-vldifile "gqview.list") # (find-fline "/usr/doc/gqview/") #* # (progn (eeg-bounded) (gdb "gdb /usr/src/gqview-0.7.0e1/src/gqview") (gdbk-mode)) # (progn (find-gqviewfile "src/image.c" "gdk_imlib_load_image") (gud-break t)) set args /usr/src/gqview-0.7.0e1/gqview.png # br main br image_change_to run bt #* apti imlib-dev # (find-status "imlib-dev") # (find-vldifile "imlib-dev.list") # (find-fline "/usr/doc/imlib-dev/") # (find-w3 "/usr/doc/imlib-dev/html/index.html") # Local Variables: # coding: utf-8-unix # End: