annotate callbacks.c @ 15:7dbf3879939a

removed support.*
author meillo@marmaro.de
date Thu, 04 Mar 2010 19:16:10 +0100
parents da18f2d4f92f
children 88b8856fccf5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
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>
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
3 #include <gdk/gdkkeysyms.h>
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
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
5 #include "callbacks.h"
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
6
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
7 int image_width;
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
8 int image_height;
10
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
9 float inc = 0.3;
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
10 float zoom = 1.0;
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
12
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
13 /*
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
14 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
15 update_spin_button_ratio(GtkWidget* spinbutton)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
16 {
3
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
17 g_print("ratio change: %f\n", ratio);
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
18 on_ratio_w_spinbutton_value_changed(spinbutton, NULL);
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
19 }
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
20
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
21
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
22 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
23 on_ratio_none_activate(GtkMenuItem* menuitem, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
24 {
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
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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
30 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
31 on_ratio_square_activate(GtkMenuItem* menuitem, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
32 {
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
33 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
34 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
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
2f11ab3e6047 added 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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
38 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
39 on_ratio_4x3_activate(GtkMenuItem* menuitem, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
40 {
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
41 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
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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
46 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
47 on_ratio_3x2_activate(GtkMenuItem* menuitem, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
48 {
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
49 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
50 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
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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
54 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
55 on_ratio_custom_activate(GtkMenuItem* menuitem, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
56 {
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
57 ratio = gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_w_spinbutton"))
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
58 / gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_h_spinbutton"));
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
59 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
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 */
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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
2f11ab3e6047 added 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 /*
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
72 static void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
73 ratio_optionmenu_changed_cb(GtkOptionMenu* optionmenu, gpointer unser_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
74 {
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
75 int idx = gtk_option_menu_get_history(optionmenu);
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
76 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
77 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
78
2f11ab3e6047 added 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 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 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
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 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
91 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
92 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
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 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 default:
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
104 w = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
105 lookup_widget(cropper_window, "ratio_w_spinbutton")));
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
106 h = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
107 lookup_widget(cropper_window, "ratio_h_spinbutton")));
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
108 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
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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
111 gtk_widget_set_sensitive(lookup_widget(cropper_window, "custom_ratio_box"),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
112 idx == GTH_CROP_RATIO_CUSTOM);
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
113 set_spin_value(cropper_window, lookup_widget(cropper_window, "ratio_w_spinbutton"), w);
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
114 set_spin_value(cropper_window, lookup_widget(cropper_window, "ratio_h_spinbutton"), h);
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
115
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
116 gth_image_selector_set_ratio(GTH_IMAGE_SELECTOR(lookup_widget(cropper_window, "crop_image")),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
117 use_ratio, (double) w / h);
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
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
2f11ab3e6047 added 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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
121 static void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
122 ratio_value_changed_cb(GtkSpinButton* spin, gpointer unser_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
123 {
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
124 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
125
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
126 w = gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "ratio_w_spinbutton"));
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
127 h = gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "ratio_h_spinbutton"));
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
128
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
129 gth_image_selector_set_ratio(GTH_IMAGE_SELECTOR(
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
130 lookup_widget(cropper_window, "crop_image")), TRUE, (double) w / h);
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
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
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
134 static void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
135 ratio_swap_button_cb(GtkButton* button, gpointer unser_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
136 {
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
137 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
138
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
139 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
140 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
141
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
142 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
143 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
144
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
145 gth_image_selector_set_ratio(GTH_IMAGE_SELECTOR(lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
146 "crop_image")), TRUE, (double) h / 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
147 }
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
148
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
149
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
150
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
151
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
152
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
153
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
154
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
155
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
156 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
157 on_ratio_w_spinbutton_value_changed(GtkSpinButton* spinbutton, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
158 {
3
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
159 g_print("spinbutton W - ratio: %f\n", ratio);
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
160 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_h_spinbutton"),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
161 gtk_spin_button_get_value(spinbutton) / ratio);
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
162 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
163
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
164
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
165 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
166 on_ratio_w_spinbutton_change_value(GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
167 {
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
168 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
169
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
170
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
171 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
172 on_ratio_h_spinbutton_change_value(GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
173 {
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
174 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
175
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
176
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
177 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
178 on_ratio_h_spinbutton_value_changed(GtkSpinButton* spinbutton, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
179 {
3
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
180 g_print("spinbutton H - ratio: %f\n", ratio);
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
181 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
182 gtk_spin_button_get_value(spinbutton) * ratio);
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
183
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
184 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
185
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
186
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
187 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
188 on_ratio_swap_button_clicked(GtkButton* button, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
189 {
2
e359bea4c8ac added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents: 1
diff changeset
190
3
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
191 ratio = 1.0 / ratio;
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
192 gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
193 gtk_spin_button_get_value(lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
194 "ratio_h_spinbutton")));
3
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
195 gtk_spin_button_update(lookup_widget(cropper_window, "ratio_w_spinbutton"));
6aaba3a61563 added ratio control code
meillo@marmaro.de
parents: 2
diff changeset
196
2
e359bea4c8ac added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents: 1
diff changeset
197 }
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
198 */
2
e359bea4c8ac added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents: 1
diff changeset
199
e359bea4c8ac added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents: 1
diff changeset
200
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
201 void
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
202 update_title(char* zoom)
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
203 {
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
204 char title[128];
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
205 snprintf(title, 128, "cropper (%s) %dx%d+%d+%d", zoom, w, h, x, y);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
206 gtk_window_set_title(GTK_WINDOW(cropper_window), title);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
207 }
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
208
2
e359bea4c8ac added code for ratio swap; new names for ratio operations; added main.h; some more
meillo@marmaro.de
parents: 1
diff changeset
209
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
210 /* zoom */
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
211 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
212 set_zoom()
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
213 {
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
214 static GdkPixbuf* pixbuf_new;
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
215 g_object_unref(pixbuf_new);
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
216
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
217 pixbuf_new = gdk_pixbuf_scale_simple(image_buffer, image_width*zoom, image_height*zoom,
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
218 GDK_INTERP_BILINEAR);
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
219 gtk_image_set_from_pixbuf((GtkImage*) lookup_widget(cropper_window, "image_area"), pixbuf_new);
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
220 }
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
221
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
222 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
223 on_zoom_in_button_clicked(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
224 {
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
225 zoom *= 1 + inc;
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
226 set_zoom();
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
227 }
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
228
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
229 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
230 on_zoom_out_button_clicked(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
231 {
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
232 zoom *= 1 - inc;
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
233 set_zoom();
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
234 }
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
235
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
236 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
237 on_zoom_100_button_clicked(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
238 {
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
239 zoom = 1.0;
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
240 set_zoom();
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
241 }
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
242
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
243 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
244 on_zoom_fit_button_clicked(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
245 {
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
246 int w, h;
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
247 float zw, zh;
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
248 GtkWidget* image_a;
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
249
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
250 image_a = (GtkWidget*) lookup_widget(cropper_window, "image_area");
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
251 gdk_drawable_get_size(image_a->window, &w, &h);
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
252
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
253 zw = w*1.0 / image_width;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
254 zh = h*1.0 / image_height;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
255
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
256 zoom = (zw < zh) ? zw : zh;
8
b0824876d379 memory is now freed aswell; added (a crappy) zoom2fit; did some casts to get rid of warnings
meillo@marmaro.de
parents: 7
diff changeset
257 set_zoom();
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
258 }
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
259
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
260
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
261
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
262
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
263
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
264
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
265
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
266 void
14
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
267 crop(void)
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
268 {
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
269 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
270
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
271 sprintf(crop_call, "echo \"convert -crop %ix%i+%i+%i %s cropped_%s\"",
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
272 gtk_spin_button_get_value_as_int((GtkSpinButton*) lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
273 "crop_width_spinbutton")),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
274 gtk_spin_button_get_value_as_int((GtkSpinButton*) lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
275 "crop_height_spinbutton")),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
276 gtk_spin_button_get_value_as_int((GtkSpinButton*) lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
277 "crop_x_spinbutton")),
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
278 gtk_spin_button_get_value_as_int((GtkSpinButton*) lookup_widget(cropper_window,
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
279 "crop_y_spinbutton")),
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
280 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
281 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
282 );
2f11ab3e6047 added option handling; added output for convert; commented all ratio code cause it is not really important now
meillo@marmaro.de
parents: 3
diff changeset
283 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
284 gtk_main_quit();
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
285 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
286
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
287
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
288 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
289 on_cropper_window_create(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
290 {
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
291 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
292 image_height = gdk_pixbuf_get_height(image_buffer);
10
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
293
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
294 /*
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
295 image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL);
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
296 image_area = gtk_image_new_from_pixbuf(image_buffer);
10
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
297
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
298 int w, h;
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
299 GtkWidget* image_a;
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
300
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
301 image_a = (GtkWidget*) lookup_widget(cropper_window, "image_area");
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
302 gdk_drawable_get_size(image_a->window, &w, &h);
10
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
303
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
304 image_width = w - 200;
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
305 image_height = h - 150;
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
306 set_zoom();
5e282003f0c1 minor changes; besser indenting
meillo@marmaro.de
parents: 9
diff changeset
307 */
7
ec2d11d96fb0 image is now gdk-pixbuff; zoom implemented in a basic way
meillo@marmaro.de
parents: 4
diff changeset
308 }
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
309
11
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
310 void
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
311 on_cropper_window_destroy(GtkObject* object, gpointer user_data)
c18ba4ea1514 just cosmetic changes
meillo@marmaro.de
parents: 10
diff changeset
312 {
0
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
313 gtk_main_quit();
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
314 }
ca9155129253 initial commit
meillo@marmaro.de
parents:
diff changeset
315
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
316
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
317
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
318
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
319 gboolean
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
320 on_key_press(GtkWidget* window, GdkEventKey* pKey, gpointer userdata)
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
321 {
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
322 if (pKey->type != GDK_KEY_PRESS) {
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
323 return FALSE;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
324 }
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
325 switch (pKey->keyval) {
14
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
326 case GDK_q:
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
327 gtk_main_quit();
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
328 break;
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
329 case GDK_Return:
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
330 crop();
da18f2d4f92f removed all buttons and stuff from the window; cleaned up
meillo@marmaro.de
parents: 13
diff changeset
331 break;
13
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
332 case GDK_plus:
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
333 on_zoom_in_button_clicked(NULL, userdata);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
334 break;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
335 case GDK_minus:
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
336 on_zoom_out_button_clicked(NULL, userdata);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
337 break;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
338 case GDK_0:
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
339 on_zoom_100_button_clicked(NULL, userdata);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
340 break;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
341 case GDK_f:
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
342 on_zoom_fit_button_clicked(NULL, userdata);
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
343 break;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
344 }
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
345 return TRUE;
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
346 }
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
347
13bc21684b8a added zooming with buttons
meillo@marmaro.de
parents: 11
diff changeset
348