cropper
changeset 14:da18f2d4f92f
removed all buttons and stuff from the window; cleaned up
author | meillo@marmaro.de |
---|---|
date | Thu, 04 Mar 2010 18:31:28 +0100 |
parents | 13bc21684b8a |
children | 7dbf3879939a |
files | callbacks.c callbacks.h interface.c main.c |
diffstat | 4 files changed, 97 insertions(+), 556 deletions(-) [+] |
line diff
1.1 --- a/callbacks.c Thu Mar 04 17:05:38 2010 +0100 1.2 +++ b/callbacks.c Thu Mar 04 18:31:28 2010 +0100 1.3 @@ -147,7 +147,6 @@ 1.4 "crop_image")), TRUE, (double) h / w); 1.5 } 1.6 1.7 -*/ 1.8 1.9 1.10 1.11 @@ -155,8 +154,6 @@ 1.12 1.13 1.14 1.15 - 1.16 -/* 1.17 void 1.18 on_ratio_w_spinbutton_value_changed(GtkSpinButton* spinbutton, gpointer user_data) 1.19 { 1.20 @@ -268,7 +265,7 @@ 1.21 1.22 1.23 void 1.24 -on_crop_clicked(GtkButton* button, gpointer user_data) 1.25 +crop(void) 1.26 { 1.27 char crop_call[256]; 1.28 1.29 @@ -327,6 +324,12 @@ 1.30 return FALSE; 1.31 } 1.32 switch (pKey->keyval) { 1.33 + case GDK_q: 1.34 + gtk_main_quit(); 1.35 + break; 1.36 + case GDK_Return: 1.37 + crop(); 1.38 + break; 1.39 case GDK_plus: 1.40 on_zoom_in_button_clicked(NULL, userdata); 1.41 break;
2.1 --- a/callbacks.h Thu Mar 04 17:05:38 2010 +0100 2.2 +++ b/callbacks.h Thu Mar 04 18:31:28 2010 +0100 2.3 @@ -5,7 +5,21 @@ 2.4 2.5 double ratio; 2.6 2.7 +void crop(void); 2.8 +gboolean on_key_press(GtkWidget* window, GdkEventKey* pKey, gpointer userdata); 2.9 +void on_cropper_window_create(GtkObject* object, gpointer user_data); 2.10 +void on_cropper_window_destroy(GtkObject* object, gpointer user_data); 2.11 + 2.12 + 2.13 + 2.14 /* 2.15 +gboolean on_cropper_window_delete_event(GtkWidget* widget, GdkEvent *event, gpointer user_data); 2.16 + 2.17 +void on_zoom_in_button_clicked(GtkObject* object, gpointer user_data); 2.18 +void on_zoom_out_button_clicked(GtkObject* object, gpointer user_data); 2.19 +void on_zoom_100_button_clicked(GtkObject* object, gpointer user_data); 2.20 +void on_zoom_fit_button_clicked(GtkObject* object, gpointer user_data); 2.21 + 2.22 void on_ratio_none_activate(GtkMenuItem* menuitem, gpointer user_data); 2.23 void on_ratio_square_activate(GtkMenuItem* menuitem, gpointer user_data); 2.24 void on_ratio_4x3_activate(GtkMenuItem* menuitem, gpointer user_data); 2.25 @@ -23,17 +37,5 @@ 2.26 void on_ratio_swap_button_clicked(GtkButton* button, gpointer user_data); 2.27 */ 2.28 2.29 -void on_crop_clicked(GtkButton* button, gpointer user_data); 2.30 - 2.31 -void on_cropper_window_create(GtkObject* object, gpointer user_data); 2.32 -void on_cropper_window_destroy(GtkObject* object, gpointer user_data); 2.33 -/*gboolean on_cropper_window_delete_event(GtkWidget* widget, GdkEvent *event, gpointer user_data);*/ 2.34 - 2.35 -void on_zoom_in_button_clicked(GtkObject* object, gpointer user_data); 2.36 -void on_zoom_out_button_clicked(GtkObject* object, gpointer user_data); 2.37 -void on_zoom_100_button_clicked(GtkObject* object, gpointer user_data); 2.38 -void on_zoom_fit_button_clicked(GtkObject* object, gpointer user_data); 2.39 - 2.40 -gboolean on_key_press(GtkWidget* window, GdkEventKey* pKey, gpointer userdata); 2.41 2.42 #endif
3.1 --- a/interface.c Thu Mar 04 17:05:38 2010 +0100 3.2 +++ b/interface.c Thu Mar 04 18:31:28 2010 +0100 3.3 @@ -24,316 +24,96 @@ 3.4 { 3.5 GtkWidget *cropper_window; 3.6 GtkWidget *dialog_vbox1; 3.7 - GtkWidget *hbox1; 3.8 - GtkWidget *vbox1; 3.9 - GtkWidget *vbox2; 3.10 + GtkWidget *status; 3.11 GtkWidget *label1; 3.12 - GtkWidget *hbox2; 3.13 GtkWidget *label2; 3.14 - GtkWidget *table2; 3.15 - GtkWidget *label3; 3.16 - GtkWidget *label5; 3.17 - GtkWidget *label4; 3.18 - GtkWidget *label6; 3.19 - GtkWidget *hbox5; 3.20 - GtkObject *crop_x_spinbutton_adj; 3.21 - GtkWidget *crop_x_spinbutton; 3.22 - GtkWidget *hbox6; 3.23 - GtkObject *crop_y_spinbutton_adj; 3.24 - GtkWidget *crop_y_spinbutton; 3.25 - GtkWidget *hbox7; 3.26 - GtkObject *crop_width_spinbutton_adj; 3.27 - GtkWidget *crop_width_spinbutton; 3.28 - GtkWidget *hbox8; 3.29 - GtkObject *crop_height_spinbutton_adj; 3.30 - GtkWidget *crop_height_spinbutton; 3.31 - GtkWidget *vbox4; 3.32 - GtkWidget *label7; 3.33 - GtkWidget *hbox3; 3.34 - GtkWidget *label8; 3.35 - GtkWidget *table3; 3.36 - GtkWidget *hbox10; 3.37 - GtkWidget *custom_ratio_box; 3.38 - GtkObject *ratio_w_spinbutton_adj; 3.39 - GtkWidget *ratio_w_spinbutton; 3.40 - GtkWidget *ratio_swap_button; 3.41 - GtkWidget *eventbox1; 3.42 - GtkWidget *ratio_swap_image; 3.43 - GtkObject *ratio_h_spinbutton_adj; 3.44 - GtkWidget *ratio_h_spinbutton; 3.45 - GtkWidget *ratio_optionmenu; 3.46 - GtkWidget *menu1; 3.47 - GtkWidget *ratio_none; 3.48 - GtkWidget *ratio_square; 3.49 - GtkWidget *ratio_4x3; 3.50 - GtkWidget *ratio_3x2; 3.51 - GtkWidget *ratio_custom; 3.52 - GtkWidget *vbox5; 3.53 - GtkWidget *frame1; 3.54 - GtkWidget *vbox7; 3.55 - GtkWidget *nav_container; 3.56 - GtkWidget *hbox16; 3.57 - GtkWidget *hbox17; 3.58 - GtkWidget *crop_zoom_in_button; 3.59 - GtkWidget *image2; 3.60 - GtkWidget *crop_zoom_out_button; 3.61 - GtkWidget *image4; 3.62 - GtkWidget *crop_zoom_100_button; 3.63 - GtkWidget *image3; 3.64 - GtkWidget *crop_zoom_fit_button; 3.65 - GtkWidget *image1; 3.66 - GtkWidget *dialog_action_area1; 3.67 - GtkWidget *crop_okbutton; 3.68 - GtkWidget *alignment1; 3.69 - GtkWidget *hbox11; 3.70 - GtkWidget *crop_image; 3.71 - GtkWidget *label12; 3.72 3.73 3.74 cropper_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 3.75 gtk_widget_set_name(cropper_window, "cropper_window"); 3.76 gtk_container_set_border_width(GTK_CONTAINER(cropper_window), 6); 3.77 - gtk_window_set_title(GTK_WINDOW(cropper_window), "Cropper"); 3.78 + gtk_window_set_title(GTK_WINDOW(cropper_window), "cropper-0.2"); 3.79 3.80 dialog_vbox1 = gtk_vbox_new(FALSE, 6); 3.81 gtk_widget_set_name(dialog_vbox1, "dialog_vbox1"); 3.82 gtk_widget_show(dialog_vbox1); 3.83 gtk_container_add(GTK_CONTAINER(cropper_window), dialog_vbox1); 3.84 3.85 - hbox1 = gtk_hbox_new(FALSE, 12); 3.86 - gtk_widget_set_name(hbox1, "hbox1"); 3.87 - gtk_widget_show(hbox1); 3.88 - gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox1, TRUE, TRUE, 0); 3.89 + 3.90 + status = gtk_hbox_new(FALSE, 0); 3.91 + gtk_widget_set_name(status, "status"); 3.92 + gtk_widget_show(status); 3.93 + gtk_box_pack_end(GTK_BOX(dialog_vbox1), status, FALSE, FALSE, 0); 3.94 + 3.95 + label1 = gtk_label_new("zoom:"); 3.96 + gtk_widget_set_name(label1, "label1"); 3.97 + gtk_widget_show(label1); 3.98 + gtk_box_pack_start(GTK_BOX(status), label1, FALSE, FALSE, 0); 3.99 + 3.100 + label2 = gtk_label_new("1.0"); 3.101 + gtk_widget_set_name(label2, "label2"); 3.102 + gtk_widget_show(label2); 3.103 + gtk_box_pack_start(GTK_BOX(status), label2, FALSE, FALSE, 0); 3.104 + 3.105 +/* image_area */ 3.106 + image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL); 3.107 + image_area = gtk_image_new_from_pixbuf(image_buffer); 3.108 + 3.109 + gtk_widget_set_name(image_area, "image_area"); 3.110 + gtk_widget_show(image_area); 3.111 + gtk_box_pack_start(GTK_BOX(dialog_vbox1), image_area, TRUE, TRUE, 0); 3.112 + 3.113 + 3.114 + 3.115 + 3.116 + 3.117 +g_signal_connect(G_OBJECT(cropper_window), "show", 3.118 + G_CALLBACK(on_cropper_window_create), NULL); 3.119 + 3.120 +g_signal_connect(G_OBJECT(cropper_window), "destroy", 3.121 + G_CALLBACK(on_cropper_window_destroy), NULL); 3.122 + 3.123 +g_signal_connect(cropper_window, "key-press-event", 3.124 + G_CALLBACK(on_key_press), NULL); 3.125 + 3.126 + 3.127 + /* Store pointers to all widgets, for use by lookup_widget(). */ 3.128 + 3.129 + GLADE_HOOKUP_OBJECT_NO_REF(cropper_window, cropper_window, "cropper_window"); 3.130 + GLADE_HOOKUP_OBJECT(cropper_window, dialog_vbox1, "dialog_vbox1"); 3.131 + 3.132 + GLADE_HOOKUP_OBJECT(cropper_window, label1, "label1"); 3.133 + GLADE_HOOKUP_OBJECT(cropper_window, label2, "label2"); 3.134 + GLADE_HOOKUP_OBJECT(cropper_window, status, "status"); 3.135 + GLADE_HOOKUP_OBJECT(cropper_window, image_area, "image_area"); 3.136 + GLADE_HOOKUP_OBJECT(cropper_window,(GtkWidget*) image_buffer, "image_buffer"); 3.137 + 3.138 + 3.139 + return cropper_window; 3.140 +} 3.141 + 3.142 + 3.143 + 3.144 + 3.145 + 3.146 + 3.147 + 3.148 + 3.149 + 3.150 +/* 3.151 gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); 3.152 3.153 - vbox1 = gtk_vbox_new(FALSE, 12); 3.154 - gtk_widget_set_name(vbox1, "vbox1"); 3.155 - gtk_widget_show(vbox1); 3.156 - gtk_box_pack_start(GTK_BOX(hbox1), vbox1, FALSE, TRUE, 0); 3.157 - 3.158 - vbox2 = gtk_vbox_new(FALSE, 6); 3.159 - gtk_widget_set_name(vbox2, "vbox2"); 3.160 - gtk_widget_show(vbox2); 3.161 - gtk_box_pack_start(GTK_BOX(vbox1), vbox2, FALSE, TRUE, 0); 3.162 - 3.163 label1 = gtk_label_new("<b>Selection</b>"); 3.164 - gtk_widget_set_name(label1, "label1"); 3.165 - gtk_widget_show(label1); 3.166 - gtk_box_pack_start(GTK_BOX(vbox2), label1, FALSE, FALSE, 0); 3.167 gtk_label_set_use_markup(GTK_LABEL(label1), TRUE); 3.168 gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5); 3.169 3.170 - hbox2 = gtk_hbox_new(FALSE, 0); 3.171 - gtk_widget_set_name(hbox2, "hbox2"); 3.172 - gtk_widget_show(hbox2); 3.173 - gtk_box_pack_start(GTK_BOX(vbox2), hbox2, FALSE, TRUE, 0); 3.174 - 3.175 - label2 = gtk_label_new(" "); 3.176 - gtk_widget_set_name(label2, "label2"); 3.177 - gtk_widget_show(label2); 3.178 - gtk_box_pack_start(GTK_BOX(hbox2), label2, FALSE, FALSE, 0); 3.179 - 3.180 - table2 = gtk_table_new(4, 2, FALSE); 3.181 - gtk_widget_set_name(table2, "table2"); 3.182 - gtk_widget_show(table2); 3.183 - gtk_box_pack_start(GTK_BOX(hbox2), table2, TRUE, TRUE, 0); 3.184 gtk_table_set_row_spacings(GTK_TABLE(table2), 6); 3.185 gtk_table_set_col_spacings(GTK_TABLE(table2), 6); 3.186 3.187 - label3 = gtk_label_new_with_mnemonic("_X:"); 3.188 - gtk_widget_set_name(label3, "label3"); 3.189 - gtk_widget_show(label3); 3.190 gtk_table_attach(GTK_TABLE(table2), label3, 0, 1, 0, 1,(GtkAttachOptions)(GTK_FILL), 3.191 (GtkAttachOptions)(0), 0, 0); 3.192 gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5); 3.193 3.194 - label5 = gtk_label_new_with_mnemonic("_Y:"); 3.195 - gtk_widget_set_name(label5, "label5"); 3.196 - gtk_widget_show(label5); 3.197 - gtk_table_attach(GTK_TABLE(table2), label5, 0, 1, 1, 2, 3.198 - (GtkAttachOptions)(GTK_FILL), 3.199 - (GtkAttachOptions)(0), 0, 0); 3.200 - gtk_misc_set_alignment(GTK_MISC(label5), 0, 0.5); 3.201 - 3.202 - label4 = gtk_label_new_with_mnemonic("_Width:"); 3.203 - gtk_widget_set_name(label4, "label4"); 3.204 - gtk_widget_show(label4); 3.205 - gtk_table_attach(GTK_TABLE(table2), label4, 0, 1, 2, 3, 3.206 - (GtkAttachOptions)(GTK_FILL), 3.207 - (GtkAttachOptions)(0), 0, 0); 3.208 - gtk_misc_set_alignment(GTK_MISC(label4), 0, 0.5); 3.209 - 3.210 - label6 = gtk_label_new_with_mnemonic("_Height:"); 3.211 - gtk_widget_set_name(label6, "label6"); 3.212 - gtk_widget_show(label6); 3.213 - gtk_table_attach(GTK_TABLE(table2), label6, 0, 1, 3, 4, 3.214 - (GtkAttachOptions)(GTK_FILL), 3.215 - (GtkAttachOptions)(0), 0, 0); 3.216 - gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5); 3.217 - 3.218 - hbox5 = gtk_hbox_new(FALSE, 0); 3.219 - gtk_widget_set_name(hbox5, "hbox5"); 3.220 - gtk_widget_show(hbox5); 3.221 - gtk_table_attach(GTK_TABLE(table2), hbox5, 1, 2, 0, 1, 3.222 - (GtkAttachOptions)(GTK_FILL), 3.223 - (GtkAttachOptions)(GTK_FILL), 0, 0); 3.224 - 3.225 - crop_x_spinbutton_adj = gtk_adjustment_new(1, 0, 300, 1, 10, 1); 3.226 - crop_x_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(crop_x_spinbutton_adj), 1, 0); 3.227 - gtk_widget_set_name(crop_x_spinbutton, "crop_x_spinbutton"); 3.228 - gtk_widget_show(crop_x_spinbutton); 3.229 - gtk_box_pack_start(GTK_BOX(hbox5), crop_x_spinbutton, FALSE, TRUE, 0); 3.230 - 3.231 - hbox6 = gtk_hbox_new(FALSE, 0); 3.232 - gtk_widget_set_name(hbox6, "hbox6"); 3.233 - gtk_widget_show(hbox6); 3.234 - gtk_table_attach(GTK_TABLE(table2), hbox6, 1, 2, 1, 2, 3.235 - (GtkAttachOptions)(GTK_FILL), 3.236 - (GtkAttachOptions)(GTK_FILL), 0, 0); 3.237 - 3.238 - crop_y_spinbutton_adj = gtk_adjustment_new(1, 0, 300, 1, 10, 1); 3.239 - crop_y_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(crop_y_spinbutton_adj), 1, 0); 3.240 - gtk_widget_set_name(crop_y_spinbutton, "crop_y_spinbutton"); 3.241 - gtk_widget_show(crop_y_spinbutton); 3.242 - gtk_box_pack_start(GTK_BOX(hbox6), crop_y_spinbutton, FALSE, TRUE, 0); 3.243 - 3.244 - hbox7 = gtk_hbox_new(FALSE, 0); 3.245 - gtk_widget_set_name(hbox7, "hbox7"); 3.246 - gtk_widget_show(hbox7); 3.247 - gtk_table_attach(GTK_TABLE(table2), hbox7, 1, 2, 2, 3, 3.248 - (GtkAttachOptions)(GTK_FILL), 3.249 - (GtkAttachOptions)(GTK_FILL), 0, 0); 3.250 - 3.251 - crop_width_spinbutton_adj = gtk_adjustment_new(1, 0, 300, 1, 10, 1); 3.252 - crop_width_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(crop_width_spinbutton_adj), 1, 0); 3.253 - gtk_widget_set_name(crop_width_spinbutton, "crop_width_spinbutton"); 3.254 - gtk_widget_show(crop_width_spinbutton); 3.255 - gtk_box_pack_start(GTK_BOX(hbox7), crop_width_spinbutton, FALSE, FALSE, 0); 3.256 - 3.257 - hbox8 = gtk_hbox_new(FALSE, 0); 3.258 - gtk_widget_set_name(hbox8, "hbox8"); 3.259 - gtk_widget_show(hbox8); 3.260 - gtk_table_attach(GTK_TABLE(table2), hbox8, 1, 2, 3, 4, 3.261 - (GtkAttachOptions)(GTK_FILL), 3.262 - (GtkAttachOptions)(GTK_FILL), 0, 0); 3.263 - 3.264 - crop_height_spinbutton_adj = gtk_adjustment_new(1, 0, 300, 1, 10, 1); 3.265 - crop_height_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(crop_height_spinbutton_adj), 1, 0); 3.266 - gtk_widget_set_name(crop_height_spinbutton, "crop_height_spinbutton"); 3.267 - gtk_widget_show(crop_height_spinbutton); 3.268 - gtk_box_pack_start(GTK_BOX(hbox8), crop_height_spinbutton, FALSE, FALSE, 0); 3.269 - 3.270 - vbox4 = gtk_vbox_new(FALSE, 6); 3.271 - gtk_widget_set_name(vbox4, "vbox4"); 3.272 - gtk_widget_show(vbox4); 3.273 - gtk_box_pack_start(GTK_BOX(vbox1), vbox4, FALSE, TRUE, 0); 3.274 - 3.275 - label7 = gtk_label_new("<b>Aspect ratio</b>"); 3.276 - gtk_widget_set_name(label7, "label7"); 3.277 - gtk_widget_show(label7); 3.278 - gtk_box_pack_start(GTK_BOX(vbox4), label7, FALSE, FALSE, 0); 3.279 - gtk_label_set_use_markup(GTK_LABEL(label7), TRUE); 3.280 - gtk_misc_set_alignment(GTK_MISC(label7), 0, 0.5); 3.281 - 3.282 - hbox3 = gtk_hbox_new(FALSE, 0); 3.283 - gtk_widget_set_name(hbox3, "hbox3"); 3.284 - gtk_widget_show(hbox3); 3.285 - gtk_box_pack_start(GTK_BOX(vbox4), hbox3, FALSE, FALSE, 0); 3.286 - 3.287 - label8 = gtk_label_new(" "); 3.288 - gtk_widget_set_name(label8, "label8"); 3.289 - gtk_widget_show(label8); 3.290 - gtk_box_pack_start(GTK_BOX(hbox3), label8, FALSE, FALSE, 0); 3.291 - 3.292 - table3 = gtk_table_new(2, 2, FALSE); 3.293 - gtk_widget_set_name(table3, "table3"); 3.294 - gtk_widget_show(table3); 3.295 - gtk_box_pack_start(GTK_BOX(hbox3), table3, TRUE, TRUE, 0); 3.296 - gtk_table_set_row_spacings(GTK_TABLE(table3), 6); 3.297 - gtk_table_set_col_spacings(GTK_TABLE(table3), 6); 3.298 - 3.299 - hbox10 = gtk_hbox_new(FALSE, 6); 3.300 - gtk_widget_set_name(hbox10, "hbox10"); 3.301 - gtk_widget_show(hbox10); 3.302 - gtk_table_attach(GTK_TABLE(table3), hbox10, 0, 2, 1, 2, 3.303 - (GtkAttachOptions)(GTK_FILL), 3.304 - (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0); 3.305 - 3.306 - custom_ratio_box = gtk_hbox_new(FALSE, 6); 3.307 - gtk_widget_set_name(custom_ratio_box, "custom_ratio_box"); 3.308 - gtk_widget_show(custom_ratio_box); 3.309 - gtk_box_pack_start(GTK_BOX(hbox10), custom_ratio_box, TRUE, TRUE, 0); 3.310 - 3.311 - ratio_w_spinbutton_adj = gtk_adjustment_new(1, 1, 9999, 1, 10, 10); 3.312 - ratio_w_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(ratio_w_spinbutton_adj), 1, 0); 3.313 - gtk_widget_set_name(ratio_w_spinbutton, "ratio_w_spinbutton"); 3.314 - gtk_widget_show(ratio_w_spinbutton); 3.315 - gtk_box_pack_start(GTK_BOX(custom_ratio_box), ratio_w_spinbutton, FALSE, TRUE, 0); 3.316 - 3.317 - ratio_swap_button = gtk_button_new(); 3.318 - gtk_widget_set_name(ratio_swap_button, "ratio_swap_button"); 3.319 - gtk_widget_show(ratio_swap_button); 3.320 - gtk_box_pack_start(GTK_BOX(custom_ratio_box), ratio_swap_button, FALSE, FALSE, 0); 3.321 - gtk_button_set_relief(GTK_BUTTON(ratio_swap_button), GTK_RELIEF_NONE); 3.322 - 3.323 - eventbox1 = gtk_event_box_new(); 3.324 - gtk_widget_set_name(eventbox1, "eventbox1"); 3.325 - gtk_widget_show(eventbox1); 3.326 - gtk_container_add(GTK_CONTAINER(ratio_swap_button), eventbox1); 3.327 - 3.328 - ratio_swap_image = gtk_image_new_from_stock("gtk-refresh", GTK_ICON_SIZE_BUTTON); 3.329 - gtk_widget_set_name(ratio_swap_image, "ratio_swap_image"); 3.330 - gtk_widget_show(ratio_swap_image); 3.331 - gtk_container_add(GTK_CONTAINER(eventbox1), ratio_swap_image); 3.332 - 3.333 - ratio_h_spinbutton_adj = gtk_adjustment_new(1, 1, 9999, 1, 10, 10); 3.334 - ratio_h_spinbutton = gtk_spin_button_new(GTK_ADJUSTMENT(ratio_h_spinbutton_adj), 1, 0); 3.335 - gtk_widget_set_name(ratio_h_spinbutton, "ratio_h_spinbutton"); 3.336 - gtk_widget_show(ratio_h_spinbutton); 3.337 - gtk_box_pack_start(GTK_BOX(custom_ratio_box), ratio_h_spinbutton, FALSE, TRUE, 0); 3.338 - gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(ratio_h_spinbutton), GTK_UPDATE_IF_VALID); 3.339 - 3.340 - ratio_optionmenu = gtk_option_menu_new(); 3.341 - gtk_widget_set_name(ratio_optionmenu, "ratio_optionmenu"); 3.342 - gtk_widget_show(ratio_optionmenu); 3.343 - gtk_table_attach(GTK_TABLE(table3), ratio_optionmenu, 0, 2, 0, 1, 3.344 - (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); 3.345 - 3.346 - menu1 = gtk_menu_new(); 3.347 - gtk_widget_set_name(menu1, "menu1"); 3.348 - 3.349 - ratio_none = gtk_menu_item_new_with_mnemonic("None"); 3.350 - gtk_widget_set_name(ratio_none, "ratio_none"); 3.351 - gtk_widget_show(ratio_none); 3.352 - gtk_container_add(GTK_CONTAINER(menu1), ratio_none); 3.353 - 3.354 - ratio_square = gtk_menu_item_new_with_mnemonic("Square"); 3.355 - gtk_widget_set_name(ratio_square, "ratio_square"); 3.356 - gtk_widget_show(ratio_square); 3.357 - gtk_container_add(GTK_CONTAINER(menu1), ratio_square); 3.358 - 3.359 - ratio_4x3 = gtk_menu_item_new_with_mnemonic("4 x 3(Book, DVD)"); 3.360 - gtk_widget_set_name(ratio_4x3, "ratio_4x3"); 3.361 - gtk_widget_show(ratio_4x3); 3.362 - gtk_container_add(GTK_CONTAINER(menu1), ratio_4x3); 3.363 - 3.364 - ratio_3x2 = gtk_menu_item_new_with_mnemonic("4 x 6(Postcard)"); 3.365 - gtk_widget_set_name(ratio_3x2, "ratio_3x2"); 3.366 - gtk_widget_show(ratio_3x2); 3.367 - gtk_container_add(GTK_CONTAINER(menu1), ratio_3x2); 3.368 - 3.369 - ratio_custom = gtk_menu_item_new_with_mnemonic("Custom"); 3.370 - gtk_widget_set_name(ratio_custom, "ratio_custom"); 3.371 - gtk_widget_show(ratio_custom); 3.372 - gtk_container_add(GTK_CONTAINER(menu1), ratio_custom); 3.373 - 3.374 - gtk_option_menu_set_menu(GTK_OPTION_MENU(ratio_optionmenu), menu1); 3.375 - 3.376 - vbox5 = gtk_vbox_new(FALSE, 0); 3.377 - gtk_widget_set_name(vbox5, "vbox5"); 3.378 - gtk_widget_show(vbox5); 3.379 - gtk_box_pack_start(GTK_BOX(hbox1), vbox5, TRUE, TRUE, 0); 3.380 - 3.381 frame1 = gtk_frame_new(NULL); 3.382 gtk_widget_set_name(frame1, "frame1"); 3.383 gtk_widget_show(frame1); 3.384 @@ -345,262 +125,14 @@ 3.385 gtk_widget_show(vbox7); 3.386 gtk_container_add(GTK_CONTAINER(frame1), vbox7); 3.387 3.388 - nav_container = gtk_hbox_new(FALSE, 0); 3.389 - gtk_widget_set_name(nav_container, "nav_container"); 3.390 - gtk_widget_show(nav_container); 3.391 - gtk_box_pack_start(GTK_BOX(vbox7), nav_container, TRUE, TRUE, 0); 3.392 - 3.393 -/* image_area */ 3.394 - image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL); 3.395 - image_area = gtk_image_new_from_pixbuf(image_buffer); 3.396 - 3.397 - gtk_widget_set_name(image_area, "image_area"); 3.398 - gtk_widget_show(image_area); 3.399 - gtk_box_pack_start(GTK_BOX(nav_container), image_area, TRUE, TRUE, 0); 3.400 - 3.401 - hbox16 = gtk_hbox_new(FALSE, 6); 3.402 - gtk_widget_set_name(hbox16, "hbox16"); 3.403 - gtk_widget_show(hbox16); 3.404 - gtk_box_pack_start(GTK_BOX(vbox7), hbox16, FALSE, TRUE, 0); 3.405 - 3.406 - hbox17 = gtk_hbox_new(FALSE, 0); 3.407 - gtk_widget_set_name(hbox17, "hbox17"); 3.408 - gtk_widget_show(hbox17); 3.409 - gtk_box_pack_end(GTK_BOX(hbox16), hbox17, FALSE, TRUE, 0); 3.410 - 3.411 - crop_zoom_in_button = gtk_button_new(); 3.412 - gtk_widget_set_name(crop_zoom_in_button, "crop_zoom_in_button"); 3.413 - gtk_widget_show(crop_zoom_in_button); 3.414 - gtk_box_pack_start(GTK_BOX(hbox17), crop_zoom_in_button, FALSE, FALSE, 0); 3.415 - gtk_button_set_relief(GTK_BUTTON(crop_zoom_in_button), GTK_RELIEF_NONE); 3.416 - 3.417 - image2 = gtk_image_new_from_stock("gtk-zoom-in", GTK_ICON_SIZE_BUTTON); 3.418 - gtk_widget_set_name(image2, "image2"); 3.419 - gtk_widget_show(image2); 3.420 - gtk_container_add(GTK_CONTAINER(crop_zoom_in_button), image2); 3.421 - 3.422 - crop_zoom_out_button = gtk_button_new(); 3.423 - gtk_widget_set_name(crop_zoom_out_button, "crop_zoom_out_button"); 3.424 - gtk_widget_show(crop_zoom_out_button); 3.425 - gtk_box_pack_start(GTK_BOX(hbox17), crop_zoom_out_button, FALSE, FALSE, 0); 3.426 - gtk_button_set_relief(GTK_BUTTON(crop_zoom_out_button), GTK_RELIEF_NONE); 3.427 - 3.428 - image4 = gtk_image_new_from_stock("gtk-zoom-out", GTK_ICON_SIZE_BUTTON); 3.429 - gtk_widget_set_name(image4, "image4"); 3.430 - gtk_widget_show(image4); 3.431 - gtk_container_add(GTK_CONTAINER(crop_zoom_out_button), image4); 3.432 - 3.433 - crop_zoom_100_button = gtk_button_new(); 3.434 - gtk_widget_set_name(crop_zoom_100_button, "crop_zoom_100_button"); 3.435 - gtk_widget_show(crop_zoom_100_button); 3.436 - gtk_box_pack_start(GTK_BOX(hbox17), crop_zoom_100_button, FALSE, FALSE, 0); 3.437 - gtk_button_set_relief(GTK_BUTTON(crop_zoom_100_button), GTK_RELIEF_NONE); 3.438 - 3.439 - image3 = gtk_image_new_from_stock("gtk-zoom-100", GTK_ICON_SIZE_BUTTON); 3.440 - gtk_widget_set_name(image3, "image3"); 3.441 - gtk_widget_show(image3); 3.442 - gtk_container_add(GTK_CONTAINER(crop_zoom_100_button), image3); 3.443 - 3.444 - crop_zoom_fit_button = gtk_button_new(); 3.445 - gtk_widget_set_name(crop_zoom_fit_button, "crop_zoom_fit_button"); 3.446 - gtk_widget_show(crop_zoom_fit_button); 3.447 - gtk_box_pack_start(GTK_BOX(hbox17), crop_zoom_fit_button, FALSE, FALSE, 0); 3.448 - gtk_button_set_relief(GTK_BUTTON(crop_zoom_fit_button), GTK_RELIEF_NONE); 3.449 - 3.450 - image1 = gtk_image_new_from_stock("gtk-zoom-fit", GTK_ICON_SIZE_BUTTON); 3.451 - gtk_widget_set_name(image1, "image1"); 3.452 - gtk_widget_show(image1); 3.453 - gtk_container_add(GTK_CONTAINER(crop_zoom_fit_button), image1); 3.454 - 3.455 - 3.456 - 3.457 -/* 3.458 - okay_box = gtk_hbox_new(FALSE, 0); 3.459 - gtk_widget_set_name(okay_box, "okay_box"); 3.460 - gtk_widget_show(okay_box); 3.461 - gtk_box_pack_end(GTK_BOX(hbox16), okay_box, FALSE, TRUE, 0); 3.462 -*/ 3.463 - 3.464 - crop_okbutton = gtk_button_new(); 3.465 - gtk_widget_set_name(crop_okbutton, "crop_okbutton"); 3.466 - gtk_widget_show(crop_okbutton); 3.467 - gtk_box_pack_end(GTK_BOX(dialog_vbox1), crop_okbutton, FALSE, FALSE, 0); 3.468 - GTK_WIDGET_SET_FLAGS(crop_okbutton, GTK_CAN_DEFAULT); 3.469 - 3.470 - alignment1 = gtk_alignment_new(0.5, 0.5, 0, 0); 3.471 - gtk_widget_set_name(alignment1, "alignment1"); 3.472 - gtk_widget_show(alignment1); 3.473 - gtk_container_add(GTK_CONTAINER(crop_okbutton), alignment1); 3.474 - 3.475 - hbox11 = gtk_hbox_new(FALSE, 2); 3.476 - gtk_widget_set_name(hbox11, "hbox11"); 3.477 - gtk_widget_show(hbox11); 3.478 - gtk_container_add(GTK_CONTAINER(alignment1), hbox11); 3.479 - 3.480 - crop_image = gtk_image_new_from_stock("gtk-ok", GTK_ICON_SIZE_BUTTON); 3.481 - gtk_widget_set_name(crop_image, "crop_image"); 3.482 - gtk_widget_show(crop_image); 3.483 - gtk_box_pack_start(GTK_BOX(hbox11), crop_image, FALSE, FALSE, 0); 3.484 - 3.485 - label12 = gtk_label_new_with_mnemonic("_Crop"); 3.486 - gtk_widget_set_name(label12, "label12"); 3.487 - gtk_widget_show(label12); 3.488 - gtk_box_pack_start(GTK_BOX(hbox11), label12, FALSE, FALSE, 0); 3.489 - 3.490 - 3.491 - 3.492 - 3.493 - 3.494 - g_signal_connect(G_OBJECT(cropper_window), "show", 3.495 - G_CALLBACK(on_cropper_window_create), NULL); 3.496 -/* destroy */ 3.497 - g_signal_connect(G_OBJECT(cropper_window), "destroy", 3.498 - G_CALLBACK(on_cropper_window_destroy), NULL); 3.499 - 3.500 - 3.501 -/* crop */ 3.502 - g_signal_connect(G_OBJECT(crop_okbutton), "clicked", 3.503 - G_CALLBACK(on_crop_clicked), NULL); 3.504 - 3.505 - 3.506 -/* zoom */ 3.507 - g_signal_connect(G_OBJECT(crop_zoom_in_button), "clicked", 3.508 - G_CALLBACK(on_zoom_in_button_clicked), NULL); 3.509 - g_signal_connect(G_OBJECT(crop_zoom_out_button), "clicked", 3.510 - G_CALLBACK(on_zoom_out_button_clicked), NULL); 3.511 - g_signal_connect(G_OBJECT(crop_zoom_100_button), "clicked", 3.512 - G_CALLBACK(on_zoom_100_button_clicked), NULL); 3.513 - g_signal_connect(G_OBJECT(crop_zoom_fit_button), "clicked", 3.514 - G_CALLBACK(on_zoom_fit_button_clicked), NULL); 3.515 - 3.516 - 3.517 -/* aspect ratio */ 3.518 -/* 3.519 - g_signal_connect(G_OBJECT(ratio_w_spinbutton), "value_changed", 3.520 - G_CALLBACK(on_ratio_w_spinbutton_value_changed), NULL); 3.521 - g_signal_connect(G_OBJECT(ratio_swap_button), "clicked", 3.522 - G_CALLBACK(on_ratio_swap_button_clicked), NULL); 3.523 - g_signal_connect(G_OBJECT(ratio_h_spinbutton), "value_changed", 3.524 - G_CALLBACK(on_ratio_h_spinbutton_value_changed), NULL); 3.525 - 3.526 +g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_x_spinbutton")), "value_changed", 3.527 + G_CALLBACK(selection_x_value_changed_cb), data); 3.528 +g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_image")), "selection_changed", 3.529 + G_CALLBACK(selection_changed_cb), data); 3.530 +g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_swap_button")), "clicked", 3.531 + G_CALLBACK(ratio_swap_button_cb), NULL); 3.532 +g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_optionmenu")), "changed", 3.533 + G_CALLBACK(ratio_optionmenu_changed_cb), NULL); 3.534 g_signal_connect(G_OBJECT(ratio_none), "activate", 3.535 G_CALLBACK(on_ratio_none_activate), NULL); 3.536 - g_signal_connect(G_OBJECT(ratio_square), "activate", 3.537 - G_CALLBACK(on_ratio_square_activate), NULL); 3.538 - g_signal_connect(G_OBJECT(ratio_4x3), "activate", 3.539 - G_CALLBACK(on_ratio_4x3_activate), NULL); 3.540 - g_signal_connect(G_OBJECT(ratio_3x2), "activate", 3.541 - G_CALLBACK(on_ratio_3x2_activate), NULL); 3.542 - g_signal_connect(G_OBJECT(ratio_custom), "activate", 3.543 - G_CALLBACK(on_ratio_custom_activate), NULL); 3.544 - 3.545 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_optionmenu")), "changed", 3.546 - G_CALLBACK(ratio_optionmenu_changed_cb), NULL); 3.547 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_w_spinbutton")), "value_changed", 3.548 - G_CALLBACK(ratio_value_changed_cb), NULL); 3.549 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_h_spinbutton")), "value_changed", 3.550 - G_CALLBACK(ratio_value_changed_cb), NULL); 3.551 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_swap_button")), "clicked", 3.552 - G_CALLBACK(ratio_swap_button_cb), NULL); 3.553 */ 3.554 - 3.555 - 3.556 -/* selection */ 3.557 -/* 3.558 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_x_spinbutton")), "value_changed", 3.559 - G_CALLBACK(selection_x_value_changed_cb), data); 3.560 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_y_spinbutton")), "value_changed", 3.561 - G_CALLBACK(selection_y_value_changed_cb), data); 3.562 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_width_spinbutton")), "value_changed", 3.563 - G_CALLBACK(selection_width_value_changed_cb), data); 3.564 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_height_spinbutton")), "value_changed", 3.565 - G_CALLBACK(selection_height_value_changed_cb), data); 3.566 -g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_image")), "selection_changed", 3.567 - G_CALLBACK(selection_changed_cb), data); 3.568 -*/ 3.569 - 3.570 - 3.571 - 3.572 - 3.573 - 3.574 - 3.575 - 3.576 - 3.577 - g_signal_connect(cropper_window, "key-press-event", G_CALLBACK(on_key_press), NULL); 3.578 - 3.579 - 3.580 - 3.581 - 3.582 - 3.583 - 3.584 - 3.585 - 3.586 - 3.587 - /* Store pointers to all widgets, for use by lookup_widget(). */ 3.588 - GLADE_HOOKUP_OBJECT_NO_REF(cropper_window, cropper_window, "cropper_window"); 3.589 - GLADE_HOOKUP_OBJECT(cropper_window, dialog_vbox1, "dialog_vbox1"); 3.590 - GLADE_HOOKUP_OBJECT(cropper_window, hbox1, "hbox1"); 3.591 - GLADE_HOOKUP_OBJECT(cropper_window, vbox1, "vbox1"); 3.592 - GLADE_HOOKUP_OBJECT(cropper_window, vbox2, "vbox2"); 3.593 - GLADE_HOOKUP_OBJECT(cropper_window, label1, "label1"); 3.594 - GLADE_HOOKUP_OBJECT(cropper_window, hbox2, "hbox2"); 3.595 - GLADE_HOOKUP_OBJECT(cropper_window, label2, "label2"); 3.596 - GLADE_HOOKUP_OBJECT(cropper_window, table2, "table2"); 3.597 - GLADE_HOOKUP_OBJECT(cropper_window, label3, "label3"); 3.598 - GLADE_HOOKUP_OBJECT(cropper_window, label5, "label5"); 3.599 - GLADE_HOOKUP_OBJECT(cropper_window, label4, "label4"); 3.600 - GLADE_HOOKUP_OBJECT(cropper_window, label6, "label6"); 3.601 - GLADE_HOOKUP_OBJECT(cropper_window, hbox5, "hbox5"); 3.602 - GLADE_HOOKUP_OBJECT(cropper_window, crop_x_spinbutton, "crop_x_spinbutton"); 3.603 - GLADE_HOOKUP_OBJECT(cropper_window, hbox6, "hbox6"); 3.604 - GLADE_HOOKUP_OBJECT(cropper_window, crop_y_spinbutton, "crop_y_spinbutton"); 3.605 - GLADE_HOOKUP_OBJECT(cropper_window, hbox7, "hbox7"); 3.606 - GLADE_HOOKUP_OBJECT(cropper_window, crop_width_spinbutton, "crop_width_spinbutton"); 3.607 - GLADE_HOOKUP_OBJECT(cropper_window, hbox8, "hbox8"); 3.608 - GLADE_HOOKUP_OBJECT(cropper_window, crop_height_spinbutton, "crop_height_spinbutton"); 3.609 - GLADE_HOOKUP_OBJECT(cropper_window, vbox4, "vbox4"); 3.610 - GLADE_HOOKUP_OBJECT(cropper_window, label7, "label7"); 3.611 - GLADE_HOOKUP_OBJECT(cropper_window, hbox3, "hbox3"); 3.612 - GLADE_HOOKUP_OBJECT(cropper_window, label8, "label8"); 3.613 - GLADE_HOOKUP_OBJECT(cropper_window, table3, "table3"); 3.614 - GLADE_HOOKUP_OBJECT(cropper_window, hbox10, "hbox10"); 3.615 - GLADE_HOOKUP_OBJECT(cropper_window, custom_ratio_box, "custom_ratio_box"); 3.616 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_w_spinbutton, "ratio_w_spinbutton"); 3.617 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_swap_button, "ratio_swap_button"); 3.618 - GLADE_HOOKUP_OBJECT(cropper_window, eventbox1, "eventbox1"); 3.619 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_swap_image, "ratio_swap_image"); 3.620 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_h_spinbutton, "ratio_h_spinbutton"); 3.621 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_optionmenu, "ratio_optionmenu"); 3.622 - GLADE_HOOKUP_OBJECT(cropper_window, menu1, "menu1"); 3.623 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_none, "ratio_none"); 3.624 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_square, "ratio_square"); 3.625 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_4x3, "ratio_4x3"); 3.626 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_3x2, "ratio_3x2"); 3.627 - GLADE_HOOKUP_OBJECT(cropper_window, ratio_custom, "ratio_custom"); 3.628 - GLADE_HOOKUP_OBJECT(cropper_window, vbox5, "vbox5"); 3.629 - GLADE_HOOKUP_OBJECT(cropper_window, frame1, "frame1"); 3.630 - GLADE_HOOKUP_OBJECT(cropper_window, vbox7, "vbox7"); 3.631 - GLADE_HOOKUP_OBJECT(cropper_window, nav_container, "nav_container"); 3.632 - GLADE_HOOKUP_OBJECT(cropper_window, image_area, "image_area"); 3.633 - GLADE_HOOKUP_OBJECT(cropper_window,(GtkWidget*) image_buffer, "image_buffer"); 3.634 - GLADE_HOOKUP_OBJECT(cropper_window, hbox16, "hbox16"); 3.635 - GLADE_HOOKUP_OBJECT(cropper_window, hbox17, "hbox17"); 3.636 - GLADE_HOOKUP_OBJECT(cropper_window, crop_zoom_in_button, "crop_zoom_in_button"); 3.637 - GLADE_HOOKUP_OBJECT(cropper_window, image2, "image2"); 3.638 - GLADE_HOOKUP_OBJECT(cropper_window, crop_zoom_out_button, "crop_zoom_out_button"); 3.639 - GLADE_HOOKUP_OBJECT(cropper_window, image4, "image4"); 3.640 - GLADE_HOOKUP_OBJECT(cropper_window, crop_zoom_100_button, "crop_zoom_100_button"); 3.641 - GLADE_HOOKUP_OBJECT(cropper_window, image3, "image3"); 3.642 - GLADE_HOOKUP_OBJECT(cropper_window, crop_zoom_fit_button, "crop_zoom_fit_button"); 3.643 - GLADE_HOOKUP_OBJECT(cropper_window, image1, "image1"); 3.644 - /*GLADE_HOOKUP_OBJECT_NO_REF(cropper_window, dialog_action_area1, "dialog_action_area1"); */ 3.645 - GLADE_HOOKUP_OBJECT(cropper_window, crop_okbutton, "crop_okbutton"); 3.646 - GLADE_HOOKUP_OBJECT(cropper_window, alignment1, "alignment1"); 3.647 - GLADE_HOOKUP_OBJECT(cropper_window, hbox11, "hbox11"); 3.648 - GLADE_HOOKUP_OBJECT(cropper_window, crop_image, "crop_image"); 3.649 - GLADE_HOOKUP_OBJECT(cropper_window, label12, "label12"); 3.650 - 3.651 - 3.652 - return cropper_window; 3.653 -} 3.654 -
4.1 --- a/main.c Thu Mar 04 17:05:38 2010 +0100 4.2 +++ b/main.c Thu Mar 04 18:31:28 2010 +0100 4.3 @@ -16,10 +16,14 @@ 4.4 4.5 image_filename = argv[1]; 4.6 4.7 +/* 4.8 gtk_set_locale(); 4.9 +*/ 4.10 gtk_init(&argc, &argv); 4.11 4.12 +/* 4.13 add_pixmap_directory("/usr/share/pixmaps"); 4.14 +*/ 4.15 4.16 cropper_window = create_cropper_window(); 4.17 gtk_widget_show(cropper_window);