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