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