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@14
|
27 GtkWidget *status;
|
meillo@0
|
28 GtkWidget *label1;
|
meillo@0
|
29 GtkWidget *label2;
|
meillo@4
|
30
|
meillo@0
|
31
|
meillo@11
|
32 cropper_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
meillo@11
|
33 gtk_widget_set_name(cropper_window, "cropper_window");
|
meillo@11
|
34 gtk_container_set_border_width(GTK_CONTAINER(cropper_window), 6);
|
meillo@14
|
35 gtk_window_set_title(GTK_WINDOW(cropper_window), "cropper-0.2");
|
meillo@0
|
36
|
meillo@11
|
37 dialog_vbox1 = gtk_vbox_new(FALSE, 6);
|
meillo@11
|
38 gtk_widget_set_name(dialog_vbox1, "dialog_vbox1");
|
meillo@11
|
39 gtk_widget_show(dialog_vbox1);
|
meillo@11
|
40 gtk_container_add(GTK_CONTAINER(cropper_window), dialog_vbox1);
|
meillo@0
|
41
|
meillo@14
|
42
|
meillo@14
|
43 status = gtk_hbox_new(FALSE, 0);
|
meillo@14
|
44 gtk_widget_set_name(status, "status");
|
meillo@14
|
45 gtk_widget_show(status);
|
meillo@14
|
46 gtk_box_pack_end(GTK_BOX(dialog_vbox1), status, FALSE, FALSE, 0);
|
meillo@14
|
47
|
meillo@14
|
48 label1 = gtk_label_new("zoom:");
|
meillo@14
|
49 gtk_widget_set_name(label1, "label1");
|
meillo@14
|
50 gtk_widget_show(label1);
|
meillo@14
|
51 gtk_box_pack_start(GTK_BOX(status), label1, FALSE, FALSE, 0);
|
meillo@14
|
52
|
meillo@14
|
53 label2 = gtk_label_new("1.0");
|
meillo@14
|
54 gtk_widget_set_name(label2, "label2");
|
meillo@14
|
55 gtk_widget_show(label2);
|
meillo@14
|
56 gtk_box_pack_start(GTK_BOX(status), label2, FALSE, FALSE, 0);
|
meillo@14
|
57
|
meillo@14
|
58 /* image_area */
|
meillo@14
|
59 image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL);
|
meillo@14
|
60 image_area = gtk_image_new_from_pixbuf(image_buffer);
|
meillo@14
|
61
|
meillo@14
|
62 gtk_widget_set_name(image_area, "image_area");
|
meillo@14
|
63 gtk_widget_show(image_area);
|
meillo@14
|
64 gtk_box_pack_start(GTK_BOX(dialog_vbox1), image_area, TRUE, TRUE, 0);
|
meillo@14
|
65
|
meillo@14
|
66
|
meillo@14
|
67
|
meillo@14
|
68
|
meillo@14
|
69
|
meillo@14
|
70 g_signal_connect(G_OBJECT(cropper_window), "show",
|
meillo@14
|
71 G_CALLBACK(on_cropper_window_create), NULL);
|
meillo@14
|
72
|
meillo@14
|
73 g_signal_connect(G_OBJECT(cropper_window), "destroy",
|
meillo@14
|
74 G_CALLBACK(on_cropper_window_destroy), NULL);
|
meillo@14
|
75
|
meillo@14
|
76 g_signal_connect(cropper_window, "key-press-event",
|
meillo@14
|
77 G_CALLBACK(on_key_press), NULL);
|
meillo@14
|
78
|
meillo@14
|
79
|
meillo@14
|
80 /* Store pointers to all widgets, for use by lookup_widget(). */
|
meillo@14
|
81
|
meillo@14
|
82 GLADE_HOOKUP_OBJECT_NO_REF(cropper_window, cropper_window, "cropper_window");
|
meillo@14
|
83 GLADE_HOOKUP_OBJECT(cropper_window, dialog_vbox1, "dialog_vbox1");
|
meillo@14
|
84
|
meillo@14
|
85 GLADE_HOOKUP_OBJECT(cropper_window, label1, "label1");
|
meillo@14
|
86 GLADE_HOOKUP_OBJECT(cropper_window, label2, "label2");
|
meillo@14
|
87 GLADE_HOOKUP_OBJECT(cropper_window, status, "status");
|
meillo@14
|
88 GLADE_HOOKUP_OBJECT(cropper_window, image_area, "image_area");
|
meillo@14
|
89 GLADE_HOOKUP_OBJECT(cropper_window,(GtkWidget*) image_buffer, "image_buffer");
|
meillo@14
|
90
|
meillo@14
|
91
|
meillo@14
|
92 return cropper_window;
|
meillo@14
|
93 }
|
meillo@14
|
94
|
meillo@14
|
95
|
meillo@14
|
96
|
meillo@14
|
97
|
meillo@14
|
98
|
meillo@14
|
99
|
meillo@14
|
100
|
meillo@14
|
101
|
meillo@14
|
102
|
meillo@14
|
103 /*
|
meillo@11
|
104 gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
|
meillo@0
|
105
|
meillo@11
|
106 label1 = gtk_label_new("<b>Selection</b>");
|
meillo@11
|
107 gtk_label_set_use_markup(GTK_LABEL(label1), TRUE);
|
meillo@11
|
108 gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
|
meillo@0
|
109
|
meillo@11
|
110 gtk_table_set_row_spacings(GTK_TABLE(table2), 6);
|
meillo@11
|
111 gtk_table_set_col_spacings(GTK_TABLE(table2), 6);
|
meillo@0
|
112
|
meillo@11
|
113 gtk_table_attach(GTK_TABLE(table2), label3, 0, 1, 0, 1,(GtkAttachOptions)(GTK_FILL),
|
meillo@11
|
114 (GtkAttachOptions)(0), 0, 0);
|
meillo@11
|
115 gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
|
meillo@0
|
116
|
meillo@11
|
117 frame1 = gtk_frame_new(NULL);
|
meillo@11
|
118 gtk_widget_set_name(frame1, "frame1");
|
meillo@11
|
119 gtk_widget_show(frame1);
|
meillo@11
|
120 gtk_box_pack_start(GTK_BOX(vbox5), frame1, TRUE, TRUE, 0);
|
meillo@11
|
121 gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE);
|
meillo@0
|
122
|
meillo@11
|
123 vbox7 = gtk_vbox_new(FALSE, 6);
|
meillo@11
|
124 gtk_widget_set_name(vbox7, "vbox7");
|
meillo@11
|
125 gtk_widget_show(vbox7);
|
meillo@11
|
126 gtk_container_add(GTK_CONTAINER(frame1), vbox7);
|
meillo@0
|
127
|
meillo@14
|
128 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_x_spinbutton")), "value_changed",
|
meillo@14
|
129 G_CALLBACK(selection_x_value_changed_cb), data);
|
meillo@14
|
130 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_image")), "selection_changed",
|
meillo@14
|
131 G_CALLBACK(selection_changed_cb), data);
|
meillo@14
|
132 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_swap_button")), "clicked",
|
meillo@14
|
133 G_CALLBACK(ratio_swap_button_cb), NULL);
|
meillo@14
|
134 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_optionmenu")), "changed",
|
meillo@14
|
135 G_CALLBACK(ratio_optionmenu_changed_cb), NULL);
|
meillo@11
|
136 g_signal_connect(G_OBJECT(ratio_none), "activate",
|
meillo@12
|
137 G_CALLBACK(on_ratio_none_activate), NULL);
|
meillo@4
|
138 */
|