Mercurial > cropper
annotate callbacks.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 | 2f11ab3e6047 |
children | b0824876d379 |
rev | line source |
---|---|
0 | 1 #include <gtk/gtk.h> |
7
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
2 #include <gdk-pixbuf/gdk-pixbuf.h> |
0 | 3 |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
4 #include "main.h" |
0 | 5 #include "callbacks.h" |
6 #include "interface.h" | |
7 #include "support.h" | |
8 | |
7
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
9 int image_width; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
10 int image_height; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
11 float inc = 0.1; |
4
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
12 /* |
3 | 13 void update_spin_button_ratio(GtkWidget* spinbutton) { |
14 g_print("ratio change: %f\n", ratio); | |
15 on_ratio_w_spinbutton_value_changed(spinbutton, NULL); | |
16 } | |
0 | 17 |
18 | |
19 | |
20 | |
21 | |
4
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
22 void on_ratio_none_activate (GtkMenuItem* menuitem, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
23 ratio = 1; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
24 update_spin_button_ratio(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
25 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
26 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
27 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
28 void on_ratio_square_activate (GtkMenuItem* menuitem, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
29 ratio = 1; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
30 update_spin_button_ratio(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
31 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
32 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
33 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
34 void on_ratio_4x3_activate (GtkMenuItem* menuitem, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
35 ratio = 4.0/3.0; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
36 update_spin_button_ratio(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
37 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
38 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
39 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
40 void on_ratio_3x2_activate (GtkMenuItem* menuitem, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
41 ratio = 1.5; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
42 update_spin_button_ratio(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
43 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
44 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
45 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
46 void on_ratio_custom_activate (GtkMenuItem* menuitem, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
47 ratio = gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_w_spinbutton")) / gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_h_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
48 update_spin_button_ratio(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
49 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
50 */ |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
51 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
52 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
53 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
54 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
55 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
56 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
57 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
58 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
59 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
60 /* |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
61 static void ratio_optionmenu_changed_cb (GtkOptionMenu* optionmenu, gpointer unser_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
62 int idx = gtk_option_menu_get_history (optionmenu); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
63 int w = 1, h = 1; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
64 gboolean use_ratio = TRUE; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
65 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
66 switch (idx) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
67 case GTH_CROP_RATIO_NONE: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
68 use_ratio = FALSE; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
69 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
70 case GTH_CROP_RATIO_SQUARE: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
71 w = h = 1; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
72 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
73 case GTH_CROP_RATIO_IMAGE: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
74 w = lookup_widget(cropper_window, "image_width"); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
75 h = lookup_widget(cropper_window, "image_height"); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
76 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
77 case GTH_CROP_RATIO_DISPLAY: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
78 w = lookup_widget(cropper_window, "display_width"); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
79 h = lookup_widget(cropper_window, "display_height"); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
80 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
81 case GTH_CROP_RATIO_4_3: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
82 w = 4; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
83 h = 3; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
84 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
85 case GTH_CROP_RATIO_4_6: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
86 w = 4; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
87 h = 6; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
88 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
89 case GTH_CROP_RATIO_CUSTOM: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
90 default: |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
91 w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (lookup_widget(cropper_window, "ratio_w_spinbutton"))); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
92 h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (lookup_widget(cropper_window, "ratio_h_spinbutton"))); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
93 break; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
94 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
95 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
96 gtk_widget_set_sensitive (lookup_widget(cropper_window, "custom_ratio_box"), idx == GTH_CROP_RATIO_CUSTOM); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
97 set_spin_value (cropper_window, lookup_widget(cropper_window, "ratio_w_spinbutton"), w); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
98 set_spin_value (cropper_window, lookup_widget(cropper_window, "ratio_h_spinbutton"), h); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
99 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
100 gth_image_selector_set_ratio (GTH_IMAGE_SELECTOR (lookup_widget(cropper_window, "crop_image")), use_ratio, (double) w / h); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
101 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
102 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
103 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
104 static void ratio_value_changed_cb (GtkSpinButton* spin, gpointer unser_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
105 int w, h; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
106 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
107 w = gtk_spin_button_get_value_as_int (lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
108 h = gtk_spin_button_get_value_as_int (lookup_widget(cropper_window, "ratio_h_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
109 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
110 gth_image_selector_set_ratio (GTH_IMAGE_SELECTOR (lookup_widget(cropper_window, "crop_image")), TRUE, (double) w / h); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
111 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
112 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
113 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
114 static void ratio_swap_button_cb (GtkButton* button, gpointer unser_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
115 int w, h; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
116 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
117 w = gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
118 h = gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "ratio_h_spinbutton")); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
119 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
120 set_spin_value(cropper_window, lookup_widget(cropper_window, "ratio_w_spinbutton"), h); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
121 set_spin_value(cropper_window, lookup_widget(cropper_window, "ratio_h_spinbutton"), w); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
122 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
123 gth_image_selector_set_ratio(GTH_IMAGE_SELECTOR (lookup_widget(cropper_window, "crop_image")), TRUE, (double) h / w); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
124 } |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
125 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
126 */ |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
127 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
128 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
129 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
130 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
131 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
132 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
133 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
134 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
135 /* |
1 | 136 void on_ratio_w_spinbutton_value_changed (GtkSpinButton* spinbutton, gpointer user_data) { |
3 | 137 g_print("spinbutton W - ratio: %f\n", ratio); |
138 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_h_spinbutton"), gtk_spin_button_get_value(spinbutton) / ratio); | |
0 | 139 } |
140 | |
141 | |
1 | 142 void on_ratio_w_spinbutton_change_value (GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data) { |
0 | 143 } |
144 | |
145 | |
1 | 146 void on_ratio_h_spinbutton_change_value (GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data) { |
0 | 147 } |
148 | |
149 | |
1 | 150 void on_ratio_h_spinbutton_value_changed (GtkSpinButton* spinbutton, gpointer user_data) { |
3 | 151 g_print("spinbutton H - ratio: %f\n", ratio); |
152 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"), gtk_spin_button_get_value(spinbutton) * ratio); | |
0 | 153 |
154 } | |
155 | |
156 | |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
157 void on_ratio_swap_button_clicked (GtkButton* button, gpointer user_data) { |
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
158 |
3 | 159 ratio = 1.0 / ratio; |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
160 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"), gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_h_spinbutton"))); |
3 | 161 gtk_spin_button_update(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
162 | |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
163 } |
4
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
164 */ |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
165 |
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
166 |
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
167 |
7
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
168 /* zoom */ |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
169 void on_zoom_in_button_clicked(GtkObject* object, gpointer user_data) { |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
170 printf("zoom in clicked\n"); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
171 image_width *= 1 + inc; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
172 image_height *= 1 + inc; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
173 gtk_image_set_from_pixbuf(lookup_widget(cropper_window, "image_area"), |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
174 gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_BILINEAR)); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
175 } |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
176 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
177 void on_zoom_out_button_clicked(GtkObject* object, gpointer user_data) { |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
178 printf("zoom out clicked\n"); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
179 image_width *= 1 - inc; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
180 image_height *= 1 - inc; |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
181 gtk_image_set_from_pixbuf(lookup_widget(cropper_window, "image_area"), |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
182 gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_BILINEAR)); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
183 } |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
184 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
185 void on_zoom_100_button_clicked(GtkObject* object, gpointer user_data) { |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
186 printf("zoom 100 clicked\n"); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
187 image_width = gdk_pixbuf_get_width(image_buffer); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
188 image_height = gdk_pixbuf_get_height(image_buffer); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
189 gtk_image_set_from_pixbuf(lookup_widget(cropper_window, "image_area"), |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
190 gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_BILINEAR)); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
191 } |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
192 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
193 void on_zoom_fit_button_clicked(GtkObject* object, gpointer user_data) { |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
194 printf("zoom fit clicked\n"); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
195 image_width = gdk_pixbuf_get_width(image_buffer) + 200; /* FIXME */ |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
196 image_height = gdk_pixbuf_get_height(image_buffer) + 200; /* FIXME */ |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
197 gtk_image_set_from_pixbuf(lookup_widget(cropper_window, "image_area"), |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
198 gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_BILINEAR)); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
199 } |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
200 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
201 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
202 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
203 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
204 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
205 |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
206 |
4
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
207 void on_crop_clicked(GtkButton* button, gpointer user_data) { |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
208 char crop_call[256]; |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
209 |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
210 sprintf(crop_call, "echo \"convert -crop %ix%i+%i+%i %s cropped_%s\"", |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
211 gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "crop_width_spinbutton")), |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
212 gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "crop_height_spinbutton")), |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
213 gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "crop_x_spinbutton")), |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
214 gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "crop_y_spinbutton")), |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
215 image_filename, |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
216 image_filename |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
217 ); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
218 system(crop_call); |
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
219 gtk_main_quit(); |
0 | 220 } |
221 | |
7
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
222 void on_cropper_window_create (GtkObject* object, gpointer user_data) { |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
223 image_width = gdk_pixbuf_get_width(image_buffer); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
224 image_height = gdk_pixbuf_get_height(image_buffer); |
ec2d11d96fb0
image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents:
4
diff
changeset
|
225 } |
4
2f11ab3e6047
added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents:
3
diff
changeset
|
226 |
1 | 227 void on_cropper_window_destroy (GtkObject* object, gpointer user_data) { |
0 | 228 gtk_main_quit(); |
229 } | |
230 |