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