annotate src/img-view.c @ 86:cade6a52a165

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