annotate src/pixbuf-renderer.c @ 856:ff15a32ad17f

Only define ExifOrientationType if GQ_BUILD is not defined since it is already defined in exif.h.
author zas_
date Thu, 26 Jun 2008 11:48:40 +0000
parents a7289f9e8d29
children 7d387a25b1ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 131
diff changeset
2 * Geeqie
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3 * (C) 2006 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 448
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
5 *
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
6 * Author: John Ellis
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
7 *
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
11 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
12
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
13 #include <stdio.h>
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
14 #include <stdlib.h>
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
15 #include <string.h>
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
16 #include <math.h>
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
17
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
18 #include "pixbuf-renderer.h"
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
19 #include "intl.h"
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
20
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
21 #include <gtk/gtk.h>
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
22
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
23
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 131
diff changeset
24 /* comment this out if not using this from within Geeqie
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
25 * defining GQ_BUILD does these things:
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
26 * - Sets the shift-click scroller pixbuf to a nice icon instead of a black box
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
27 */
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
28 #define GQ_BUILD 1
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
29
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
30 #ifdef GQ_BUILD
507
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
31 #include "main.h"
135570a8bd96 Move debug macros from main.h to new debug.h.
zas_
parents: 506
diff changeset
32 #include "pixbuf_util.h"
856
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
33 #include "exif.h"
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
34 #else
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
35 typedef enum {
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
36 EXIF_ORIENTATION_UNKNOWN = 0,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
37 EXIF_ORIENTATION_TOP_LEFT = 1,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
38 EXIF_ORIENTATION_TOP_RIGHT = 2,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
39 EXIF_ORIENTATION_BOTTOM_RIGHT = 3,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
40 EXIF_ORIENTATION_BOTTOM_LEFT = 4,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
41 EXIF_ORIENTATION_LEFT_TOP = 5,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
42 EXIF_ORIENTATION_RIGHT_TOP = 6,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
43 EXIF_ORIENTATION_RIGHT_BOTTOM = 7,
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
44 EXIF_ORIENTATION_LEFT_BOTTOM = 8
ff15a32ad17f Only define ExifOrientationType if GQ_BUILD is not defined since
zas_
parents: 736
diff changeset
45 } ExifOrientationType;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
46 #endif
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
47
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
48
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
49 /* size to use when breaking up image pane for rendering */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
50 #define PR_TILE_SIZE 128
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
51
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
52 /* default size of tile cache (mb) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
53 #define PR_CACHE_SIZE_DEFAULT 8
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
54
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
55 /* default min and max zoom */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
56 #define PR_ZOOM_MIN -32.0
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
57 #define PR_ZOOM_MAX 32.0
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
58
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
59 /* distance to drag mouse to disable image flip */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
60 #define PR_DRAG_SCROLL_THRESHHOLD 4
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
61
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
62 /* increase pan rate when holding down shift */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
63 #define PR_PAN_SHIFT_MULTIPLIER 6
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
64
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
65 /* scroller config */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
66 #define PR_SCROLLER_UPDATES_PER_SEC 30
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
67 #define PR_SCROLLER_DEAD_ZONE 6
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
68
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
69 /* alpha channel checkerboard background (same as gimp) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
70 #define PR_ALPHA_CHECK1 0x00999999
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
71 #define PR_ALPHA_CHECK2 0x00666666
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
72 #define PR_ALPHA_CHECK_SIZE 16
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
73
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
74 /* when scaling image to below this size, use nearest pixel for scaling
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
75 * (below about 4, the other scale types become slow generating their conversion tables)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
76 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
77 #define PR_MIN_SCALE_SIZE 8
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
78
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
79 typedef enum {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
80 TILE_RENDER_NONE = 0, /* do nothing */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
81 TILE_RENDER_AREA, /* render an area of the tile */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
82 TILE_RENDER_ALL /* render the whole tile */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
83 } ImageTileRenderType;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
84
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
85 typedef struct _ImageTile ImageTile;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
86 typedef struct _QueueData QueueData;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
87
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
88 struct _ImageTile
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
89 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
90 GdkPixmap *pixmap; /* off screen buffer */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
91 GdkPixbuf *pixbuf; /* pixbuf area for zooming */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
92 gint x; /* x offset into image */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
93 gint y; /* y offset into image */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
94 gint w; /* width that is visible (may be less if at edge of image) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
95 gint h; /* height '' */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
96
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
97 gboolean blank;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
98
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
99 /* render_todo: (explanation)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
100 NONE do nothing
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
101 AREA render area of tile, usually only used when loading an image
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
102 note: will jump to an ALL if render_done is not ALL.
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
103 ALL render entire tile, if never done before w/ ALL, for expose events *only*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
104 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
105
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
106 ImageTileRenderType render_todo; /* what to do (see above) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
107 ImageTileRenderType render_done; /* highest that has been done before on tile */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
108
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
109 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
110 QueueData *qd2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
111
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
112 guint size; /* est. memory used by pixmap and pixbuf */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
113 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
114
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
115 struct _QueueData
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
116 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
117 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
118 gint x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
119 gint y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
120 gint w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
121 gint h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
122 gboolean new_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
123 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
124
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
125 typedef struct _SourceTile SourceTile;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
126 struct _SourceTile
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
127 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
128 gint x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
129 gint y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
130 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
131 gboolean blank;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
132 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
133
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
134 typedef struct _OverlayData OverlayData;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
135 struct _OverlayData
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
136 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
137 gint id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
138
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
139 GdkPixbuf *pixbuf;
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
140 GdkWindow *window;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
141
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
142 gint x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
143 gint y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
144 gint relative; /* x,y coordinates are relative, negative values start bottom right */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
145
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
146 gint always; /* hide temporarily when scrolling (not yet implemented) */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
147 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
148
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
149 enum {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
150 SIGNAL_ZOOM = 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
151 SIGNAL_CLICKED,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
152 SIGNAL_SCROLL_NOTIFY,
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
153 SIGNAL_RENDER_COMPLETE,
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
154 SIGNAL_DRAG,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
155 SIGNAL_COUNT
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
156 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
157
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
158 enum {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
159 PROP_0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
160 PROP_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
161 PROP_ZOOM_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
162 PROP_ZOOM_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
163 PROP_ZOOM_2PASS,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
164 PROP_ZOOM_EXPAND,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
165 PROP_DITHER_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
166 PROP_SCROLL_RESET,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
167 PROP_DELAY_FLIP,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
168 PROP_LOADING,
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
169 PROP_COMPLETE,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
170 PROP_CACHE_SIZE_DISPLAY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
171 PROP_CACHE_SIZE_TILES,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
172 PROP_WINDOW_FIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
173 PROP_WINDOW_LIMIT,
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
174 PROP_WINDOW_LIMIT_VALUE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
175 PROP_AUTOFIT_LIMIT,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
176 PROP_AUTOFIT_LIMIT_VALUE
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
177 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
178
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
179
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
180
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
181 static guint signals[SIGNAL_COUNT] = { 0 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
182 static GtkEventBoxClass *parent_class = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
183
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
184
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
185
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
186 static void pixbuf_renderer_class_init(PixbufRendererClass *class);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
187 static void pixbuf_renderer_init(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
188 static void pixbuf_renderer_finalize(GObject *object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
189 static void pixbuf_renderer_set_property(GObject *object, guint prop_id,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
190 const GValue *value, GParamSpec *pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
191 static void pixbuf_renderer_get_property(GObject *object, guint prop_id,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
192 GValue *value, GParamSpec *pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
193 static gint pixbuf_renderer_expose(GtkWidget *widget, GdkEventExpose *event);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
194
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
195 static void pr_render_complete_signal(PixbufRenderer *pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
196
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
197 static void pr_overlay_list_clear(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
198 static void pr_scroller_timer_set(PixbufRenderer *pr, gint start);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
199 static void pr_border_draw(PixbufRenderer *pr, gint x, gint y, gint w, gint h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
200
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
201
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
202 static void pr_source_tile_free_all(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
203 static void pr_tile_free_all(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
204 static void pr_tile_invalidate_region(PixbufRenderer *pr, gint x, gint y, gint w, gint h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
205 static gint pr_tile_is_visible(PixbufRenderer *pr, ImageTile *it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
206 static void pr_queue_clear(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
207 static void pr_queue_merge(QueueData *parent, QueueData *qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
208 static void pr_queue(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
209 gint clamp, ImageTileRenderType render, gint new_data, gint only_existing);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
210
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
211 static void pr_redraw(PixbufRenderer *pr, gint new_data);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
212
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
213 static void pr_zoom_sync(PixbufRenderer *pr, gdouble zoom,
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
214 gint force, gint new,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
215 gint center_point, gint px, gint py);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
216
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
217 static void pr_signals_connect(PixbufRenderer *pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
218 static void pr_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
219 static void pixbuf_renderer_paint(PixbufRenderer *pr, GdkRectangle *area);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
220
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
221
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
222 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
223 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
224 * Pixbuf Renderer object
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
225 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
226 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
227
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
228 GType pixbuf_renderer_get_type(void)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
229 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
230 static GType pixbuf_renderer_type = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
231
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
232 if (!pixbuf_renderer_type)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
233 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
234 static const GTypeInfo pixbuf_renderer_info =
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
235 {
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
236 sizeof(PixbufRendererClass), /* class_size */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
237 NULL, /* base_init */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
238 NULL, /* base_finalize */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
239 (GClassInitFunc)pixbuf_renderer_class_init,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
240 NULL, /* class_finalize */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
241 NULL, /* class_data */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
242 sizeof(PixbufRenderer), /* instance_size */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
243 0, /* n_preallocs */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
244 (GInstanceInitFunc)pixbuf_renderer_init, /* instance_init */
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
245 NULL, /* value_table */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
246 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
247
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
248 pixbuf_renderer_type = g_type_register_static(GTK_TYPE_EVENT_BOX, "PixbufRenderer",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
249 &pixbuf_renderer_info, 0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
250 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
251
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
252 return pixbuf_renderer_type;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
253 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
254
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
255 static void pixbuf_renderer_class_init(PixbufRendererClass *class)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
256 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
257 GObjectClass *gobject_class = G_OBJECT_CLASS(class);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
258 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
259
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
260 parent_class = g_type_class_peek_parent(class);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
261
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
262 gobject_class->set_property = pixbuf_renderer_set_property;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
263 gobject_class->get_property = pixbuf_renderer_get_property;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
264
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
265 gobject_class->finalize = pixbuf_renderer_finalize;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
266
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
267 widget_class->expose_event = pixbuf_renderer_expose;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
268
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
269 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
270 PROP_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
271 g_param_spec_double("zoom_min",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
272 "Zoom minimum",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
273 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
274 -1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
275 1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
276 PR_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
277 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
278
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
279 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
280 PROP_ZOOM_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
281 g_param_spec_double("zoom_max",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
282 "Zoom maximum",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
283 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
284 -1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
285 1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
286 PR_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
287 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
288
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
289 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
290 PROP_ZOOM_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
291 g_param_spec_uint("zoom_quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
292 "Zoom quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
293 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
294 GDK_INTERP_NEAREST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
295 GDK_INTERP_HYPER,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
296 GDK_INTERP_BILINEAR,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
297 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
298
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
299 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
300 PROP_ZOOM_2PASS,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
301 g_param_spec_boolean("zoom_2pass",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
302 "2 pass zoom",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
303 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
304 TRUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
305 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
306
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
307 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
308 PROP_ZOOM_EXPAND,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
309 g_param_spec_boolean("zoom_expand",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
310 "Expand image in autozoom.",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
311 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
312 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
313 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
314
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
315 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
316 PROP_DITHER_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
317 g_param_spec_uint("dither_quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
318 "Dither quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
319 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
320 GDK_RGB_DITHER_NONE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
321 GDK_RGB_DITHER_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
322 GDK_RGB_DITHER_NORMAL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
323 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
324
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
325 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
326 PROP_SCROLL_RESET,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
327 g_param_spec_uint("scroll_reset",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
328 "New image scroll reset",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
329 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
330 PR_SCROLL_RESET_TOPLEFT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
331 PR_SCROLL_RESET_NOCHANGE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
332 PR_SCROLL_RESET_TOPLEFT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
333 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
334
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
335 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
336 PROP_DELAY_FLIP,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
337 g_param_spec_boolean("delay_flip",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
338 "Delay image update",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
339 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
340 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
341 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
342
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
343 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
344 PROP_LOADING,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
345 g_param_spec_boolean("loading",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
346 "Image actively loading",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
347 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
348 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
349 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
350
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
351 g_object_class_install_property(gobject_class,
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
352 PROP_COMPLETE,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
353 g_param_spec_boolean("complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
354 "Image rendering complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
355 NULL,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
356 FALSE,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
357 G_PARAM_READABLE | G_PARAM_WRITABLE));
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
358
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
359 g_object_class_install_property(gobject_class,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
360 PROP_CACHE_SIZE_DISPLAY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
361 g_param_spec_uint("cache_display",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
362 "Display cache size MB",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
363 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
364 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
365 128,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
366 PR_CACHE_SIZE_DEFAULT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
367 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
368
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
369 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
370 PROP_CACHE_SIZE_TILES,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
371 g_param_spec_uint("cache_tiles",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
372 "Tile cache count",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
373 "Number of tiles to retain in memory at any one time.",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
374 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
375 256,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
376 PR_CACHE_SIZE_DEFAULT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
377 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
378
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
379 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
380 PROP_WINDOW_FIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
381 g_param_spec_boolean("window_fit",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
382 "Fit window to image size",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
383 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
384 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
385 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
386
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
387 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
388 PROP_WINDOW_LIMIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
389 g_param_spec_boolean("window_limit",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
390 "Limit size of parent window",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
391 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
392 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
393 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
394
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
395 g_object_class_install_property(gobject_class,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
396 PROP_WINDOW_LIMIT_VALUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
397 g_param_spec_uint("window_limit_value",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
398 "Size limit of parent window",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
399 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
400 10,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
401 150,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
402 100,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
403 G_PARAM_READABLE | G_PARAM_WRITABLE));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
404
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
405 g_object_class_install_property(gobject_class,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
406 PROP_AUTOFIT_LIMIT,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
407 g_param_spec_boolean("autofit_limit",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
408 "Limit size of image when autofitting",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
409 NULL,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
410 FALSE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
411 G_PARAM_READABLE | G_PARAM_WRITABLE));
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
412
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
413 g_object_class_install_property(gobject_class,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
414 PROP_AUTOFIT_LIMIT_VALUE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
415 g_param_spec_uint("autofit_limit_value",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
416 "Size limit of image when autofitting",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
417 NULL,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
418 10,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
419 150,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
420 100,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
421 G_PARAM_READABLE | G_PARAM_WRITABLE));
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
422
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
423
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
424 signals[SIGNAL_ZOOM] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
425 g_signal_new("zoom",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
426 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
427 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
428 G_STRUCT_OFFSET(PixbufRendererClass, zoom),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
429 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
430 g_cclosure_marshal_VOID__DOUBLE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
431 G_TYPE_NONE, 1,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
432 G_TYPE_DOUBLE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
433
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
434 signals[SIGNAL_CLICKED] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
435 g_signal_new("clicked",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
436 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
437 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
438 G_STRUCT_OFFSET(PixbufRendererClass, clicked),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
439 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
440 g_cclosure_marshal_VOID__BOXED,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
441 G_TYPE_NONE, 1,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
442 GDK_TYPE_EVENT);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
443
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
444 signals[SIGNAL_SCROLL_NOTIFY] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
445 g_signal_new("scroll-notify",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
446 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
447 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
448 G_STRUCT_OFFSET(PixbufRendererClass, scroll_notify),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
449 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
450 g_cclosure_marshal_VOID__VOID,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
451 G_TYPE_NONE, 0);
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
452
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
453 signals[SIGNAL_RENDER_COMPLETE] =
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
454 g_signal_new("render-complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
455 G_OBJECT_CLASS_TYPE(gobject_class),
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
456 G_SIGNAL_RUN_LAST,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
457 G_STRUCT_OFFSET(PixbufRendererClass, render_complete),
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
458 NULL, NULL,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
459 g_cclosure_marshal_VOID__VOID,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
460 G_TYPE_NONE, 0);
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
461
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
462 signals[SIGNAL_DRAG] =
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
463 g_signal_new("drag",
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
464 G_OBJECT_CLASS_TYPE(gobject_class),
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
465 G_SIGNAL_RUN_LAST,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
466 G_STRUCT_OFFSET(PixbufRendererClass, drag),
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
467 NULL, NULL,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
468 g_cclosure_marshal_VOID__BOXED,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
469 G_TYPE_NONE, 1,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
470 GDK_TYPE_EVENT);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
471 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
472
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
473 static void pixbuf_renderer_init(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
474 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
475 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
476
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
477 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
478
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
479 pr->zoom_min = PR_ZOOM_MIN;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
480 pr->zoom_max = PR_ZOOM_MAX;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
481 pr->zoom_quality = GDK_INTERP_BILINEAR;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
482 pr->zoom_2pass = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
483
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
484 pr->zoom = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
485 pr->scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
486
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
487 pr->dither_quality = GDK_RGB_DITHER_NORMAL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
488
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
489 pr->scroll_reset = PR_SCROLL_RESET_TOPLEFT;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
490
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
491 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
492
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
493 pr->tile_width = PR_TILE_SIZE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
494 pr->tile_height = PR_TILE_SIZE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
495
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
496 pr->tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
497 pr->tile_cache_size = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
498
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
499 pr->tile_cache_max = PR_CACHE_SIZE_DEFAULT;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
500
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
501 pr->scroller_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
502 pr->scroller_overlay = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
503
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
504 pr->source_tiles_enabled = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
505 pr->source_tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
506
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
507 pr->orientation = 1;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
508
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
509 gtk_widget_set_double_buffered(box, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
510 g_signal_connect_after(G_OBJECT(box), "size_allocate",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
511 G_CALLBACK(pr_size_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
512
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
513 pr_signals_connect(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
514 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
515
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
516 static void pixbuf_renderer_finalize(GObject *object)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
517 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
518 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
519
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
520 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
521
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
522 pr_queue_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
523 pr_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
524
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
525 if (pr->pixbuf) g_object_unref(pr->pixbuf);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
526 if (pr->spare_tile) gdk_pixbuf_unref(pr->spare_tile);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
527
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
528 pr_scroller_timer_set(pr, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
529 pr_overlay_list_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
530
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
531 pr_source_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
532 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
533
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
534 PixbufRenderer* pixbuf_renderer_new(void)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
535 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
536 return g_object_new(TYPE_PIXBUF_RENDERER, NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
537 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
538
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
539 static void pixbuf_renderer_set_property(GObject *object, guint prop_id,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
540 const GValue *value, GParamSpec *pspec)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
541 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
542 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
543
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
544 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
545
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
546 switch (prop_id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
547 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
548 case PROP_ZOOM_MIN:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
549 pr->zoom_min = g_value_get_double(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
550 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
551 case PROP_ZOOM_MAX:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
552 pr->zoom_max = g_value_get_double(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
553 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
554 case PROP_ZOOM_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
555 pr->zoom_quality = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
556 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
557 case PROP_ZOOM_2PASS:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
558 pr->zoom_2pass = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
559 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
560 case PROP_ZOOM_EXPAND:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
561 pr->zoom_expand = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
562 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
563 case PROP_DITHER_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
564 pr->dither_quality = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
565 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
566 case PROP_SCROLL_RESET:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
567 pr->scroll_reset = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
568 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
569 case PROP_DELAY_FLIP:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
570 pr->delay_flip = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
571 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
572 case PROP_LOADING:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
573 pr->loading = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
574 break;
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
575 case PROP_COMPLETE:
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
576 pr->complete = g_value_get_boolean(value);
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
577 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
578 case PROP_CACHE_SIZE_DISPLAY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
579 pr->tile_cache_max = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
580 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
581 case PROP_CACHE_SIZE_TILES:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
582 pr->source_tiles_cache_size = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
583 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
584 case PROP_WINDOW_FIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
585 pr->window_fit = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
586 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
587 case PROP_WINDOW_LIMIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
588 pr->window_limit = g_value_get_boolean(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
589 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
590 case PROP_WINDOW_LIMIT_VALUE:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
591 pr->window_limit_size = g_value_get_uint(value);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
592 break;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
593 case PROP_AUTOFIT_LIMIT:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
594 pr->autofit_limit = g_value_get_boolean(value);
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
595 break;
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
596 case PROP_AUTOFIT_LIMIT_VALUE:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
597 pr->autofit_limit_size = g_value_get_uint(value);
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
598 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
599 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
600 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
601 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
602 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
603 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
604
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
605 static void pixbuf_renderer_get_property(GObject *object, guint prop_id,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
606 GValue *value, GParamSpec *pspec)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
607 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
608 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
609
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
610 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
611
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
612 switch (prop_id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
613 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
614 case PROP_ZOOM_MIN:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
615 g_value_set_double(value, pr->zoom_min);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
616 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
617 case PROP_ZOOM_MAX:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
618 g_value_set_double(value, pr->zoom_max);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
619 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
620 case PROP_ZOOM_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
621 g_value_set_uint(value, pr->zoom_quality);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
622 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
623 case PROP_ZOOM_2PASS:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
624 g_value_set_boolean(value, pr->zoom_2pass);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
625 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
626 case PROP_ZOOM_EXPAND:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
627 g_value_set_boolean(value, pr->zoom_expand);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
628 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
629 case PROP_DITHER_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
630 g_value_set_uint(value, pr->dither_quality);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
631 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
632 case PROP_SCROLL_RESET:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
633 g_value_set_uint(value, pr->scroll_reset);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
634 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
635 case PROP_DELAY_FLIP:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
636 g_value_set_boolean(value, pr->delay_flip);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
637 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
638 case PROP_LOADING:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
639 g_value_set_boolean(value, pr->loading);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
640 break;
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
641 case PROP_COMPLETE:
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
642 g_value_set_boolean(value, pr->complete);
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
643 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
644 case PROP_CACHE_SIZE_DISPLAY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
645 g_value_set_uint(value, pr->tile_cache_max);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
646 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
647 case PROP_CACHE_SIZE_TILES:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
648 g_value_set_uint(value, pr->source_tiles_cache_size);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
649 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
650 case PROP_WINDOW_FIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
651 g_value_set_boolean(value, pr->window_fit);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
652 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
653 case PROP_WINDOW_LIMIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
654 g_value_set_boolean(value, pr->window_limit);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
655 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
656 case PROP_WINDOW_LIMIT_VALUE:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
657 g_value_set_uint(value, pr->window_limit_size);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
658 break;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
659 case PROP_AUTOFIT_LIMIT:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
660 g_value_set_boolean(value, pr->autofit_limit);
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
661 break;
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
662 case PROP_AUTOFIT_LIMIT_VALUE:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
663 g_value_set_uint(value, pr->autofit_limit_size);
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
664 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
665 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
666 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
667 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
668 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
669 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
670
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
671 static gint pixbuf_renderer_expose(GtkWidget *widget, GdkEventExpose *event)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
672 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
673 if (GTK_WIDGET_DRAWABLE(widget))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
674 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
675 if (!GTK_WIDGET_NO_WINDOW(widget))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
676 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
677 if (event->window != widget->window)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
678 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
679 GdkRectangle area;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
680
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
681 gdk_window_get_position(event->window, &area.x, &area.y);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
682
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
683 area.x += event->area.x;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
684 area.y += event->area.y;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
685 area.width = event->area.width;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
686 area.height = event->area.height;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
687 pixbuf_renderer_paint(PIXBUF_RENDERER(widget), &area);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
688 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
689 else
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
690 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
691 pixbuf_renderer_paint(PIXBUF_RENDERER(widget), &event->area);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
692 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
693 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
694 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
695
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
696 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
697 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
698
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
699 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
700 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
701 * misc utilities
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
702 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
703 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
704
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
705 static void widget_set_cursor(GtkWidget *widget, gint icon)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
706 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
707 GdkCursor *cursor;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
708
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
709 if (!widget->window) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
710
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
711 if (icon == -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
712 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
713 cursor = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
714 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
715 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
716 {
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
717 cursor = gdk_cursor_new(icon);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
718 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
719
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
720 gdk_window_set_cursor(widget->window, cursor);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
721
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
722 if (cursor) gdk_cursor_unref(cursor);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
723 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
724
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
725 static gint pixmap_calc_size(GdkPixmap *pixmap)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
726 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
727 gint w, h, d;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
728
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
729 d = gdk_drawable_get_depth(pixmap);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
730 gdk_drawable_get_size(pixmap, &w, &h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
731 return w * h * (d / 8);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
732 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
733
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
734 static gint pr_clip_region(gint x, gint y, gint w, gint h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
735 gint clip_x, gint clip_y, gint clip_w, gint clip_h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
736 gint *rx, gint *ry, gint *rw, gint *rh)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
737 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
738 if (clip_x + clip_w <= x ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
739 clip_x >= x + w ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
740 clip_y + clip_h <= y ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
741 clip_y >= y + h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
742 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
743 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
744 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
745
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
746 *rx = MAX(x, clip_x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
747 *rw = MIN((x + w), (clip_x + clip_w)) - *rx;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
748
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
749 *ry = MAX(y, clip_y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
750 *rh = MIN((y + h), (clip_y + clip_h)) - *ry;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
751
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
752 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
753 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
754
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
755 static gint pr_parent_window_sizable(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
756 {
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
757 GdkWindowState state;
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
758
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
759 if (!pr->parent_window) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
760 if (!pr->window_fit) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
761 if (!GTK_WIDGET(pr)->window) return FALSE;
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
762
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
763 if (!pr->parent_window->window) return FALSE;
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
764 state = gdk_window_get_state(pr->parent_window->window);
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
765 if (state & GDK_WINDOW_STATE_MAXIMIZED) return FALSE;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
766
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
767 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
768 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
769
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
770 static gint pr_parent_window_resize(PixbufRenderer *pr, gint w, gint h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
771 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
772 GtkWidget *widget;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
773 GtkWidget *parent;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
774 gint ww, wh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
775
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
776 if (!pr_parent_window_sizable(pr)) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
777
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
778 if (pr->window_limit)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
779 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
780 gint sw = gdk_screen_width() * pr->window_limit_size / 100;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
781 gint sh = gdk_screen_height() * pr->window_limit_size / 100;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
782
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
783 if (w > sw) w = sw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
784 if (h > sh) h = sh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
785 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
786
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
787 widget = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
788 parent = GTK_WIDGET(pr->parent_window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
789
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
790 w += (parent->allocation.width - widget->allocation.width);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
791 h += (parent->allocation.height - widget->allocation.height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
792
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
793 gdk_drawable_get_size(parent->window, &ww, &wh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
794 if (w == ww && h == wh) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
795
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
796 gdk_window_resize(parent->window, w, h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
797
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
798 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
799 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
800
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
801 void pixbuf_renderer_set_parent(PixbufRenderer *pr, GtkWindow *window)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
802 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
803 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
804 g_return_if_fail(window == NULL || GTK_IS_WINDOW(window));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
805
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
806 pr->parent_window = GTK_WIDGET(window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
807 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
808
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
809 GtkWindow *pixbuf_renderer_get_parent(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
810 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
811 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
812
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
813 return GTK_WINDOW(pr->parent_window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
814 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
815
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
816
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
817 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
818 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
819 * overlays
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
820 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
821 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
822
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
823 static void pr_overlay_get_position(PixbufRenderer *pr, OverlayData *od,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
824 gint *x, gint *y, gint *w, gint *h)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
825 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
826 gint px, py, pw, ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
827
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
828 pw = gdk_pixbuf_get_width(od->pixbuf);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
829 ph = gdk_pixbuf_get_height(od->pixbuf);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
830 px = od->x;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
831 py = od->y;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
832
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
833 if (od->relative)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
834 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
835 if (px < 0) px = pr->window_width - pw + px;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
836 if (py < 0) py = pr->window_height - ph + py;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
837 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
838
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
839 if (x) *x = px;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
840 if (y) *y = py;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
841 if (w) *w = pw;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
842 if (h) *h = ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
843 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
844
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
845 static void pr_overlay_draw(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
846 ImageTile *it)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
847 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
848 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
849 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
850
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
851 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
852
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
853 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
854 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
855 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
856 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
857 gint px, py, pw, ph;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
858 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
859
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
860 od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
861 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
862
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
863 pr_overlay_get_position(pr, od, &px, &py, &pw, &ph);
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
864 if (pr_clip_region(x, y, w, h, px, py, pw, ph, &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
865 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
866 if (!pr->overlay_buffer)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
867 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
868 pr->overlay_buffer = gdk_pixmap_new(((GtkWidget *)pr)->window, pr->tile_width, pr->tile_height, -1);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
869 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
870
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
871 if (it)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
872 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
873 gdk_draw_drawable(pr->overlay_buffer, box->style->fg_gc[GTK_WIDGET_STATE(box)],
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
874 it->pixmap,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
875 rx - (pr->x_offset + (it->x - pr->x_scroll)),
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
876 ry - (pr->y_offset + (it->y - pr->y_scroll)),
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
877 0, 0, rw, rh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
878 gdk_draw_pixbuf(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
879 box->style->fg_gc[GTK_WIDGET_STATE(box)],
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
880 od->pixbuf,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
881 rx - px, ry - py,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
882 0, 0, rw, rh,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
883 pr->dither_quality, rx, ry);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
884 gdk_draw_drawable(od->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
885 pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
886 0, 0,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
887 rx - px, ry - py, rw, rh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
888 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
889 else
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
890 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
891 /* no ImageTile means region may be larger than our scratch buffer */
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
892 gint sx, sy;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
893
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
894 for (sx = rx; sx < rx + rw; sx += pr->tile_width)
517
d84f2210a73c 6 for() vs 201 for (): winner is for ().
zas_
parents: 513
diff changeset
895 for (sy = ry; sy < ry + rh; sy += pr->tile_height)
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
896 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
897 gint sw, sh;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
898
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
899 sw = MIN(rx + rw - sx, pr->tile_width);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
900 sh = MIN(ry + rh - sy, pr->tile_height);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
901
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
902 gdk_draw_rectangle(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
903 box->style->bg_gc[GTK_WIDGET_STATE(box)], TRUE,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
904 0, 0, sw, sh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
905 gdk_draw_pixbuf(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
906 box->style->fg_gc[GTK_WIDGET_STATE(box)],
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
907 od->pixbuf,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
908 sx - px, sy - py,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
909 0, 0, sw, sh,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
910 pr->dither_quality, sx, sy);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
911 gdk_draw_drawable(od->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
912 pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
913 0, 0,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
914 sx - px, sy - py, sw, sh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
915 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
916 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
917 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
918 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
919 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
920
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
921 static void pr_overlay_queue_draw(PixbufRenderer *pr, OverlayData *od)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
922 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
923 gint x, y, w, h;
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
924
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
925 pr_overlay_get_position(pr, od, &x, &y, &w, &h);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
926 pr_queue(pr, pr->x_scroll - pr->x_offset + x,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
927 pr->y_scroll - pr->y_offset + y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
928 w, h,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
929 FALSE, TILE_RENDER_ALL, FALSE, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
930
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
931 pr_border_draw(pr, x, y, w, h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
932 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
933
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
934 static void pr_overlay_queue_all(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
935 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
936 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
937
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
938 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
939 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
940 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
941 OverlayData *od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
942 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
943
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
944 pr_overlay_queue_draw(pr, od);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
945 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
946 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
947
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
948 static void pr_overlay_update_sizes(PixbufRenderer *pr)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
949 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
950 GList *work;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
951
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
952 work = pr->overlay_list;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
953 while (work)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
954 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
955 OverlayData *od = work->data;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
956 work = work->next;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
957
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
958 if (od->relative && od->window)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
959 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
960 gint x, y, w, h;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
961
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
962 pr_overlay_get_position(pr, od, &x, &y, &w, &h);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
963 gdk_window_move_resize(od->window, x, y, w, h);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
964 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
965 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
966 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
967
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
968 static OverlayData *pr_overlay_find(PixbufRenderer *pr, gint id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
969 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
970 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
971
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
972 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
973 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
974 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
975 OverlayData *od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
976 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
977
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
978 if (od->id == id) return od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
979 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
980
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
981 return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
982 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
983
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
984 gint pixbuf_renderer_overlay_add(PixbufRenderer *pr, GdkPixbuf *pixbuf, gint x, gint y,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
985 gint relative, gint always)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
986 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
987 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
988 gint id;
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
989 gint px, py, pw, ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
990 GdkWindowAttr attributes;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
991 gint attributes_mask;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
992
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
993 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), -1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
994 g_return_val_if_fail(pixbuf != NULL, -1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
995
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
996 id = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
997 while (pr_overlay_find(pr, id)) id++;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
998
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
999 od = g_new0(OverlayData, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1000 od->id = id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1001 od->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1002 g_object_ref(G_OBJECT(od->pixbuf));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1003 od->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1004 od->y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1005 od->relative = relative;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1006 od->always = always;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1007
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1008 pr_overlay_get_position(pr, od, &px, &py, &pw, &ph);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1009
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1010 attributes.window_type = GDK_WINDOW_CHILD;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1011 attributes.wclass = GDK_INPUT_OUTPUT;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1012 attributes.width = pw;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1013 attributes.height = ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1014 attributes.event_mask = GDK_EXPOSURE_MASK;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1015 attributes_mask = 0;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1016
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1017 od->window = gdk_window_new(GTK_WIDGET(pr)->window, &attributes, attributes_mask);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 507
diff changeset
1018 gdk_window_set_user_data(od->window, pr);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1019 gdk_window_move(od->window, px, py);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1020 gdk_window_show(od->window);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1021
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1022 pr->overlay_list = g_list_append(pr->overlay_list, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1023
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1024 pr_overlay_queue_draw(pr, od);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1025
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1026 return od->id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1027 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1028
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1029 static void pr_overlay_free(PixbufRenderer *pr, OverlayData *od)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1030 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1031 pr->overlay_list = g_list_remove(pr->overlay_list, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1032
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1033 if (od->pixbuf) g_object_unref(G_OBJECT(od->pixbuf));
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1034 if (od->window) gdk_window_destroy(od->window);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1035 g_free(od);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1036
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1037 if (!pr->overlay_list && pr->overlay_buffer)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1038 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1039 g_object_unref(pr->overlay_buffer);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1040 pr->overlay_buffer = NULL;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1041 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1042 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1043
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1044 static void pr_overlay_list_clear(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1045 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1046 while (pr->overlay_list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1047 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1048 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1049
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1050 od = pr->overlay_list->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1051 pr_overlay_free(pr, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1052 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1053 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1054
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1055 void pixbuf_renderer_overlay_set(PixbufRenderer *pr, gint id, GdkPixbuf *pixbuf, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1056 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1057 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1058
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1059 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1060
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1061 od = pr_overlay_find(pr, id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1062 if (!od) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1063
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1064 if (pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1065 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1066 gint px, py, pw, ph;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1067
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1068 g_object_ref(G_OBJECT(pixbuf));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1069 g_object_unref(G_OBJECT(od->pixbuf));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1070 od->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1071
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1072 od->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1073 od->y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1074
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1075 pr_overlay_queue_draw(pr, od);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1076 pr_overlay_get_position(pr, od, &px, &py, &pw, &ph);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1077 gdk_window_move_resize(od->window, px, py, pw, ph);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1078 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1079 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1080 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1081 pr_overlay_queue_draw(pr, od);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1082 pr_overlay_free(pr, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1083 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1084 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1085
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1086 gint pixbuf_renderer_overlay_get(PixbufRenderer *pr, gint id, GdkPixbuf **pixbuf, gint *x, gint *y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1087 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1088 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1089
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1090 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1091
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1092 od = pr_overlay_find(pr, id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1093 if (!od) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1094
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1095 if (pixbuf) *pixbuf = od->pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1096 if (x) *x = od->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1097 if (y) *y = od->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1098
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1099 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1100 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1101
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1102 void pixbuf_renderer_overlay_remove(PixbufRenderer *pr, gint id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1103 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1104 pixbuf_renderer_overlay_set(pr, id, NULL, 0, 0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1105 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1106
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1107 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1108 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1109 * scroller overlay
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1110 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1111 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1112
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1113
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1114 static gboolean pr_scroller_update_cb(gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1115 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1116 PixbufRenderer *pr = data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1117 gint x, y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1118 gint xinc, yinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1119
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1120 /* this was a simple scroll by difference between scroller and mouse position,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1121 * but all this math results in a smoother result and accounts for a dead zone.
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1122 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1123
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1124 if (abs(pr->scroller_xpos - pr->scroller_x) < PR_SCROLLER_DEAD_ZONE)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1125 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1126 x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1127 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1128 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1129 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1130 gint shift = PR_SCROLLER_DEAD_ZONE / 2 * PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1131 x = (pr->scroller_xpos - pr->scroller_x) / 2 * PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1132 x += (x > 0) ? -shift : shift;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1133 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1134
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1135 if (abs(pr->scroller_ypos - pr->scroller_y) < PR_SCROLLER_DEAD_ZONE)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1136 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1137 y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1138 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1139 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1140 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1141 gint shift = PR_SCROLLER_DEAD_ZONE / 2 * PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1142 y = (pr->scroller_ypos - pr->scroller_y) / 2 * PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1143 y += (y > 0) ? -shift : shift;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1144 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1145
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1146 if (abs(x) < PR_SCROLLER_DEAD_ZONE * PR_SCROLLER_UPDATES_PER_SEC)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1147 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1148 xinc = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1149 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1150 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1151 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1152 xinc = pr->scroller_xinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1153
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1154 if (x >= 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1155 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1156 if (xinc < 0) xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1157 if (x < xinc) xinc = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1158 if (x > xinc) xinc = MIN(xinc + x / PR_SCROLLER_UPDATES_PER_SEC, x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1159 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1160 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1161 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1162 if (xinc > 0) xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1163 if (x > xinc) xinc = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1164 if (x < xinc) xinc = MAX(xinc + x / PR_SCROLLER_UPDATES_PER_SEC, x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1165 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1166 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1167
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1168 if (abs(y) < PR_SCROLLER_DEAD_ZONE * PR_SCROLLER_UPDATES_PER_SEC)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1169 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1170 yinc = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1171 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1172 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1173 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1174 yinc = pr->scroller_yinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1175
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1176 if (y >= 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1177 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1178 if (yinc < 0) yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1179 if (y < yinc) yinc = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1180 if (y > yinc) yinc = MIN(yinc + y / PR_SCROLLER_UPDATES_PER_SEC, y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1181 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1182 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1183 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1184 if (yinc > 0) yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1185 if (y > yinc) yinc = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1186 if (y < yinc) yinc = MAX(yinc + y / PR_SCROLLER_UPDATES_PER_SEC, y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1187 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1188 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1189
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1190 pr->scroller_xinc = xinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1191 pr->scroller_yinc = yinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1192
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1193 xinc = xinc / PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1194 yinc = yinc / PR_SCROLLER_UPDATES_PER_SEC;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1195
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1196 pixbuf_renderer_scroll(pr, xinc, yinc);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1197
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1198 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1199 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1200
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1201 static void pr_scroller_timer_set(PixbufRenderer *pr, gint start)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1202 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1203 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1204 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1205 g_source_remove(pr->scroller_id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1206 pr->scroller_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1207 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1208
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1209 if (start)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1210 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1211 pr->scroller_id = g_timeout_add(1000 / PR_SCROLLER_UPDATES_PER_SEC,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1212 pr_scroller_update_cb, pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1213 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1214 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1215
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1216 static void pr_scroller_start(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1217 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1218 if (pr->scroller_overlay == -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1219 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1220 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1221 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1222
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
1223 #ifdef GQ_BUILD
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1224 pixbuf = pixbuf_inline(PIXBUF_INLINE_SCROLLER);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1225 #else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1226 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, 32, 32);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1227 gdk_pixbuf_fill(pixbuf, 0x000000ff);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1228 #endif
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1229 w = gdk_pixbuf_get_width(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1230 h = gdk_pixbuf_get_height(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1231
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1232 pr->scroller_overlay = pixbuf_renderer_overlay_add(pr, pixbuf, x - w / 2, y - h / 2, FALSE, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1233 g_object_unref(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1234 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1235
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1236 pr->scroller_x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1237 pr->scroller_y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1238 pr->scroller_xpos = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1239 pr->scroller_ypos = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1240
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1241 pr_scroller_timer_set(pr, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1242 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1243
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1244 static void pr_scroller_stop(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1245 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1246 if (pr->scroller_id == -1) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1247
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1248 pixbuf_renderer_overlay_remove(pr, pr->scroller_overlay);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1249 pr->scroller_overlay = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1250
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1251 pr_scroller_timer_set(pr, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1252 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1253
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1254 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1255 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1256 * borders
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1257 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1258 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1259
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1260 static void pr_border_draw(PixbufRenderer *pr, gint x, gint y, gint w, gint h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1261 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1262 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1263 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1264
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1265 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1266
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1267 if (!box->window) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1268
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1269 if (!pr->pixbuf && !pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1270 {
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1271 if (pr_clip_region(x, y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1272 0, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1273 pr->window_width, pr->window_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1274 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1275 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1276 gdk_window_clear_area(box->window, rx, ry, rw, rh);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1277 pr_overlay_draw(pr, rx, ry, rw, rh, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1278 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1279 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1280 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1281
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1282 if (pr->vis_width < pr->window_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1283 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1284 if (pr->x_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1285 pr_clip_region(x, y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1286 0, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1287 pr->x_offset, pr->window_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1288 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1289 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1290 gdk_window_clear_area(box->window, rx, ry, rw, rh);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1291 pr_overlay_draw(pr, rx, ry, rw, rh, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1292 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1293 if (pr->window_width - pr->vis_width - pr->x_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1294 pr_clip_region(x, y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1295 pr->x_offset + pr->vis_width, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1296 pr->window_width - pr->vis_width - pr->x_offset, pr->window_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1297 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1298 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1299 gdk_window_clear_area(box->window, rx, ry, rw, rh);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1300 pr_overlay_draw(pr, rx, ry, rw, rh, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1301 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1302 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1303 if (pr->vis_height < pr->window_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1304 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1305 if (pr->y_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1306 pr_clip_region(x, y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1307 pr->x_offset, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1308 pr->vis_width, pr->y_offset,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1309 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1310 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1311 gdk_window_clear_area(box->window, rx, ry, rw, rh);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1312 pr_overlay_draw(pr, rx, ry, rw, rh, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1313 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1314 if (pr->window_height - pr->vis_height - pr->y_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1315 pr_clip_region(x, y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1316 pr->x_offset, pr->y_offset + pr->vis_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1317 pr->vis_width, pr->window_height - pr->vis_height - pr->y_offset,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1318 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1319 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1320 gdk_window_clear_area(box->window, rx, ry, rw, rh);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1321 pr_overlay_draw(pr, rx, ry, rw, rh, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1322 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1323 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1324 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1325
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1326 static void pr_border_clear(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1327 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1328 pr_border_draw(pr, 0, 0, pr->window_width, pr->window_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1329 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1330
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1331 void pixbuf_renderer_set_color(PixbufRenderer *pr, GdkColor *color)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1332 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1333 GtkStyle *style;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1334 GtkWidget *widget;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1335
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1336 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1337
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1338 widget = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1339
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1340 if (color) {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1341 GdkColor *slot;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1342
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1343 style = gtk_style_copy(gtk_widget_get_style(widget));
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1344 slot = &style->bg[GTK_STATE_NORMAL];
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1345
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1346 slot->red = color->red;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1347 slot->green = color->green;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1348 slot->blue = color->blue;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1349 }
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1350 else {
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1351 style = gtk_style_copy(gtk_widget_get_default_style());
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1352 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1353
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1354 gtk_widget_set_style(widget, style);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1355
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1356 if (GTK_WIDGET_VISIBLE(widget)) pr_border_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1357 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1358
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1359
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1360 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1361 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1362 * source tiles
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1363 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1364 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1365
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1366 static void pr_source_tile_free(SourceTile *st)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1367 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1368 if (!st) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1369
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1370 if (st->pixbuf) g_object_unref(st->pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1371 g_free(st);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1372 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1373
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1374 static void pr_source_tile_free_all(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1375 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1376 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1377
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1378 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1379 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1380 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1381 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1382
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1383 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1384 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1385
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1386 pr_source_tile_free(st);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1387 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1388
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1389 g_list_free(pr->source_tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1390 pr->source_tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1391 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1392
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1393 static void pr_source_tile_unset(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1394 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1395 pr_source_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1396 pr->source_tiles_enabled = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1397 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1398
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1399 static gint pr_source_tile_visible(PixbufRenderer *pr, SourceTile *st)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1400 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1401 gint x1, y1, x2, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1402
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1403 if (!st) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1404
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1405 x1 = (pr->x_scroll / pr->tile_width) * pr->tile_width;
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1406 y1 = (pr->y_scroll / pr->tile_height) * pr->tile_height;
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1407 x2 = ((pr->x_scroll + pr->vis_width) / pr->tile_width) * pr->tile_width + pr->tile_width;
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1408 y2 = ((pr->y_scroll + pr->vis_height) / pr->tile_height) * pr->tile_height + pr->tile_height;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1409
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1410 return !((double)st->x * pr->scale > (double)x2 ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1411 (double)(st->x + pr->source_tile_width) * pr->scale < (double)x1 ||
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
1412 (double)st->y * pr->scale > (double)y2 ||
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1413 (double)(st->y + pr->source_tile_height) * pr->scale < (double)y1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1414 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1415
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1416 static SourceTile *pr_source_tile_new(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1417 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1418 SourceTile *st = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1419 gint count;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1420
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1421 g_return_val_if_fail(pr->source_tile_width >= 1 && pr->source_tile_height >= 1, NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1422
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1423 if (pr->source_tiles_cache_size < 4) pr->source_tiles_cache_size = 4;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1424
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1425 count = g_list_length(pr->source_tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1426 if (count >= pr->source_tiles_cache_size)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1427 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1428 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1429
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1430 work = g_list_last(pr->source_tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1431 while (work && count >= pr->source_tiles_cache_size)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1432 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1433 SourceTile *needle;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1434
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1435 needle = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1436 work = work->prev;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1437
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1438 if (!pr_source_tile_visible(pr, needle))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1439 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1440 pr->source_tiles = g_list_remove(pr->source_tiles, needle);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1441
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1442 if (pr->func_tile_dispose)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1443 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1444 pr->func_tile_dispose(pr, needle->x, needle->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1445 pr->source_tile_width, pr->source_tile_height,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1446 needle->pixbuf, pr->func_tile_data);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1447 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1448
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1449 if (!st)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1450 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1451 st = needle;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1452 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1453 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1454 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1455 pr_source_tile_free(needle);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1456 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1457
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1458 count--;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1459 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1460 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1461 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1462
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1463 if (!st)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1464 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1465 st = g_new0(SourceTile, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1466 st->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1467 pr->source_tile_width, pr->source_tile_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1468 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1469
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1470 st->x = (x / pr->source_tile_width) * pr->source_tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1471 st->y = (y / pr->source_tile_height) * pr->source_tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1472 st->blank = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1473
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1474 pr->source_tiles = g_list_prepend(pr->source_tiles, st);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1475
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1476 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1477 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1478
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1479 static SourceTile *pr_source_tile_request(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1480 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1481 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1482
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1483 st = pr_source_tile_new(pr, x, y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1484 if (!st) return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1485
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1486 if (pr->func_tile_request &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1487 pr->func_tile_request(pr, st->x, st->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1488 pr->source_tile_width, pr->source_tile_height, st->pixbuf, pr->func_tile_data))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1489 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1490 st->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1491 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1492
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1493 pr_tile_invalidate_region(pr, st->x * pr->scale, st->y * pr->scale,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1494 pr->source_tile_width * pr->scale, pr->source_tile_height * pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1495
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1496 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1497 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1498
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1499 static SourceTile *pr_source_tile_find(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1500 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1501 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1502
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1503 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1504 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1505 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1506 SourceTile *st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1507
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1508 if (x >= st->x && x < st->x + pr->source_tile_width &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1509 y >= st->y && y < st->y + pr->source_tile_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1510 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1511 if (work != pr->source_tiles)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1512 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1513 pr->source_tiles = g_list_remove_link(pr->source_tiles, work);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1514 pr->source_tiles = g_list_concat(work, pr->source_tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1515 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1516 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1517 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1518
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1519 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1520 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1521
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1522 return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1523 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1524
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1525 static GList *pr_source_tile_compute_region(PixbufRenderer *pr, gint x, gint y, gint w, gint h, gint request)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1526 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1527 gint x1, y1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1528 GList *list = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1529 gint sx, sy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1530
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1531 if (x < 0) x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1532 if (y < 0) y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1533 if (w > pr->image_width) w = pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1534 if (h > pr->image_height) h = pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1535
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1536 sx = (x / pr->source_tile_width) * pr->source_tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1537 sy = (y / pr->source_tile_height) * pr->source_tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1538
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1539 for (x1 = sx; x1 < x + w; x1+= pr->source_tile_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1540 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1541 for (y1 = sy; y1 < y + h; y1 += pr->source_tile_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1542 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1543 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1544
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1545 st = pr_source_tile_find(pr, x1, y1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1546 if (!st && request) st = pr_source_tile_request(pr, x1, y1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1547
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1548 if (st) list = g_list_prepend(list, st);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1549 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1550 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1551
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1552 return g_list_reverse(list);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1553 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1554
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1555 static void pr_source_tile_changed(PixbufRenderer *pr, gint x, gint y, gint width, gint height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1556 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1557 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1558
95
eb9bb29cbd65 Fri Nov 3 11:40:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 87
diff changeset
1559 if (width < 1 || height < 1) return;
eb9bb29cbd65 Fri Nov 3 11:40:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 87
diff changeset
1560
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1561 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1562 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1563 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1564 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1565 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1566
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1567 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1568 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1569
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1570 if (pr_clip_region(st->x, st->y, pr->source_tile_width, pr->source_tile_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1571 x, y, width, height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1572 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1573 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1574 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1575
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1576 pixbuf = gdk_pixbuf_new_subpixbuf(st->pixbuf, rx - st->x, ry - st->y, rw, rh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1577 if (pr->func_tile_request &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1578 pr->func_tile_request(pr, rx, ry, rw, rh, pixbuf, pr->func_tile_data))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1579 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1580 pr_tile_invalidate_region(pr, rx * pr->scale, ry * pr->scale,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1581 rw * pr->scale, rh * pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1582 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1583 g_object_unref(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1584 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1585 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1586 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1587
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1588 static gint pr_source_tile_render(PixbufRenderer *pr, ImageTile *it,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1589 gint x, gint y, gint w, gint h,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1590 gint new_data, gint fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1591 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1592 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1593 GList *list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1594 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1595 gint draw = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1596
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1597 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1598
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1599 if (pr->zoom == 1.0 || pr->scale == 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1600 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1601 list = pr_source_tile_compute_region(pr, it->x + x, it->y + y, w, h, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1602 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1603 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1604 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1605 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1606 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1607
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1608 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1609 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1610
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1611 if (pr_clip_region(st->x, st->y, pr->source_tile_width, pr->source_tile_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1612 it->x + x, it->y + y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1613 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1614 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1615 if (st->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1616 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1617 gdk_draw_rectangle(it->pixmap, box->style->black_gc, TRUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1618 rx - st->x, ry - st->y, rw, rh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1619 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1620 else /* (pr->zoom == 1.0 || pr->scale == 1.0) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1621 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1622 gdk_draw_pixbuf(it->pixmap,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1623 box->style->fg_gc[GTK_WIDGET_STATE(box)],
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1624 st->pixbuf,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1625 rx - st->x, ry - st->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1626 rx - it->x, ry - it->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1627 rw, rh,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1628 pr->dither_quality, rx, ry);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1629 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1630 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1631 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1632 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1633 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1634 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1635 double scale_x, scale_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1636 gint sx, sy, sw, sh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1637
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1638 if (pr->image_width == 0 || pr->image_height == 0) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1639 scale_x = (double)pr->width / pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1640 scale_y = (double)pr->height / pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1641
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1642 sx = (double)(it->x + x) / scale_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1643 sy = (double)(it->y + y) / scale_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1644 sw = (double)w / scale_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1645 sh = (double)h / scale_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1646
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1647 if (pr->width < PR_MIN_SCALE_SIZE || pr->height < PR_MIN_SCALE_SIZE) fast = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1648
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1649 #if 0
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1650 /* draws red over draw region, to check for leaks (regions not filled) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1651 pixbuf_set_rect_fill(it->pixbuf, x, y, w, h, 255, 0, 0, 255);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1652 #endif
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1653
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1654 list = pr_source_tile_compute_region(pr, sx, sy, sw, sh, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1655 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1656 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1657 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1658 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1659 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1660 gint stx, sty, stw, sth;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1661
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1662 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1663 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1664
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1665 stx = floor((double)st->x * scale_x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1666 sty = floor((double)st->y * scale_y);
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
1667 stw = ceil((double)(st->x + pr->source_tile_width) * scale_x) - stx;
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
1668 sth = ceil((double)(st->y + pr->source_tile_height) * scale_y) - sty;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1669
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1670 if (pr_clip_region(stx, sty, stw, sth,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1671 it->x + x, it->y + y, w, h,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1672 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1673 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1674 if (st->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1675 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1676 gdk_draw_rectangle(it->pixmap, box->style->black_gc, TRUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1677 rx - st->x, ry - st->y, rw, rh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1678 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1679 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1680 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1681 double offset_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1682 double offset_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1683
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1684 /* may need to use unfloored stx,sty values here */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1685 offset_x = (double)(stx - it->x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1686 offset_y = (double)(sty - it->y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1687
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1688 gdk_pixbuf_scale(st->pixbuf, it->pixbuf, rx - it->x, ry - it->y, rw, rh,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1689 (double) 0.0 + offset_x,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1690 (double) 0.0 + offset_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1691 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1692 (fast) ? GDK_INTERP_NEAREST : pr->zoom_quality);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1693 draw = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1694 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1695 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1696 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1697 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1698
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1699 g_list_free(list);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1700
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1701 return draw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1702 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1703
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1704 void pixbuf_renderer_set_tiles(PixbufRenderer *pr, gint width, gint height,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1705 gint tile_width, gint tile_height, gint cache_size,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1706 PixbufRendererTileRequestFunc func_request,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1707 PixbufRendererTileDisposeFunc func_dispose,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1708 gpointer user_data,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1709 gdouble zoom)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1710 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1711 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1712 g_return_if_fail(tile_width >= 32 && tile_width >= 32);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1713 g_return_if_fail(width >= 32 && height > 32);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1714 g_return_if_fail(func_request != NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1715
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1716 if (pr->pixbuf) g_object_unref(pr->pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1717 pr->pixbuf = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1718
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1719 pr_source_tile_unset(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1720
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1721 if (cache_size < 4) cache_size = 4;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1722
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1723 pr->source_tiles_enabled = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1724 pr->source_tiles_cache_size = cache_size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1725 pr->source_tile_width = tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1726 pr->source_tile_height = tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1727
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1728 pr->image_width = width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1729 pr->image_height = height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1730
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1731 pr->func_tile_request = func_request;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1732 pr->func_tile_dispose = func_dispose;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1733 pr->func_tile_data = user_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1734
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
1735 pr_zoom_sync(pr, zoom, TRUE, TRUE, FALSE, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1736 pr_redraw(pr, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1737 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1738
77
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1739 void pixbuf_renderer_set_tiles_size(PixbufRenderer *pr, gint width, gint height)
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1740 {
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1741 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1742 g_return_if_fail(width >= 32 && height > 32);
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1743
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1744 if (!pr->source_tiles_enabled) return;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1745 if (pr->image_width == width && pr->image_height == height) return;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1746
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1747 pr->image_width = width;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1748 pr->image_height = height;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1749
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
1750 pr_zoom_sync(pr, pr->zoom, TRUE, FALSE, FALSE, 0, 0);
77
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1751 }
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1752
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1753 gint pixbuf_renderer_get_tiles(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1754 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1755 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1756
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1757 return pr->source_tiles_enabled;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1758 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1759
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1760 static void pr_zoom_adjust_real(PixbufRenderer *pr, gdouble increment,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1761 gint center_point, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1762 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1763 gdouble zoom = pr->zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1764
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1765 if (increment == 0.0) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1766
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1767 if (zoom == 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1768 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1769 if (pr->scale < 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1770 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1771 zoom = 0.0 - 1.0 / pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1772 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1773 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1774 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1775 zoom = pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1776 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1777 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1778
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1779 if (increment < 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1780 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1781 if (zoom >= 1.0 && zoom + increment < 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1782 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1783 zoom = zoom + increment - 2.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1784 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1785 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1786 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1787 zoom = zoom + increment;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1788 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1789 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1790 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1791 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1792 if (zoom <= -1.0 && zoom + increment > -1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1793 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1794 zoom = zoom + increment + 2.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1795 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1796 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1797 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1798 zoom = zoom + increment;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1799 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1800 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1801
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
1802 pr_zoom_sync(pr, zoom, FALSE, FALSE, center_point, x, y);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1803 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1804
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1805 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1806 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1807 * display tiles
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1808 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1809 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1810
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1811 static ImageTile *pr_tile_new(gint x, gint y, gint width, gint height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1812 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1813 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1814
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1815 it = g_new0(ImageTile, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1816
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1817 it->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1818 it->y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1819 it->w = width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1820 it->h = height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1821
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1822 it->render_done = TILE_RENDER_NONE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1823
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1824 return it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1825 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1826
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1827 static void pr_tile_free(ImageTile *it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1828 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1829 if (!it) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1830
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1831 if (it->pixbuf) gdk_pixbuf_unref(it->pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1832 if (it->pixmap) g_object_unref(it->pixmap);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1833
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1834 g_free(it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1835 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1836
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1837 static void pr_tile_free_all(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1838 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1839 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1840
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1841 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1842 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1843 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1844 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1845
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1846 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1847 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1848
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1849 pr_tile_free(it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1850 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1851
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1852 g_list_free(pr->tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1853 pr->tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1854 pr->tile_cache_size = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1855 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1856
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1857 static ImageTile *pr_tile_add(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1858 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1859 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1860
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1861 it = pr_tile_new(x, y, pr->tile_width, pr->tile_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1862
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1863 if (it->x + it->w > pr->width) it->w = pr->width - it->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1864 if (it->y + it->h > pr->height) it->h = pr->height - it->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1865
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1866 pr->tiles = g_list_prepend(pr->tiles, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1867 pr->tile_cache_size += it->size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1868
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1869 return it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1870 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1871
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1872 static void pr_tile_remove(PixbufRenderer *pr, ImageTile *it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1873 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1874 if (it->qd)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1875 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1876 QueueData *qd = it->qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1877
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1878 it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1879 pr->draw_queue = g_list_remove(pr->draw_queue, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1880 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1881 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1882
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1883 if (it->qd2)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1884 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1885 QueueData *qd = it->qd2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1886
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1887 it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1888 pr->draw_queue_2pass = g_list_remove(pr->draw_queue_2pass, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1889 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1890 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1891
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1892 pr->tiles = g_list_remove(pr->tiles, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1893 pr->tile_cache_size -= it->size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1894
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1895 pr_tile_free(it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1896 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1897
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1898 static void pr_tile_free_space(PixbufRenderer *pr, guint space, ImageTile *it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1899 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1900 GList *work;
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 691
diff changeset
1901 guint tile_max;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1902
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1903 work = g_list_last(pr->tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1904
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1905 if (pr->source_tiles_enabled && pr->scale < 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1906 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1907 gint tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1908
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1909 tiles = (pr->vis_width / pr->tile_width + 1) * (pr->vis_height / pr->tile_height + 1);
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1910 tile_max = MAX(tiles * pr->tile_width * pr->tile_height * 3,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1911 (gint)((double)pr->tile_cache_max * 1048576.0 * pr->scale));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1912 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1913 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1914 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1915 tile_max = pr->tile_cache_max * 1048576;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1916 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1917
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1918 while (work && pr->tile_cache_size + space > tile_max)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1919 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1920 ImageTile *needle;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1921
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1922 needle = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1923 work = work->prev;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1924 if (needle != it &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1925 ((!needle->qd && !needle->qd2) || !pr_tile_is_visible(pr, needle))) pr_tile_remove(pr, needle);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1926 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1927 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1928
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1929 static void pr_tile_invalidate_all(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1930 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1931 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1932
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1933 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1934 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1935 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1936 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1937
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1938 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1939 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1940
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1941 it->render_done = TILE_RENDER_NONE;
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
1942 it->render_todo = TILE_RENDER_ALL;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1943 it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1944
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1945 it->w = MIN(pr->tile_width, pr->width - it->x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1946 it->h = MIN(pr->tile_height, pr->height - it->y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1947 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1948 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1949
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1950 static void pr_tile_invalidate_region(PixbufRenderer *pr, gint x, gint y, gint w, gint h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1951 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1952 gint x1, x2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1953 gint y1, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1954 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1955
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1956 x1 = (gint)floor(x / pr->tile_width) * pr->tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1957 x2 = (gint)ceil((x + w) / pr->tile_width) * pr->tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1958
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1959 y1 = (gint)floor(y / pr->tile_height) * pr->tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1960 y2 = (gint)ceil((y + h) / pr->tile_height) * pr->tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1961
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1962 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1963 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1964 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1965 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1966
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1967 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1968 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1969
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1970 if (it->x < x2 && it->x + it->w > x1 &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1971 it->y < y2 && it->y + it->h > y1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1972 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1973 it->render_done = TILE_RENDER_NONE;
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
1974 it->render_todo = TILE_RENDER_ALL;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1975 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1976 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1977 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1978
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
1979 static ImageTile *pr_tile_get(PixbufRenderer *pr, gint x, gint y, gint only_existing)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1980 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1981 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1982
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1983 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1984 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1985 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1986 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1987
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1988 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1989 if (it->x == x && it->y == y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1990 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1991 pr->tiles = g_list_delete_link(pr->tiles, work);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1992 pr->tiles = g_list_prepend(pr->tiles, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1993 return it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1994 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1995
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1996 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1997 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1998
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
1999 if (only_existing) return NULL;
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2000
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2001 return pr_tile_add(pr, x, y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2002 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2003
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2004 static void pr_tile_prepare(PixbufRenderer *pr, ImageTile *it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2005 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2006 if (!it->pixmap)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2007 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2008 GdkPixmap *pixmap;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2009 guint size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2010
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2011 pixmap = gdk_pixmap_new(((GtkWidget *)pr)->window, pr->tile_width, pr->tile_height, -1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2012
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2013 size = pixmap_calc_size(pixmap);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2014 pr_tile_free_space(pr, size, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2015
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2016 it->pixmap = pixmap;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2017 it->size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2018 pr->tile_cache_size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2019 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2020
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2021 if ((pr->zoom != 1.0 || pr->source_tiles_enabled || (pr->pixbuf && gdk_pixbuf_get_has_alpha(pr->pixbuf)) ||
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2022 pr->orientation != EXIF_ORIENTATION_TOP_LEFT || pr->func_post_process) && !it->pixbuf)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2023 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2024 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2025 guint size;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2026 #if 0
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2027 /* I don't think that we need a pixbuf with alpha channel here */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2028 if (pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2029 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2030 pixbuf = gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pr->pixbuf),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2031 gdk_pixbuf_get_has_alpha(pr->pixbuf),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2032 gdk_pixbuf_get_bits_per_sample(pr->pixbuf),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2033 pr->tile_width, pr->tile_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2034 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2035 else
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2036 #endif
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2037 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2038 pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, pr->tile_width, pr->tile_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2039 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2040
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2041 size = gdk_pixbuf_get_rowstride(pixbuf) * pr->tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2042 pr_tile_free_space(pr, size, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2043
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2044 it->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2045 it->size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2046 pr->tile_cache_size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2047 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2048 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2049
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2050 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2051 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2052 * drawing
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2053 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2054 */
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2055
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2056
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2057 static void pr_tile_coords_map_orientation(PixbufRenderer *pr,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2058 double tile_x, double tile_y, /* coordinates of the tile */
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2059 gint image_w, gint image_h,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2060 double tile_w, double tile_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2061 double *res_x, double *res_y)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2062 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2063 *res_x = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2064 *res_y = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2065 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2066 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2067 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2068 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2069 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2070 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2071 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2072 *res_x = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2073 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2074 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2075 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2076 *res_x = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2077 *res_y = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2078 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2079 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2080 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2081 *res_y = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2082 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2083 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2084 *res_x = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2085 *res_y = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2086 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2087 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2088 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2089 *res_x = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2090 *res_y = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2091 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2092 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2093 *res_x = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2094 *res_y = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2095 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2096 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2097 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2098 *res_x = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2099 *res_y = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2100 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2101 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2102 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2103 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2104 }
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
2105 // log_printf("tile coord y:%f, ih:%d, th:%f ry:%f\n", tile_y, image_h, tile_h, *res_x);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2106 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2107
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2108 static void pr_tile_region_map_orientation(PixbufRenderer *pr,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2109 gint area_x, gint area_y, /* coordinates of the area inside tile */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2110 gint tile_w, gint tile_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2111 gint area_w, gint area_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2112 gint *res_x, gint *res_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2113 gint *res_w, gint *res_h)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2114 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2115 *res_x = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2116 *res_y = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2117 *res_w = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2118 *res_h = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2119
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2120 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2121 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2122 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2123 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2124 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2125 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2126 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2127 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2128 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2129 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2130 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2131 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2132 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2133 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2134 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2135 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2136 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2137 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2138 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2139 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2140 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2141 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2142 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2143 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2144 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2145 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2146 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2147 *res_y = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2148 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2149 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2150 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2151 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2152 *res_x = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2153 *res_y = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2154 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2155 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2156 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2157 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2158 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2159 *res_x = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2160 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2161 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2162 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2163 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2164 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2165 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2166 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2167 }
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
2168 // log_printf("inside y:%d, th:%d, ah:%d ry:%d\n", area_y, tile_h, area_h, *res_x);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2169 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2170
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2171 static void pr_coords_map_orientation_reverse(PixbufRenderer *pr,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2172 gint area_x, gint area_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2173 gint tile_w, gint tile_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2174 gint area_w, gint area_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2175 gint *res_x, gint *res_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2176 gint *res_w, gint *res_h)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2177 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2178 *res_x = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2179 *res_y = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2180 *res_w = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2181 *res_h = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2182
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2183 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2184 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2185 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2186 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2187 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2188 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2189 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2190 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2191 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2192 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2193 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2194 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2195 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2196 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2197 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2198 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2199 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2200 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2201 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2202 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2203 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2204 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2205 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2206 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2207 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2208 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2209 *res_x = tile_w - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2210 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2211 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2212 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2213 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2214 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2215 *res_x = tile_w - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2216 *res_y = tile_h - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2217 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2218 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2219 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2220 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2221 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2222 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2223 *res_y = tile_h - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2224 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2225 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2226 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2227 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2228 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2229 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2230 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2231 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2232
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2233
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2234 static GdkPixbuf *pr_get_spare_tile(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2235 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2236 if (!pr->spare_tile) pr->spare_tile = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, pr->tile_width, pr->tile_height);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2237 return pr->spare_tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2238 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2239
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2240 #define COLOR_BYTES 3 /* rgb */
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2241
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2242 static void pr_tile_rotate_90_clockwise(PixbufRenderer *pr, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2243 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2244 GdkPixbuf *src = *tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2245 GdkPixbuf *dest;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2246 gint srs, drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2247 guchar *s_pix, *d_pix;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2248 guchar *sp, *dp;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2249 guchar *ip, *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2250 gint i, j;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2251 gint tw = pr->tile_width;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2252
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2253 srs = gdk_pixbuf_get_rowstride(src);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2254 s_pix = gdk_pixbuf_get_pixels(src);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2255 spi = s_pix + (x * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2256
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2257 dest = pr_get_spare_tile(pr);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2258 drs = gdk_pixbuf_get_rowstride(dest);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2259 d_pix = gdk_pixbuf_get_pixels(dest);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2260 dpi = d_pix + (tw - 1) * COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2261
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2262 for (i = y; i < y + h; i++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2263 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2264 sp = spi + (i * srs);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2265 ip = dpi - (i * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2266 for (j = x; j < x + w; j++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2267 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2268 dp = ip + (j * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2269 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2270 sp += COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2271 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2272 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2273
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2274 pr->spare_tile = src;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2275 *tile = dest;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2276 }
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2277
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2278 static void pr_tile_rotate_90_counter_clockwise(PixbufRenderer *pr, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2279 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2280 GdkPixbuf *src = *tile;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2281 GdkPixbuf *dest;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2282 gint srs, drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2283 guchar *s_pix, *d_pix;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2284 guchar *sp, *dp;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2285 guchar *ip, *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2286 gint i, j;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2287 gint th = pr->tile_height;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2288
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2289 srs = gdk_pixbuf_get_rowstride(src);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2290 s_pix = gdk_pixbuf_get_pixels(src);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2291 spi = s_pix + (x * COLOR_BYTES);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2292
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2293 dest = pr_get_spare_tile(pr);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2294 drs = gdk_pixbuf_get_rowstride(dest);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2295 d_pix = gdk_pixbuf_get_pixels(dest);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2296 dpi = d_pix + (th - 1) * drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2297
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2298 for (i = y; i < y + h; i++)
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2299 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2300 sp = spi + (i * srs);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2301 ip = dpi + (i * COLOR_BYTES);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2302 for (j = x; j < x + w; j++)
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2303 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2304 dp = ip - (j * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2305 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2306 sp += COLOR_BYTES;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2307 }
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2308 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2309
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2310 pr->spare_tile = src;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2311 *tile = dest;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2312 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2313
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2314 static void pr_tile_mirror_only(PixbufRenderer *pr, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2315 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2316 GdkPixbuf *src = *tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2317 GdkPixbuf *dest;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2318 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2319 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2320 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2321 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2322 gint i, j;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2323
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2324 gint tw = pr->tile_width;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2325
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2326 srs = gdk_pixbuf_get_rowstride(src);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2327 s_pix = gdk_pixbuf_get_pixels(src);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2328 spi = s_pix + (x * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2329
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2330 dest = pr_get_spare_tile(pr);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2331 drs = gdk_pixbuf_get_rowstride(dest);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2332 d_pix = gdk_pixbuf_get_pixels(dest);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2333 dpi = d_pix + (tw - x - 1) * COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2334
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2335 for (i = y; i < y + h; i++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2336 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2337 sp = spi + (i * srs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2338 dp = dpi + (i * drs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2339 for (j = 0; j < w; j++)
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2340 {
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2341 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2342 sp += COLOR_BYTES;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2343 dp -= COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2344 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2345 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2346
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2347 pr->spare_tile = src;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2348 *tile = dest;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2349 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2350
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2351 static void pr_tile_mirror_and_flip(PixbufRenderer *pr, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2352 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2353 GdkPixbuf *src = *tile;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2354 GdkPixbuf *dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2355 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2356 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2357 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2358 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2359 gint i, j;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2360 gint tw = pr->tile_width;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2361 gint th = pr->tile_height;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2362
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2363 srs = gdk_pixbuf_get_rowstride(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2364 s_pix = gdk_pixbuf_get_pixels(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2365 spi = s_pix + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2366
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2367 dest = pr_get_spare_tile(pr);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2368 drs = gdk_pixbuf_get_rowstride(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2369 d_pix = gdk_pixbuf_get_pixels(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2370 dpi = d_pix + (th - 1) * drs + (tw - 1) * COLOR_BYTES;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2371
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2372 for (i = y; i < y + h; i++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2373 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2374 sp = s_pix + (i * srs) + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2375 dp = dpi - (i * drs) - (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2376 for (j = 0; j < w; j++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2377 {
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2378 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2379 sp += COLOR_BYTES;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2380 dp -= COLOR_BYTES;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2381 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2382 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2383
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2384 pr->spare_tile = src;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2385 *tile = dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2386 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2387
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2388 static void pr_tile_flip_only(PixbufRenderer *pr, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2389 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2390 GdkPixbuf *src = *tile;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2391 GdkPixbuf *dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2392 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2393 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2394 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2395 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2396 gint i;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2397 gint th = pr->tile_height;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2398
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2399 srs = gdk_pixbuf_get_rowstride(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2400 s_pix = gdk_pixbuf_get_pixels(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2401 spi = s_pix + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2402
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2403 dest = pr_get_spare_tile(pr);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2404 drs = gdk_pixbuf_get_rowstride(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2405 d_pix = gdk_pixbuf_get_pixels(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2406 dpi = d_pix + (th - 1) * drs + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2407
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2408 for (i = y; i < y + h; i++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2409 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2410 sp = spi + (i * srs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2411 dp = dpi - (i * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2412 memcpy(dp, sp, w * COLOR_BYTES);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2413 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2414
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2415 pr->spare_tile = src;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2416 *tile = dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2417 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2418
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2419 static void pr_tile_apply_orientation(PixbufRenderer *pr, GdkPixbuf **pixbuf, gint x, gint y, gint w, gint h)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2420 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2421 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2422 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2423 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2424 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2425 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2426 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2427 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2428 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2429 pr_tile_mirror_only(pr, pixbuf, x, y, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2430 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2431 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2432 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2433 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2434 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2435 pr_tile_mirror_and_flip(pr, pixbuf, x, y, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2436 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2437 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2438 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2439 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2440 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2441 pr_tile_flip_only(pr, pixbuf, x, y, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2442 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2443 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2444 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2445 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2446 pr_tile_flip_only(pr, pixbuf, x, y, w, h);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2447 pr_tile_rotate_90_clockwise(pr, pixbuf, x, pr->tile_height - y - h, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2448 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2449 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2450 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2451 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2452 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2453 pr_tile_rotate_90_clockwise(pr, pixbuf, x, y, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2454 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2455 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2456 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2457 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2458 pr_tile_flip_only(pr, pixbuf, x, y, w, h);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2459 pr_tile_rotate_90_counter_clockwise(pr, pixbuf, x, pr->tile_height - y - h, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2460 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2461 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2462 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2463 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2464 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2465 pr_tile_rotate_90_counter_clockwise(pr, pixbuf, x, y, w, h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2466 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2467 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2468 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2469 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2470 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2471 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2472 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2473
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2474
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2475 static void pr_tile_render(PixbufRenderer *pr, ImageTile *it,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2476 gint x, gint y, gint w, gint h,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2477 gint new_data, gint fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2478 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2479 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2480 gint has_alpha;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2481 gint draw = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2482
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2483 if (it->render_todo == TILE_RENDER_NONE && it->pixmap && !new_data) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2484
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2485 if (it->render_done != TILE_RENDER_ALL)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2486 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2487 x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2488 y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2489 w = it->w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2490 h = it->h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2491 if (!fast) it->render_done = TILE_RENDER_ALL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2492 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2493 else if (it->render_todo != TILE_RENDER_AREA)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2494 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2495 if (!fast) it->render_todo = TILE_RENDER_NONE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2496 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2497 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2498
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2499 if (!fast) it->render_todo = TILE_RENDER_NONE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2500
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2501 if (new_data) it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2502
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2503 pr_tile_prepare(pr, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2504 has_alpha = (pr->pixbuf && gdk_pixbuf_get_has_alpha(pr->pixbuf));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2505
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2506 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2507
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2508 /* FIXME checker colors for alpha should be configurable,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2509 * also should be drawn for blank = TRUE
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2510 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2511
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2512 if (it->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2513 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2514 /* no data, do fast rect fill */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2515 gdk_draw_rectangle(it->pixmap, box->style->black_gc, TRUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2516 0, 0, it->w, it->h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2517 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2518 else if (pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2519 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2520 draw = pr_source_tile_render(pr, it, x, y, w, h, new_data, fast);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2521 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2522 else if (pr->zoom == 1.0 || pr->scale == 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2523 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2524
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2525 double src_x, src_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2526 gint pb_x, pb_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2527 gint pb_w, pb_h;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2528 pr_tile_coords_map_orientation(pr, it->x, it->y,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2529 pr->image_width, pr->image_height,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2530 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2531 &src_x, &src_y);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2532 pr_tile_region_map_orientation(pr, x, y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2533 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2534 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2535 &pb_x, &pb_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2536 &pb_w, &pb_h);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2537
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2538 if (has_alpha)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2539 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2540 gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2541 (double) 0.0 - src_x,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2542 (double) 0.0 - src_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2543 1.0, 1.0, GDK_INTERP_NEAREST,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2544 255, it->x + pb_x, it->y + pb_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2545 PR_ALPHA_CHECK_SIZE, PR_ALPHA_CHECK1, PR_ALPHA_CHECK2);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2546 pr_tile_apply_orientation(pr, &it->pixbuf, pb_x, pb_y, pb_w, pb_h);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2547 draw = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2548 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2549 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2550 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2551
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2552
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2553 if (pr->orientation == EXIF_ORIENTATION_TOP_LEFT && !(pr->func_post_process && !(pr->post_process_slow && fast)))
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2554 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2555 /* faster, simple, base orientation, no postprocessing */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2556 gdk_draw_pixbuf(it->pixmap,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2557 box->style->fg_gc[GTK_WIDGET_STATE(box)],
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2558 pr->pixbuf,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2559 it->x + x, it->y + y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2560 x, y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2561 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2562 pr->dither_quality, it->x + x, it->y + y);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2563 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2564 else
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2565 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2566 gdk_pixbuf_copy_area(pr->pixbuf,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2567 src_x + pb_x, src_y + pb_y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2568 pb_w, pb_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2569 it->pixbuf,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2570 pb_x, pb_y);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2571 pr_tile_apply_orientation(pr, &it->pixbuf, pb_x, pb_y, pb_w, pb_h);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2572 draw = TRUE;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2573 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2574 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2575 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2576 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2577 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2578 double scale_x, scale_y;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2579 double src_x, src_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2580 gint pb_x, pb_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2581 gint pb_w, pb_h;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2582
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2583 if (pr->image_width == 0 || pr->image_height == 0) return;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2584
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2585 scale_x = (double)pr->width / pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2586 scale_y = (double)pr->height / pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2587
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2588 pr_tile_coords_map_orientation(pr, it->x / scale_x, it->y /scale_y ,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2589 pr->image_width, pr->image_height,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2590 pr->tile_width / scale_x , pr->tile_height / scale_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2591 &src_x, &src_y);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2592 pr_tile_region_map_orientation(pr, x, y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2593 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2594 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2595 &pb_x, &pb_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2596 &pb_w, &pb_h);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2597
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2598 /* HACK: The pixbuf scalers get kinda buggy(crash) with extremely
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2599 * small sizes for anything but GDK_INTERP_NEAREST
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2600 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2601 if (pr->width < PR_MIN_SCALE_SIZE || pr->height < PR_MIN_SCALE_SIZE) fast = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2602
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2603 if (!has_alpha)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2604 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2605 gdk_pixbuf_scale(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2606 (double) 0.0 - src_x * scale_x,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2607 (double) 0.0 - src_y * scale_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2608 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2609 (fast) ? GDK_INTERP_NEAREST : pr->zoom_quality);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2610 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2611 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2612 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2613 gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2614 (double) 0.0 - src_x * scale_x,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2615 (double) 0.0 - src_y * scale_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2616 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2617 (fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2618 255, it->x + pb_x, it->y + pb_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2619 PR_ALPHA_CHECK_SIZE, PR_ALPHA_CHECK1, PR_ALPHA_CHECK2);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2620 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2621 pr_tile_apply_orientation(pr, &it->pixbuf, pb_x, pb_y, pb_w, pb_h);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2622 draw = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2623 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2624
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2625 if (draw && it->pixbuf && !it->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2626 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2627
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2628 if (pr->func_post_process && !(pr->post_process_slow && fast))
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2629 pr->func_post_process(pr, &it->pixbuf, x, y, w, h, pr->post_process_user_data);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2630
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2631 gdk_draw_pixbuf(it->pixmap,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2632 box->style->fg_gc[GTK_WIDGET_STATE(box)],
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2633 it->pixbuf,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2634 x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2635 x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2636 w, h,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2637 pr->dither_quality, it->x + x, it->y + y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2638 }
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2639
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2640 #if 0
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2641 /* enable this line for debugging the edges of tiles */
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2642 gdk_draw_rectangle(it->pixmap, box->style->white_gc,
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2643 FALSE, 0, 0, it->w, it->h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2644 gdk_draw_rectangle(it->pixmap, box->style->white_gc,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2645 FALSE, x, y, w, h);
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2646 #endif
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2647 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2648
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2649
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2650 static void pr_tile_expose(PixbufRenderer *pr, ImageTile *it,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2651 gint x, gint y, gint w, gint h,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2652 gint new_data, gint fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2653 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2654 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2655
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2656 pr_tile_render(pr, it, x, y, w, h, new_data, fast);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2657
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2658 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2659
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2660 gdk_draw_drawable(box->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2661 it->pixmap, x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2662 pr->x_offset + (it->x - pr->x_scroll) + x, pr->y_offset + (it->y - pr->y_scroll) + y, w, h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2663
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2664 if (pr->overlay_list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2665 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2666 pr_overlay_draw(pr, pr->x_offset + (it->x - pr->x_scroll) + x,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2667 pr->y_offset + (it->y - pr->y_scroll) + y,
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
2668 w, h,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
2669 it);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2670 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2671 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2672
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2673
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2674 static gint pr_tile_is_visible(PixbufRenderer *pr, ImageTile *it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2675 {
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2676 return (it->x + it->w >= pr->x_scroll && it->x < pr->x_scroll + pr->vis_width &&
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2677 it->y + it->h >= pr->y_scroll && it->y < pr->y_scroll + pr->vis_height);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2678 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2679
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2680 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2681 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2682 * draw queue
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2683 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2684 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2685
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2686 static gint pr_queue_draw_idle_cb(gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2687 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2688 PixbufRenderer *pr = data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2689 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2690 gint fast;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2691
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2692 if ((!pr->pixbuf && !pr->source_tiles_enabled) ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2693 (!pr->draw_queue && !pr->draw_queue_2pass) ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2694 pr->draw_idle_id == -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2695 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
2696 pr_render_complete_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2697
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2698 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2699 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2700 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2701
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2702 if (pr->draw_queue)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2703 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2704 qd = pr->draw_queue->data;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2705 fast = ((pr->zoom_2pass && pr->zoom_quality != GDK_INTERP_NEAREST && pr->scale != 1.0) || pr->post_process_slow);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2706 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2707 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2708 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2709 if (pr->loading)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2710 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2711 /* still loading, wait till done (also drops the higher priority) */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2712
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2713 pr->draw_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2714 pr_queue_draw_idle_cb, pr, NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2715 pr->draw_idle_high = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2716 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2717 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2718
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2719 qd = pr->draw_queue_2pass->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2720 fast = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2721 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2722
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2723 if (GTK_WIDGET_REALIZED(pr))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2724 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2725 if (pr_tile_is_visible(pr, qd->it))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2726 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2727 pr_tile_expose(pr, qd->it, qd->x, qd->y, qd->w, qd->h, qd->new_data, fast);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2728 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2729 else if (qd->new_data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2730 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2731 /* if new pixel data, and we already have a pixmap, update the tile */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2732 qd->it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2733 if (qd->it->pixmap && qd->it->render_done == TILE_RENDER_ALL)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2734 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2735 pr_tile_render(pr, qd->it, qd->x, qd->y, qd->w, qd->h, qd->new_data, fast);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2736 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2737 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2738 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2739
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2740 if (pr->draw_queue)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2741 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2742 qd->it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2743 pr->draw_queue = g_list_remove(pr->draw_queue, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2744 if (fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2745 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2746 if (qd->it->qd2)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2747 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2748 pr_queue_merge(qd->it->qd2, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2749 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2750 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2751 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2752 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2753 qd->it->qd2 = qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2754 pr->draw_queue_2pass = g_list_append(pr->draw_queue_2pass, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2755 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2756 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2757 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2758 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2759 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2760 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2761 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2762 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2763 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2764 qd->it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2765 pr->draw_queue_2pass = g_list_remove(pr->draw_queue_2pass, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2766 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2767 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2768
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2769 if (!pr->draw_queue && !pr->draw_queue_2pass)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2770 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
2771 pr_render_complete_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2772
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2773 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2774 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2775 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2776
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2777 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2778 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2779
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2780 static void pr_queue_list_free(GList *list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2781 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2782 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2783
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2784 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2785 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2786 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2787 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2788
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2789 qd = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2790 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2791
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2792 qd->it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2793 qd->it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2794 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2795 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2796
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2797 g_list_free(list);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2798 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2799
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2800 static void pr_queue_clear(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2801 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2802 pr_queue_list_free(pr->draw_queue);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2803 pr->draw_queue = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2804
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2805 pr_queue_list_free(pr->draw_queue_2pass);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2806 pr->draw_queue_2pass = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2807
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2808 if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2809 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2810 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2811
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2812 static void pr_queue_merge(QueueData *parent, QueueData *qd)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2813 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2814 if (parent->x + parent->w < qd->x + qd->w)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2815 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2816 parent->w += (qd->x + qd->w) - (parent->x + parent->w);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2817 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2818 if (parent->x > qd->x)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2819 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2820 parent->w += parent->x - qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2821 parent->x = qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2822 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2823
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2824 if (parent->y + parent->h < qd->y + qd->h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2825 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2826 parent->h += (qd->y + qd->h) - (parent->y + parent->h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2827 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2828 if (parent->y > qd->y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2829 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2830 parent->h += parent->y - qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2831 parent->y = qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2832 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2833
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2834 parent->new_data |= qd->new_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2835 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2836
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2837 static gint pr_clamp_to_visible(PixbufRenderer *pr, gint *x, gint *y, gint *w, gint *h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2838 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2839 gint nx, ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2840 gint nw, nh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2841 gint vx, vy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2842 gint vw, vh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2843
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2844 vw = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2845 vh = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2846
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2847 vx = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2848 vy = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2849
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2850 if (*x + *w < vx || *x > vx + vw || *y + *h < vy || *y > vy + vh) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2851
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2852 /* now clamp it */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2853 nx = CLAMP(*x, vx, vx + vw);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2854 nw = CLAMP(*w - (nx - *x), 1, vw);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2855
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2856 ny = CLAMP(*y, vy, vy + vh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2857 nh = CLAMP(*h - (ny - *y), 1, vh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2858
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2859 *x = nx;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2860 *y = ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2861 *w = nw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2862 *h = nh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2863
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2864 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2865 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2866
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2867 static gint pr_queue_to_tiles(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2868 gint clamp, ImageTileRenderType render, gint new_data, gint only_existing)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2869 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2870 gint i, j;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2871 gint x1, x2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2872 gint y1, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2873
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2874 if (clamp && !pr_clamp_to_visible(pr, &x, &y, &w, &h)) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2875
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2876 x1 = (gint)floor(x / pr->tile_width) * pr->tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2877 x2 = (gint)ceil((x + w) / pr->tile_width) * pr->tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2878
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2879 y1 = (gint)floor(y / pr->tile_height) * pr->tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2880 y2 = (gint)ceil((y + h) / pr->tile_height) * pr->tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2881
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2882 for (j = y1; j <= y2; j += pr->tile_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2883 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2884 for (i = x1; i <= x2; i += pr->tile_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2885 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2886 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2887
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2888 it = pr_tile_get(pr, i, j,
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2889 (only_existing &&
34
772fe5a509b1 Thu Apr 7 08:42:54 2005 John Ellis <johne@verizon.net>
gqview
parents: 33
diff changeset
2890 (i + pr->tile_width < pr->x_scroll ||
772fe5a509b1 Thu Apr 7 08:42:54 2005 John Ellis <johne@verizon.net>
gqview
parents: 33
diff changeset
2891 i > pr->x_scroll + pr->vis_width ||
772fe5a509b1 Thu Apr 7 08:42:54 2005 John Ellis <johne@verizon.net>
gqview
parents: 33
diff changeset
2892 j + pr->tile_height < pr->y_scroll ||
772fe5a509b1 Thu Apr 7 08:42:54 2005 John Ellis <johne@verizon.net>
gqview
parents: 33
diff changeset
2893 j > pr->y_scroll + pr->vis_height)));
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2894 if (it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2895 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2896 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2897
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2898 if ((render == TILE_RENDER_ALL && it->render_done != TILE_RENDER_ALL) ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2899 (render == TILE_RENDER_AREA && it->render_todo != TILE_RENDER_ALL))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2900 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2901 it->render_todo = render;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2902 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2903
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2904 qd = g_new(QueueData, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2905 qd->it = it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2906 qd->new_data = new_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2907
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2908 if (i < x)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2909 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2910 qd->x = x - i;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2911 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2912 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2913 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2914 qd->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2915 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2916 qd->w = x + w - i - qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2917 if (qd->x + qd->w > pr->tile_width) qd->w = pr->tile_width - qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2918
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2919 if (j < y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2920 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2921 qd->y = y - j;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2922 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2923 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2924 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2925 qd->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2926 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2927 qd->h = y + h - j - qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2928 if (qd->y + qd->h > pr->tile_height) qd->h = pr->tile_height - qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2929
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2930 if (qd->w < 1 || qd->h < 1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2931 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2932 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2933 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2934 else if (it->qd)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2935 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2936 pr_queue_merge(it->qd, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2937 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2938 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2939 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2940 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2941 it->qd = qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2942 pr->draw_queue = g_list_append(pr->draw_queue, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2943 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2944 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2945 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2946 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2947
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2948 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2949 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2950
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2951 static void pr_queue(PixbufRenderer *pr, gint x, gint y, gint w, gint h,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2952 gint clamp, ImageTileRenderType render, gint new_data, gint only_existing)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2953 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2954 gint nx, ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2955
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2956 nx = CLAMP(x, 0, pr->width - 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2957 ny = CLAMP(y, 0, pr->height - 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2958 w -= (nx - x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2959 h -= (ny - y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2960 w = CLAMP(w, 0, pr->width - nx);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2961 h = CLAMP(h, 0, pr->height - ny);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2962 if (w < 1 || h < 1) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2963
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2964 if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data, only_existing) &&
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2965 ((!pr->draw_queue && !pr->draw_queue_2pass) || pr->draw_idle_id == -1 || !pr->draw_idle_high))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2966 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2967 if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2968 pr->draw_idle_id = g_idle_add_full(GDK_PRIORITY_REDRAW,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2969 pr_queue_draw_idle_cb, pr, NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2970 pr->draw_idle_high = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2971 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2972 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2973
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2974 static void pr_redraw(PixbufRenderer *pr, gint new_data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2975 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2976 pr_queue_clear(pr);
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2977 pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, new_data, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2978 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2979
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2980 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2981 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2982 * signal emission
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2983 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2984 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2985
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2986 static void pr_update_signal(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2987 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2988 #if 0
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
2989 log_printf("FIXME: send updated signal\n");
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2990 #endif
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 495
diff changeset
2991 DEBUG_1("%s pixbuf renderer updated - started drawing %p", get_exec_time(), pr);
386
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
2992 pr->debug_updated = TRUE;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2993 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2994
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2995 static void pr_zoom_signal(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2996 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2997 g_signal_emit(pr, signals[SIGNAL_ZOOM], 0, pr->zoom);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2998 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2999
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3000 static void pr_clicked_signal(PixbufRenderer *pr, GdkEventButton *bevent)
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3001 {
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3002 g_signal_emit(pr, signals[SIGNAL_CLICKED], 0, bevent);
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3003 }
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3004
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3005 static void pr_scroll_notify_signal(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3006 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3007 g_signal_emit(pr, signals[SIGNAL_SCROLL_NOTIFY], 0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3008 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3009
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3010 static void pr_render_complete_signal(PixbufRenderer *pr)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3011 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3012 if (!pr->complete)
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3013 {
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3014 g_signal_emit(pr, signals[SIGNAL_RENDER_COMPLETE], 0);
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3015 g_object_set(G_OBJECT(pr), "complete", TRUE, NULL);
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3016 }
386
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3017 if (pr->debug_updated)
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3018 {
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 495
diff changeset
3019 DEBUG_1("%s pixbuf renderer done %p", get_exec_time(), pr);
386
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3020 pr->debug_updated = FALSE;
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3021 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3022 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3023
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3024 static void pr_drag_signal(PixbufRenderer *pr, GdkEventButton *bevent)
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3025 {
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3026 g_signal_emit(pr, signals[SIGNAL_DRAG], 0, bevent);
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3027 }
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3028
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3029 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3030 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3031 * sync and clamp
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3032 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3033 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3034
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3035 static gint pr_scroll_clamp(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3036 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3037 gint old_xs;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3038 gint old_ys;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3039
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3040 if (pr->zoom == 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3041 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3042 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3043 pr->y_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3044
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3045 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3046 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3047
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3048 old_xs = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3049 old_ys = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3050
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3051 if (pr->x_offset > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3052 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3053 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3054 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3055 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3056 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3057 pr->x_scroll = CLAMP(pr->x_scroll, 0, pr->width - pr->vis_width);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3058 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3059
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3060 if (pr->y_offset > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3061 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3062 pr->y_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3063 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3064 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3065 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3066 pr->y_scroll = CLAMP(pr->y_scroll, 0, pr->height - pr->vis_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3067 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3068
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3069 return (old_xs != pr->x_scroll || old_ys != pr->y_scroll);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3070 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3071
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3072 static gint pr_size_clamp(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3073 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3074 gint old_vw, old_vh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3075
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3076 old_vw = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3077 old_vh = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3078
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3079 if (pr->width < pr->window_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3080 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3081 pr->vis_width = pr->width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3082 pr->x_offset = (pr->window_width - pr->width) / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3083 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3084 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3085 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3086 pr->vis_width = pr->window_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3087 pr->x_offset = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3088 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3089
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3090 if (pr->height < pr->window_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3091 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3092 pr->vis_height = pr->height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3093 pr->y_offset = (pr->window_height - pr->height) / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3094 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3095 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3096 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3097 pr->vis_height = pr->window_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3098 pr->y_offset = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3099 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3100
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3101 return (old_vw != pr->vis_width || old_vh != pr->vis_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3102 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3103
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3104 static gint pr_zoom_clamp(PixbufRenderer *pr, gdouble zoom,
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3105 gint force, gint new, gint invalidate,
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3106 gint *redrawn)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3107 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3108 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3109 gdouble scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3110 gint invalid;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3111
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3112 zoom = CLAMP(zoom, pr->zoom_min, pr->zoom_max);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3113
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3114 if (pr->zoom == zoom && !force) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3115
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3116 w = pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3117 h = pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3118
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3119 if (zoom == 0.0 && !pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3120 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3121 scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3122 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3123 else if (zoom == 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3124 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3125 gint max_w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3126 gint max_h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3127 gint sizeable;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3128
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3129 sizeable = (new && pr_parent_window_sizable(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3130
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3131 if (sizeable)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3132 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3133 max_w = gdk_screen_width();
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3134 max_h = gdk_screen_height();
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3135
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3136 if (pr->window_limit)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3137 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3138 max_w = max_w * pr->window_limit_size / 100;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3139 max_h = max_h * pr->window_limit_size / 100;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3140 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3141 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3142 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3143 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3144 max_w = pr->window_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3145 max_h = pr->window_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3146 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3147
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3148 if ((pr->zoom_expand && !sizeable) || w > max_w || h > max_h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3149 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3150 if ((gdouble)max_w / w > (gdouble)max_h / h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3151 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3152 scale = (gdouble)max_h / h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3153 h = max_h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3154 w = w * scale + 0.5;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3155 if (w > max_w) w = max_w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3156 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3157 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3158 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3159 scale = (gdouble)max_w / w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3160 w = max_w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3161 h = h * scale + 0.5;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3162 if (h > max_h) h = max_h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3163 }
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3164
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3165 if (pr->autofit_limit)
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3166 {
336
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3167 gdouble factor = (gdouble)pr->autofit_limit_size / 100;
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3168 w = w * factor + 0.5;
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3169 h = h * factor + 0.5;
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3170 scale = scale * factor;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3171 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3172
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3173 if (w < 1) w = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3174 if (h < 1) h = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3175 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3176 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3177 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3178 scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3179 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3180 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3181 else if (zoom > 0.0) /* zoom orig, in */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3182 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3183 scale = zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3184 w = w * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3185 h = h * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3186 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3187 else /* zoom out */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3188 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3189 scale = 1.0 / (0.0 - zoom);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3190 w = w * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3191 h = h * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3192 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3193
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3194 invalid = (pr->width != w || pr->height != h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3195
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3196 pr->zoom = zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3197 pr->width = w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3198 pr->height = h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3199 pr->scale = scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3200
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3201 if (invalidate || invalid)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3202 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3203 pr_tile_invalidate_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3204 pr_redraw(pr, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3205 }
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3206 if (redrawn) *redrawn = (invalidate || invalid);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3207
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3208 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3209 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3210
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3211 static void pr_zoom_sync(PixbufRenderer *pr, gdouble zoom,
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3212 gint force, gint new,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3213 gint center_point, gint px, gint py)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3214 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3215 gdouble old_scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3216 gint old_cx, old_cy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3217 gint clamped;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3218 gint sized;
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3219 gint redrawn = FALSE;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3220
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3221 old_scale = pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3222 if (center_point)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3223 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3224 px = CLAMP(px, 0, pr->width);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3225 py = CLAMP(py, 0, pr->height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3226 old_cx = pr->x_scroll + (px - pr->x_offset);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3227 old_cy = pr->y_scroll + (py - pr->y_offset);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3228 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3229 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3230 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3231 px = py = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3232 old_cx = pr->x_scroll + pr->vis_width / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3233 old_cy = pr->y_scroll + pr->vis_height / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3234 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3235
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3236 if (!pr_zoom_clamp(pr, zoom, force, new, force, &redrawn)) return;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3237
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3238 clamped = pr_size_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3239 sized = pr_parent_window_resize(pr, pr->width, pr->height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3240
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3241 if (force && new)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3242 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3243 switch (pr->scroll_reset)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3244 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3245 case PR_SCROLL_RESET_NOCHANGE:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3246 /* maintain old scroll position, do nothing */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3247 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3248 case PR_SCROLL_RESET_CENTER:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3249 /* center new image */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3250 pr->x_scroll = ((double)pr->image_width / 2.0 * pr->scale) - pr->vis_width / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3251 pr->y_scroll = ((double)pr->image_height / 2.0 * pr->scale) - pr->vis_height / 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3252 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3253 case PR_SCROLL_RESET_TOPLEFT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3254 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3255 /* reset to upper left */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3256 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3257 pr->y_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3258 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3259 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3260 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3261 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3262 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3263 /* user zoom does not force, so keep visible center point */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3264 if (center_point)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3265 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3266 pr->x_scroll = old_cx / old_scale * pr->scale - (px - pr->x_offset);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3267 pr->y_scroll = old_cy / old_scale * pr->scale - (py - pr->y_offset);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3268 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3269 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3270 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3271 pr->x_scroll = old_cx / old_scale * pr->scale - (pr->vis_width / 2);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3272 pr->y_scroll = old_cy / old_scale * pr->scale - (pr->vis_height / 2);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3273 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3274 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3275
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3276 pr_scroll_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3277
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3278 /* If the window was not sized, redraw the image - we know there will be no size/expose signal.
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3279 * But even if a size is claimed, there is no guarantee that the window manager will allow it,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3280 * so redraw the window anyway :/
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3281 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3282 if (sized || clamped) pr_border_clear(pr);
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3283 pr_redraw(pr, redrawn);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3284
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3285 pr_scroll_notify_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3286 pr_zoom_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3287 pr_update_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3288 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3289
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3290 static void pr_size_sync(PixbufRenderer *pr, gint new_width, gint new_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3291 {
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3292 gint zoom_changed = FALSE;
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3293
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3294 if (pr->window_width == new_width && pr->window_height == new_height) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3295
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3296 pr->window_width = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3297 pr->window_height = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3298
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3299 if (pr->zoom == 0.0)
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3300 {
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3301 gdouble old_scale = pr->scale;
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3302 pr_zoom_clamp(pr, 0.0, TRUE, FALSE, FALSE, NULL);
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3303 zoom_changed = (old_scale != pr->scale);
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3304 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3305
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3306 pr_size_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3307 pr_scroll_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3308
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3309 pr_overlay_update_sizes(pr);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3310
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3311 /* ensure scroller remains visible */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3312 if (pr->scroller_overlay != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3313 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3314 gint update = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3315
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3316 if (pr->scroller_x > new_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3317 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3318 pr->scroller_x = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3319 pr->scroller_xpos = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3320 update = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3321 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3322 if (pr->scroller_y > new_height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3323 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3324 pr->scroller_y = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3325 pr->scroller_ypos = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3326 update = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3327 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3328
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3329 if (update)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3330 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3331 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3332
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3333 if (pixbuf_renderer_overlay_get(pr, pr->scroller_overlay, &pixbuf, NULL, NULL))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3334 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3335 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3336
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3337 w = gdk_pixbuf_get_width(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3338 h = gdk_pixbuf_get_height(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3339 pixbuf_renderer_overlay_set(pr, pr->scroller_overlay, pixbuf,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3340 pr->scroller_x - w / 2, pr->scroller_y - h / 2);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3341 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3342 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3343 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3344
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3345 pr_border_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3346
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3347 pr_scroll_notify_signal(pr);
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3348 if (zoom_changed) pr_zoom_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3349 pr_update_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3350 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3351
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3352 static void pr_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3353 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3354 PixbufRenderer *pr = data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3355
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3356 pr_size_sync(pr, allocation->width, allocation->height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3357 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3358
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3359 static void pixbuf_renderer_paint(PixbufRenderer *pr, GdkRectangle *area)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3360 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3361 gint x, y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3362
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3363 pr_border_draw(pr, area->x, area->y, area->width, area->height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3364
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3365 x = MAX(0, (gint)area->x - pr->x_offset + pr->x_scroll);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3366 y = MAX(0, (gint)area->y - pr->y_offset + pr->y_scroll);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3367
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3368 pr_queue(pr, x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3369 MIN((gint)area->width, pr->width - x),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3370 MIN((gint)area->height, pr->height - y),
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3371 FALSE, TILE_RENDER_ALL, FALSE, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3372 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3373
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3374 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3375 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3376 * scrolling
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3377 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3378 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3379
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3380 void pixbuf_renderer_scroll(PixbufRenderer *pr, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3381 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3382 gint old_x, old_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3383 gint x_off, y_off;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3384 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3385
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3386 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3387
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3388 if (!pr->pixbuf && !pr->source_tiles_enabled) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3389
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3390 old_x = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3391 old_y = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3392
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3393 pr->x_scroll += x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3394 pr->y_scroll += y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3395
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3396 pr_scroll_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3397 if (pr->x_scroll == old_x && pr->y_scroll == old_y) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3398
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3399 pr_scroll_notify_signal(pr);
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3400
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3401 x_off = pr->x_scroll - old_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3402 y_off = pr->y_scroll - old_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3403
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3404 w = pr->vis_width - abs(x_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3405 h = pr->vis_height - abs(y_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3406
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3407 if (w < 1 || h < 1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3408 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3409 /* scrolled completely to new material */
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3410 pr_queue(pr, 0, 0, pr->width, pr->height, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3411 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3412 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3413 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3414 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3415 gint x1, y1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3416 gint x2, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3417 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3418 GdkGC *gc;
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3419 GdkEvent *event;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3420
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3421 if (x_off < 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3422 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3423 x1 = abs(x_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3424 x2 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3425 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3426 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3427 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3428 x1 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3429 x2 = abs(x_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3430 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3431
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3432 if (y_off < 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3433 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3434 y1 = abs(y_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3435 y2 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3436 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3437 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3438 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3439 y1 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3440 y2 = abs(y_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3441 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3442
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3443 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3444
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3445 gc = gdk_gc_new(box->window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3446 gdk_gc_set_exposures(gc, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3447 gdk_draw_drawable(box->window, gc,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3448 box->window,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3449 x2 + pr->x_offset, y2 + pr->y_offset,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3450 x1 + pr->x_offset, y1 + pr->y_offset, w, h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3451 g_object_unref(gc);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3452
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3453 if (pr->overlay_list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3454 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3455 pr_overlay_queue_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3456 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3457
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3458 w = pr->vis_width - w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3459 h = pr->vis_height - h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3460
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3461 if (w > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3462 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3463 pr_queue(pr,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3464 x_off > 0 ? pr->x_scroll + (pr->vis_width - w) : pr->x_scroll, pr->y_scroll,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3465 w, pr->vis_height, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3466 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3467 if (h > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3468 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3469 /* FIXME, to optimize this, remove overlap */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3470 pr_queue(pr,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3471 pr->x_scroll, y_off > 0 ? pr->y_scroll + (pr->vis_height - h) : pr->y_scroll,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3472 pr->vis_width, h, TRUE, TILE_RENDER_ALL, FALSE, FALSE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3473 }
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3474
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3475 /* process exposures here, "expose_event" seems to miss a few with obstructed windows */
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3476 while ((event = gdk_event_get_graphics_expose(box->window)) != NULL)
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3477 {
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3478 pixbuf_renderer_paint(pr, &event->expose.area);
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3479
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3480 if (event->expose.count == 0)
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3481 {
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3482 gdk_event_free(event);
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3483 break;
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3484 }
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3485 gdk_event_free(event);
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3486 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3487 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3488 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3489
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3490 void pixbuf_renderer_scroll_to_point(PixbufRenderer *pr, gint x, gint y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3491 gdouble x_align, gdouble y_align)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3492 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3493 gint px, py;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3494 gint ax, ay;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3495
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3496 x_align = CLAMP(x_align, 0.0, 1.0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3497 y_align = CLAMP(y_align, 0.0, 1.0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3498
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3499 ax = (gdouble)pr->vis_width * x_align;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3500 ay = (gdouble)pr->vis_height * y_align;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3501
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3502 px = (gdouble)x * pr->scale - (pr->x_scroll + ax);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3503 py = (gdouble)y * pr->scale - (pr->y_scroll + ay);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3504
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3505 pixbuf_renderer_scroll(pr, px, py);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3506 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3507
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3508 /* get or set coordinates of viewport center in the image, in range 0.0 - 1.0 */
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3509
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3510 void pixbuf_renderer_get_scroll_center(PixbufRenderer *pr, gdouble *x, gdouble *y)
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3511 {
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3512 gint src_x, src_y;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3513
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3514 src_x = pr->x_scroll + pr->vis_width / 2;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3515 src_y = pr->y_scroll + pr->vis_height / 2;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3516
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3517 *x = (gdouble)src_x / pr->width;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3518 *y = (gdouble)src_y / pr->height;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3519 }
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3520
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3521 void pixbuf_renderer_set_scroll_center(PixbufRenderer *pr, gdouble x, gdouble y)
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3522 {
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3523 gdouble dst_x, dst_y;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3524
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3525 dst_x = x * pr->width - pr->vis_width / 2 - pr->x_scroll + CLAMP(pr->subpixel_x_scroll, -1.0, 1.0);
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3526 dst_y = y * pr->height - pr->vis_height / 2 - pr->y_scroll + CLAMP(pr->subpixel_y_scroll, -1.0, 1.0);
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3527
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3528 pr->subpixel_x_scroll = dst_x - (int)dst_x;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3529 pr->subpixel_y_scroll = dst_y - (int)dst_y;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3530
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3531 pixbuf_renderer_scroll(pr, (int)dst_x, (int)dst_y);
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3532 }
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3533
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3534
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3535 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3536 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3537 * mouse
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3538 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3539 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3540
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3541 static gint pr_mouse_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3542 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3543 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3544 gint accel;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3545
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3546 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3547
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3548 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3549 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3550 pr->scroller_xpos = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3551 pr->scroller_ypos = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3552 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3553
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3554 if (!pr->in_drag || !gdk_pointer_is_grabbed()) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3555
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3556 if (pr->drag_moved < PR_DRAG_SCROLL_THRESHHOLD)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3557 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3558 pr->drag_moved++;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3559 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3560 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3561 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3562 widget_set_cursor(widget, GDK_FLEUR);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3563 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3564
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3565 if (bevent->state & GDK_SHIFT_MASK)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3566 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3567 accel = PR_PAN_SHIFT_MULTIPLIER;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3568 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3569 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3570 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3571 accel = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3572 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3573
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3574 /* do the scroll */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3575 pixbuf_renderer_scroll(pr, (pr->drag_last_x - bevent->x) * accel,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3576 (pr->drag_last_y - bevent->y) * accel);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3577
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3578 pr_drag_signal(pr, bevent);
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3579
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3580 pr->drag_last_x = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3581 pr->drag_last_y = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3582
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3583 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3584 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3585
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3586 static gint pr_mouse_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3587 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3588 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3589 GtkWidget *parent;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3590
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3591 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3592
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3593 if (pr->scroller_id != -1) return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3594
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3595 switch (bevent->button)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3596 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3597 case MOUSE_BUTTON_LEFT:
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3598 pr->in_drag = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3599 pr->drag_last_x = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3600 pr->drag_last_y = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3601 pr->drag_moved = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3602 gdk_pointer_grab(widget->window, FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3603 GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3604 NULL, NULL, bevent->time);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3605 gtk_grab_add(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3606 break;
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3607 case MOUSE_BUTTON_MIDDLE:
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3608 pr->drag_moved = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3609 break;
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3610 case MOUSE_BUTTON_RIGHT:
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3611 pr_clicked_signal(pr, bevent);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3612 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3613 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3614 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3615 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3616
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3617 parent = gtk_widget_get_parent(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3618 if (widget && GTK_WIDGET_CAN_FOCUS(parent))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3619 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3620 gtk_widget_grab_focus(parent);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3621 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3622
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3623 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3624 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3625
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3626 static gint pr_mouse_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3627 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3628 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3629
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3630 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3631
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3632 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3633 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3634 pr_scroller_stop(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3635 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3636 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3637
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3638 if (gdk_pointer_is_grabbed() && GTK_WIDGET_HAS_GRAB(pr))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3639 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3640 gtk_grab_remove(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3641 gdk_pointer_ungrab(bevent->time);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3642 widget_set_cursor(widget, -1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3643 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3644
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3645 if (pr->drag_moved < PR_DRAG_SCROLL_THRESHHOLD)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3646 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3647 if (bevent->button == MOUSE_BUTTON_LEFT && (bevent->state & GDK_SHIFT_MASK))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3648 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3649 pr_scroller_start(pr, bevent->x, bevent->y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3650 }
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3651 else if (bevent->button == MOUSE_BUTTON_LEFT || bevent->button == MOUSE_BUTTON_MIDDLE)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3652 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3653 pr_clicked_signal(pr, bevent);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3654 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3655 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3656
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3657 pr->in_drag = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3658
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3659 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3660 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3661
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3662 static gint pr_mouse_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3663 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3664 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3665
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3666 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3667
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3668 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3669 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3670 pr->scroller_xpos = pr->scroller_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3671 pr->scroller_ypos = pr->scroller_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3672 pr->scroller_xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3673 pr->scroller_yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3674 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3675
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3676 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3677 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3678
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3679 static void pr_mouse_drag_cb(GtkWidget *widget, GdkDragContext *context, gpointer data)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3680 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3681 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3682
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3683 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3684
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3685 pr->drag_moved = PR_DRAG_SCROLL_THRESHHOLD;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3686 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3687
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3688 static void pr_signals_connect(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3689 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3690 g_signal_connect(G_OBJECT(pr), "motion_notify_event",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3691 G_CALLBACK(pr_mouse_motion_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3692 g_signal_connect(G_OBJECT(pr), "button_press_event",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3693 G_CALLBACK(pr_mouse_press_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3694 g_signal_connect(G_OBJECT(pr), "button_release_event",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3695 G_CALLBACK(pr_mouse_release_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3696 g_signal_connect(G_OBJECT(pr), "leave_notify_event",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3697 G_CALLBACK(pr_mouse_leave_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3698
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3699 gtk_widget_set_events(GTK_WIDGET(pr), GDK_POINTER_MOTION_MASK |
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3700 GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK |
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3701 GDK_LEAVE_NOTIFY_MASK);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3702
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3703 g_signal_connect(G_OBJECT(pr), "drag_begin",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3704 G_CALLBACK(pr_mouse_drag_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3705
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3706 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3707
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3708 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3709 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3710 * public
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3711 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3712 */
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3713 static void pr_pixbuf_size_sync(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3714 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3715 if (!pr->pixbuf) return;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3716 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3717 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3718 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3719 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3720 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3721 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3722 pr->image_width = gdk_pixbuf_get_height(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3723 pr->image_height = gdk_pixbuf_get_width(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3724 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3725 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3726 pr->image_width = gdk_pixbuf_get_width(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3727 pr->image_height = gdk_pixbuf_get_height(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3728 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3729 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3730
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3731 static void pr_pixbuf_sync(PixbufRenderer *pr, gdouble zoom)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3732 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3733 if (!pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3734 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3735 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3736
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3737 /* no pixbuf so just clear the window */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3738 pr->image_width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3739 pr->image_height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3740 pr->scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3741
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3742 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3743
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3744 if (GTK_WIDGET_REALIZED(box))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3745 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3746 gdk_window_clear(box->window);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3747 pr_overlay_draw(pr, 0, 0, pr->window_width, pr->window_height, NULL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3748 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3749
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3750 pr_update_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3751
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3752 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3753 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3754
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3755 pr_pixbuf_size_sync(pr);
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3756 pr_zoom_sync(pr, zoom, TRUE, TRUE, FALSE, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3757 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3758
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3759 static void pr_set_pixbuf(PixbufRenderer *pr, GdkPixbuf *pixbuf, gdouble zoom)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3760 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3761 if (pixbuf) g_object_ref(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3762 if (pr->pixbuf) g_object_unref(pr->pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3763 pr->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3764
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3765 pr_pixbuf_sync(pr, zoom);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3766 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3767
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3768 void pixbuf_renderer_set_pixbuf(PixbufRenderer *pr, GdkPixbuf *pixbuf, gdouble zoom)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3769 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3770 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3771
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3772 pr_source_tile_unset(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3773
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3774 pr_set_pixbuf(pr, pixbuf, zoom);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3775
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3776 pr_update_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3777 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3778
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3779 GdkPixbuf *pixbuf_renderer_get_pixbuf(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3780 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3781 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), NULL);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3782
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3783 return pr->pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3784 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3785
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3786 void pixbuf_renderer_set_orientation(PixbufRenderer *pr, gint orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3787 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3788 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3789
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3790 pr->orientation = orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3791
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3792 pr_pixbuf_size_sync(pr);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3793 pr_zoom_sync(pr, pr->zoom, TRUE, FALSE, FALSE, 0, 0);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3794 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3795
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3796 gint pixbuf_renderer_get_orientation(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3797 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3798 if (!pr) return 1;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3799 return pr->orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3800 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3801
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3802 void pixbuf_renderer_set_post_process_func(PixbufRenderer *pr, PixbufRendererPostProcessFunc func, gpointer user_data, gint slow)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3803 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3804 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3805
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3806 pr->func_post_process = func;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3807 pr->post_process_user_data = user_data;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3808 pr->post_process_slow = func && slow;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3809
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3810 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3811
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3812
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3813 void pixbuf_renderer_move(PixbufRenderer *pr, PixbufRenderer *source)
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3814 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3815 GObject *object;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3816 PixbufRendererScrollResetType scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3817
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3818 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3819 g_return_if_fail(IS_PIXBUF_RENDERER(source));
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3820
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3821 if (pr == source) return;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3822
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3823 object = G_OBJECT(pr);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3824
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3825 g_object_set(object, "zoom_min", source->zoom_min, NULL);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3826 g_object_set(object, "zoom_max", source->zoom_max, NULL);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3827 g_object_set(object, "loading", source->loading, NULL);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3828
42
606fcf461a68 Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
gqview
parents: 38
diff changeset
3829 pr->complete = source->complete;
606fcf461a68 Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
gqview
parents: 38
diff changeset
3830
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3831 pr->x_scroll = source->x_scroll;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3832 pr->y_scroll = source->y_scroll;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3833
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3834 scroll_reset = pr->scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3835 pr->scroll_reset = PR_SCROLL_RESET_NOCHANGE;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3836
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3837 pr->func_post_process = source->func_post_process;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3838 pr->post_process_user_data = source->post_process_user_data;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3839 pr->post_process_slow = source->post_process_slow;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3840 pr->orientation = source->orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3841
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3842 if (source->source_tiles_enabled)
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3843 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3844 pr_source_tile_unset(pr);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3845
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3846 pr->source_tiles_enabled = source->source_tiles_enabled;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3847 pr->source_tiles_cache_size = source->source_tiles_cache_size;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3848 pr->source_tile_width = source->source_tile_width;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3849 pr->source_tile_height = source->source_tile_height;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3850 pr->image_width = source->image_width;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3851 pr->image_height = source->image_height;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3852
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3853 pr->func_tile_request = source->func_tile_request;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3854 pr->func_tile_dispose = source->func_tile_dispose;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3855 pr->func_tile_data = source->func_tile_data;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3856
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3857 pr->source_tiles = source->source_tiles;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3858 source->source_tiles = NULL;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3859
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3860 pr_zoom_sync(pr, source->zoom, TRUE, TRUE, FALSE, 0, 0);
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3861 pr_redraw(pr, TRUE);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3862 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3863 else
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3864 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3865 pixbuf_renderer_set_pixbuf(pr, source->pixbuf, source->zoom);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3866 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3867
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3868 pr->scroll_reset = scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3869
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3870 pixbuf_renderer_set_pixbuf(source, NULL, source->zoom);
38
d5f8f8a4d47b Thu Apr 14 04:49:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 36
diff changeset
3871 pr_queue_clear(source);
36
9b01fe7e84d5 Tue Apr 12 07:59:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 34
diff changeset
3872 pr_tile_free_all(source);
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3873 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3874
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3875 void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint src_x, gint src_y, gint src_w, gint src_h)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3876 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3877 gint x, y, width, height, x1, y1, x2, y2;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3878
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3879 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3880
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3881 pr_coords_map_orientation_reverse(pr,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3882 src_x, src_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3883 pr->image_width, pr->image_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3884 src_w, src_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3885 &x, &y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3886 &width, &height);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3887
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3888 if (pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3889 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3890 pr_source_tile_changed(pr, x, y, width, height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3891 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3892
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3893 if (pr->scale != 1.0 && pr->zoom_quality != GDK_INTERP_NEAREST)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3894 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3895 /* increase region when using a zoom quality that may access surrounding pixels */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3896 y -= 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3897 height += 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3898 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3899
26
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
3900 x1 = (gint)floor((double)x * pr->scale);
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
3901 y1 = (gint)floor((double)y * pr->scale);
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
3902 x2 = (gint)ceil((double)(x + width) * pr->scale);
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
3903 y2 = (gint)ceil((double)(y + height) * pr->scale);
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
3904
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3905 pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3906 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3907
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3908 void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3909 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3910 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3911
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3912 pr_zoom_adjust_real(pr, increment, FALSE, 0, 0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3913 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3914
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3915 void pixbuf_renderer_zoom_adjust_at_point(PixbufRenderer *pr, gdouble increment, gint x, gint y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3916 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3917 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3918
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3919 pr_zoom_adjust_real(pr, increment, TRUE, x, y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3920 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3921
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3922 void pixbuf_renderer_zoom_set(PixbufRenderer *pr, gdouble zoom)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3923 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3924 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3925
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3926 pr_zoom_sync(pr, zoom, FALSE, FALSE, FALSE, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3927 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3928
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3929 gdouble pixbuf_renderer_zoom_get(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3930 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3931 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), 1.0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3932
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3933 return pr->zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3934 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3935
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3936 gdouble pixbuf_renderer_zoom_get_scale(PixbufRenderer *pr)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3937 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3938 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), 1.0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3939
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3940 return pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3941 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3942
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3943 void pixbuf_renderer_zoom_set_limits(PixbufRenderer *pr, gdouble min, gdouble max)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3944 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3945 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3946
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3947 if (min > 1.0 || max < 1.0) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3948 if (min < 1.0 && min > -1.0) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3949 if (min < -200.0 || max > 200.0) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3950
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3951 if (pr->zoom_min != min)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3952 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3953 pr->zoom_min = min;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3954 g_object_notify(G_OBJECT(pr), "zoom_min");
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3955 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3956 if (pr->zoom_max != max)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3957 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3958 pr->zoom_max = max;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3959 g_object_notify(G_OBJECT(pr), "zoom_max");
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3960 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3961 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3962
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3963 gint pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3964 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3965 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3966 g_return_val_if_fail(width != NULL && height != NULL, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3967
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3968 if (!pr->pixbuf && !pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3969 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3970 *width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3971 *height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3972 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3973 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3974
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3975 *width = pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3976 *height = pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3977 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3978 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3979
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3980 gint pixbuf_renderer_get_scaled_size(PixbufRenderer *pr, gint *width, gint *height)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3981 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3982 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3983 g_return_val_if_fail(width != NULL && height != NULL, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3984
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3985 if (!pr->pixbuf && !pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3986 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3987 *width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3988 *height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3989 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3990 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3991
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3992 *width = pr->width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3993 *height = pr->height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3994 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3995 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3996
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3997 gint pixbuf_renderer_get_visible_rect(PixbufRenderer *pr, GdkRectangle *rect)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3998 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3999 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4000 g_return_val_if_fail(rect != NULL, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4001
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4002 if ((!pr->pixbuf && !pr->source_tiles_enabled) ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4003 !pr->scale)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4004 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4005 rect->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4006 rect->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4007 rect->width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4008 rect->height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4009 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4010 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4011
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4012 rect->x = (gint)((gdouble)pr->x_scroll / pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4013 rect->y = (gint)((gdouble)pr->y_scroll / pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4014 rect->width = (gint)((gdouble)pr->vis_width / pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4015 rect->height = (gint)((gdouble)pr->vis_height / pr->scale);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4016 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4017 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4018
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4019 gint pixbuf_renderer_get_virtual_rect(PixbufRenderer *pr, GdkRectangle *rect)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4020 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4021 g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4022 g_return_val_if_fail(rect != NULL, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4023
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4024 if ((!pr->pixbuf && !pr->source_tiles_enabled))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4025 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4026 rect->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4027 rect->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4028 rect->width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4029 rect->height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4030 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4031 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4032
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4033 rect->x = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4034 rect->y = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4035 rect->width = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4036 rect->height = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4037 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4038 }