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