Mercurial > geeqie
annotate src/img-view.c @ 1329:1fc356f629fe
Clean up histogram stuff: options saving/restoring, osd histogram separation, tidy up.
author | zas_ |
---|---|
date | Thu, 26 Feb 2009 20:50:36 +0000 |
parents | 55ea4962887a |
children | 79937bc55f3a |
rev | line source |
---|---|
1 | 1 /* |
196 | 2 * Geeqie |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
3 * (C) 2006 John Ellis |
1284 | 4 * Copyright (C) 2008 - 2009 The Geeqie Team |
1 | 5 * |
6 * Author: John Ellis | |
7 * | |
9 | 8 * This software is released under the GNU General Public License (GNU GPL). |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
1 | 11 */ |
12 | |
9 | 13 |
281 | 14 #include "main.h" |
9 | 15 #include "img-view.h" |
16 | |
17 #include "collect.h" | |
18 #include "collect-io.h" | |
19 #include "dnd.h" | |
20 #include "editors.h" | |
586 | 21 #include "filedata.h" |
9 | 22 #include "fullscreen.h" |
1 | 23 #include "image.h" |
9 | 24 #include "image-overlay.h" |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
25 #include "layout.h" |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
26 #include "layout_image.h" |
9 | 27 #include "menu.h" |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
995
diff
changeset
|
28 #include "misc.h" |
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
995
diff
changeset
|
29 #include "pixbuf_util.h" |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
30 #include "pixbuf-renderer.h" |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
31 #include "print.h" |
9 | 32 #include "slideshow.h" |
33 #include "ui_fileops.h" | |
34 #include "ui_menu.h" | |
904
1698baa37871
Move uri_*() functions to separate files: uri_utils.[ch]
zas_
parents:
888
diff
changeset
|
35 #include "uri_utils.h" |
1022
9962b24b6b43
Move miscellaneous functions to their own files (new misc.[ch]).
zas_
parents:
995
diff
changeset
|
36 #include "utilops.h" |
648
e34c1002e553
Move some functions from main.[ch] to new window.[ch].
zas_
parents:
621
diff
changeset
|
37 #include "window.h" |
9 | 38 |
1 | 39 #include <gdk/gdkkeysyms.h> /* for keyboard values */ |
40 | |
9 | 41 |
42 typedef struct _ViewWindow ViewWindow; | |
43 struct _ViewWindow | |
44 { | |
45 GtkWidget *window; | |
46 ImageWindow *imd; | |
47 FullScreenData *fs; | |
48 SlideShowData *ss; | |
49 | |
50 GList *list; | |
51 GList *list_pointer; | |
52 }; | |
53 | |
54 | |
55 static GList *view_window_list = NULL; | |
56 | |
57 | |
58 static GtkWidget *view_popup_menu(ViewWindow *vw); | |
59 static void view_fullscreen_toggle(ViewWindow *vw, gint force_off); | |
60 static void view_overlay_toggle(ViewWindow *vw); | |
61 | |
62 static void view_slideshow_next(ViewWindow *vw); | |
63 static void view_slideshow_prev(ViewWindow *vw); | |
64 static void view_slideshow_start(ViewWindow *vw); | |
65 static void view_slideshow_stop(ViewWindow *vw); | |
66 | |
67 static void view_window_close(ViewWindow *vw); | |
68 | |
69 static void view_window_dnd_init(ViewWindow *vw); | |
70 | |
797 | 71 static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data); |
9 | 72 |
73 /* | |
74 *----------------------------------------------------------------------------- | |
75 * misc | |
76 *----------------------------------------------------------------------------- | |
442 | 77 */ |
9 | 78 |
79 static ImageWindow *view_window_active_image(ViewWindow *vw) | |
80 { | |
81 if (vw->fs) return vw->fs->imd; | |
82 | |
83 return vw->imd; | |
84 } | |
85 | |
86 static void view_window_set_list(ViewWindow *vw, GList *list) | |
87 { | |
88 | |
138 | 89 filelist_free(vw->list); |
9 | 90 vw->list = NULL; |
91 vw->list_pointer = NULL; | |
92 | |
138 | 93 vw->list = filelist_copy(list); |
9 | 94 } |
95 | |
96 static gint view_window_contains_collection(ViewWindow *vw) | |
97 { | |
98 CollectionData *cd; | |
99 CollectInfo *info; | |
100 | |
101 cd = image_get_collection(view_window_active_image(vw), &info); | |
102 | |
103 return (cd && info); | |
104 } | |
105 | |
106 static void view_collection_step(ViewWindow *vw, gint next) | |
107 { | |
108 ImageWindow *imd = view_window_active_image(vw); | |
109 CollectionData *cd; | |
110 CollectInfo *info; | |
111 CollectInfo *read_ahead_info = NULL; | |
112 | |
113 cd = image_get_collection(imd, &info); | |
114 | |
115 if (!cd || !info) return; | |
116 | |
117 if (next) | |
118 { | |
119 info = collection_next_by_info(cd, info); | |
334 | 120 if (options->image.enable_read_ahead) |
9 | 121 { |
122 read_ahead_info = collection_next_by_info(cd, info); | |
123 if (!read_ahead_info) read_ahead_info = collection_prev_by_info(cd, info); | |
124 } | |
125 } | |
126 else | |
127 { | |
128 info = collection_prev_by_info(cd, info); | |
334 | 129 if (options->image.enable_read_ahead) |
9 | 130 { |
131 read_ahead_info = collection_prev_by_info(cd, info); | |
132 if (!read_ahead_info) read_ahead_info = collection_next_by_info(cd, info); | |
133 } | |
134 } | |
135 | |
136 if (info) | |
137 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
138 image_change_from_collection(imd, cd, info, image_zoom_get_default(imd)); |
9 | 139 |
138 | 140 if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); |
9 | 141 } |
442 | 142 |
9 | 143 } |
144 | |
145 static void view_collection_step_to_end(ViewWindow *vw, gint last) | |
146 { | |
147 ImageWindow *imd = view_window_active_image(vw); | |
148 CollectionData *cd; | |
149 CollectInfo *info; | |
150 CollectInfo *read_ahead_info = NULL; | |
151 | |
152 cd = image_get_collection(imd, &info); | |
153 | |
154 if (!cd || !info) return; | |
155 | |
156 if (last) | |
157 { | |
158 info = collection_get_last(cd); | |
334 | 159 if (options->image.enable_read_ahead) read_ahead_info = collection_prev_by_info(cd, info); |
9 | 160 } |
161 else | |
162 { | |
163 info = collection_get_first(cd); | |
334 | 164 if (options->image.enable_read_ahead) read_ahead_info = collection_next_by_info(cd, info); |
9 | 165 } |
166 | |
167 if (info) | |
168 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
169 image_change_from_collection(imd, cd, info, image_zoom_get_default(imd)); |
138 | 170 if (read_ahead_info) image_prebuffer_set(imd, read_ahead_info->fd); |
9 | 171 } |
172 } | |
173 | |
174 static void view_list_step(ViewWindow *vw, gint next) | |
175 { | |
176 ImageWindow *imd = view_window_active_image(vw); | |
138 | 177 FileData *fd; |
9 | 178 GList *work; |
179 GList *work_ahead; | |
180 | |
181 if (!vw->list) return; | |
182 | |
138 | 183 fd = image_get_fd(imd); |
184 if (!fd) return; | |
9 | 185 |
186 if (g_list_position(vw->list, vw->list_pointer) >= 0) | |
187 { | |
188 work = vw->list_pointer; | |
189 } | |
190 else | |
191 { | |
192 gint found = FALSE; | |
193 | |
194 work = vw->list; | |
195 while (work && !found) | |
196 { | |
138 | 197 FileData *temp; |
9 | 198 |
199 temp = work->data; | |
200 | |
138 | 201 if (fd == temp) |
9 | 202 { |
203 found = TRUE; | |
204 } | |
205 else | |
206 { | |
207 work = work->next; | |
208 } | |
209 } | |
210 } | |
211 if (!work) return; | |
212 | |
213 work_ahead = NULL; | |
214 if (next) | |
215 { | |
216 work = work->next; | |
217 if (work) work_ahead = work->next; | |
218 } | |
219 else | |
220 { | |
221 work = work->prev; | |
222 if (work) work_ahead = work->prev; | |
223 } | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
224 |
9 | 225 if (!work) return; |
226 | |
227 vw->list_pointer = work; | |
138 | 228 fd = work->data; |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
229 image_change_fd(imd, fd, image_zoom_get_default(imd)); |
9 | 230 |
334 | 231 if (options->image.enable_read_ahead && work_ahead) |
9 | 232 { |
138 | 233 FileData *next_fd = work_ahead->data; |
234 image_prebuffer_set(imd, next_fd); | |
9 | 235 } |
236 } | |
237 | |
238 static void view_list_step_to_end(ViewWindow *vw, gint last) | |
239 { | |
240 ImageWindow *imd = view_window_active_image(vw); | |
138 | 241 FileData *fd; |
9 | 242 GList *work; |
243 GList *work_ahead; | |
244 | |
245 if (!vw->list) return; | |
246 | |
247 if (last) | |
248 { | |
249 work = g_list_last(vw->list); | |
250 work_ahead = work->prev; | |
251 } | |
252 else | |
253 { | |
254 work = vw->list; | |
255 work_ahead = work->next; | |
256 } | |
257 | |
258 vw->list_pointer = work; | |
138 | 259 fd = work->data; |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
260 image_change_fd(imd, fd, image_zoom_get_default(imd)); |
9 | 261 |
334 | 262 if (options->image.enable_read_ahead && work_ahead) |
9 | 263 { |
138 | 264 FileData *next_fd = work_ahead->data; |
265 image_prebuffer_set(imd, next_fd); | |
9 | 266 } |
267 } | |
268 | |
269 static void view_step_next(ViewWindow *vw) | |
270 { | |
271 if (vw->ss) | |
272 { | |
273 view_slideshow_next(vw); | |
274 } | |
275 else if (vw->list) | |
276 { | |
277 view_list_step(vw, TRUE); | |
278 } | |
279 else | |
280 { | |
281 view_collection_step(vw, TRUE); | |
282 } | |
283 } | |
284 | |
285 static void view_step_prev(ViewWindow *vw) | |
286 { | |
287 if (vw->ss) | |
288 { | |
289 view_slideshow_prev(vw); | |
290 } | |
291 else if (vw->list) | |
292 { | |
293 view_list_step(vw, FALSE); | |
294 } | |
295 else | |
296 { | |
297 view_collection_step(vw, FALSE); | |
298 } | |
299 } | |
300 | |
301 static void view_step_to_end(ViewWindow *vw, gint last) | |
302 { | |
303 if (vw->list) | |
304 { | |
305 view_list_step_to_end(vw, last); | |
306 } | |
307 else | |
308 { | |
309 view_collection_step_to_end(vw, last); | |
310 } | |
311 } | |
312 | |
1 | 313 /* |
314 *----------------------------------------------------------------------------- | |
315 * view window keyboard | |
316 *----------------------------------------------------------------------------- | |
317 */ | |
318 | |
9 | 319 static void view_window_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) |
320 { | |
321 ViewWindow *vw = data; | |
322 ImageWindow *imd; | |
323 | |
324 imd = view_window_active_image(vw); | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
325 gdk_window_get_origin(imd->pr->window, x, y); |
9 | 326 popup_menu_position_clamp(menu, x, y, 0); |
327 } | |
328 | |
1 | 329 static gint view_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
330 { | |
9 | 331 ViewWindow *vw = data; |
332 ImageWindow *imd; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
333 gint stop_signal; |
9 | 334 GtkWidget *menu; |
1 | 335 gint x = 0; |
336 gint y = 0; | |
337 | |
9 | 338 imd = view_window_active_image(vw); |
339 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
340 stop_signal = TRUE; |
1 | 341 switch (event->keyval) |
342 { | |
9 | 343 case GDK_Left: case GDK_KP_Left: |
1 | 344 x -= 1; |
345 break; | |
9 | 346 case GDK_Right: case GDK_KP_Right: |
1 | 347 x += 1; |
348 break; | |
9 | 349 case GDK_Up: case GDK_KP_Up: |
1 | 350 y -= 1; |
351 break; | |
9 | 352 case GDK_Down: case GDK_KP_Down: |
1 | 353 y += 1; |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
354 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
355 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
356 stop_signal = FALSE; |
1 | 357 break; |
9 | 358 } |
359 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
360 if (x != 0 || y!= 0) |
9 | 361 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
362 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
363 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
364 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
365 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
366 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
367 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
368 keyboard_scroll_calc(&x, &y, event); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
369 image_scroll(imd, x, y); |
1 | 370 } |
371 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
372 if (stop_signal) return stop_signal; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
373 |
1 | 374 if (event->state & GDK_CONTROL_MASK) |
375 { | |
376 gint n = -1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
377 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
378 stop_signal = TRUE; |
1 | 379 switch (event->keyval) |
380 { | |
381 case '1': | |
382 n = 0; | |
383 break; | |
384 case '2': | |
385 n = 1; | |
386 break; | |
387 case '3': | |
388 n = 2; | |
389 break; | |
390 case '4': | |
391 n = 3; | |
392 break; | |
393 case '5': | |
394 n = 4; | |
395 break; | |
396 case '6': | |
397 n = 5; | |
398 break; | |
399 case '7': | |
400 n = 6; | |
401 break; | |
402 case '8': | |
403 n = 7; | |
404 break; | |
9 | 405 case '9': |
406 n = 8; | |
407 break; | |
408 case '0': | |
409 n = 9; | |
410 break; | |
411 case 'C': case 'c': | |
138 | 412 file_util_copy(image_get_fd(imd), NULL, NULL, imd->widget); |
9 | 413 break; |
414 case 'M': case 'm': | |
138 | 415 file_util_move(image_get_fd(imd), NULL, NULL, imd->widget); |
9 | 416 break; |
417 case 'R': case 'r': | |
138 | 418 file_util_rename(image_get_fd(imd), NULL, imd->widget); |
9 | 419 break; |
420 case 'D': case 'd': | |
138 | 421 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
9 | 422 break; |
423 case 'W': case 'w': | |
424 view_window_close(vw); | |
425 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
426 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
427 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
428 break; |
1 | 429 } |
1272 | 430 #if 0 |
1 | 431 if (n != -1) |
432 { | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
433 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
434 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
435 view_fullscreen_toggle(vw, TRUE); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
436 } |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
437 imd = view_window_active_image(vw); |
753 | 438 file_util_start_editor_from_file(n, image_get_fd(imd), imd->widget); |
1 | 439 } |
1272 | 440 #endif |
1 | 441 } |
9 | 442 else if (event->state & GDK_SHIFT_MASK) |
1 | 443 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
444 stop_signal = TRUE; |
9 | 445 switch (event->keyval) |
446 { | |
447 case 'R': case 'r': | |
448 image_alter(imd, ALTER_ROTATE_180); | |
449 break; | |
450 case 'M': case 'm': | |
451 image_alter(imd, ALTER_MIRROR); | |
452 break; | |
453 case 'F': case 'f': | |
454 image_alter(imd, ALTER_FLIP); | |
455 break; | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
456 case 'G': case 'g': |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
457 image_alter(imd, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
458 break; |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
459 case 'P': case 'p': |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
460 { |
138 | 461 FileData *fd; |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
462 |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
463 view_fullscreen_toggle(vw, TRUE); |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
464 imd = view_window_active_image(vw); |
138 | 465 fd = image_get_fd(imd); |
466 print_window_new(fd, | |
467 fd ? g_list_append(NULL, file_data_ref(fd)) : NULL, | |
468 filelist_copy(vw->list), vw->window); | |
94
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
469 } |
50dc5a14d37b
Thu Nov 2 17:51:31 2006 John Ellis <johne@verizon.net>
gqview
parents:
91
diff
changeset
|
470 break; |
9 | 471 default: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
472 stop_signal = FALSE; |
9 | 473 break; |
474 } | |
1 | 475 } |
442 | 476 else |
1 | 477 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
478 stop_signal = TRUE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
479 switch (event->keyval) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
480 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
481 case GDK_Page_Up: case GDK_KP_Page_Up: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
482 case GDK_BackSpace: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
483 case 'B': case 'b': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
484 view_step_prev(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
485 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
486 case GDK_Page_Down: case GDK_KP_Page_Down: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
487 case GDK_space: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
488 case 'N': case 'n': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
489 view_step_next(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
490 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
491 case GDK_Home: case GDK_KP_Home: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
492 view_step_to_end(vw, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
493 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
494 case GDK_End: case GDK_KP_End: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
495 view_step_to_end(vw, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
496 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
497 case '+': case '=': case GDK_KP_Add: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
498 image_zoom_adjust(imd, get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
499 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
500 case '-': case GDK_KP_Subtract: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
501 image_zoom_adjust(imd, -get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
502 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
503 case 'X': case 'x': case GDK_KP_Multiply: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
504 image_zoom_set(imd, 0.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
505 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
506 case 'Z': case 'z': case GDK_KP_Divide: case '1': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
507 image_zoom_set(imd, 1.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
508 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
509 case '2': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
510 image_zoom_set(imd, 2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
511 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
512 case '3': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
513 image_zoom_set(imd, 3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
514 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
515 case '4': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
516 image_zoom_set(imd, 4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
517 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
518 case '7': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
519 image_zoom_set(imd, -4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
520 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
521 case '8': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
522 image_zoom_set(imd, -3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
523 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
524 case '9': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
525 image_zoom_set(imd, -2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
526 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
527 case 'W': case 'w': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
528 image_zoom_set_fill_geometry(imd, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
529 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
530 case 'H': case 'h': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
531 image_zoom_set_fill_geometry(imd, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
532 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
533 case 'R': case 'r': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
534 image_reload(imd); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
535 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
536 case 'S': case 's': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
537 if (vw->ss) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
538 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
539 view_slideshow_stop(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
540 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
541 else |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
542 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
543 view_slideshow_start(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
544 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
545 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
546 case 'P': case 'p': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
547 slideshow_pause_toggle(vw->ss); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
548 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
549 case 'F': case 'f': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
550 case 'V': case 'v': |
86
cade6a52a165
Mon Oct 23 05:34:29 2006 John Ellis <johne@verizon.net>
gqview
parents:
84
diff
changeset
|
551 case GDK_F11: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
552 view_fullscreen_toggle(vw, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
553 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
554 case 'I': case 'i': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
555 view_overlay_toggle(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
556 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
557 case ']': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
558 image_alter(imd, ALTER_ROTATE_90); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
559 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
560 case '[': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
561 image_alter(imd, ALTER_ROTATE_90_CC); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
562 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
563 case GDK_Delete: case GDK_KP_Delete: |
341
15c6b94545a2
Move safe_delete* and in place rename options to file_ops
zas_
parents:
339
diff
changeset
|
564 if (options->file_ops.enable_delete_key) |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
565 { |
138 | 566 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
567 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
568 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
569 case GDK_Escape: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
570 if (vw->fs) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
571 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
572 view_fullscreen_toggle(vw, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
573 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
574 else |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
575 { |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
576 view_window_close(vw); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
577 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
578 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
579 case GDK_Menu: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
580 case GDK_F10: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
581 menu = view_popup_menu(vw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
582 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
583 view_window_menu_pos_cb, vw, 0, GDK_CURRENT_TIME); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
584 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
585 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
586 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
587 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
588 } |
1 | 589 } |
590 | |
591 return stop_signal; | |
592 } | |
593 | |
594 /* | |
595 *----------------------------------------------------------------------------- | |
596 * view window main routines | |
597 *----------------------------------------------------------------------------- | |
442 | 598 */ |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
599 static void button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data) |
9 | 600 { |
601 ViewWindow *vw = data; | |
602 GtkWidget *menu; | |
603 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
604 switch (event->button) |
9 | 605 { |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
606 case MOUSE_BUTTON_LEFT: |
9 | 607 view_step_next(vw); |
608 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
609 case MOUSE_BUTTON_MIDDLE: |
9 | 610 view_step_prev(vw); |
611 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
612 case MOUSE_BUTTON_RIGHT: |
9 | 613 menu = view_popup_menu(vw); |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
614 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time); |
9 | 615 break; |
616 default: | |
617 break; | |
618 } | |
619 } | |
620 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
621 static void scroll_cb(ImageWindow *imd, GdkEventScroll *event, gpointer data) |
1 | 622 { |
9 | 623 ViewWindow *vw = data; |
624 | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
625 if (event->state & GDK_CONTROL_MASK) |
9 | 626 { |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
627 switch (event->direction) |
9 | 628 { |
629 case GDK_SCROLL_UP: | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
630 image_zoom_adjust_at_point(imd, get_zoom_increment(), event->x, event->y); |
9 | 631 break; |
632 case GDK_SCROLL_DOWN: | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
633 image_zoom_adjust_at_point(imd, -get_zoom_increment(), event->x, event->y); |
9 | 634 break; |
635 default: | |
636 break; | |
637 } | |
638 } | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
639 else if ( (event->state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls)) |
9 | 640 { |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
641 switch (event->direction) |
9 | 642 { |
643 case GDK_SCROLL_UP: | |
644 image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE); | |
645 break; | |
646 case GDK_SCROLL_DOWN: | |
647 image_scroll(imd, 0, MOUSEWHEEL_SCROLL_SIZE); | |
648 break; | |
649 case GDK_SCROLL_LEFT: | |
650 image_scroll(imd, -MOUSEWHEEL_SCROLL_SIZE, 0); | |
651 break; | |
652 case GDK_SCROLL_RIGHT: | |
653 image_scroll(imd, MOUSEWHEEL_SCROLL_SIZE, 0); | |
654 break; | |
655 default: | |
656 break; | |
657 } | |
658 } | |
659 else | |
660 { | |
868
db6977f8b0f1
Reduce number of parameters (mostly unused), just pass the event pointer.
zas_
parents:
803
diff
changeset
|
661 switch (event->direction) |
9 | 662 { |
663 case GDK_SCROLL_UP: | |
664 view_step_prev(vw); | |
665 break; | |
666 case GDK_SCROLL_DOWN: | |
667 view_step_next(vw); | |
668 break; | |
669 default: | |
670 break; | |
671 } | |
672 } | |
673 } | |
674 | |
675 static void view_image_set_buttons(ViewWindow *vw, ImageWindow *imd) | |
676 { | |
677 image_set_button_func(imd, button_cb, vw); | |
678 image_set_scroll_func(imd, scroll_cb, vw); | |
679 } | |
680 | |
681 static void view_fullscreen_stop_func(FullScreenData *fs, gpointer data) | |
682 { | |
683 ViewWindow *vw = data; | |
684 | |
685 vw->fs = NULL; | |
686 | |
687 if (vw->ss) vw->ss->imd = vw->imd; | |
1 | 688 } |
689 | |
9 | 690 static void view_fullscreen_toggle(ViewWindow *vw, gint force_off) |
4 | 691 { |
9 | 692 if (force_off && !vw->fs) return; |
693 | |
694 if (vw->fs) | |
695 { | |
621 | 696 if (image_osd_get(vw->imd) & OSD_SHOW_INFO) |
697 image_osd_set(vw->imd, image_osd_get(vw->fs->imd)); | |
698 | |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
94
diff
changeset
|
699 fullscreen_stop(vw->fs); |
9 | 700 } |
701 else | |
702 { | |
703 vw->fs = fullscreen_start(vw->window, vw->imd, view_fullscreen_stop_func, vw); | |
704 | |
705 view_image_set_buttons(vw, vw->fs->imd); | |
706 g_signal_connect(G_OBJECT(vw->fs->window), "key_press_event", | |
707 G_CALLBACK(view_window_key_press_cb), vw); | |
708 | |
709 if (vw->ss) vw->ss->imd = vw->fs->imd; | |
710 | |
621 | 711 if (image_osd_get(vw->imd) & OSD_SHOW_INFO) |
9 | 712 { |
621 | 713 image_osd_set(vw->fs->imd, image_osd_get(vw->imd)); |
614 | 714 image_osd_set(vw->imd, OSD_SHOW_NOTHING); |
9 | 715 } |
716 } | |
717 } | |
718 | |
719 static void view_overlay_toggle(ViewWindow *vw) | |
720 { | |
721 ImageWindow *imd; | |
722 | |
723 imd = view_window_active_image(vw); | |
481
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
479
diff
changeset
|
724 |
67a612985686
Merge view_overlay_toggle() and layout_image_overlay_toggle() into new image_osd_toggle().
zas_
parents:
479
diff
changeset
|
725 image_osd_toggle(imd); |
9 | 726 } |
727 | |
728 static void view_slideshow_next(ViewWindow *vw) | |
729 { | |
730 if (vw->ss) slideshow_next(vw->ss); | |
4 | 731 } |
732 | |
9 | 733 static void view_slideshow_prev(ViewWindow *vw) |
734 { | |
735 if (vw->ss) slideshow_prev(vw->ss); | |
736 } | |
737 | |
738 static void view_slideshow_stop_func(SlideShowData *fs, gpointer data) | |
739 { | |
740 ViewWindow *vw = data; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
741 GList *work; |
138 | 742 FileData *fd; |
9 | 743 |
744 vw->ss = NULL; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
745 |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
746 work = vw->list; |
138 | 747 fd = image_get_fd(view_window_active_image(vw)); |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
748 while (work) |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
749 { |
138 | 750 FileData *temp; |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
751 |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
752 temp = work->data; |
138 | 753 if (fd == temp) |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
754 { |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
755 vw->list_pointer = work; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
756 work = NULL; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
757 } |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
758 else |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
759 { |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
760 work = work->next; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
761 } |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
762 } |
9 | 763 } |
764 | |
765 static void view_slideshow_start(ViewWindow *vw) | |
4 | 766 { |
9 | 767 if (!vw->ss) |
768 { | |
769 CollectionData *cd; | |
770 CollectInfo *info; | |
771 | |
772 if (vw->list) | |
773 { | |
138 | 774 vw->ss = slideshow_start_from_filelist(view_window_active_image(vw), |
775 filelist_copy(vw->list), | |
9 | 776 view_slideshow_stop_func, vw); |
777 vw->list_pointer = NULL; | |
778 return; | |
779 } | |
780 | |
781 cd = image_get_collection(view_window_active_image(vw), &info); | |
782 if (cd && info) | |
783 { | |
784 vw->ss = slideshow_start_from_collection(view_window_active_image(vw), cd, | |
785 view_slideshow_stop_func, vw, info); | |
786 } | |
787 } | |
788 } | |
789 | |
790 static void view_slideshow_stop(ViewWindow *vw) | |
791 { | |
792 if (vw->ss) slideshow_free(vw->ss); | |
793 } | |
794 | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
795 static void view_window_destroy_cb(GtkWidget *widget, gpointer data) |
9 | 796 { |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
797 ViewWindow *vw = data; |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
798 |
9 | 799 view_window_list = g_list_remove(view_window_list, vw); |
800 | |
801 view_slideshow_stop(vw); | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
802 fullscreen_stop(vw->fs); |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
803 |
138 | 804 filelist_free(vw->list); |
797 | 805 |
806 file_data_unregister_notify_func(view_window_notify_cb, vw); | |
807 | |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
808 g_free(vw); |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
809 } |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
810 |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
811 static void view_window_close(ViewWindow *vw) |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
812 { |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
813 view_slideshow_stop(vw); |
9 | 814 view_fullscreen_toggle(vw, TRUE); |
815 gtk_widget_destroy(vw->window); | |
4 | 816 } |
817 | |
1 | 818 static gint view_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) |
819 { | |
9 | 820 ViewWindow *vw = data; |
821 | |
822 view_window_close(vw); | |
1 | 823 return TRUE; |
824 } | |
825 | |
138 | 826 static ViewWindow *real_view_window_new(FileData *fd, GList *list, CollectionData *cd, CollectInfo *info) |
1 | 827 { |
9 | 828 ViewWindow *vw; |
1 | 829 GtkAllocation req_size; |
9 | 830 GdkGeometry geometry; |
1 | 831 gint w, h; |
9 | 832 |
138 | 833 if (!fd && !list && (!cd || !info)) return NULL; |
9 | 834 |
835 vw = g_new0(ViewWindow, 1); | |
836 vw->fs = NULL; | |
837 vw->ss = NULL; | |
838 vw->list = NULL; | |
839 vw->list_pointer = NULL; | |
840 | |
289
6a7298988a7a
Simplify and unify gtk_window creation with the help of
zas_
parents:
288
diff
changeset
|
841 vw->window = window_new(GTK_WINDOW_TOPLEVEL, "view", PIXBUF_INLINE_ICON_VIEW, NULL, NULL); |
9 | 842 |
1029
1a4b18c58556
Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents:
1022
diff
changeset
|
843 geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE; |
1a4b18c58556
Use a constant for minimal window size. Set it to 32 for all dialogs.
zas_
parents:
1022
diff
changeset
|
844 geometry.min_height = DEFAULT_MINIMAL_WINDOW_SIZE; |
9 | 845 gtk_window_set_geometry_hints(GTK_WINDOW(vw->window), NULL, &geometry, GDK_HINT_MIN_SIZE); |
1 | 846 |
9 | 847 gtk_window_set_resizable(GTK_WINDOW(vw->window), TRUE); |
442 | 848 gtk_container_set_border_width(GTK_CONTAINER(vw->window), 0); |
9 | 849 |
850 vw->imd = image_new(FALSE); | |
851 | |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
334
diff
changeset
|
852 image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 853 |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
854 image_attach_window(vw->imd, vw->window, NULL, GQ_APPNAME, TRUE); |
9 | 855 |
888 | 856 image_auto_refresh_enable(vw->imd, TRUE); |
9 | 857 image_top_window_set_sync(vw->imd, TRUE); |
858 | |
859 gtk_container_add(GTK_CONTAINER(vw->window), vw->imd->widget); | |
860 gtk_widget_show(vw->imd->widget); | |
861 | |
862 view_window_dnd_init(vw); | |
1 | 863 |
9 | 864 view_image_set_buttons(vw, vw->imd); |
1 | 865 |
89
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
866 g_signal_connect(G_OBJECT(vw->window), "destroy", |
b3149a34d0dd
Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
867 G_CALLBACK(view_window_destroy_cb), vw); |
9 | 868 g_signal_connect(G_OBJECT(vw->window), "delete_event", |
869 G_CALLBACK(view_window_delete_cb), vw); | |
870 g_signal_connect(G_OBJECT(vw->window), "key_press_event", | |
871 G_CALLBACK(view_window_key_press_cb), vw); | |
872 if (cd && info) | |
873 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
874 image_change_from_collection(vw->imd, cd, info, image_zoom_get_default(NULL)); |
334 | 875 if (options->image.enable_read_ahead) |
9 | 876 { |
877 CollectInfo * r_info = collection_next_by_info(cd, info); | |
878 if (!r_info) r_info = collection_prev_by_info(cd, info); | |
138 | 879 if (r_info) image_prebuffer_set(vw->imd, r_info->fd); |
9 | 880 } |
881 } | |
882 else if (list) | |
883 { | |
884 view_window_set_list(vw, list); | |
885 vw->list_pointer = vw->list; | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
886 image_change_fd(vw->imd, (FileData *)vw->list->data, image_zoom_get_default(NULL)); |
1 | 887 |
334 | 888 if (options->image.enable_read_ahead) |
9 | 889 { |
890 GList *work = vw->list->next; | |
138 | 891 if (work) image_prebuffer_set(vw->imd, (FileData *)work->data); |
9 | 892 } |
893 } | |
894 else | |
895 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
896 image_change_fd(vw->imd, fd, image_zoom_get_default(NULL)); |
9 | 897 } |
1 | 898 |
9 | 899 if (image_zoom_get(vw->imd) == 0.0) |
900 { | |
531 | 901 image_get_image_size(vw->imd, &w, &h); |
9 | 902 } |
903 else | |
904 { | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
905 pixbuf_renderer_get_scaled_size(PIXBUF_RENDERER(vw->imd->pr), &w, &h); |
9 | 906 } |
334 | 907 if (options->image.limit_window_size) |
1 | 908 { |
334 | 909 gint mw = gdk_screen_width() * options->image.max_window_size / 100; |
910 gint mh = gdk_screen_height() * options->image.max_window_size / 100; | |
1 | 911 |
912 if (w > mw) w = mw; | |
913 if (h > mh) h = mh; | |
914 } | |
915 | |
9 | 916 gtk_window_set_default_size(GTK_WINDOW(vw->window), w, h); |
1 | 917 req_size.x = req_size.y = 0; |
918 req_size.width = w; | |
919 req_size.height = h; | |
9 | 920 gtk_widget_size_allocate(GTK_WIDGET(vw->window), &req_size); |
921 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
922 gtk_widget_set_size_request(vw->imd->pr, w, h); |
9 | 923 |
924 gtk_widget_show(vw->window); | |
925 | |
926 view_window_list = g_list_append(view_window_list, vw); | |
927 | |
797 | 928 file_data_register_notify_func(view_window_notify_cb, vw, NOTIFY_PRIORITY_LOW); |
929 | |
9 | 930 return vw; |
931 } | |
932 | |
933 static void view_window_collection_unref_cb(GtkWidget *widget, gpointer data) | |
934 { | |
935 CollectionData *cd = data; | |
936 | |
937 collection_unref(cd); | |
938 } | |
939 | |
138 | 940 void view_window_new(FileData *fd) |
9 | 941 { |
780
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
942 GList *list; |
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
943 |
781
2d2cca2bceb0
Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents:
780
diff
changeset
|
944 if (file_extension_match(fd->path, GQ_COLLECTION_EXT)) |
9 | 945 { |
946 ViewWindow *vw; | |
947 CollectionData *cd; | |
948 CollectInfo *info; | |
949 | |
138 | 950 cd = collection_new(fd->path); |
358 | 951 if (collection_load(cd, fd->path, COLLECTION_LOAD_NONE)) |
9 | 952 { |
953 info = collection_get_first(cd); | |
954 } | |
955 else | |
956 { | |
957 collection_unref(cd); | |
958 cd = NULL; | |
959 info = NULL; | |
960 } | |
961 vw = real_view_window_new(NULL, NULL, cd, info); | |
962 if (vw && cd) | |
963 { | |
964 g_signal_connect(G_OBJECT(vw->window), "destroy", | |
965 G_CALLBACK(view_window_collection_unref_cb), cd); | |
966 } | |
967 } | |
783 | 968 else if (isdir(fd->path) && filelist_read(fd, &list, NULL)) |
995 | 969 { |
780
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
970 list = filelist_sort_path(list); |
44128da39e13
Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents:
753
diff
changeset
|
971 list = filelist_filter(list, FALSE); |
9 | 972 real_view_window_new(NULL, list, NULL, NULL); |
138 | 973 filelist_free(list); |
9 | 974 } |
975 else | |
976 { | |
138 | 977 real_view_window_new(fd, NULL, NULL, NULL); |
9 | 978 } |
979 } | |
980 | |
981 void view_window_new_from_list(GList *list) | |
982 { | |
983 real_view_window_new(NULL, list, NULL, NULL); | |
984 } | |
985 | |
986 void view_window_new_from_collection(CollectionData *cd, CollectInfo *info) | |
987 { | |
988 real_view_window_new(NULL, NULL, cd, info); | |
989 } | |
990 | |
991 /* | |
992 *----------------------------------------------------------------------------- | |
993 * public | |
994 *----------------------------------------------------------------------------- | |
995 */ | |
996 | |
997 void view_window_colors_update(void) | |
998 { | |
999 GList *work; | |
1 | 1000 |
9 | 1001 work = view_window_list; |
1002 while (work) | |
1003 { | |
1004 ViewWindow *vw = work->data; | |
1005 work = work->next; | |
1006 | |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
334
diff
changeset
|
1007 image_background_set_color(vw->imd, options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 1008 } |
1009 } | |
1010 | |
1011 gint view_window_find_image(ImageWindow *imd, gint *index, gint *total) | |
1012 { | |
1013 GList *work; | |
1014 | |
1015 work = view_window_list; | |
1016 while (work) | |
1017 { | |
1018 ViewWindow *vw = work->data; | |
1019 work = work->next; | |
1020 | |
1021 if (vw->imd == imd || | |
1022 (vw->fs && vw->fs->imd == imd)) | |
1023 { | |
1024 if (vw->ss) | |
1025 { | |
1026 gint n; | |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1027 gint t; |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1028 |
9 | 1029 n = g_list_length(vw->ss->list_done); |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1030 t = n + g_list_length(vw->ss->list); |
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1031 if (n == 0) n = t; |
9 | 1032 if (index) *index = n - 1; |
118
ac0f7f942c4d
Wed Nov 29 22:53:03 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1033 if (total) *total = t; |
9 | 1034 } |
1035 else | |
1036 { | |
1037 if (index) *index = g_list_position(vw->list, vw->list_pointer); | |
1038 if (total) *total = g_list_length(vw->list); | |
1039 } | |
1040 return TRUE; | |
1041 } | |
1042 } | |
1043 | |
1044 return FALSE; | |
1 | 1045 } |
1046 | |
1047 /* | |
1048 *----------------------------------------------------------------------------- | |
1049 * view window menu routines and callbacks | |
1050 *----------------------------------------------------------------------------- | |
442 | 1051 */ |
1 | 1052 |
9 | 1053 static void view_new_window_cb(GtkWidget *widget, gpointer data) |
1 | 1054 { |
9 | 1055 ViewWindow *vw = data; |
1056 CollectionData *cd; | |
1057 CollectInfo *info; | |
1058 | |
1059 cd = image_get_collection(vw->imd, &info); | |
1060 | |
1061 if (cd && info) | |
1062 { | |
1063 view_window_new_from_collection(cd, info); | |
1064 } | |
1065 else | |
1066 { | |
138 | 1067 view_window_new(image_get_fd(vw->imd)); |
9 | 1068 } |
1 | 1069 } |
1070 | |
9 | 1071 static void view_edit_cb(GtkWidget *widget, gpointer data) |
1 | 1072 { |
9 | 1073 ViewWindow *vw; |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1074 ImageWindow *imd; |
1272 | 1075 const gchar *key = data; |
9 | 1076 |
1077 vw = submenu_item_get_data(widget); | |
1078 if (!vw) return; | |
1079 | |
1272 | 1080 if (!editor_window_flag_set(key)) |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1081 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1082 view_fullscreen_toggle(vw, TRUE); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1083 } |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1084 |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
1085 imd = view_window_active_image(vw); |
1272 | 1086 file_util_start_editor_from_file(key, image_get_fd(imd), imd->widget); |
1 | 1087 } |
1088 | |
9 | 1089 static void view_alter_cb(GtkWidget *widget, gpointer data) |
1090 { | |
1091 ViewWindow *vw; | |
1092 AlterType type; | |
1093 | |
1094 vw = submenu_item_get_data(widget); | |
1095 type = GPOINTER_TO_INT(data); | |
1096 | |
1097 if (!vw) return; | |
1098 image_alter(vw->imd, type); | |
1099 } | |
1100 | |
1101 static void view_wallpaper_cb(GtkWidget *widget, gpointer data) | |
1102 { | |
1103 ViewWindow *vw = data; | |
1104 ImageWindow *imd; | |
1105 | |
1106 imd = view_window_active_image(vw); | |
1107 image_to_root_window(imd, (image_zoom_get(imd) == 0.0)); | |
3 | 1108 } |
1109 | |
1 | 1110 static void view_zoom_in_cb(GtkWidget *widget, gpointer data) |
1111 { | |
9 | 1112 ViewWindow *vw = data; |
1113 | |
1114 image_zoom_adjust(view_window_active_image(vw), get_zoom_increment()); | |
1 | 1115 } |
1116 | |
1117 static void view_zoom_out_cb(GtkWidget *widget, gpointer data) | |
1118 { | |
9 | 1119 ViewWindow *vw = data; |
1120 | |
1121 image_zoom_adjust(view_window_active_image(vw), -get_zoom_increment()); | |
1 | 1122 } |
1123 | |
1124 static void view_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
1125 { | |
9 | 1126 ViewWindow *vw = data; |
1127 | |
1128 image_zoom_set(view_window_active_image(vw), 1.0); | |
1 | 1129 } |
1130 | |
1131 static void view_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
1132 { | |
9 | 1133 ViewWindow *vw = data; |
1134 | |
1135 image_zoom_set(view_window_active_image(vw), 0.0); | |
1 | 1136 } |
1137 | |
1138 static void view_copy_cb(GtkWidget *widget, gpointer data) | |
1139 { | |
9 | 1140 ViewWindow *vw = data; |
1141 ImageWindow *imd; | |
1142 | |
1143 imd = view_window_active_image(vw); | |
138 | 1144 file_util_copy(image_get_fd(imd), NULL, NULL, imd->widget); |
1 | 1145 } |
1146 | |
1147 static void view_move_cb(GtkWidget *widget, gpointer data) | |
1148 { | |
9 | 1149 ViewWindow *vw = data; |
1150 ImageWindow *imd; | |
1151 | |
1152 imd = view_window_active_image(vw); | |
138 | 1153 file_util_move(image_get_fd(imd), NULL, NULL, imd->widget); |
1 | 1154 } |
1155 | |
1156 static void view_rename_cb(GtkWidget *widget, gpointer data) | |
1157 { | |
9 | 1158 ViewWindow *vw = data; |
1159 ImageWindow *imd; | |
1160 | |
1161 imd = view_window_active_image(vw); | |
138 | 1162 file_util_rename(image_get_fd(imd), NULL, imd->widget); |
1 | 1163 } |
1164 | |
1165 static void view_delete_cb(GtkWidget *widget, gpointer data) | |
1166 { | |
9 | 1167 ViewWindow *vw = data; |
1168 ImageWindow *imd; | |
1169 | |
1170 imd = view_window_active_image(vw); | |
138 | 1171 file_util_delete(image_get_fd(imd), NULL, imd->widget); |
9 | 1172 } |
1173 | |
497 | 1174 static void view_copy_path_cb(GtkWidget *widget, gpointer data) |
1175 { | |
1176 ViewWindow *vw = data; | |
1177 ImageWindow *imd; | |
1178 | |
1179 imd = view_window_active_image(vw); | |
1180 file_util_copy_path_to_clipboard(image_get_fd(imd)); | |
1181 } | |
1182 | |
9 | 1183 static void view_fullscreen_cb(GtkWidget *widget, gpointer data) |
1184 { | |
1185 ViewWindow *vw = data; | |
1186 | |
1187 view_fullscreen_toggle(vw, FALSE); | |
1188 } | |
1189 | |
1190 static void view_slideshow_start_cb(GtkWidget *widget, gpointer data) | |
1191 { | |
1192 ViewWindow *vw = data; | |
1193 | |
1194 view_slideshow_start(vw); | |
1195 } | |
1196 | |
1197 static void view_slideshow_stop_cb(GtkWidget *widget, gpointer data) | |
1198 { | |
1199 ViewWindow *vw = data; | |
1200 | |
1201 view_slideshow_stop(vw); | |
1202 } | |
1203 | |
1204 static void view_slideshow_pause_cb(GtkWidget *widget, gpointer data) | |
1205 { | |
1206 ViewWindow *vw = data; | |
1207 | |
1208 slideshow_pause_toggle(vw->ss); | |
1 | 1209 } |
1210 | |
1211 static void view_close_cb(GtkWidget *widget, gpointer data) | |
1212 { | |
9 | 1213 ViewWindow *vw = data; |
1214 | |
1215 view_window_close(vw); | |
1216 } | |
1217 | |
783 | 1218 static LayoutWindow *view_new_layout_with_fd(FileData *fd) |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1219 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1220 LayoutWindow *nw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1221 |
1309 | 1222 nw = layout_new(NULL, NULL); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1223 layout_sort_set(nw, options->file_sort.method, options->file_sort.ascending); |
783 | 1224 layout_set_fd(nw, fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1225 return nw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1226 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1227 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1228 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1229 static void view_set_layout_path_cb(GtkWidget *widget, gpointer data) |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1230 { |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1231 ViewWindow *vw = data; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1232 LayoutWindow *lw; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1233 ImageWindow *imd; |
442 | 1234 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1235 imd = view_window_active_image(vw); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1236 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1237 if (!imd || !imd->image_fd) return; |
442 | 1238 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1239 lw = layout_find_by_image_fd(imd); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1240 if (lw) |
783 | 1241 layout_set_fd(lw, imd->image_fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1242 else |
783 | 1243 view_new_layout_with_fd(imd->image_fd); |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1244 view_window_close(vw); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1245 } |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1246 |
9 | 1247 static GtkWidget *view_popup_menu(ViewWindow *vw) |
1248 { | |
1249 GtkWidget *menu; | |
1250 GtkWidget *item; | |
1251 | |
1252 menu = popup_menu_short_lived(); | |
1253 | |
1254 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(view_zoom_in_cb), vw); | |
1255 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(view_zoom_out_cb), vw); | |
1256 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(view_zoom_1_1_cb), vw); | |
1257 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(view_zoom_fit_cb), vw); | |
1258 menu_item_add_divider(menu); | |
1259 | |
1260 item = submenu_add_edit(menu, NULL, G_CALLBACK(view_edit_cb), vw); | |
1261 menu_item_add_divider(item); | |
1262 menu_item_add(item, _("Set as _wallpaper"), G_CALLBACK(view_wallpaper_cb), vw); | |
1263 | |
1264 submenu_add_alter(menu, G_CALLBACK(view_alter_cb), vw); | |
1265 | |
1266 menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(view_new_window_cb), vw); | |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
358
diff
changeset
|
1267 item = menu_item_add(menu, _("_Go to directory view"), G_CALLBACK(view_set_layout_path_cb), vw); |
9 | 1268 |
1269 menu_item_add_divider(menu); | |
1270 menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(view_copy_cb), vw); | |
1271 menu_item_add(menu, _("_Move..."), G_CALLBACK(view_move_cb), vw); | |
1272 menu_item_add(menu, _("_Rename..."), G_CALLBACK(view_rename_cb), vw); | |
1273 menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(view_delete_cb), vw); | |
497 | 1274 if (options->show_copy_path) |
1275 menu_item_add(menu, _("_Copy path"), G_CALLBACK(view_copy_path_cb), vw); | |
9 | 1276 |
1277 menu_item_add_divider(menu); | |
1278 | |
1279 if (vw->ss) | |
1280 { | |
1281 menu_item_add(menu, _("_Stop slideshow"), G_CALLBACK(view_slideshow_stop_cb), vw); | |
1282 if (slideshow_paused(vw->ss)) | |
1283 { | |
1284 item = menu_item_add(menu, _("Continue slides_how"), | |
1285 G_CALLBACK(view_slideshow_pause_cb), vw); | |
1286 } | |
1287 else | |
1288 { | |
1289 item = menu_item_add(menu, _("Pause slides_how"), | |
1290 G_CALLBACK(view_slideshow_pause_cb), vw); | |
1291 } | |
1292 } | |
1293 else | |
1294 { | |
1295 item = menu_item_add(menu, _("_Start slideshow"), G_CALLBACK(view_slideshow_start_cb), vw); | |
1296 gtk_widget_set_sensitive(item, (vw->list != NULL) || view_window_contains_collection(vw)); | |
1297 item = menu_item_add(menu, _("Pause slides_how"), G_CALLBACK(view_slideshow_pause_cb), vw); | |
1298 gtk_widget_set_sensitive(item, FALSE); | |
1299 } | |
1300 | |
1301 if (vw->fs) | |
1302 { | |
1303 menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(view_fullscreen_cb), vw); | |
1304 } | |
1305 else | |
1306 { | |
1307 menu_item_add(menu, _("_Full screen"), G_CALLBACK(view_fullscreen_cb), vw); | |
1308 } | |
1309 | |
1310 menu_item_add_divider(menu); | |
1311 menu_item_add_stock(menu, _("C_lose window"), GTK_STOCK_CLOSE, G_CALLBACK(view_close_cb), vw); | |
1312 | |
1313 return menu; | |
1314 } | |
1315 | |
1316 /* | |
1317 *------------------------------------------------------------------- | |
1318 * dnd confirm dir | |
1319 *------------------------------------------------------------------- | |
1320 */ | |
1321 | |
1322 typedef struct { | |
1323 ViewWindow *vw; | |
1324 GList *list; | |
1325 } CViewConfirmD; | |
1326 | |
1327 static void view_dir_list_cancel(GtkWidget *widget, gpointer data) | |
1328 { | |
1329 /* do nothing */ | |
1330 } | |
1331 | |
1332 static void view_dir_list_do(ViewWindow *vw, GList *list, gint skip, gint recurse) | |
1333 { | |
1334 GList *work; | |
1335 | |
1336 view_window_set_list(vw, NULL); | |
1337 | |
1338 work = list; | |
1339 while (work) | |
1340 { | |
138 | 1341 FileData *fd = work->data; |
9 | 1342 work = work->next; |
1343 | |
138 | 1344 if (isdir(fd->path)) |
9 | 1345 { |
1346 if (!skip) | |
1347 { | |
1348 GList *list = NULL; | |
1349 | |
1350 if (recurse) | |
1351 { | |
783 | 1352 list = filelist_recursive(fd); |
9 | 1353 } |
1354 else | |
138 | 1355 { /*FIXME */ |
783 | 1356 filelist_read(fd, &list, NULL); |
138 | 1357 list = filelist_sort_path(list); |
1358 list = filelist_filter(list, FALSE); | |
9 | 1359 } |
1360 if (list) vw->list = g_list_concat(vw->list, list); | |
1361 } | |
1362 } | |
1363 else | |
1364 { | |
1365 /* FIXME: no filtering here */ | |
138 | 1366 vw->list = g_list_append(vw->list, file_data_ref(fd)); |
9 | 1367 } |
1368 } | |
1369 | |
1370 if (vw->list) | |
1371 { | |
138 | 1372 FileData *fd; |
9 | 1373 |
1374 vw->list_pointer = vw->list; | |
138 | 1375 fd = vw->list->data; |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1376 image_change_fd(vw->imd, fd, image_zoom_get_default(vw->imd)); |
9 | 1377 |
1378 work = vw->list->next; | |
334 | 1379 if (options->image.enable_read_ahead && work) |
9 | 1380 { |
138 | 1381 fd = work->data; |
1382 image_prebuffer_set(vw->imd, fd); | |
9 | 1383 } |
1384 } | |
1385 else | |
1386 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1387 image_change_fd(vw->imd, NULL, image_zoom_get_default(vw->imd)); |
9 | 1388 } |
1389 } | |
1390 | |
1391 static void view_dir_list_add(GtkWidget *widget, gpointer data) | |
1392 { | |
1393 CViewConfirmD *d = data; | |
1394 view_dir_list_do(d->vw, d->list, FALSE, FALSE); | |
1395 } | |
1396 | |
1397 static void view_dir_list_recurse(GtkWidget *widget, gpointer data) | |
1398 { | |
1399 CViewConfirmD *d = data; | |
1400 view_dir_list_do(d->vw, d->list, FALSE, TRUE); | |
1401 } | |
1402 | |
1403 static void view_dir_list_skip(GtkWidget *widget, gpointer data) | |
1404 { | |
1405 CViewConfirmD *d = data; | |
1406 view_dir_list_do(d->vw, d->list, TRUE, FALSE); | |
1407 } | |
1408 | |
1409 static void view_dir_list_destroy(GtkWidget *widget, gpointer data) | |
1410 { | |
1411 CViewConfirmD *d = data; | |
442 | 1412 filelist_free(d->list); |
1413 g_free(d); | |
9 | 1414 } |
1415 | |
1416 static GtkWidget *view_confirm_dir_list(ViewWindow *vw, GList *list) | |
1417 { | |
1418 GtkWidget *menu; | |
1419 CViewConfirmD *d; | |
1420 | |
1421 d = g_new(CViewConfirmD, 1); | |
1422 d->vw = vw; | |
1423 d->list = list; | |
1424 | |
1425 menu = popup_menu_short_lived(); | |
1426 g_signal_connect(G_OBJECT(menu), "destroy", | |
1427 G_CALLBACK(view_dir_list_destroy), d); | |
1428 | |
1429 menu_item_add_stock(menu, _("Dropped list includes folders."), GTK_STOCK_DND_MULTIPLE, NULL, NULL); | |
1430 menu_item_add_divider(menu); | |
1431 menu_item_add_stock(menu, _("_Add contents"), GTK_STOCK_OK, G_CALLBACK(view_dir_list_add), d); | |
1432 menu_item_add_stock(menu, _("Add contents _recursive"), GTK_STOCK_ADD, G_CALLBACK(view_dir_list_recurse), d); | |
1433 menu_item_add_stock(menu, _("_Skip folders"), GTK_STOCK_REMOVE, G_CALLBACK(view_dir_list_skip), d); | |
1434 menu_item_add_divider(menu); | |
1435 menu_item_add_stock(menu, _("Cancel"), GTK_STOCK_CANCEL, G_CALLBACK(view_dir_list_cancel), d); | |
1436 | |
1437 return menu; | |
1 | 1438 } |
1439 | |
9 | 1440 /* |
1441 *----------------------------------------------------------------------------- | |
1442 * image drag and drop routines | |
1443 *----------------------------------------------------------------------------- | |
1444 */ | |
1445 | |
1446 static void view_window_get_dnd_data(GtkWidget *widget, GdkDragContext *context, | |
1447 gint x, gint y, | |
1448 GtkSelectionData *selection_data, guint info, | |
1449 guint time, gpointer data) | |
1 | 1450 { |
9 | 1451 ViewWindow *vw = data; |
1452 ImageWindow *imd; | |
1453 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1454 if (gtk_drag_get_source_widget(context) == vw->imd->pr) return; |
9 | 1455 |
1456 imd = vw->imd; | |
1457 | |
1458 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) | |
1459 { | |
1460 CollectionData *source; | |
1461 GList *list; | |
1462 GList *info_list; | |
1463 | |
1464 if (info == TARGET_URI_LIST) | |
1465 { | |
1466 GList *work; | |
1467 | |
138 | 1468 list = uri_filelist_from_text((gchar *)selection_data->data, TRUE); |
9 | 1469 |
1470 work = list; | |
1471 while (work) | |
1472 { | |
138 | 1473 FileData *fd = work->data; |
1474 if (isdir(fd->path)) | |
9 | 1475 { |
1476 GtkWidget *menu; | |
1477 menu = view_confirm_dir_list(vw, list); | |
1478 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, time); | |
1479 return; | |
1480 } | |
1481 work = work->next; | |
1482 } | |
1483 | |
138 | 1484 list = filelist_filter(list, FALSE); |
9 | 1485 |
1486 source = NULL; | |
1487 info_list = NULL; | |
1488 } | |
1489 else | |
1490 { | |
1491 source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list); | |
1492 } | |
1493 | |
1494 if (list) | |
1495 { | |
138 | 1496 FileData *fd; |
9 | 1497 |
138 | 1498 fd = list->data; |
1499 if (isfile(fd->path)) | |
9 | 1500 { |
1501 view_slideshow_stop(vw); | |
1502 view_window_set_list(vw, NULL); | |
1 | 1503 |
9 | 1504 if (source && info_list) |
1505 { | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1506 image_change_from_collection(imd, source, info_list->data, image_zoom_get_default(imd)); |
9 | 1507 } |
1508 else | |
1509 { | |
1510 if (list->next) | |
1511 { | |
1512 vw->list = list; | |
1513 list = NULL; | |
1514 | |
1515 vw->list_pointer = vw->list; | |
1516 } | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1517 image_change_fd(imd, fd, image_zoom_get_default(imd)); |
9 | 1518 } |
1519 } | |
1520 } | |
138 | 1521 filelist_free(list); |
9 | 1522 g_list_free(info_list); |
1523 } | |
1524 } | |
1525 | |
1526 static void view_window_set_dnd_data(GtkWidget *widget, GdkDragContext *context, | |
1527 GtkSelectionData *selection_data, guint info, | |
1528 guint time, gpointer data) | |
1529 { | |
1530 ViewWindow *vw = data; | |
138 | 1531 FileData *fd; |
9 | 1532 |
138 | 1533 fd = image_get_fd(vw->imd); |
1 | 1534 |
138 | 1535 if (fd) |
9 | 1536 { |
1537 gchar *text = NULL; | |
1538 gint len; | |
1539 gint plain_text; | |
1540 GList *list; | |
1 | 1541 |
9 | 1542 switch (info) |
1543 { | |
1544 case TARGET_URI_LIST: | |
1545 plain_text = FALSE; | |
1546 break; | |
1547 case TARGET_TEXT_PLAIN: | |
1548 default: | |
1549 plain_text = TRUE; | |
1550 break; | |
1551 } | |
138 | 1552 list = g_list_append(NULL, fd); |
1553 text = uri_text_from_filelist(list, &len, plain_text); | |
9 | 1554 g_list_free(list); |
1555 if (text) | |
1556 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1557 gtk_selection_data_set(selection_data, selection_data->target, |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1558 8, (guchar *)text, len); |
9 | 1559 g_free(text); |
1560 } | |
1561 } | |
1562 else | |
1563 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1564 gtk_selection_data_set(selection_data, selection_data->target, |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
497
diff
changeset
|
1565 8, NULL, 0); |
9 | 1566 } |
1 | 1567 } |
1568 | |
9 | 1569 static void view_window_dnd_init(ViewWindow *vw) |
1570 { | |
1571 ImageWindow *imd; | |
1 | 1572 |
9 | 1573 imd = vw->imd; |
1574 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1575 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, |
9 | 1576 dnd_file_drag_types, dnd_file_drag_types_count, |
1577 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1578 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
9 | 1579 G_CALLBACK(view_window_set_dnd_data), vw); |
1580 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1581 gtk_drag_dest_set(imd->pr, |
9 | 1582 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
1583 dnd_file_drop_types, dnd_file_drop_types_count, | |
442 | 1584 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
1585 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
9 | 1586 G_CALLBACK(view_window_get_dnd_data), vw); |
1587 } | |
1588 | |
1589 /* | |
1590 *----------------------------------------------------------------------------- | |
1591 * maintenance (for rename, move, remove) | |
1592 *----------------------------------------------------------------------------- | |
1593 */ | |
1594 | |
797 | 1595 static void view_real_removed(ViewWindow *vw, FileData *fd) |
9 | 1596 { |
1597 ImageWindow *imd; | |
138 | 1598 FileData *image_fd; |
9 | 1599 |
1600 imd = view_window_active_image(vw); | |
138 | 1601 image_fd = image_get_fd(imd); |
9 | 1602 |
138 | 1603 if (image_fd && image_fd == fd) |
9 | 1604 { |
1605 if (vw->list) | |
1606 { | |
1607 view_list_step(vw, TRUE); | |
138 | 1608 if (image_get_fd(imd) == image_fd) |
9 | 1609 { |
1610 view_list_step(vw, FALSE); | |
1611 } | |
1612 } | |
1613 else if (view_window_contains_collection(vw)) | |
1614 { | |
1615 view_collection_step(vw, TRUE); | |
138 | 1616 if (image_get_fd(imd) == image_fd) |
9 | 1617 { |
1618 view_collection_step(vw, FALSE); | |
1619 } | |
1620 } | |
138 | 1621 if (image_get_fd(imd) == image_fd) |
9 | 1622 { |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1623 image_change_fd(imd, NULL, image_zoom_get_default(imd)); |
9 | 1624 } |
1625 } | |
1626 | |
1627 if (vw->list) | |
1628 { | |
1629 GList *work; | |
1630 GList *old; | |
1631 | |
1632 old = vw->list_pointer; | |
1633 | |
1634 work = vw->list; | |
1635 while (work) | |
1636 { | |
138 | 1637 FileData *chk_fd; |
9 | 1638 GList *chk_link; |
1639 | |
138 | 1640 chk_fd = work->data; |
9 | 1641 chk_link = work; |
1642 work = work->next; | |
1643 | |
138 | 1644 if (chk_fd == fd) |
9 | 1645 { |
1646 if (vw->list_pointer == chk_link) | |
1647 { | |
1648 vw->list_pointer = (chk_link->next) ? chk_link->next : chk_link->prev; | |
1649 } | |
138 | 1650 vw->list = g_list_remove(vw->list, chk_fd); |
1651 file_data_unref(chk_fd); | |
9 | 1652 } |
1653 } | |
1654 | |
1655 /* handles stepping correctly when same image is in the list more than once */ | |
1656 if (old && old != vw->list_pointer) | |
1657 { | |
138 | 1658 FileData *fd; |
9 | 1659 |
1660 if (vw->list_pointer) | |
1661 { | |
138 | 1662 fd = vw->list_pointer->data; |
9 | 1663 } |
1664 else | |
1665 { | |
138 | 1666 fd = NULL; |
9 | 1667 } |
1668 | |
885
ad420f2eb789
Use a specific enum for image.zoom_mode values (ZoomMode) and
zas_
parents:
868
diff
changeset
|
1669 image_change_fd(imd, fd, image_zoom_get_default(imd)); |
9 | 1670 } |
1671 } | |
1672 | |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
94
diff
changeset
|
1673 image_osd_update(imd); |
9 | 1674 } |
1675 | |
797 | 1676 static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data) |
9 | 1677 { |
797 | 1678 ViewWindow *vw = data; |
9 | 1679 |
803 | 1680 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return; |
797 | 1681 |
1682 switch(fd->change->type) | |
9 | 1683 { |
797 | 1684 case FILEDATA_CHANGE_MOVE: |
1685 case FILEDATA_CHANGE_RENAME: | |
1686 break; | |
1687 case FILEDATA_CHANGE_COPY: | |
1688 break; | |
1689 case FILEDATA_CHANGE_DELETE: | |
1690 view_real_removed(vw, fd); | |
1691 break; | |
1692 case FILEDATA_CHANGE_UNSPECIFIED: | |
1211 | 1693 case FILEDATA_CHANGE_WRITE_METADATA: |
797 | 1694 break; |
9 | 1695 } |
1696 } | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1029
diff
changeset
|
1697 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |