Mercurial > geeqie
comparison src/layout_image.c @ 84:ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
* img-view.c, layout_image.c, layout_util.c: Keypress signal handler
code clean-up round 1: the main windows. Also fixes [Shift]+[F] from
deactivating full screen [F].
author | gqview |
---|---|
date | Fri, 20 Oct 2006 12:03:16 +0000 |
parents | a4c1b7014e6e |
children | cade6a52a165 |
comparison
equal
deleted
inserted
replaced
83:4a0091c0c231 | 84:ba3c39002a24 |
---|---|
97 } | 97 } |
98 | 98 |
99 static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) | 99 static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
100 { | 100 { |
101 LayoutWindow *lw = data; | 101 LayoutWindow *lw = data; |
102 gint stop_signal = FALSE; | 102 gint stop_signal; |
103 gint x = 0; | 103 gint x = 0; |
104 gint y = 0; | 104 gint y = 0; |
105 | 105 |
106 stop_signal = TRUE; | |
106 switch (event->keyval) | 107 switch (event->keyval) |
107 { | 108 { |
108 case GDK_Left: case GDK_KP_Left: | 109 case GDK_Left: case GDK_KP_Left: |
109 x -= 1; | 110 x -= 1; |
110 stop_signal = TRUE; | |
111 break; | 111 break; |
112 case GDK_Right: case GDK_KP_Right: | 112 case GDK_Right: case GDK_KP_Right: |
113 x += 1; | 113 x += 1; |
114 stop_signal = TRUE; | |
115 break; | 114 break; |
116 case GDK_Up: case GDK_KP_Up: | 115 case GDK_Up: case GDK_KP_Up: |
117 y -= 1; | 116 y -= 1; |
118 stop_signal = TRUE; | |
119 break; | 117 break; |
120 case GDK_Down: case GDK_KP_Down: | 118 case GDK_Down: case GDK_KP_Down: |
121 y += 1; | 119 y += 1; |
122 stop_signal = TRUE; | |
123 break; | 120 break; |
124 } | 121 default: |
125 | 122 stop_signal = FALSE; |
126 if ( !(event->state & GDK_CONTROL_MASK) ) | |
127 switch (event->keyval) | |
128 { | |
129 case '+': case '=': case GDK_KP_Add: | |
130 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
131 break; | 123 break; |
132 case '-': case GDK_KP_Subtract: | 124 } |
133 layout_image_zoom_adjust(lw, -get_zoom_increment()); | 125 |
134 break; | 126 if (x != 0 || y!= 0) |
135 case 'X': case 'x': case GDK_KP_Multiply: | 127 { |
136 layout_image_zoom_set(lw, 0.0); | 128 if (event->state & GDK_SHIFT_MASK) |
137 break; | 129 { |
138 case 'Z': case 'z': case GDK_KP_Divide: | 130 x *= 3; |
139 case '1': | 131 y *= 3; |
140 layout_image_zoom_set(lw, 1.0); | 132 } |
141 break; | 133 |
142 case '2': | 134 keyboard_scroll_calc(&x, &y, event); |
143 layout_image_zoom_set(lw, 2.0); | 135 layout_image_scroll(lw, x, y); |
144 break; | 136 } |
145 case '3': | 137 |
146 layout_image_zoom_set(lw, 3.0); | 138 if (stop_signal) return stop_signal; |
147 break; | |
148 case '4': | |
149 layout_image_zoom_set(lw, 4.0); | |
150 break; | |
151 case '7': | |
152 layout_image_zoom_set(lw, -4.0); | |
153 break; | |
154 case '8': | |
155 layout_image_zoom_set(lw, -3.0); | |
156 break; | |
157 case '9': | |
158 layout_image_zoom_set(lw, -2.0); | |
159 break; | |
160 case 'W': case 'w': | |
161 layout_image_zoom_set_fill_geometry(lw, FALSE); | |
162 break; | |
163 case 'H': case 'h': | |
164 layout_image_zoom_set_fill_geometry(lw, TRUE); | |
165 break; | |
166 case GDK_Page_Up: case GDK_KP_Page_Up: | |
167 case GDK_BackSpace: | |
168 case 'B': case 'b': | |
169 layout_image_prev(lw); | |
170 stop_signal = TRUE; | |
171 break; | |
172 case GDK_Page_Down: case GDK_KP_Page_Down: | |
173 case GDK_space: | |
174 case 'N': case 'n': | |
175 layout_image_next(lw); | |
176 stop_signal = TRUE; | |
177 break; | |
178 case GDK_Home: case GDK_KP_Home: | |
179 layout_image_first(lw); | |
180 stop_signal = TRUE; | |
181 break; | |
182 case GDK_End: case GDK_KP_End: | |
183 layout_image_last(lw); | |
184 stop_signal = TRUE; | |
185 break; | |
186 case ']': | |
187 layout_image_alter(lw, ALTER_ROTATE_90); | |
188 stop_signal = TRUE; | |
189 break; | |
190 case '[': | |
191 layout_image_alter(lw, ALTER_ROTATE_90_CC); | |
192 stop_signal = TRUE; | |
193 break; | |
194 case GDK_Delete: case GDK_KP_Delete: | |
195 if (enable_delete_key) | |
196 { | |
197 file_util_delete(layout_image_get_path(lw), NULL, widget); | |
198 stop_signal = TRUE; | |
199 } | |
200 break; | |
201 case GDK_Escape: | |
202 layout_image_full_screen_stop(lw); | |
203 stop_signal = TRUE; | |
204 break; | |
205 case 'R': case 'r': | |
206 if (!(event->state & GDK_SHIFT_MASK)) | |
207 { | |
208 layout_refresh(lw); | |
209 } | |
210 break; | |
211 case 'S': case 's': | |
212 layout_image_slideshow_toggle(lw); | |
213 break; | |
214 case 'P': case 'p': | |
215 layout_image_slideshow_pause_toggle(lw); | |
216 break; | |
217 case 'F': case 'f': | |
218 case 'V': case 'v': | |
219 layout_image_full_screen_stop(lw); | |
220 break; | |
221 case GDK_Menu: | |
222 case GDK_F10: | |
223 layout_image_full_screen_menu_popup(lw); | |
224 stop_signal = TRUE; | |
225 break; | |
226 case 'I': case 'i': | |
227 layout_image_overlay_set(lw, !(lw->full_screen_overlay_on)); | |
228 break; | |
229 } | |
230 | 139 |
231 if (event->state & GDK_CONTROL_MASK) | 140 if (event->state & GDK_CONTROL_MASK) |
232 { | 141 { |
233 gint n = -1; | 142 gint n = -1; |
143 | |
144 stop_signal = TRUE; | |
234 switch (event->keyval) | 145 switch (event->keyval) |
235 { | 146 { |
236 case '1': | 147 case '1': |
237 n = 0; | 148 n = 0; |
238 break; | 149 break; |
279 info_window_new(layout_image_get_path(lw), NULL); | 190 info_window_new(layout_image_get_path(lw), NULL); |
280 break; | 191 break; |
281 case 'Q': case 'q': | 192 case 'Q': case 'q': |
282 exit_gqview(); | 193 exit_gqview(); |
283 return FALSE; | 194 return FALSE; |
195 break; | |
196 default: | |
197 stop_signal = FALSE; | |
284 break; | 198 break; |
285 } | 199 } |
286 if (n != -1) | 200 if (n != -1) |
287 { | 201 { |
288 if (!editor_window_flag_set(n)) | 202 if (!editor_window_flag_set(n)) |
292 start_editor_from_file(n, layout_image_get_path(lw)); | 206 start_editor_from_file(n, layout_image_get_path(lw)); |
293 } | 207 } |
294 } | 208 } |
295 else if (event->state & GDK_SHIFT_MASK) | 209 else if (event->state & GDK_SHIFT_MASK) |
296 { | 210 { |
211 stop_signal = TRUE; | |
297 switch (event->keyval) | 212 switch (event->keyval) |
298 { | 213 { |
299 case 'R': case 'r': | 214 case 'R': case 'r': |
300 layout_image_alter(lw, ALTER_ROTATE_180); | 215 layout_image_alter(lw, ALTER_ROTATE_180); |
301 stop_signal = TRUE; | |
302 break; | 216 break; |
303 case 'M': case 'm': | 217 case 'M': case 'm': |
304 layout_image_alter(lw, ALTER_MIRROR); | 218 layout_image_alter(lw, ALTER_MIRROR); |
305 stop_signal = TRUE; | |
306 break; | 219 break; |
307 case 'F': case 'f': | 220 case 'F': case 'f': |
308 layout_image_alter(lw, ALTER_FLIP); | 221 layout_image_alter(lw, ALTER_FLIP); |
309 stop_signal = TRUE; | |
310 break; | 222 break; |
311 case 'G': case 'g': | 223 case 'G': case 'g': |
312 layout_image_alter(lw, ALTER_DESATURATE); | 224 layout_image_alter(lw, ALTER_DESATURATE); |
313 stop_signal = TRUE; | |
314 break; | 225 break; |
315 default: | 226 default: |
316 break; | 227 stop_signal = FALSE; |
317 } | 228 break; |
318 x *= 3; | 229 } |
319 y *= 3; | 230 } |
320 } | 231 else |
321 | 232 { |
322 if (x != 0 || y!= 0) | 233 stop_signal = TRUE; |
323 { | 234 switch (event->keyval) |
324 keyboard_scroll_calc(&x, &y, event); | 235 { |
325 layout_image_scroll(lw, x, y); | 236 case '+': case '=': case GDK_KP_Add: |
237 layout_image_zoom_adjust(lw, get_zoom_increment()); | |
238 break; | |
239 case '-': case GDK_KP_Subtract: | |
240 layout_image_zoom_adjust(lw, -get_zoom_increment()); | |
241 break; | |
242 case 'X': case 'x': case GDK_KP_Multiply: | |
243 layout_image_zoom_set(lw, 0.0); | |
244 break; | |
245 case 'Z': case 'z': case GDK_KP_Divide: | |
246 case '1': | |
247 layout_image_zoom_set(lw, 1.0); | |
248 break; | |
249 case '2': | |
250 layout_image_zoom_set(lw, 2.0); | |
251 break; | |
252 case '3': | |
253 layout_image_zoom_set(lw, 3.0); | |
254 break; | |
255 case '4': | |
256 layout_image_zoom_set(lw, 4.0); | |
257 break; | |
258 case '7': | |
259 layout_image_zoom_set(lw, -4.0); | |
260 break; | |
261 case '8': | |
262 layout_image_zoom_set(lw, -3.0); | |
263 break; | |
264 case '9': | |
265 layout_image_zoom_set(lw, -2.0); | |
266 break; | |
267 case 'W': case 'w': | |
268 layout_image_zoom_set_fill_geometry(lw, FALSE); | |
269 break; | |
270 case 'H': case 'h': | |
271 layout_image_zoom_set_fill_geometry(lw, TRUE); | |
272 break; | |
273 case GDK_Page_Up: case GDK_KP_Page_Up: | |
274 case GDK_BackSpace: | |
275 case 'B': case 'b': | |
276 layout_image_prev(lw); | |
277 break; | |
278 case GDK_Page_Down: case GDK_KP_Page_Down: | |
279 case GDK_space: | |
280 case 'N': case 'n': | |
281 layout_image_next(lw); | |
282 break; | |
283 case GDK_Home: case GDK_KP_Home: | |
284 layout_image_first(lw); | |
285 break; | |
286 case GDK_End: case GDK_KP_End: | |
287 layout_image_last(lw); | |
288 break; | |
289 case ']': | |
290 layout_image_alter(lw, ALTER_ROTATE_90); | |
291 break; | |
292 case '[': | |
293 layout_image_alter(lw, ALTER_ROTATE_90_CC); | |
294 break; | |
295 case GDK_Delete: case GDK_KP_Delete: | |
296 if (enable_delete_key) | |
297 { | |
298 file_util_delete(layout_image_get_path(lw), NULL, widget); | |
299 } | |
300 break; | |
301 case GDK_Escape: | |
302 layout_image_full_screen_stop(lw); | |
303 break; | |
304 case 'R': case 'r': | |
305 layout_refresh(lw); | |
306 break; | |
307 case 'S': case 's': | |
308 layout_image_slideshow_toggle(lw); | |
309 break; | |
310 case 'P': case 'p': | |
311 layout_image_slideshow_pause_toggle(lw); | |
312 break; | |
313 case 'F': case 'f': | |
314 case 'V': case 'v': | |
315 layout_image_full_screen_stop(lw); | |
316 break; | |
317 case GDK_Menu: | |
318 case GDK_F10: | |
319 layout_image_full_screen_menu_popup(lw); | |
320 break; | |
321 case 'I': case 'i': | |
322 layout_image_overlay_set(lw, !(lw->full_screen_overlay_on)); | |
323 break; | |
324 default: | |
325 stop_signal = FALSE; | |
326 break; | |
327 } | |
326 } | 328 } |
327 | 329 |
328 return stop_signal; | 330 return stop_signal; |
329 } | 331 } |
330 | 332 |