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