Mercurial > geeqie.yaz
annotate src/layout_image.c @ 334:df868b947aa0
Rename image-related options.
author | zas_ |
---|---|
date | Sat, 12 Apr 2008 15:04:58 +0000 |
parents | 049d6b00cc14 |
children | de1c2cd06fce |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
3 * (C) 2006 John Ellis |
9 | 4 * |
5 * Author: John Ellis | |
6 * | |
7 * This software is released under the GNU General Public License (GNU GPL). | |
8 * Please read the included file COPYING for more information. | |
9 * This software comes with no warranty of any kind, use at your own risk! | |
10 */ | |
11 | |
281 | 12 #include "main.h" |
9 | 13 #include "layout_image.h" |
14 | |
15 #include "collect.h" | |
16 #include "dnd.h" | |
17 #include "editors.h" | |
18 #include "filelist.h" | |
19 #include "fullscreen.h" | |
20 #include "image.h" | |
21 #include "image-overlay.h" | |
22 #include "img-view.h" | |
23 #include "info.h" | |
24 #include "layout.h" | |
25 #include "layout_util.h" | |
26 #include "menu.h" | |
27 #include "pixbuf_util.h" | |
28 #include "utilops.h" | |
29 #include "slideshow.h" | |
30 #include "ui_bookmark.h" | |
31 #include "ui_fileops.h" | |
32 #include "ui_menu.h" | |
33 | |
34 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | |
35 | |
36 | |
37 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw); | |
38 static void layout_image_set_buttons(LayoutWindow *lw); | |
39 | |
40 /* | |
41 *---------------------------------------------------------------------------- | |
42 * full screen overlay | |
43 *---------------------------------------------------------------------------- | |
44 */ | |
45 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
46 void layout_image_overlay_toggle(LayoutWindow *lw) |
9 | 47 { |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
48 if (image_osd_get(lw->image, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
49 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
50 image_osd_set(lw->image, FALSE, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
51 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
52 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
53 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
54 image_osd_set(lw->image, (lw->full_screen != NULL), TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
55 image_osd_icon(lw->image, IMAGE_OSD_ICON, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
56 } |
9 | 57 } |
58 | |
59 void layout_image_overlay_update(LayoutWindow *lw) | |
60 { | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
61 if (!lw) return; |
117
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
62 |
0c2e1f0a001b
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
63 image_osd_update(lw->image); |
9 | 64 } |
65 | |
66 /* | |
67 *---------------------------------------------------------------------------- | |
68 * full screen | |
69 *---------------------------------------------------------------------------- | |
70 */ | |
246
bee34a6a4aec
Drop 3 unused variables and comment out 2 unused functions.
zas_
parents:
220
diff
changeset
|
71 #if 0 |
9 | 72 static void layout_image_fullscreen_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) |
73 { | |
74 LayoutWindow *lw = data; | |
75 | |
76 if (!lw->full_screen) return; | |
77 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
78 gdk_window_get_origin(lw->full_screen->imd->pr->window, x, y); |
9 | 79 popup_menu_position_clamp(menu, x, y, 0); |
80 } | |
81 | |
82 static void layout_image_full_screen_menu_popup(LayoutWindow *lw) | |
83 { | |
84 GtkWidget *menu; | |
85 | |
86 menu = layout_image_pop_menu(lw); | |
87 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, layout_image_fullscreen_menu_pos_cb, lw, 0, GDK_CURRENT_TIME); | |
88 } | |
89 | |
160 | 90 /* this is handled by layout_key_press_cb */ |
91 | |
92 | |
9 | 93 static gint layout_image_full_screen_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) |
94 { | |
95 LayoutWindow *lw = data; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
96 gint stop_signal; |
9 | 97 gint x = 0; |
98 gint y = 0; | |
99 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
100 stop_signal = TRUE; |
9 | 101 switch (event->keyval) |
102 { | |
103 case GDK_Left: case GDK_KP_Left: | |
104 x -= 1; | |
105 break; | |
106 case GDK_Right: case GDK_KP_Right: | |
107 x += 1; | |
108 break; | |
109 case GDK_Up: case GDK_KP_Up: | |
110 y -= 1; | |
111 break; | |
112 case GDK_Down: case GDK_KP_Down: | |
113 y += 1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
114 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
115 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
116 stop_signal = FALSE; |
9 | 117 break; |
118 } | |
119 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
120 if (x != 0 || y!= 0) |
9 | 121 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
122 if (event->state & GDK_SHIFT_MASK) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
123 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
124 x *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
125 y *= 3; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
126 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
127 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
128 keyboard_scroll_calc(&x, &y, event); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
129 layout_image_scroll(lw, x, y); |
9 | 130 } |
131 | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
132 if (stop_signal) return stop_signal; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
133 |
9 | 134 if (event->state & GDK_CONTROL_MASK) |
135 { | |
136 gint n = -1; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
137 |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
138 stop_signal = TRUE; |
9 | 139 switch (event->keyval) |
140 { | |
141 case '1': | |
142 n = 0; | |
143 break; | |
144 case '2': | |
145 n = 1; | |
146 break; | |
147 case '3': | |
148 n = 2; | |
149 break; | |
150 case '4': | |
151 n = 3; | |
152 break; | |
153 case '5': | |
154 n = 4; | |
155 break; | |
156 case '6': | |
157 n = 5; | |
158 break; | |
159 case '7': | |
160 n = 6; | |
161 break; | |
162 case '8': | |
163 n = 7; | |
164 break; | |
165 case '9': | |
166 n = 8; | |
167 break; | |
168 case '0': | |
169 n = 9; | |
170 break; | |
171 case 'C': case 'c': | |
138 | 172 file_util_copy(layout_image_get_fd(lw), NULL, NULL, widget); |
9 | 173 break; |
174 case 'M': case 'm': | |
138 | 175 file_util_move(layout_image_get_fd(lw), NULL, NULL, widget); |
9 | 176 break; |
177 case 'R': case 'r': | |
138 | 178 file_util_rename(layout_image_get_fd(lw), NULL, widget); |
9 | 179 break; |
180 case 'D': case 'd': | |
138 | 181 file_util_delete(layout_image_get_fd(lw), NULL, widget); |
9 | 182 break; |
183 case 'P': case 'p': | |
138 | 184 info_window_new(layout_image_get_fd(lw), NULL); |
9 | 185 break; |
186 case 'Q': case 'q': | |
278 | 187 exit_program(); |
9 | 188 return FALSE; |
189 break; | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
190 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
191 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
192 break; |
9 | 193 } |
194 if (n != -1) | |
195 { | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
196 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
197 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
198 layout_image_full_screen_stop(lw); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
199 } |
138 | 200 start_editor_from_file(n, layout_image_get_fd(lw)); |
9 | 201 } |
202 } | |
203 else if (event->state & GDK_SHIFT_MASK) | |
204 { | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
205 stop_signal = TRUE; |
9 | 206 switch (event->keyval) |
207 { | |
208 case 'R': case 'r': | |
209 layout_image_alter(lw, ALTER_ROTATE_180); | |
210 break; | |
211 case 'M': case 'm': | |
212 layout_image_alter(lw, ALTER_MIRROR); | |
213 break; | |
214 case 'F': case 'f': | |
215 layout_image_alter(lw, ALTER_FLIP); | |
216 break; | |
82
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
217 case 'G': case 'g': |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
218 layout_image_alter(lw, ALTER_DESATURATE); |
a4c1b7014e6e
Thu Oct 19 15:20:51 2006 John Ellis <johne@verizon.net>
gqview
parents:
64
diff
changeset
|
219 break; |
9 | 220 default: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
221 stop_signal = FALSE; |
9 | 222 break; |
223 } | |
224 } | |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
225 else |
9 | 226 { |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
227 stop_signal = TRUE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
228 switch (event->keyval) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
229 { |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
230 case '+': case '=': case GDK_KP_Add: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
231 layout_image_zoom_adjust(lw, get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
232 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
233 case '-': case GDK_KP_Subtract: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
234 layout_image_zoom_adjust(lw, -get_zoom_increment()); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
235 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
236 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
|
237 layout_image_zoom_set(lw, 0.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
238 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
239 case 'Z': case 'z': case GDK_KP_Divide: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
240 case '1': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
241 layout_image_zoom_set(lw, 1.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
242 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
243 case '2': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
244 layout_image_zoom_set(lw, 2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
245 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
246 case '3': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
247 layout_image_zoom_set(lw, 3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
248 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
249 case '4': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
250 layout_image_zoom_set(lw, 4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
251 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
252 case '7': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
253 layout_image_zoom_set(lw, -4.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
254 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
255 case '8': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
256 layout_image_zoom_set(lw, -3.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
257 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
258 case '9': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
259 layout_image_zoom_set(lw, -2.0); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
260 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
261 case 'W': case 'w': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
262 layout_image_zoom_set_fill_geometry(lw, FALSE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
263 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
264 case 'H': case 'h': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
265 layout_image_zoom_set_fill_geometry(lw, TRUE); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
266 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
267 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
|
268 case GDK_BackSpace: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
269 case 'B': case 'b': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
270 layout_image_prev(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
271 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
272 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
|
273 case GDK_space: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
274 case 'N': case 'n': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
275 layout_image_next(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
276 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
277 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
|
278 layout_image_first(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
279 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
280 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
|
281 layout_image_last(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
282 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
283 case ']': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
284 layout_image_alter(lw, ALTER_ROTATE_90); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
285 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
286 case '[': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
287 layout_image_alter(lw, ALTER_ROTATE_90_CC); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
288 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
289 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
|
290 if (enable_delete_key) |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
291 { |
138 | 292 file_util_delete(layout_image_get_fd(lw), NULL, widget); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
293 } |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
294 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
295 case GDK_Escape: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
296 layout_image_full_screen_stop(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
297 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
298 case 'R': case 'r': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
299 layout_refresh(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
300 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
301 case 'S': case 's': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
302 layout_image_slideshow_toggle(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
303 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
304 case 'P': case 'p': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
305 layout_image_slideshow_pause_toggle(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
306 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
307 case 'F': case 'f': |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
308 case 'V': case 'v': |
86
cade6a52a165
Mon Oct 23 05:34:29 2006 John Ellis <johne@verizon.net>
gqview
parents:
84
diff
changeset
|
309 case GDK_F11: |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
310 layout_image_full_screen_stop(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
311 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
312 case GDK_Menu: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
313 case GDK_F10: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
314 layout_image_full_screen_menu_popup(lw); |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
315 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
316 case 'I': case 'i': |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
317 layout_image_overlay_toggle(lw); |
84
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
318 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
319 default: |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
320 stop_signal = FALSE; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
321 break; |
ba3c39002a24
Fri Oct 20 08:00:08 2006 John Ellis <johne@verizon.net>
gqview
parents:
82
diff
changeset
|
322 } |
9 | 323 } |
324 | |
325 return stop_signal; | |
326 } | |
327 | |
160 | 328 #endif |
329 | |
9 | 330 static void layout_image_full_screen_stop_func(FullScreenData *fs, gpointer data) |
331 { | |
332 LayoutWindow *lw = data; | |
333 | |
334 /* restore image window */ | |
335 lw->image = fs->normal_imd; | |
336 | |
337 if (lw->slideshow) | |
338 { | |
339 lw->slideshow->imd = lw->image; | |
340 } | |
341 | |
342 lw->full_screen = NULL; | |
343 } | |
344 | |
345 void layout_image_full_screen_start(LayoutWindow *lw) | |
346 { | |
347 if (!layout_valid(&lw)) return; | |
348 | |
349 if (lw->full_screen) return; | |
350 | |
351 lw->full_screen = fullscreen_start(lw->window, lw->image, | |
352 layout_image_full_screen_stop_func, lw); | |
353 | |
354 /* set to new image window */ | |
355 lw->image = lw->full_screen->imd; | |
356 | |
357 if (lw->slideshow) | |
358 { | |
359 lw->slideshow->imd = lw->image; | |
360 } | |
361 | |
362 layout_image_set_buttons(lw); | |
363 | |
364 g_signal_connect(G_OBJECT(lw->full_screen->window), "key_press_event", | |
160 | 365 G_CALLBACK(layout_key_press_cb), lw); |
9 | 366 |
160 | 367 layout_actions_add_window(lw, lw->full_screen->window); |
9 | 368 #if 0 |
369 gtk_widget_set_sensitive(lw->window, FALSE); | |
370 if (lw->tools) gtk_widget_set_sensitive(lw->tools, FALSE); | |
371 #endif | |
372 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
373 if (image_osd_get(lw->full_screen->normal_imd, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
374 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
375 image_osd_set(lw->image, TRUE, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
376 image_osd_set(lw->full_screen->normal_imd, FALSE, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
377 } |
9 | 378 } |
379 | |
380 void layout_image_full_screen_stop(LayoutWindow *lw) | |
381 { | |
382 if (!layout_valid(&lw)) return; | |
383 if (!lw->full_screen) return; | |
384 | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
385 if (image_osd_get(lw->image, NULL, NULL)) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
386 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
387 image_osd_set(lw->full_screen->normal_imd, FALSE, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
388 } |
9 | 389 fullscreen_stop(lw->full_screen); |
390 | |
391 #if 0 | |
392 gtk_widget_set_sensitive(lw->window, TRUE); | |
393 if (lw->tools) gtk_widget_set_sensitive(lw->tools, TRUE); | |
394 #endif | |
395 } | |
396 | |
397 void layout_image_full_screen_toggle(LayoutWindow *lw) | |
398 { | |
399 if (!layout_valid(&lw)) return; | |
400 if (lw->full_screen) | |
401 { | |
402 layout_image_full_screen_stop(lw); | |
403 } | |
404 else | |
405 { | |
406 layout_image_full_screen_start(lw); | |
407 } | |
408 } | |
409 | |
410 gint layout_image_full_screen_active(LayoutWindow *lw) | |
411 { | |
412 if (!layout_valid(&lw)) return FALSE; | |
413 | |
414 return (lw->full_screen != NULL); | |
415 } | |
416 | |
417 /* | |
418 *---------------------------------------------------------------------------- | |
419 * slideshow | |
420 *---------------------------------------------------------------------------- | |
421 */ | |
422 | |
423 static void layout_image_slideshow_next(LayoutWindow *lw) | |
424 { | |
425 if (lw->slideshow) slideshow_next(lw->slideshow); | |
426 } | |
427 | |
428 static void layout_image_slideshow_prev(LayoutWindow *lw) | |
429 { | |
430 if (lw->slideshow) slideshow_prev(lw->slideshow); | |
431 } | |
432 | |
433 static void layout_image_slideshow_stop_func(SlideShowData *ss, gpointer data) | |
434 { | |
435 LayoutWindow *lw = data; | |
436 | |
437 lw->slideshow = NULL; | |
438 layout_status_update_info(lw, NULL); | |
439 } | |
440 | |
441 void layout_image_slideshow_start(LayoutWindow *lw) | |
442 { | |
443 CollectionData *cd; | |
444 CollectInfo *info; | |
445 | |
446 if (!layout_valid(&lw)) return; | |
447 if (lw->slideshow) return; | |
448 | |
449 cd = image_get_collection(lw->image, &info); | |
450 | |
451 if (cd && info) | |
452 { | |
453 lw->slideshow = slideshow_start_from_collection(lw->image, cd, | |
454 layout_image_slideshow_stop_func, lw, info); | |
455 } | |
456 else | |
457 { | |
458 lw->slideshow = slideshow_start(lw->image, lw, | |
459 layout_list_get_index(lw, layout_image_get_path(lw)), | |
460 layout_image_slideshow_stop_func, lw); | |
461 } | |
462 | |
463 layout_status_update_info(lw, NULL); | |
464 } | |
465 | |
466 /* note that slideshow will take ownership of the list, do not free it */ | |
467 void layout_image_slideshow_start_from_list(LayoutWindow *lw, GList *list) | |
468 { | |
469 if (!layout_valid(&lw)) return; | |
470 | |
471 if (lw->slideshow || !list) | |
472 { | |
138 | 473 filelist_free(list); |
9 | 474 return; |
475 } | |
476 | |
138 | 477 lw->slideshow = slideshow_start_from_filelist(lw->image, list, |
9 | 478 layout_image_slideshow_stop_func, lw); |
479 | |
480 layout_status_update_info(lw, NULL); | |
481 } | |
482 | |
483 void layout_image_slideshow_stop(LayoutWindow *lw) | |
484 { | |
485 if (!layout_valid(&lw)) return; | |
486 | |
487 if (!lw->slideshow) return; | |
488 | |
489 slideshow_free(lw->slideshow); | |
490 /* the stop_func sets lw->slideshow to NULL for us */ | |
491 } | |
492 | |
493 void layout_image_slideshow_toggle(LayoutWindow *lw) | |
494 { | |
495 if (!layout_valid(&lw)) return; | |
496 | |
497 if (lw->slideshow) | |
498 { | |
499 layout_image_slideshow_stop(lw); | |
500 } | |
501 else | |
502 { | |
503 layout_image_slideshow_start(lw); | |
504 } | |
505 } | |
506 | |
507 gint layout_image_slideshow_active(LayoutWindow *lw) | |
508 { | |
509 if (!layout_valid(&lw)) return FALSE; | |
510 | |
511 return (lw->slideshow != NULL); | |
512 } | |
513 | |
514 gint layout_image_slideshow_pause_toggle(LayoutWindow *lw) | |
515 { | |
516 gint ret; | |
517 | |
518 if (!layout_valid(&lw)) return FALSE; | |
519 | |
520 ret = slideshow_pause_toggle(lw->slideshow); | |
521 | |
522 layout_status_update_info(lw, NULL); | |
523 | |
524 return ret; | |
525 } | |
526 | |
527 gint layout_image_slideshow_paused(LayoutWindow *lw) | |
528 { | |
529 if (!layout_valid(&lw)) return FALSE; | |
530 | |
531 return (slideshow_paused(lw->slideshow)); | |
532 } | |
533 | |
534 static gint layout_image_slideshow_continue_check(LayoutWindow *lw) | |
535 { | |
536 if (!lw->slideshow) return FALSE; | |
537 | |
538 if (!slideshow_should_continue(lw->slideshow)) | |
539 { | |
540 layout_image_slideshow_stop(lw); | |
541 return FALSE; | |
542 } | |
543 | |
544 return TRUE; | |
545 } | |
546 | |
547 /* | |
548 *---------------------------------------------------------------------------- | |
549 * pop-up menus | |
550 *---------------------------------------------------------------------------- | |
551 */ | |
552 | |
553 static void li_pop_menu_zoom_in_cb(GtkWidget *widget, gpointer data) | |
554 { | |
555 LayoutWindow *lw = data; | |
556 | |
130 | 557 layout_image_zoom_adjust(lw, get_zoom_increment()); |
9 | 558 } |
559 | |
560 static void li_pop_menu_zoom_out_cb(GtkWidget *widget, gpointer data) | |
561 { | |
562 LayoutWindow *lw = data; | |
130 | 563 layout_image_zoom_adjust(lw, -get_zoom_increment()); |
9 | 564 } |
565 | |
566 static void li_pop_menu_zoom_1_1_cb(GtkWidget *widget, gpointer data) | |
567 { | |
568 LayoutWindow *lw = data; | |
569 | |
130 | 570 layout_image_zoom_set(lw, 1.0); |
9 | 571 } |
572 | |
573 static void li_pop_menu_zoom_fit_cb(GtkWidget *widget, gpointer data) | |
574 { | |
575 LayoutWindow *lw = data; | |
576 | |
130 | 577 layout_image_zoom_set(lw, 0.0); |
9 | 578 } |
579 | |
580 static void li_pop_menu_edit_cb(GtkWidget *widget, gpointer data) | |
581 { | |
582 LayoutWindow *lw; | |
583 gint n; | |
584 | |
585 lw = submenu_item_get_data(widget); | |
586 n = GPOINTER_TO_INT(data); | |
587 | |
60
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
588 if (!editor_window_flag_set(n)) |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
589 { |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
590 layout_image_full_screen_stop(lw); |
9c0c402b0ef3
Mon Jun 13 17:31:46 2005 John Ellis <johne@verizon.net>
gqview
parents:
23
diff
changeset
|
591 } |
138 | 592 start_editor_from_file(n, layout_image_get_fd(lw)); |
9 | 593 } |
594 | |
595 static void li_pop_menu_wallpaper_cb(GtkWidget *widget, gpointer data) | |
596 { | |
597 LayoutWindow *lw = data; | |
598 | |
599 layout_image_to_root(lw); | |
600 } | |
601 | |
602 static void li_pop_menu_alter_cb(GtkWidget *widget, gpointer data) | |
603 { | |
604 LayoutWindow *lw = data; | |
605 AlterType type; | |
606 | |
607 lw = submenu_item_get_data(widget); | |
608 type = (AlterType)GPOINTER_TO_INT(data); | |
609 | |
610 image_alter(lw->image, type); | |
611 } | |
612 | |
613 static void li_pop_menu_info_cb(GtkWidget *widget, gpointer data) | |
614 { | |
615 LayoutWindow *lw = data; | |
616 | |
138 | 617 info_window_new(layout_image_get_fd(lw), NULL); |
9 | 618 } |
619 | |
620 static void li_pop_menu_new_cb(GtkWidget *widget, gpointer data) | |
621 { | |
622 LayoutWindow *lw = data; | |
623 | |
138 | 624 view_window_new(layout_image_get_fd(lw)); |
9 | 625 } |
626 | |
627 static GtkWidget *li_pop_menu_click_parent(GtkWidget *widget, LayoutWindow *lw) | |
628 { | |
629 GtkWidget *menu; | |
630 GtkWidget *parent; | |
631 | |
632 menu = gtk_widget_get_toplevel(widget); | |
633 if (!menu) return NULL; | |
634 | |
635 parent = g_object_get_data(G_OBJECT(menu), "click_parent"); | |
636 | |
637 if (!parent && lw->full_screen) | |
638 { | |
639 parent = lw->full_screen->imd->widget; | |
640 } | |
641 | |
642 return parent; | |
643 } | |
644 | |
645 static void li_pop_menu_copy_cb(GtkWidget *widget, gpointer data) | |
646 { | |
647 LayoutWindow *lw = data; | |
648 | |
138 | 649 file_util_copy(layout_image_get_fd(lw), NULL, NULL, |
9 | 650 li_pop_menu_click_parent(widget, lw)); |
651 } | |
652 | |
653 static void li_pop_menu_move_cb(GtkWidget *widget, gpointer data) | |
654 { | |
655 LayoutWindow *lw = data; | |
656 | |
138 | 657 file_util_move(layout_image_get_fd(lw), NULL, NULL, |
9 | 658 li_pop_menu_click_parent(widget, lw)); |
659 } | |
660 | |
661 static void li_pop_menu_rename_cb(GtkWidget *widget, gpointer data) | |
662 { | |
663 LayoutWindow *lw = data; | |
664 | |
138 | 665 file_util_rename(layout_image_get_fd(lw), NULL, |
9 | 666 li_pop_menu_click_parent(widget, lw)); |
667 } | |
668 | |
669 static void li_pop_menu_delete_cb(GtkWidget *widget, gpointer data) | |
670 { | |
671 LayoutWindow *lw = data; | |
672 | |
138 | 673 file_util_delete(layout_image_get_fd(lw), NULL, |
9 | 674 li_pop_menu_click_parent(widget, lw)); |
675 } | |
676 | |
677 static void li_pop_menu_slide_start_cb(GtkWidget *widget, gpointer data) | |
678 { | |
679 LayoutWindow *lw = data; | |
680 | |
681 layout_image_slideshow_start(lw); | |
682 } | |
683 | |
684 static void li_pop_menu_slide_stop_cb(GtkWidget *widget, gpointer data) | |
685 { | |
686 LayoutWindow *lw = data; | |
687 | |
688 layout_image_slideshow_stop(lw); | |
689 } | |
690 | |
691 static void li_pop_menu_slide_pause_cb(GtkWidget *widget, gpointer data) | |
692 { | |
693 LayoutWindow *lw = data; | |
694 | |
695 layout_image_slideshow_pause_toggle(lw); | |
696 } | |
697 | |
698 static void li_pop_menu_full_screen_cb(GtkWidget *widget, gpointer data) | |
699 { | |
700 LayoutWindow *lw = data; | |
701 | |
702 layout_image_full_screen_toggle(lw); | |
703 } | |
704 | |
705 static void li_pop_menu_hide_cb(GtkWidget *widget, gpointer data) | |
706 { | |
707 LayoutWindow *lw = data; | |
708 | |
709 layout_tools_hide_toggle(lw); | |
710 } | |
711 | |
712 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw) | |
713 { | |
714 GtkWidget *menu; | |
715 GtkWidget *item; | |
716 GtkWidget *submenu; | |
717 const gchar *path; | |
718 gint fullscreen; | |
719 | |
720 path = layout_image_get_path(lw); | |
721 fullscreen = layout_image_full_screen_active(lw); | |
722 | |
723 menu = popup_menu_short_lived(); | |
724 | |
725 menu_item_add_stock(menu, _("Zoom _in"), GTK_STOCK_ZOOM_IN, G_CALLBACK(li_pop_menu_zoom_in_cb), lw); | |
726 menu_item_add_stock(menu, _("Zoom _out"), GTK_STOCK_ZOOM_OUT, G_CALLBACK(li_pop_menu_zoom_out_cb), lw); | |
727 menu_item_add_stock(menu, _("Zoom _1:1"), GTK_STOCK_ZOOM_100, G_CALLBACK(li_pop_menu_zoom_1_1_cb), lw); | |
728 menu_item_add_stock(menu, _("Fit image to _window"), GTK_STOCK_ZOOM_FIT, G_CALLBACK(li_pop_menu_zoom_fit_cb), lw); | |
729 menu_item_add_divider(menu); | |
730 | |
731 submenu = submenu_add_edit(menu, &item, G_CALLBACK(li_pop_menu_edit_cb), lw); | |
732 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
733 menu_item_add_divider(submenu); | |
734 menu_item_add(submenu, _("Set as _wallpaper"), G_CALLBACK(li_pop_menu_wallpaper_cb), lw); | |
735 | |
736 item = submenu_add_alter(menu, G_CALLBACK(li_pop_menu_alter_cb), lw); | |
737 | |
738 item = menu_item_add_stock(menu, _("_Properties"), GTK_STOCK_PROPERTIES, G_CALLBACK(li_pop_menu_info_cb), lw); | |
739 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
740 | |
741 item = menu_item_add_stock(menu, _("View in _new window"), GTK_STOCK_NEW, G_CALLBACK(li_pop_menu_new_cb), lw); | |
742 if (!path || fullscreen) gtk_widget_set_sensitive(item, FALSE); | |
743 | |
744 menu_item_add_divider(menu); | |
745 | |
746 item = menu_item_add_stock(menu, _("_Copy..."), GTK_STOCK_COPY, G_CALLBACK(li_pop_menu_copy_cb), lw); | |
747 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
748 item = menu_item_add(menu, _("_Move..."), G_CALLBACK(li_pop_menu_move_cb), lw); | |
749 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
750 item = menu_item_add(menu, _("_Rename..."), G_CALLBACK(li_pop_menu_rename_cb), lw); | |
751 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
752 item = menu_item_add_stock(menu, _("_Delete..."), GTK_STOCK_DELETE, G_CALLBACK(li_pop_menu_delete_cb), lw); | |
753 if (!path) gtk_widget_set_sensitive(item, FALSE); | |
754 | |
755 menu_item_add_divider(menu); | |
756 | |
757 if (layout_image_slideshow_active(lw)) | |
758 { | |
759 menu_item_add(menu, _("_Stop slideshow"), G_CALLBACK(li_pop_menu_slide_stop_cb), lw); | |
760 if (layout_image_slideshow_paused(lw)) | |
761 { | |
762 item = menu_item_add(menu, _("Continue slides_how"), | |
763 G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
764 } | |
765 else | |
766 { | |
767 item = menu_item_add(menu, _("Pause slides_how"), | |
768 G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
769 } | |
770 } | |
771 else | |
772 { | |
773 menu_item_add(menu, _("_Start slideshow"), G_CALLBACK(li_pop_menu_slide_start_cb), lw); | |
774 item = menu_item_add(menu, _("Pause slides_how"), G_CALLBACK(li_pop_menu_slide_pause_cb), lw); | |
775 gtk_widget_set_sensitive(item, FALSE); | |
776 } | |
777 | |
778 if (!fullscreen) | |
779 { | |
780 menu_item_add(menu, _("_Full screen"), G_CALLBACK(li_pop_menu_full_screen_cb), lw); | |
781 } | |
782 else | |
783 { | |
784 menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(li_pop_menu_full_screen_cb), lw); | |
785 } | |
786 | |
787 menu_item_add_divider(menu); | |
788 | |
789 item = menu_item_add_check(menu, _("Hide file _list"), lw->tools_hidden, | |
790 G_CALLBACK(li_pop_menu_hide_cb), lw); | |
791 if (fullscreen) gtk_widget_set_sensitive(item, FALSE); | |
792 | |
793 return menu; | |
794 } | |
795 | |
796 static void layout_image_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) | |
797 { | |
798 LayoutWindow *lw = data; | |
799 | |
23
17acca639a86
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
9
diff
changeset
|
800 gdk_window_get_origin(lw->image->pr->window, x, y); |
9 | 801 popup_menu_position_clamp(menu, x, y, 0); |
802 } | |
803 | |
804 void layout_image_menu_popup(LayoutWindow *lw) | |
805 { | |
806 GtkWidget *menu; | |
807 | |
808 menu = layout_image_pop_menu(lw); | |
809 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, layout_image_menu_pos_cb, lw, 0, GDK_CURRENT_TIME); | |
810 } | |
811 | |
812 /* | |
813 *---------------------------------------------------------------------------- | |
814 * dnd | |
815 *---------------------------------------------------------------------------- | |
816 */ | |
817 | |
818 static void layout_image_dnd_receive(GtkWidget *widget, GdkDragContext *context, | |
819 gint x, gint y, | |
820 GtkSelectionData *selection_data, guint info, | |
821 guint time, gpointer data) | |
822 { | |
823 LayoutWindow *lw = data; | |
127 | 824 gint i; |
825 | |
826 | |
827 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
828 { | |
829 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
830 break; | |
831 } | |
832 if (i < MAX_SPLIT_IMAGES) | |
833 { | |
302 | 834 if (debug) printf("dnd image activate %d\n", i); |
127 | 835 layout_image_activate(lw, i); |
836 } | |
837 | |
9 | 838 |
839 if (info == TARGET_URI_LIST || info == TARGET_APP_COLLECTION_MEMBER) | |
840 { | |
841 CollectionData *source; | |
842 GList *list; | |
843 GList *info_list; | |
844 | |
845 if (info == TARGET_URI_LIST) | |
846 { | |
138 | 847 list = uri_filelist_from_text((gchar *)selection_data->data, TRUE); |
9 | 848 source = NULL; |
849 info_list = NULL; | |
850 } | |
851 else | |
852 { | |
853 source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list); | |
854 } | |
855 | |
856 if (list) | |
857 { | |
138 | 858 FileData *fd = list->data; |
9 | 859 |
138 | 860 if (isfile(fd->path)) |
9 | 861 { |
862 gchar *base; | |
863 gint row; | |
864 | |
138 | 865 base = remove_level_from_path(fd->path); |
9 | 866 if (strcmp(base, layout_get_path(lw)) != 0) |
867 { | |
868 layout_set_path(lw, base); | |
869 } | |
870 g_free(base); | |
871 | |
138 | 872 row = layout_list_get_index(lw, fd->path); |
9 | 873 if (source && info_list) |
874 { | |
875 layout_image_set_collection(lw, source, info_list->data); | |
876 } | |
877 else if (row == -1) | |
878 { | |
138 | 879 layout_image_set_fd(lw, fd); |
9 | 880 } |
881 else | |
882 { | |
883 layout_image_set_index(lw, row); | |
884 } | |
885 } | |
138 | 886 else if (isdir(fd->path)) |
9 | 887 { |
138 | 888 layout_set_path(lw, fd->path); |
889 layout_image_set_fd(lw, NULL); | |
9 | 890 } |
891 } | |
892 | |
138 | 893 filelist_free(list); |
9 | 894 g_list_free(info_list); |
895 } | |
896 } | |
897 | |
898 static void layout_image_dnd_get(GtkWidget *widget, GdkDragContext *context, | |
899 GtkSelectionData *selection_data, guint info, | |
900 guint time, gpointer data) | |
901 { | |
902 LayoutWindow *lw = data; | |
138 | 903 FileData *fd; |
127 | 904 gint i; |
905 | |
906 | |
907 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
908 { | |
909 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
910 break; | |
911 } | |
912 if (i < MAX_SPLIT_IMAGES) | |
913 { | |
302 | 914 if (debug) printf("dnd get from %d\n", i); |
138 | 915 fd = image_get_fd(lw->split_images[i]); |
127 | 916 } |
917 else | |
138 | 918 fd = layout_image_get_fd(lw); |
9 | 919 |
138 | 920 if (fd) |
9 | 921 { |
922 gchar *text = NULL; | |
923 gint len; | |
924 gint plain_text; | |
925 GList *list; | |
926 | |
927 switch (info) | |
928 { | |
929 case TARGET_URI_LIST: | |
930 plain_text = FALSE; | |
931 break; | |
932 case TARGET_TEXT_PLAIN: | |
933 default: | |
934 plain_text = TRUE; | |
935 break; | |
936 } | |
138 | 937 list = g_list_append(NULL, fd); |
938 text = uri_text_from_filelist(list, &len, plain_text); | |
9 | 939 g_list_free(list); |
940 if (text) | |
941 { | |
942 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
|
943 8, (guchar *)text, len); |
9 | 944 g_free(text); |
945 } | |
946 } | |
947 else | |
948 { | |
949 gtk_selection_data_set (selection_data, selection_data->target, | |
950 8, NULL, 0); | |
951 } | |
952 } | |
953 | |
954 static void layout_image_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) | |
955 { | |
956 LayoutWindow *lw = data; | |
957 if (context->action == GDK_ACTION_MOVE) | |
958 { | |
959 const gchar *path; | |
960 gint row; | |
961 | |
962 path = layout_image_get_path(lw); | |
963 row = layout_list_get_index(lw, path); | |
964 if (row < 0) return; | |
965 | |
966 if (!isfile(path)) | |
967 { | |
968 if (row < layout_list_count(lw, NULL) - 1) | |
969 { | |
970 layout_image_next(lw); | |
971 } | |
972 else | |
973 { | |
974 layout_image_prev(lw); | |
975 } | |
976 } | |
977 layout_refresh(lw); | |
978 } | |
979 } | |
980 | |
127 | 981 static void layout_image_dnd_init(LayoutWindow *lw, gint i) |
9 | 982 { |
127 | 983 ImageWindow *imd = lw->split_images[i]; |
984 | |
985 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, | |
9 | 986 dnd_file_drag_types, dnd_file_drag_types_count, |
987 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
127 | 988 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
9 | 989 G_CALLBACK(layout_image_dnd_get), lw); |
127 | 990 g_signal_connect(G_OBJECT(imd->pr), "drag_end", |
9 | 991 G_CALLBACK(layout_image_dnd_end), lw); |
992 | |
127 | 993 gtk_drag_dest_set(imd->pr, |
9 | 994 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
995 dnd_file_drop_types, dnd_file_drop_types_count, | |
996 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
127 | 997 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
9 | 998 G_CALLBACK(layout_image_dnd_receive), lw); |
999 } | |
1000 | |
1001 | |
1002 /* | |
1003 *---------------------------------------------------------------------------- | |
1004 * misc | |
1005 *---------------------------------------------------------------------------- | |
1006 */ | |
1007 | |
1008 void layout_image_to_root(LayoutWindow *lw) | |
1009 { | |
1010 image_to_root_window(lw->image, (image_zoom_get(lw->image) == 0)); | |
1011 } | |
1012 | |
1013 /* | |
1014 *---------------------------------------------------------------------------- | |
1015 * manipulation + accessors | |
1016 *---------------------------------------------------------------------------- | |
1017 */ | |
1018 | |
1019 void layout_image_scroll(LayoutWindow *lw, gint x, gint y) | |
1020 { | |
1021 if (!layout_valid(&lw)) return; | |
1022 | |
1023 image_scroll(lw->image, x, y); | |
1024 } | |
1025 | |
1026 void layout_image_zoom_adjust(LayoutWindow *lw, gdouble increment) | |
1027 { | |
130 | 1028 gint i; |
9 | 1029 if (!layout_valid(&lw)) return; |
1030 | |
1031 image_zoom_adjust(lw->image, increment); | |
130 | 1032 |
1033 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1034 { | |
1035 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) | |
1036 image_zoom_adjust(lw->split_images[i], increment); ; | |
1037 } | |
9 | 1038 } |
1039 | |
1040 void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom) | |
1041 { | |
130 | 1042 gint i; |
9 | 1043 if (!layout_valid(&lw)) return; |
1044 | |
1045 image_zoom_set(lw->image, zoom); | |
130 | 1046 |
1047 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1048 { | |
1049 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) | |
1050 image_zoom_set(lw->split_images[i], zoom); | |
1051 } | |
9 | 1052 } |
1053 | |
1054 void layout_image_zoom_set_fill_geometry(LayoutWindow *lw, gint vertical) | |
1055 { | |
1056 if (!layout_valid(&lw)) return; | |
1057 | |
1058 image_zoom_set_fill_geometry(lw->image, vertical); | |
1059 } | |
1060 | |
1061 void layout_image_alter(LayoutWindow *lw, AlterType type) | |
1062 { | |
1063 if (!layout_valid(&lw)) return; | |
1064 | |
1065 image_alter(lw->image, type); | |
1066 } | |
1067 | |
1068 const gchar *layout_image_get_path(LayoutWindow *lw) | |
1069 { | |
1070 if (!layout_valid(&lw)) return NULL; | |
1071 | |
1072 return image_get_path(lw->image); | |
1073 } | |
1074 | |
1075 const gchar *layout_image_get_name(LayoutWindow *lw) | |
1076 { | |
1077 if (!layout_valid(&lw)) return NULL; | |
1078 | |
1079 return image_get_name(lw->image); | |
1080 } | |
1081 | |
138 | 1082 FileData *layout_image_get_fd(LayoutWindow *lw) |
1083 { | |
1084 if (!layout_valid(&lw)) return NULL; | |
1085 | |
1086 return image_get_fd(lw->image); | |
1087 } | |
1088 | |
9 | 1089 CollectionData *layout_image_get_collection(LayoutWindow *lw, CollectInfo **info) |
1090 { | |
1091 if (!layout_valid(&lw)) return NULL; | |
1092 | |
1093 return image_get_collection(lw->image, info); | |
1094 } | |
1095 | |
1096 gint layout_image_get_index(LayoutWindow *lw) | |
1097 { | |
1098 return layout_list_get_index(lw, image_get_path(lw->image)); | |
1099 } | |
1100 | |
1101 /* | |
1102 *---------------------------------------------------------------------------- | |
1103 * image changers | |
1104 *---------------------------------------------------------------------------- | |
1105 */ | |
1106 | |
138 | 1107 void layout_image_set_fd(LayoutWindow *lw, FileData *fd) |
9 | 1108 { |
131 | 1109 gdouble sx, sy; |
9 | 1110 if (!layout_valid(&lw)) return; |
1111 | |
129 | 1112 image_get_scroll_center(lw->image, &sx, &sy); |
1113 | |
334 | 1114 image_change_fd(lw->image, fd, image_zoom_get_default(lw->image, options->image.zoom_mode)); |
9 | 1115 |
129 | 1116 image_set_scroll_center(lw->image, sx, sy); |
1117 | |
138 | 1118 layout_list_sync_fd(lw, fd); |
9 | 1119 layout_image_slideshow_continue_check(lw); |
1120 layout_bars_new_image(lw); | |
1121 } | |
1122 | |
138 | 1123 void layout_image_set_with_ahead(LayoutWindow *lw, FileData *fd, FileData *read_ahead_fd) |
9 | 1124 { |
1125 if (!layout_valid(&lw)) return; | |
1126 | |
144 | 1127 /* |
1128 This should be handled at the caller: in vflist_select_image | |
1129 if (path) | |
9 | 1130 { |
1131 const gchar *old_path; | |
1132 | |
1133 old_path = layout_image_get_path(lw); | |
1134 if (old_path && strcmp(path, old_path) == 0) return; | |
1135 } | |
127 | 1136 */ |
138 | 1137 layout_image_set_fd(lw, fd); |
334 | 1138 if (options->image.enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_fd); |
9 | 1139 } |
1140 | |
1141 void layout_image_set_index(LayoutWindow *lw, gint index) | |
1142 { | |
138 | 1143 FileData *fd; |
1144 FileData *read_ahead_fd; | |
9 | 1145 gint old; |
1146 | |
1147 if (!layout_valid(&lw)) return; | |
1148 | |
1149 old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
138 | 1150 fd = layout_list_get_fd(lw, index); |
9 | 1151 |
1152 if (old > index) | |
1153 { | |
138 | 1154 read_ahead_fd = layout_list_get_fd(lw, index - 1); |
9 | 1155 } |
1156 else | |
1157 { | |
138 | 1158 read_ahead_fd = layout_list_get_fd(lw, index + 1); |
9 | 1159 } |
1160 | |
220 | 1161 if (layout_selection_count(lw, 0) > 1) |
1162 { | |
1163 GList *x = layout_selection_list_by_index(lw); | |
1164 GList *y; | |
1165 GList *last; | |
1166 | |
1167 for (last = y = x; y; y = y->next) | |
1168 last = y; | |
1169 for (y = x; y && ((gint)y->data) != index; y = y->next) | |
1170 ; | |
1171 | |
1172 if (y) | |
1173 { | |
1174 gint newindex; | |
1175 | |
1176 if ((index > old && (index != (gint) last->data || old != (gint) x->data)) | |
1177 || (old == (gint) last->data && index == (gint) x->data)) | |
1178 { | |
1179 if (y->next) | |
1180 newindex = (gint) y->next->data; | |
1181 else | |
1182 newindex = (gint) x->data; | |
1183 } | |
1184 else | |
1185 { | |
1186 if (y->prev) | |
1187 newindex = (gint) y->prev->data; | |
1188 else | |
1189 newindex = (gint) last->data; | |
1190 } | |
1191 | |
1192 read_ahead_fd = layout_list_get_fd(lw, newindex); | |
1193 } | |
1194 | |
1195 while (x) | |
1196 x = g_list_remove(x, x->data); | |
1197 } | |
1198 | |
138 | 1199 layout_image_set_with_ahead(lw, fd, read_ahead_fd); |
9 | 1200 } |
1201 | |
1202 static void layout_image_set_collection_real(LayoutWindow *lw, CollectionData *cd, CollectInfo *info, gint forward) | |
1203 { | |
1204 if (!layout_valid(&lw)) return; | |
1205 | |
334 | 1206 image_change_from_collection(lw->image, cd, info, image_zoom_get_default(lw->image, options->image.zoom_mode)); |
1207 if (options->image.enable_read_ahead) | |
9 | 1208 { |
1209 CollectInfo *r_info; | |
1210 if (forward) | |
1211 { | |
1212 r_info = collection_next_by_info(cd, info); | |
1213 if (!r_info) r_info = collection_prev_by_info(cd, info); | |
1214 } | |
1215 else | |
1216 { | |
1217 r_info = collection_prev_by_info(cd, info); | |
1218 if (!r_info) r_info = collection_next_by_info(cd, info); | |
1219 } | |
138 | 1220 if (r_info) image_prebuffer_set(lw->image, r_info->fd); |
9 | 1221 } |
1222 | |
1223 layout_image_slideshow_continue_check(lw); | |
1224 layout_bars_new_image(lw); | |
1225 } | |
1226 | |
1227 void layout_image_set_collection(LayoutWindow *lw, CollectionData *cd, CollectInfo *info) | |
1228 { | |
1229 layout_image_set_collection_real(lw, cd, info, TRUE); | |
138 | 1230 layout_list_sync_fd(lw, layout_image_get_fd(lw)); |
9 | 1231 } |
1232 | |
1233 void layout_image_refresh(LayoutWindow *lw) | |
1234 { | |
1235 if (!layout_valid(&lw)) return; | |
1236 | |
1237 image_reload(lw->image); | |
1238 } | |
1239 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1240 void layout_image_color_profile_set(LayoutWindow *lw, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1241 gint input_type, gint screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1242 gint use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1243 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1244 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1245 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1246 image_color_profile_set(lw->image, input_type, screen_type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1247 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1248 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1249 gint layout_image_color_profile_get(LayoutWindow *lw, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1250 gint *input_type, gint *screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1251 gint *use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1252 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1253 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1254 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1255 return image_color_profile_get(lw->image, input_type, screen_type, use_image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1256 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1257 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1258 void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1259 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1260 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1261 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1262 image_color_profile_set_use(lw->image, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1263 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1264 if (lw->info_color) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1265 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1266 #ifndef HAVE_LCMS |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1267 enable = FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1268 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1269 gtk_widget_set_sensitive(GTK_BIN(lw->info_color)->child, enable); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1270 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1271 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1272 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1273 gint layout_image_color_profile_get_use(LayoutWindow *lw) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1274 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1275 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1276 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1277 return image_color_profile_get_use(lw->image); |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1278 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1279 |
9 | 1280 /* |
1281 *---------------------------------------------------------------------------- | |
1282 * list walkers | |
1283 *---------------------------------------------------------------------------- | |
1284 */ | |
1285 | |
1286 void layout_image_next(LayoutWindow *lw) | |
1287 { | |
1288 gint current; | |
1289 CollectionData *cd; | |
1290 CollectInfo *info; | |
1291 | |
1292 if (!layout_valid(&lw)) return; | |
1293 | |
1294 if (layout_image_slideshow_active(lw)) | |
1295 { | |
1296 layout_image_slideshow_next(lw); | |
1297 return; | |
1298 } | |
1299 | |
220 | 1300 if (layout_selection_count(lw, 0) > 1) |
1301 { | |
1302 GList *x = layout_selection_list_by_index(lw); | |
1303 gint old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
1304 GList *y; | |
1305 | |
1306 for (y = x; y && ((gint) y->data) != old; y = y->next) | |
1307 ; | |
1308 if (y) | |
1309 { | |
1310 if (y->next) | |
1311 layout_image_set_index(lw, (gint) y->next->data); | |
1312 else | |
1313 layout_image_set_index(lw, (gint) x->data); | |
1314 } | |
1315 while (x) | |
1316 x = g_list_remove(x, x->data); | |
1317 if (y) /* not dereferenced */ | |
1318 return; | |
1319 } | |
1320 | |
9 | 1321 cd = image_get_collection(lw->image, &info); |
1322 | |
1323 if (cd && info) | |
1324 { | |
1325 info = collection_next_by_info(cd, info); | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1326 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1327 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1328 layout_image_set_collection_real(lw, cd, info, TRUE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1329 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1330 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1331 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1332 image_osd_icon(lw->image, IMAGE_OSD_LAST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1333 } |
9 | 1334 return; |
1335 } | |
1336 | |
1337 current = layout_image_get_index(lw); | |
1338 | |
1339 if (current >= 0) | |
1340 { | |
1341 if (current < layout_list_count(lw, NULL) - 1) | |
1342 { | |
1343 layout_image_set_index(lw, current + 1); | |
1344 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1345 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1346 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1347 image_osd_icon(lw->image, IMAGE_OSD_LAST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1348 } |
9 | 1349 } |
1350 else | |
1351 { | |
1352 layout_image_set_index(lw, 0); | |
1353 } | |
1354 } | |
1355 | |
1356 void layout_image_prev(LayoutWindow *lw) | |
1357 { | |
1358 gint current; | |
1359 CollectionData *cd; | |
1360 CollectInfo *info; | |
1361 | |
1362 if (!layout_valid(&lw)) return; | |
1363 | |
1364 if (layout_image_slideshow_active(lw)) | |
1365 { | |
1366 layout_image_slideshow_prev(lw); | |
1367 return; | |
1368 } | |
1369 | |
220 | 1370 if (layout_selection_count(lw, 0) > 1) |
1371 { | |
1372 GList *x = layout_selection_list_by_index(lw); | |
1373 gint old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
1374 GList *y; | |
1375 GList *last; | |
1376 | |
1377 for (last = y = x; y; y = y->next) | |
1378 last = y; | |
1379 for (y = x; y && ((gint) y->data) != old; y = y->next) | |
1380 ; | |
1381 if (y) | |
1382 { | |
1383 if (y->prev) | |
1384 layout_image_set_index(lw, (gint) y->prev->data); | |
1385 else | |
1386 layout_image_set_index(lw, (gint) last->data); | |
1387 } | |
1388 while (x) | |
1389 x = g_list_remove(x, x->data); | |
1390 if (y) /* not dereferenced */ | |
1391 return; | |
1392 } | |
1393 | |
9 | 1394 cd = image_get_collection(lw->image, &info); |
1395 | |
1396 if (cd && info) | |
1397 { | |
1398 info = collection_prev_by_info(cd, info); | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1399 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1400 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1401 layout_image_set_collection_real(lw, cd, info, FALSE); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1402 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1403 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1404 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1405 image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1406 } |
9 | 1407 return; |
1408 } | |
1409 | |
1410 current = layout_image_get_index(lw); | |
1411 | |
1412 if (current >= 0) | |
1413 { | |
1414 if (current > 0) | |
1415 { | |
1416 layout_image_set_index(lw, current - 1); | |
1417 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1418 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1419 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1420 image_osd_icon(lw->image, IMAGE_OSD_FIRST, -1); |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1421 } |
9 | 1422 } |
1423 else | |
1424 { | |
1425 layout_image_set_index(lw, layout_list_count(lw, NULL) - 1); | |
1426 } | |
1427 } | |
1428 | |
1429 void layout_image_first(LayoutWindow *lw) | |
1430 { | |
1431 gint current; | |
1432 CollectionData *cd; | |
1433 CollectInfo *info; | |
1434 | |
1435 if (!layout_valid(&lw)) return; | |
1436 | |
1437 cd = image_get_collection(lw->image, &info); | |
1438 | |
1439 if (cd && info) | |
1440 { | |
1441 CollectInfo *new; | |
1442 new = collection_get_first(cd); | |
1443 if (new != info) layout_image_set_collection_real(lw, cd, new, TRUE); | |
1444 return; | |
1445 } | |
1446 | |
1447 current = layout_image_get_index(lw); | |
1448 if (current != 0 && layout_list_count(lw, NULL) > 0) | |
1449 { | |
1450 layout_image_set_index(lw, 0); | |
1451 } | |
1452 } | |
1453 | |
1454 void layout_image_last(LayoutWindow *lw) | |
1455 { | |
1456 gint current; | |
1457 gint count; | |
1458 CollectionData *cd; | |
1459 CollectInfo *info; | |
1460 | |
1461 if (!layout_valid(&lw)) return; | |
1462 | |
1463 cd = image_get_collection(lw->image, &info); | |
1464 | |
1465 if (cd && info) | |
1466 { | |
1467 CollectInfo *new; | |
1468 new = collection_get_last(cd); | |
1469 if (new != info) layout_image_set_collection_real(lw, cd, new, FALSE); | |
1470 return; | |
1471 } | |
1472 | |
1473 current = layout_image_get_index(lw); | |
1474 count = layout_list_count(lw, NULL); | |
1475 if (current != count - 1 && count > 0) | |
1476 { | |
1477 layout_image_set_index(lw, count - 1); | |
1478 } | |
1479 } | |
1480 | |
1481 /* | |
1482 *---------------------------------------------------------------------------- | |
1483 * mouse callbacks | |
1484 *---------------------------------------------------------------------------- | |
1485 */ | |
1486 | |
127 | 1487 static gint image_idx(LayoutWindow *lw, ImageWindow *imd) |
1488 { | |
1489 gint i; | |
1490 | |
1491 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1492 { | |
1493 if (lw->split_images[i] == imd) | |
1494 break; | |
1495 } | |
1496 if (i < MAX_SPLIT_IMAGES) | |
1497 { | |
1498 return i; | |
1499 } | |
1500 return -1; | |
1501 } | |
1502 | |
1503 | |
9 | 1504 static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time, |
1505 gdouble x, gdouble y, guint state, gpointer data) | |
1506 { | |
1507 LayoutWindow *lw = data; | |
1508 GtkWidget *menu; | |
1509 | |
1510 switch (button) | |
1511 { | |
1512 case 1: | |
1513 layout_image_next(lw); | |
1514 break; | |
1515 case 2: | |
1516 layout_image_prev(lw); | |
1517 break; | |
1518 case 3: | |
1519 menu = layout_image_pop_menu(lw); | |
1520 if (imd == lw->image) | |
1521 { | |
1522 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); | |
1523 } | |
1524 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time); | |
1525 break; | |
1526 default: | |
1527 break; | |
1528 } | |
1529 } | |
1530 | |
1531 static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time, | |
1532 gdouble x, gdouble y, guint state, gpointer data) | |
1533 { | |
1534 LayoutWindow *lw = data; | |
1535 | |
127 | 1536 gint i = image_idx(lw, imd); |
1537 | |
1538 if (i != -1) | |
1539 { | |
1540 printf("image activate scroll %d\n", i); | |
1541 layout_image_activate(lw, i); | |
1542 } | |
1543 | |
1544 | |
9 | 1545 if (state & GDK_CONTROL_MASK) |
1546 { | |
1547 switch (direction) | |
1548 { | |
1549 case GDK_SCROLL_UP: | |
1550 image_zoom_adjust_at_point(imd, get_zoom_increment(), x, y); | |
1551 break; | |
1552 case GDK_SCROLL_DOWN: | |
1553 image_zoom_adjust_at_point(imd, -get_zoom_increment(), x, y); | |
1554 break; | |
1555 default: | |
1556 break; | |
1557 } | |
1558 } | |
318 | 1559 else if ( (state & GDK_SHIFT_MASK) != (options->mousewheel_scrolls)) |
9 | 1560 { |
1561 switch (direction) | |
1562 { | |
1563 case GDK_SCROLL_UP: | |
1564 image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE); | |
1565 break; | |
1566 case GDK_SCROLL_DOWN: | |
1567 image_scroll(imd, 0, MOUSEWHEEL_SCROLL_SIZE); | |
1568 break; | |
1569 case GDK_SCROLL_LEFT: | |
1570 image_scroll(imd, -MOUSEWHEEL_SCROLL_SIZE, 0); | |
1571 break; | |
1572 case GDK_SCROLL_RIGHT: | |
1573 image_scroll(imd, MOUSEWHEEL_SCROLL_SIZE, 0); | |
1574 break; | |
1575 default: | |
1576 break; | |
1577 } | |
1578 } | |
1579 else | |
1580 { | |
1581 switch (direction) | |
1582 { | |
1583 case GDK_SCROLL_UP: | |
1584 layout_image_prev(lw); | |
1585 break; | |
1586 case GDK_SCROLL_DOWN: | |
1587 layout_image_next(lw); | |
1588 break; | |
1589 default: | |
1590 break; | |
1591 } | |
1592 } | |
1593 } | |
1594 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1595 static void layout_image_drag_cb(ImageWindow *imd, gint button, guint32 time, |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1596 gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data) |
127 | 1597 { |
1598 gint i; | |
1599 LayoutWindow *lw = data; | |
1600 | |
1601 | |
1602 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1603 { | |
1604 if (lw->split_images[i] && lw->split_images[i] != imd) | |
129 | 1605 if (lw->connect_scroll) |
1606 { | |
131 | 1607 gdouble sx, sy; |
1608 if (state & GDK_CONTROL_MASK) | |
129 | 1609 { |
1610 image_get_scroll_center(imd, &sx, &sy); | |
1611 } | |
1612 else | |
1613 { | |
1614 image_get_scroll_center(lw->split_images[i], &sx, &sy); | |
1615 sx += dx; | |
1616 sy += dy; | |
1617 } | |
1618 image_set_scroll_center(lw->split_images[i], sx, sy); | |
1619 } | |
127 | 1620 } |
1621 } | |
1622 | |
1623 static void layout_image_button_inactive_cb(ImageWindow *imd, gint button, guint32 time, | |
1624 gdouble x, gdouble y, guint state, gpointer data) | |
1625 { | |
1626 LayoutWindow *lw = data; | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1627 GtkWidget *menu; |
127 | 1628 gint i = image_idx(lw, imd); |
1629 | |
1630 if (i != -1) | |
1631 { | |
1632 layout_image_activate(lw, i); | |
1633 } | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1634 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1635 switch (button) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1636 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1637 case 3: |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1638 menu = layout_image_pop_menu(lw); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1639 if (imd == lw->image) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1640 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1641 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1642 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1643 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1644 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1645 default: |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1646 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1647 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1648 |
127 | 1649 } |
1650 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1651 static void layout_image_drag_inactive_cb(ImageWindow *imd, gint button, guint32 time, |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1652 gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1653 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1654 LayoutWindow *lw = data; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1655 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1656 gint i = image_idx(lw, imd); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1657 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1658 if (i != -1) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1659 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1660 layout_image_activate(lw, i); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1661 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1662 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1663 |
129 | 1664 /* continue as with active image */ |
1665 layout_image_drag_cb(imd, button, time, x, y, state, dx, dy, data); | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1666 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1667 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1668 |
9 | 1669 static void layout_image_set_buttons(LayoutWindow *lw) |
1670 { | |
1671 image_set_button_func(lw->image, layout_image_button_cb, lw); | |
1672 image_set_scroll_func(lw->image, layout_image_scroll_cb, lw); | |
1673 } | |
1674 | |
127 | 1675 static void layout_image_set_buttons_inactive(LayoutWindow *lw, gint i) |
1676 { | |
1677 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); | |
1678 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); | |
1679 } | |
1680 | |
9 | 1681 /* |
1682 *---------------------------------------------------------------------------- | |
1683 * setup | |
1684 *---------------------------------------------------------------------------- | |
1685 */ | |
1686 | |
1687 static void layout_image_update_cb(ImageWindow *imd, gpointer data) | |
1688 { | |
1689 LayoutWindow *lw = data; | |
1690 layout_status_update_image(lw); | |
1691 } | |
1692 | |
127 | 1693 GtkWidget *layout_image_new(LayoutWindow *lw, gint i) |
9 | 1694 { |
127 | 1695 if (!lw->split_images[i]) |
9 | 1696 { |
127 | 1697 lw->split_images[i] = image_new(TRUE); |
1698 | |
1699 gtk_widget_ref(lw->split_images[i]->widget); | |
9 | 1700 |
318 | 1701 image_background_set_color(lw->split_images[i], options->user_specified_window_background ? &options->window_background_color : NULL); |
9 | 1702 |
207 | 1703 image_auto_refresh(lw->split_images[i], 0); |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1704 |
127 | 1705 layout_image_dnd_init(lw, i); |
207 | 1706 image_color_profile_set(lw->split_images[i], |
327 | 1707 options->color_profile.input_type, |
1708 options->color_profile.screen_type, | |
1709 options->color_profile.use_image); | |
1710 image_color_profile_set_use(lw->split_images[i], options->color_profile.enabled); | |
9 | 1711 } |
1712 | |
127 | 1713 return lw->split_images[i]->widget; |
1714 } | |
1715 | |
1716 void layout_image_deactivate(LayoutWindow *lw, gint i) | |
1717 { | |
1718 | |
1719 if (!lw->split_images[i]) return; | |
1720 image_set_update_func(lw->split_images[i], NULL, NULL); | |
1721 layout_image_set_buttons_inactive(lw, i); | |
129 | 1722 image_set_drag_func(lw->split_images[i], layout_image_drag_inactive_cb, lw); |
127 | 1723 |
1724 image_attach_window(lw->split_images[i], NULL, NULL, NULL, FALSE); | |
1725 image_select(lw->split_images[i], FALSE); | |
1726 } | |
1727 | |
1728 | |
1729 void layout_image_activate(LayoutWindow *lw, gint i) | |
1730 { | |
138 | 1731 FileData *fd; |
127 | 1732 |
1733 if (!lw->split_images[i]) return; | |
1734 | |
1735 /* deactivate currently active */ | |
1736 if (lw->active_split_image != i) | |
1737 layout_image_deactivate(lw, lw->active_split_image); | |
1738 | |
1739 lw->image = lw->split_images[i]; | |
1740 lw->active_split_image = i; | |
1741 | |
1742 image_set_update_func(lw->image, layout_image_update_cb, lw); | |
1743 layout_image_set_buttons(lw); | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1744 image_set_drag_func(lw->image, layout_image_drag_cb, lw); |
127 | 1745 |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
1746 image_attach_window(lw->image, lw->window, NULL, GQ_APPNAME, FALSE); |
127 | 1747 |
152 | 1748 /* do not hilight selected image in SPLIT_NONE */ |
1749 /* maybe the image should be selected always and hilight should be controled by | |
1750 another image option */ | |
1751 if (lw->split_mode != SPLIT_NONE) | |
1752 image_select(lw->split_images[i], TRUE); | |
1753 else | |
1754 image_select(lw->split_images[i], FALSE); | |
127 | 1755 |
138 | 1756 fd = image_get_fd(lw->image); |
127 | 1757 |
138 | 1758 if (fd) |
127 | 1759 { |
1760 // layout_list_sync_path(lw, path); | |
138 | 1761 layout_set_path(lw, fd->path); |
127 | 1762 } |
1763 } | |
1764 | |
1765 | |
1766 GtkWidget *layout_image_setup_split_none(LayoutWindow *lw) | |
1767 { | |
1768 gint i; | |
1769 | |
152 | 1770 lw->split_mode = SPLIT_NONE; |
1771 | |
127 | 1772 if (!lw->split_images[0]) |
1773 { | |
1774 layout_image_new(lw, 0); | |
175 | 1775 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); |
1776 image_set_selectable(lw->split_images[0], 0); | |
127 | 1777 layout_image_activate(lw, 0); |
1778 } | |
175 | 1779 else |
1780 { | |
1781 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); | |
1782 image_set_selectable(lw->split_images[0], 0); | |
1783 } | |
127 | 1784 |
1785 for (i=1; i < MAX_SPLIT_IMAGES; i++) | |
1786 { | |
1787 if (lw->split_images[i]) | |
1788 { | |
1789 gtk_widget_unref(lw->split_images[i]->widget); | |
1790 lw->split_images[i] = NULL; | |
1791 } | |
1792 } | |
152 | 1793 |
175 | 1794 |
152 | 1795 layout_image_activate(lw, 0); |
127 | 1796 |
1797 lw->split_image_widget = lw->split_images[0]->widget; | |
1798 | |
1799 return lw->split_image_widget; | |
9 | 1800 } |
1801 | |
127 | 1802 GtkWidget *layout_image_setup_split_hv(LayoutWindow *lw, gboolean horizontal) |
1803 { | |
1804 GtkWidget *paned; | |
1805 gint i; | |
152 | 1806 |
1807 lw->split_mode = horizontal ? SPLIT_HOR : SPLIT_VERT; | |
127 | 1808 |
1809 if (!lw->split_images[0]) | |
1810 { | |
1811 layout_image_new(lw, 0); | |
1812 } | |
175 | 1813 image_set_frame(lw->split_images[0], 1); |
1814 image_set_selectable(lw->split_images[0], 1); | |
127 | 1815 |
1816 if (!lw->split_images[1]) | |
1817 { | |
1818 layout_image_new(lw, 1); | |
175 | 1819 image_set_frame(lw->split_images[1], 1); |
1820 image_set_selectable(lw->split_images[1], 1); | |
127 | 1821 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1822 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1823 gdouble sx, sy; |
138 | 1824 image_change_fd(lw->split_images[1], |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1825 image_get_fd(lw->image), image_zoom_get(lw->image)); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1826 image_get_scroll_center(lw->image, &sx, &sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1827 image_set_scroll_center(lw->split_images[1], sx, sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1828 } |
127 | 1829 layout_image_deactivate(lw, 1); |
152 | 1830 layout_image_activate(lw, 0); |
127 | 1831 } |
175 | 1832 else |
1833 { | |
1834 image_set_frame(lw->split_images[1], 1); | |
1835 image_set_selectable(lw->split_images[1], 1); | |
1836 } | |
127 | 1837 |
1838 | |
1839 for (i=2; i < MAX_SPLIT_IMAGES; i++) | |
1840 { | |
1841 if (lw->split_images[i]) | |
1842 { | |
1843 gtk_widget_unref(lw->split_images[i]->widget); | |
1844 lw->split_images[i] = NULL; | |
1845 } | |
1846 } | |
1847 | |
1848 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 1) | |
1849 { | |
1850 layout_image_activate(lw, 0); | |
1851 } | |
1852 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1853 /* horizontal split means vpaned and vice versa */ |
127 | 1854 if (horizontal) |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1855 paned = gtk_vpaned_new (); |
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1856 else |
127 | 1857 paned = gtk_hpaned_new (); |
1858 | |
1859 gtk_paned_pack1 (GTK_PANED (paned), lw->split_images[0]->widget, TRUE, TRUE); | |
1860 gtk_paned_pack2 (GTK_PANED (paned), lw->split_images[1]->widget, TRUE, TRUE); | |
1861 | |
1862 gtk_widget_show (lw->split_images[0]->widget); | |
1863 gtk_widget_show (lw->split_images[1]->widget); | |
1864 | |
1865 | |
1866 lw->split_image_widget = paned; | |
1867 | |
1868 return lw->split_image_widget; | |
1869 | |
1870 } | |
1871 | |
1872 GtkWidget *layout_image_setup_split_quad(LayoutWindow *lw) | |
1873 { | |
1874 GtkWidget *hpaned; | |
1875 GtkWidget *vpaned1; | |
1876 GtkWidget *vpaned2; | |
1877 gint i; | |
1878 | |
152 | 1879 lw->split_mode = SPLIT_QUAD; |
1880 | |
127 | 1881 if (!lw->split_images[0]) |
1882 { | |
1883 layout_image_new(lw, 0); | |
152 | 1884 } |
1885 | |
175 | 1886 image_set_frame(lw->split_images[0], 1); |
1887 image_set_selectable(lw->split_images[0], 1); | |
1888 | |
152 | 1889 if (!lw->split_images[1]) |
1890 { | |
127 | 1891 layout_image_activate(lw, 0); |
1892 } | |
1893 | |
1894 for (i=1; i < 4; i++) | |
1895 if (!lw->split_images[i]) | |
1896 { | |
1897 layout_image_new(lw, i); | |
175 | 1898 image_set_frame(lw->split_images[i], 1); |
1899 image_set_selectable(lw->split_images[i], 1); | |
127 | 1900 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1901 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1902 gdouble sx, sy; |
138 | 1903 image_change_fd(lw->split_images[i], |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1904 image_get_fd(lw->image), image_zoom_get(lw->image)); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1905 image_get_scroll_center(lw->image, &sx, &sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1906 image_set_scroll_center(lw->split_images[i], sx, sy); |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1907 } |
127 | 1908 layout_image_deactivate(lw, i); |
1909 } | |
175 | 1910 else |
1911 { | |
1912 image_set_frame(lw->split_images[i], 1); | |
1913 image_set_selectable(lw->split_images[i], 1); | |
1914 } | |
127 | 1915 |
1916 for (i=4; i < MAX_SPLIT_IMAGES; i++) | |
1917 { | |
1918 if (lw->split_images[i]) | |
1919 { | |
1920 gtk_widget_unref(lw->split_images[i]->widget); | |
1921 lw->split_images[i] = NULL; | |
1922 } | |
1923 } | |
1924 | |
174 | 1925 |
127 | 1926 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 3) |
1927 { | |
1928 layout_image_activate(lw, 0); | |
1929 } | |
1930 | |
1931 hpaned = gtk_hpaned_new (); | |
1932 vpaned1 = gtk_vpaned_new (); | |
1933 vpaned2 = gtk_vpaned_new (); | |
1934 | |
1935 gtk_paned_pack1 (GTK_PANED (vpaned1), lw->split_images[0]->widget, TRUE, TRUE); | |
1936 gtk_paned_pack2 (GTK_PANED (vpaned1), lw->split_images[2]->widget, TRUE, TRUE); | |
1937 | |
1938 gtk_paned_pack1 (GTK_PANED (vpaned2), lw->split_images[1]->widget, TRUE, TRUE); | |
1939 gtk_paned_pack2 (GTK_PANED (vpaned2), lw->split_images[3]->widget, TRUE, TRUE); | |
1940 | |
1941 gtk_paned_pack1 (GTK_PANED (hpaned), vpaned1, TRUE, TRUE); | |
1942 gtk_paned_pack2 (GTK_PANED (hpaned), vpaned2, TRUE, TRUE); | |
1943 | |
1944 | |
1945 for (i=0; i < 4; i++) | |
1946 gtk_widget_show (lw->split_images[i]->widget); | |
1947 gtk_widget_show (vpaned1); | |
1948 gtk_widget_show (vpaned2); | |
1949 | |
1950 | |
1951 lw->split_image_widget = hpaned; | |
1952 | |
1953 return lw->split_image_widget; | |
1954 | |
1955 } | |
1956 | |
1957 GtkWidget *layout_image_setup_split(LayoutWindow *lw, ImageSplitMode mode) | |
1958 { | |
1959 switch (mode) | |
1960 { | |
1961 case SPLIT_HOR: | |
1962 return layout_image_setup_split_hv(lw, TRUE); | |
1963 case SPLIT_VERT: | |
1964 return layout_image_setup_split_hv(lw, FALSE); | |
1965 case SPLIT_QUAD: | |
1966 return layout_image_setup_split_quad(lw); | |
1967 case SPLIT_NONE: | |
1968 default: | |
1969 return layout_image_setup_split_none(lw); | |
1970 } | |
1971 } | |
1972 | |
1973 | |
9 | 1974 /* |
1975 *----------------------------------------------------------------------------- | |
1976 * maintenance (for rename, move, remove) | |
1977 *----------------------------------------------------------------------------- | |
1978 */ | |
1979 | |
138 | 1980 void layout_image_maint_renamed(LayoutWindow *lw, FileData *fd) |
9 | 1981 { |
138 | 1982 FileData *img_fd; |
9 | 1983 |
138 | 1984 img_fd = layout_image_get_fd(lw); |
1985 if (img_fd == fd) | |
9 | 1986 { |
138 | 1987 image_set_fd(lw->image, fd); |
9 | 1988 layout_bars_maint_renamed(lw); |
1989 } | |
1990 } | |
1991 | |
138 | 1992 void layout_image_maint_removed(LayoutWindow *lw, FileData *fd) |
9 | 1993 { |
138 | 1994 FileData *img_fd; |
9 | 1995 |
138 | 1996 img_fd = layout_image_get_fd(lw); |
1997 if (img_fd == fd) | |
9 | 1998 { |
1999 CollectionData *cd; | |
2000 CollectInfo *info; | |
2001 | |
2002 cd = image_get_collection(lw->image, &info); | |
2003 if (cd && info) | |
2004 { | |
2005 CollectInfo *new; | |
2006 | |
2007 new = collection_next_by_info(cd, info); | |
2008 if (!new) new = collection_prev_by_info(cd, info); | |
2009 | |
2010 if (new) | |
2011 { | |
2012 layout_image_set_collection(lw, cd, new); | |
2013 return; | |
2014 } | |
2015 } | |
2016 | |
138 | 2017 layout_image_set_fd(lw, NULL); |
9 | 2018 } |
2019 } | |
2020 | |
138 | 2021 void layout_image_maint_moved(LayoutWindow *lw, FileData *fd) |
9 | 2022 { |
138 | 2023 layout_image_maint_renamed(lw, fd); |
9 | 2024 } |
2025 |