Mercurial > hg > forks > geeqie
annotate src/image.c @ 2909:2e7fd08bfbe4
DEBUG_NAME() function for use with GTKInspector
This debug function can be used with GTKInspector to provide a visual
indication of where a widget is declared.
This is a documentation facility to aid developers new to the project.
Sample call:
GTK_DEBUG=interactive src/geeqie
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Thu, 14 Feb 2019 12:05:04 +0000 |
parents | f105ca657cb3 |
children |
rev | line source |
---|---|
1 | 1 /* |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
2 * Copyright (C) 2006 John Ellis |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
3 * Copyright (C) 2008 - 2016 The Geeqie Team |
1 | 4 * |
5 * Author: John Ellis | |
6 * | |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
10 * (at your option) any later version. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
11 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
15 * GNU General Public License for more details. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
16 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
17 * You should have received a copy of the GNU General Public License along |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
18 * with this program; if not, write to the Free Software Foundation, Inc., |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2347
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
1 | 20 */ |
21 | |
281 | 22 #include "main.h" |
1 | 23 #include "image.h" |
9 | 24 |
25 | |
26 #include "collect.h" | |
2737
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
27 #include "collect-table.h" |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
28 #include "color-man.h" |
9 | 29 #include "exif.h" |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
30 #include "metadata.h" |
480
c6ba1d81cf42
Make histogram depends on image window not layout window.
Laurent Monin <geeqie@norz.org>
parents:
475
diff
changeset
|
31 #include "histogram.h" |
507
7408e89b601d
Move debug macros from main.h to new debug.h.
Laurent Monin <geeqie@norz.org>
parents:
506
diff
changeset
|
32 #include "image-load.h" |
415
7c97f17797f5
Add zoom ratio display to OSD in fullscreen mode.
Laurent Monin <geeqie@norz.org>
parents:
414
diff
changeset
|
33 #include "image-overlay.h" |
284
8dae20c78d18
Fix missing header files inclusions.
Laurent Monin <geeqie@norz.org>
parents:
281
diff
changeset
|
34 #include "layout.h" |
8dae20c78d18
Fix missing header files inclusions.
Laurent Monin <geeqie@norz.org>
parents:
281
diff
changeset
|
35 #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
|
36 #include "pixbuf-renderer.h" |
9 | 37 #include "pixbuf_util.h" |
38 #include "ui_fileops.h" | |
39 | |
586
122fc2223b42
split filelist.c to filefilter.c and filedata.c
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
530
diff
changeset
|
40 #include "filedata.h" |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
41 #include "filecache.h" |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
42 |
9 | 43 #include <math.h> |
44 | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
45 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
|
46 |
61
72245fb0b946
Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
42
diff
changeset
|
47 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
|
48 static void image_read_ahead_start(ImageWindow *imd); |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
49 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
|
50 |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
51 // For draw rectangle function |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
52 static gint pixbuf_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
53 static gint pixbuf_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
54 static gint image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
55 static gint image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
56 static gint rect_x1, rect_x2, rect_y1, rect_y2; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
57 static gint rect_id = 0; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
58 |
1 | 59 /* |
9 | 60 *------------------------------------------------------------------- |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
61 * 'signals' |
9 | 62 *------------------------------------------------------------------- |
63 */ | |
64 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
65 static void image_click_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data) |
9 | 66 { |
67 ImageWindow *imd = data; | |
2466
d286a43ba3b5
Fix #290: Mouse-only image viewing
Colin Clark <cclark@mcb.net>
parents:
2452
diff
changeset
|
68 if (!options->image_lm_click_nav && event->button == MOUSE_BUTTON_MIDDLE) |
d286a43ba3b5
Fix #290: Mouse-only image viewing
Colin Clark <cclark@mcb.net>
parents:
2452
diff
changeset
|
69 { |
d286a43ba3b5
Fix #290: Mouse-only image viewing
Colin Clark <cclark@mcb.net>
parents:
2452
diff
changeset
|
70 imd->mouse_wheel_mode = !imd->mouse_wheel_mode; |
d286a43ba3b5
Fix #290: Mouse-only image viewing
Colin Clark <cclark@mcb.net>
parents:
2452
diff
changeset
|
71 } |
9 | 72 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
73 if (imd->func_button) |
9 | 74 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
75 imd->func_button(imd, event, imd->data_button); |
9 | 76 } |
77 } | |
78 | |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
79 static void switch_coords_orientation(ImageWindow *imd, gint x, gint y, gint width, gint height) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
80 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
81 switch (imd->orientation) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
82 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
83 case EXIF_ORIENTATION_TOP_LEFT: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
84 /* normal -- nothing to do */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
85 rect_x1 = image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
86 rect_y1 = image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
87 rect_x2 = x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
88 rect_y2 = y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
89 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
90 case EXIF_ORIENTATION_TOP_RIGHT: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
91 /* mirrored */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
92 rect_x1 = width - x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
93 rect_y1 = image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
94 rect_x2 = width - image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
95 rect_y2 = y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
96 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
97 case EXIF_ORIENTATION_BOTTOM_RIGHT: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
98 /* upside down */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
99 rect_x1 = width - x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
100 rect_y1 = height - y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
101 rect_x2 = width - image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
102 rect_y2 = height - image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
103 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
104 case EXIF_ORIENTATION_BOTTOM_LEFT: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
105 /* flipped */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
106 rect_x1 = image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
107 rect_y1 = height - y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
108 rect_x2 = x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
109 rect_y2 = height - image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
110 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
111 case EXIF_ORIENTATION_LEFT_TOP: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
112 /* left mirrored */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
113 rect_x1 = image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
114 rect_y1 = image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
115 rect_x2 = y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
116 rect_y2 = x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
117 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
118 case EXIF_ORIENTATION_RIGHT_TOP: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
119 /* rotated -90 (270) */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
120 rect_x1 = image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
121 rect_y1 = width - x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
122 rect_x2 = y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
123 rect_y2 = width - image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
124 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
125 case EXIF_ORIENTATION_RIGHT_BOTTOM: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
126 /* right mirrored */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
127 rect_x1 = height - y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
128 rect_y1 = width - x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
129 rect_x2 = height - image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
130 rect_y2 = width - image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
131 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
132 case EXIF_ORIENTATION_LEFT_BOTTOM: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
133 /* rotated 90 */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
134 rect_x1 = height - y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
135 rect_y1 = image_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
136 rect_x2 = height - image_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
137 rect_y2 = x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
138 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
139 default: |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
140 /* The other values are out of range */ |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
141 break; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
142 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
143 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
144 |
2565
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
145 static void image_press_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data) |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
146 { |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
147 ImageWindow *imd = data; |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
148 LayoutWindow *lw; |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
149 gint x_pixel, y_pixel; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
150 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
151 if(options->draw_rectangle) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
152 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
153 pixbuf_renderer_get_mouse_position(pr, &x_pixel, &y_pixel); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
154 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
155 pixbuf_start_x = event->x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
156 pixbuf_start_y = event->y; |
2862
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
157 |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
158 if (x_pixel == -1) |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
159 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
160 image_start_x = 0; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
161 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
162 else |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
163 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
164 image_start_x = x_pixel; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
165 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
166 |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
167 if (y_pixel == -1) |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
168 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
169 image_start_y = 0; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
170 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
171 else |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
172 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
173 image_start_y = y_pixel; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
174 } |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
175 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
176 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
177 if (rect_id) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
178 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
179 pixbuf_renderer_overlay_remove((PixbufRenderer *)imd->pr, rect_id); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
180 } |
2565
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
181 |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
182 lw = layout_find_by_image(imd); |
2610
34ca0d97d79d
Bug fix: Segfault in pan view
Colin Clark <colin.clark@cclark.uk>
parents:
2597
diff
changeset
|
183 if (lw && event->button == MOUSE_BUTTON_LEFT && event->type == GDK_2BUTTON_PRESS |
34ca0d97d79d
Bug fix: Segfault in pan view
Colin Clark <colin.clark@cclark.uk>
parents:
2597
diff
changeset
|
184 && !options->image_lm_click_nav) |
2565
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
185 { |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
186 if (lw->full_screen) |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
187 layout_image_full_screen_stop(lw); |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
188 } |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
189 } |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
190 |
2452
8bcdac2603d3
Fix #473: Parameter type fix for "motion-notify-event" signal handlers
Colin Clark <cclark@mcb.net>
parents:
2440
diff
changeset
|
191 static void image_drag_cb(PixbufRenderer *pr, GdkEventMotion *event, gpointer data) |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
192 { |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
193 ImageWindow *imd = data; |
129
b1ba80767864
started relative scroll, keep scroll position
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
128
diff
changeset
|
194 gint width, height; |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
195 gint rect_width; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
196 gint rect_height; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
197 GdkPixbuf *rect_pixbuf; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
198 gint x_pixel, y_pixel; |
2862
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
199 gint image_x_pixel, image_y_pixel; |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
200 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
201 if (options->draw_rectangle) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
202 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
203 pixbuf_renderer_get_image_size(pr, &width, &height); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
204 pixbuf_renderer_get_mouse_position(pr, &x_pixel, &y_pixel); |
2862
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
205 |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
206 if (x_pixel == -1) |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
207 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
208 image_x_pixel = width; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
209 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
210 else |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
211 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
212 image_x_pixel = x_pixel; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
213 } |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
214 |
2862
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
215 if (y_pixel == -1) |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
216 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
217 image_y_pixel = height; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
218 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
219 else |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
220 { |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
221 image_y_pixel = y_pixel; |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
222 } |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
223 |
f105ca657cb3
Bug fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2847
diff
changeset
|
224 switch_coords_orientation(imd, image_x_pixel, image_y_pixel, width, height); |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
225 if (rect_id) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
226 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
227 pixbuf_renderer_overlay_remove((PixbufRenderer *)imd->pr, rect_id); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
228 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
229 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
230 rect_width = pr->drag_last_x - pixbuf_start_x; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
231 if (rect_width <= 0) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
232 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
233 rect_width = 1; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
234 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
235 rect_height = pr->drag_last_y - pixbuf_start_y; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
236 if (rect_height <= 0) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
237 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
238 rect_height = 1; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
239 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
240 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
241 rect_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, rect_width, rect_height); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
242 pixbuf_set_rect_fill(rect_pixbuf, 0, 0, rect_width, rect_height, 255, 255, 255, 0); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
243 pixbuf_set_rect(rect_pixbuf, 1, 1, rect_width-2, rect_height - 2, 0, 0, 0, 255, 1, 1, 1, 1); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
244 pixbuf_set_rect(rect_pixbuf, 2, 2, rect_width-4, rect_height - 4, 255, 255, 255, 255, 1, 1, 1, 1); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
245 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
246 rect_id = pixbuf_renderer_overlay_add((PixbufRenderer *)imd->pr, rect_pixbuf, pixbuf_start_x, pixbuf_start_y, OVL_NORMAL); |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
247 } |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
248 |
129
b1ba80767864
started relative scroll, keep scroll position
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
128
diff
changeset
|
249 pixbuf_renderer_get_scaled_size(pr, &width, &height); |
442 | 250 |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
251 if (imd->func_drag) |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
252 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
253 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
|
254 (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
|
255 (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
|
256 imd->data_button); |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
257 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
258 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
259 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
260 static void image_scroll_notify_cb(PixbufRenderer *pr, gpointer data) |
9 | 261 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
262 ImageWindow *imd = data; |
9 | 263 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
264 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
|
265 { |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
266 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
|
267 (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
|
268 (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
|
269 (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
|
270 (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
|
271 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
|
272 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
273 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
274 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
275 static void image_update_util(ImageWindow *imd) |
1 | 276 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
277 if (imd->func_update) imd->func_update(imd, imd->data_update); |
9 | 278 } |
279 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
280 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
281 static void image_complete_util(ImageWindow *imd, gboolean preload) |
9 | 282 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
283 if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return; |
9 | 284 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
285 DEBUG_1("%s image load completed \"%s\" (%s)", get_exec_time(), |
442 | 286 (preload) ? (imd->read_ahead_fd ? imd->read_ahead_fd->path : "null") : |
287 (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
|
288 (preload) ? "preload" : "current"); |
9 | 289 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
290 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
|
291 if (imd->func_complete) imd->func_complete(imd, preload, imd->data_complete); |
1 | 292 } |
293 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
294 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
|
295 { |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
296 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
|
297 |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
298 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
|
299 } |
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
300 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
301 static void image_state_set(ImageWindow *imd, ImageState state) |
9 | 302 { |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
303 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
|
304 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
305 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
|
306 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
307 else |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
308 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
309 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
|
310 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
311 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
|
312 } |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
313 |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
314 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
|
315 { |
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
316 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
|
317 if (imd->func_state) imd->func_state(imd, state, imd->data_state); |
1 | 318 } |
319 | |
1791
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
320 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
|
321 { |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
322 ImageWindow *imd = data; |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
323 |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 } |
834c16343cb3
Fix osd zoom level refreshing (it was broken since some times).
Laurent Monin <geeqie@norz.org>
parents:
1731
diff
changeset
|
328 |
1 | 329 /* |
9 | 330 *------------------------------------------------------------------- |
331 * misc | |
332 *------------------------------------------------------------------- | |
333 */ | |
334 | |
335 static void image_update_title(ImageWindow *imd) | |
1 | 336 { |
9 | 337 gchar *title = NULL; |
338 gchar *zoom = NULL; | |
339 gchar *collection = NULL; | |
2739
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
340 LayoutWindow *lw; |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
341 gchar *lw_ident = NULL; |
9 | 342 |
343 if (!imd->top_window) return; | |
344 | |
345 if (imd->collection && collection_to_number(imd->collection) >= 0) | |
346 { | |
987
0f029bb4968c
Mark forgotten string for translation.
Laurent Monin <geeqie@norz.org>
parents:
954
diff
changeset
|
347 const gchar *name = imd->collection->name; |
9 | 348 if (!name) name = _("Untitled"); |
987
0f029bb4968c
Mark forgotten string for translation.
Laurent Monin <geeqie@norz.org>
parents:
954
diff
changeset
|
349 collection = g_strdup_printf(_(" (Collection %s)"), name); |
9 | 350 } |
351 | |
352 if (imd->title_show_zoom) | |
1 | 353 { |
9 | 354 gchar *buf = image_zoom_get_as_text(imd); |
355 zoom = g_strconcat(" [", buf, "]", NULL); | |
356 g_free(buf); | |
1 | 357 } |
358 | |
2739
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
359 lw = layout_find_by_image(imd); |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
360 if (lw) |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
361 { |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
362 lw_ident = g_strconcat(" (", lw->options.id, ")", NULL); |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
363 } |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
364 |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
365 title = g_strdup_printf("%s%s%s%s%s%s%s", |
9 | 366 imd->title ? imd->title : "", |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
367 imd->image_fd ? imd->image_fd->name : "", |
9 | 368 zoom ? zoom : "", |
369 collection ? collection : "", | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
370 imd->image_fd ? " - " : "", |
2739
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
371 imd->title_right ? imd->title_right : "", |
2740
808983eb036e
Option to display window ID
Colin Clark <colin.clark@cclark.uk>
parents:
2739
diff
changeset
|
372 options->show_window_ids ? (lw_ident ? lw_ident : "") : "" |
2739
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
373 ); |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
374 if (lw_ident) |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
375 { |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
376 g_free(lw_ident); |
a03b5446e68f
Additional remote commands for layout windows
Colin Clark <colin.clark@cclark.uk>
parents:
2737
diff
changeset
|
377 } |
9 | 378 |
379 gtk_window_set_title(GTK_WINDOW(imd->top_window), title); | |
380 | |
381 g_free(title); | |
382 g_free(zoom); | |
383 g_free(collection); | |
384 } | |
385 | |
386 /* | |
387 *------------------------------------------------------------------- | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
388 * rotation, flip, etc. |
9 | 389 *------------------------------------------------------------------- |
390 */ | |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
391 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
|
392 { |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
393 GdkScreen *screen = gtk_widget_get_screen(imd->widget);; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
394 GdkAtom type = GDK_NONE; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
395 gint format = 0; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
396 |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
397 return (gdk_property_get(gdk_screen_get_root_window(screen), |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
398 gdk_atom_intern ("_ICC_PROFILE", FALSE), |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
399 GDK_NONE, |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
400 0, 64 * 1024 * 1024, FALSE, |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
401 &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
|
402 } |
9 | 403 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
404 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
|
405 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
406 ColorMan *cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
407 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
|
408 ColorManProfileType screen_type; |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
409 const gchar *input_file = NULL; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
410 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
|
411 guchar *profile = NULL; |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
412 guint profile_len; |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
413 guchar *screen_profile = NULL; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
414 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
|
415 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
|
416 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
417 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
|
418 |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
419 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
|
420 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
|
421 { |
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
|
422 const gchar *file = options->color_profile.input_file[imd->color_profile_input - COLOR_PROFILE_FILE]; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
423 |
1362
58a1649f728b
Improve file checks using is_readable_file().
Laurent Monin <geeqie@norz.org>
parents:
1359
diff
changeset
|
424 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
|
425 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
426 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
|
427 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
|
428 } |
442 | 429 else if (imd->color_profile_input >= COLOR_PROFILE_SRGB && |
430 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
|
431 { |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
432 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
|
433 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
|
434 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
435 else |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
436 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
437 return FALSE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
438 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
439 |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
440 if (options->color_profile.use_x11_screen_profile && |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
441 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
|
442 { |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
443 screen_type = COLOR_PROFILE_MEM; |
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
444 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
|
445 } |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
446 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
|
447 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
|
448 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
449 screen_type = COLOR_PROFILE_FILE; |
327
e2fc4d9e7174
Rename color profile options.
Laurent Monin <geeqie@norz.org>
parents:
320
diff
changeset
|
450 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
|
451 } |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
452 else |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
453 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
454 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
|
455 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
|
456 } |
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
|
457 |
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
|
458 |
426
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
459 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
|
460 |
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
|
461 exif = exif_read_fd(imd->image_fd); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
462 |
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
|
463 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
|
464 { |
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
|
465 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
|
466 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
|
467 { |
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
|
468 if (!imd->color_profile_use_image) |
424
3cbf9a9d896f
first support for AdobeRGB colorspace
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
415
diff
changeset
|
469 { |
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
|
470 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
|
471 profile = NULL; |
424
3cbf9a9d896f
first support for AdobeRGB colorspace
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
415
diff
changeset
|
472 } |
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
|
473 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
|
474 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
|
475 } |
1364
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
476 else |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
477 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
478 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
|
479 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
480 if (interop_index) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
481 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
482 /* Exif 2.21 specification */ |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
483 if (!strcmp(interop_index, "R98")) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
484 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
485 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
|
486 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
|
487 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
488 else if (!strcmp(interop_index, "R03")) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
489 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
490 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
|
491 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
|
492 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
493 g_free(interop_index); |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
494 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
495 else |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
496 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
497 gint cs; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
498 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
499 /* 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
|
500 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
|
501 if (cs == 1) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
502 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
503 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
|
504 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
|
505 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
506 else if (cs == 2) |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
507 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
508 /* 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
|
509 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
|
510 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
|
511 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
512 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
513 |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
514 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
|
515 { |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
516 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
|
517 input_file = NULL; |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
518 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
519 } |
84d8b7f50ca2
Clarify colorspace determination (exif 2.2/2.21).
Laurent Monin <geeqie@norz.org>
parents:
1363
diff
changeset
|
520 |
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
|
521 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
|
522 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
523 |
176
254f45cec904
simplified exif.h, moved implementation-specific stuff to exif-int.h
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
175
diff
changeset
|
524 |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
446
diff
changeset
|
525 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
|
526 { |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
527 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
|
528 profile, profile_len, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
529 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
|
530 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
|
531 } |
442 | 532 else |
114
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
533 { |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
534 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
|
535 input_type, input_file, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
536 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
|
537 } |
3b5429dfd1d3
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
113
diff
changeset
|
538 |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
539 if (cm) |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
540 { |
116
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
541 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
|
542 { |
5a55c5f7d368
Tue Nov 28 13:17:18 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
115
diff
changeset
|
543 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
|
544 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
|
545 } |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
546 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
547 imd->cm = (gpointer)cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
548 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
549 |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
550 image_update_util(imd); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
551 |
1638
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
552 if (screen_profile) |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
553 { |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
554 g_free(screen_profile); |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
555 screen_profile = NULL; |
98fe6dc74fdf
fixed leak in image_post_process_color
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1626
diff
changeset
|
556 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
557 |
1550
dd8af73d49f1
color profile fixes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1549
diff
changeset
|
558 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
|
559 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
560 |
9 | 561 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
562 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
|
563 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
564 ImageWindow *imd = (ImageWindow *)data; |
442 | 565 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
|
566 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
|
567 |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
568 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
569 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
570 void image_alter_orientation(ImageWindow *imd, FileData *fd_n, AlterType type) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
571 { |
691
d82fb3402662
Fix some incomplete initialization warnings.
Laurent Monin <geeqie@norz.org>
parents:
671
diff
changeset
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
578 gint orientation; |
442 | 579 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
580 if (!imd || !imd->pr || !imd->image_fd || !fd_n) return; |
442 | 581 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
582 orientation = EXIF_ORIENTATION_TOP_LEFT; |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
583 { |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
584 if (fd_n->user_orientation) |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
585 { |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
586 orientation = fd_n->user_orientation; |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
587 } |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
588 else |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
589 if (options->metadata.write_orientation) |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
590 { |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
591 orientation = metadata_read_int(fd_n, ORIENTATION_KEY, EXIF_ORIENTATION_TOP_LEFT); |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
592 } |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
593 } |
442 | 594 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
595 switch (type) |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
596 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
597 case ALTER_ROTATE_90: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
598 orientation = rotate_90[orientation]; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
599 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
600 case ALTER_ROTATE_90_CC: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
601 orientation = rotate_90_cc[orientation]; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
602 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
603 case ALTER_ROTATE_180: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
604 orientation = rotate_180[orientation]; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
605 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
606 case ALTER_MIRROR: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
607 orientation = mirror[orientation]; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
608 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
609 case ALTER_FLIP: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
610 orientation = flip[orientation]; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
611 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
612 case ALTER_NONE: |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
613 orientation = fd_n->exif_orientation ? fd_n->exif_orientation : 1; |
439
a529755a2be0
Add a way to restore original state in Adjust menu.
Laurent Monin <geeqie@norz.org>
parents:
437
diff
changeset
|
614 break; |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
615 default: |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
616 return; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
617 break; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
618 } |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
619 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
620 if (orientation != (fd_n->exif_orientation ? fd_n->exif_orientation : 1)) |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
621 { |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
622 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
|
623 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
624 /* 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
|
625 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
|
626 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
|
627 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
|
628 */ |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
629 if (fd_n->user_orientation == 0) file_data_ref(fd_n); |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
630 fd_n->user_orientation = orientation; |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
631 } |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
632 } |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
633 else |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
634 { |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
635 if (fd_n->user_orientation != 0) file_data_unref(fd_n); |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
636 fd_n->user_orientation = 0; |
434
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
637 } |
b7b09a18917a
Keep image orientation set by the user during the session.
Laurent Monin <geeqie@norz.org>
parents:
432
diff
changeset
|
638 |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
639 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
|
640 { |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
641 if (type == ALTER_NONE) |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
642 { |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
643 metadata_write_revert(fd_n, ORIENTATION_KEY); |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
644 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
645 else |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
646 { |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
647 metadata_write_int(fd_n, ORIENTATION_KEY, orientation); |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
648 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
649 } |
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
650 |
2440
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
651 if (imd->image_fd == fd_n && !(options->metadata.write_orientation && !options->image.exif_rotate_enable)) |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
652 { |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
653 imd->orientation = orientation; |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
654 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, orientation); |
cb9f25cb54f3
Orientation commands and file selections
cclark <cclark@mcb.net>
parents:
2437
diff
changeset
|
655 } |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
656 } |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
657 |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
658 void image_set_desaturate(ImageWindow *imd, gboolean desaturate) |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
659 { |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
660 imd->desaturate = desaturate; |
442 | 661 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
|
662 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
|
663 else |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
664 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
|
665 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
|
666 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
667 |
1566
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
668 gboolean image_get_desaturate(ImageWindow *imd) |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
669 { |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
670 return imd->desaturate; |
df4da4647646
separated Orientation and Grayscale functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1550
diff
changeset
|
671 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
672 |
9 | 673 /* |
674 *------------------------------------------------------------------- | |
675 * read ahead (prebuffer) | |
676 *------------------------------------------------------------------- | |
677 */ | |
678 | |
679 static void image_read_ahead_cancel(ImageWindow *imd) | |
680 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
681 DEBUG_1("%s read ahead cancelled for :%s", get_exec_time(), imd->read_ahead_fd ? imd->read_ahead_fd->path : "null"); |
9 | 682 |
683 image_loader_free(imd->read_ahead_il); | |
684 imd->read_ahead_il = NULL; | |
685 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
686 file_data_unref(imd->read_ahead_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
687 imd->read_ahead_fd = NULL; |
9 | 688 } |
689 | |
690 static void image_read_ahead_done_cb(ImageLoader *il, gpointer data) | |
691 { | |
692 ImageWindow *imd = data; | |
693 | |
2252
f2b8d63842ca
NULL-ptr crash in image_read_ahead_done_cb()
Michael Schwendt <mschwendt@gmail.com>
parents:
2185
diff
changeset
|
694 if (!imd->read_ahead_fd || !imd->read_ahead_il) return; |
f2b8d63842ca
NULL-ptr crash in image_read_ahead_done_cb()
Michael Schwendt <mschwendt@gmail.com>
parents:
2185
diff
changeset
|
695 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
696 DEBUG_1("%s read ahead done for :%s", get_exec_time(), imd->read_ahead_fd->path); |
9 | 697 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
698 if (!imd->read_ahead_fd->pixbuf) |
9 | 699 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
700 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
|
701 if (imd->read_ahead_fd->pixbuf) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
702 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
703 g_object_ref(imd->read_ahead_fd->pixbuf); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
704 image_cache_set(imd, imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
705 } |
9 | 706 } |
707 image_loader_free(imd->read_ahead_il); | |
708 imd->read_ahead_il = NULL; | |
709 | |
710 image_complete_util(imd, TRUE); | |
711 } | |
712 | |
713 static void image_read_ahead_error_cb(ImageLoader *il, gpointer data) | |
714 { | |
715 /* we even treat errors as success, maybe at least some of the file was ok */ | |
716 image_read_ahead_done_cb(il, data); | |
717 } | |
718 | |
719 static void image_read_ahead_start(ImageWindow *imd) | |
720 { | |
721 /* already started ? */ | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
722 if (!imd->read_ahead_fd || imd->read_ahead_il || imd->read_ahead_fd->pixbuf) return; |
9 | 723 |
724 /* still loading ?, do later */ | |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
725 if (imd->il /*|| imd->cm*/) return; |
9 | 726 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
727 DEBUG_1("%s read ahead started for :%s", get_exec_time(), imd->read_ahead_fd->path); |
9 | 728 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
729 imd->read_ahead_il = image_loader_new(imd->read_ahead_fd); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
730 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
731 image_loader_delay_area_ready(imd->read_ahead_il, TRUE); /* we will need the area_ready signals later */ |
9 | 732 |
1346
b3378273091e
No space between function name and first parenthesis, it eases greping (see CODING).
Laurent Monin <geeqie@norz.org>
parents:
1338
diff
changeset
|
733 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
|
734 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
|
735 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
736 if (!image_loader_start(imd->read_ahead_il)) |
9 | 737 { |
738 image_read_ahead_cancel(imd); | |
739 image_complete_util(imd, TRUE); | |
740 } | |
741 } | |
742 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
743 static void image_read_ahead_set(ImageWindow *imd, FileData *fd) |
9 | 744 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
745 if (imd->read_ahead_fd && fd && imd->read_ahead_fd == fd) return; |
9 | 746 |
747 image_read_ahead_cancel(imd); | |
748 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
749 imd->read_ahead_fd = file_data_ref(fd); |
9 | 750 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
751 DEBUG_1("read ahead set to :%s", imd->read_ahead_fd->path); |
9 | 752 |
753 image_read_ahead_start(imd); | |
754 } | |
755 | |
756 /* | |
757 *------------------------------------------------------------------- | |
758 * post buffering | |
759 *------------------------------------------------------------------- | |
760 */ | |
761 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
762 static void image_cache_release_cb(FileData *fd) |
9 | 763 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
764 g_object_unref(fd->pixbuf); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
765 fd->pixbuf = NULL; |
9 | 766 } |
767 | |
1182
d432b1cdf6a5
Fix up deprecated function and not a prototype warnings.
Laurent Monin <geeqie@norz.org>
parents:
1055
diff
changeset
|
768 static FileCacheData *image_get_cache(void) |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
769 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
770 static FileCacheData *cache = NULL; |
848
79fc2c215d64
cache size made configurable
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
847
diff
changeset
|
771 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
|
772 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
|
773 return cache; |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
774 } |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
775 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
776 static void image_cache_set(ImageWindow *imd, FileData *fd) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
777 { |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
778 g_assert(fd->pixbuf); |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
779 |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
780 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
|
781 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
|
782 } |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
783 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
784 static gint image_cache_get(ImageWindow *imd) |
9 | 785 { |
786 gint success; | |
787 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
788 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
|
789 if (success) |
9 | 790 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
791 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
|
792 image_change_pixbuf(imd, imd->image_fd->pixbuf, image_zoom_get(imd), FALSE); |
9 | 793 } |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
794 |
1498
2b0712dcf139
improved debug messages
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1482
diff
changeset
|
795 // file_cache_dump(image_get_cache()); |
9 | 796 return success; |
797 } | |
798 | |
799 /* | |
800 *------------------------------------------------------------------- | |
801 * loading | |
802 *------------------------------------------------------------------- | |
803 */ | |
804 | |
805 static void image_load_pixbuf_ready(ImageWindow *imd) | |
806 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
807 if (image_get_pixbuf(imd) || !imd->il) return; |
9 | 808 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
809 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), FALSE); |
9 | 810 } |
811 | |
812 static void image_load_area_cb(ImageLoader *il, guint x, guint y, guint w, guint h, gpointer data) | |
813 { | |
814 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
|
815 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
|
816 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
817 pr = (PixbufRenderer *)imd->pr; |
9 | 818 |
819 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
|
820 pr->pixbuf != image_loader_get_pixbuf(il)) |
9 | 821 { |
822 return; | |
823 } | |
824 | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
825 if (!pr->pixbuf) image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), TRUE); |
9 | 826 |
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 pixbuf_renderer_area_changed(pr, x, y, w, h); |
9 | 828 } |
829 | |
830 static void image_load_done_cb(ImageLoader *il, gpointer data) | |
1 | 831 { |
832 ImageWindow *imd = data; | |
9 | 833 |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
834 DEBUG_1("%s image done", get_exec_time()); |
9 | 835 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
836 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
|
837 { |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
838 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
|
839 image_cache_set(imd, imd->image_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
840 } |
1294 | 841 /* call the callback triggered by image_state after fd->pixbuf is set */ |
842 g_object_set(G_OBJECT(imd->pr), "loading", FALSE, NULL); | |
843 image_state_unset(imd, IMAGE_STATE_LOADING); | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
844 |
1031
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
845 if (!image_loader_get_pixbuf(imd->il)) |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
846 { |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
847 GdkPixbuf *pixbuf; |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
848 |
2597
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
849 switch (imd->image_fd->format_class) |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
850 { |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
851 case FORMAT_CLASS_UNKNOWN: |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
852 pixbuf = pixbuf_inline(PIXBUF_INLINE_UNKNOWN); |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
853 break; |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
854 case FORMAT_CLASS_META: |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
855 pixbuf = pixbuf_inline(PIXBUF_INLINE_METADATA); |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
856 break; |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
857 case FORMAT_CLASS_VIDEO: |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
858 pixbuf = pixbuf_inline(PIXBUF_INLINE_VIDEO); |
2793 | 859 case FORMAT_CLASS_COLLECTION: |
860 pixbuf = pixbuf_inline(PIXBUF_INLINE_COLLECTION); | |
2597
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
861 break; |
2799
ea4163f0c769
Ref #332: include pdf-view
Colin Clark <colin.clark@cclark.uk>
parents:
2793
diff
changeset
|
862 case FORMAT_CLASS_PDF: |
ea4163f0c769
Ref #332: include pdf-view
Colin Clark <colin.clark@cclark.uk>
parents:
2793
diff
changeset
|
863 pixbuf = pixbuf_inline(PIXBUF_INLINE_ICON_PDF); |
ea4163f0c769
Ref #332: include pdf-view
Colin Clark <colin.clark@cclark.uk>
parents:
2793
diff
changeset
|
864 break; |
2597
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
865 default: |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
866 pixbuf = pixbuf_inline(PIXBUF_INLINE_BROKEN); |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
867 } |
e65df743a5a1
Ref #510: Rudimentary video support
Colin Clark <colin.clark@cclark.uk>
parents:
2565
diff
changeset
|
868 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
869 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
|
870 g_object_unref(pixbuf); |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
871 |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
872 imd->unknown = TRUE; |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
873 } |
3f141a4f6482
fixed handling of broken images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1027
diff
changeset
|
874 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
|
875 image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) |
9 | 876 { |
42
056d96cdec23
Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
29
diff
changeset
|
877 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
|
878 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), FALSE); |
9 | 879 } |
880 | |
881 image_loader_free(imd->il); | |
882 imd->il = NULL; | |
883 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
884 // image_post_process(imd, TRUE); |
9 | 885 |
886 image_read_ahead_start(imd); | |
887 } | |
888 | |
1865 | 889 static void image_load_size_cb(ImageLoader *il, guint width, guint height, gpointer data) |
890 { | |
891 ImageWindow *imd = data; | |
892 | |
893 DEBUG_1("image_load_size_cb: %dx%d", width, height); | |
894 pixbuf_renderer_set_size_early((PixbufRenderer *)imd->pr, width, height); | |
895 } | |
896 | |
9 | 897 static void image_load_error_cb(ImageLoader *il, gpointer data) |
898 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
899 DEBUG_1("%s image error", get_exec_time()); |
9 | 900 |
901 /* even on error handle it like it was done, | |
902 * since we have a pixbuf with _something_ */ | |
903 | |
904 image_load_done_cb(il, data); | |
905 } | |
906 | |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
907 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
|
908 { |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
909 g_assert(imd->il); |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
910 if (override_old_signals) |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
911 { |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
912 /* override the old signals */ |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
913 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
|
914 } |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
915 |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
916 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
|
917 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
|
918 g_signal_connect(G_OBJECT(imd->il), "done", (GCallback)image_load_done_cb, imd); |
1865 | 919 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
|
920 } |
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
921 |
9 | 922 /* this read ahead is located here merely for the callbacks, above */ |
923 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
924 static gboolean image_read_ahead_check(ImageWindow *imd) |
9 | 925 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
926 if (!imd->read_ahead_fd) return FALSE; |
9 | 927 if (imd->il) return FALSE; |
928 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
929 if (!imd->image_fd || imd->read_ahead_fd != imd->image_fd) |
9 | 930 { |
931 image_read_ahead_cancel(imd); | |
932 return FALSE; | |
933 } | |
934 | |
935 if (imd->read_ahead_il) | |
936 { | |
937 imd->il = imd->read_ahead_il; | |
938 imd->read_ahead_il = NULL; | |
939 | |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
940 image_load_set_signals(imd, TRUE); |
9 | 941 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
942 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
|
943 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
|
944 |
9 | 945 if (!imd->delay_flip) |
946 { | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
947 image_change_pixbuf(imd, image_loader_get_pixbuf(imd->il), image_zoom_get(imd), TRUE); |
9 | 948 } |
949 | |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
950 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
|
951 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
952 file_data_unref(imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
953 imd->read_ahead_fd = NULL; |
9 | 954 return TRUE; |
955 } | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
956 else if (imd->read_ahead_fd->pixbuf) |
9 | 957 { |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
958 image_change_pixbuf(imd, imd->read_ahead_fd->pixbuf, image_zoom_get(imd), FALSE); |
9 | 959 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
960 file_data_unref(imd->read_ahead_fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
961 imd->read_ahead_fd = NULL; |
9 | 962 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
963 // image_post_process(imd, FALSE); |
9 | 964 return TRUE; |
965 } | |
966 | |
967 image_read_ahead_cancel(imd); | |
968 return FALSE; | |
969 } | |
970 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
971 static gboolean image_load_begin(ImageWindow *imd, FileData *fd) |
9 | 972 { |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
973 DEBUG_1("%s image begin", get_exec_time()); |
9 | 974 |
975 if (imd->il) return FALSE; | |
976 | |
977 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
|
978 g_object_set(G_OBJECT(imd->pr), "complete", FALSE, NULL); |
9 | 979 |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
980 if (image_cache_get(imd)) |
9 | 981 { |
847
80d2ea882786
measure pixbuf cache size in bytes
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
846
diff
changeset
|
982 DEBUG_1("from cache: %s", imd->image_fd->path); |
9 | 983 return TRUE; |
984 } | |
985 | |
986 if (image_read_ahead_check(imd)) | |
987 { | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
988 DEBUG_1("from read ahead buffer: %s", imd->image_fd->path); |
9 | 989 return TRUE; |
990 } | |
991 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
992 if (!imd->delay_flip && image_get_pixbuf(imd)) |
9 | 993 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
994 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
|
995 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
996 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
|
997 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
|
998 pr->pixbuf = NULL; |
9 | 999 } |
1000 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1001 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
|
1002 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1003 imd->il = image_loader_new(fd); |
9 | 1004 |
1338
c805996b7389
Minor simplification and cleanup.
Laurent Monin <geeqie@norz.org>
parents:
1337
diff
changeset
|
1005 image_load_set_signals(imd, FALSE); |
9 | 1006 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1007 if (!image_loader_start(imd->il)) |
9 | 1008 { |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
1009 DEBUG_1("image start error"); |
9 | 1010 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1011 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
|
1012 |
9 | 1013 image_loader_free(imd->il); |
1014 imd->il = NULL; | |
1015 | |
1016 image_complete_util(imd, FALSE); | |
1017 | |
1018 return FALSE; | |
1019 } | |
1020 | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1021 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
|
1022 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1023 /* |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1024 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
|
1025 { |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1026 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
|
1027 } |
2184 | 1028 */ |
9 | 1029 return TRUE; |
1030 } | |
1031 | |
1032 static void image_reset(ImageWindow *imd) | |
1033 { | |
1034 /* stops anything currently being done */ | |
1035 | |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
1036 DEBUG_1("%s image reset", get_exec_time()); |
9 | 1037 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1038 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
|
1039 |
9 | 1040 image_loader_free(imd->il); |
1041 imd->il = NULL; | |
1042 | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1043 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
|
1044 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
|
1045 |
9 | 1046 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
|
1047 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1048 image_state_set(imd, IMAGE_STATE_NONE); |
9 | 1049 } |
1050 | |
1051 /* | |
1052 *------------------------------------------------------------------- | |
1053 * image changer | |
1054 *------------------------------------------------------------------- | |
1055 */ | |
1056 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1057 static void image_change_complete(ImageWindow *imd, gdouble zoom) |
9 | 1058 { |
1059 image_reset(imd); | |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1060 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
|
1061 |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1062 if (!imd->image_fd) |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1063 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1064 image_change_pixbuf(imd, NULL, zoom, FALSE); |
9 | 1065 } |
1066 else | |
1067 { | |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1068 |
1362
58a1649f728b
Improve file checks using is_readable_file().
Laurent Monin <geeqie@norz.org>
parents:
1359
diff
changeset
|
1069 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
|
1070 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1071 PixbufRenderer *pr; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1072 |
1337
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1073 pr = PIXBUF_RENDERER(imd->pr); |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1074 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
|
1075 |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1076 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
|
1077 { |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1078 imd->unknown = FALSE; |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1079 } |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1080 } |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1081 |
440c72d5cf88
image_change_complete(): reduce code redundancy and implify.
Laurent Monin <geeqie@norz.org>
parents:
1333
diff
changeset
|
1082 if (imd->unknown == TRUE) |
9 | 1083 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1084 GdkPixbuf *pixbuf; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1085 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1086 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
|
1087 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
|
1088 g_object_unref(pixbuf); |
9 | 1089 } |
1090 } | |
1091 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1092 image_update_util(imd); |
9 | 1093 } |
1094 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1095 static void image_change_real(ImageWindow *imd, FileData *fd, |
9 | 1096 CollectionData *cd, CollectInfo *info, gdouble zoom) |
1097 { | |
1098 | |
1099 imd->collection = cd; | |
1100 imd->collection_info = info; | |
1101 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1102 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1103 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1104 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1105 file_data_unref(imd->image_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1106 imd->image_fd = file_data_ref(fd); |
9 | 1107 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1108 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1109 image_change_complete(imd, zoom); |
9 | 1110 |
1111 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
|
1112 image_state_set(imd, IMAGE_STATE_IMAGE); |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1113 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1114 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1115 file_data_register_real_time_monitor(imd->image_fd); |
9 | 1116 } |
1117 | |
1118 /* | |
1119 *------------------------------------------------------------------- | |
1120 * focus stuff | |
1121 *------------------------------------------------------------------- | |
1122 */ | |
1123 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1124 static gboolean image_focus_in_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) |
9 | 1125 { |
1126 ImageWindow *imd = data; | |
1127 | |
1481
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1128 if (imd->func_focus_in) |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1129 { |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1130 imd->func_focus_in(imd, imd->data_focus_in); |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1131 } |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1132 |
9 | 1133 return TRUE; |
1134 } | |
1135 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1136 static gboolean image_scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer data) |
9 | 1137 { |
1138 ImageWindow *imd = data; | |
1139 | |
1140 if (imd->func_scroll && | |
1141 event && event->type == GDK_SCROLL) | |
442 | 1142 { |
868
b043dc777759
Reduce number of parameters (mostly unused), just pass the event pointer.
Laurent Monin <geeqie@norz.org>
parents:
863
diff
changeset
|
1143 imd->func_scroll(imd, event, imd->data_scroll); |
9 | 1144 return TRUE; |
1145 } | |
1146 | |
1147 return FALSE; | |
1148 } | |
1149 | |
1150 /* | |
1151 *------------------------------------------------------------------- | |
1152 * public interface | |
1153 *------------------------------------------------------------------- | |
1154 */ | |
1155 | |
1156 void image_attach_window(ImageWindow *imd, GtkWidget *window, | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1157 const gchar *title, const gchar *title_right, gboolean show_zoom) |
1 | 1158 { |
2847
53785dd2e8c9
Bug fix: View in new window wrong size
Colin Clark <colin.clark@cclark.uk>
parents:
2801
diff
changeset
|
1159 LayoutWindow *lw; |
53785dd2e8c9
Bug fix: View in new window wrong size
Colin Clark <colin.clark@cclark.uk>
parents:
2801
diff
changeset
|
1160 |
1 | 1161 imd->top_window = window; |
1162 g_free(imd->title); | |
9 | 1163 imd->title = g_strdup(title); |
1164 g_free(imd->title_right); | |
1165 imd->title_right = g_strdup(title_right); | |
1166 imd->title_show_zoom = show_zoom; | |
1167 | |
2847
53785dd2e8c9
Bug fix: View in new window wrong size
Colin Clark <colin.clark@cclark.uk>
parents:
2801
diff
changeset
|
1168 lw = layout_find_by_image(imd); |
53785dd2e8c9
Bug fix: View in new window wrong size
Colin Clark <colin.clark@cclark.uk>
parents:
2801
diff
changeset
|
1169 |
53785dd2e8c9
Bug fix: View in new window wrong size
Colin Clark <colin.clark@cclark.uk>
parents:
2801
diff
changeset
|
1170 if (!(options->image.fit_window_to_image && lw && lw->options.tools_float)) 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
|
1171 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1172 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
|
1173 |
9 | 1174 image_update_title(imd); |
1175 } | |
1176 | |
1177 void image_set_update_func(ImageWindow *imd, | |
1178 void (*func)(ImageWindow *imd, gpointer data), | |
1179 gpointer data) | |
1180 { | |
1181 imd->func_update = func; | |
1182 imd->data_update = data; | |
1 | 1183 } |
1184 | |
9 | 1185 void image_set_complete_func(ImageWindow *imd, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1186 void (*func)(ImageWindow *imd, gboolean preload, gpointer data), |
9 | 1187 gpointer data) |
1 | 1188 { |
9 | 1189 imd->func_complete = func; |
1190 imd->data_complete = data; | |
1 | 1191 } |
1192 | |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1193 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
|
1194 void (*func)(ImageWindow *imd, ImageState state, gpointer data), |
9 | 1195 gpointer data) |
1 | 1196 { |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1197 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
|
1198 imd->data_state = data; |
9 | 1199 } |
1200 | |
1201 | |
1202 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
|
1203 void (*func)(ImageWindow *, GdkEventButton *event, gpointer), |
9 | 1204 gpointer data) |
1205 { | |
1206 imd->func_button = func; | |
1207 imd->data_button = data; | |
1208 } | |
1209 | |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1210 void image_set_drag_func(ImageWindow *imd, |
2452
8bcdac2603d3
Fix #473: Parameter type fix for "motion-notify-event" signal handlers
Colin Clark <cclark@mcb.net>
parents:
2440
diff
changeset
|
1211 void (*func)(ImageWindow *, GdkEventMotion *event, gdouble dx, gdouble dy, gpointer), |
128
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1212 gpointer data) |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1213 { |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1214 imd->func_drag = func; |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1215 imd->data_drag = data; |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1216 } |
0c318260b7f6
improved connected scroll and active image switching
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
127
diff
changeset
|
1217 |
9 | 1218 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
|
1219 void (*func)(ImageWindow *, GdkEventScroll *event, gpointer), |
9 | 1220 gpointer data) |
1 | 1221 { |
9 | 1222 imd->func_scroll = func; |
1223 imd->data_scroll = data; | |
1 | 1224 } |
1225 | |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1226 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
|
1227 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
|
1228 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
|
1229 { |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1230 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
|
1231 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
|
1232 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1233 |
1481
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1234 void image_set_focus_in_func(ImageWindow *imd, |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1235 void (*func)(ImageWindow *, gpointer), |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1236 gpointer data) |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1237 { |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1238 imd->func_focus_in = func; |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1239 imd->data_focus_in = data; |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1240 } |
7757038ff080
active image follows keyboard focus
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1432
diff
changeset
|
1241 |
9 | 1242 /* path, name */ |
1243 | |
1244 const gchar *image_get_path(ImageWindow *imd) | |
1245 { | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1246 if (imd->image_fd == NULL) return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1247 return imd->image_fd->path; |
9 | 1248 } |
1249 | |
1250 const gchar *image_get_name(ImageWindow *imd) | |
1251 { | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1252 if (imd->image_fd == NULL) return NULL; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1253 return imd->image_fd->name; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1254 } |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1255 |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1256 FileData *image_get_fd(ImageWindow *imd) |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1257 { |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1258 return imd->image_fd; |
9 | 1259 } |
1260 | |
1261 /* 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
|
1262 void image_set_fd(ImageWindow *imd, FileData *fd) |
1 | 1263 { |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1264 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1265 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1266 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1267 file_data_unref(imd->image_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1268 imd->image_fd = file_data_ref(fd); |
9 | 1269 |
1270 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
|
1271 image_state_set(imd, IMAGE_STATE_IMAGE); |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1272 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1273 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1274 file_data_register_real_time_monitor(imd->image_fd); |
9 | 1275 } |
1276 | |
1277 /* load a new image */ | |
1278 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1279 void image_change_fd(ImageWindow *imd, FileData *fd, gdouble zoom) |
9 | 1280 { |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1281 if (imd->image_fd == fd) return; |
9 | 1282 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1283 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
|
1284 } |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1285 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1286 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
|
1287 { |
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
1288 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
|
1289 } |
8def7e6cff90
fixed connected zoom and scroll that didn't work in some cases
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
513
diff
changeset
|
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 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
|
1292 { |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1293 return pixbuf_renderer_get_pixbuf((PixbufRenderer *)imd->pr); |
9 | 1294 } |
1295 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1296 void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gboolean lazy) |
9 | 1297 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1298 StereoPixbufData stereo_data = STEREO_PIXBUF_DEFAULT; |
1639
3dfbbabd5138
enabled color management in img-view
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1638
diff
changeset
|
1299 /* 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
|
1300 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
|
1301 here before it is taken over by the renderer. */ |
2184 | 1302 if (pixbuf) g_object_ref(pixbuf); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1303 |
2437
f703774799a5
Fix #469: Exif rotation problems
Colin Clark <cclark@mcb.net>
parents:
2350
diff
changeset
|
1304 imd->orientation = EXIF_ORIENTATION_TOP_LEFT; |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1305 if (imd->image_fd) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1306 { |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1307 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
|
1308 { |
1288
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1309 imd->orientation = imd->image_fd->user_orientation; |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1310 } |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1311 else if (options->image.exif_rotate_enable) |
01a4a8674c8b
use metadata_read_* functions where possible
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1284
diff
changeset
|
1312 { |
1567
ef3ca18df43f
added an option to write image orientation to the metadata
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1566
diff
changeset
|
1313 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
|
1314 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
|
1315 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1316 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1317 |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1318 if (pixbuf) |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1319 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1320 stereo_data = imd->user_stereo; |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1321 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
|
1322 { |
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1323 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
|
1324 } |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1325 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1326 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1327 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, FALSE); |
442 | 1328 if (imd->cm) |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1329 { |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1330 color_man_free(imd->cm); |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1331 imd->cm = NULL; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1332 } |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1333 |
1045
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1334 if (lazy) |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1335 { |
1916
69ab167a50f5
do not mix autodetected and user-defined stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1900
diff
changeset
|
1336 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
|
1337 } |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1338 else |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1339 { |
19bc806e0a69
added possibility to redraw only the parts of image that are already
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1043
diff
changeset
|
1340 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
|
1341 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
|
1342 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
|
1343 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1344 |
1251 | 1345 if (pixbuf) g_object_unref(pixbuf); |
1247
f9e2deeaa947
fixed possible crash
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1182
diff
changeset
|
1346 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1347 if (imd->color_profile_enable) |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1348 { |
1357
4bf8cc21b89a
image_post_process_color(): remove exif parameter, just extract it when needed.
Laurent Monin <geeqie@norz.org>
parents:
1356
diff
changeset
|
1349 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
|
1350 } |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1351 |
442 | 1352 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
|
1353 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); |
442 | 1354 |
117
f95079062ea0
Wed Nov 29 14:28:30 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
116
diff
changeset
|
1355 image_state_set(imd, IMAGE_STATE_IMAGE); |
9 | 1356 } |
1357 | |
1358 void image_change_from_collection(ImageWindow *imd, CollectionData *cd, CollectInfo *info, gdouble zoom) | |
1359 { | |
2737
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1360 CollectWindow *cw; |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1361 |
9 | 1362 if (!cd || !info || !g_list_find(cd->list, info)) return; |
1363 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1364 image_change_real(imd, info->fd, cd, info, zoom); |
2737
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1365 cw = collection_window_find(cd); |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1366 if (cw) |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1367 { |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1368 collection_table_set_focus(cw->table, info); |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1369 collection_table_unselect_all(cw->table); |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1370 collection_table_select(cw->table,info); |
065402476db8
Collection window - thumbnail focus
Colin Clark <colin.clark@cclark.uk>
parents:
2610
diff
changeset
|
1371 } |
9 | 1372 } |
1373 | |
1374 CollectionData *image_get_collection(ImageWindow *imd, CollectInfo **info) | |
1375 { | |
1376 if (collection_to_number(imd->collection) >= 0) | |
1377 { | |
1378 if (g_list_find(imd->collection->list, imd->collection_info) != NULL) | |
1379 { | |
1380 if (info) *info = imd->collection_info; | |
1381 } | |
1382 else | |
1383 { | |
1384 if (info) *info = NULL; | |
1385 } | |
1386 return imd->collection; | |
1387 } | |
1388 | |
1389 if (info) *info = NULL; | |
1390 return NULL; | |
1391 } | |
1392 | |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1393 static void image_loader_sync_read_ahead_data(ImageLoader *il, gpointer old_data, gpointer data) |
9 | 1394 { |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1395 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
|
1396 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
|
1397 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1398 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
|
1399 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
|
1400 } |
9 | 1401 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1402 static void image_loader_sync_data(ImageLoader *il, gpointer old_data, gpointer data) |
2184 | 1403 { |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1404 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
|
1405 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
|
1406 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1407 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
|
1408 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
|
1409 |
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1410 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
|
1411 g_signal_connect(G_OBJECT(il), "done", (GCallback)image_load_done_cb, data); |
1 | 1412 } |
1413 | |
9 | 1414 /* 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
|
1415 * it moves most data from source to imd |
9 | 1416 */ |
2099
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1417 void image_move_from_image(ImageWindow *imd, ImageWindow *source) |
9 | 1418 { |
1419 if (imd == source) return; | |
1420 | |
1421 imd->unknown = source->unknown; | |
1422 | |
1423 imd->collection = source->collection; | |
1424 imd->collection_info = source->collection_info; | |
1425 | |
1426 image_loader_free(imd->il); | |
1427 imd->il = NULL; | |
1428 | |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1429 image_set_fd(imd, image_get_fd(source)); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1430 |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1431 |
24
ca420b4159df
Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
23
diff
changeset
|
1432 if (source->il) |
9 | 1433 { |
863
6837cd867f33
fixed crash in entering fullscreen during loading
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
848
diff
changeset
|
1434 imd->il = source->il; |
6837cd867f33
fixed crash in entering fullscreen during loading
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
848
diff
changeset
|
1435 source->il = NULL; |
9 | 1436 |
1012
409b52dfe683
converted image loader to a GObject and use signals for notification
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
1437 image_loader_sync_data(imd->il, source, imd); |
9 | 1438 |
1439 imd->delay_alter_type = source->delay_alter_type; | |
1440 source->delay_alter_type = ALTER_NONE; | |
1441 } | |
1442 | |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1443 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
|
1444 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
|
1445 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
|
1446 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
|
1447 imd->cm = NULL; |
2347
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1448 if (source->cm) |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1449 { |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1450 ColorMan *cm; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1451 |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1452 imd->cm = source->cm; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1453 source->cm = NULL; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1454 |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1455 cm = (ColorMan *)imd->cm; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1456 cm->imd = imd; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1457 cm->func_done_data = imd; |
6d8143a8cae8
Enable color manager in all fullscreen methods
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2341
diff
changeset
|
1458 } |
2099
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1459 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1460 file_data_unref(imd->read_ahead_fd); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1461 source->read_ahead_fd = NULL; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1462 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1463 imd->orientation = source->orientation; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1464 imd->desaturate = source->desaturate; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1465 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1466 imd->user_stereo = source->user_stereo; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1467 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1468 pixbuf_renderer_move(PIXBUF_RENDERER(imd->pr), PIXBUF_RENDERER(source->pr)); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1469 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1470 if (imd->cm || imd->desaturate) |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1471 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1472 else |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1473 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1474 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1475 } |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1476 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1477 /* this is a copy function |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1478 * source stays unchanged |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1479 */ |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1480 void image_copy_from_image(ImageWindow *imd, ImageWindow *source) |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1481 { |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1482 if (imd == source) return; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1483 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1484 imd->unknown = source->unknown; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1485 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1486 imd->collection = source->collection; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1487 imd->collection_info = source->collection_info; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1488 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1489 image_loader_free(imd->il); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1490 imd->il = NULL; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1491 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1492 image_set_fd(imd, image_get_fd(source)); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1493 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1494 |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1495 imd->color_profile_enable = source->color_profile_enable; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1496 imd->color_profile_input = source->color_profile_input; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1497 imd->color_profile_use_image = source->color_profile_use_image; |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1498 color_man_free((ColorMan *)imd->cm); |
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1499 imd->cm = NULL; |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1500 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
|
1501 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1502 ColorMan *cm; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1503 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1504 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
|
1505 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
|
1506 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1507 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
|
1508 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
|
1509 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
|
1510 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1511 |
9 | 1512 image_loader_free(imd->read_ahead_il); |
1513 imd->read_ahead_il = source->read_ahead_il; | |
1514 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
|
1515 if (imd->read_ahead_il) image_loader_sync_read_ahead_data(imd->read_ahead_il, source, imd); |
9 | 1516 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1517 file_data_unref(imd->read_ahead_fd); |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1518 imd->read_ahead_fd = source->read_ahead_fd; |
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1519 source->read_ahead_fd = NULL; |
9 | 1520 |
1521 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
|
1522 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
|
1523 source->state = IMAGE_STATE_NONE; |
442 | 1524 |
398
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1525 imd->orientation = source->orientation; |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1526 imd->desaturate = source->desaturate; |
9 | 1527 |
1900
6e146fa6ec29
infrastructure for image loader backend
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1891
diff
changeset
|
1528 imd->user_stereo = source->user_stereo; |
6e146fa6ec29
infrastructure for image loader backend
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1891
diff
changeset
|
1529 |
2099
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1530 pixbuf_renderer_copy(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
|
1531 |
442 | 1532 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
|
1533 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
|
1534 else |
3297e8f0d5d7
image post-processing (rotation and color management) moved to
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
386
diff
changeset
|
1535 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
|
1536 |
9 | 1537 } |
1538 | |
2099
cd445a64205f
implemented presentation mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2095
diff
changeset
|
1539 |
9 | 1540 /* manipulation */ |
1541 | |
1542 void image_area_changed(ImageWindow *imd, gint x, gint y, gint width, gint height) | |
1543 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1544 pixbuf_renderer_area_changed((PixbufRenderer *)imd->pr, x, y, width, height); |
9 | 1545 } |
1546 | |
1547 void image_reload(ImageWindow *imd) | |
1548 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1549 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
|
1550 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1551 image_change_complete(imd, image_zoom_get(imd)); |
9 | 1552 } |
1553 | |
1554 void image_scroll(ImageWindow *imd, gint x, gint y) | |
1555 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1556 pixbuf_renderer_scroll((PixbufRenderer *)imd->pr, x, y); |
9 | 1557 } |
1558 | |
13
ba909f3b01d6
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
12
diff
changeset
|
1559 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
|
1560 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
|
1561 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1562 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
|
1563 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1564 |
131
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1565 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
|
1566 { |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1567 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
|
1568 } |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1569 |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1570 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
|
1571 { |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1572 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
|
1573 } |
d50f6061b37b
relative scroll is working; some cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
129
diff
changeset
|
1574 |
9 | 1575 void image_zoom_adjust(ImageWindow *imd, gdouble increment) |
1576 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1577 pixbuf_renderer_zoom_adjust((PixbufRenderer *)imd->pr, increment); |
9 | 1578 } |
1579 | |
1580 void image_zoom_adjust_at_point(ImageWindow *imd, gdouble increment, gint x, gint y) | |
1581 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1582 pixbuf_renderer_zoom_adjust_at_point((PixbufRenderer *)imd->pr, increment, x, y); |
9 | 1583 } |
1584 | |
12
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1585 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
|
1586 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1587 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
|
1588 } |
8e6d90233b6d
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
9
diff
changeset
|
1589 |
9 | 1590 void image_zoom_set(ImageWindow *imd, gdouble zoom) |
1591 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1592 pixbuf_renderer_zoom_set((PixbufRenderer *)imd->pr, zoom); |
9 | 1593 } |
1594 | |
1269 | 1595 void image_zoom_set_fill_geometry(ImageWindow *imd, gboolean vertical) |
9 | 1596 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1597 PixbufRenderer *pr; |
9 | 1598 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
|
1599 gint width, height; |
9 | 1600 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1601 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
|
1602 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1603 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
|
1604 !pixbuf_renderer_get_image_size(pr, &width, &height)) return; |
9 | 1605 |
1606 if (vertical) | |
1607 { | |
1875
e9b157ab56a6
first stereo support
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1865
diff
changeset
|
1608 zoom = (gdouble)pr->viewport_height / height; |
9 | 1609 } |
1610 else | |
1611 { | |
1875
e9b157ab56a6
first stereo support
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1865
diff
changeset
|
1612 zoom = (gdouble)pr->viewport_width / width; |
9 | 1613 } |
1614 | |
1615 if (zoom < 1.0) | |
1616 { | |
1617 zoom = 0.0 - 1.0 / zoom; | |
1 | 1618 } |
9 | 1619 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1620 pixbuf_renderer_zoom_set(pr, zoom); |
9 | 1621 } |
1622 | |
1623 gdouble image_zoom_get(ImageWindow *imd) | |
1624 { | |
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 return pixbuf_renderer_zoom_get((PixbufRenderer *)imd->pr); |
9 | 1626 } |
1627 | |
1628 gdouble image_zoom_get_real(ImageWindow *imd) | |
1629 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1630 return pixbuf_renderer_zoom_get_scale((PixbufRenderer *)imd->pr); |
9 | 1631 } |
1632 | |
1633 gchar *image_zoom_get_as_text(ImageWindow *imd) | |
1634 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1635 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
|
1636 gdouble scale; |
9 | 1637 gdouble l = 1.0; |
1638 gdouble r = 1.0; | |
1639 gint pl = 0; | |
1640 gint pr = 0; | |
1641 gchar *approx = " "; | |
1642 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1643 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
|
1644 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
|
1645 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1646 if (zoom > 0.0) |
1 | 1647 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1648 l = zoom; |
9 | 1649 } |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1650 else if (zoom < 0.0) |
9 | 1651 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1652 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
|
1653 } |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1654 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
|
1655 { |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1656 if (scale >= 1.0) |
9 | 1657 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1658 l = scale; |
9 | 1659 } |
1660 else | |
1661 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1662 r = 1.0 / scale; |
9 | 1663 } |
415
7c97f17797f5
Add zoom ratio display to OSD in fullscreen mode.
Laurent Monin <geeqie@norz.org>
parents:
414
diff
changeset
|
1664 approx = "~"; |
9 | 1665 } |
1666 | |
2341 | 1667 if (rint(l) != l) pl = 2; |
1668 if (rint(r) != r) pr = 2; | |
9 | 1669 |
1670 return g_strdup_printf("%.*f :%s%.*f", pl, l, approx, pr, r); | |
1671 } | |
1672 | |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1673 gdouble image_zoom_get_default(ImageWindow *imd) |
9 | 1674 { |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1675 gdouble zoom = 1.0; |
9 | 1676 |
885
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1677 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
|
1678 { |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1679 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
|
1680 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1681 case ZOOM_RESET_FIT_WINDOW: |
9 | 1682 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
|
1683 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1684 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
|
1685 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
|
1686 break; |
b561a43f7fb0
Use a specific enum for image.zoom_mode values (ZoomMode) and
Laurent Monin <geeqie@norz.org>
parents:
868
diff
changeset
|
1687 } |
1 | 1688 |
1689 return zoom; | |
1690 } | |
1691 | |
1886
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1692 /* stereo */ |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1693 gint image_stereo_get(ImageWindow *imd) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1694 { |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1695 return pixbuf_renderer_stereo_get((PixbufRenderer *)imd->pr); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1696 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1697 |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1698 void image_stereo_set(ImageWindow *imd, gint stereo_mode) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1699 { |
2184 | 1700 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
|
1701 pixbuf_renderer_stereo_set((PixbufRenderer *)imd->pr, stereo_mode); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1702 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1703 |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1704 void image_stereo_swap(ImageWindow *imd) |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1705 { |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1706 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
|
1707 stereo_mode ^= PR_STEREO_SWAP; |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1708 pixbuf_renderer_stereo_set((PixbufRenderer *)imd->pr, stereo_mode); |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1709 } |
ba2f9ac17b54
change stereo mode from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1875
diff
changeset
|
1710 |
1888
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1711 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
|
1712 { |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1713 return imd->user_stereo; |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1714 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1715 |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1716 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
|
1717 { |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1718 imd->user_stereo = stereo_mode; |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1719 image_reload(imd); |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1720 } |
039d5c8864a0
type of source stereo image made adjustable from menu
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1887
diff
changeset
|
1721 |
9 | 1722 /* read ahead */ |
1723 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1724 void image_prebuffer_set(ImageWindow *imd, FileData *fd) |
9 | 1725 { |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1726 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
|
1727 |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
1728 if (fd) |
9 | 1729 { |
846
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1730 if (!file_cache_get(image_get_cache(), fd)) |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1731 { |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1732 image_read_ahead_set(imd, fd); |
cf1c9abfa524
simple cache for loaded pixbufs
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
844
diff
changeset
|
1733 } |
9 | 1734 } |
1735 else | |
1736 { | |
1737 image_read_ahead_cancel(imd); | |
1738 } | |
1739 } | |
1740 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1741 static void image_notify_cb(FileData *fd, NotifyType type, gpointer data) |
9 | 1742 { |
1743 ImageWindow *imd = data; | |
442 | 1744 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1745 if (!imd || !image_get_pixbuf(imd) || |
995 | 1746 /* 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
|
1747 !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
|
1748 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
|
1749 ) return; |
9 | 1750 |
1731
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1751 if ((type & NOTIFY_REREAD) && fd == imd->image_fd) |
9 | 1752 { |
2184 | 1753 /* there is no need to reload on NOTIFY_CHANGE, |
1754 modified files should be detacted anyway and NOTIFY_REREAD should be recieved | |
1731
bc1ffc734e7e
do not reload image on copy, move, rename and external editor
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1701
diff
changeset
|
1755 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
|
1756 */ |
1498
2b0712dcf139
improved debug messages
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1482
diff
changeset
|
1757 DEBUG_1("Notify image: %s %04x", fd->path, type); |
9 | 1758 image_reload(imd); |
1759 } | |
1760 } | |
1761 | |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1762 void image_auto_refresh_enable(ImageWindow *imd, gboolean enable) |
9 | 1763 { |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1764 if (!enable && imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1765 file_data_unregister_real_time_monitor(imd->image_fd); |
9 | 1766 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1767 if (enable && !imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1768 file_data_register_real_time_monitor(imd->image_fd); |
9 | 1769 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
1770 imd->auto_refresh = enable; |
9 | 1771 } |
1772 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1773 void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync) |
9 | 1774 { |
1775 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
|
1776 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1777 g_object_set(G_OBJECT(imd->pr), "window_fit", allow_sync, NULL); |
9 | 1778 } |
1779 | |
1780 void image_background_set_color(ImageWindow *imd, GdkColor *color) | |
1781 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1782 pixbuf_renderer_set_color((PixbufRenderer *)imd->pr, color); |
9 | 1783 } |
1784 | |
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
|
1785 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
|
1786 { |
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
|
1787 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
|
1788 |
1644
2b10e2bee592
the options for custom border color were made independent
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1639
diff
changeset
|
1789 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
|
1790 (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
|
1791 { |
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
|
1792 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
|
1793 } |
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
|
1794 |
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
|
1795 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
|
1796 } |
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
|
1797 |
113
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1798 void image_color_profile_set(ImageWindow *imd, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1799 gint input_type, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1800 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
|
1801 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1802 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
|
1803 |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1804 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
|
1805 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1806 return; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1807 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1808 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1809 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
|
1810 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
|
1811 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1812 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1813 gboolean image_color_profile_get(ImageWindow *imd, |
1548
1bd57e730350
support X11 screen profile
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1498
diff
changeset
|
1814 gint *input_type, |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1815 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
|
1816 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1817 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
|
1818 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1819 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
|
1820 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
|
1821 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1822 return TRUE; |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1823 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1824 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1825 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
|
1826 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1827 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
|
1828 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1829 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
|
1830 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1831 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
|
1832 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1833 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1834 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
|
1835 { |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1836 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
|
1837 |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1838 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
|
1839 } |
f2109493004f
Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
109
diff
changeset
|
1840 |
1549
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1841 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
|
1842 { |
1549
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1843 ColorMan *cm; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1844 if (!imd) return FALSE; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1845 |
1549
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1846 cm = imd->cm; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1847 if (!cm) return FALSE; |
83cc83702eb6
show color management status on statusbar
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1548
diff
changeset
|
1848 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
|
1849 |
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1850 } |
e4a5d61aff1c
show the AdobeRGB profile in the menu, indicate input profile from image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
424
diff
changeset
|
1851 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1852 void image_set_delay_flip(ImageWindow *imd, gboolean delay) |
9 | 1853 { |
1854 if (!imd || | |
1855 imd->delay_flip == delay) return; | |
1856 | |
1857 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
|
1858 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1859 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
|
1860 |
9 | 1861 if (!imd->delay_flip && imd->il) |
1862 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1863 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
|
1864 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1865 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
|
1866 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
|
1867 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
|
1868 |
9 | 1869 image_load_pixbuf_ready(imd); |
1870 } | |
1871 } | |
1872 | |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
1873 void image_to_root_window(ImageWindow *imd, gboolean scaled) |
9 | 1874 { |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1875 #if !GTK_CHECK_VERSION(3,0,0) |
9 | 1876 GdkScreen *screen; |
3 | 1877 GdkWindow *rootwindow; |
1878 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
|
1879 GdkPixbuf *pixbuf; |
9 | 1880 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
|
1881 gint width, height; |
9 | 1882 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1883 if (!imd) return; |
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 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
|
1886 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
|
1887 |
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1888 screen = gtk_widget_get_screen(imd->widget); |
9 | 1889 rootwindow = gdk_screen_get_root_window(screen); |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1890 if (gdk_window_get_visual(rootwindow) != gdk_visual_get_system()) return; |
3 | 1891 |
1892 if (scaled) | |
1893 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1894 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
|
1895 height = gdk_screen_height(); |
3 | 1896 } |
1897 else | |
1898 { | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
1899 pixbuf_renderer_get_scaled_size((PixbufRenderer *)imd->pr, &width, &height); |
3 | 1900 } |
1901 | |
334
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1902 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
|
1903 |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
1904 gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, NULL, 128); |
3 | 1905 gdk_window_set_back_pixmap(rootwindow, pixmap, FALSE); |
1906 gdk_window_clear(rootwindow); | |
9 | 1907 g_object_unref(pb); |
1908 g_object_unref(pixmap); | |
3 | 1909 |
1910 gdk_flush(); | |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
1911 #endif |
3 | 1912 } |
1913 | |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1914 void image_select(ImageWindow *imd, gboolean select) |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1915 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1916 if (!imd->has_frame) return; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1917 |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1918 if (select) |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1919 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1920 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
|
1921 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
|
1922 } |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1923 else |
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1924 gtk_widget_set_state(imd->widget, GTK_STATE_NORMAL); |
127
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1925 } |
996ccab9eab3
implemented split windows
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
122
diff
changeset
|
1926 |
174
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1927 void image_set_selectable(ImageWindow *imd, gboolean selectable) |
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1928 { |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1929 if (!imd->has_frame) return; |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1930 |
1359
5fd084313013
image_select(), image_set_selectable(): tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1358
diff
changeset
|
1931 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
|
1932 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
|
1933 } |
cbbd0368670d
improved drawing of image frames
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
154
diff
changeset
|
1934 |
1482
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1935 void image_grab_focus(ImageWindow *imd) |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1936 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1937 if (imd->has_frame) |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1938 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1939 gtk_widget_grab_focus(imd->frame); |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1940 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1941 else |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1942 { |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1943 gtk_widget_grab_focus(imd->widget); |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1944 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1945 } |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1946 |
0fa0b9ba559c
fixed keyboard focus on start-up
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1481
diff
changeset
|
1947 |
9 | 1948 /* |
1949 *------------------------------------------------------------------- | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1950 * prefs sync |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1951 *------------------------------------------------------------------- |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1952 */ |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1953 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1954 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
|
1955 { |
334
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1956 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
|
1957 "zoom_2pass", options->image.zoom_2pass, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1958 "zoom_expand", options->image.zoom_to_fit_allow_expand, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1959 "scroll_reset", options->image.scroll_reset_method, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1960 "cache_display", options->image.tile_cache_max, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1961 "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
|
1962 "window_limit", options->image.limit_window_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1963 "window_limit_value", options->image.max_window_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1964 "autofit_limit", options->image.limit_autofit_size, |
771c179cba77
Rename image-related options.
Laurent Monin <geeqie@norz.org>
parents:
327
diff
changeset
|
1965 "autofit_limit_value", options->image.max_autofit_size, |
2474
f591509cb3d3
Fix #123: Limit image expansion in Fit To Window
Colin Clark <colin.clark@cclark.uk>
parents:
2466
diff
changeset
|
1966 "enlargement_limit_value", options->image.max_enlargement_size, |
209
ce89a8349d8b
configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
208
diff
changeset
|
1967 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1968 NULL); |
27
ff0b02ab8da7
Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
26
diff
changeset
|
1969 |
ff0b02ab8da7
Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
26
diff
changeset
|
1970 pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)imd->top_window); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
1971 |
1887
cca739d627fd
stereo mode preferences
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1886
diff
changeset
|
1972 image_stereo_set(imd, options->stereo.mode); |
2184 | 1973 pixbuf_renderer_stereo_fixed_set((PixbufRenderer *)imd->pr, |
1974 options->stereo.fixed_w, options->stereo.fixed_h, | |
1891
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1975 options->stereo.fixed_x1, options->stereo.fixed_y1, |
25645af65caf
added fixed stereo mode
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1888
diff
changeset
|
1976 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
|
1977 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1978 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1979 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
|
1980 { |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1981 GList *work; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1982 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1983 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
|
1984 while (work) |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1985 { |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1986 ImageWindow *imd; |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1987 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1988 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
|
1989 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
|
1990 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1991 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
|
1992 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1993 } |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1994 |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1995 /* |
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
1996 *------------------------------------------------------------------- |
9 | 1997 * init / destroy |
1998 *------------------------------------------------------------------- | |
1999 */ | |
2000 | |
2001 static void image_free(ImageWindow *imd) | |
2002 { | |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
2003 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
|
2004 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2005 if (imd->auto_refresh && imd->image_fd) |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2006 file_data_unregister_real_time_monitor(imd->image_fd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2007 |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2008 file_data_unregister_notify_func(image_notify_cb, imd); |
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2009 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
2010 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
|
2011 |
9 | 2012 image_read_ahead_cancel(imd); |
2013 | |
138
5be5d1c53016
replaced gchar* path with FileData *fd
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
131
diff
changeset
|
2014 file_data_unref(imd->image_fd); |
9 | 2015 g_free(imd->title); |
2016 g_free(imd->title_right); | |
2017 g_free(imd); | |
2018 } | |
2019 | |
2035
4321c486aec7
use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2034
diff
changeset
|
2020 static void image_destroy_cb(GtkWidget *widget, gpointer data) |
9 | 2021 { |
2022 ImageWindow *imd = data; | |
2023 image_free(imd); | |
2024 } | |
2184 | 2025 #if GTK_CHECK_VERSION(3,0,0) |
2039
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2026 gboolean selectable_frame_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2027 { |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2028 GtkAllocation allocation; |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2029 gtk_widget_get_allocation(widget, &allocation); |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2030 gtk_paint_flat_box(gtk_widget_get_style(widget), |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2031 cr, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2032 gtk_widget_get_state(widget), |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2033 gtk_frame_get_shadow_type(GTK_FRAME(widget)), |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2034 widget, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2035 NULL, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2036 allocation.x + 3, allocation.y + 3, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2037 allocation.width - 6, allocation.height - 6); |
9 | 2038 |
2039
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2039 if (gtk_widget_has_focus(widget)) |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2040 { |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2041 gtk_paint_focus(gtk_widget_get_style(widget), cr, GTK_STATE_ACTIVE, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2042 widget, "image_window", |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2043 allocation.x, allocation.y, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2044 allocation.width - 1, allocation.height - 1); |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2045 } |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2046 else |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2047 { |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2048 gtk_paint_shadow(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_IN, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2049 widget, "image_window", |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2050 allocation.x, allocation.y, |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2051 allocation.width - 1, allocation.height - 1); |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2052 } |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2053 return FALSE; |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2054 } |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2055 |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2056 #else |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
2057 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
|
2058 { |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2059 GtkAllocation allocation; |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2060 gtk_widget_get_allocation(widget, &allocation); |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2061 gtk_paint_flat_box(gtk_widget_get_style(widget), |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2062 gtk_widget_get_window(widget), |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2063 gtk_widget_get_state(widget), |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2064 gtk_frame_get_shadow_type(GTK_FRAME(widget)), |
442 | 2065 NULL, |
2066 widget, | |
2067 NULL, | |
2034
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2068 allocation.x + 3, allocation.y + 3, |
9297985567b5
use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
2069 allocation.width - 6, allocation.height - 6); |
442 | 2070 |
2038
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2071 if (gtk_widget_has_focus(widget)) |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2072 { |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2073 gtk_paint_focus(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_ACTIVE, |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2074 &event->area, widget, "image_window", |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2075 allocation.x, allocation.y, |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2076 allocation.width - 1, allocation.height - 1); |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2077 } |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2078 else |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2079 { |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2080 gtk_paint_shadow(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_IN, |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2081 &event->area, widget, "image_window", |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2082 allocation.x, allocation.y, |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2083 allocation.width - 1, allocation.height - 1); |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2084 } |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
2085 return FALSE; |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
2086 } |
2039
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2087 #endif |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
2088 |
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
2089 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2090 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
|
2091 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2092 frame = !!frame; |
442 | 2093 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2094 if (frame == imd->has_frame) return; |
442 | 2095 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2096 gtk_widget_hide(imd->pr); |
442 | 2097 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2098 if (frame) |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2099 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2100 imd->frame = gtk_frame_new(NULL); |
2909
2e7fd08bfbe4
DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents:
2862
diff
changeset
|
2101 DEBUG_NAME(imd->frame); |
1358 | 2102 g_object_ref(imd->pr); |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2103 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
|
2104 gtk_container_add(GTK_CONTAINER(imd->frame), imd->pr); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
2105 |
1358 | 2106 g_object_unref(imd->pr); |
2038
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2107 gtk_widget_set_can_focus(imd->frame, TRUE); |
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2108 gtk_widget_set_app_paintable(imd->frame, TRUE); |
2185
c14a1d8e6aa4
Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents:
2184
diff
changeset
|
2109 |
2184 | 2110 #if GTK_CHECK_VERSION(3,0,0) |
2039
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2111 g_signal_connect(G_OBJECT(imd->frame), "draw", |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2112 G_CALLBACK(selectable_frame_draw_cb), NULL); |
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2113 #else |
512
0896f486ec6f
Remove whitespace between function name and first parenthesis for the sake of consistency.
Laurent Monin <geeqie@norz.org>
parents:
507
diff
changeset
|
2114 g_signal_connect(G_OBJECT(imd->frame), "expose_event", |
2038
dea1a1ba5e83
selectable image cleanup
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2037
diff
changeset
|
2115 G_CALLBACK(selectable_frame_expose_cb), NULL); |
2039
995254a632bb
selectable image drawing for gtk3
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2038
diff
changeset
|
2116 #endif |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2117 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
|
2118 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
|
2119 |
1358 | 2120 gtk_box_pack_start(GTK_BOX(imd->widget), imd->frame, TRUE, TRUE, 0); |
2121 gtk_widget_show(imd->frame); | |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2122 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2123 else |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2124 { |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
2125 g_object_ref(imd->pr); |
442 | 2126 if (imd->frame) |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2127 { |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2128 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
|
2129 gtk_widget_destroy(imd->frame); |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2130 imd->frame = NULL; |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2131 } |
1358 | 2132 gtk_box_pack_start(GTK_BOX(imd->widget), imd->pr, TRUE, TRUE, 0); |
1043
718ab8111f48
Replaced gtk depreceated code.
Petr Ostadal <postadal@suse.cz>
parents:
1032
diff
changeset
|
2133 |
1358 | 2134 g_object_unref(imd->pr); |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2135 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2136 |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2137 gtk_widget_show(imd->pr); |
442 | 2138 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2139 imd->has_frame = frame; |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2140 } |
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2141 |
1431
13c985b6e35e
More gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1365
diff
changeset
|
2142 ImageWindow *image_new(gboolean frame) |
9 | 2143 { |
2144 ImageWindow *imd; | |
2145 | |
2146 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
|
2147 |
9 | 2148 imd->unknown = TRUE; |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2149 imd->has_frame = -1; /* not initialized; for image_set_frame */ |
9 | 2150 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
|
2151 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
|
2152 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
|
2153 imd->orientation = 1; |
9 | 2154 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
2155 imd->pr = GTK_WIDGET(pixbuf_renderer_new()); |
2909
2e7fd08bfbe4
DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents:
2862
diff
changeset
|
2156 DEBUG_NAME(imd->pr); |
9 | 2157 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
2158 image_options_set(imd); |
9 | 2159 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2160 imd->widget = gtk_vbox_new(0, 0); |
2909
2e7fd08bfbe4
DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents:
2862
diff
changeset
|
2161 DEBUG_NAME(imd->widget); |
151
edc0e0494694
improved drawing of frame around selected image
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
138
diff
changeset
|
2162 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2163 image_set_frame(imd, frame); |
9 | 2164 |
175
f9420b9a0bbc
do not show frame for full-window images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
174
diff
changeset
|
2165 image_set_selectable(imd, 0); |
9 | 2166 |
2565
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
2167 g_signal_connect(G_OBJECT(imd->pr), "clicked", |
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
2168 G_CALLBACK(image_click_cb), imd); |
2507
e9c4c1876d31
Fix #262: double click and fullscreen
Colin Clark <colin.clark@cclark.uk>
parents:
2474
diff
changeset
|
2169 g_signal_connect(G_OBJECT(imd->pr), "button_press_event", |
2565
52fa0e775bb5
Fix #499: Unable to move zoomed image
Colin Clark <colin.clark@cclark.uk>
parents:
2507
diff
changeset
|
2170 G_CALLBACK(image_press_cb), 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
|
2171 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
|
2172 G_CALLBACK(image_scroll_notify_cb), imd); |
9 | 2173 |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
2174 g_signal_connect(G_OBJECT(imd->pr), "scroll_event", |
9 | 2175 G_CALLBACK(image_scroll_cb), imd); |
2176 | |
23
9ff428db7772
##### Note: GQview CVS on sourceforge is not always up to date, please use #####
John Ellis <johne@verizon.net>
parents:
14
diff
changeset
|
2177 g_signal_connect(G_OBJECT(imd->pr), "destroy", |
9 | 2178 G_CALLBACK(image_destroy_cb), imd); |
2179 | |
25
aa1b676c31b6
Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
24
diff
changeset
|
2180 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
|
2181 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
|
2182 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
|
2183 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
|
2184 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
|
2185 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
|
2186 |
888
626822338b41
reload changed images
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
885
diff
changeset
|
2187 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
|
2188 |
26
f1fe26e637e9
Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
John Ellis <johne@verizon.net>
parents:
25
diff
changeset
|
2189 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
|
2190 |
9 | 2191 return imd; |
2192 } | |
2801
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2193 |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2194 void image_get_rectangle(gint *x1, gint *y1, gint *x2, gint *y2) |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2195 { |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2196 *x1 = rect_x1; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2197 *y1 = rect_y1; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2198 *x2 = rect_x2; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2199 *y2 = rect_y2; |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2200 } |
3e9ca298bb1d
Fix #251: Crop simulation
Colin Clark <colin.clark@cclark.uk>
parents:
2799
diff
changeset
|
2201 |
1055
4bbdfab3c89a
Adding a vim modeline to all files - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1045
diff
changeset
|
2202 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |