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