cropper

annotate interface.c @ 11:c18ba4ea1514

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