annotate src/layout_image.c @ 1593:2b2aa3326763

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