Mercurial > hg > forks > geeqie
annotate src/image.c @ 1916:69ab167a50f5
do not mix autodetected and user-defined stereo mode
author | Vladimir Nadvornik <nadvornik@suse.cz> |
---|---|
date | Sat, 14 May 2011 21:53:45 +0200 |
parents | 6e146fa6ec29 |
children | 4845663f466e 26dfd7a4d130 |
rev | line source |
---|---|
1 | 1 /* |
196
bdad1cacadf4
rename GQview -> Geeqie over the code
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
188
diff
changeset
|
2 * Geeqie |
115
66885b65dd84
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
114
diff
changeset
|
3 * (C) 2006 John Ellis |
1802
359d910c7ce0
added 2010 to copyright text
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1791
diff
changeset
|
4 * Copyright (C) 2008 - 2010 The Geeqie Team |
1 | 5 * |
6 * Author: John Ellis | |
7 * | |
9 | 8 * This software is released under the GNU General Public License (GNU GPL). |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
1 | 11 */ |
12 | |
9 | 13 |
281 | 14 #include "main.h" |
1 | 15 #include "image.h" |
9 | 16 |
17 | |
18 #include "collect.h" | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
19 #include "color-man.h" |
9 | 20 #include "exif.h" |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
21 #include "metadata.h" |
480
c6ba1d81cf42
Make histogram depends on image window not layout window.
Laurent Monin <geeqie@norz.org>
parents:
475
diff
changeset
|
22 #include "histogram.h" |
507
7408e89b601d
Move debug macros from main.h to new debug.h.
Laurent Monin <geeqie@norz.org>
parents:
506
diff
changeset
|
23 #include "image-load.h" |
415
7c97f17797f5
Add zoom ratio display to OSD in fullscreen mode.
Laurent Monin <geeqie@norz.org>
parents:
414
diff
changeset
|
24 #include "image-overlay.h" |
284
8dae20c78d18
Fix missing header files inclusions.
Laurent Monin <geeqie@norz.org>
parents:
281
diff
changeset
|
25 #include "layout.h" |
8dae20c78d18
Fix missing header files inclusions.
Laurent Monin <geeqie@norz.org>
parents:
281
diff
changeset
|
26 #include "layout_image.h" |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
27 #include "pixbuf-renderer.h" |
9 | 28 #include "pixbuf_util.h" |
29 #include "ui_fileops.h" | |
30 | |
586
122fc2223b42
split filelist.c to filefilter.c and filedata.c
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
530
diff
changeset
|
31 #include "filedata.h" |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
32 #include "filecache.h" |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
33 |
9 | 34 #include <math.h> |
35 | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
36 static GList *image_list = NULL; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
37 |
61
72245fb0b946
Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
42
diff
changeset
|
38 static void image_update_title(ImageWindow *imd); |
115
66885b65dd84
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
114
diff
changeset
|
39 static void image_read_ahead_start(ImageWindow *imd); |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
40 static void image_cache_set(ImageWindow *imd, FileData *fd); |
61
72245fb0b946
Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
42
diff
changeset
|
41 |
1 | 42 /* |
9 | 43 *------------------------------------------------------------------- |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
44 * 'signals' |
9 | 45 *------------------------------------------------------------------- |
46 */ | |
47 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
48 static void image_click_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data) |
9 | 49 { |
50 ImageWindow *imd = data; | |
51 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
52 if (imd->func_button) |
9 | 53 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
54 imd->func_button(imd, event, imd->data_button); |
9 | 55 } |
56 } | |
57 | |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
58 static void image_drag_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data) |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
59 { |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
60 ImageWindow *imd = data; |
129
b1ba80767864
started relative scroll, keep scroll position
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
128
diff
changeset
|
61 gint width, height; |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
62 |
129
b1ba80767864
started relative scroll, keep scroll position
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
128
diff
changeset
|
63 pixbuf_renderer_get_scaled_size(pr, &width, &height); |
442 | 64 |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
65 if (imd->func_drag) |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
66 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
67 imd->func_drag(imd, event, |
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
68 (gfloat)(pr->drag_last_x - event->x) / width, |
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
69 (gfloat)(pr->drag_last_y - event->y) / height, |
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
70 imd->data_button); |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
71 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
72 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
73 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
74 static void image_scroll_notify_cb(PixbufRenderer *pr, gpointer data) |
9 | 75 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
76 ImageWindow *imd = data; |
9 | 77 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
78 if (imd->func_scroll_notify && pr->scale) |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
79 { |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
80 imd->func_scroll_notify(imd, |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
81 (gint)((gdouble)pr->x_scroll / pr->scale), |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
82 (gint)((gdouble)pr->y_scroll / pr->scale), |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
83 (gint)((gdouble)pr->image_width - pr->vis_width / pr->scale), |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
84 (gint)((gdouble)pr->image_height - pr->vis_height / pr->scale), |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
85 imd->data_scroll_notify); |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
86 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
87 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
88 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
89 static void image_update_util(ImageWindow *imd) |
1 | 90 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
91 if (imd->func_update) imd->func_update(imd, imd->data_update); |
9 | 92 } |
93 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
94 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
95 static void image_complete_util(ImageWindow *imd, gboolean preload) |
9 | 96 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
97 if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return; |
9 | 98 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
99 DEBUG_1("%s image load completed \"%s\" (%s)", get_exec_time(), |
442 | 100 (preload) ? (imd->read_ahead_fd ? imd->read_ahead_fd->path : "null") : |
101 (imd->image_fd ? imd->image_fd->path : "null"), | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
102 (preload) ? "preload" : "current"); |
9 | 103 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
104 if (!preload) imd->completed = TRUE; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
105 if (imd->func_complete) imd->func_complete(imd, preload, imd->data_complete); |
1 | 106 } |
107 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
108 static void image_render_complete_cb(PixbufRenderer *pr, gpointer data) |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
109 { |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
110 ImageWindow *imd = data; |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
111 |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
112 image_complete_util(imd, FALSE); |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
113 } |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
114 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
115 static void image_state_set(ImageWindow *imd, ImageState state) |
9 | 116 { |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
117 if (state == IMAGE_STATE_NONE) |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
118 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
119 imd->state = state; |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
120 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
121 else |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
122 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
123 imd->state |= state; |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
124 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
125 if (imd->func_state) imd->func_state(imd, state, imd->data_state); |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
126 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
127 |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
128 static void image_state_unset(ImageWindow *imd, ImageState state) |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
129 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
130 imd->state &= ~state; |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
131 if (imd->func_state) imd->func_state(imd, state, imd->data_state); |
1 | 132 } |
133 | |
1791
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
134 static void image_zoom_cb(PixbufRenderer *pr, gdouble zoom, gpointer data) |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
135 { |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
136 ImageWindow *imd = data; |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
137 |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
138 if (imd->title_show_zoom) image_update_title(imd); |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
139 image_state_set(imd, IMAGE_STATE_IMAGE); |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
140 image_update_util(imd); |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
141 } |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
142 |
1 | 143 /* |
9 | 144 *------------------------------------------------------------------- |
145 * misc | |
146 *------------------------------------------------------------------- | |
147 */ | |
148 | |
149 static void image_update_title(ImageWindow *imd) | |
1 | 150 { |
9 | 151 gchar *title = NULL; |
152 gchar *zoom = NULL; | |
153 gchar *collection = NULL; | |
154 | |
155 if (!imd->top_window) return; | |
156 | |
157 if (imd->collection && collection_to_number(imd->collection) >= 0) | |
158 { | |
987
0f029bb4968c
Mark forgotten string for translation.
Laurent Monin <geeqie@norz.org>
parents:
954
diff
changeset
|
159 const gchar *name = imd->collection->name; |
9 | 160 if (!name) name = _("Untitled"); |
987
0f029bb4968c
Mark forgotten string for translation.
Laurent Monin <geeqie@norz.org>
parents:
954
diff
changeset
|
161 collection = g_strdup_printf(_(" (Collection %s)"), name); |
9 | 162 } |
163 | |
164 if (imd->title_show_zoom) | |
1 | 165 { |
9 | 166 gchar *buf = image_zoom_get_as_text(imd); |
167 zoom = g_strconcat(" [", buf, "]", NULL); | |
168 g_free(buf); | |
1 | 169 } |
170 | |
9 | 171 title = g_strdup_printf("%s%s%s%s%s%s", |
172 imd->title ? imd->title : "", | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
173 imd->image_fd ? imd->image_fd->name : "", |
9 | 174 zoom ? zoom : "", |
175 collection ? collection : "", | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
176 imd->image_fd ? " - " : "", |
9 | 177 imd->title_right ? imd->title_right : ""); |
178 | |
179 gtk_window_set_title(GTK_WINDOW(imd->top_window), title); | |
180 | |
181 g_free(title); | |
182 g_free(zoom); | |
183 g_free(collection); | |
184 } | |
185 | |
186 /* | |
187 *------------------------------------------------------------------- | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
188 * rotation, flip, etc. |
9 | 189 *------------------------------------------------------------------- |
190 */ | |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
191 static gboolean image_get_x11_screen_profile(ImageWindow *imd, guchar **screen_profile, gint *screen_profile_len) |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
192 { |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
193 GdkScreen *screen = gtk_widget_get_screen(imd->widget);; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
194 GdkAtom type = GDK_NONE; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
195 gint format = 0; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
196 |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
197 return (gdk_property_get(gdk_screen_get_root_window(screen), |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
198 gdk_atom_intern ("_ICC_PROFILE", FALSE), |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
199 GDK_NONE, |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
200 0, 64 * 1024 * 1024, FALSE, |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
201 &type, &format, screen_profile_len, screen_profile) && *screen_profile_len > 0); |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
202 } |
9 | 203 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
204 static gboolean image_post_process_color(ImageWindow *imd, gint start_row, gboolean run_in_bg) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
205 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
206 ColorMan *cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
207 ColorManProfileType input_type; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
208 ColorManProfileType screen_type; |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
209 const gchar *input_file = NULL; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
210 const gchar *screen_file = NULL; |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
995
diff
changeset
|
211 guchar *profile = NULL; |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
212 guint profile_len; |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
213 guchar *screen_profile = NULL; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
214 gint screen_profile_len; |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
215 ExifData *exif; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
216 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
217 if (imd->cm) return FALSE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
218 |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
219 if (imd->color_profile_input >= COLOR_PROFILE_FILE && |
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
220 imd->color_profile_input < COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
221 { |
1356
56881d66e7c8
Slightly modify access_file() and use it to test profile files existence and read access.
Laurent Monin <geeqie@norz.org>
parents:
1346
diff
changeset
|
222 const gchar *file = options->color_profile.input_file[imd->color_profile_input - COLOR_PROFILE_FILE]; |
56881d66e7c8
Slightly modify access_file() and use it to test profile files existence and read access.
Laurent Monin <geeqie@norz.org>
parents:
1346
diff
changeset
|
223 |
1362
58a1649f728b
Improve file checks using is_readable_file().
Laurent Monin <geeqie@norz.org>
parents:
1359
diff
changeset
|
224 if (!is_readable_file(file)) return FALSE; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
225 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
226 input_type = COLOR_PROFILE_FILE; |
1356
56881d66e7c8
Slightly modify access_file() and use it to test profile files existence and read access.
Laurent Monin <geeqie@norz.org>
parents:
1346
diff
changeset
|
227 input_file = file; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
228 } |
442 | 229 else if (imd->color_profile_input >= COLOR_PROFILE_SRGB && |
230 imd->color_profile_input < COLOR_PROFILE_FILE) | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
231 { |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
232 input_type = imd->color_profile_input; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
233 input_file = NULL; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
234 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
235 else |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
236 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
237 return FALSE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
238 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
239 |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
240 if (options->color_profile.use_x11_screen_profile && |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
241 image_get_x11_screen_profile(imd, &screen_profile, &screen_profile_len)) |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
242 { |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
243 screen_type = COLOR_PROFILE_MEM; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
244 DEBUG_1("Using X11 screen profile, length: %d", screen_profile_len); |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
245 } |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
246 else if (options->color_profile.screen_file && |
1362
58a1649f728b
Improve file checks using is_readable_file().
Laurent Monin <geeqie@norz.org>
parents:
1359
diff
changeset
|
247 is_readable_file(options->color_profile.screen_file)) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
248 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
249 screen_type = COLOR_PROFILE_FILE; |
327
e2fc4d9e7174
Rename color profile options.
Laurent Monin <geeqie@norz.org>
parents:
320
diff
changeset
|
250 screen_file = options->color_profile.screen_file; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
251 } |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
252 else |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
253 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
254 screen_type = COLOR_PROFILE_SRGB; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
255 screen_file = NULL; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
256 } |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
257 |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
258 |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
259 imd->color_profile_from_image = COLOR_PROFILE_NONE; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
260 |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
261 exif = exif_read_fd(imd->image_fd); |
1357
4bf8cc21b89a
image_post_process_color(): remove exif parameter, just extract it when needed.
Laurent Monin <geeqie@norz.org>
parents:
1356
diff
changeset
|
262 |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
263 if (exif) |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
264 { |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
265 profile = exif_get_color_profile(exif, &profile_len); |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
266 if (profile) |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
267 { |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
268 if (!imd->color_profile_use_image) |
424
3cbf9a9d896f
first support for AdobeRGB colorspace
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
415
diff
changeset
|
269 { |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
270 g_free(profile); |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
271 profile = NULL; |
424
3cbf9a9d896f
first support for AdobeRGB colorspace
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
415
diff
changeset
|
272 } |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
273 DEBUG_1("Found embedded color profile"); |
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
274 imd->color_profile_from_image = COLOR_PROFILE_MEM; |
115
66885b65dd84
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
114
diff
changeset
|
275 } |
1364
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
276 else |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
277 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
278 gchar *interop_index = exif_get_data_as_text(exif, "Exif.Iop.InteroperabilityIndex"); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
279 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
280 if (interop_index) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
281 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
282 /* Exif 2.21 specification */ |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
283 if (!strcmp(interop_index, "R98")) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
284 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
285 imd->color_profile_from_image = COLOR_PROFILE_SRGB; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
286 DEBUG_1("Found EXIF 2.21 ColorSpace of sRGB"); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
287 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
288 else if (!strcmp(interop_index, "R03")) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
289 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
290 imd->color_profile_from_image = COLOR_PROFILE_ADOBERGB; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
291 DEBUG_1("Found EXIF 2.21 ColorSpace of AdobeRGB"); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
292 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
293 g_free(interop_index); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
294 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
295 else |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
296 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
297 gint cs; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
298 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
299 /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */ |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
300 if (!exif_get_integer(exif, "Exif.Photo.ColorSpace", &cs)) cs = 0; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
301 if (cs == 1) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
302 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
303 imd->color_profile_from_image = COLOR_PROFILE_SRGB; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
304 DEBUG_1("Found EXIF 2.2 ColorSpace of sRGB"); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
305 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
306 else if (cs == 2) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
307 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
308 /* non-standard way of specifying AdobeRGB (used by some software) */ |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
309 imd->color_profile_from_image = COLOR_PROFILE_ADOBERGB; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
310 DEBUG_1("Found EXIF 2.2 ColorSpace of AdobeRGB"); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
311 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
312 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
313 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
314 if (imd->color_profile_use_image && imd->color_profile_from_image != COLOR_PROFILE_NONE) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
315 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
316 input_type = imd->color_profile_from_image; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
317 input_file = NULL; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
318 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
319 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
320 |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
321 exif_free_fd(imd->image_fd, exif); |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
322 } |
1363
ce0dd3bd613f
Enable 'Use profile from image' item of color management menu only if such profile information is available from image.
Laurent Monin <geeqie@norz.org>
parents:
1362
diff
changeset
|
323 |
176
254f45cec904
simplified exif.h, moved implementation-specific stuff to exif-int.h
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
175
diff
changeset
|
324 |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
325 if (profile) |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
326 { |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
327 cm = color_man_new_embedded(run_in_bg ? imd : NULL, NULL, |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
328 profile, profile_len, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
329 screen_type, screen_file, screen_profile, screen_profile_len); |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
330 g_free(profile); |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
331 } |
442 | 332 else |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
333 { |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
334 cm = color_man_new(run_in_bg ? imd : NULL, NULL, |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
335 input_type, input_file, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
336 screen_type, screen_file, screen_profile, screen_profile_len); |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
337 } |
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
338 |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
339 if (cm) |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
340 { |
116
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
341 if (start_row > 0) |
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
342 { |
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
343 cm->row = start_row; |
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
344 cm->incremental_sync = TRUE; |
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
345 } |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
346 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
347 imd->cm = (gpointer)cm; |
442 | 348 #if 0 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
349 if (run_in_bg) color_man_start_bg(imd->cm, image_post_process_color_cb, imd); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
350 #endif |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
351 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
352 |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
353 image_update_util(imd); |
1638
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
354 |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
355 if (screen_profile) |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
356 { |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
357 g_free(screen_profile); |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
358 screen_profile = NULL; |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
359 } |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
360 |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
361 return !!cm; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
362 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
363 |
9 | 364 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
365 static void image_post_process_tile_color_cb(PixbufRenderer *pr, GdkPixbuf **pixbuf, gint x, gint y, gint w, gint h, gpointer data) |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
366 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
367 ImageWindow *imd = (ImageWindow *)data; |
442 | 368 if (imd->cm) color_man_correct_region(imd->cm, *pixbuf, x, y, w, h); |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
369 if (imd->desaturate) pixbuf_desaturate_rect(*pixbuf, x, y, w, h); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
370 |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
371 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
372 |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
373 void image_alter_orientation(ImageWindow *imd, AlterType type) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
374 { |
691
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
375 static const gint rotate_90[] = {1, 6, 7, 8, 5, 2, 3, 4, 1}; |
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
376 static const gint rotate_90_cc[] = {1, 8, 5, 6, 7, 4, 1, 2, 3}; |
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
377 static const gint rotate_180[] = {1, 3, 4, 1, 2, 7, 8, 5, 6}; |
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
378 static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7}; |
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
379 static const gint flip[] = {1, 4, 3, 2, 1, 8, 7, 6, 5}; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
380 |
442 | 381 |
994
31599bda74c7
Fixed segfaulting when alter image in directory without images.
Petr Ostadal <postadal@suse.cz>
parents:
987
diff
changeset
|
382 if (!imd || !imd->pr || !imd->image_fd) return; |
442 | 383 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
384 if (imd->orientation < 1 || imd->orientation > 8) imd->orientation = 1; |
442 | 385 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
386 switch (type) |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
387 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
388 case ALTER_ROTATE_90: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
389 imd->orientation = rotate_90[imd->orientation]; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
390 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
391 case ALTER_ROTATE_90_CC: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
392 imd->orientation = rotate_90_cc[imd->orientation]; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
393 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
394 case ALTER_ROTATE_180: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
395 imd->orientation = rotate_180[imd->orientation]; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
396 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
397 case ALTER_MIRROR: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
398 imd->orientation = mirror[imd->orientation]; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
399 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
400 case ALTER_FLIP: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
401 imd->orientation = flip[imd->orientation]; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
402 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
403 case ALTER_NONE: |
439
a529755a2be0
Add a way to restore original state in Adjust menu.
Laurent Monin <geeqie@norz.org>
parents:
437
diff
changeset
|
404 imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1; |
a529755a2be0
Add a way to restore original state in Adjust menu.
Laurent Monin <geeqie@norz.org>
parents:
437
diff
changeset
|
405 break; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
406 default: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
407 return; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
408 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
409 } |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
410 |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
411 if (imd->orientation != imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1) |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
412 { |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
413 if (!options->metadata.write_orientation) |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
414 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
415 /* user_orientation does not work together with options->metadata.write_orientation, |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
416 use either one or the other. |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
417 we must however handle switching metadata.write_orientation on and off, therefore |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
418 we just disable referencing new fd's, not unreferencing the old ones |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
419 */ |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
420 if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd); |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
421 imd->image_fd->user_orientation = imd->orientation; |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
422 } |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
423 } |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
424 else |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
425 { |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
426 if (imd->image_fd->user_orientation != 0) file_data_unref(imd->image_fd); |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
427 imd->image_fd->user_orientation = 0; |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
428 } |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
429 |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
430 if (options->metadata.write_orientation) |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
431 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
432 if (type == ALTER_NONE) |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
433 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
434 metadata_write_revert(imd->image_fd, ORIENTATION_KEY); |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
435 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
436 else |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
437 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
438 metadata_write_int(imd->image_fd, ORIENTATION_KEY, imd->orientation); |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
439 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
440 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
441 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
442 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation); |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
443 } |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
444 |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
445 void image_set_desaturate(ImageWindow *imd, gboolean desaturate) |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
446 { |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
447 imd->desaturate = desaturate; |
442 | 448 if (imd->cm || imd->desaturate) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
449 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
450 else |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
451 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE); |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
452 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation); |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
453 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
454 |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
455 gboolean image_get_desaturate(ImageWindow *imd) |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
456 { |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
457 return imd->desaturate; |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
458 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
459 |
9 | 460 /* |
461 *------------------------------------------------------------------- | |
462 * read ahead (prebuffer) | |
463 *------------------------------------------------------------------- | |
464 */ | |
465 | |
466 static void image_read_ahead_cancel(ImageWindow *imd) | |
467 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
468 DEBUG_1("%s read ahead cancelled for :%s", get_exec_time(), imd->read_ahead_fd ? imd->read_ahead_fd->path : "null"); |
9 | 469 |
470 image_loader_free(imd->read_ahead_il); | |
471 imd->read_ahead_il = NULL; | |
472 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
473 file_data_unref(imd->read_ahead_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
474 imd->read_ahead_fd = NULL; |
9 | 475 } |
476 | |
477 static void image_read_ahead_done_cb(ImageLoader *il, gpointer data) | |
478 { | |
479 ImageWindow *imd = data; | |
480 | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
481 DEBUG_1("%s read ahead done for :%s", get_exec_time(), imd->read_ahead_fd->path); |
9 | 482 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
483 if (!imd->read_ahead_fd->pixbuf) |
9 | 484 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
485 imd->read_ahead_fd->pixbuf = image_loader_get_pixbuf(imd->read_ahead_il); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
486 if (imd->read_ahead_fd->pixbuf) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
487 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
488 g_object_ref(imd->read_ahead_fd->pixbuf); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
489 image_cache_set(imd, imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
490 } |
9 | 491 } |
492 image_loader_free(imd->read_ahead_il); | |
493 imd->read_ahead_il = NULL; | |
494 | |
495 image_complete_util(imd, TRUE); | |
496 } | |
497 | |
498 static void image_read_ahead_error_cb(ImageLoader *il, gpointer data) | |
499 { | |
500 /* we even treat errors as success, maybe at least some of the file was ok */ | |
501 image_read_ahead_done_cb(il, data); | |
502 } | |
503 | |
504 static void image_read_ahead_start(ImageWindow *imd) | |
505 { | |
506 /* already started ? */ | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
507 if (!imd->read_ahead_fd || imd->read_ahead_il || imd->read_ahead_fd->pixbuf) return; |
9 | 508 |
509 /* still loading ?, do later */ | |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
510 if (imd->il /*|| imd->cm*/) return; |
9 | 511 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
512 DEBUG_1("%s read ahead started for :%s", get_exec_time(), imd->read_ahead_fd->path); |
9 | 513 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
514 imd->read_ahead_il = image_loader_new(imd->read_ahead_fd); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
515 |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
516 image_loader_delay_area_ready(imd->read_ahead_il, TRUE); /* we will need the area_ready signals later */ |
9 | 517 |
1346
b3378273091e
No space between function name and first parenthesis, it eases greping (see CODING).
Laurent Monin <geeqie@norz.org>
parents:
1338
diff
changeset
|
518 g_signal_connect(G_OBJECT(imd->read_ahead_il), "error", (GCallback)image_read_ahead_error_cb, imd); |
b3378273091e
No space between function name and first parenthesis, it eases greping (see CODING).
Laurent Monin <geeqie@norz.org>
parents:
1338
diff
changeset
|
519 g_signal_connect(G_OBJECT(imd->read_ahead_il), "done", (GCallback)image_read_ahead_done_cb, imd); |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
520 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
521 if (!image_loader_start(imd->read_ahead_il)) |
9 | 522 { |
523 image_read_ahead_cancel(imd); | |
524 image_complete_util(imd, TRUE); | |
525 } | |
526 } | |
527 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
528 static void image_read_ahead_set(ImageWindow *imd, FileData *fd) |
9 | 529 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
530 if (imd->read_ahead_fd && fd && imd->read_ahead_fd == fd) return; |
9 | 531 |
532 image_read_ahead_cancel(imd); | |
533 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
534 imd->read_ahead_fd = file_data_ref(fd); |
9 | 535 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
536 DEBUG_1("read ahead set to :%s", imd->read_ahead_fd->path); |
9 | 537 |
538 image_read_ahead_start(imd); | |
539 } | |
540 | |
541 /* | |
542 *------------------------------------------------------------------- | |
543 * post buffering | |
544 *------------------------------------------------------------------- | |
545 */ | |
546 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
547 static void image_cache_release_cb(FileData *fd) |
9 | 548 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
549 g_object_unref(fd->pixbuf); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
550 fd->pixbuf = NULL; |
9 | 551 } |
552 | |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
553 static FileCacheData *image_get_cache(void) |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
554 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
555 static FileCacheData *cache = NULL; |
848
79fc2c215d64
cache size made configurable
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
847
diff
changeset
|
556 if (!cache) cache = file_cache_new(image_cache_release_cb, 1); |
79fc2c215d64
cache size made configurable
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
847
diff
changeset
|
557 file_cache_set_max_size(cache, (gulong)options->image.image_cache_max * 1048576); /* update from options */ |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
558 return cache; |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
559 } |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
560 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
561 static void image_cache_set(ImageWindow *imd, FileData *fd) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
562 { |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
563 g_assert(fd->pixbuf); |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
564 |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
565 file_cache_put(image_get_cache(), fd, (gulong)gdk_pixbuf_get_rowstride(fd->pixbuf) * (gulong)gdk_pixbuf_get_height(fd->pixbuf)); |
1432
7f454e7d07a3
improved notification system
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1431
diff
changeset
|
566 file_data_send_notification(fd, NOTIFY_PIXBUF); /* to update histogram */ |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
567 } |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
568 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
569 static gint image_cache_get(ImageWindow *imd) |
9 | 570 { |
571 gint success; | |
572 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
573 success = file_cache_get(image_get_cache(), imd->image_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
574 if (success) |
9 | 575 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
576 g_assert(imd->image_fd->pixbuf); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
577 image_change_pixbuf(imd, imd->image_fd->pixbuf, image_zoom_get(imd), FALSE); |
9 | 578 } |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
579 |
1498
2b0712dcf139
improved debug messages
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1482
diff
changeset
|
580 // file_cache_dump(image_get_cache()); |
9 | 581 return success; |
582 } | |
583 | |
584 /* | |
585 *------------------------------------------------------------------- | |
586 * loading | |
587 *------------------------------------------------------------------- | |
588 */ | |
589 | |
590 static void image_load_pixbuf_ready(ImageWindow *imd) | |
591 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
592 if (image_get_pixbuf(imd) || !imd->il) return; |
9 | 593 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
594 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), FALSE); |
9 | 595 } |
596 | |
597 static void image_load_area_cb(ImageLoader *il, guint x, guint y, guint w, guint h, gpointer data) | |
598 { | |
599 ImageWindow *imd = data; | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
600 PixbufRenderer *pr; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
601 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
602 pr = (PixbufRenderer *)imd->pr; |
9 | 603 |
604 if (imd->delay_flip && | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
605 pr->pixbuf != image_loader_get_pixbuf(il)) |
9 | 606 { |
607 return; | |
608 } | |
609 | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
610 if (!pr->pixbuf) image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), TRUE); |
9 | 611 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
612 pixbuf_renderer_area_changed(pr, x, y, w, h); |
9 | 613 } |
614 | |
615 static void image_load_done_cb(ImageLoader *il, gpointer data) | |
1 | 616 { |
617 ImageWindow *imd = data; | |
9 | 618 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
619 DEBUG_1("%s image done", get_exec_time()); |
9 | 620 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
621 if (options->image.enable_read_ahead && imd->image_fd && !imd->image_fd->pixbuf && image_loader_get_pixbuf(imd->il)) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
622 { |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
623 imd->image_fd->pixbuf = g_object_ref(image_loader_get_pixbuf(imd->il)); |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
624 image_cache_set(imd, imd->image_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
625 } |
1294 | 626 /* call the callback triggered by image_state after fd->pixbuf is set */ |
627 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); | |
628 image_state_unset(imd, IMAGE_STATE_LOADING); | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
629 |
1031
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
630 if (!image_loader_get_pixbuf(imd->il)) |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
631 { |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
632 GdkPixbuf *pixbuf; |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
633 |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
634 pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
635 image_change_pixbuf(imd, pixbuf, image_zoom_get(imd), FALSE); |
1031
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
636 g_object_unref(pixbuf); |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
637 |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
638 imd->unknown = TRUE; |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
639 } |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
640 else if (imd->delay_flip && |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
641 image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) |
9 | 642 { |
42
056d96cdec23
Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
29
diff
changeset
|
643 g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
644 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), FALSE); |
9 | 645 } |
646 | |
647 image_loader_free(imd->il); | |
648 imd->il = NULL; | |
649 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
650 // image_post_process(imd, TRUE); |
9 | 651 |
652 image_read_ahead_start(imd); | |
653 } | |
654 | |
1865 | 655 static void image_load_size_cb(ImageLoader *il, guint width, guint height, gpointer data) |
656 { | |
657 ImageWindow *imd = data; | |
658 | |
659 DEBUG_1("image_load_size_cb: %dx%d", width, height); | |
660 pixbuf_renderer_set_size_early((PixbufRenderer *)imd->pr, width, height); | |
661 } | |
662 | |
9 | 663 static void image_load_error_cb(ImageLoader *il, gpointer data) |
664 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
665 DEBUG_1("%s image error", get_exec_time()); |
9 | 666 |
667 /* even on error handle it like it was done, | |
668 * since we have a pixbuf with _something_ */ | |
669 | |
670 image_load_done_cb(il, data); | |
671 } | |
672 | |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
673 static void image_load_set_signals(ImageWindow *imd, gboolean override_old_signals) |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
674 { |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
675 g_assert(imd->il); |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
676 if (override_old_signals) |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
677 { |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
678 /* override the old signals */ |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
679 g_signal_handlers_disconnect_matched(G_OBJECT(imd->il), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, imd); |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
680 } |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
681 |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
682 g_signal_connect(G_OBJECT(imd->il), "area_ready", (GCallback)image_load_area_cb, imd); |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
683 g_signal_connect(G_OBJECT(imd->il), "error", (GCallback)image_load_error_cb, imd); |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
684 g_signal_connect(G_OBJECT(imd->il), "done", (GCallback)image_load_done_cb, imd); |
1865 | 685 g_signal_connect(G_OBJECT(imd->il), "size_prepared", (GCallback)image_load_size_cb, imd); |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
686 } |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
687 |
9 | 688 /* this read ahead is located here merely for the callbacks, above */ |
689 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
690 static gboolean image_read_ahead_check(ImageWindow *imd) |
9 | 691 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
692 if (!imd->read_ahead_fd) return FALSE; |
9 | 693 if (imd->il) return FALSE; |
694 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
695 if (!imd->image_fd || imd->read_ahead_fd != imd->image_fd) |
9 | 696 { |
697 image_read_ahead_cancel(imd); | |
698 return FALSE; | |
699 } | |
700 | |
701 if (imd->read_ahead_il) | |
702 { | |
703 imd->il = imd->read_ahead_il; | |
704 imd->read_ahead_il = NULL; | |
705 | |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
706 image_load_set_signals(imd, TRUE); |
9 | 707 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
708 g_object_set(G_OBJECT(imd->pr), "loading", TRUE, NULL); |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
709 image_state_set(imd, IMAGE_STATE_LOADING); |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
710 |
9 | 711 if (!imd->delay_flip) |
712 { | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
713 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), TRUE); |
9 | 714 } |
715 | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
716 image_loader_delay_area_ready(imd->il, FALSE); /* send the delayed area_ready signals */ |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
717 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
718 file_data_unref(imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
719 imd->read_ahead_fd = NULL; |
9 | 720 return TRUE; |
721 } | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
722 else if (imd->read_ahead_fd->pixbuf) |
9 | 723 { |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
724 image_change_pixbuf(imd, imd->read_ahead_fd->pixbuf, image_zoom_get(imd), FALSE); |
9 | 725 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
726 file_data_unref(imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
727 imd->read_ahead_fd = NULL; |
9 | 728 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
729 // image_post_process(imd, FALSE); |
9 | 730 return TRUE; |
731 } | |
732 | |
733 image_read_ahead_cancel(imd); | |
734 return FALSE; | |
735 } | |
736 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
737 static gboolean image_load_begin(ImageWindow *imd, FileData *fd) |
9 | 738 { |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
739 DEBUG_1("%s image begin", get_exec_time()); |
9 | 740 |
741 if (imd->il) return FALSE; | |
742 | |
743 imd->completed = FALSE; | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
744 g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL); |
9 | 745 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
746 if (image_cache_get(imd)) |
9 | 747 { |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
748 DEBUG_1("from cache: %s", imd->image_fd->path); |
9 | 749 return TRUE; |
750 } | |
751 | |
752 if (image_read_ahead_check(imd)) | |
753 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
754 DEBUG_1("from read ahead buffer: %s", imd->image_fd->path); |
9 | 755 return TRUE; |
756 } | |
757 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
758 if (!imd->delay_flip && image_get_pixbuf(imd)) |
9 | 759 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
760 PixbufRenderer *pr; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
761 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
762 pr = PIXBUF_RENDERER(imd->pr); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
763 if (pr->pixbuf) g_object_unref(pr->pixbuf); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
764 pr->pixbuf = NULL; |
9 | 765 } |
766 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
767 g_object_set(G_OBJECT(imd->pr), "loading", TRUE, NULL); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
768 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
769 imd->il = image_loader_new(fd); |
9 | 770 |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
771 image_load_set_signals(imd, FALSE); |
9 | 772 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
773 if (!image_loader_start(imd->il)) |
9 | 774 { |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
775 DEBUG_1("image start error"); |
9 | 776 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
777 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
778 |
9 | 779 image_loader_free(imd->il); |
780 imd->il = NULL; | |
781 | |
782 image_complete_util(imd, FALSE); | |
783 | |
784 return FALSE; | |
785 } | |
786 | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
787 image_state_set(imd, IMAGE_STATE_LOADING); |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
788 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
789 /* |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
790 if (!imd->delay_flip && !image_get_pixbuf(imd) && image_loader_get_pixbuf(imd->il)) |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
791 { |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
792 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), TRUE); |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
793 } |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
794 */ |
9 | 795 return TRUE; |
796 } | |
797 | |
798 static void image_reset(ImageWindow *imd) | |
799 { | |
800 /* stops anything currently being done */ | |
801 | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
802 DEBUG_1("%s image reset", get_exec_time()); |
9 | 803 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
804 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
805 |
9 | 806 image_loader_free(imd->il); |
807 imd->il = NULL; | |
808 | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
809 color_man_free((ColorMan *)imd->cm); |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
810 imd->cm = NULL; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
811 |
9 | 812 imd->delay_alter_type = ALTER_NONE; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
813 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
814 image_state_set(imd, IMAGE_STATE_NONE); |
9 | 815 } |
816 | |
817 /* | |
818 *------------------------------------------------------------------- | |
819 * image changer | |
820 *------------------------------------------------------------------- | |
821 */ | |
822 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
823 static void image_change_complete(ImageWindow *imd, gdouble zoom) |
9 | 824 { |
825 image_reset(imd); | |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
826 imd->unknown = TRUE; |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
827 |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
828 if (!imd->image_fd) |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
829 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
830 image_change_pixbuf(imd, NULL, zoom, FALSE); |
9 | 831 } |
832 else | |
833 { | |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
834 |
1362
58a1649f728b
Improve file checks using is_readable_file().
Laurent Monin <geeqie@norz.org>
parents:
1359
diff
changeset
|
835 if (is_readable_file(imd->image_fd->path)) |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
836 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
837 PixbufRenderer *pr; |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
838 |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
839 pr = PIXBUF_RENDERER(imd->pr); |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
840 pr->zoom = zoom; /* store the zoom, needed by the loader */ |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
841 |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
842 if (image_load_begin(imd, imd->image_fd)) |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
843 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
844 imd->unknown = FALSE; |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
845 } |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
846 } |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
847 |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
848 if (imd->unknown == TRUE) |
9 | 849 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
850 GdkPixbuf *pixbuf; |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
851 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
852 pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
853 image_change_pixbuf(imd, pixbuf, zoom, FALSE); |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
854 g_object_unref(pixbuf); |
9 | 855 } |
856 } | |
857 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
858 image_update_util(imd); |
9 | 859 } |
860 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
861 static void image_change_real(ImageWindow *imd, FileData *fd, |
9 | 862 CollectionData *cd, CollectInfo *info, gdouble zoom) |
863 { | |
864 | |
865 imd->collection = cd; | |
866 imd->collection_info = info; | |
867 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
868 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
869 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
870 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
871 file_data_unref(imd->image_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
872 imd->image_fd = file_data_ref(fd); |
9 | 873 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
874 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
875 image_change_complete(imd, zoom); |
9 | 876 |
877 image_update_title(imd); | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
878 image_state_set(imd, IMAGE_STATE_IMAGE); |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
879 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
880 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
881 file_data_register_real_time_monitor(imd->image_fd); |
9 | 882 } |
883 | |
884 /* | |
885 *------------------------------------------------------------------- | |
886 * focus stuff | |
887 *------------------------------------------------------------------- | |
888 */ | |
889 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
890 static void image_focus_paint(ImageWindow *imd, gboolean has_focus, GdkRectangle *area) |
9 | 891 { |
892 GtkWidget *widget; | |
893 | |
894 widget = imd->widget; | |
895 if (!widget->window) return; | |
896 | |
897 if (has_focus) | |
898 { | |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
899 gtk_paint_focus(widget->style, widget->window, GTK_STATE_ACTIVE, |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
900 area, widget, "image_window", |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
901 widget->allocation.x, widget->allocation.y, |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
902 widget->allocation.width - 1, widget->allocation.height - 1); |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
903 } |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
904 else |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
905 { |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
906 gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, |
9 | 907 area, widget, "image_window", |
908 widget->allocation.x, widget->allocation.y, | |
442 | 909 widget->allocation.width - 1, widget->allocation.height - 1); |
9 | 910 } |
911 } | |
912 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
913 static gboolean image_focus_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data) |
9 | 914 { |
915 ImageWindow *imd = data; | |
916 | |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
917 #if GTK_CHECK_VERSION(2,20,0) |
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
918 image_focus_paint(imd, gtk_widget_has_focus(widget), &event->area); |
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
919 #else |
9 | 920 image_focus_paint(imd, GTK_WIDGET_HAS_FOCUS(widget), &event->area); |
1810
c3a79dda8ea7
GTK marks several functions as deprecated
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
921 #endif |
9 | 922 return TRUE; |
923 } | |
924 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
925 static gboolean image_focus_in_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) |
9 | 926 { |
927 ImageWindow *imd = data; | |
928 | |
929 GTK_WIDGET_SET_FLAGS(imd->widget, GTK_HAS_FOCUS); | |
930 image_focus_paint(imd, TRUE, NULL); | |
931 | |
1481
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
932 if (imd->func_focus_in) |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
933 { |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
934 imd->func_focus_in(imd, imd->data_focus_in); |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
935 } |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
936 |
9 | 937 return TRUE; |
938 } | |
939 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
940 static gboolean image_focus_out_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) |
9 | 941 { |
942 ImageWindow *imd = data; | |
943 | |
944 GTK_WIDGET_UNSET_FLAGS(imd->widget, GTK_HAS_FOCUS); | |
945 image_focus_paint(imd, FALSE, NULL); | |
946 | |
947 return TRUE; | |
948 } | |
949 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
950 static gboolean image_scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer data) |
9 | 951 { |
952 ImageWindow *imd = data; | |
953 | |
954 if (imd->func_scroll && | |
955 event && event->type == GDK_SCROLL) | |
442 | 956 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
957 imd->func_scroll(imd, event, imd->data_scroll); |
9 | 958 return TRUE; |
959 } | |
960 | |
961 return FALSE; | |
962 } | |
963 | |
964 /* | |
965 *------------------------------------------------------------------- | |
966 * public interface | |
967 *------------------------------------------------------------------- | |
968 */ | |
969 | |
970 void image_attach_window(ImageWindow *imd, GtkWidget *window, | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
971 const gchar *title, const gchar *title_right, gboolean show_zoom) |
1 | 972 { |
973 imd->top_window = window; | |
974 g_free(imd->title); | |
9 | 975 imd->title = g_strdup(title); |
976 g_free(imd->title_right); | |
977 imd->title_right = g_strdup(title_right); | |
978 imd->title_show_zoom = show_zoom; | |
979 | |
334
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
980 if (!options->image.fit_window_to_image) window = NULL; |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
981 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
982 pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)window); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
983 |
9 | 984 image_update_title(imd); |
985 } | |
986 | |
987 void image_set_update_func(ImageWindow *imd, | |
988 void (*func)(ImageWindow *imd, gpointer data), | |
989 gpointer data) | |
990 { | |
991 imd->func_update = func; | |
992 imd->data_update = data; | |
1 | 993 } |
994 | |
9 | 995 void image_set_complete_func(ImageWindow *imd, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
996 void (*func)(ImageWindow *imd, gboolean preload, gpointer data), |
9 | 997 gpointer data) |
1 | 998 { |
9 | 999 imd->func_complete = func; |
1000 imd->data_complete = data; | |
1 | 1001 } |
1002 | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1003 void image_set_state_func(ImageWindow *imd, |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1004 void (*func)(ImageWindow *imd, ImageState state, gpointer data), |
9 | 1005 gpointer data) |
1 | 1006 { |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1007 imd->func_state = func; |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1008 imd->data_state = data; |
9 | 1009 } |
1010 | |
1011 | |
1012 void image_set_button_func(ImageWindow *imd, | |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
1013 void (*func)(ImageWindow *, GdkEventButton *event, gpointer), |
9 | 1014 gpointer data) |
1015 { | |
1016 imd->func_button = func; | |
1017 imd->data_button = data; | |
1018 } | |
1019 | |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1020 void image_set_drag_func(ImageWindow *imd, |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
1021 void (*func)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer), |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1022 gpointer data) |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1023 { |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1024 imd->func_drag = func; |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1025 imd->data_drag = data; |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1026 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1027 |
9 | 1028 void image_set_scroll_func(ImageWindow *imd, |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
1029 void (*func)(ImageWindow *, GdkEventScroll *event, gpointer), |
9 | 1030 gpointer data) |
1 | 1031 { |
9 | 1032 imd->func_scroll = func; |
1033 imd->data_scroll = data; | |
1 | 1034 } |
1035 | |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1036 void image_set_scroll_notify_func(ImageWindow *imd, |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1037 void (*func)(ImageWindow *imd, gint x, gint y, gint width, gint height, gpointer data), |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1038 gpointer data) |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1039 { |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1040 imd->func_scroll_notify = func; |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1041 imd->data_scroll_notify = data; |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1042 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1043 |
1481
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1044 void image_set_focus_in_func(ImageWindow *imd, |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1045 void (*func)(ImageWindow *, gpointer), |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1046 gpointer data) |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1047 { |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1048 imd->func_focus_in = func; |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1049 imd->data_focus_in = data; |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1050 } |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1051 |
9 | 1052 /* path, name */ |
1053 | |
1054 const gchar *image_get_path(ImageWindow *imd) | |
1055 { | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1056 if (imd->image_fd == NULL) return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1057 return imd->image_fd->path; |
9 | 1058 } |
1059 | |
1060 const gchar *image_get_name(ImageWindow *imd) | |
1061 { | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1062 if (imd->image_fd == NULL) return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1063 return imd->image_fd->name; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1064 } |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1065 |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1066 FileData *image_get_fd(ImageWindow *imd) |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1067 { |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1068 return imd->image_fd; |
9 | 1069 } |
1070 | |
1071 /* merely changes path string, does not change the image! */ | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1072 void image_set_fd(ImageWindow *imd, FileData *fd) |
1 | 1073 { |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1074 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1075 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1076 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1077 file_data_unref(imd->image_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1078 imd->image_fd = file_data_ref(fd); |
9 | 1079 |
1080 image_update_title(imd); | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1081 image_state_set(imd, IMAGE_STATE_IMAGE); |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1082 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1083 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1084 file_data_register_real_time_monitor(imd->image_fd); |
9 | 1085 } |
1086 | |
1087 /* load a new image */ | |
1088 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1089 void image_change_fd(ImageWindow *imd, FileData *fd, gdouble zoom) |
9 | 1090 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1091 if (imd->image_fd == fd) return; |
9 | 1092 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1093 image_change_real(imd, fd, NULL, NULL, zoom); |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1094 } |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1095 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1096 gboolean image_get_image_size(ImageWindow *imd, gint *width, gint *height) |
530
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
1097 { |
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
1098 return pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), width, height); |
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
1099 } |
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
1100 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1101 GdkPixbuf *image_get_pixbuf(ImageWindow *imd) |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1102 { |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1103 return pixbuf_renderer_get_pixbuf((PixbufRenderer *)imd->pr); |
9 | 1104 } |
1105 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1106 void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gboolean lazy) |
9 | 1107 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1108 StereoPixbufData stereo_data = STEREO_PIXBUF_DEFAULT; |
1639
3dfbbabd5138
enabled color management in img-view
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1638
diff
changeset
|
1109 /* read_exif and similar functions can actually notice that the file has changed and trigger |
3dfbbabd5138
enabled color management in img-view
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1638
diff
changeset
|
1110 a notification that removes the pixbuf from cache and unrefs it. Therefore we must ref it |
3dfbbabd5138
enabled color management in img-view
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1638
diff
changeset
|
1111 here before it is taken over by the renderer. */ |
1251 | 1112 if (pixbuf) g_object_ref(pixbuf); |
1247
f9e2deeaa947
fixed possible crash
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1182
diff
changeset
|
1113 |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1114 if (imd->image_fd) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1115 { |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1116 if (imd->image_fd->user_orientation) |
437
534aab7d3632
Fix the case "orientation from FileData, color profile from exif".
Laurent Monin <geeqie@norz.org>
parents:
434
diff
changeset
|
1117 { |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1118 imd->orientation = imd->image_fd->user_orientation; |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1119 } |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1120 else if (options->image.exif_rotate_enable) |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1121 { |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
1122 imd->orientation = metadata_read_int(imd->image_fd, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT); |
439
a529755a2be0
Add a way to restore original state in Adjust menu.
Laurent Monin <geeqie@norz.org>
parents:
437
diff
changeset
|
1123 imd->image_fd->exif_orientation = imd->orientation; |
437
534aab7d3632
Fix the case "orientation from FileData, color profile from exif".
Laurent Monin <geeqie@norz.org>
parents:
434
diff
changeset
|
1124 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1125 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1126 |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1127 if (pixbuf) |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1128 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1129 stereo_data = imd->user_stereo; |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1130 if (stereo_data == STEREO_PIXBUF_DEFAULT) |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1131 { |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1132 stereo_data = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(pixbuf), "stereo_data")); |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1133 } |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1134 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1135 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1136 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, FALSE); |
442 | 1137 if (imd->cm) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1138 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1139 color_man_free(imd->cm); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1140 imd->cm = NULL; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1141 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1142 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1143 if (lazy) |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1144 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1145 pixbuf_renderer_set_pixbuf_lazy((PixbufRenderer *)imd->pr, pixbuf, zoom, imd->orientation, stereo_data); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1146 } |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1147 else |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1148 { |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1149 pixbuf_renderer_set_pixbuf((PixbufRenderer *)imd->pr, pixbuf, zoom); |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1150 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation); |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1151 pixbuf_renderer_set_stereo_data((PixbufRenderer *)imd->pr, stereo_data); |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1152 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1153 |
1251 | 1154 if (pixbuf) g_object_unref(pixbuf); |
1247
f9e2deeaa947
fixed possible crash
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1182
diff
changeset
|
1155 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1156 if (imd->color_profile_enable) |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1157 { |
1357
4bf8cc21b89a
image_post_process_color(): remove exif parameter, just extract it when needed.
Laurent Monin <geeqie@norz.org>
parents:
1356
diff
changeset
|
1158 image_post_process_color(imd, 0, FALSE); /* TODO: error handling */ |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1159 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1160 |
442 | 1161 if (imd->cm || imd->desaturate) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1162 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); |
442 | 1163 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1164 image_state_set(imd, IMAGE_STATE_IMAGE); |
9 | 1165 } |
1166 | |
1167 void image_change_from_collection(ImageWindow *imd, CollectionData *cd, CollectInfo *info, gdouble zoom) | |
1168 { | |
1169 if (!cd || !info || !g_list_find(cd->list, info)) return; | |
1170 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1171 image_change_real(imd, info->fd, cd, info, zoom); |
9 | 1172 } |
1173 | |
1174 CollectionData *image_get_collection(ImageWindow *imd, CollectInfo **info) | |
1175 { | |
1176 if (collection_to_number(imd->collection) >= 0) | |
1177 { | |
1178 if (g_list_find(imd->collection->list, imd->collection_info) != NULL) | |
1179 { | |
1180 if (info) *info = imd->collection_info; | |
1181 } | |
1182 else | |
1183 { | |
1184 if (info) *info = NULL; | |
1185 } | |
1186 return imd->collection; | |
1187 } | |
1188 | |
1189 if (info) *info = NULL; | |
1190 return NULL; | |
1191 } | |
1192 | |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1193 static void image_loader_sync_read_ahead_data(ImageLoader *il, gpointer old_data, gpointer data) |
9 | 1194 { |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1195 if (g_signal_handlers_disconnect_by_func(G_OBJECT(il), (GCallback)image_read_ahead_error_cb, old_data)) |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1196 g_signal_connect(G_OBJECT(il), "error", (GCallback)image_read_ahead_error_cb, data); |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1197 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1198 if (g_signal_handlers_disconnect_by_func(G_OBJECT(il), (GCallback)image_read_ahead_done_cb, old_data)) |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1199 g_signal_connect(G_OBJECT(il), "done", (GCallback)image_read_ahead_done_cb, data); |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1200 } |
9 | 1201 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1202 static void image_loader_sync_data(ImageLoader *il, gpointer old_data, gpointer data) |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1203 { |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1204 if (g_signal_handlers_disconnect_by_func(G_OBJECT(il), (GCallback)image_load_area_cb, old_data)) |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1205 g_signal_connect(G_OBJECT(il), "area_ready", (GCallback)image_load_area_cb, data); |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1206 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1207 if (g_signal_handlers_disconnect_by_func(G_OBJECT(il), (GCallback)image_load_error_cb, old_data)) |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1208 g_signal_connect(G_OBJECT(il), "error", (GCallback)image_load_error_cb, data); |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1209 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1210 if (g_signal_handlers_disconnect_by_func(G_OBJECT(il), (GCallback)image_load_done_cb, old_data)) |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1211 g_signal_connect(G_OBJECT(il), "done", (GCallback)image_load_done_cb, data); |
1 | 1212 } |
1213 | |
9 | 1214 /* this is more like a move function |
24
ca420b4159df
Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
1215 * it moves most data from source to imd |
9 | 1216 */ |
1217 void image_change_from_image(ImageWindow *imd, ImageWindow *source) | |
1218 { | |
1219 if (imd == source) return; | |
1220 | |
1221 imd->unknown = source->unknown; | |
1222 | |
1223 imd->collection = source->collection; | |
1224 imd->collection_info = source->collection_info; | |
1225 | |
1226 image_loader_free(imd->il); | |
1227 imd->il = NULL; | |
1228 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1229 image_set_fd(imd, image_get_fd(source)); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1230 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1231 |
24
ca420b4159df
Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
1232 if (source->il) |
9 | 1233 { |
863
6837cd867f33
fixed crash in entering fullscreen during loading
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
848
diff
changeset
|
1234 imd->il = source->il; |
6837cd867f33
fixed crash in entering fullscreen during loading
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
848
diff
changeset
|
1235 source->il = NULL; |
9 | 1236 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1237 image_loader_sync_data(imd->il, source, imd); |
9 | 1238 |
1239 imd->delay_alter_type = source->delay_alter_type; | |
1240 source->delay_alter_type = ALTER_NONE; | |
1241 } | |
1242 | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1243 imd->color_profile_enable = source->color_profile_enable; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1244 imd->color_profile_input = source->color_profile_input; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1245 imd->color_profile_use_image = source->color_profile_use_image; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1246 color_man_free((ColorMan *)imd->cm); |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1247 imd->cm = NULL; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1248 if (source->cm) |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1249 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1250 ColorMan *cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1251 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1252 imd->cm = source->cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1253 source->cm = NULL; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1254 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1255 cm = (ColorMan *)imd->cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1256 cm->imd = imd; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1257 cm->func_done_data = imd; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1258 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1259 |
9 | 1260 image_loader_free(imd->read_ahead_il); |
1261 imd->read_ahead_il = source->read_ahead_il; | |
1262 source->read_ahead_il = NULL; | |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1263 if (imd->read_ahead_il) image_loader_sync_read_ahead_data(imd->read_ahead_il, source, imd); |
9 | 1264 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1265 file_data_unref(imd->read_ahead_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1266 imd->read_ahead_fd = source->read_ahead_fd; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1267 source->read_ahead_fd = NULL; |
9 | 1268 |
1269 imd->completed = source->completed; | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1270 imd->state = source->state; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1271 source->state = IMAGE_STATE_NONE; |
442 | 1272 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1273 imd->orientation = source->orientation; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1274 imd->desaturate = source->desaturate; |
9 | 1275 |
1900
6e146fa6ec29
infrastructure for image loader backend
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1891
diff
changeset
|
1276 imd->user_stereo = source->user_stereo; |
6e146fa6ec29
infrastructure for image loader backend
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1891
diff
changeset
|
1277 |
24
ca420b4159df
Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
1278 pixbuf_renderer_move(PIXBUF_RENDERER(imd->pr), PIXBUF_RENDERER(source->pr)); |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1279 |
442 | 1280 if (imd->cm || imd->desaturate) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1281 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1282 else |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1283 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1284 |
9 | 1285 } |
1286 | |
1287 /* manipulation */ | |
1288 | |
1289 void image_area_changed(ImageWindow *imd, gint x, gint y, gint width, gint height) | |
1290 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1291 pixbuf_renderer_area_changed((PixbufRenderer *)imd->pr, x, y, width, height); |
9 | 1292 } |
1293 | |
1294 void image_reload(ImageWindow *imd) | |
1295 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1296 if (pixbuf_renderer_get_tiles((PixbufRenderer *)imd->pr)) return; |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1297 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1298 image_change_complete(imd, image_zoom_get(imd)); |
9 | 1299 } |
1300 | |
1301 void image_scroll(ImageWindow *imd, gint x, gint y) | |
1302 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1303 pixbuf_renderer_scroll((PixbufRenderer *)imd->pr, x, y); |
9 | 1304 } |
1305 | |
13
ba909f3b01d6
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
12
diff
changeset
|
1306 void image_scroll_to_point(ImageWindow *imd, gint x, gint y, |
ba909f3b01d6
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
12
diff
changeset
|
1307 gdouble x_align, gdouble y_align) |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1308 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1309 pixbuf_renderer_scroll_to_point((PixbufRenderer *)imd->pr, x, y, x_align, y_align); |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1310 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1311 |
131
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1312 void image_get_scroll_center(ImageWindow *imd, gdouble *x, gdouble *y) |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1313 { |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1314 pixbuf_renderer_get_scroll_center(PIXBUF_RENDERER(imd->pr), x, y); |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1315 } |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1316 |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1317 void image_set_scroll_center(ImageWindow *imd, gdouble x, gdouble y) |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1318 { |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1319 pixbuf_renderer_set_scroll_center(PIXBUF_RENDERER(imd->pr), x, y); |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1320 } |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1321 |
9 | 1322 void image_zoom_adjust(ImageWindow *imd, gdouble increment) |
1323 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1324 pixbuf_renderer_zoom_adjust((PixbufRenderer *)imd->pr, increment); |
9 | 1325 } |
1326 | |
1327 void image_zoom_adjust_at_point(ImageWindow *imd, gdouble increment, gint x, gint y) | |
1328 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1329 pixbuf_renderer_zoom_adjust_at_point((PixbufRenderer *)imd->pr, increment, x, y); |
9 | 1330 } |
1331 | |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1332 void image_zoom_set_limits(ImageWindow *imd, gdouble min, gdouble max) |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1333 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1334 pixbuf_renderer_zoom_set_limits((PixbufRenderer *)imd->pr, min, max); |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1335 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1336 |
9 | 1337 void image_zoom_set(ImageWindow *imd, gdouble zoom) |
1338 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1339 pixbuf_renderer_zoom_set((PixbufRenderer *)imd->pr, zoom); |
9 | 1340 } |
1341 | |
1269 | 1342 void image_zoom_set_fill_geometry(ImageWindow *imd, gboolean vertical) |
9 | 1343 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1344 PixbufRenderer *pr; |
9 | 1345 gdouble zoom; |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1346 gint width, height; |
9 | 1347 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1348 pr = (PixbufRenderer *)imd->pr; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1349 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1350 if (!pixbuf_renderer_get_pixbuf(pr) || |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1351 !pixbuf_renderer_get_image_size(pr, &width, &height)) return; |
9 | 1352 |
1353 if (vertical) | |
1354 { | |
1875
e9b157ab56a6
first stereo support
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1865
diff
changeset
|
1355 zoom = (gdouble)pr->viewport_height / height; |
9 | 1356 } |
1357 else | |
1358 { | |
1875
e9b157ab56a6
first stereo support
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1865
diff
changeset
|
1359 zoom = (gdouble)pr->viewport_width / width; |
9 | 1360 } |
1361 | |
1362 if (zoom < 1.0) | |
1363 { | |
1364 zoom = 0.0 - 1.0 / zoom; | |
1 | 1365 } |
9 | 1366 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1367 pixbuf_renderer_zoom_set(pr, zoom); |
9 | 1368 } |
1369 | |
1370 gdouble image_zoom_get(ImageWindow *imd) | |
1371 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1372 return pixbuf_renderer_zoom_get((PixbufRenderer *)imd->pr); |
9 | 1373 } |
1374 | |
1375 gdouble image_zoom_get_real(ImageWindow *imd) | |
1376 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1377 return pixbuf_renderer_zoom_get_scale((PixbufRenderer *)imd->pr); |
9 | 1378 } |
1379 | |
1380 gchar *image_zoom_get_as_text(ImageWindow *imd) | |
1381 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1382 gdouble zoom; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1383 gdouble scale; |
9 | 1384 gdouble l = 1.0; |
1385 gdouble r = 1.0; | |
1386 gint pl = 0; | |
1387 gint pr = 0; | |
1388 gchar *approx = " "; | |
1389 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1390 zoom = image_zoom_get(imd); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1391 scale = image_zoom_get_real(imd); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1392 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1393 if (zoom > 0.0) |
1 | 1394 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1395 l = zoom; |
9 | 1396 } |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1397 else if (zoom < 0.0) |
9 | 1398 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1399 r = 0.0 - zoom; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1400 } |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1401 else if (zoom == 0.0 && scale != 0.0) |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1402 { |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1403 if (scale >= 1.0) |
9 | 1404 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1405 l = scale; |
9 | 1406 } |
1407 else | |
1408 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1409 r = 1.0 / scale; |
9 | 1410 } |
415
7c97f17797f5
Add zoom ratio display to OSD in fullscreen mode.
Laurent Monin <geeqie@norz.org>
parents:
414
diff
changeset
|
1411 approx = "~"; |
9 | 1412 } |
1413 | |
1414 if (rint(l) != l) pl = 1; | |
1415 if (rint(r) != r) pr = 1; | |
1416 | |
1417 return g_strdup_printf("%.*f :%s%.*f", pl, l, approx, pr, r); | |
1418 } | |
1419 | |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1420 gdouble image_zoom_get_default(ImageWindow *imd) |
9 | 1421 { |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1422 gdouble zoom = 1.0; |
9 | 1423 |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1424 switch (options->image.zoom_mode) |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1425 { |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1426 case ZOOM_RESET_ORIGINAL: |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1427 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1428 case ZOOM_RESET_FIT_WINDOW: |
9 | 1429 zoom = 0.0; |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1430 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1431 case ZOOM_RESET_NONE: |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1432 if (imd) zoom = image_zoom_get(imd); |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1433 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1434 } |
1 | 1435 |
1436 return zoom; | |
1437 } | |
1438 | |
1886
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1439 /* stereo */ |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1440 gint image_stereo_get(ImageWindow *imd) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1441 { |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1442 return pixbuf_renderer_stereo_get((PixbufRenderer *)imd->pr); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1443 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1444 |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1445 void image_stereo_set(ImageWindow *imd, gint stereo_mode) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1446 { |
1887
cca739d627fd
stereo mode preferences
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1886
diff
changeset
|
1447 DEBUG_1("Setting stereo mode %04x for imd %p", stereo_mode, imd); |
1886
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1448 pixbuf_renderer_stereo_set((PixbufRenderer *)imd->pr, stereo_mode); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1449 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1450 |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1451 void image_stereo_swap(ImageWindow *imd) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1452 { |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1453 gint stereo_mode = pixbuf_renderer_stereo_get((PixbufRenderer *)imd->pr); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1454 stereo_mode ^= PR_STEREO_SWAP; |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1455 pixbuf_renderer_stereo_set((PixbufRenderer *)imd->pr, stereo_mode); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1456 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1457 |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1458 StereoPixbufData image_stereo_pixbuf_get(ImageWindow *imd) |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1459 { |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1460 return imd->user_stereo; |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1461 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1462 |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1463 void image_stereo_pixbuf_set(ImageWindow *imd, StereoPixbufData stereo_mode) |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1464 { |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1465 imd->user_stereo = stereo_mode; |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1466 image_reload(imd); |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1467 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1468 |
9 | 1469 /* read ahead */ |
1470 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1471 void image_prebuffer_set(ImageWindow *imd, FileData *fd) |
9 | 1472 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1473 if (pixbuf_renderer_get_tiles((PixbufRenderer *)imd->pr)) return; |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1474 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1475 if (fd) |
9 | 1476 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1477 if (!file_cache_get(image_get_cache(), fd)) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1478 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1479 image_read_ahead_set(imd, fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1480 } |
9 | 1481 } |
1482 else | |
1483 { | |
1484 image_read_ahead_cancel(imd); | |
1485 } | |
1486 } | |
1487 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1488 static void image_notify_cb(FileData *fd, NotifyType type, gpointer data) |
9 | 1489 { |
1490 ImageWindow *imd = data; | |
442 | 1491 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1492 if (!imd || !image_get_pixbuf(imd) || |
995 | 1493 /* imd->il || */ /* loading in progress - do not check - it should start from the beginning anyway */ |
891
d227b0af7410
fixed test for changed files in cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
890
diff
changeset
|
1494 !imd->image_fd || /* nothing to reload */ |
903
24b605a2ea12
periodic testing of changed files can be now disabled
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
891
diff
changeset
|
1495 imd->state == IMAGE_STATE_NONE /* loading not started, no need to reload */ |
24b605a2ea12
periodic testing of changed files can be now disabled
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
891
diff
changeset
|
1496 ) return; |
9 | 1497 |
1731
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1498 if ((type & NOTIFY_REREAD) && fd == imd->image_fd) |
9 | 1499 { |
1731
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1500 /* there is no need to reload on NOTIFY_CHANGE, |
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1501 modified files should be detacted anyway and NOTIFY_REREAD should be recieved |
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1502 or they are removed from the filelist completely on "move" and "delete" |
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1503 */ |
1498
2b0712dcf139
improved debug messages
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1482
diff
changeset
|
1504 DEBUG_1("Notify image: %s %04x", fd->path, type); |
9 | 1505 image_reload(imd); |
1506 } | |
1507 } | |
1508 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1509 void image_auto_refresh_enable(ImageWindow *imd, gboolean enable) |
9 | 1510 { |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1511 if (!enable && imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1512 file_data_unregister_real_time_monitor(imd->image_fd); |
9 | 1513 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1514 if (enable && !imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1515 file_data_register_real_time_monitor(imd->image_fd); |
9 | 1516 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1517 imd->auto_refresh = enable; |
9 | 1518 } |
1519 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1520 void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync) |
9 | 1521 { |
1522 imd->top_window_sync = allow_sync; | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1523 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1524 g_object_set(G_OBJECT(imd->pr), "window_fit", allow_sync, NULL); |
9 | 1525 } |
1526 | |
1527 void image_background_set_color(ImageWindow *imd, GdkColor *color) | |
1528 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1529 pixbuf_renderer_set_color((PixbufRenderer *)imd->pr, color); |
9 | 1530 } |
1531 | |
1626
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1532 void image_background_set_color_from_options(ImageWindow *imd, gboolean fullscreen) |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1533 { |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1534 GdkColor *color = NULL; |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1535 |
1644
2b10e2bee592
the options for custom border color were made independent
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1639
diff
changeset
|
1536 if ((options->image.use_custom_border_color && !fullscreen) || |
2b10e2bee592
the options for custom border color were made independent
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1639
diff
changeset
|
1537 (options->image.use_custom_border_color_in_fullscreen && fullscreen)) |
1626
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1538 { |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1539 color = &options->image.border_color; |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1540 } |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1541 |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1542 image_background_set_color(imd, color); |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1543 } |
63527696d61c
Add an option to Image preferences to restrict custom border to fullscreen mode only. Bug 2798062.
Laurent Monin <geeqie@norz.org>
parents:
1567
diff
changeset
|
1544 |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1545 void image_color_profile_set(ImageWindow *imd, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1546 gint input_type, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1547 gboolean use_image) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1548 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1549 if (!imd) return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1550 |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1551 if (input_type < 0 || input_type >= COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1552 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1553 return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1554 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1555 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1556 imd->color_profile_input = input_type; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1557 imd->color_profile_use_image = use_image; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1558 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1559 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1560 gboolean image_color_profile_get(ImageWindow *imd, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1561 gint *input_type, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1562 gboolean *use_image) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1563 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1564 if (!imd) return FALSE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1565 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1566 if (input_type) *input_type = imd->color_profile_input; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1567 if (use_image) *use_image = imd->color_profile_use_image; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1568 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1569 return TRUE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1570 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1571 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1572 void image_color_profile_set_use(ImageWindow *imd, gboolean enable) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1573 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1574 if (!imd) return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1575 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1576 if (imd->color_profile_enable == enable) return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1577 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1578 imd->color_profile_enable = enable; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1579 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1580 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1581 gboolean image_color_profile_get_use(ImageWindow *imd) |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1582 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1583 if (!imd) return FALSE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1584 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1585 return imd->color_profile_enable; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1586 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1587 |
1549
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1588 gboolean image_color_profile_get_status(ImageWindow *imd, gchar **image_profile, gchar **screen_profile) |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1589 { |
1549
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1590 ColorMan *cm; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1591 if (!imd) return FALSE; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1592 |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1593 cm = imd->cm; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1594 if (!cm) return FALSE; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1595 return color_man_get_status(cm, image_profile, screen_profile); |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1596 |
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1597 } |
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1598 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1599 void image_set_delay_flip(ImageWindow *imd, gboolean delay) |
9 | 1600 { |
1601 if (!imd || | |
1602 imd->delay_flip == delay) return; | |
1603 | |
1604 imd->delay_flip = delay; | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1605 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1606 g_object_set(G_OBJECT(imd->pr), "delay_flip", delay, NULL); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1607 |
9 | 1608 if (!imd->delay_flip && imd->il) |
1609 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1610 PixbufRenderer *pr; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1611 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1612 pr = PIXBUF_RENDERER(imd->pr); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1613 if (pr->pixbuf) g_object_unref(pr->pixbuf); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1614 pr->pixbuf = NULL; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1615 |
9 | 1616 image_load_pixbuf_ready(imd); |
1617 } | |
1618 } | |
1619 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1620 void image_to_root_window(ImageWindow *imd, gboolean scaled) |
9 | 1621 { |
1622 GdkScreen *screen; | |
3 | 1623 GdkWindow *rootwindow; |
1624 GdkPixmap *pixmap; | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1625 GdkPixbuf *pixbuf; |
9 | 1626 GdkPixbuf *pb; |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1627 gint width, height; |
9 | 1628 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1629 if (!imd) return; |
9 | 1630 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1631 pixbuf = image_get_pixbuf(imd); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1632 if (!pixbuf) return; |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1633 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1634 screen = gtk_widget_get_screen(imd->widget); |
9 | 1635 rootwindow = gdk_screen_get_root_window(screen); |
1636 if (gdk_drawable_get_visual(rootwindow) != gdk_visual_get_system()) return; | |
3 | 1637 |
1638 if (scaled) | |
1639 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1640 width = gdk_screen_width(); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1641 height = gdk_screen_height(); |
3 | 1642 } |
1643 else | |
1644 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1645 pixbuf_renderer_get_scaled_size((PixbufRenderer *)imd->pr, &width, &height); |
3 | 1646 } |
1647 | |
334
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1648 pb = gdk_pixbuf_scale_simple(pixbuf, width, height, (GdkInterpType)options->image.zoom_quality); |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1649 |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1650 gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, NULL, 128); |
3 | 1651 gdk_window_set_back_pixmap(rootwindow, pixmap, FALSE); |
1652 gdk_window_clear(rootwindow); | |
9 | 1653 g_object_unref(pb); |
1654 g_object_unref(pixmap); | |
3 | 1655 |
1656 gdk_flush(); | |
1657 } | |
1658 | |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1659 void image_select(ImageWindow *imd, gboolean select) |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1660 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1661 if (!imd->has_frame) return; |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1662 |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1663 if (select) |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1664 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1665 gtk_widget_set_state(imd->widget, GTK_STATE_SELECTED); |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1666 gtk_widget_set_state(imd->pr, GTK_STATE_NORMAL); /* do not propagate */ |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1667 } |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1668 else |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1669 gtk_widget_set_state(imd->widget, GTK_STATE_NORMAL); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1670 } |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1671 |
174
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1672 void image_set_selectable(ImageWindow *imd, gboolean selectable) |
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1673 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1674 if (!imd->has_frame) return; |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1675 |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1676 gtk_frame_set_shadow_type(GTK_FRAME(imd->frame), GTK_SHADOW_NONE); |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1677 gtk_container_set_border_width(GTK_CONTAINER(imd->frame), selectable ? 4 : 0); |
174
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1678 } |
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1679 |
1482
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1680 void image_grab_focus(ImageWindow *imd) |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1681 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1682 if (imd->has_frame) |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1683 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1684 gtk_widget_grab_focus(imd->frame); |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1685 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1686 else |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1687 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1688 gtk_widget_grab_focus(imd->widget); |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1689 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1690 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1691 |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1692 |
9 | 1693 /* |
1694 *------------------------------------------------------------------- | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1695 * prefs sync |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1696 *------------------------------------------------------------------- |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1697 */ |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1698 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1699 static void image_options_set(ImageWindow *imd) |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1700 { |
334
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1701 g_object_set(G_OBJECT(imd->pr), "zoom_quality", options->image.zoom_quality, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1702 "zoom_2pass", options->image.zoom_2pass, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1703 "zoom_expand", options->image.zoom_to_fit_allow_expand, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1704 "dither_quality", options->image.dither_quality, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1705 "scroll_reset", options->image.scroll_reset_method, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1706 "cache_display", options->image.tile_cache_max, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1707 "window_fit", (imd->top_window_sync && options->image.fit_window_to_image), |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1708 "window_limit", options->image.limit_window_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1709 "window_limit_value", options->image.max_window_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1710 "autofit_limit", options->image.limit_autofit_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1711 "autofit_limit_value", options->image.max_autofit_size, |
209
ce89a8349d8b
configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
208
diff
changeset
|
1712 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1713 NULL); |
27
ff0b02ab8da7
Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
26
diff
changeset
|
1714 |
ff0b02ab8da7
Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
26
diff
changeset
|
1715 pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)imd->top_window); |
1887
cca739d627fd
stereo mode preferences
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1886
diff
changeset
|
1716 |
cca739d627fd
stereo mode preferences
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1886
diff
changeset
|
1717 image_stereo_set(imd, options->stereo.mode); |
1891
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1718 pixbuf_renderer_stereo_fixed_set((PixbufRenderer *)imd->pr, |
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1719 options->stereo.fixed_w, options->stereo.fixed_h, |
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1720 options->stereo.fixed_x1, options->stereo.fixed_y1, |
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1721 options->stereo.fixed_x2, options->stereo.fixed_y2); |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1722 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1723 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1724 void image_options_sync(void) |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1725 { |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1726 GList *work; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1727 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1728 work = image_list; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1729 while (work) |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1730 { |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1731 ImageWindow *imd; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1732 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1733 imd = work->data; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1734 work = work->next; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1735 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1736 image_options_set(imd); |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1737 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1738 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1739 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1740 /* |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1741 *------------------------------------------------------------------- |
9 | 1742 * init / destroy |
1743 *------------------------------------------------------------------- | |
1744 */ | |
1745 | |
1746 static void image_free(ImageWindow *imd) | |
1747 { | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1748 image_list = g_list_remove(image_list, imd); |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1749 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1750 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1751 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1752 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1753 file_data_unregister_notify_func(image_notify_cb, imd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1754 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1755 image_reset(imd); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1756 |
9 | 1757 image_read_ahead_cancel(imd); |
1758 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1759 file_data_unref(imd->image_fd); |
9 | 1760 g_free(imd->title); |
1761 g_free(imd->title_right); | |
1762 g_free(imd); | |
1763 } | |
1764 | |
1765 static void image_destroy_cb(GtkObject *widget, gpointer data) | |
1766 { | |
1767 ImageWindow *imd = data; | |
1768 image_free(imd); | |
1769 } | |
1770 | |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1771 gboolean selectable_frame_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data) |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1772 { |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1773 gtk_paint_flat_box(widget->style, |
442 | 1774 widget->window, |
1775 widget->state, | |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1776 (GTK_FRAME(widget))->shadow_type, |
442 | 1777 NULL, |
1778 widget, | |
1779 NULL, | |
1780 widget->allocation.x + 3, widget->allocation.y + 3, | |
1781 widget->allocation.width - 6, widget->allocation.height - 6); | |
1782 | |
1783 | |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1784 return FALSE; |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1785 } |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1786 |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1787 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1788 void image_set_frame(ImageWindow *imd, gboolean frame) |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1789 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1790 frame = !!frame; |
442 | 1791 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1792 if (frame == imd->has_frame) return; |
442 | 1793 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1794 gtk_widget_hide(imd->pr); |
442 | 1795 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1796 if (frame) |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1797 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1798 imd->frame = gtk_frame_new(NULL); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1799 #if GTK_CHECK_VERSION(2,12,0) |
1358 | 1800 g_object_ref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1801 #else |
1358 | 1802 gtk_widget_ref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1803 #endif |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1804 if (imd->has_frame != -1) gtk_container_remove(GTK_CONTAINER(imd->widget), imd->pr); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1805 gtk_container_add(GTK_CONTAINER(imd->frame), imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1806 |
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1807 #if GTK_CHECK_VERSION(2,12,0) |
1358 | 1808 g_object_unref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1809 #else |
1358 | 1810 gtk_widget_unref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1811 #endif |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1812 g_signal_connect(G_OBJECT(imd->frame), "expose_event", |
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1813 G_CALLBACK(selectable_frame_expose_cb), NULL); |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1814 |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1815 GTK_WIDGET_SET_FLAGS(imd->frame, GTK_CAN_FOCUS); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1816 g_signal_connect(G_OBJECT(imd->frame), "focus_in_event", |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1817 G_CALLBACK(image_focus_in_cb), imd); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1818 g_signal_connect(G_OBJECT(imd->frame), "focus_out_event", |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1819 G_CALLBACK(image_focus_out_cb), imd); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1820 |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1821 g_signal_connect_after(G_OBJECT(imd->frame), "expose_event", |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1822 G_CALLBACK(image_focus_expose), imd); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1823 |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1824 #if GTK_CHECK_VERSION(2,14,0) |
1358 | 1825 gtk_box_pack_start(GTK_BOX(imd->widget), imd->frame, TRUE, TRUE, 0); |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1826 #else |
1358 | 1827 gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->frame); |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1828 #endif |
1358 | 1829 gtk_widget_show(imd->frame); |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1830 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1831 else |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1832 { |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1833 #if GTK_CHECK_VERSION(2,12,0) |
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1834 g_object_ref(imd->pr); |
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1835 #else |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1836 gtk_widget_ref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1837 #endif |
442 | 1838 if (imd->frame) |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1839 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1840 gtk_container_remove(GTK_CONTAINER(imd->frame), imd->pr); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1841 gtk_widget_destroy(imd->frame); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1842 imd->frame = NULL; |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1843 } |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1844 #if GTK_CHECK_VERSION(2,14,0) |
1358 | 1845 gtk_box_pack_start(GTK_BOX(imd->widget), imd->pr, TRUE, TRUE, 0); |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1846 #else |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1847 gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->pr); |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
1848 #endif |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1849 |
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1850 #if GTK_CHECK_VERSION(2,12,0) |
1358 | 1851 g_object_unref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1852 #else |
1358 | 1853 gtk_widget_unref(imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
1854 #endif |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1855 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1856 |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1857 gtk_widget_show(imd->pr); |
442 | 1858 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1859 imd->has_frame = frame; |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1860 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1861 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1862 ImageWindow *image_new(gboolean frame) |
9 | 1863 { |
1864 ImageWindow *imd; | |
1865 | |
1866 imd = g_new0(ImageWindow, 1); | |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1867 |
9 | 1868 imd->unknown = TRUE; |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1869 imd->has_frame = -1; /* not initialized; for image_set_frame */ |
9 | 1870 imd->delay_alter_type = ALTER_NONE; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1871 imd->state = IMAGE_STATE_NONE; |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1872 imd->color_profile_from_image = COLOR_PROFILE_NONE; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1873 imd->orientation = 1; |
9 | 1874 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1875 imd->pr = GTK_WIDGET(pixbuf_renderer_new()); |
9 | 1876 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1877 image_options_set(imd); |
9 | 1878 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1879 imd->widget = gtk_vbox_new(0, 0); |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
1880 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1881 image_set_frame(imd, frame); |
9 | 1882 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
1883 image_set_selectable(imd, 0); |
9 | 1884 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1885 g_signal_connect(G_OBJECT(imd->pr), "clicked", |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1886 G_CALLBACK(image_click_cb), imd); |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1887 g_signal_connect(G_OBJECT(imd->pr), "scroll_notify", |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1888 G_CALLBACK(image_scroll_notify_cb), imd); |
9 | 1889 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1890 g_signal_connect(G_OBJECT(imd->pr), "scroll_event", |
9 | 1891 G_CALLBACK(image_scroll_cb), imd); |
1892 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1893 g_signal_connect(G_OBJECT(imd->pr), "destroy", |
9 | 1894 G_CALLBACK(image_destroy_cb), imd); |
1895 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
1896 g_signal_connect(G_OBJECT(imd->pr), "zoom", |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
1897 G_CALLBACK(image_zoom_cb), imd); |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
1898 g_signal_connect(G_OBJECT(imd->pr), "render_complete", |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
1899 G_CALLBACK(image_render_complete_cb), imd); |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1900 g_signal_connect(G_OBJECT(imd->pr), "drag", |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1901 G_CALLBACK(image_drag_cb), imd); |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
1902 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1903 file_data_register_notify_func(image_notify_cb, imd, NOTIFY_PRIORITY_LOW); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1904 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1905 image_list = g_list_append(image_list, imd); |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1906 |
9 | 1907 return imd; |
1908 } | |
1055
4bbdfab3c89a
Adding a vim modeline to all files - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1045
diff
changeset
|
1909 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |