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