# HG changeset patch # User meillo@marmaro.de # Date 1196783331 -3600 # Node ID ca9155129253d4fe8d95e756dbf0a1985caca2ae initial commit code base: gthumb_crop.glade and generated code from it with glade diff -r 000000000000 -r ca9155129253 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,5 @@ +syntax: glob +*~ +*.swp +*.o +cropper diff -r 000000000000 -r ca9155129253 Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,20 @@ +# basic GTK+ app makefile +SOURCES = interface.c callbacks.c support.c main.c interface.h callbacks.h support.h +OBJS = ${SOURCES:.c=.o} +#CFLAGS = `gtk-config --cflags` +#LDADD = `gtk-config --libs --cflags` +datadir = /usr/local/share +CFLAGS = `pkg-config --cflags gtk+-2.0` +LDADD = `pkg-config --libs --cflags gtk+-2.0` +CC = gcc +PACKAGE = cropper + + + +all : ${OBJS} + ${CC} -o ${PACKAGE} ${OBJS} ${LDADD} + +.c.o: + ${CC} ${CFLAGS} -c $< + +# end of file diff -r 000000000000 -r ca9155129253 callbacks.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/callbacks.c Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,127 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +on_none1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_square1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_4x3__book__dvd_1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_4x6__postcard_1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_5x1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_8x1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_custom1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_ratio_w_spinbutton_value_changed (GtkSpinButton *spinbutton, + gpointer user_data) +{ + +} + + +void +on_ratio_w_spinbutton_change_value (GtkSpinButton *spinbutton, + GtkScrollType scroll, + gpointer user_data) +{ + +} + + +void +on_ratio_swap_button_clicked (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_ratio_h_spinbutton_change_value (GtkSpinButton *spinbutton, + GtkScrollType scroll, + gpointer user_data) +{ + +} + + +void +on_ratio_h_spinbutton_value_changed (GtkSpinButton *spinbutton, + gpointer user_data) +{ + +} + + +gboolean +on_cropper_window_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + + g_print ("delete event occurred\n"); + return FALSE; +} + + +void +on_cropper_window_destroy (GtkObject *object, + gpointer user_data) +{ + gtk_main_quit(); +} + diff -r 000000000000 -r ca9155129253 callbacks.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/callbacks.h Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,65 @@ +#include + + +void +on_none1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_square1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_4x3__book__dvd_1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_4x6__postcard_1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_5x1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_8x1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_custom1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_cropper_window_destroy (GtkObject *object, + gpointer user_data); + +void +on_ratio_w_spinbutton_value_changed (GtkSpinButton *spinbutton, + gpointer user_data); + +void +on_ratio_w_spinbutton_change_value (GtkSpinButton *spinbutton, + GtkScrollType scroll, + gpointer user_data); + +void +on_ratio_swap_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_ratio_h_spinbutton_change_value (GtkSpinButton *spinbutton, + GtkScrollType scroll, + gpointer user_data); + +void +on_ratio_h_spinbutton_value_changed (GtkSpinButton *spinbutton, + gpointer user_data); + +gboolean +on_cropper_window_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_cropper_window_destroy (GtkObject *object, + gpointer user_data); diff -r 000000000000 -r ca9155129253 interface.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface.c Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,524 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +GtkWidget* +create_cropper_window (void) +{ + GtkWidget *cropper_window; + GtkWidget *dialog_vbox1; + GtkWidget *hbox1; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *label1; + GtkWidget *hbox2; + GtkWidget *label2; + GtkWidget *table2; + GtkWidget *label3; + GtkWidget *label5; + GtkWidget *label4; + GtkWidget *label6; + GtkWidget *hbox5; + GtkObject *crop_x_spinbutton_adj; + GtkWidget *crop_x_spinbutton; + GtkWidget *hbox6; + GtkObject *crop_y_spinbutton_adj; + GtkWidget *crop_y_spinbutton; + GtkWidget *hbox7; + GtkObject *crop_width_spinbutton_adj; + GtkWidget *crop_width_spinbutton; + GtkWidget *hbox8; + GtkObject *crop_height_spinbutton_adj; + GtkWidget *crop_height_spinbutton; + GtkWidget *vbox4; + GtkWidget *label7; + GtkWidget *hbox3; + GtkWidget *label8; + GtkWidget *table3; + GtkWidget *hbox10; + GtkWidget *custom_ratio_box; + GtkObject *ratio_w_spinbutton_adj; + GtkWidget *ratio_w_spinbutton; + GtkWidget *ratio_swap_button; + GtkWidget *eventbox1; + GtkWidget *ratio_swap_image; + GtkObject *ratio_h_spinbutton_adj; + GtkWidget *ratio_h_spinbutton; + GtkWidget *ratio_optionmenu; + GtkWidget *menu1; + GtkWidget *none1; + GtkWidget *square1; + GtkWidget *_4x3__book__dvd_1; + GtkWidget *_4x6__postcard_1; + GtkWidget *_5x1; + GtkWidget *_8x1; + GtkWidget *custom1; + GtkWidget *vbox5; + GtkWidget *frame1; + GtkWidget *vbox7; + GtkWidget *nav_container; + GtkWidget *hbox16; + GtkWidget *hbox17; + GtkWidget *crop_zoom_in_button; + GtkWidget *image2; + GtkWidget *crop_zoom_out_button; + GtkWidget *image4; + GtkWidget *crop_zoom_100_button; + GtkWidget *image3; + GtkWidget *crop_zoom_fit_button; + GtkWidget *image1; + + cropper_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (cropper_window, "cropper_window"); + gtk_container_set_border_width (GTK_CONTAINER (cropper_window), 6); + gtk_window_set_title (GTK_WINDOW (cropper_window), "Cropper"); + + dialog_vbox1 = gtk_vbox_new (FALSE, 6); + gtk_widget_set_name (dialog_vbox1, "dialog_vbox1"); + gtk_widget_show (dialog_vbox1); + gtk_container_add (GTK_CONTAINER (cropper_window), dialog_vbox1); + + hbox1 = gtk_hbox_new (FALSE, 12); + gtk_widget_set_name (hbox1, "hbox1"); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5); + + vbox1 = gtk_vbox_new (FALSE, 12); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (hbox1), vbox1, FALSE, TRUE, 0); + + vbox2 = gtk_vbox_new (FALSE, 6); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_show (vbox2); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0); + + label1 = gtk_label_new ("Selection"); + gtk_widget_set_name (label1, "label1"); + gtk_widget_show (label1); + gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); + gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox2, "hbox2"); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0); + + label2 = gtk_label_new (" "); + gtk_widget_set_name (label2, "label2"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0); + + table2 = gtk_table_new (4, 2, FALSE); + gtk_widget_set_name (table2, "table2"); + gtk_widget_show (table2); + gtk_box_pack_start (GTK_BOX (hbox2), table2, TRUE, TRUE, 0); + gtk_table_set_row_spacings (GTK_TABLE (table2), 6); + gtk_table_set_col_spacings (GTK_TABLE (table2), 6); + + label3 = gtk_label_new_with_mnemonic ("_X:"); + gtk_widget_set_name (label3, "label3"); + gtk_widget_show (label3); + gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5); + + label5 = gtk_label_new_with_mnemonic ("_Y:"); + gtk_widget_set_name (label5, "label5"); + gtk_widget_show (label5); + gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); + + label4 = gtk_label_new_with_mnemonic ("_Width:"); + gtk_widget_set_name (label4, "label4"); + gtk_widget_show (label4); + gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); + + label6 = gtk_label_new_with_mnemonic ("_Height:"); + gtk_widget_set_name (label6, "label6"); + gtk_widget_show (label6); + gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5); + + hbox5 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox5, "hbox5"); + gtk_widget_show (hbox5); + gtk_table_attach (GTK_TABLE (table2), hbox5, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + crop_x_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1); + crop_x_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_x_spinbutton_adj), 1, 0); + gtk_widget_set_name (crop_x_spinbutton, "crop_x_spinbutton"); + gtk_widget_show (crop_x_spinbutton); + gtk_box_pack_start (GTK_BOX (hbox5), crop_x_spinbutton, FALSE, TRUE, 0); + + hbox6 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox6, "hbox6"); + gtk_widget_show (hbox6); + gtk_table_attach (GTK_TABLE (table2), hbox6, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + crop_y_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1); + crop_y_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_y_spinbutton_adj), 1, 0); + gtk_widget_set_name (crop_y_spinbutton, "crop_y_spinbutton"); + gtk_widget_show (crop_y_spinbutton); + gtk_box_pack_start (GTK_BOX (hbox6), crop_y_spinbutton, FALSE, TRUE, 0); + + hbox7 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox7, "hbox7"); + gtk_widget_show (hbox7); + gtk_table_attach (GTK_TABLE (table2), hbox7, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + crop_width_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1); + crop_width_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_width_spinbutton_adj), 1, 0); + gtk_widget_set_name (crop_width_spinbutton, "crop_width_spinbutton"); + gtk_widget_show (crop_width_spinbutton); + gtk_box_pack_start (GTK_BOX (hbox7), crop_width_spinbutton, FALSE, FALSE, 0); + + hbox8 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox8, "hbox8"); + gtk_widget_show (hbox8); + gtk_table_attach (GTK_TABLE (table2), hbox8, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + crop_height_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1); + crop_height_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_height_spinbutton_adj), 1, 0); + gtk_widget_set_name (crop_height_spinbutton, "crop_height_spinbutton"); + gtk_widget_show (crop_height_spinbutton); + gtk_box_pack_start (GTK_BOX (hbox8), crop_height_spinbutton, FALSE, FALSE, 0); + + vbox4 = gtk_vbox_new (FALSE, 6); + gtk_widget_set_name (vbox4, "vbox4"); + gtk_widget_show (vbox4); + gtk_box_pack_start (GTK_BOX (vbox1), vbox4, FALSE, TRUE, 0); + + label7 = gtk_label_new ("Aspect ratio"); + gtk_widget_set_name (label7, "label7"); + gtk_widget_show (label7); + gtk_box_pack_start (GTK_BOX (vbox4), label7, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (label7), TRUE); + gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5); + + hbox3 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox3, "hbox3"); + gtk_widget_show (hbox3); + gtk_box_pack_start (GTK_BOX (vbox4), hbox3, FALSE, FALSE, 0); + + label8 = gtk_label_new (" "); + gtk_widget_set_name (label8, "label8"); + gtk_widget_show (label8); + gtk_box_pack_start (GTK_BOX (hbox3), label8, FALSE, FALSE, 0); + + table3 = gtk_table_new (2, 2, FALSE); + gtk_widget_set_name (table3, "table3"); + gtk_widget_show (table3); + gtk_box_pack_start (GTK_BOX (hbox3), table3, TRUE, TRUE, 0); + gtk_table_set_row_spacings (GTK_TABLE (table3), 6); + gtk_table_set_col_spacings (GTK_TABLE (table3), 6); + + hbox10 = gtk_hbox_new (FALSE, 6); + gtk_widget_set_name (hbox10, "hbox10"); + gtk_widget_show (hbox10); + gtk_table_attach (GTK_TABLE (table3), hbox10, 0, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + + custom_ratio_box = gtk_hbox_new (FALSE, 6); + gtk_widget_set_name (custom_ratio_box, "custom_ratio_box"); + gtk_widget_show (custom_ratio_box); + gtk_box_pack_start (GTK_BOX (hbox10), custom_ratio_box, TRUE, TRUE, 0); + + ratio_w_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10); + ratio_w_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_w_spinbutton_adj), 1, 0); + gtk_widget_set_name (ratio_w_spinbutton, "ratio_w_spinbutton"); + gtk_widget_show (ratio_w_spinbutton); + gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_w_spinbutton, FALSE, TRUE, 0); + + ratio_swap_button = gtk_button_new (); + gtk_widget_set_name (ratio_swap_button, "ratio_swap_button"); + gtk_widget_show (ratio_swap_button); + gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_swap_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (ratio_swap_button), GTK_RELIEF_NONE); + + eventbox1 = gtk_event_box_new (); + gtk_widget_set_name (eventbox1, "eventbox1"); + gtk_widget_show (eventbox1); + gtk_container_add (GTK_CONTAINER (ratio_swap_button), eventbox1); + + ratio_swap_image = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (ratio_swap_image, "ratio_swap_image"); + gtk_widget_show (ratio_swap_image); + gtk_container_add (GTK_CONTAINER (eventbox1), ratio_swap_image); + + ratio_h_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10); + ratio_h_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_h_spinbutton_adj), 1, 0); + gtk_widget_set_name (ratio_h_spinbutton, "ratio_h_spinbutton"); + gtk_widget_show (ratio_h_spinbutton); + gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_h_spinbutton, FALSE, TRUE, 0); + gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (ratio_h_spinbutton), GTK_UPDATE_IF_VALID); + + ratio_optionmenu = gtk_option_menu_new (); + gtk_widget_set_name (ratio_optionmenu, "ratio_optionmenu"); + gtk_widget_show (ratio_optionmenu); + gtk_table_attach (GTK_TABLE (table3), ratio_optionmenu, 0, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + menu1 = gtk_menu_new (); + gtk_widget_set_name (menu1, "menu1"); + + none1 = gtk_menu_item_new_with_mnemonic ("None"); + gtk_widget_set_name (none1, "none1"); + gtk_widget_show (none1); + gtk_container_add (GTK_CONTAINER (menu1), none1); + + square1 = gtk_menu_item_new_with_mnemonic ("Square"); + gtk_widget_set_name (square1, "square1"); + gtk_widget_show (square1); + gtk_container_add (GTK_CONTAINER (menu1), square1); + + _4x3__book__dvd_1 = gtk_menu_item_new_with_mnemonic ("4 x 3 (Book, DVD)"); + gtk_widget_set_name (_4x3__book__dvd_1, "_4x3__book__dvd_1"); + gtk_widget_show (_4x3__book__dvd_1); + gtk_container_add (GTK_CONTAINER (menu1), _4x3__book__dvd_1); + + _4x6__postcard_1 = gtk_menu_item_new_with_mnemonic ("4 x 6 (Postcard)"); + gtk_widget_set_name (_4x6__postcard_1, "_4x6__postcard_1"); + gtk_widget_show (_4x6__postcard_1); + gtk_container_add (GTK_CONTAINER (menu1), _4x6__postcard_1); + + _5x1 = gtk_menu_item_new_with_mnemonic ("5 x 7"); + gtk_widget_set_name (_5x1, "_5x1"); + gtk_widget_show (_5x1); + gtk_container_add (GTK_CONTAINER (menu1), _5x1); + + _8x1 = gtk_menu_item_new_with_mnemonic ("8 x 10"); + gtk_widget_set_name (_8x1, "_8x1"); + gtk_widget_show (_8x1); + gtk_container_add (GTK_CONTAINER (menu1), _8x1); + + custom1 = gtk_menu_item_new_with_mnemonic ("Custom"); + gtk_widget_set_name (custom1, "custom1"); + gtk_widget_show (custom1); + gtk_container_add (GTK_CONTAINER (menu1), custom1); + + gtk_option_menu_set_menu (GTK_OPTION_MENU (ratio_optionmenu), menu1); + + vbox5 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox5, "vbox5"); + gtk_widget_show (vbox5); + gtk_box_pack_start (GTK_BOX (hbox1), vbox5, TRUE, TRUE, 0); + + frame1 = gtk_frame_new (NULL); + gtk_widget_set_name (frame1, "frame1"); + gtk_widget_show (frame1); + gtk_box_pack_start (GTK_BOX (vbox5), frame1, TRUE, TRUE, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE); + + vbox7 = gtk_vbox_new (FALSE, 6); + gtk_widget_set_name (vbox7, "vbox7"); + gtk_widget_show (vbox7); + gtk_container_add (GTK_CONTAINER (frame1), vbox7); + + nav_container = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (nav_container, "nav_container"); + gtk_widget_show (nav_container); + gtk_box_pack_start (GTK_BOX (vbox7), nav_container, TRUE, TRUE, 0); + + hbox16 = gtk_hbox_new (FALSE, 6); + gtk_widget_set_name (hbox16, "hbox16"); + gtk_widget_show (hbox16); + gtk_box_pack_start (GTK_BOX (vbox7), hbox16, FALSE, TRUE, 0); + + hbox17 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox17, "hbox17"); + gtk_widget_show (hbox17); + gtk_box_pack_end (GTK_BOX (hbox16), hbox17, FALSE, TRUE, 0); + + crop_zoom_in_button = gtk_button_new (); + gtk_widget_set_name (crop_zoom_in_button, "crop_zoom_in_button"); + gtk_widget_show (crop_zoom_in_button); + gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_in_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (crop_zoom_in_button), GTK_RELIEF_NONE); + + image2 = gtk_image_new_from_stock ("gtk-zoom-in", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (image2, "image2"); + gtk_widget_show (image2); + gtk_container_add (GTK_CONTAINER (crop_zoom_in_button), image2); + + crop_zoom_out_button = gtk_button_new (); + gtk_widget_set_name (crop_zoom_out_button, "crop_zoom_out_button"); + gtk_widget_show (crop_zoom_out_button); + gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_out_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (crop_zoom_out_button), GTK_RELIEF_NONE); + + image4 = gtk_image_new_from_stock ("gtk-zoom-out", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (image4, "image4"); + gtk_widget_show (image4); + gtk_container_add (GTK_CONTAINER (crop_zoom_out_button), image4); + + crop_zoom_100_button = gtk_button_new (); + gtk_widget_set_name (crop_zoom_100_button, "crop_zoom_100_button"); + gtk_widget_show (crop_zoom_100_button); + gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_100_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (crop_zoom_100_button), GTK_RELIEF_NONE); + + image3 = gtk_image_new_from_stock ("gtk-zoom-100", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (image3, "image3"); + gtk_widget_show (image3); + gtk_container_add (GTK_CONTAINER (crop_zoom_100_button), image3); + + crop_zoom_fit_button = gtk_button_new (); + gtk_widget_set_name (crop_zoom_fit_button, "crop_zoom_fit_button"); + gtk_widget_show (crop_zoom_fit_button); + gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_fit_button, FALSE, FALSE, 0); + gtk_button_set_relief (GTK_BUTTON (crop_zoom_fit_button), GTK_RELIEF_NONE); + + image1 = gtk_image_new_from_stock ("gtk-zoom-fit", GTK_ICON_SIZE_BUTTON); + gtk_widget_set_name (image1, "image1"); + gtk_widget_show (image1); + gtk_container_add (GTK_CONTAINER (crop_zoom_fit_button), image1); + + g_signal_connect ((gpointer) cropper_window, "delete_event", + G_CALLBACK (on_cropper_window_delete_event), + NULL); + g_signal_connect ((gpointer) cropper_window, "destroy", + G_CALLBACK (on_cropper_window_destroy), + NULL); + g_signal_connect ((gpointer) ratio_w_spinbutton, "value_changed", + G_CALLBACK (on_ratio_w_spinbutton_value_changed), + NULL); + g_signal_connect ((gpointer) ratio_w_spinbutton, "change_value", + G_CALLBACK (on_ratio_w_spinbutton_change_value), + NULL); + g_signal_connect ((gpointer) ratio_swap_button, "clicked", + G_CALLBACK (on_ratio_swap_button_clicked), + NULL); + g_signal_connect ((gpointer) ratio_h_spinbutton, "change_value", + G_CALLBACK (on_ratio_h_spinbutton_change_value), + NULL); + g_signal_connect ((gpointer) ratio_h_spinbutton, "value_changed", + G_CALLBACK (on_ratio_h_spinbutton_value_changed), + NULL); + g_signal_connect ((gpointer) none1, "activate", + G_CALLBACK (on_none1_activate), + NULL); + g_signal_connect ((gpointer) square1, "activate", + G_CALLBACK (on_square1_activate), + NULL); + g_signal_connect ((gpointer) _4x3__book__dvd_1, "activate", + G_CALLBACK (on_4x3__book__dvd_1_activate), + NULL); + g_signal_connect ((gpointer) _4x6__postcard_1, "activate", + G_CALLBACK (on_4x6__postcard_1_activate), + NULL); + g_signal_connect ((gpointer) _5x1, "activate", + G_CALLBACK (on_5x1_activate), + NULL); + g_signal_connect ((gpointer) _8x1, "activate", + G_CALLBACK (on_8x1_activate), + NULL); + g_signal_connect ((gpointer) custom1, "activate", + G_CALLBACK (on_custom1_activate), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (cropper_window, cropper_window, "cropper_window"); + GLADE_HOOKUP_OBJECT (cropper_window, dialog_vbox1, "dialog_vbox1"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox1, "hbox1"); + GLADE_HOOKUP_OBJECT (cropper_window, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (cropper_window, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (cropper_window, label1, "label1"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (cropper_window, label2, "label2"); + GLADE_HOOKUP_OBJECT (cropper_window, table2, "table2"); + GLADE_HOOKUP_OBJECT (cropper_window, label3, "label3"); + GLADE_HOOKUP_OBJECT (cropper_window, label5, "label5"); + GLADE_HOOKUP_OBJECT (cropper_window, label4, "label4"); + GLADE_HOOKUP_OBJECT (cropper_window, label6, "label6"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox5, "hbox5"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_x_spinbutton, "crop_x_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox6, "hbox6"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_y_spinbutton, "crop_y_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox7, "hbox7"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_width_spinbutton, "crop_width_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox8, "hbox8"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_height_spinbutton, "crop_height_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, vbox4, "vbox4"); + GLADE_HOOKUP_OBJECT (cropper_window, label7, "label7"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox3, "hbox3"); + GLADE_HOOKUP_OBJECT (cropper_window, label8, "label8"); + GLADE_HOOKUP_OBJECT (cropper_window, table3, "table3"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox10, "hbox10"); + GLADE_HOOKUP_OBJECT (cropper_window, custom_ratio_box, "custom_ratio_box"); + GLADE_HOOKUP_OBJECT (cropper_window, ratio_w_spinbutton, "ratio_w_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_button, "ratio_swap_button"); + GLADE_HOOKUP_OBJECT (cropper_window, eventbox1, "eventbox1"); + GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_image, "ratio_swap_image"); + GLADE_HOOKUP_OBJECT (cropper_window, ratio_h_spinbutton, "ratio_h_spinbutton"); + GLADE_HOOKUP_OBJECT (cropper_window, ratio_optionmenu, "ratio_optionmenu"); + GLADE_HOOKUP_OBJECT (cropper_window, menu1, "menu1"); + GLADE_HOOKUP_OBJECT (cropper_window, none1, "none1"); + GLADE_HOOKUP_OBJECT (cropper_window, square1, "square1"); + GLADE_HOOKUP_OBJECT (cropper_window, _4x3__book__dvd_1, "_4x3__book__dvd_1"); + GLADE_HOOKUP_OBJECT (cropper_window, _4x6__postcard_1, "_4x6__postcard_1"); + GLADE_HOOKUP_OBJECT (cropper_window, _5x1, "_5x1"); + GLADE_HOOKUP_OBJECT (cropper_window, _8x1, "_8x1"); + GLADE_HOOKUP_OBJECT (cropper_window, custom1, "custom1"); + GLADE_HOOKUP_OBJECT (cropper_window, vbox5, "vbox5"); + GLADE_HOOKUP_OBJECT (cropper_window, frame1, "frame1"); + GLADE_HOOKUP_OBJECT (cropper_window, vbox7, "vbox7"); + GLADE_HOOKUP_OBJECT (cropper_window, nav_container, "nav_container"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox16, "hbox16"); + GLADE_HOOKUP_OBJECT (cropper_window, hbox17, "hbox17"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_in_button, "crop_zoom_in_button"); + GLADE_HOOKUP_OBJECT (cropper_window, image2, "image2"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_out_button, "crop_zoom_out_button"); + GLADE_HOOKUP_OBJECT (cropper_window, image4, "image4"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_100_button, "crop_zoom_100_button"); + GLADE_HOOKUP_OBJECT (cropper_window, image3, "image3"); + GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_fit_button, "crop_zoom_fit_button"); + GLADE_HOOKUP_OBJECT (cropper_window, image1, "image1"); + + return cropper_window; +} + diff -r 000000000000 -r ca9155129253 interface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface.h Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,6 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ +#include + +GtkWidget* create_cropper_window (void); diff -r 000000000000 -r ca9155129253 main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,36 @@ +/* + * Initial main.c file generated by Glade. Edit as required. + * Glade will not overwrite this file. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "interface.h" +#include "support.h" + +int +main (int argc, char *argv[]) +{ + GtkWidget *cropper_window; + + gtk_set_locale (); + gtk_init (&argc, &argv); + + add_pixmap_directory ("/usr/share/pixmaps"); + + /* + * The following code was added by Glade to create one of each component + * (except popup menus), just so that you see something after building + * the project. Delete any components that you don't want shown initially. + */ + cropper_window = create_cropper_window (); + gtk_widget_show (cropper_window); + + gtk_main (); + return 0; +} + diff -r 000000000000 -r ca9155129253 support.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/support.c Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning ("Couldn't find pixmap file: %s", filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff -r 000000000000 -r ca9155129253 support.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/support.h Tue Dec 04 16:48:51 2007 +0100 @@ -0,0 +1,44 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps used in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); +