Mercurial > geeqie
annotate src/layout_image.c @ 759:362c9a769bb7
use fputs instead of printf - patch by Uwe Ohse
author | nadvornik |
---|---|
date | Mon, 26 May 2008 18:22:08 +0000 |
parents | 477f48ba28d8 |
children | d6a7fb4b8e7c |
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, | |
445 layout_list_get_index(lw, layout_image_get_path(lw)), | |
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; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
708 const gchar *path; |
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 |
368
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
712 path = layout_image_get_path(lw); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
713 if (path) layout_set_path(lw, path); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
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 |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
721 if (!path || !layout_valid(&lw) || !lw->path) return FALSE; |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
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); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
724 ret = (strcmp(lw->path, dirname) == 0); |
95fe470440ad
New Go to directory view feature that permits to find and display the directory
zas_
parents:
339
diff
changeset
|
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; | |
890 | |
138 | 891 base = remove_level_from_path(fd->path); |
9 | 892 if (strcmp(base, layout_get_path(lw)) != 0) |
893 { | |
894 layout_set_path(lw, base); | |
895 } | |
896 g_free(base); | |
897 | |
138 | 898 row = layout_list_get_index(lw, fd->path); |
9 | 899 if (source && info_list) |
900 { | |
901 layout_image_set_collection(lw, source, info_list->data); | |
902 } | |
903 else if (row == -1) | |
904 { | |
138 | 905 layout_image_set_fd(lw, fd); |
9 | 906 } |
907 else | |
908 { | |
909 layout_image_set_index(lw, row); | |
910 } | |
911 } | |
138 | 912 else if (isdir(fd->path)) |
9 | 913 { |
138 | 914 layout_set_path(lw, fd->path); |
915 layout_image_set_fd(lw, NULL); | |
9 | 916 } |
917 } | |
918 | |
138 | 919 filelist_free(list); |
9 | 920 g_list_free(info_list); |
921 } | |
922 } | |
923 | |
924 static void layout_image_dnd_get(GtkWidget *widget, GdkDragContext *context, | |
925 GtkSelectionData *selection_data, guint info, | |
926 guint time, gpointer data) | |
927 { | |
928 LayoutWindow *lw = data; | |
138 | 929 FileData *fd; |
127 | 930 gint i; |
442 | 931 |
932 | |
520 | 933 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
127 | 934 { |
935 if (lw->split_images[i] && lw->split_images[i]->pr == widget) | |
936 break; | |
937 } | |
938 if (i < MAX_SPLIT_IMAGES) | |
939 { | |
506
fc9c8a3e1a8b
Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents:
497
diff
changeset
|
940 DEBUG_1("dnd get from %d", i); |
138 | 941 fd = image_get_fd(lw->split_images[i]); |
127 | 942 } |
943 else | |
138 | 944 fd = layout_image_get_fd(lw); |
9 | 945 |
138 | 946 if (fd) |
9 | 947 { |
948 gchar *text = NULL; | |
949 gint len; | |
950 gint plain_text; | |
951 GList *list; | |
952 | |
953 switch (info) | |
954 { | |
955 case TARGET_URI_LIST: | |
956 plain_text = FALSE; | |
957 break; | |
958 case TARGET_TEXT_PLAIN: | |
959 default: | |
960 plain_text = TRUE; | |
961 break; | |
962 } | |
138 | 963 list = g_list_append(NULL, fd); |
964 text = uri_text_from_filelist(list, &len, plain_text); | |
9 | 965 g_list_free(list); |
966 if (text) | |
967 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
968 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
|
969 8, (guchar *)text, len); |
9 | 970 g_free(text); |
971 } | |
972 } | |
973 else | |
974 { | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
975 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
|
976 8, NULL, 0); |
9 | 977 } |
978 } | |
979 | |
980 static void layout_image_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data) | |
981 { | |
982 LayoutWindow *lw = data; | |
983 if (context->action == GDK_ACTION_MOVE) | |
984 { | |
985 const gchar *path; | |
986 gint row; | |
987 | |
988 path = layout_image_get_path(lw); | |
989 row = layout_list_get_index(lw, path); | |
990 if (row < 0) return; | |
991 | |
992 if (!isfile(path)) | |
993 { | |
736 | 994 if ((guint) row < layout_list_count(lw, NULL) - 1) |
9 | 995 { |
996 layout_image_next(lw); | |
997 } | |
998 else | |
999 { | |
1000 layout_image_prev(lw); | |
1001 } | |
1002 } | |
1003 layout_refresh(lw); | |
1004 } | |
1005 } | |
1006 | |
127 | 1007 static void layout_image_dnd_init(LayoutWindow *lw, gint i) |
9 | 1008 { |
127 | 1009 ImageWindow *imd = lw->split_images[i]; |
1010 | |
1011 gtk_drag_source_set(imd->pr, GDK_BUTTON2_MASK, | |
9 | 1012 dnd_file_drag_types, dnd_file_drag_types_count, |
1013 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); | |
127 | 1014 g_signal_connect(G_OBJECT(imd->pr), "drag_data_get", |
9 | 1015 G_CALLBACK(layout_image_dnd_get), lw); |
127 | 1016 g_signal_connect(G_OBJECT(imd->pr), "drag_end", |
9 | 1017 G_CALLBACK(layout_image_dnd_end), lw); |
1018 | |
127 | 1019 gtk_drag_dest_set(imd->pr, |
9 | 1020 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, |
1021 dnd_file_drop_types, dnd_file_drop_types_count, | |
442 | 1022 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK); |
127 | 1023 g_signal_connect(G_OBJECT(imd->pr), "drag_data_received", |
9 | 1024 G_CALLBACK(layout_image_dnd_receive), lw); |
1025 } | |
1026 | |
1027 | |
1028 /* | |
1029 *---------------------------------------------------------------------------- | |
1030 * misc | |
1031 *---------------------------------------------------------------------------- | |
1032 */ | |
1033 | |
1034 void layout_image_to_root(LayoutWindow *lw) | |
1035 { | |
1036 image_to_root_window(lw->image, (image_zoom_get(lw->image) == 0)); | |
1037 } | |
1038 | |
1039 /* | |
1040 *---------------------------------------------------------------------------- | |
1041 * manipulation + accessors | |
1042 *---------------------------------------------------------------------------- | |
1043 */ | |
1044 | |
1045 void layout_image_scroll(LayoutWindow *lw, gint x, gint y) | |
1046 { | |
530
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1047 gdouble dx, dy; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1048 gint width, height, i; |
9 | 1049 if (!layout_valid(&lw)) return; |
1050 | |
1051 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
|
1052 |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1053 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
|
1054 dx = (gdouble) x / width; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1055 dy = (gdouble) y / height; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1056 |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1057 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
|
1058 { |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1059 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
|
1060 { |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1061 gdouble sx, sy; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1062 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
|
1063 sx += dx; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1064 sy += dy; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1065 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
|
1066 } |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1067 } |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1068 |
9 | 1069 } |
1070 | |
1071 void layout_image_zoom_adjust(LayoutWindow *lw, gdouble increment) | |
1072 { | |
130 | 1073 gint i; |
9 | 1074 if (!layout_valid(&lw)) return; |
1075 | |
1076 image_zoom_adjust(lw->image, increment); | |
130 | 1077 |
520 | 1078 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
130 | 1079 { |
442 | 1080 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) |
130 | 1081 image_zoom_adjust(lw->split_images[i], increment); ; |
1082 } | |
9 | 1083 } |
1084 | |
530
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1085 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
|
1086 { |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1087 gint i; |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1088 if (!layout_valid(&lw)) return; |
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 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
|
1091 |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1092 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
|
1093 { |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1094 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
|
1095 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
|
1096 } |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1097 } |
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1098 |
9 | 1099 void layout_image_zoom_set(LayoutWindow *lw, gdouble zoom) |
1100 { | |
130 | 1101 gint i; |
9 | 1102 if (!layout_valid(&lw)) return; |
1103 | |
1104 image_zoom_set(lw->image, zoom); | |
130 | 1105 |
1106 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1107 { | |
442 | 1108 if (lw->split_images[i] && lw->split_images[i] != lw->image && lw->connect_zoom) |
130 | 1109 image_zoom_set(lw->split_images[i], zoom); |
1110 } | |
9 | 1111 } |
1112 | |
1113 void layout_image_zoom_set_fill_geometry(LayoutWindow *lw, gint vertical) | |
1114 { | |
1115 if (!layout_valid(&lw)) return; | |
1116 | |
1117 image_zoom_set_fill_geometry(lw->image, vertical); | |
1118 } | |
1119 | |
1120 void layout_image_alter(LayoutWindow *lw, AlterType type) | |
1121 { | |
1122 if (!layout_valid(&lw)) return; | |
1123 | |
1124 image_alter(lw->image, type); | |
1125 } | |
1126 | |
1127 const gchar *layout_image_get_path(LayoutWindow *lw) | |
1128 { | |
1129 if (!layout_valid(&lw)) return NULL; | |
1130 | |
1131 return image_get_path(lw->image); | |
1132 } | |
1133 | |
1134 const gchar *layout_image_get_name(LayoutWindow *lw) | |
1135 { | |
1136 if (!layout_valid(&lw)) return NULL; | |
1137 | |
1138 return image_get_name(lw->image); | |
1139 } | |
1140 | |
138 | 1141 FileData *layout_image_get_fd(LayoutWindow *lw) |
1142 { | |
1143 if (!layout_valid(&lw)) return NULL; | |
1144 | |
1145 return image_get_fd(lw->image); | |
1146 } | |
1147 | |
9 | 1148 CollectionData *layout_image_get_collection(LayoutWindow *lw, CollectInfo **info) |
1149 { | |
1150 if (!layout_valid(&lw)) return NULL; | |
1151 | |
1152 return image_get_collection(lw->image, info); | |
1153 } | |
1154 | |
1155 gint layout_image_get_index(LayoutWindow *lw) | |
1156 { | |
1157 return layout_list_get_index(lw, image_get_path(lw->image)); | |
1158 } | |
1159 | |
1160 /* | |
1161 *---------------------------------------------------------------------------- | |
1162 * image changers | |
1163 *---------------------------------------------------------------------------- | |
1164 */ | |
1165 | |
138 | 1166 void layout_image_set_fd(LayoutWindow *lw, FileData *fd) |
9 | 1167 { |
131 | 1168 gdouble sx, sy; |
9 | 1169 if (!layout_valid(&lw)) return; |
1170 | |
129 | 1171 image_get_scroll_center(lw->image, &sx, &sy); |
1172 | |
334 | 1173 image_change_fd(lw->image, fd, image_zoom_get_default(lw->image, options->image.zoom_mode)); |
9 | 1174 |
129 | 1175 image_set_scroll_center(lw->image, sx, sy); |
1176 | |
138 | 1177 layout_list_sync_fd(lw, fd); |
9 | 1178 layout_image_slideshow_continue_check(lw); |
1179 layout_bars_new_image(lw); | |
1180 } | |
1181 | |
138 | 1182 void layout_image_set_with_ahead(LayoutWindow *lw, FileData *fd, FileData *read_ahead_fd) |
9 | 1183 { |
1184 if (!layout_valid(&lw)) return; | |
1185 | |
144 | 1186 /* |
1187 This should be handled at the caller: in vflist_select_image | |
1188 if (path) | |
9 | 1189 { |
1190 const gchar *old_path; | |
1191 | |
1192 old_path = layout_image_get_path(lw); | |
1193 if (old_path && strcmp(path, old_path) == 0) return; | |
1194 } | |
127 | 1195 */ |
138 | 1196 layout_image_set_fd(lw, fd); |
334 | 1197 if (options->image.enable_read_ahead) image_prebuffer_set(lw->image, read_ahead_fd); |
9 | 1198 } |
1199 | |
1200 void layout_image_set_index(LayoutWindow *lw, gint index) | |
1201 { | |
138 | 1202 FileData *fd; |
1203 FileData *read_ahead_fd; | |
9 | 1204 gint old; |
1205 | |
1206 if (!layout_valid(&lw)) return; | |
1207 | |
1208 old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
138 | 1209 fd = layout_list_get_fd(lw, index); |
9 | 1210 |
1211 if (old > index) | |
1212 { | |
138 | 1213 read_ahead_fd = layout_list_get_fd(lw, index - 1); |
9 | 1214 } |
1215 else | |
1216 { | |
138 | 1217 read_ahead_fd = layout_list_get_fd(lw, index + 1); |
9 | 1218 } |
1219 | |
220 | 1220 if (layout_selection_count(lw, 0) > 1) |
1221 { | |
1222 GList *x = layout_selection_list_by_index(lw); | |
1223 GList *y; | |
1224 GList *last; | |
1225 | |
1226 for (last = y = x; y; y = y->next) | |
1227 last = y; | |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1228 for (y = x; y && (GPOINTER_TO_INT(y->data)) != index; y = y->next) |
220 | 1229 ; |
1230 | |
1231 if (y) | |
1232 { | |
1233 gint newindex; | |
1234 | |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1235 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
|
1236 || (old == GPOINTER_TO_INT(last->data) && index == GPOINTER_TO_INT(x->data))) |
442 | 1237 { |
220 | 1238 if (y->next) |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1239 newindex = GPOINTER_TO_INT(y->next->data); |
220 | 1240 else |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1241 newindex = GPOINTER_TO_INT(x->data); |
220 | 1242 } |
1243 else | |
1244 { | |
1245 if (y->prev) | |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1246 newindex = GPOINTER_TO_INT(y->prev->data); |
220 | 1247 else |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1248 newindex = GPOINTER_TO_INT(last->data); |
220 | 1249 } |
1250 | |
1251 read_ahead_fd = layout_list_get_fd(lw, newindex); | |
1252 } | |
442 | 1253 |
220 | 1254 while (x) |
1255 x = g_list_remove(x, x->data); | |
1256 } | |
1257 | |
138 | 1258 layout_image_set_with_ahead(lw, fd, read_ahead_fd); |
9 | 1259 } |
1260 | |
1261 static void layout_image_set_collection_real(LayoutWindow *lw, CollectionData *cd, CollectInfo *info, gint forward) | |
1262 { | |
1263 if (!layout_valid(&lw)) return; | |
1264 | |
334 | 1265 image_change_from_collection(lw->image, cd, info, image_zoom_get_default(lw->image, options->image.zoom_mode)); |
1266 if (options->image.enable_read_ahead) | |
9 | 1267 { |
1268 CollectInfo *r_info; | |
1269 if (forward) | |
1270 { | |
1271 r_info = collection_next_by_info(cd, info); | |
1272 if (!r_info) r_info = collection_prev_by_info(cd, info); | |
1273 } | |
1274 else | |
1275 { | |
1276 r_info = collection_prev_by_info(cd, info); | |
1277 if (!r_info) r_info = collection_next_by_info(cd, info); | |
1278 } | |
138 | 1279 if (r_info) image_prebuffer_set(lw->image, r_info->fd); |
9 | 1280 } |
1281 | |
1282 layout_image_slideshow_continue_check(lw); | |
1283 layout_bars_new_image(lw); | |
1284 } | |
1285 | |
1286 void layout_image_set_collection(LayoutWindow *lw, CollectionData *cd, CollectInfo *info) | |
1287 { | |
1288 layout_image_set_collection_real(lw, cd, info, TRUE); | |
138 | 1289 layout_list_sync_fd(lw, layout_image_get_fd(lw)); |
9 | 1290 } |
1291 | |
1292 void layout_image_refresh(LayoutWindow *lw) | |
1293 { | |
1294 if (!layout_valid(&lw)) return; | |
1295 | |
1296 image_reload(lw->image); | |
1297 } | |
1298 | |
113
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1299 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
|
1300 gint input_type, gint screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1301 gint use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1302 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1303 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1304 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1305 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
|
1306 } |
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 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
|
1309 gint *input_type, gint *screen_type, |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1310 gint *use_image) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1311 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1312 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1313 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1314 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
|
1315 } |
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 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
|
1318 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1319 if (!layout_valid(&lw)) return; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1320 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1321 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
|
1322 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1323 if (lw->info_color) |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1324 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1325 #ifndef HAVE_LCMS |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1326 enable = FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1327 #endif |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1328 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
|
1329 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1330 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1331 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1332 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
|
1333 { |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1334 if (!layout_valid(&lw)) return FALSE; |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1335 |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1336 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
|
1337 } |
55166d93498d
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
gqview
parents:
86
diff
changeset
|
1338 |
426
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
369
diff
changeset
|
1339 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
|
1340 { |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
369
diff
changeset
|
1341 if (!layout_valid(&lw)) return FALSE; |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
369
diff
changeset
|
1342 |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
369
diff
changeset
|
1343 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
|
1344 } |
9fe0ca1b5263
show the AdobeRGB profile in the menu, indicate input profile from image
nadvornik
parents:
369
diff
changeset
|
1345 |
9 | 1346 /* |
1347 *---------------------------------------------------------------------------- | |
1348 * list walkers | |
1349 *---------------------------------------------------------------------------- | |
1350 */ | |
1351 | |
1352 void layout_image_next(LayoutWindow *lw) | |
1353 { | |
1354 gint current; | |
1355 CollectionData *cd; | |
1356 CollectInfo *info; | |
1357 | |
1358 if (!layout_valid(&lw)) return; | |
1359 | |
1360 if (layout_image_slideshow_active(lw)) | |
1361 { | |
1362 layout_image_slideshow_next(lw); | |
1363 return; | |
1364 } | |
1365 | |
220 | 1366 if (layout_selection_count(lw, 0) > 1) |
1367 { | |
1368 GList *x = layout_selection_list_by_index(lw); | |
1369 gint old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
1370 GList *y; | |
1371 | |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1372 for (y = x; y && (GPOINTER_TO_INT(y->data)) != old; y = y->next) |
220 | 1373 ; |
1374 if (y) | |
1375 { | |
442 | 1376 if (y->next) |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1377 layout_image_set_index(lw, GPOINTER_TO_INT(y->next->data)); |
442 | 1378 else |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1379 layout_image_set_index(lw, GPOINTER_TO_INT(x->data)); |
220 | 1380 } |
1381 while (x) | |
1382 x = g_list_remove(x, x->data); | |
1383 if (y) /* not dereferenced */ | |
1384 return; | |
1385 } | |
1386 | |
9 | 1387 cd = image_get_collection(lw->image, &info); |
1388 | |
1389 if (cd && info) | |
1390 { | |
1391 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
|
1392 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1393 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1394 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
|
1395 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1396 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1397 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1398 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
|
1399 } |
9 | 1400 return; |
1401 } | |
1402 | |
1403 current = layout_image_get_index(lw); | |
1404 | |
1405 if (current >= 0) | |
1406 { | |
736 | 1407 if ((guint) current < layout_list_count(lw, NULL) - 1) |
9 | 1408 { |
1409 layout_image_set_index(lw, current + 1); | |
1410 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1411 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1412 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1413 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
|
1414 } |
9 | 1415 } |
1416 else | |
1417 { | |
1418 layout_image_set_index(lw, 0); | |
1419 } | |
1420 } | |
1421 | |
1422 void layout_image_prev(LayoutWindow *lw) | |
1423 { | |
1424 gint current; | |
1425 CollectionData *cd; | |
1426 CollectInfo *info; | |
1427 | |
1428 if (!layout_valid(&lw)) return; | |
1429 | |
1430 if (layout_image_slideshow_active(lw)) | |
1431 { | |
1432 layout_image_slideshow_prev(lw); | |
1433 return; | |
1434 } | |
1435 | |
220 | 1436 if (layout_selection_count(lw, 0) > 1) |
1437 { | |
1438 GList *x = layout_selection_list_by_index(lw); | |
1439 gint old = layout_list_get_index(lw, layout_image_get_path(lw)); | |
1440 GList *y; | |
1441 GList *last; | |
1442 | |
1443 for (last = y = x; y; y = y->next) | |
1444 last = y; | |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1445 for (y = x; y && (GPOINTER_TO_INT(y->data)) != old; y = y->next) |
220 | 1446 ; |
1447 if (y) | |
1448 { | |
442 | 1449 if (y->prev) |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1450 layout_image_set_index(lw, GPOINTER_TO_INT(y->prev->data)); |
220 | 1451 else |
529
8815fea478ee
fix warning cast from pointer to integer of different size (when an integer is
bruclik
parents:
520
diff
changeset
|
1452 layout_image_set_index(lw, GPOINTER_TO_INT(last->data)); |
220 | 1453 } |
1454 while (x) | |
1455 x = g_list_remove(x, x->data); | |
1456 if (y) /* not dereferenced */ | |
1457 return; | |
1458 } | |
1459 | |
9 | 1460 cd = image_get_collection(lw->image, &info); |
1461 | |
1462 if (cd && info) | |
1463 { | |
1464 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
|
1465 if (info) |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1466 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1467 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
|
1468 } |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1469 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1470 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1471 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
|
1472 } |
9 | 1473 return; |
1474 } | |
1475 | |
1476 current = layout_image_get_index(lw); | |
1477 | |
1478 if (current >= 0) | |
1479 { | |
1480 if (current > 0) | |
1481 { | |
1482 layout_image_set_index(lw, current - 1); | |
1483 } | |
122
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1484 else |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1485 { |
e2a8b7f2165b
Sat Dec 2 16:44:48 2006 John Ellis <johne@verizon.net>
gqview
parents:
117
diff
changeset
|
1486 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
|
1487 } |
9 | 1488 } |
1489 else | |
1490 { | |
1491 layout_image_set_index(lw, layout_list_count(lw, NULL) - 1); | |
1492 } | |
1493 } | |
1494 | |
1495 void layout_image_first(LayoutWindow *lw) | |
1496 { | |
1497 gint current; | |
1498 CollectionData *cd; | |
1499 CollectInfo *info; | |
1500 | |
1501 if (!layout_valid(&lw)) return; | |
1502 | |
1503 cd = image_get_collection(lw->image, &info); | |
1504 | |
1505 if (cd && info) | |
1506 { | |
1507 CollectInfo *new; | |
1508 new = collection_get_first(cd); | |
1509 if (new != info) layout_image_set_collection_real(lw, cd, new, TRUE); | |
1510 return; | |
1511 } | |
1512 | |
1513 current = layout_image_get_index(lw); | |
1514 if (current != 0 && layout_list_count(lw, NULL) > 0) | |
1515 { | |
1516 layout_image_set_index(lw, 0); | |
1517 } | |
1518 } | |
1519 | |
1520 void layout_image_last(LayoutWindow *lw) | |
1521 { | |
1522 gint current; | |
1523 gint count; | |
1524 CollectionData *cd; | |
1525 CollectInfo *info; | |
1526 | |
1527 if (!layout_valid(&lw)) return; | |
1528 | |
1529 cd = image_get_collection(lw->image, &info); | |
1530 | |
1531 if (cd && info) | |
1532 { | |
1533 CollectInfo *new; | |
1534 new = collection_get_last(cd); | |
1535 if (new != info) layout_image_set_collection_real(lw, cd, new, FALSE); | |
1536 return; | |
1537 } | |
1538 | |
1539 current = layout_image_get_index(lw); | |
1540 count = layout_list_count(lw, NULL); | |
1541 if (current != count - 1 && count > 0) | |
1542 { | |
1543 layout_image_set_index(lw, count - 1); | |
1544 } | |
1545 } | |
1546 | |
1547 /* | |
1548 *---------------------------------------------------------------------------- | |
1549 * mouse callbacks | |
1550 *---------------------------------------------------------------------------- | |
1551 */ | |
1552 | |
127 | 1553 static gint image_idx(LayoutWindow *lw, ImageWindow *imd) |
1554 { | |
1555 gint i; | |
442 | 1556 |
520 | 1557 for (i = 0; i < MAX_SPLIT_IMAGES; i++) |
127 | 1558 { |
1559 if (lw->split_images[i] == imd) | |
1560 break; | |
1561 } | |
1562 if (i < MAX_SPLIT_IMAGES) | |
1563 { | |
1564 return i; | |
1565 } | |
1566 return -1; | |
1567 } | |
1568 | |
1569 | |
9 | 1570 static void layout_image_button_cb(ImageWindow *imd, gint button, guint32 time, |
1571 gdouble x, gdouble y, guint state, gpointer data) | |
1572 { | |
1573 LayoutWindow *lw = data; | |
1574 GtkWidget *menu; | |
1575 | |
1576 switch (button) | |
1577 { | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
1578 case MOUSE_BUTTON_LEFT: |
9 | 1579 layout_image_next(lw); |
1580 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
1581 case MOUSE_BUTTON_MIDDLE: |
9 | 1582 layout_image_prev(lw); |
1583 break; | |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
1584 case MOUSE_BUTTON_RIGHT: |
9 | 1585 menu = layout_image_pop_menu(lw); |
1586 if (imd == lw->image) | |
1587 { | |
1588 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); | |
1589 } | |
1590 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, time); | |
1591 break; | |
1592 default: | |
1593 break; | |
1594 } | |
1595 } | |
1596 | |
1597 static void layout_image_scroll_cb(ImageWindow *imd, GdkScrollDirection direction, guint32 time, | |
1598 gdouble x, gdouble y, guint state, gpointer data) | |
1599 { | |
1600 LayoutWindow *lw = data; | |
1601 | |
127 | 1602 gint i = image_idx(lw, imd); |
442 | 1603 |
127 | 1604 if (i != -1) |
1605 { | |
506
fc9c8a3e1a8b
Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents:
497
diff
changeset
|
1606 DEBUG_1("image activate scroll %d", i); |
127 | 1607 layout_image_activate(lw, i); |
1608 } | |
1609 | |
1610 | |
9 | 1611 if (state & GDK_CONTROL_MASK) |
1612 { | |
1613 switch (direction) | |
1614 { | |
1615 case GDK_SCROLL_UP: | |
530
1d67ef911fa8
fixed connected zoom and scroll that didn't work in some cases
nadvornik
parents:
529
diff
changeset
|
1616 layout_image_zoom_adjust_at_point(lw, get_zoom_increment(), x, y); |
9 | 1617 break; |
1618 case GDK_SCROLL_DOWN: | |
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 default: | |
1622 break; | |
1623 } | |
1624 } | |
736 | 1625 else if ( (state & GDK_SHIFT_MASK) != (guint) (options->mousewheel_scrolls)) |
9 | 1626 { |
1627 switch (direction) | |
1628 { | |
1629 case GDK_SCROLL_UP: | |
1630 image_scroll(imd, 0, -MOUSEWHEEL_SCROLL_SIZE); | |
1631 break; | |
1632 case GDK_SCROLL_DOWN: | |
1633 image_scroll(imd, 0, MOUSEWHEEL_SCROLL_SIZE); | |
1634 break; | |
1635 case GDK_SCROLL_LEFT: | |
1636 image_scroll(imd, -MOUSEWHEEL_SCROLL_SIZE, 0); | |
1637 break; | |
1638 case GDK_SCROLL_RIGHT: | |
1639 image_scroll(imd, MOUSEWHEEL_SCROLL_SIZE, 0); | |
1640 break; | |
1641 default: | |
1642 break; | |
1643 } | |
1644 } | |
1645 else | |
1646 { | |
1647 switch (direction) | |
1648 { | |
1649 case GDK_SCROLL_UP: | |
1650 layout_image_prev(lw); | |
1651 break; | |
1652 case GDK_SCROLL_DOWN: | |
1653 layout_image_next(lw); | |
1654 break; | |
1655 default: | |
1656 break; | |
1657 } | |
1658 } | |
1659 } | |
1660 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1661 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
|
1662 gdouble x, gdouble y, guint state, gdouble dx, gdouble dy, gpointer data) |
127 | 1663 { |
1664 gint i; | |
1665 LayoutWindow *lw = data; | |
1666 | |
1667 | |
1668 for (i=0; i < MAX_SPLIT_IMAGES; i++) | |
1669 { | |
1670 if (lw->split_images[i] && lw->split_images[i] != imd) | |
442 | 1671 if (lw->connect_scroll) |
129 | 1672 { |
131 | 1673 gdouble sx, sy; |
1674 if (state & GDK_CONTROL_MASK) | |
129 | 1675 { |
1676 image_get_scroll_center(imd, &sx, &sy); | |
1677 } | |
442 | 1678 else |
129 | 1679 { |
1680 image_get_scroll_center(lw->split_images[i], &sx, &sy); | |
1681 sx += dx; | |
1682 sy += dy; | |
1683 } | |
1684 image_set_scroll_center(lw->split_images[i], sx, sy); | |
1685 } | |
127 | 1686 } |
1687 } | |
1688 | |
1689 static void layout_image_button_inactive_cb(ImageWindow *imd, gint button, guint32 time, | |
1690 gdouble x, gdouble y, guint state, gpointer data) | |
1691 { | |
1692 LayoutWindow *lw = data; | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1693 GtkWidget *menu; |
127 | 1694 gint i = image_idx(lw, imd); |
442 | 1695 |
127 | 1696 if (i != -1) |
1697 { | |
1698 layout_image_activate(lw, i); | |
1699 } | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1700 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1701 switch (button) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1702 { |
448
a73cc0fa14d0
Use explicit names for mouse buttons instead of numbers.
zas_
parents:
446
diff
changeset
|
1703 case MOUSE_BUTTON_RIGHT: |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1704 menu = layout_image_pop_menu(lw); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1705 if (imd == lw->image) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1706 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1707 g_object_set_data(G_OBJECT(menu), "click_parent", imd->widget); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1708 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1709 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
|
1710 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1711 default: |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1712 break; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1713 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1714 |
127 | 1715 } |
1716 | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1717 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
|
1718 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
|
1719 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1720 LayoutWindow *lw = data; |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1721 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1722 gint i = image_idx(lw, imd); |
442 | 1723 |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1724 if (i != -1) |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1725 { |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1726 layout_image_activate(lw, i); |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1727 } |
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 |
129 | 1730 /* continue as with active image */ |
1731 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
|
1732 } |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1733 |
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1734 |
9 | 1735 static void layout_image_set_buttons(LayoutWindow *lw) |
1736 { | |
1737 image_set_button_func(lw->image, layout_image_button_cb, lw); | |
1738 image_set_scroll_func(lw->image, layout_image_scroll_cb, lw); | |
1739 } | |
1740 | |
127 | 1741 static void layout_image_set_buttons_inactive(LayoutWindow *lw, gint i) |
1742 { | |
1743 image_set_button_func(lw->split_images[i], layout_image_button_inactive_cb, lw); | |
1744 image_set_scroll_func(lw->split_images[i], layout_image_scroll_cb, lw); | |
1745 } | |
1746 | |
9 | 1747 /* |
1748 *---------------------------------------------------------------------------- | |
1749 * setup | |
1750 *---------------------------------------------------------------------------- | |
1751 */ | |
1752 | |
1753 static void layout_image_update_cb(ImageWindow *imd, gpointer data) | |
1754 { | |
1755 LayoutWindow *lw = data; | |
1756 layout_status_update_image(lw); | |
1757 } | |
1758 | |
127 | 1759 GtkWidget *layout_image_new(LayoutWindow *lw, gint i) |
9 | 1760 { |
442 | 1761 if (!lw->split_images[i]) |
9 | 1762 { |
127 | 1763 lw->split_images[i] = image_new(TRUE); |
1764 | |
1765 gtk_widget_ref(lw->split_images[i]->widget); | |
9 | 1766 |
339
de1c2cd06fce
Rename user_specified_window_background and window_background_color
zas_
parents:
334
diff
changeset
|
1767 image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL); |
9 | 1768 |
207 | 1769 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
|
1770 |
127 | 1771 layout_image_dnd_init(lw, i); |
207 | 1772 image_color_profile_set(lw->split_images[i], |
327 | 1773 options->color_profile.input_type, |
1774 options->color_profile.screen_type, | |
1775 options->color_profile.use_image); | |
1776 image_color_profile_set_use(lw->split_images[i], options->color_profile.enabled); | |
9 | 1777 } |
1778 | |
127 | 1779 return lw->split_images[i]->widget; |
1780 } | |
1781 | |
1782 void layout_image_deactivate(LayoutWindow *lw, gint i) | |
1783 { | |
1784 | |
1785 if (!lw->split_images[i]) return; | |
1786 image_set_update_func(lw->split_images[i], NULL, NULL); | |
1787 layout_image_set_buttons_inactive(lw, i); | |
129 | 1788 image_set_drag_func(lw->split_images[i], layout_image_drag_inactive_cb, lw); |
127 | 1789 |
1790 image_attach_window(lw->split_images[i], NULL, NULL, NULL, FALSE); | |
1791 image_select(lw->split_images[i], FALSE); | |
1792 } | |
1793 | |
1794 | |
1795 void layout_image_activate(LayoutWindow *lw, gint i) | |
1796 { | |
138 | 1797 FileData *fd; |
442 | 1798 |
127 | 1799 if (!lw->split_images[i]) return; |
1800 | |
1801 /* deactivate currently active */ | |
1802 if (lw->active_split_image != i) | |
1803 layout_image_deactivate(lw, lw->active_split_image); | |
1804 | |
1805 lw->image = lw->split_images[i]; | |
1806 lw->active_split_image = i; | |
442 | 1807 |
127 | 1808 image_set_update_func(lw->image, layout_image_update_cb, lw); |
1809 layout_image_set_buttons(lw); | |
128
98e2632b5d3d
improved connected scroll and active image switching
nadvornik
parents:
127
diff
changeset
|
1810 image_set_drag_func(lw->image, layout_image_drag_cb, lw); |
127 | 1811 |
288
d1f74154463e
Replace occurences of Geeqie / geeqie by constants defined in main.h.
zas_
parents:
281
diff
changeset
|
1812 image_attach_window(lw->image, lw->window, NULL, GQ_APPNAME, FALSE); |
127 | 1813 |
152 | 1814 /* do not hilight selected image in SPLIT_NONE */ |
1815 /* maybe the image should be selected always and hilight should be controled by | |
1816 another image option */ | |
1817 if (lw->split_mode != SPLIT_NONE) | |
1818 image_select(lw->split_images[i], TRUE); | |
1819 else | |
1820 image_select(lw->split_images[i], FALSE); | |
127 | 1821 |
138 | 1822 fd = image_get_fd(lw->image); |
127 | 1823 |
442 | 1824 if (fd) |
127 | 1825 { |
1826 // layout_list_sync_path(lw, path); | |
138 | 1827 layout_set_path(lw, fd->path); |
127 | 1828 } |
1829 } | |
1830 | |
1831 | |
1832 GtkWidget *layout_image_setup_split_none(LayoutWindow *lw) | |
1833 { | |
1834 gint i; | |
442 | 1835 |
152 | 1836 lw->split_mode = SPLIT_NONE; |
1837 | |
127 | 1838 if (!lw->split_images[0]) |
1839 { | |
1840 layout_image_new(lw, 0); | |
175 | 1841 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); |
1842 image_set_selectable(lw->split_images[0], 0); | |
127 | 1843 layout_image_activate(lw, 0); |
1844 } | |
175 | 1845 else |
1846 { | |
1847 image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden)); | |
1848 image_set_selectable(lw->split_images[0], 0); | |
1849 } | |
442 | 1850 |
520 | 1851 for (i = 1; i < MAX_SPLIT_IMAGES; i++) |
127 | 1852 { |
1853 if (lw->split_images[i]) | |
1854 { | |
1855 gtk_widget_unref(lw->split_images[i]->widget); | |
1856 lw->split_images[i] = NULL; | |
1857 } | |
1858 } | |
152 | 1859 |
175 | 1860 |
152 | 1861 layout_image_activate(lw, 0); |
442 | 1862 |
127 | 1863 lw->split_image_widget = lw->split_images[0]->widget; |
442 | 1864 |
127 | 1865 return lw->split_image_widget; |
9 | 1866 } |
1867 | |
127 | 1868 GtkWidget *layout_image_setup_split_hv(LayoutWindow *lw, gboolean horizontal) |
1869 { | |
1870 GtkWidget *paned; | |
1871 gint i; | |
152 | 1872 |
1873 lw->split_mode = horizontal ? SPLIT_HOR : SPLIT_VERT; | |
442 | 1874 |
127 | 1875 if (!lw->split_images[0]) |
1876 { | |
1877 layout_image_new(lw, 0); | |
1878 } | |
175 | 1879 image_set_frame(lw->split_images[0], 1); |
1880 image_set_selectable(lw->split_images[0], 1); | |
127 | 1881 |
1882 if (!lw->split_images[1]) | |
1883 { | |
1884 layout_image_new(lw, 1); | |
175 | 1885 image_set_frame(lw->split_images[1], 1); |
1886 image_set_selectable(lw->split_images[1], 1); | |
127 | 1887 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1888 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1889 gdouble sx, sy; |
442 | 1890 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
|
1891 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
|
1892 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
|
1893 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
|
1894 } |
127 | 1895 layout_image_deactivate(lw, 1); |
152 | 1896 layout_image_activate(lw, 0); |
127 | 1897 } |
175 | 1898 else |
1899 { | |
1900 image_set_frame(lw->split_images[1], 1); | |
1901 image_set_selectable(lw->split_images[1], 1); | |
1902 } | |
127 | 1903 |
442 | 1904 |
520 | 1905 for (i = 2; i < MAX_SPLIT_IMAGES; i++) |
127 | 1906 { |
1907 if (lw->split_images[i]) | |
1908 { | |
1909 gtk_widget_unref(lw->split_images[i]->widget); | |
1910 lw->split_images[i] = NULL; | |
1911 } | |
1912 } | |
1913 | |
442 | 1914 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 1) |
127 | 1915 { |
1916 layout_image_activate(lw, 0); | |
1917 } | |
1918 | |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1919 /* horizontal split means vpaned and vice versa */ |
127 | 1920 if (horizontal) |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1921 paned = gtk_vpaned_new(); |
156
dd6dc0a55d3d
better integration of split image functions into menu
nadvornik
parents:
153
diff
changeset
|
1922 else |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1923 paned = gtk_hpaned_new(); |
127 | 1924 |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1925 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
|
1926 gtk_paned_pack2(GTK_PANED(paned), lw->split_images[1]->widget, TRUE, TRUE); |
442 | 1927 |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1928 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
|
1929 gtk_widget_show(lw->split_images[1]->widget); |
442 | 1930 |
127 | 1931 |
1932 lw->split_image_widget = paned; | |
442 | 1933 |
127 | 1934 return lw->split_image_widget; |
1935 | |
1936 } | |
1937 | |
1938 GtkWidget *layout_image_setup_split_quad(LayoutWindow *lw) | |
1939 { | |
1940 GtkWidget *hpaned; | |
1941 GtkWidget *vpaned1; | |
1942 GtkWidget *vpaned2; | |
1943 gint i; | |
442 | 1944 |
152 | 1945 lw->split_mode = SPLIT_QUAD; |
1946 | |
127 | 1947 if (!lw->split_images[0]) |
1948 { | |
1949 layout_image_new(lw, 0); | |
152 | 1950 } |
1951 | |
175 | 1952 image_set_frame(lw->split_images[0], 1); |
1953 image_set_selectable(lw->split_images[0], 1); | |
1954 | |
152 | 1955 if (!lw->split_images[1]) |
1956 { | |
127 | 1957 layout_image_activate(lw, 0); |
1958 } | |
1959 | |
520 | 1960 for (i = 1; i < 4; i++) |
127 | 1961 if (!lw->split_images[i]) |
1962 { | |
1963 layout_image_new(lw, i); | |
175 | 1964 image_set_frame(lw->split_images[i], 1); |
1965 image_set_selectable(lw->split_images[i], 1); | |
127 | 1966 if (lw->image) |
153
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1967 { |
0e54267762f6
fixed copying zoom an scroll values from the original image on splitting
nadvornik
parents:
152
diff
changeset
|
1968 gdouble sx, sy; |
442 | 1969 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
|
1970 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
|
1971 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
|
1972 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
|
1973 } |
127 | 1974 layout_image_deactivate(lw, i); |
1975 } | |
175 | 1976 else |
1977 { | |
1978 image_set_frame(lw->split_images[i], 1); | |
1979 image_set_selectable(lw->split_images[i], 1); | |
1980 } | |
127 | 1981 |
520 | 1982 for (i = 4; i < MAX_SPLIT_IMAGES; i++) |
127 | 1983 { |
1984 if (lw->split_images[i]) | |
1985 { | |
1986 gtk_widget_unref(lw->split_images[i]->widget); | |
1987 lw->split_images[i] = NULL; | |
1988 } | |
1989 } | |
1990 | |
174 | 1991 |
442 | 1992 if (!lw->image || lw->active_split_image < 0 || lw->active_split_image > 3) |
127 | 1993 { |
1994 layout_image_activate(lw, 0); | |
1995 } | |
1996 | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1997 hpaned = gtk_hpaned_new(); |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1998 vpaned1 = gtk_vpaned_new(); |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
1999 vpaned2 = gtk_vpaned_new(); |
127 | 2000 |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
2001 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
|
2002 gtk_paned_pack2(GTK_PANED(vpaned1), lw->split_images[2]->widget, TRUE, TRUE); |
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(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
|
2005 gtk_paned_pack2(GTK_PANED(vpaned2), lw->split_images[3]->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(hpaned), vpaned1, 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(hpaned), vpaned2, TRUE, TRUE); |
127 | 2009 |
442 | 2010 |
520 | 2011 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
|
2012 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
|
2013 |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
2014 gtk_widget_show(vpaned1); |
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
507
diff
changeset
|
2015 gtk_widget_show(vpaned2); |
442 | 2016 |
127 | 2017 |
2018 lw->split_image_widget = hpaned; | |
442 | 2019 |
127 | 2020 return lw->split_image_widget; |
2021 | |
2022 } | |
2023 | |
2024 GtkWidget *layout_image_setup_split(LayoutWindow *lw, ImageSplitMode mode) | |
2025 { | |
2026 switch (mode) | |
2027 { | |
442 | 2028 case SPLIT_HOR: |
127 | 2029 return layout_image_setup_split_hv(lw, TRUE); |
2030 case SPLIT_VERT: | |
2031 return layout_image_setup_split_hv(lw, FALSE); | |
2032 case SPLIT_QUAD: | |
2033 return layout_image_setup_split_quad(lw); | |
2034 case SPLIT_NONE: | |
2035 default: | |
2036 return layout_image_setup_split_none(lw); | |
2037 } | |
2038 } | |
2039 | |
2040 | |
9 | 2041 /* |
2042 *----------------------------------------------------------------------------- | |
2043 * maintenance (for rename, move, remove) | |
2044 *----------------------------------------------------------------------------- | |
2045 */ | |
2046 | |
138 | 2047 void layout_image_maint_renamed(LayoutWindow *lw, FileData *fd) |
9 | 2048 { |
138 | 2049 FileData *img_fd; |
9 | 2050 |
138 | 2051 img_fd = layout_image_get_fd(lw); |
2052 if (img_fd == fd) | |
9 | 2053 { |
138 | 2054 image_set_fd(lw->image, fd); |
9 | 2055 layout_bars_maint_renamed(lw); |
2056 } | |
2057 } | |
2058 | |
138 | 2059 void layout_image_maint_removed(LayoutWindow *lw, FileData *fd) |
9 | 2060 { |
138 | 2061 FileData *img_fd; |
9 | 2062 |
138 | 2063 img_fd = layout_image_get_fd(lw); |
2064 if (img_fd == fd) | |
9 | 2065 { |
2066 CollectionData *cd; | |
2067 CollectInfo *info; | |
2068 | |
2069 cd = image_get_collection(lw->image, &info); | |
2070 if (cd && info) | |
2071 { | |
2072 CollectInfo *new; | |
2073 | |
2074 new = collection_next_by_info(cd, info); | |
2075 if (!new) new = collection_prev_by_info(cd, info); | |
2076 | |
2077 if (new) | |
2078 { | |
2079 layout_image_set_collection(lw, cd, new); | |
2080 return; | |
2081 } | |
2082 } | |
2083 | |
138 | 2084 layout_image_set_fd(lw, NULL); |
9 | 2085 } |
2086 } | |
2087 | |
138 | 2088 void layout_image_maint_moved(LayoutWindow *lw, FileData *fd) |
9 | 2089 { |
138 | 2090 layout_image_maint_renamed(lw, fd); |
9 | 2091 } |