cropper
view interface.c @ 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 |
line source
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <stdio.h>
7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h>
9 #include <gdk-pixbuf/gdk-pixbuf.h>
11 #include "main.h"
12 #include "callbacks.h"
13 #include "support.h"
15 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
16 g_object_set_data_full(G_OBJECT(component), name, \
17 gtk_widget_ref(widget),(GDestroyNotify) gtk_widget_unref)
19 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
20 g_object_set_data(G_OBJECT(component), name, widget)
22 GtkWidget*
23 create_cropper_window(void)
24 {
25 GtkWidget *cropper_window;
26 GtkWidget *dialog_vbox1;
27 GtkWidget *status;
28 GtkWidget *label1;
29 GtkWidget *label2;
32 cropper_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
33 gtk_widget_set_name(cropper_window, "cropper_window");
34 gtk_container_set_border_width(GTK_CONTAINER(cropper_window), 6);
35 gtk_window_set_title(GTK_WINDOW(cropper_window), "cropper-0.2");
37 dialog_vbox1 = gtk_vbox_new(FALSE, 6);
38 gtk_widget_set_name(dialog_vbox1, "dialog_vbox1");
39 gtk_widget_show(dialog_vbox1);
40 gtk_container_add(GTK_CONTAINER(cropper_window), dialog_vbox1);
43 status = gtk_hbox_new(FALSE, 0);
44 gtk_widget_set_name(status, "status");
45 gtk_widget_show(status);
46 gtk_box_pack_end(GTK_BOX(dialog_vbox1), status, FALSE, FALSE, 0);
48 label1 = gtk_label_new("zoom:");
49 gtk_widget_set_name(label1, "label1");
50 gtk_widget_show(label1);
51 gtk_box_pack_start(GTK_BOX(status), label1, FALSE, FALSE, 0);
53 label2 = gtk_label_new("1.0");
54 gtk_widget_set_name(label2, "label2");
55 gtk_widget_show(label2);
56 gtk_box_pack_start(GTK_BOX(status), label2, FALSE, FALSE, 0);
58 /* image_area */
59 image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL);
60 image_area = gtk_image_new_from_pixbuf(image_buffer);
62 gtk_widget_set_name(image_area, "image_area");
63 gtk_widget_show(image_area);
64 gtk_box_pack_start(GTK_BOX(dialog_vbox1), image_area, TRUE, TRUE, 0);
70 g_signal_connect(G_OBJECT(cropper_window), "show",
71 G_CALLBACK(on_cropper_window_create), NULL);
73 g_signal_connect(G_OBJECT(cropper_window), "destroy",
74 G_CALLBACK(on_cropper_window_destroy), NULL);
76 g_signal_connect(cropper_window, "key-press-event",
77 G_CALLBACK(on_key_press), NULL);
80 /* Store pointers to all widgets, for use by lookup_widget(). */
82 GLADE_HOOKUP_OBJECT_NO_REF(cropper_window, cropper_window, "cropper_window");
83 GLADE_HOOKUP_OBJECT(cropper_window, dialog_vbox1, "dialog_vbox1");
85 GLADE_HOOKUP_OBJECT(cropper_window, label1, "label1");
86 GLADE_HOOKUP_OBJECT(cropper_window, label2, "label2");
87 GLADE_HOOKUP_OBJECT(cropper_window, status, "status");
88 GLADE_HOOKUP_OBJECT(cropper_window, image_area, "image_area");
89 GLADE_HOOKUP_OBJECT(cropper_window,(GtkWidget*) image_buffer, "image_buffer");
92 return cropper_window;
93 }
103 /*
104 gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
106 label1 = gtk_label_new("<b>Selection</b>");
107 gtk_label_set_use_markup(GTK_LABEL(label1), TRUE);
108 gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);
110 gtk_table_set_row_spacings(GTK_TABLE(table2), 6);
111 gtk_table_set_col_spacings(GTK_TABLE(table2), 6);
113 gtk_table_attach(GTK_TABLE(table2), label3, 0, 1, 0, 1,(GtkAttachOptions)(GTK_FILL),
114 (GtkAttachOptions)(0), 0, 0);
115 gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
117 frame1 = gtk_frame_new(NULL);
118 gtk_widget_set_name(frame1, "frame1");
119 gtk_widget_show(frame1);
120 gtk_box_pack_start(GTK_BOX(vbox5), frame1, TRUE, TRUE, 0);
121 gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE);
123 vbox7 = gtk_vbox_new(FALSE, 6);
124 gtk_widget_set_name(vbox7, "vbox7");
125 gtk_widget_show(vbox7);
126 gtk_container_add(GTK_CONTAINER(frame1), vbox7);
128 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_x_spinbutton")), "value_changed",
129 G_CALLBACK(selection_x_value_changed_cb), data);
130 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "crop_image")), "selection_changed",
131 G_CALLBACK(selection_changed_cb), data);
132 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_swap_button")), "clicked",
133 G_CALLBACK(ratio_swap_button_cb), NULL);
134 g_signal_connect(G_OBJECT(lookup_widget(cropper_window, "ratio_optionmenu")), "changed",
135 G_CALLBACK(ratio_optionmenu_changed_cb), NULL);
136 g_signal_connect(G_OBJECT(ratio_none), "activate",
137 G_CALLBACK(on_ratio_none_activate), NULL);
138 */