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