cropper

annotate interface.c @ 7:ec2d11d96fb0

image is now gdk-pixbuff; zoom implemented in a basic way
author meillo@marmaro.de
date Wed, 19 Mar 2008 23:01:43 +0100
parents 61e5a1727231
children b0824876d379
rev   line source
meillo@0 1 #include <sys/types.h>
meillo@0 2 #include <sys/stat.h>
meillo@0 3 #include <unistd.h>
meillo@0 4 #include <string.h>
meillo@0 5 #include <stdio.h>
meillo@0 6
meillo@0 7 #include <gdk/gdkkeysyms.h>
meillo@0 8 #include <gtk/gtk.h>
meillo@7 9 #include <gdk-pixbuf/gdk-pixbuf.h>
meillo@0 10
meillo@5 11 #include "main.h"
meillo@0 12 #include "callbacks.h"
meillo@0 13 #include "interface.h"
meillo@0 14 #include "support.h"
meillo@0 15
meillo@0 16 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
meillo@0 17 g_object_set_data_full (G_OBJECT (component), name, \
meillo@0 18 gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
meillo@0 19
meillo@0 20 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
meillo@0 21 g_object_set_data (G_OBJECT (component), name, widget)
meillo@0 22
meillo@0 23 GtkWidget*
meillo@0 24 create_cropper_window (void)
meillo@0 25 {
meillo@0 26 GtkWidget *cropper_window;
meillo@0 27 GtkWidget *dialog_vbox1;
meillo@0 28 GtkWidget *hbox1;
meillo@0 29 GtkWidget *vbox1;
meillo@0 30 GtkWidget *vbox2;
meillo@0 31 GtkWidget *label1;
meillo@0 32 GtkWidget *hbox2;
meillo@0 33 GtkWidget *label2;
meillo@0 34 GtkWidget *table2;
meillo@0 35 GtkWidget *label3;
meillo@0 36 GtkWidget *label5;
meillo@0 37 GtkWidget *label4;
meillo@0 38 GtkWidget *label6;
meillo@0 39 GtkWidget *hbox5;
meillo@0 40 GtkObject *crop_x_spinbutton_adj;
meillo@0 41 GtkWidget *crop_x_spinbutton;
meillo@0 42 GtkWidget *hbox6;
meillo@0 43 GtkObject *crop_y_spinbutton_adj;
meillo@0 44 GtkWidget *crop_y_spinbutton;
meillo@0 45 GtkWidget *hbox7;
meillo@0 46 GtkObject *crop_width_spinbutton_adj;
meillo@0 47 GtkWidget *crop_width_spinbutton;
meillo@0 48 GtkWidget *hbox8;
meillo@0 49 GtkObject *crop_height_spinbutton_adj;
meillo@0 50 GtkWidget *crop_height_spinbutton;
meillo@0 51 GtkWidget *vbox4;
meillo@0 52 GtkWidget *label7;
meillo@0 53 GtkWidget *hbox3;
meillo@0 54 GtkWidget *label8;
meillo@0 55 GtkWidget *table3;
meillo@0 56 GtkWidget *hbox10;
meillo@0 57 GtkWidget *custom_ratio_box;
meillo@0 58 GtkObject *ratio_w_spinbutton_adj;
meillo@0 59 GtkWidget *ratio_w_spinbutton;
meillo@0 60 GtkWidget *ratio_swap_button;
meillo@0 61 GtkWidget *eventbox1;
meillo@0 62 GtkWidget *ratio_swap_image;
meillo@0 63 GtkObject *ratio_h_spinbutton_adj;
meillo@0 64 GtkWidget *ratio_h_spinbutton;
meillo@0 65 GtkWidget *ratio_optionmenu;
meillo@0 66 GtkWidget *menu1;
meillo@2 67 GtkWidget *ratio_none;
meillo@2 68 GtkWidget *ratio_square;
meillo@2 69 GtkWidget *ratio_4x3;
meillo@2 70 GtkWidget *ratio_3x2;
meillo@2 71 GtkWidget *ratio_custom;
meillo@0 72 GtkWidget *vbox5;
meillo@0 73 GtkWidget *frame1;
meillo@0 74 GtkWidget *vbox7;
meillo@0 75 GtkWidget *nav_container;
meillo@5 76 GtkWidget *image_area;
meillo@0 77 GtkWidget *hbox16;
meillo@0 78 GtkWidget *hbox17;
meillo@0 79 GtkWidget *crop_zoom_in_button;
meillo@0 80 GtkWidget *image2;
meillo@0 81 GtkWidget *crop_zoom_out_button;
meillo@0 82 GtkWidget *image4;
meillo@0 83 GtkWidget *crop_zoom_100_button;
meillo@0 84 GtkWidget *image3;
meillo@0 85 GtkWidget *crop_zoom_fit_button;
meillo@0 86 GtkWidget *image1;
meillo@4 87 GtkWidget *dialog_action_area1;
meillo@4 88 GtkWidget *crop_okbutton;
meillo@4 89 GtkWidget *alignment1;
meillo@4 90 GtkWidget *hbox11;
meillo@4 91 GtkWidget *crop_image;
meillo@4 92 GtkWidget *label12;
meillo@4 93
meillo@0 94
meillo@0 95 cropper_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
meillo@0 96 gtk_widget_set_name (cropper_window, "cropper_window");
meillo@0 97 gtk_container_set_border_width (GTK_CONTAINER (cropper_window), 6);
meillo@0 98 gtk_window_set_title (GTK_WINDOW (cropper_window), "Cropper");
meillo@0 99
meillo@0 100 dialog_vbox1 = gtk_vbox_new (FALSE, 6);
meillo@0 101 gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
meillo@0 102 gtk_widget_show (dialog_vbox1);
meillo@0 103 gtk_container_add (GTK_CONTAINER (cropper_window), dialog_vbox1);
meillo@0 104
meillo@0 105 hbox1 = gtk_hbox_new (FALSE, 12);
meillo@0 106 gtk_widget_set_name (hbox1, "hbox1");
meillo@0 107 gtk_widget_show (hbox1);
meillo@0 108 gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);
meillo@0 109 gtk_container_set_border_width (GTK_CONTAINER (hbox1), 5);
meillo@0 110
meillo@0 111 vbox1 = gtk_vbox_new (FALSE, 12);
meillo@0 112 gtk_widget_set_name (vbox1, "vbox1");
meillo@0 113 gtk_widget_show (vbox1);
meillo@0 114 gtk_box_pack_start (GTK_BOX (hbox1), vbox1, FALSE, TRUE, 0);
meillo@0 115
meillo@0 116 vbox2 = gtk_vbox_new (FALSE, 6);
meillo@0 117 gtk_widget_set_name (vbox2, "vbox2");
meillo@0 118 gtk_widget_show (vbox2);
meillo@0 119 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
meillo@0 120
meillo@0 121 label1 = gtk_label_new ("<b>Selection</b>");
meillo@0 122 gtk_widget_set_name (label1, "label1");
meillo@0 123 gtk_widget_show (label1);
meillo@0 124 gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0);
meillo@0 125 gtk_label_set_use_markup (GTK_LABEL (label1), TRUE);
meillo@0 126 gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
meillo@0 127
meillo@0 128 hbox2 = gtk_hbox_new (FALSE, 0);
meillo@0 129 gtk_widget_set_name (hbox2, "hbox2");
meillo@0 130 gtk_widget_show (hbox2);
meillo@0 131 gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 0);
meillo@0 132
meillo@0 133 label2 = gtk_label_new (" ");
meillo@0 134 gtk_widget_set_name (label2, "label2");
meillo@0 135 gtk_widget_show (label2);
meillo@0 136 gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0);
meillo@0 137
meillo@0 138 table2 = gtk_table_new (4, 2, FALSE);
meillo@0 139 gtk_widget_set_name (table2, "table2");
meillo@0 140 gtk_widget_show (table2);
meillo@0 141 gtk_box_pack_start (GTK_BOX (hbox2), table2, TRUE, TRUE, 0);
meillo@0 142 gtk_table_set_row_spacings (GTK_TABLE (table2), 6);
meillo@0 143 gtk_table_set_col_spacings (GTK_TABLE (table2), 6);
meillo@0 144
meillo@0 145 label3 = gtk_label_new_with_mnemonic ("_X:");
meillo@0 146 gtk_widget_set_name (label3, "label3");
meillo@0 147 gtk_widget_show (label3);
meillo@0 148 gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 0, 1,
meillo@0 149 (GtkAttachOptions) (GTK_FILL),
meillo@0 150 (GtkAttachOptions) (0), 0, 0);
meillo@0 151 gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
meillo@0 152
meillo@0 153 label5 = gtk_label_new_with_mnemonic ("_Y:");
meillo@0 154 gtk_widget_set_name (label5, "label5");
meillo@0 155 gtk_widget_show (label5);
meillo@0 156 gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 1, 2,
meillo@0 157 (GtkAttachOptions) (GTK_FILL),
meillo@0 158 (GtkAttachOptions) (0), 0, 0);
meillo@0 159 gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
meillo@0 160
meillo@0 161 label4 = gtk_label_new_with_mnemonic ("_Width:");
meillo@0 162 gtk_widget_set_name (label4, "label4");
meillo@0 163 gtk_widget_show (label4);
meillo@0 164 gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 2, 3,
meillo@0 165 (GtkAttachOptions) (GTK_FILL),
meillo@0 166 (GtkAttachOptions) (0), 0, 0);
meillo@0 167 gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
meillo@0 168
meillo@0 169 label6 = gtk_label_new_with_mnemonic ("_Height:");
meillo@0 170 gtk_widget_set_name (label6, "label6");
meillo@0 171 gtk_widget_show (label6);
meillo@0 172 gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 3, 4,
meillo@0 173 (GtkAttachOptions) (GTK_FILL),
meillo@0 174 (GtkAttachOptions) (0), 0, 0);
meillo@0 175 gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
meillo@0 176
meillo@0 177 hbox5 = gtk_hbox_new (FALSE, 0);
meillo@0 178 gtk_widget_set_name (hbox5, "hbox5");
meillo@0 179 gtk_widget_show (hbox5);
meillo@0 180 gtk_table_attach (GTK_TABLE (table2), hbox5, 1, 2, 0, 1,
meillo@0 181 (GtkAttachOptions) (GTK_FILL),
meillo@0 182 (GtkAttachOptions) (GTK_FILL), 0, 0);
meillo@0 183
meillo@0 184 crop_x_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
meillo@0 185 crop_x_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_x_spinbutton_adj), 1, 0);
meillo@0 186 gtk_widget_set_name (crop_x_spinbutton, "crop_x_spinbutton");
meillo@0 187 gtk_widget_show (crop_x_spinbutton);
meillo@0 188 gtk_box_pack_start (GTK_BOX (hbox5), crop_x_spinbutton, FALSE, TRUE, 0);
meillo@0 189
meillo@0 190 hbox6 = gtk_hbox_new (FALSE, 0);
meillo@0 191 gtk_widget_set_name (hbox6, "hbox6");
meillo@0 192 gtk_widget_show (hbox6);
meillo@0 193 gtk_table_attach (GTK_TABLE (table2), hbox6, 1, 2, 1, 2,
meillo@0 194 (GtkAttachOptions) (GTK_FILL),
meillo@0 195 (GtkAttachOptions) (GTK_FILL), 0, 0);
meillo@0 196
meillo@0 197 crop_y_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
meillo@0 198 crop_y_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_y_spinbutton_adj), 1, 0);
meillo@0 199 gtk_widget_set_name (crop_y_spinbutton, "crop_y_spinbutton");
meillo@0 200 gtk_widget_show (crop_y_spinbutton);
meillo@0 201 gtk_box_pack_start (GTK_BOX (hbox6), crop_y_spinbutton, FALSE, TRUE, 0);
meillo@0 202
meillo@0 203 hbox7 = gtk_hbox_new (FALSE, 0);
meillo@0 204 gtk_widget_set_name (hbox7, "hbox7");
meillo@0 205 gtk_widget_show (hbox7);
meillo@0 206 gtk_table_attach (GTK_TABLE (table2), hbox7, 1, 2, 2, 3,
meillo@0 207 (GtkAttachOptions) (GTK_FILL),
meillo@0 208 (GtkAttachOptions) (GTK_FILL), 0, 0);
meillo@0 209
meillo@0 210 crop_width_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
meillo@0 211 crop_width_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_width_spinbutton_adj), 1, 0);
meillo@0 212 gtk_widget_set_name (crop_width_spinbutton, "crop_width_spinbutton");
meillo@0 213 gtk_widget_show (crop_width_spinbutton);
meillo@0 214 gtk_box_pack_start (GTK_BOX (hbox7), crop_width_spinbutton, FALSE, FALSE, 0);
meillo@0 215
meillo@0 216 hbox8 = gtk_hbox_new (FALSE, 0);
meillo@0 217 gtk_widget_set_name (hbox8, "hbox8");
meillo@0 218 gtk_widget_show (hbox8);
meillo@0 219 gtk_table_attach (GTK_TABLE (table2), hbox8, 1, 2, 3, 4,
meillo@0 220 (GtkAttachOptions) (GTK_FILL),
meillo@0 221 (GtkAttachOptions) (GTK_FILL), 0, 0);
meillo@0 222
meillo@0 223 crop_height_spinbutton_adj = gtk_adjustment_new (1, 0, 300, 1, 10, 1);
meillo@0 224 crop_height_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (crop_height_spinbutton_adj), 1, 0);
meillo@0 225 gtk_widget_set_name (crop_height_spinbutton, "crop_height_spinbutton");
meillo@0 226 gtk_widget_show (crop_height_spinbutton);
meillo@0 227 gtk_box_pack_start (GTK_BOX (hbox8), crop_height_spinbutton, FALSE, FALSE, 0);
meillo@0 228
meillo@0 229 vbox4 = gtk_vbox_new (FALSE, 6);
meillo@0 230 gtk_widget_set_name (vbox4, "vbox4");
meillo@0 231 gtk_widget_show (vbox4);
meillo@0 232 gtk_box_pack_start (GTK_BOX (vbox1), vbox4, FALSE, TRUE, 0);
meillo@0 233
meillo@0 234 label7 = gtk_label_new ("<b>Aspect ratio</b>");
meillo@0 235 gtk_widget_set_name (label7, "label7");
meillo@0 236 gtk_widget_show (label7);
meillo@0 237 gtk_box_pack_start (GTK_BOX (vbox4), label7, FALSE, FALSE, 0);
meillo@0 238 gtk_label_set_use_markup (GTK_LABEL (label7), TRUE);
meillo@0 239 gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
meillo@0 240
meillo@0 241 hbox3 = gtk_hbox_new (FALSE, 0);
meillo@0 242 gtk_widget_set_name (hbox3, "hbox3");
meillo@0 243 gtk_widget_show (hbox3);
meillo@0 244 gtk_box_pack_start (GTK_BOX (vbox4), hbox3, FALSE, FALSE, 0);
meillo@0 245
meillo@0 246 label8 = gtk_label_new (" ");
meillo@0 247 gtk_widget_set_name (label8, "label8");
meillo@0 248 gtk_widget_show (label8);
meillo@0 249 gtk_box_pack_start (GTK_BOX (hbox3), label8, FALSE, FALSE, 0);
meillo@0 250
meillo@0 251 table3 = gtk_table_new (2, 2, FALSE);
meillo@0 252 gtk_widget_set_name (table3, "table3");
meillo@0 253 gtk_widget_show (table3);
meillo@0 254 gtk_box_pack_start (GTK_BOX (hbox3), table3, TRUE, TRUE, 0);
meillo@0 255 gtk_table_set_row_spacings (GTK_TABLE (table3), 6);
meillo@0 256 gtk_table_set_col_spacings (GTK_TABLE (table3), 6);
meillo@0 257
meillo@0 258 hbox10 = gtk_hbox_new (FALSE, 6);
meillo@0 259 gtk_widget_set_name (hbox10, "hbox10");
meillo@0 260 gtk_widget_show (hbox10);
meillo@0 261 gtk_table_attach (GTK_TABLE (table3), hbox10, 0, 2, 1, 2,
meillo@0 262 (GtkAttachOptions) (GTK_FILL),
meillo@0 263 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
meillo@0 264
meillo@0 265 custom_ratio_box = gtk_hbox_new (FALSE, 6);
meillo@0 266 gtk_widget_set_name (custom_ratio_box, "custom_ratio_box");
meillo@0 267 gtk_widget_show (custom_ratio_box);
meillo@0 268 gtk_box_pack_start (GTK_BOX (hbox10), custom_ratio_box, TRUE, TRUE, 0);
meillo@0 269
meillo@0 270 ratio_w_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10);
meillo@0 271 ratio_w_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_w_spinbutton_adj), 1, 0);
meillo@0 272 gtk_widget_set_name (ratio_w_spinbutton, "ratio_w_spinbutton");
meillo@0 273 gtk_widget_show (ratio_w_spinbutton);
meillo@0 274 gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_w_spinbutton, FALSE, TRUE, 0);
meillo@0 275
meillo@0 276 ratio_swap_button = gtk_button_new ();
meillo@0 277 gtk_widget_set_name (ratio_swap_button, "ratio_swap_button");
meillo@0 278 gtk_widget_show (ratio_swap_button);
meillo@0 279 gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_swap_button, FALSE, FALSE, 0);
meillo@0 280 gtk_button_set_relief (GTK_BUTTON (ratio_swap_button), GTK_RELIEF_NONE);
meillo@0 281
meillo@0 282 eventbox1 = gtk_event_box_new ();
meillo@0 283 gtk_widget_set_name (eventbox1, "eventbox1");
meillo@0 284 gtk_widget_show (eventbox1);
meillo@0 285 gtk_container_add (GTK_CONTAINER (ratio_swap_button), eventbox1);
meillo@0 286
meillo@0 287 ratio_swap_image = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_BUTTON);
meillo@0 288 gtk_widget_set_name (ratio_swap_image, "ratio_swap_image");
meillo@0 289 gtk_widget_show (ratio_swap_image);
meillo@0 290 gtk_container_add (GTK_CONTAINER (eventbox1), ratio_swap_image);
meillo@0 291
meillo@0 292 ratio_h_spinbutton_adj = gtk_adjustment_new (1, 1, 9999, 1, 10, 10);
meillo@0 293 ratio_h_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (ratio_h_spinbutton_adj), 1, 0);
meillo@0 294 gtk_widget_set_name (ratio_h_spinbutton, "ratio_h_spinbutton");
meillo@0 295 gtk_widget_show (ratio_h_spinbutton);
meillo@0 296 gtk_box_pack_start (GTK_BOX (custom_ratio_box), ratio_h_spinbutton, FALSE, TRUE, 0);
meillo@0 297 gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (ratio_h_spinbutton), GTK_UPDATE_IF_VALID);
meillo@0 298
meillo@0 299 ratio_optionmenu = gtk_option_menu_new ();
meillo@0 300 gtk_widget_set_name (ratio_optionmenu, "ratio_optionmenu");
meillo@0 301 gtk_widget_show (ratio_optionmenu);
meillo@0 302 gtk_table_attach (GTK_TABLE (table3), ratio_optionmenu, 0, 2, 0, 1,
meillo@0 303 (GtkAttachOptions) (GTK_FILL),
meillo@0 304 (GtkAttachOptions) (0), 0, 0);
meillo@0 305
meillo@0 306 menu1 = gtk_menu_new ();
meillo@0 307 gtk_widget_set_name (menu1, "menu1");
meillo@0 308
meillo@2 309 ratio_none = gtk_menu_item_new_with_mnemonic ("None");
meillo@2 310 gtk_widget_set_name (ratio_none, "ratio_none");
meillo@2 311 gtk_widget_show (ratio_none);
meillo@2 312 gtk_container_add (GTK_CONTAINER (menu1), ratio_none);
meillo@0 313
meillo@2 314 ratio_square = gtk_menu_item_new_with_mnemonic ("Square");
meillo@2 315 gtk_widget_set_name (ratio_square, "ratio_square");
meillo@2 316 gtk_widget_show (ratio_square);
meillo@2 317 gtk_container_add (GTK_CONTAINER (menu1), ratio_square);
meillo@0 318
meillo@2 319 ratio_4x3 = gtk_menu_item_new_with_mnemonic ("4 x 3 (Book, DVD)");
meillo@2 320 gtk_widget_set_name (ratio_4x3, "ratio_4x3");
meillo@2 321 gtk_widget_show (ratio_4x3);
meillo@2 322 gtk_container_add (GTK_CONTAINER (menu1), ratio_4x3);
meillo@0 323
meillo@2 324 ratio_3x2 = gtk_menu_item_new_with_mnemonic ("4 x 6 (Postcard)");
meillo@2 325 gtk_widget_set_name (ratio_3x2, "ratio_3x2");
meillo@2 326 gtk_widget_show (ratio_3x2);
meillo@2 327 gtk_container_add (GTK_CONTAINER (menu1), ratio_3x2);
meillo@0 328
meillo@2 329 ratio_custom = gtk_menu_item_new_with_mnemonic ("Custom");
meillo@2 330 gtk_widget_set_name (ratio_custom, "ratio_custom");
meillo@2 331 gtk_widget_show (ratio_custom);
meillo@2 332 gtk_container_add (GTK_CONTAINER (menu1), ratio_custom);
meillo@0 333
meillo@0 334 gtk_option_menu_set_menu (GTK_OPTION_MENU (ratio_optionmenu), menu1);
meillo@0 335
meillo@0 336 vbox5 = gtk_vbox_new (FALSE, 0);
meillo@0 337 gtk_widget_set_name (vbox5, "vbox5");
meillo@0 338 gtk_widget_show (vbox5);
meillo@0 339 gtk_box_pack_start (GTK_BOX (hbox1), vbox5, TRUE, TRUE, 0);
meillo@0 340
meillo@0 341 frame1 = gtk_frame_new (NULL);
meillo@0 342 gtk_widget_set_name (frame1, "frame1");
meillo@0 343 gtk_widget_show (frame1);
meillo@0 344 gtk_box_pack_start (GTK_BOX (vbox5), frame1, TRUE, TRUE, 0);
meillo@0 345 gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_NONE);
meillo@0 346
meillo@0 347 vbox7 = gtk_vbox_new (FALSE, 6);
meillo@0 348 gtk_widget_set_name (vbox7, "vbox7");
meillo@0 349 gtk_widget_show (vbox7);
meillo@0 350 gtk_container_add (GTK_CONTAINER (frame1), vbox7);
meillo@0 351
meillo@0 352 nav_container = gtk_hbox_new (FALSE, 0);
meillo@0 353 gtk_widget_set_name (nav_container, "nav_container");
meillo@0 354 gtk_widget_show (nav_container);
meillo@0 355 gtk_box_pack_start (GTK_BOX (vbox7), nav_container, TRUE, TRUE, 0);
meillo@0 356
meillo@5 357 /* image_area */
meillo@7 358 image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL);
meillo@7 359 image_area = gtk_image_new_from_pixbuf(image_buffer);
meillo@7 360 gtk_widget_set_name(image_area, "image_area");
meillo@7 361 gtk_widget_show(image_area);
meillo@7 362 gtk_box_pack_start(GTK_BOX(nav_container), image_area, TRUE, TRUE, 0);
meillo@5 363
meillo@0 364 hbox16 = gtk_hbox_new (FALSE, 6);
meillo@0 365 gtk_widget_set_name (hbox16, "hbox16");
meillo@0 366 gtk_widget_show (hbox16);
meillo@0 367 gtk_box_pack_start (GTK_BOX (vbox7), hbox16, FALSE, TRUE, 0);
meillo@0 368
meillo@0 369 hbox17 = gtk_hbox_new (FALSE, 0);
meillo@0 370 gtk_widget_set_name (hbox17, "hbox17");
meillo@0 371 gtk_widget_show (hbox17);
meillo@0 372 gtk_box_pack_end (GTK_BOX (hbox16), hbox17, FALSE, TRUE, 0);
meillo@0 373
meillo@0 374 crop_zoom_in_button = gtk_button_new ();
meillo@0 375 gtk_widget_set_name (crop_zoom_in_button, "crop_zoom_in_button");
meillo@0 376 gtk_widget_show (crop_zoom_in_button);
meillo@0 377 gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_in_button, FALSE, FALSE, 0);
meillo@0 378 gtk_button_set_relief (GTK_BUTTON (crop_zoom_in_button), GTK_RELIEF_NONE);
meillo@0 379
meillo@0 380 image2 = gtk_image_new_from_stock ("gtk-zoom-in", GTK_ICON_SIZE_BUTTON);
meillo@0 381 gtk_widget_set_name (image2, "image2");
meillo@0 382 gtk_widget_show (image2);
meillo@0 383 gtk_container_add (GTK_CONTAINER (crop_zoom_in_button), image2);
meillo@0 384
meillo@0 385 crop_zoom_out_button = gtk_button_new ();
meillo@0 386 gtk_widget_set_name (crop_zoom_out_button, "crop_zoom_out_button");
meillo@0 387 gtk_widget_show (crop_zoom_out_button);
meillo@0 388 gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_out_button, FALSE, FALSE, 0);
meillo@0 389 gtk_button_set_relief (GTK_BUTTON (crop_zoom_out_button), GTK_RELIEF_NONE);
meillo@0 390
meillo@0 391 image4 = gtk_image_new_from_stock ("gtk-zoom-out", GTK_ICON_SIZE_BUTTON);
meillo@0 392 gtk_widget_set_name (image4, "image4");
meillo@0 393 gtk_widget_show (image4);
meillo@0 394 gtk_container_add (GTK_CONTAINER (crop_zoom_out_button), image4);
meillo@0 395
meillo@0 396 crop_zoom_100_button = gtk_button_new ();
meillo@0 397 gtk_widget_set_name (crop_zoom_100_button, "crop_zoom_100_button");
meillo@0 398 gtk_widget_show (crop_zoom_100_button);
meillo@0 399 gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_100_button, FALSE, FALSE, 0);
meillo@0 400 gtk_button_set_relief (GTK_BUTTON (crop_zoom_100_button), GTK_RELIEF_NONE);
meillo@0 401
meillo@0 402 image3 = gtk_image_new_from_stock ("gtk-zoom-100", GTK_ICON_SIZE_BUTTON);
meillo@0 403 gtk_widget_set_name (image3, "image3");
meillo@0 404 gtk_widget_show (image3);
meillo@0 405 gtk_container_add (GTK_CONTAINER (crop_zoom_100_button), image3);
meillo@0 406
meillo@0 407 crop_zoom_fit_button = gtk_button_new ();
meillo@0 408 gtk_widget_set_name (crop_zoom_fit_button, "crop_zoom_fit_button");
meillo@0 409 gtk_widget_show (crop_zoom_fit_button);
meillo@0 410 gtk_box_pack_start (GTK_BOX (hbox17), crop_zoom_fit_button, FALSE, FALSE, 0);
meillo@0 411 gtk_button_set_relief (GTK_BUTTON (crop_zoom_fit_button), GTK_RELIEF_NONE);
meillo@0 412
meillo@0 413 image1 = gtk_image_new_from_stock ("gtk-zoom-fit", GTK_ICON_SIZE_BUTTON);
meillo@0 414 gtk_widget_set_name (image1, "image1");
meillo@0 415 gtk_widget_show (image1);
meillo@0 416 gtk_container_add (GTK_CONTAINER (crop_zoom_fit_button), image1);
meillo@0 417
meillo@1 418
meillo@2 419
meillo@4 420 /*
meillo@4 421 okay_box = gtk_hbox_new (FALSE, 0);
meillo@4 422 gtk_widget_set_name (okay_box, "okay_box");
meillo@4 423 gtk_widget_show (okay_box);
meillo@4 424 gtk_box_pack_end (GTK_BOX (hbox16), okay_box, FALSE, TRUE, 0);
meillo@4 425 */
meillo@2 426
meillo@7 427 crop_okbutton = gtk_button_new ();
meillo@7 428 gtk_widget_set_name (crop_okbutton, "crop_okbutton");
meillo@7 429 gtk_widget_show (crop_okbutton);
meillo@7 430 gtk_box_pack_end (GTK_BOX (dialog_vbox1), crop_okbutton, FALSE, FALSE, 0);
meillo@7 431 GTK_WIDGET_SET_FLAGS (crop_okbutton, GTK_CAN_DEFAULT);
meillo@2 432
meillo@7 433 alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
meillo@7 434 gtk_widget_set_name (alignment1, "alignment1");
meillo@7 435 gtk_widget_show (alignment1);
meillo@7 436 gtk_container_add (GTK_CONTAINER (crop_okbutton), alignment1);
meillo@2 437
meillo@7 438 hbox11 = gtk_hbox_new (FALSE, 2);
meillo@7 439 gtk_widget_set_name (hbox11, "hbox11");
meillo@7 440 gtk_widget_show (hbox11);
meillo@7 441 gtk_container_add (GTK_CONTAINER (alignment1), hbox11);
meillo@4 442
meillo@7 443 crop_image = gtk_image_new_from_stock ("gtk-ok", GTK_ICON_SIZE_BUTTON);
meillo@7 444 gtk_widget_set_name (crop_image, "crop_image");
meillo@7 445 gtk_widget_show (crop_image);
meillo@7 446 gtk_box_pack_start (GTK_BOX (hbox11), crop_image, FALSE, FALSE, 0);
meillo@4 447
meillo@7 448 label12 = gtk_label_new_with_mnemonic ("_Crop");
meillo@7 449 gtk_widget_set_name (label12, "label12");
meillo@7 450 gtk_widget_show (label12);
meillo@7 451 gtk_box_pack_start (GTK_BOX (hbox11), label12, FALSE, FALSE, 0);
meillo@4 452
meillo@4 453
meillo@4 454
meillo@4 455
meillo@4 456
meillo@7 457 g_signal_connect (G_OBJECT (cropper_window), "show",
meillo@7 458 G_CALLBACK (on_cropper_window_create),
meillo@7 459 NULL);
meillo@4 460 /* destroy */
meillo@4 461 g_signal_connect (G_OBJECT (cropper_window), "destroy",
meillo@0 462 G_CALLBACK (on_cropper_window_destroy),
meillo@0 463 NULL);
meillo@2 464
meillo@4 465
meillo@4 466 /* crop */
meillo@4 467 g_signal_connect (G_OBJECT (crop_okbutton), "clicked",
meillo@4 468 G_CALLBACK (on_crop_clicked),
meillo@4 469 NULL);
meillo@4 470
meillo@4 471
meillo@7 472 /* zoom */
meillo@7 473 g_signal_connect (G_OBJECT (crop_zoom_in_button), "clicked",
meillo@7 474 G_CALLBACK (on_zoom_in_button_clicked),
meillo@7 475 NULL);
meillo@7 476 g_signal_connect (G_OBJECT (crop_zoom_out_button), "clicked",
meillo@7 477 G_CALLBACK (on_zoom_out_button_clicked),
meillo@7 478 NULL);
meillo@7 479 g_signal_connect (G_OBJECT (crop_zoom_100_button), "clicked",
meillo@7 480 G_CALLBACK (on_zoom_100_button_clicked),
meillo@7 481 NULL);
meillo@7 482 g_signal_connect (G_OBJECT (crop_zoom_fit_button), "clicked",
meillo@7 483 G_CALLBACK (on_zoom_fit_button_clicked),
meillo@7 484 NULL);
meillo@7 485
meillo@4 486
meillo@4 487 /* aspect ratio */
meillo@4 488 /*
meillo@4 489 g_signal_connect (G_OBJECT (ratio_w_spinbutton), "value_changed",
meillo@0 490 G_CALLBACK (on_ratio_w_spinbutton_value_changed),
meillo@0 491 NULL);
meillo@4 492 g_signal_connect (G_OBJECT (ratio_swap_button), "clicked",
meillo@0 493 G_CALLBACK (on_ratio_swap_button_clicked),
meillo@0 494 NULL);
meillo@4 495 g_signal_connect (G_OBJECT (ratio_h_spinbutton), "value_changed",
meillo@0 496 G_CALLBACK (on_ratio_h_spinbutton_value_changed),
meillo@0 497 NULL);
meillo@2 498
meillo@4 499 g_signal_connect (G_OBJECT (ratio_none), "activate",
meillo@2 500 G_CALLBACK (on_ratio_none_activate),
meillo@0 501 NULL);
meillo@4 502 g_signal_connect (G_OBJECT (ratio_square), "activate",
meillo@2 503 G_CALLBACK (on_ratio_square_activate),
meillo@0 504 NULL);
meillo@4 505 g_signal_connect (G_OBJECT (ratio_4x3), "activate",
meillo@2 506 G_CALLBACK (on_ratio_4x3_activate),
meillo@0 507 NULL);
meillo@4 508 g_signal_connect (G_OBJECT (ratio_3x2), "activate",
meillo@2 509 G_CALLBACK (on_ratio_3x2_activate),
meillo@0 510 NULL);
meillo@4 511 g_signal_connect (G_OBJECT (ratio_custom), "activate",
meillo@2 512 G_CALLBACK (on_ratio_custom_activate),
meillo@0 513 NULL);
meillo@2 514
meillo@4 515 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "ratio_optionmenu")), "changed",
meillo@4 516 G_CALLBACK (ratio_optionmenu_changed_cb),
meillo@4 517 NULL);
meillo@4 518 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "ratio_w_spinbutton")), "value_changed",
meillo@4 519 G_CALLBACK (ratio_value_changed_cb),
meillo@4 520 NULL);
meillo@4 521 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "ratio_h_spinbutton")), "value_changed",
meillo@4 522 G_CALLBACK (ratio_value_changed_cb),
meillo@4 523 NULL);
meillo@4 524 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "ratio_swap_button")), "clicked",
meillo@4 525 G_CALLBACK (ratio_swap_button_cb),
meillo@4 526 NULL);
meillo@4 527 */
meillo@4 528
meillo@4 529
meillo@4 530 /* selection */
meillo@4 531 /*
meillo@4 532 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "crop_x_spinbutton")), "value_changed",
meillo@4 533 G_CALLBACK (selection_x_value_changed_cb),
meillo@4 534 data);
meillo@4 535 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "crop_y_spinbutton")), "value_changed",
meillo@4 536 G_CALLBACK (selection_y_value_changed_cb),
meillo@4 537 data);
meillo@4 538 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "crop_width_spinbutton")), "value_changed",
meillo@4 539 G_CALLBACK (selection_width_value_changed_cb),
meillo@4 540 data);
meillo@4 541 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "crop_height_spinbutton")), "value_changed",
meillo@4 542 G_CALLBACK (selection_height_value_changed_cb),
meillo@4 543 data);
meillo@4 544 g_signal_connect (G_OBJECT (lookup_widget(cropper_window, "crop_image")), "selection_changed",
meillo@4 545 G_CALLBACK (selection_changed_cb),
meillo@4 546 data);
meillo@4 547 */
meillo@4 548
meillo@4 549
meillo@4 550
meillo@4 551
meillo@4 552
meillo@4 553
meillo@4 554
meillo@4 555
meillo@4 556
meillo@4 557
meillo@4 558
meillo@4 559
meillo@4 560
meillo@4 561
meillo@4 562
meillo@0 563
meillo@0 564 /* Store pointers to all widgets, for use by lookup_widget(). */
meillo@0 565 GLADE_HOOKUP_OBJECT_NO_REF (cropper_window, cropper_window, "cropper_window");
meillo@0 566 GLADE_HOOKUP_OBJECT (cropper_window, dialog_vbox1, "dialog_vbox1");
meillo@0 567 GLADE_HOOKUP_OBJECT (cropper_window, hbox1, "hbox1");
meillo@0 568 GLADE_HOOKUP_OBJECT (cropper_window, vbox1, "vbox1");
meillo@0 569 GLADE_HOOKUP_OBJECT (cropper_window, vbox2, "vbox2");
meillo@0 570 GLADE_HOOKUP_OBJECT (cropper_window, label1, "label1");
meillo@0 571 GLADE_HOOKUP_OBJECT (cropper_window, hbox2, "hbox2");
meillo@0 572 GLADE_HOOKUP_OBJECT (cropper_window, label2, "label2");
meillo@0 573 GLADE_HOOKUP_OBJECT (cropper_window, table2, "table2");
meillo@0 574 GLADE_HOOKUP_OBJECT (cropper_window, label3, "label3");
meillo@0 575 GLADE_HOOKUP_OBJECT (cropper_window, label5, "label5");
meillo@0 576 GLADE_HOOKUP_OBJECT (cropper_window, label4, "label4");
meillo@0 577 GLADE_HOOKUP_OBJECT (cropper_window, label6, "label6");
meillo@0 578 GLADE_HOOKUP_OBJECT (cropper_window, hbox5, "hbox5");
meillo@0 579 GLADE_HOOKUP_OBJECT (cropper_window, crop_x_spinbutton, "crop_x_spinbutton");
meillo@0 580 GLADE_HOOKUP_OBJECT (cropper_window, hbox6, "hbox6");
meillo@0 581 GLADE_HOOKUP_OBJECT (cropper_window, crop_y_spinbutton, "crop_y_spinbutton");
meillo@0 582 GLADE_HOOKUP_OBJECT (cropper_window, hbox7, "hbox7");
meillo@0 583 GLADE_HOOKUP_OBJECT (cropper_window, crop_width_spinbutton, "crop_width_spinbutton");
meillo@0 584 GLADE_HOOKUP_OBJECT (cropper_window, hbox8, "hbox8");
meillo@0 585 GLADE_HOOKUP_OBJECT (cropper_window, crop_height_spinbutton, "crop_height_spinbutton");
meillo@0 586 GLADE_HOOKUP_OBJECT (cropper_window, vbox4, "vbox4");
meillo@0 587 GLADE_HOOKUP_OBJECT (cropper_window, label7, "label7");
meillo@0 588 GLADE_HOOKUP_OBJECT (cropper_window, hbox3, "hbox3");
meillo@0 589 GLADE_HOOKUP_OBJECT (cropper_window, label8, "label8");
meillo@0 590 GLADE_HOOKUP_OBJECT (cropper_window, table3, "table3");
meillo@0 591 GLADE_HOOKUP_OBJECT (cropper_window, hbox10, "hbox10");
meillo@0 592 GLADE_HOOKUP_OBJECT (cropper_window, custom_ratio_box, "custom_ratio_box");
meillo@0 593 GLADE_HOOKUP_OBJECT (cropper_window, ratio_w_spinbutton, "ratio_w_spinbutton");
meillo@0 594 GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_button, "ratio_swap_button");
meillo@0 595 GLADE_HOOKUP_OBJECT (cropper_window, eventbox1, "eventbox1");
meillo@0 596 GLADE_HOOKUP_OBJECT (cropper_window, ratio_swap_image, "ratio_swap_image");
meillo@0 597 GLADE_HOOKUP_OBJECT (cropper_window, ratio_h_spinbutton, "ratio_h_spinbutton");
meillo@0 598 GLADE_HOOKUP_OBJECT (cropper_window, ratio_optionmenu, "ratio_optionmenu");
meillo@0 599 GLADE_HOOKUP_OBJECT (cropper_window, menu1, "menu1");
meillo@2 600 GLADE_HOOKUP_OBJECT (cropper_window, ratio_none, "ratio_none");
meillo@2 601 GLADE_HOOKUP_OBJECT (cropper_window, ratio_square, "ratio_square");
meillo@2 602 GLADE_HOOKUP_OBJECT (cropper_window, ratio_4x3, "ratio_4x3");
meillo@2 603 GLADE_HOOKUP_OBJECT (cropper_window, ratio_3x2, "ratio_3x2");
meillo@2 604 GLADE_HOOKUP_OBJECT (cropper_window, ratio_custom, "ratio_custom");
meillo@0 605 GLADE_HOOKUP_OBJECT (cropper_window, vbox5, "vbox5");
meillo@0 606 GLADE_HOOKUP_OBJECT (cropper_window, frame1, "frame1");
meillo@0 607 GLADE_HOOKUP_OBJECT (cropper_window, vbox7, "vbox7");
meillo@0 608 GLADE_HOOKUP_OBJECT (cropper_window, nav_container, "nav_container");
meillo@5 609 GLADE_HOOKUP_OBJECT (cropper_window, image_area, "image_area");
meillo@7 610 GLADE_HOOKUP_OBJECT (cropper_window, image_buffer, "image_buffer");
meillo@0 611 GLADE_HOOKUP_OBJECT (cropper_window, hbox16, "hbox16");
meillo@0 612 GLADE_HOOKUP_OBJECT (cropper_window, hbox17, "hbox17");
meillo@0 613 GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_in_button, "crop_zoom_in_button");
meillo@0 614 GLADE_HOOKUP_OBJECT (cropper_window, image2, "image2");
meillo@0 615 GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_out_button, "crop_zoom_out_button");
meillo@0 616 GLADE_HOOKUP_OBJECT (cropper_window, image4, "image4");
meillo@0 617 GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_100_button, "crop_zoom_100_button");
meillo@0 618 GLADE_HOOKUP_OBJECT (cropper_window, image3, "image3");
meillo@0 619 GLADE_HOOKUP_OBJECT (cropper_window, crop_zoom_fit_button, "crop_zoom_fit_button");
meillo@0 620 GLADE_HOOKUP_OBJECT (cropper_window, image1, "image1");
meillo@4 621 /*GLADE_HOOKUP_OBJECT_NO_REF (cropper_window, dialog_action_area1, "dialog_action_area1"); */
meillo@7 622 GLADE_HOOKUP_OBJECT (cropper_window, crop_okbutton, "crop_okbutton");
meillo@4 623 GLADE_HOOKUP_OBJECT (cropper_window, alignment1, "alignment1");
meillo@4 624 GLADE_HOOKUP_OBJECT (cropper_window, hbox11, "hbox11");
meillo@4 625 GLADE_HOOKUP_OBJECT (cropper_window, crop_image, "crop_image");
meillo@4 626 GLADE_HOOKUP_OBJECT (cropper_window, label12, "label12");
meillo@4 627
meillo@0 628
meillo@0 629 return cropper_window;
meillo@0 630 }
meillo@0 631