Mercurial > cropper
annotate callbacks.c @ 6:f53ce3b28bb4
mercurial ignores JPG and PNG now, so I can store them in this directory for testing
author | meillo@marmaro.de |
---|---|
date | Fri, 07 Dec 2007 21:38:25 +0100 |
parents | 2f11ab3e6047 |
children | ec2d11d96fb0 |
rev | line source |
---|---|
0 | 1 #include <gtk/gtk.h> |
2 | |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
3 #include "main.h" |
0 | 4 #include "callbacks.h" |
5 #include "interface.h" | |
6 #include "support.h" | |
7 | |
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
|
8 /* |
3 | 9 void update_spin_button_ratio(GtkWidget* spinbutton) { |
10 g_print("ratio change: %f\n", ratio); | |
11 on_ratio_w_spinbutton_value_changed(spinbutton, NULL); | |
12 } | |
0 | 13 |
14 | |
15 | |
16 | |
17 | |
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
|
18 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
|
19 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
|
20 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
|
21 } |
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 |
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 |
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 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
|
25 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
|
26 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
|
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 |
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 |
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 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
|
31 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
|
32 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
|
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 |
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 |
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 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
|
37 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
|
38 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
|
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 |
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 |
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 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
|
43 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
|
44 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
|
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 */ |
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 |
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 |
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 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
|
58 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
|
59 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
|
60 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
|
61 |
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 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
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_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
|
74 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
|
75 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
|
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_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
|
78 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
|
79 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
|
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_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
|
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 = 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
|
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_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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 } |
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 |
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 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
|
93 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
|
94 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
|
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 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
|
97 } |
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 |
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 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
|
101 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
|
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 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
|
104 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
|
105 |
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 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
|
107 } |
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 |
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 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
|
111 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
|
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 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
|
114 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
|
115 |
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 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
|
117 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
|
118 |
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 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
|
120 } |
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 |
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 |
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 /* |
1 | 132 void on_ratio_w_spinbutton_value_changed (GtkSpinButton* spinbutton, gpointer user_data) { |
3 | 133 g_print("spinbutton W - ratio: %f\n", ratio); |
134 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_h_spinbutton"), gtk_spin_button_get_value(spinbutton) / ratio); | |
0 | 135 } |
136 | |
137 | |
1 | 138 void on_ratio_w_spinbutton_change_value (GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data) { |
0 | 139 } |
140 | |
141 | |
1 | 142 void on_ratio_h_spinbutton_change_value (GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data) { |
0 | 143 } |
144 | |
145 | |
1 | 146 void on_ratio_h_spinbutton_value_changed (GtkSpinButton* spinbutton, gpointer user_data) { |
3 | 147 g_print("spinbutton H - ratio: %f\n", ratio); |
148 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"), gtk_spin_button_get_value(spinbutton) * ratio); | |
0 | 149 |
150 } | |
151 | |
152 | |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
153 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
|
154 |
3 | 155 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
|
156 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 | 157 gtk_spin_button_update(lookup_widget(cropper_window, "ratio_w_spinbutton")); |
158 | |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
159 } |
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
|
160 */ |
2
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
161 |
e359bea4c8ac
added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents:
1
diff
changeset
|
162 |
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 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
|
165 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
|
166 |
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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 ); |
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
|
175 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
|
176 gtk_main_quit(); |
0 | 177 } |
178 | |
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
|
179 |
1 | 180 void on_cropper_window_destroy (GtkObject* object, gpointer user_data) { |
0 | 181 gtk_main_quit(); |
182 } | |
183 |