annotate src/pixbuf-renderer.c @ 1374:27ba259d3496

reorder exif pane entries with drag and drop
author nadvornik
date Tue, 03 Mar 2009 23:17:07 +0000
parents 168e5597ddc7
children df58e511d90e
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
1284
8b89e3ff286b Add year 2009 to copyright info everywhere.
zas_
parents: 1055
diff changeset
4 * Copyright (C) 2008 - 2009 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;
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
144
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
145 OverlayRendererFlags flags;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
146 };
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 enum {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
149 SIGNAL_ZOOM = 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
150 SIGNAL_CLICKED,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
151 SIGNAL_SCROLL_NOTIFY,
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
152 SIGNAL_RENDER_COMPLETE,
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
153 SIGNAL_DRAG,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
154 SIGNAL_COUNT
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
155 };
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 enum {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
158 PROP_0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
159 PROP_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
160 PROP_ZOOM_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
161 PROP_ZOOM_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
162 PROP_ZOOM_2PASS,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
163 PROP_ZOOM_EXPAND,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
164 PROP_DITHER_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
165 PROP_SCROLL_RESET,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
166 PROP_DELAY_FLIP,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
167 PROP_LOADING,
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
168 PROP_COMPLETE,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
169 PROP_CACHE_SIZE_DISPLAY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
170 PROP_CACHE_SIZE_TILES,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
171 PROP_WINDOW_FIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
172 PROP_WINDOW_LIMIT,
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
173 PROP_WINDOW_LIMIT_VALUE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
174 PROP_AUTOFIT_LIMIT,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
175 PROP_AUTOFIT_LIMIT_VALUE
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
176 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
177
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
178 typedef enum {
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
179 PR_ZOOM_NONE = 0,
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
180 PR_ZOOM_FORCE = 1 << 0,
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
181 PR_ZOOM_NEW = 1 << 1,
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
182 PR_ZOOM_CENTER = 1 << 2,
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
183 PR_ZOOM_INVALIDATE = 1 << 3,
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
184 PR_ZOOM_LAZY = 1 << 4 /* wait with redraw for pixbuf_renderer_area_changed */
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
185 } PrZoomFlags;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
186
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
187 static guint signals[SIGNAL_COUNT] = { 0 };
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
188 static GtkEventBoxClass *parent_class = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
189
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
190
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
191
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
192 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
193 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
194 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
195 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
196 const GValue *value, GParamSpec *pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
197 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
198 GValue *value, GParamSpec *pspec);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
199 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
200
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
201 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
202
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
203 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
204 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
205 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
206
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
207
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
208 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
209 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
210 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
211 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
212 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
213 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
214 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
215 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
216
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
217 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
218
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
219 static void pr_zoom_sync(PixbufRenderer *pr, gdouble zoom,
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
220 PrZoomFlags flags, gint px, gint py);
23
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 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
223 static void pr_size_cb(GtkWidget *widget, GtkAllocation *allocation, gpointer data);
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
224 static void pr_unmap_cb(GtkWidget *widget, gpointer data);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
225 static void pixbuf_renderer_paint(PixbufRenderer *pr, GdkRectangle *area);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
226 static gint pr_queue_draw_idle_cb(gpointer data);
23
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
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
231 * Pixbuf Renderer object
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
232 *-------------------------------------------------------------------
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
235 GType pixbuf_renderer_get_type(void)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
236 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
237 static GType pixbuf_renderer_type = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
238
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
239 if (!pixbuf_renderer_type)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
240 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
241 static const GTypeInfo pixbuf_renderer_info =
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
242 {
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
243 sizeof(PixbufRendererClass), /* class_size */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
244 NULL, /* base_init */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
245 NULL, /* base_finalize */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
246 (GClassInitFunc)pixbuf_renderer_class_init,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
247 NULL, /* class_finalize */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
248 NULL, /* class_data */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
249 sizeof(PixbufRenderer), /* instance_size */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
250 0, /* n_preallocs */
691
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
251 (GInstanceInitFunc)pixbuf_renderer_init, /* instance_init */
631d626c1f6b Fix some incomplete initialization warnings.
zas_
parents: 673
diff changeset
252 NULL, /* value_table */
23
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 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
256 &pixbuf_renderer_info, 0);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
257 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
258
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
259 return pixbuf_renderer_type;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
260 }
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 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
263 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
264 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
265 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
266
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
267 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
268
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
269 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
270 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
271
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
272 gobject_class->finalize = pixbuf_renderer_finalize;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
273
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
274 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
275
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
276 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
277 PROP_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
278 g_param_spec_double("zoom_min",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
279 "Zoom minimum",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
280 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
281 -1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
282 1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
283 PR_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
284 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
285
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
286 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
287 PROP_ZOOM_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
288 g_param_spec_double("zoom_max",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
289 "Zoom maximum",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
290 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
291 -1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
292 1000.0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
293 PR_ZOOM_MIN,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
294 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
295
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
296 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
297 PROP_ZOOM_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
298 g_param_spec_uint("zoom_quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
299 "Zoom quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
300 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
301 GDK_INTERP_NEAREST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
302 GDK_INTERP_HYPER,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
303 GDK_INTERP_BILINEAR,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
304 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
305
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
306 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
307 PROP_ZOOM_2PASS,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
308 g_param_spec_boolean("zoom_2pass",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
309 "2 pass zoom",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
310 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
311 TRUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
312 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
313
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
314 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
315 PROP_ZOOM_EXPAND,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
316 g_param_spec_boolean("zoom_expand",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
317 "Expand image in autozoom.",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
318 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
319 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
320 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
321
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
322 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
323 PROP_DITHER_QUALITY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
324 g_param_spec_uint("dither_quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
325 "Dither quality",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
326 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
327 GDK_RGB_DITHER_NONE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
328 GDK_RGB_DITHER_MAX,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
329 GDK_RGB_DITHER_NORMAL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
330 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
331
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
332 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
333 PROP_SCROLL_RESET,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
334 g_param_spec_uint("scroll_reset",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
335 "New image scroll reset",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
336 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
337 PR_SCROLL_RESET_TOPLEFT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
338 PR_SCROLL_RESET_NOCHANGE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
339 PR_SCROLL_RESET_TOPLEFT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
340 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
341
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
342 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
343 PROP_DELAY_FLIP,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
344 g_param_spec_boolean("delay_flip",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
345 "Delay image update",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
346 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
347 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
348 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
349
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
350 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
351 PROP_LOADING,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
352 g_param_spec_boolean("loading",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
353 "Image actively loading",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
354 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
355 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
356 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
357
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
358 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
359 PROP_COMPLETE,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
360 g_param_spec_boolean("complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
361 "Image rendering complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
362 NULL,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
363 FALSE,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
364 G_PARAM_READABLE | G_PARAM_WRITABLE));
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
365
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
366 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
367 PROP_CACHE_SIZE_DISPLAY,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
368 g_param_spec_uint("cache_display",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
369 "Display cache size MB",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
370 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
371 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
372 128,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
373 PR_CACHE_SIZE_DEFAULT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
374 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
375
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
376 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
377 PROP_CACHE_SIZE_TILES,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
378 g_param_spec_uint("cache_tiles",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
379 "Tile cache count",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
380 "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
381 0,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
382 256,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
383 PR_CACHE_SIZE_DEFAULT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
384 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
385
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
386 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
387 PROP_WINDOW_FIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
388 g_param_spec_boolean("window_fit",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
389 "Fit window to image size",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
390 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
391 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
392 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
393
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
394 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
395 PROP_WINDOW_LIMIT,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
396 g_param_spec_boolean("window_limit",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
397 "Limit size of parent window",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
398 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
399 FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
400 G_PARAM_READABLE | G_PARAM_WRITABLE));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
401
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
402 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
403 PROP_WINDOW_LIMIT_VALUE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
404 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
405 "Size limit of parent window",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
406 NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
407 10,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
408 150,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
409 100,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
410 G_PARAM_READABLE | G_PARAM_WRITABLE));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
411
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
412 g_object_class_install_property(gobject_class,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
413 PROP_AUTOFIT_LIMIT,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
414 g_param_spec_boolean("autofit_limit",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
415 "Limit size of image when autofitting",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
416 NULL,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
417 FALSE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
418 G_PARAM_READABLE | G_PARAM_WRITABLE));
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
419
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
420 g_object_class_install_property(gobject_class,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
421 PROP_AUTOFIT_LIMIT_VALUE,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
422 g_param_spec_uint("autofit_limit_value",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
423 "Size limit of image when autofitting",
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
424 NULL,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
425 10,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
426 150,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
427 100,
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
428 G_PARAM_READABLE | G_PARAM_WRITABLE));
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
429
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
430
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
431 signals[SIGNAL_ZOOM] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
432 g_signal_new("zoom",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
433 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
434 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
435 G_STRUCT_OFFSET(PixbufRendererClass, zoom),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
436 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
437 g_cclosure_marshal_VOID__DOUBLE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
438 G_TYPE_NONE, 1,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
439 G_TYPE_DOUBLE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
440
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
441 signals[SIGNAL_CLICKED] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
442 g_signal_new("clicked",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
443 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
444 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
445 G_STRUCT_OFFSET(PixbufRendererClass, clicked),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
446 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
447 g_cclosure_marshal_VOID__BOXED,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
448 G_TYPE_NONE, 1,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
449 GDK_TYPE_EVENT);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
450
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
451 signals[SIGNAL_SCROLL_NOTIFY] =
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
452 g_signal_new("scroll-notify",
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
453 G_OBJECT_CLASS_TYPE(gobject_class),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
454 G_SIGNAL_RUN_LAST,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
455 G_STRUCT_OFFSET(PixbufRendererClass, scroll_notify),
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
456 NULL, NULL,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
457 g_cclosure_marshal_VOID__VOID,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
458 G_TYPE_NONE, 0);
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
459
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
460 signals[SIGNAL_RENDER_COMPLETE] =
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
461 g_signal_new("render-complete",
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
462 G_OBJECT_CLASS_TYPE(gobject_class),
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
463 G_SIGNAL_RUN_LAST,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
464 G_STRUCT_OFFSET(PixbufRendererClass, render_complete),
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
465 NULL, NULL,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
466 g_cclosure_marshal_VOID__VOID,
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
467 G_TYPE_NONE, 0);
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
468
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
469 signals[SIGNAL_DRAG] =
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
470 g_signal_new("drag",
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
471 G_OBJECT_CLASS_TYPE(gobject_class),
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
472 G_SIGNAL_RUN_LAST,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
473 G_STRUCT_OFFSET(PixbufRendererClass, drag),
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
474 NULL, NULL,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
475 g_cclosure_marshal_VOID__BOXED,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
476 G_TYPE_NONE, 1,
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
477 GDK_TYPE_EVENT);
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
480 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
481 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
482 GtkWidget *box;
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 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
485
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
486 pr->zoom_min = PR_ZOOM_MIN;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
487 pr->zoom_max = PR_ZOOM_MAX;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
488 pr->zoom_quality = GDK_INTERP_BILINEAR;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
489 pr->zoom_2pass = FALSE;
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->zoom = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
492 pr->scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
493
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
494 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
495
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
496 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
497
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
498 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
499
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
500 pr->tile_width = PR_TILE_SIZE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
501 pr->tile_height = PR_TILE_SIZE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
502
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
503 pr->tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
504 pr->tile_cache_size = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
505
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
506 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
507
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
508 pr->scroller_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
509 pr->scroller_overlay = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
510
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
511 pr->source_tiles_enabled = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
512 pr->source_tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
513
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
514 pr->orientation = 1;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
515
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
516 pr->norm_center_x = 0.5;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
517 pr->norm_center_y = 0.5;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
518
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
519 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
520 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
521 G_CALLBACK(pr_size_cb), pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
522
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
523 g_signal_connect(G_OBJECT(pr), "unmap",
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
524 G_CALLBACK(pr_unmap_cb), pr);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
525
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
526 pr_signals_connect(pr);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
529 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
530 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
531 PixbufRenderer *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 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
534
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
535 pr_queue_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
536 pr_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
537
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1037
diff changeset
538
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
539 if (pr->pixbuf) g_object_unref(pr->pixbuf);
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1037
diff changeset
540 if (pr->spare_tile) g_object_unref(pr->spare_tile);
23
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 pr_scroller_timer_set(pr, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
543 pr_overlay_list_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
544
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
545 pr_source_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
546 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
547
1001
d22e21bfd2a3 Consistency: type * instead of type*.
zas_
parents: 1000
diff changeset
548 PixbufRenderer *pixbuf_renderer_new(void)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
549 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
550 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
551 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
552
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
553 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
554 const GValue *value, GParamSpec *pspec)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
555 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
556 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
557
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
558 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
559
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
560 switch (prop_id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
561 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
562 case PROP_ZOOM_MIN:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
563 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
564 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
565 case PROP_ZOOM_MAX:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
566 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
567 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
568 case PROP_ZOOM_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
569 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
570 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
571 case PROP_ZOOM_2PASS:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
572 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
573 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
574 case PROP_ZOOM_EXPAND:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
575 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
576 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
577 case PROP_DITHER_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
578 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
579 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
580 case PROP_SCROLL_RESET:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
581 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
582 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
583 case PROP_DELAY_FLIP:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
584 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
585 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
586 case PROP_LOADING:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
587 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
588 break;
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
589 case PROP_COMPLETE:
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
590 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
591 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
592 case PROP_CACHE_SIZE_DISPLAY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
593 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
594 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
595 case PROP_CACHE_SIZE_TILES:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
596 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
597 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
598 case PROP_WINDOW_FIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
599 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
600 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
601 case PROP_WINDOW_LIMIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
602 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
603 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
604 case PROP_WINDOW_LIMIT_VALUE:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
605 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
606 break;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
607 case PROP_AUTOFIT_LIMIT:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
608 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
609 break;
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
610 case PROP_AUTOFIT_LIMIT_VALUE:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
611 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
612 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
613 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
614 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
615 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
616 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
617 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
618
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
619 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
620 GValue *value, GParamSpec *pspec)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
621 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
622 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
623
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
624 pr = PIXBUF_RENDERER(object);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
625
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
626 switch (prop_id)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
627 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
628 case PROP_ZOOM_MIN:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
629 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
630 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
631 case PROP_ZOOM_MAX:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
632 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
633 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
634 case PROP_ZOOM_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
635 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
636 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
637 case PROP_ZOOM_2PASS:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
638 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
639 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
640 case PROP_ZOOM_EXPAND:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
641 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
642 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
643 case PROP_DITHER_QUALITY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
644 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
645 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
646 case PROP_SCROLL_RESET:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
647 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
648 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
649 case PROP_DELAY_FLIP:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
650 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
651 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
652 case PROP_LOADING:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
653 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
654 break;
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
655 case PROP_COMPLETE:
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
656 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
657 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
658 case PROP_CACHE_SIZE_DISPLAY:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
659 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
660 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
661 case PROP_CACHE_SIZE_TILES:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
662 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
663 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
664 case PROP_WINDOW_FIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
665 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
666 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
667 case PROP_WINDOW_LIMIT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
668 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
669 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
670 case PROP_WINDOW_LIMIT_VALUE:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
671 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
672 break;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
673 case PROP_AUTOFIT_LIMIT:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
674 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
675 break;
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
676 case PROP_AUTOFIT_LIMIT_VALUE:
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
677 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
678 break;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
679 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
680 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
681 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
682 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
683 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
684
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
685 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
686 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
687 if (GTK_WIDGET_DRAWABLE(widget))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
688 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
689 if (!GTK_WIDGET_NO_WINDOW(widget))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
690 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
691 if (event->window != widget->window)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
692 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
693 GdkRectangle area;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
694
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
695 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
696
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
697 area.x += event->area.x;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
698 area.y += event->area.y;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
699 area.width = event->area.width;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
700 area.height = event->area.height;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
701 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
702 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
703 else
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
704 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
705 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
706 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
707 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
710 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
711 }
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 /*
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 * misc utilities
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
716 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
717 */
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 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
720 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
721 GdkCursor *cursor;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
722
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
723 if (!widget->window) return;
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 if (icon == -1)
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 cursor = NULL;
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
730 {
513
985fdfebd89e Remove whitespace between function name and first parenthesis for the sake of consistency. (pass 2)
zas_
parents: 512
diff changeset
731 cursor = gdk_cursor_new(icon);
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
734 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
735
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
736 if (cursor) gdk_cursor_unref(cursor);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
739 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
740 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
741 gint w, h, d;
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 d = gdk_drawable_get_depth(pixmap);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
744 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
745 return w * h * (d / 8);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
746 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
747
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
748 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
749 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
750 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
751 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
752 if (clip_x + clip_w <= x ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
753 clip_x >= x + w ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
754 clip_y + clip_h <= y ||
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
755 clip_y >= y + h)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
756 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
757 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
758 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
759
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
760 *rx = MAX(x, clip_x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
761 *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
762
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
763 *ry = MAX(y, clip_y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
764 *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
765
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
766 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
767 }
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 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
770 {
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
771 GdkWindowState state;
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
772
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
773 if (!pr->parent_window) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
774 if (!pr->window_fit) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
775 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
776
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
777 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
778 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
779 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
780
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
781 return TRUE;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
784 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
785 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
786 GtkWidget *widget;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
787 GtkWidget *parent;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
788 gint ww, wh;
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 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
791
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
792 if (pr->window_limit)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
793 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
794 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
795 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
796
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
797 if (w > sw) w = sw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
798 if (h > sh) h = sh;
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 widget = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
802 parent = GTK_WIDGET(pr->parent_window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
803
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
804 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
805 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
806
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
807 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
808 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
809
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
810 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
811
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
812 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
813 }
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 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
816 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
817 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
818 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
819
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
820 pr->parent_window = GTK_WIDGET(window);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
823 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
824 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
825 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
826
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
827 return GTK_WINDOW(pr->parent_window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
828 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
829
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
830
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
831 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
832 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
833 * overlays
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
834 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
835 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
836
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
837 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
838 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
839 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
840 gint px, py, pw, ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
841
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
842 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
843 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
844 px = od->x;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
845 py = od->y;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
846
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
847 if (od->flags & OVL_RELATIVE)
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
848 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
849 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
850 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
851 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
852
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
853 if (x) *x = px;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
854 if (y) *y = py;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
855 if (w) *w = pw;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
856 if (h) *h = ph;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
857 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
858
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
859 static void pr_overlay_init_window(PixbufRenderer *pr, OverlayData *od)
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
860 {
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
861 gint px, py, pw, ph;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
862 GdkWindowAttr attributes;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
863 gint attributes_mask;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
864
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
865 pr_overlay_get_position(pr, od, &px, &py, &pw, &ph);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
866
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
867 attributes.window_type = GDK_WINDOW_CHILD;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
868 attributes.wclass = GDK_INPUT_OUTPUT;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
869 attributes.width = pw;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
870 attributes.height = ph;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
871 attributes.event_mask = GDK_EXPOSURE_MASK;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
872 attributes_mask = 0;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
873
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
874 od->window = gdk_window_new(GTK_WIDGET(pr)->window, &attributes, attributes_mask);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
875 gdk_window_set_user_data(od->window, pr);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
876 gdk_window_move(od->window, px, py);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
877 gdk_window_show(od->window);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
878 }
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
879
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
880 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
881 ImageTile *it)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
882 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
883 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
884 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
885
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
886 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
887
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
888 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
889 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
890 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
891 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
892 gint px, py, pw, ph;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
893 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
894
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
895 od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
896 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
897
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
898 if (!od->window) pr_overlay_init_window(pr, od);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
899
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
900 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
901 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
902 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
903 if (!pr->overlay_buffer)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
904 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
905 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
906 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
907
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
908 if (it)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
909 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
910 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
911 it->pixmap,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
912 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
913 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
914 0, 0, rw, rh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
915 gdk_draw_pixbuf(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
916 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
917 od->pixbuf,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
918 rx - px, ry - py,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
919 0, 0, rw, rh,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
920 pr->dither_quality, rx, ry);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
921 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
922 pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
923 0, 0,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
924 rx - px, ry - py, rw, rh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
925 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
926 else
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
927 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
928 /* 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
929 gint sx, sy;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
930
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
931 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
932 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
933 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
934 gint sw, sh;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
935
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
936 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
937 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
938
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
939 gdk_draw_rectangle(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
940 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
941 0, 0, sw, sh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
942 gdk_draw_pixbuf(pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
943 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
944 od->pixbuf,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
945 sx - px, sy - py,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
946 0, 0, sw, sh,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
947 pr->dither_quality, sx, sy);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
948 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
949 pr->overlay_buffer,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
950 0, 0,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
951 sx - px, sy - py, sw, sh);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
952 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
953 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
954 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
955 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
956 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
957
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
958 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
959 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
960 gint x, y, w, h;
104
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);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
963 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
964 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
965 w, h,
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
966 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
967
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
968 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
969 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
970
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
971 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
972 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
973 GList *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 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
976 while (work)
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 OverlayData *od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
979 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
980
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
981 pr_overlay_queue_draw(pr, od);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
982 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
983 }
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
984
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
985 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
986 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
987 GList *work;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
988
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
989 work = pr->overlay_list;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
990 while (work)
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
991 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
992 OverlayData *od = work->data;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
993 work = work->next;
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
994
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
995 if (!od->window) pr_overlay_init_window(pr, od);
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
996
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
997 if (od->flags & OVL_RELATIVE)
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
998 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
999 gint x, y, w, h;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1000
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1001 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
1002 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
1003 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1004 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1005 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1006
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1007 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
1008 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1009 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1010
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1011 work = pr->overlay_list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1012 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1013 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1014 OverlayData *od = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1015 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1016
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1017 if (od->id == id) return od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1018 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1019
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1020 return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1021 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1022
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1023
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1024 gint pixbuf_renderer_overlay_add(PixbufRenderer *pr, GdkPixbuf *pixbuf, gint x, gint y,
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
1025 OverlayRendererFlags flags)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1026 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1027 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1028 gint id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1029
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1030 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
1031 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
1032
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1033 id = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1034 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
1035
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1036 od = g_new0(OverlayData, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1037 od->id = id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1038 od->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1039 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
1040 od->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1041 od->y = y;
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
1042 od->flags = flags;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1043
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1044 pr_overlay_init_window(pr, od);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1045
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1046 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
1047
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1048 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
1049
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1050 return od->id;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1051 }
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 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
1054 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1055 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
1056
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1057 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
1058 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
1059 g_free(od);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1060
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1061 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
1062 {
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1063 g_object_unref(pr->overlay_buffer);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1064 pr->overlay_buffer = NULL;
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1065 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1066 }
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 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
1069 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1070 while (pr->overlay_list)
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 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1073
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1074 od = pr->overlay_list->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1075 pr_overlay_free(pr, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1076 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1077 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1078
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1079 static void pr_overlay_list_reset_window(PixbufRenderer *pr)
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1080 {
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1081 GList *work;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1082
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1083 if (pr->overlay_buffer) g_object_unref(pr->overlay_buffer);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1084 pr->overlay_buffer = NULL;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1085
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1086 work = pr->overlay_list;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1087 while (work)
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1088 {
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1089 OverlayData *od = work->data;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1090 work = work->next;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1091 if (od->window) gdk_window_destroy(od->window);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1092 od->window = NULL;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1093 }
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1094 }
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1095
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1096 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
1097 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1098 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1099
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1100 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
1101
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1102 od = pr_overlay_find(pr, id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1103 if (!od) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1104
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1105 if (pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1106 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1107 gint px, py, pw, ph;
23
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 g_object_ref(G_OBJECT(pixbuf));
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1110 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
1111 od->pixbuf = pixbuf;
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 od->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1114 od->y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1115
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1116 pr_overlay_queue_draw(pr, od);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1117 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
1118 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
1119 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1120 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1121 {
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
1122 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
1123 pr_overlay_free(pr, od);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1124 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1127 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
1128 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1129 OverlayData *od;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1130
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1131 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
1132
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1133 od = pr_overlay_find(pr, id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1134 if (!od) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1135
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1136 if (pixbuf) *pixbuf = od->pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1137 if (x) *x = od->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1138 if (y) *y = od->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1139
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1140 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1141 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1142
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1143 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
1144 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1145 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
1146 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1147
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1148 static void pr_unmap_cb(GtkWidget *widget, gpointer data)
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1149 {
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1150 PixbufRenderer *pr = data;
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1151 pr_overlay_list_reset_window(pr);
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1152 }
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1153
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
1154
23
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1157 * scroller overlay
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1158 *-------------------------------------------------------------------
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
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 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
1163 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1164 PixbufRenderer *pr = data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1165 gint x, y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1166 gint xinc, yinc;
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 /* 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
1169 * 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
1170 */
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 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
1173 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1174 x = 0;
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 else
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 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
1179 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
1180 x += (x > 0) ? -shift : shift;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1183 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
1184 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1185 y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1186 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1187 else
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 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
1190 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
1191 y += (y > 0) ? -shift : shift;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1194 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
1195 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1196 xinc = x;
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 else
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 xinc = pr->scroller_xinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1201
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1202 if (x >= 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1203 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1204 if (xinc < 0) xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1205 if (x < xinc) xinc = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1206 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
1207 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1208 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1209 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1210 if (xinc > 0) xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1211 if (x > xinc) xinc = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1212 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
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 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
1217 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1218 yinc = y;
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1221 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1222 yinc = pr->scroller_yinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1223
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1224 if (y >= 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1225 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1226 if (yinc < 0) yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1227 if (y < yinc) yinc = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1228 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
1229 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1230 else
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 if (yinc > 0) yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1233 if (y > yinc) yinc = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1234 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
1235 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1236 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1237
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1238 pr->scroller_xinc = xinc;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1239 pr->scroller_yinc = yinc;
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 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
1242 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
1243
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1244 pixbuf_renderer_scroll(pr, xinc, yinc);
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 return TRUE;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1249 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
1250 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1251 if (pr->scroller_id != -1)
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 g_source_remove(pr->scroller_id);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1254 pr->scroller_id = -1;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1257 if (start)
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 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
1260 pr_scroller_update_cb, pr);
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 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1263
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1264 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
1265 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1266 if (pr->scroller_overlay == -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1267 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1268 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1269 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1270
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 209
diff changeset
1271 #ifdef GQ_BUILD
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1272 pixbuf = pixbuf_inline(PIXBUF_INLINE_SCROLLER);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1273 #else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1274 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
1275 gdk_pixbuf_fill(pixbuf, 0x000000ff);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1276 #endif
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1277 w = gdk_pixbuf_get_width(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1278 h = gdk_pixbuf_get_height(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1279
857
7d387a25b1ec Use flags instead of int parameters for pixbuf_renderer_overlay_add().
zas_
parents: 856
diff changeset
1280 pr->scroller_overlay = pixbuf_renderer_overlay_add(pr, pixbuf, x - w / 2, y - h / 2, OVL_NORMAL);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1281 g_object_unref(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1282 }
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 pr->scroller_x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1285 pr->scroller_y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1286 pr->scroller_xpos = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1287 pr->scroller_ypos = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1288
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1289 pr_scroller_timer_set(pr, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1290 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1291
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1292 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
1293 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1294 if (pr->scroller_id == -1) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1295
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1296 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
1297 pr->scroller_overlay = -1;
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 pr_scroller_timer_set(pr, FALSE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1300 }
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1304 * borders
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1305 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1306 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1307
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1308 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
1309 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1310 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1311 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1312
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1313 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1314
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1315 if (!box->window) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1316
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1317 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
1318 {
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1319 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
1320 0, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1321 pr->window_width, pr->window_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1322 &rx, &ry, &rw, &rh))
23
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 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
1325 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
1326 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1327 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1328 }
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 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
1331 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1332 if (pr->x_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1333 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
1334 0, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1335 pr->x_offset, pr->window_height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1336 &rx, &ry, &rw, &rh))
23
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 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
1339 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
1340 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1341 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
1342 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
1343 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
1344 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
1345 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1346 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1347 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
1348 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
1349 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1350 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1351 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
1352 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1353 if (pr->y_offset > 0 &&
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1354 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
1355 pr->x_offset, 0,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1356 pr->vis_width, pr->y_offset,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1357 &rx, &ry, &rw, &rh))
23
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 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
1360 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
1361 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1362 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
1363 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
1364 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
1365 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
1366 &rx, &ry, &rw, &rh))
23
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 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
1369 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
1370 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1371 }
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_border_clear(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 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
1377 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1378
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1379 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
1380 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1381 GtkStyle *style;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1382 GtkWidget *widget;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1383
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1384 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
1385
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1386 widget = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1387
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1388 if (color) {
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1389 GdkColor *slot;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1390
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1391 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
1392 slot = &style->bg[GTK_STATE_NORMAL];
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1393
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1394 slot->red = color->red;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1395 slot->green = color->green;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1396 slot->blue = color->blue;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1397 }
208
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1398 else {
fa0e05f985c3 set user-defined color as image background - patch by Laurent MONIN
nadvornik
parents: 196
diff changeset
1399 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
1400 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1401
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1402 gtk_widget_set_style(widget, style);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1403
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1404 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
1405 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1406
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1407
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1408 /*
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 * source tiles
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1411 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1412 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1413
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1414 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
1415 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1416 if (!st) return;
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 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
1419 g_free(st);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1422 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
1423 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1424 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1425
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1426 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1427 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1428 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1429 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1430
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1431 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1432 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1433
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1434 pr_source_tile_free(st);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1435 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1436
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1437 g_list_free(pr->source_tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1438 pr->source_tiles = NULL;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1441 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
1442 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1443 pr_source_tile_free_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1444 pr->source_tiles_enabled = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1445 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1446
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1447 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
1448 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1449 gint x1, y1, x2, y2;
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 if (!st) return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1452
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1453 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
1454 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
1455 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
1456 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
1457
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1458 return !((gdouble)st->x * pr->scale > (gdouble)x2 ||
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1459 (gdouble)(st->x + pr->source_tile_width) * pr->scale < (gdouble)x1 ||
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1460 (gdouble)st->y * pr->scale > (gdouble)y2 ||
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1461 (gdouble)(st->y + pr->source_tile_height) * pr->scale < (gdouble)y1);
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1464 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
1465 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1466 SourceTile *st = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1467 gint count;
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 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
1470
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1471 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
1472
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1473 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
1474 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
1475 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1476 GList *work;
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 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
1479 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
1480 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1481 SourceTile *needle;
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 needle = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1484 work = work->prev;
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_source_tile_visible(pr, needle))
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1487 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1488 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
1489
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1490 if (pr->func_tile_dispose)
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 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
1493 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
1494 needle->pixbuf, pr->func_tile_data);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1497 if (!st)
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 st = needle;
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 else
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 pr_source_tile_free(needle);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1504 }
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 count--;
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 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1509 }
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 (!st)
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 st = g_new0(SourceTile, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1514 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
1515 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
1516 }
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 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
1519 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
1520 st->blank = TRUE;
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 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
1523
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1524 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1525 }
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 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
1528 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1529 SourceTile *st;
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 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
1532 if (!st) return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1533
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1534 if (pr->func_tile_request &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1535 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
1536 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
1537 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1538 st->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1539 }
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 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
1542 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
1543
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1544 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1545 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1546
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1547 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
1548 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1549 GList *work;
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 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1552 while (work)
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 SourceTile *st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1555
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1556 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
1557 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
1558 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1559 if (work != pr->source_tiles)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1560 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1561 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
1562 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
1563 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1564 return st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1565 }
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 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1568 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1569
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1570 return NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1571 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1572
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1573 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
1574 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1575 gint x1, y1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1576 GList *list = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1577 gint sx, sy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1578
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1579 if (x < 0) x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1580 if (y < 0) y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1581 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
1582 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
1583
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1584 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
1585 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
1586
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1587 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
1588 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1589 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
1590 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1591 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1592
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1593 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
1594 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
1595
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1596 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
1597 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1600 return g_list_reverse(list);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1601 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1602
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1603 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
1604 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1605 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1606
95
eb9bb29cbd65 Fri Nov 3 11:40:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 87
diff changeset
1607 if (width < 1 || height < 1) return;
eb9bb29cbd65 Fri Nov 3 11:40:48 2006 John Ellis <johne@verizon.net>
gqview
parents: 87
diff changeset
1608
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1609 work = pr->source_tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1610 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1611 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1612 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1613 gint rx, ry, rw, rh;
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 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1616 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1617
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1618 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
1619 x, y, width, height,
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1620 &rx, &ry, &rw, &rh))
23
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 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1623
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1624 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
1625 if (pr->func_tile_request &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1626 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
1627 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1628 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
1629 rw * pr->scale, rh * pr->scale);
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 g_object_unref(pixbuf);
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 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1636 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
1637 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
1638 gint new_data, gint fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1639 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1640 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1641 GList *list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1642 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1643 gint draw = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1644
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1645 box = GTK_WIDGET(pr);
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->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
1648 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1649 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
1650 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1651 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1652 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1653 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1654 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1655
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1656 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1657 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1658
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1659 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
1660 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
1661 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1662 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1663 if (st->blank)
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 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
1666 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
1667 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1668 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
1669 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1670 gdk_draw_pixbuf(it->pixmap,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1671 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
1672 st->pixbuf,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1673 rx - st->x, ry - st->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1674 rx - it->x, ry - it->y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1675 rw, rh,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1676 pr->dither_quality, rx, ry);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1677 }
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 }
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1682 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1683 gdouble scale_x, scale_y;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1684 gint sx, sy, sw, sh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1685
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1686 if (pr->image_width == 0 || pr->image_height == 0) return FALSE;
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1687 scale_x = (gdouble)pr->width / pr->image_width;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1688 scale_y = (gdouble)pr->height / pr->image_height;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1689
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1690 sx = (gdouble)(it->x + x) / scale_x;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1691 sy = (gdouble)(it->y + y) / scale_y;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1692 sw = (gdouble)w / scale_x;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1693 sh = (gdouble)h / scale_y;
23
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 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
1696
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1697 #if 0
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1698 /* 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
1699 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
1700 #endif
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1701
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1702 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
1703 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1704 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1705 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1706 SourceTile *st;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1707 gint rx, ry, rw, rh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1708 gint stx, sty, stw, sth;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1709
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1710 st = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1711 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1712
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1713 stx = floor((gdouble)st->x * scale_x);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1714 sty = floor((gdouble)st->y * scale_y);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1715 stw = ceil((gdouble)(st->x + pr->source_tile_width) * scale_x) - stx;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1716 sth = ceil((gdouble)(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
1717
33
a41ecbb26a96 Wed Apr 6 06:41:25 2005 John Ellis <johne@verizon.net>
gqview
parents: 32
diff changeset
1718 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
1719 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
1720 &rx, &ry, &rw, &rh))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1721 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1722 if (st->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1723 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1724 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
1725 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
1726 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1727 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1728 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1729 gdouble offset_x;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1730 gdouble offset_y;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1731
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1732 /* may need to use unfloored stx,sty values here */
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1733 offset_x = (gdouble)(stx - it->x);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1734 offset_y = (gdouble)(sty - it->y);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1735
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1736 gdk_pixbuf_scale(st->pixbuf, it->pixbuf, rx - it->x, ry - it->y, rw, rh,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1737 (gdouble) 0.0 + offset_x,
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1738 (gdouble) 0.0 + offset_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1739 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1740 (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
1741 draw = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1742 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1743 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1744 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1745 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1746
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1747 g_list_free(list);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1748
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1749 return draw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1750 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1751
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1752 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
1753 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
1754 PixbufRendererTileRequestFunc func_request,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1755 PixbufRendererTileDisposeFunc func_dispose,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1756 gpointer user_data,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1757 gdouble zoom)
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 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
1760 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
1761 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
1762 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
1763
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1764 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
1765 pr->pixbuf = NULL;
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 pr_source_tile_unset(pr);
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 (cache_size < 4) cache_size = 4;
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 pr->source_tiles_enabled = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1772 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
1773 pr->source_tile_width = tile_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1774 pr->source_tile_height = tile_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1775
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1776 pr->image_width = width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1777 pr->image_height = height;
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 pr->func_tile_request = func_request;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1780 pr->func_tile_dispose = func_dispose;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1781 pr->func_tile_data = user_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1782
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
1783 pr_zoom_sync(pr, zoom, PR_ZOOM_FORCE | PR_ZOOM_NEW, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1784 pr_redraw(pr, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1785 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1786
77
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1787 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
1788 {
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1789 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
1790 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
1791
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1792 if (!pr->source_tiles_enabled) return;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1793 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
1794
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1795 pr->image_width = width;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1796 pr->image_height = height;
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1797
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
1798 pr_zoom_sync(pr, pr->zoom, PR_ZOOM_FORCE, 0, 0);
77
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1799 }
44f2223541d1 Sun Oct 15 10:45:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 61
diff changeset
1800
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1801 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
1802 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1803 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
1804
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1805 return pr->source_tiles_enabled;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1808 static void pr_zoom_adjust_real(PixbufRenderer *pr, gdouble increment,
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
1809 PrZoomFlags flags, gint x, gint y)
23
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 gdouble zoom = pr->zoom;
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 if (increment == 0.0) return;
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 if (zoom == 0.0)
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 if (pr->scale < 1.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1818 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1819 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
1820 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1821 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1822 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1823 zoom = pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1824 }
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 if (increment < 0.0)
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 (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
1830 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1831 zoom = zoom + increment - 2.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1832 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1833 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1834 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1835 zoom = zoom + increment;
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 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1838 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1839 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1840 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
1841 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1842 zoom = zoom + increment + 2.0;
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 else
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 zoom = zoom + increment;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1847 }
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
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
1850 pr_zoom_sync(pr, zoom, flags, x, y);
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1853 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1854 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1855 * display tiles
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 */
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 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
1860 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1861 ImageTile *it;
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 it = g_new0(ImageTile, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1864
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1865 it->x = x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1866 it->y = y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1867 it->w = width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1868 it->h = height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1869
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1870 it->render_done = TILE_RENDER_NONE;
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 return 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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1875 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
1876 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1877 if (!it) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1878
1043
5fc64d6252e7 Replaced gtk depreceated code.
bruclik
parents: 1037
diff changeset
1879 if (it->pixbuf) g_object_unref(it->pixbuf);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1880 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
1881
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1882 g_free(it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1883 }
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 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
1886 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1887 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1888
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1889 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1890 while (work)
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 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1893
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1894 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1895 work = work->next;
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 pr_tile_free(it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1898 }
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 g_list_free(pr->tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1901 pr->tiles = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1902 pr->tile_cache_size = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1903 }
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 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
1906 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1907 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1908
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1909 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
1910
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1911 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
1912 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
1913
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1914 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
1915 pr->tile_cache_size += it->size;
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 return it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1918 }
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 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
1921 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1922 if (it->qd)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1923 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1924 QueueData *qd = it->qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1925
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1926 it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1927 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
1928 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1929 }
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 if (it->qd2)
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 QueueData *qd = it->qd2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1934
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1935 it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1936 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
1937 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1938 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1939
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1940 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
1941 pr->tile_cache_size -= it->size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1942
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1943 pr_tile_free(it);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1946 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
1947 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1948 GList *work;
736
a7289f9e8d29 Fix signed vs unsigned warnings.
zas_
parents: 691
diff changeset
1949 guint tile_max;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1950
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1951 work = g_list_last(pr->tiles);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1952
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1953 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
1954 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1955 gint tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1956
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
1957 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
1958 tile_max = MAX(tiles * pr->tile_width * pr->tile_height * 3,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
1959 (gint)((gdouble)pr->tile_cache_max * 1048576.0 * pr->scale));
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1960 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1961 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1962 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1963 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
1964 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1965
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1966 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
1967 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1968 ImageTile *needle;
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 needle = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1971 work = work->prev;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1972 if (needle != it &&
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1973 ((!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
1974 }
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 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
1978 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1979 GList *work;
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 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1982 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1983 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1984 ImageTile *it;
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 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1987 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1988
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1989 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
1990 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
1991 it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1992
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1993 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
1994 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
1995 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
1996 }
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 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
1999 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2000 gint x1, x2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2001 gint y1, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2002 GList *work;
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 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
2005 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
2006
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2007 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
2008 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
2009
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2010 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2011 while (work)
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 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2014
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2015 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2016 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2017
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2018 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
2019 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
2020 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2021 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
2022 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
2023 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2024 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2025 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2026
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2027 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
2028 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2029 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2030
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2031 work = pr->tiles;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2032 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2033 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2034 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2035
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2036 it = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2037 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
2038 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2039 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
2040 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
2041 return it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2042 }
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 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2045 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2046
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2047 if (only_existing) return NULL;
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
2048
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2049 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
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 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
2053 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2054 if (!it->pixmap)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2055 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2056 GdkPixmap *pixmap;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2057 guint size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2058
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2059 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
2060
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2061 size = pixmap_calc_size(pixmap);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2062 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
2063
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2064 it->pixmap = pixmap;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2065 it->size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2066 pr->tile_cache_size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2067 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2068
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2069 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
2070 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
2071 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2072 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2073 guint size;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2074 #if 0
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2075 /* 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
2076 if (pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2077 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2078 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
2079 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
2080 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
2081 pr->tile_width, pr->tile_height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2082 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2083 else
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2084 #endif
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2085 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2086 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
2087 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2088
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2089 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
2090 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
2091
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2092 it->pixbuf = pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2093 it->size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2094 pr->tile_cache_size += size;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2095 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2096 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2097
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2098 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2099 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2100 * drawing
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2101 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2102 */
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2103
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2104
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2105 static void pr_tile_coords_map_orientation(PixbufRenderer *pr,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2106 gdouble tile_x, gdouble tile_y, /* coordinates of the tile */
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2107 gint image_w, gint image_h,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2108 gdouble tile_w, gdouble tile_h,
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2109 gdouble *res_x, gdouble *res_y)
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2110 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2111 *res_x = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2112 *res_y = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2113 switch (pr->orientation)
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 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2116 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2117 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2118 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2119 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2120 *res_x = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2121 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2122 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2123 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2124 *res_x = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2125 *res_y = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2126 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2127 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2128 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2129 *res_y = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2130 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2131 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2132 *res_x = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2133 *res_y = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2134 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2135 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2136 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2137 *res_x = tile_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2138 *res_y = image_w - tile_x - tile_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2139 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2140 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2141 *res_x = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2142 *res_y = image_w - tile_x - tile_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_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2145 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2146 *res_x = image_h - tile_y - tile_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2147 *res_y = tile_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2148 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2149 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2150 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2151 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2152 }
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
2153 // 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
2154 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2155
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2156 static void pr_tile_region_map_orientation(PixbufRenderer *pr,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2157 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
2158 gint tile_w, gint tile_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2159 gint area_w, gint area_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2160 gint *res_x, gint *res_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2161 gint *res_w, gint *res_h)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2162 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2163 *res_x = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2164 *res_y = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2165 *res_w = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2166 *res_h = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2167
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2168 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2169 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2170 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2171 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2172 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2173 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2174 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2175 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2176 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2177 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2178 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2179 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2180 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2181 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2182 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2183 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2184 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2185 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2186 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2187 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2188 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2189 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2190 *res_h = 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_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2193 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2194 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2195 *res_y = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2196 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2197 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2198 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2199 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2200 *res_x = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2201 *res_y = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2202 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2203 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2204 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2205 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2206 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2207 *res_x = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2208 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2209 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2210 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2211 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2212 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2213 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2214 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2215 }
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
2216 // 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
2217 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2218
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2219 static void pr_coords_map_orientation_reverse(PixbufRenderer *pr,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2220 gint area_x, gint area_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2221 gint tile_w, gint tile_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2222 gint area_w, gint area_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2223 gint *res_x, gint *res_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2224 gint *res_w, gint *res_h)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2225 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2226 *res_x = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2227 *res_y = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2228 *res_w = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2229 *res_h = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2230
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2231 switch (pr->orientation)
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 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2234 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2235 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2236 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2237 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2238 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2239 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2240 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2241 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2242 *res_x = tile_w - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2243 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2244 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2245 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2246 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2247 *res_y = tile_h - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2248 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2249 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2250 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2251 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2252 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2253 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2254 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2255 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2256 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2257 *res_x = tile_w - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2258 *res_y = area_x;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2259 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2260 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2261 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2262 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2263 *res_x = tile_w - area_y - area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2264 *res_y = tile_h - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2265 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2266 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2267 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2268 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2269 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2270 *res_x = area_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2271 *res_y = tile_h - area_x - area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2272 *res_w = area_h;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2273 *res_h = area_w;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2274 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2275 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2276 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2277 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2278 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2279 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2280
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2281
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2282 static GdkPixbuf *pr_get_spare_tile(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2283 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2284 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
2285 return pr->spare_tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2286 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2287
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2288 #define COLOR_BYTES 3 /* rgb */
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2289
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2290 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
2291 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2292 GdkPixbuf *src = *tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2293 GdkPixbuf *dest;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2294 gint srs, drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2295 guchar *s_pix, *d_pix;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2296 guchar *sp, *dp;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2297 guchar *ip, *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2298 gint i, j;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2299 gint tw = pr->tile_width;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2300
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2301 srs = gdk_pixbuf_get_rowstride(src);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2302 s_pix = gdk_pixbuf_get_pixels(src);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2303 spi = s_pix + (x * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2304
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2305 dest = pr_get_spare_tile(pr);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2306 drs = gdk_pixbuf_get_rowstride(dest);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2307 d_pix = gdk_pixbuf_get_pixels(dest);
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2308 dpi = d_pix + (tw - 1) * COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2309
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2310 for (i = y; i < y + h; i++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2311 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2312 sp = spi + (i * srs);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2313 ip = dpi - (i * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2314 for (j = x; j < x + w; j++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2315 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2316 dp = ip + (j * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2317 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2318 sp += COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2319 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2320 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2321
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2322 pr->spare_tile = src;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2323 *tile = dest;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2324 }
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2325
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2326 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
2327 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2328 GdkPixbuf *src = *tile;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2329 GdkPixbuf *dest;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2330 gint srs, drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2331 guchar *s_pix, *d_pix;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2332 guchar *sp, *dp;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2333 guchar *ip, *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2334 gint i, j;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2335 gint th = pr->tile_height;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2336
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2337 srs = gdk_pixbuf_get_rowstride(src);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2338 s_pix = gdk_pixbuf_get_pixels(src);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2339 spi = s_pix + (x * COLOR_BYTES);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2340
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2341 dest = pr_get_spare_tile(pr);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2342 drs = gdk_pixbuf_get_rowstride(dest);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2343 d_pix = gdk_pixbuf_get_pixels(dest);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2344 dpi = d_pix + (th - 1) * drs;
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2345
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2346 for (i = y; i < y + h; i++)
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2347 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2348 sp = spi + (i * srs);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2349 ip = dpi + (i * COLOR_BYTES);
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2350 for (j = x; j < x + w; j++)
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2351 {
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2352 dp = ip - (j * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2353 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2354 sp += COLOR_BYTES;
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2355 }
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2356 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2357
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2358 pr->spare_tile = src;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2359 *tile = dest;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2360 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2361
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2362 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
2363 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2364 GdkPixbuf *src = *tile;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2365 GdkPixbuf *dest;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2366 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2367 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2368 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2369 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2370 gint i, j;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2371
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2372 gint tw = pr->tile_width;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2373
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2374 srs = gdk_pixbuf_get_rowstride(src);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2375 s_pix = gdk_pixbuf_get_pixels(src);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2376 spi = s_pix + (x * COLOR_BYTES);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2377
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2378 dest = pr_get_spare_tile(pr);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2379 drs = gdk_pixbuf_get_rowstride(dest);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2380 d_pix = gdk_pixbuf_get_pixels(dest);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2381 dpi = d_pix + (tw - x - 1) * COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2382
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2383 for (i = y; i < y + h; i++)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2384 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2385 sp = spi + (i * srs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2386 dp = dpi + (i * drs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2387 for (j = 0; j < w; j++)
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2388 {
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2389 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2390 sp += COLOR_BYTES;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2391 dp -= COLOR_BYTES;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2392 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2393 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2394
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2395 pr->spare_tile = src;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2396 *tile = dest;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2397 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2398
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2399 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
2400 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2401 GdkPixbuf *src = *tile;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2402 GdkPixbuf *dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2403 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2404 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2405 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2406 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2407 gint i, j;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2408 gint tw = pr->tile_width;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2409 gint th = pr->tile_height;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2410
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2411 srs = gdk_pixbuf_get_rowstride(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2412 s_pix = gdk_pixbuf_get_pixels(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2413 spi = s_pix + (x * COLOR_BYTES);
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 dest = pr_get_spare_tile(pr);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2416 drs = gdk_pixbuf_get_rowstride(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2417 d_pix = gdk_pixbuf_get_pixels(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2418 dpi = d_pix + (th - 1) * drs + (tw - 1) * COLOR_BYTES;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2419
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2420 for (i = y; i < y + h; i++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2421 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2422 sp = s_pix + (i * srs) + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2423 dp = dpi - (i * drs) - (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2424 for (j = 0; j < w; j++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2425 {
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2426 memcpy(dp, sp, COLOR_BYTES);
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2427 sp += COLOR_BYTES;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2428 dp -= COLOR_BYTES;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2429 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2430 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2431
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2432 pr->spare_tile = src;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2433 *tile = dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2434 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2435
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2436 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
2437 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2438 GdkPixbuf *src = *tile;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2439 GdkPixbuf *dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2440 gint srs, drs;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2441 guchar *s_pix, *d_pix;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2442 guchar *sp, *dp;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2443 guchar *spi, *dpi;
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2444 gint i;
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2445 gint th = pr->tile_height;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2446
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2447 srs = gdk_pixbuf_get_rowstride(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2448 s_pix = gdk_pixbuf_get_pixels(src);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2449 spi = s_pix + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2450
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2451 dest = pr_get_spare_tile(pr);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2452 drs = gdk_pixbuf_get_rowstride(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2453 d_pix = gdk_pixbuf_get_pixels(dest);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2454 dpi = d_pix + (th - 1) * drs + (x * COLOR_BYTES);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2455
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2456 for (i = y; i < y + h; i++)
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2457 {
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2458 sp = spi + (i * srs);
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2459 dp = dpi - (i * drs);
409
319cd8857399 replace inner loops with memcpy
nadvornik
parents: 408
diff changeset
2460 memcpy(dp, sp, w * COLOR_BYTES);
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2461 }
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2462
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2463 pr->spare_tile = src;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2464 *tile = dest;
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2465 }
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 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
2468 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2469 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2470 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2471 case EXIF_ORIENTATION_TOP_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2472 /* normal -- nothing to do */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2473 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2474 case EXIF_ORIENTATION_TOP_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2475 /* mirrored */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2476 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2477 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
2478 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2479 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2480 case EXIF_ORIENTATION_BOTTOM_RIGHT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2481 /* upside down */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2482 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2483 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
2484 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2485 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2486 case EXIF_ORIENTATION_BOTTOM_LEFT:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2487 /* flipped */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2488 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2489 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
2490 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2491 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2492 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2493 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2494 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
2495 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
2496 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2497 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2498 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2499 /* rotated -90 (270) */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2500 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2501 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
2502 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2503 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2504 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2505 {
408
fcba18ac1551 Explode pr_tile_mirror() in three optimized functions:
zas_
parents: 404
diff changeset
2506 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
2507 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
2508 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2509 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2510 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2511 /* rotated 90 */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2512 {
404
d9afd1636ed8 Explode pr_tile_rotate_90() in two functions:
zas_
parents: 398
diff changeset
2513 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
2514 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2515 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2516 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2517 /* The other values are out of range */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2518 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2519 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2520 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2521
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2522
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2523 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
2524 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
2525 gint new_data, gint fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2526 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2527 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2528 gint has_alpha;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2529 gint draw = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2530
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2531 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
2532
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2533 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
2534 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2535 x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2536 y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2537 w = it->w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2538 h = it->h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2539 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
2540 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2541 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
2542 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2543 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
2544 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2545 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2546
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2547 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
2548
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2549 if (new_data) it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2550
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2551 pr_tile_prepare(pr, it);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2552 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
2553
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2554 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2555
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2556 /* 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
2557 * 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
2558 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2559
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2560 if (it->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2561 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2562 /* no data, do fast rect fill */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2563 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
2564 0, 0, it->w, it->h);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2565 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2566 else if (pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2567 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2568 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
2569 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2570 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
2571 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2572
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2573 gdouble src_x, src_y;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2574 gint pb_x, pb_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2575 gint pb_w, pb_h;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2576 pr_tile_coords_map_orientation(pr, it->x, it->y,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2577 pr->image_width, pr->image_height,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2578 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2579 &src_x, &src_y);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2580 pr_tile_region_map_orientation(pr, x, y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2581 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2582 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2583 &pb_x, &pb_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2584 &pb_w, &pb_h);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2585
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2586 if (has_alpha)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2587 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2588 gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2589 (gdouble) 0.0 - src_x,
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2590 (gdouble) 0.0 - src_y,
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2591 1.0, 1.0, GDK_INTERP_NEAREST,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2592 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
2593 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
2594 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
2595 draw = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2596 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2597 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2598 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2599
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2600
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2601 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
2602 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2603 /* faster, simple, base orientation, no postprocessing */
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2604 gdk_draw_pixbuf(it->pixmap,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2605 box->style->fg_gc[GTK_WIDGET_STATE(box)],
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2606 pr->pixbuf,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2607 it->x + x, it->y + y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2608 x, y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2609 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2610 pr->dither_quality, it->x + x, it->y + y);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2611 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2612 else
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2613 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2614 gdk_pixbuf_copy_area(pr->pixbuf,
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2615 src_x + pb_x, src_y + pb_y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2616 pb_w, pb_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2617 it->pixbuf,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2618 pb_x, pb_y);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2619 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
2620 draw = TRUE;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2621 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2622 }
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2625 {
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2626 gdouble scale_x, scale_y;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2627 gdouble src_x, src_y;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2628 gint pb_x, pb_y;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2629 gint pb_w, pb_h;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2630
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2631 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
2632
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2633 scale_x = (gdouble)pr->width / pr->image_width;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2634 scale_y = (gdouble)pr->height / pr->image_height;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2635
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2636 pr_tile_coords_map_orientation(pr, it->x / scale_x, it->y /scale_y ,
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2637 pr->image_width, pr->image_height,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2638 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
2639 &src_x, &src_y);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2640 pr_tile_region_map_orientation(pr, x, y,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2641 pr->tile_width, pr->tile_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2642 w, h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2643 &pb_x, &pb_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2644 &pb_w, &pb_h);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2645
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2646 /* 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
2647 * 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
2648 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2649 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
2650
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2651 if (!has_alpha)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2652 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2653 gdk_pixbuf_scale(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2654 (gdouble) 0.0 - src_x * scale_x,
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2655 (gdouble) 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
2656 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2657 (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
2658 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2659 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2660 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2661 gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2662 (gdouble) 0.0 - src_x * scale_x,
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
2663 (gdouble) 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
2664 scale_x, scale_y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2665 (fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2666 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
2667 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
2668 }
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2669 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
2670 draw = TRUE;
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 if (draw && it->pixbuf && !it->blank)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2674 {
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
2675
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2676 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
2677 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
2678
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2679 gdk_draw_pixbuf(it->pixmap,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2680 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
2681 it->pixbuf,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2682 x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2683 x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2684 w, h,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2685 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
2686 }
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2687
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2688 #if 0
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2689 /* 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
2690 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
2691 FALSE, 0, 0, it->w, it->h);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2692 gdk_draw_rectangle(it->pixmap, box->style->white_gc,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2693 FALSE, x, y, w, h);
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
2694 #endif
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2695 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2696
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 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
2699 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
2700 gint new_data, gint fast)
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 GtkWidget *box;
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 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
2705
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2706 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2707
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2708 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
2709 it->pixmap, x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2710 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
2711
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2712 if (pr->overlay_list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2713 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2714 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
2715 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
2716 w, h,
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
2717 it);
23
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 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2720
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 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
2723 {
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2724 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
2725 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
2726 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2727
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2730 * draw queue
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2731 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2732 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2733
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2734 static gint pr_get_queued_area(GList *work)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2735 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2736 gint area = 0;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2737
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2738 while (work)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2739 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2740 QueueData *qd = work->data;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2741 area += qd->w * qd->h;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2742 work = work->next;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2743 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2744 return area;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2745 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2746
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2747
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2748 static gint pr_queue_schedule_next_draw(PixbufRenderer *pr, gboolean force_set)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2749 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2750 gfloat percent;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2751 gint visible_area = pr->vis_width * pr->vis_height;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2752
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2753 if (!pr->loading)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2754 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2755 /* 2pass prio */
1035
04a8e8a26fff Improve debug messages.
zas_
parents: 1033
diff changeset
2756 DEBUG_2("redraw priority: 2pass");
1033
8db1017c4ca0 adjusted redraw priority relative to icon drawing
nadvornik
parents: 1030
diff changeset
2757 pr->draw_idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, pr_queue_draw_idle_cb, pr, NULL);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2758 return FALSE;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2759 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2760
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2761 if (visible_area == 0)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2762 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2763 /* not known yet */
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2764 percent = 100.0;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2765 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2766 else
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2767 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2768 percent = 100.0 * pr_get_queued_area(pr->draw_queue) / visible_area;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2769 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2770
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2771 if (percent > 10.0)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2772 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2773 /* we have enough data for starting intensive redrawing */
1035
04a8e8a26fff Improve debug messages.
zas_
parents: 1033
diff changeset
2774 DEBUG_2("redraw priority: high %.2f %%", percent);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2775 pr->draw_idle_id = g_idle_add_full(GDK_PRIORITY_REDRAW, pr_queue_draw_idle_cb, pr, NULL);
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2776 return FALSE;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2777 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2778
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2779 if (percent < 1.0 || force_set)
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2780 {
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2781 /* queue is (almost) empty, wait 50 ms*/
1035
04a8e8a26fff Improve debug messages.
zas_
parents: 1033
diff changeset
2782 DEBUG_2("redraw priority: wait %.2f %%", percent);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2783 pr->draw_idle_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, 50, pr_queue_draw_idle_cb, pr, NULL);
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2784 return FALSE;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2785 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2786
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2787 /* keep the same priority as before */
1035
04a8e8a26fff Improve debug messages.
zas_
parents: 1033
diff changeset
2788 DEBUG_2("redraw priority: no change %.2f %%", percent);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2789 return TRUE;
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2790 }
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2791
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2792
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2793 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
2794 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2795 PixbufRenderer *pr = data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2796 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2797 gint fast;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2798
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2799
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2800 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
2801 (!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
2802 pr->draw_idle_id == -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2803 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
2804 pr_render_complete_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2805
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2806 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2807 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2808 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2809
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2810 if (pr->draw_queue)
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 qd = pr->draw_queue->data;
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
2813 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
2814 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2815 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2816 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2817 if (pr->loading)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2818 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2819 /* 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
2820
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2821 return pr_queue_schedule_next_draw(pr, FALSE);
23
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 qd = pr->draw_queue_2pass->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2825 fast = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2826 }
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 (GTK_WIDGET_REALIZED(pr))
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 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
2831 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2832 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
2833 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2834 else if (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 /* 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
2837 qd->it->blank = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2838 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
2839 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2840 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
2841 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2842 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2845 if (pr->draw_queue)
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 qd->it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2848 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
2849 if (fast)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2850 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2851 if (qd->it->qd2)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2852 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2853 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
2854 g_free(qd);
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2857 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2858 qd->it->qd2 = qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2859 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
2860 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2861 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2862 else
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 g_free(qd);
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2868 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2869 qd->it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2870 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
2871 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2872 }
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 (!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
2875 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
2876 pr_render_complete_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2877
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2878 pr->draw_idle_id = -1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2879 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2880 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2881
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
2882 return pr_queue_schedule_next_draw(pr, FALSE);
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2885 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
2886 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2887 GList *work;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2888
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2889 work = list;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2890 while (work)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2891 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2892 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2893
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2894 qd = work->data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2895 work = work->next;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2896
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2897 qd->it->qd = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2898 qd->it->qd2 = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2899 g_free(qd);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2902 g_list_free(list);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2905 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
2906 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2907 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
2908 pr->draw_queue = NULL;
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 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
2911 pr->draw_queue_2pass = NULL;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2912
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2913 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
2914 pr->draw_idle_id = -1;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2917 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
2918 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2919 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
2920 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2921 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
2922 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2923 if (parent->x > qd->x)
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 parent->w += parent->x - qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2926 parent->x = qd->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2927 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2928
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2929 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
2930 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2931 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
2932 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2933 if (parent->y > qd->y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2934 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2935 parent->h += parent->y - qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2936 parent->y = qd->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2937 }
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 parent->new_data |= qd->new_data;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2942 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
2943 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2944 gint nx, ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2945 gint nw, nh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2946 gint vx, vy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2947 gint vw, vh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2948
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2949 vw = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2950 vh = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2951
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2952 vx = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2953 vy = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2954
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2955 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
2956
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2957 /* now clamp it */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2958 nx = CLAMP(*x, vx, vx + vw);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2959 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
2960
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2961 ny = CLAMP(*y, vy, vy + vh);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2962 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
2963
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2964 *x = nx;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2965 *y = ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2966 *w = nw;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2967 *h = nh;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2968
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2969 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2970 }
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 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
2973 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
2974 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2975 gint i, j;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2976 gint x1, x2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2977 gint y1, y2;
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 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
2980
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2981 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
2982 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
2983
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2984 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
2985 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
2986
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2987 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
2988 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2989 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
2990 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2991 ImageTile *it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
2992
32
96ac60a9c0f1 Wed Apr 6 02:43:40 2005 John Ellis <johne@verizon.net>
gqview
parents: 31
diff changeset
2993 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
2994 (only_existing &&
34
772fe5a509b1 Thu Apr 7 08:42:54 2005 John Ellis <johne@verizon.net>
gqview
parents: 33
diff changeset
2995 (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
2996 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
2997 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
2998 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
2999 if (it)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3000 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3001 QueueData *qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3002
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3003 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
3004 (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
3005 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3006 it->render_todo = render;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3007 }
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 qd = g_new(QueueData, 1);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3010 qd->it = it;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3011 qd->new_data = new_data;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3012
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3013 if (i < x)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3014 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3015 qd->x = x - i;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3016 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3017 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3018 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3019 qd->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3020 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3021 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
3022 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
3023
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3024 if (j < y)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3025 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3026 qd->y = y - j;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3027 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3028 else
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 qd->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3031 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3032 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
3033 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
3034
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3035 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
3036 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3037 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3038 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3039 else if (it->qd)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3040 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3041 pr_queue_merge(it->qd, qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3042 g_free(qd);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3043 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3044 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3045 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3046 it->qd = qd;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3047 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
3048 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3049 }
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 }
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 return TRUE;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3056 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
3057 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
3058 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3059 gint nx, ny;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3060
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3061 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
3062 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
3063 w -= (nx - x);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3064 h -= (ny - y);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3065 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
3066 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
3067 if (w < 1 || h < 1) return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3068
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3069 if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data, only_existing) &&
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
3070 ((!pr->draw_queue && !pr->draw_queue_2pass) || pr->draw_idle_id == -1))
23
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 if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
1030
f10b680b4baa improved pixbuf draw priority control
nadvornik
parents: 1001
diff changeset
3073 pr_queue_schedule_next_draw(pr, TRUE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3074 }
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3077 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
3078 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3079 pr_queue_clear(pr);
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3080 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
3081 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3082
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3085 * signal emission
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3086 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3087 */
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 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
3090 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3091 #if 0
673
fbebf5cf4a55 Do not use printf() directly but use new wrapper function log_printf() instead.
zas_
parents: 671
diff changeset
3092 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
3093 #endif
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 495
diff changeset
3094 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
3095 pr->debug_updated = TRUE;
23
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3098 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
3099 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3100 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
3101 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3102
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3103 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
3104 {
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3105 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
3106 }
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3107
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3108 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
3109 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3110 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
3111 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3112
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3113 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
3114 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3115 if (!pr->complete)
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3116 {
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3117 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
3118 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
3119 }
386
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3120 if (pr->debug_updated)
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3121 {
506
fc9c8a3e1a8b Handle the newline in DEBUG_N() macro instead of adding one
zas_
parents: 495
diff changeset
3122 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
3123 pr->debug_updated = FALSE;
0226daf8c30b in debug mode print time information on selected events
nadvornik
parents: 336
diff changeset
3124 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3125 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3126
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3127 static void pr_drag_signal(PixbufRenderer *pr, GdkEventButton *bevent)
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3128 {
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3129 g_signal_emit(pr, signals[SIGNAL_DRAG], 0, bevent);
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3130 }
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3131
23
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 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3134 * sync and clamp
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 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3137
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3138 static void pixbuf_renderer_sync_scroll_center(PixbufRenderer *pr)
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3139 {
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3140 gint src_x, src_y;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3141 if (!pr->width || !pr->height) return;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3142
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3143 src_x = pr->x_scroll + pr->vis_width / 2;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3144 src_y = pr->y_scroll + pr->vis_height / 2;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3145
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3146 pr->norm_center_x = (gdouble)src_x / pr->width;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3147 pr->norm_center_y = (gdouble)src_y / pr->height;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3148 }
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3149
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3150
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3151 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
3152 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3153 gint old_xs;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3154 gint old_ys;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3155
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3156 if (pr->zoom == 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3157 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3158 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3159 pr->y_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3160
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3161 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3162 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3163
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3164 old_xs = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3165 old_ys = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3166
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3167 if (pr->x_offset > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3168 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3169 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3170 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3171 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3172 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3173 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
3174 }
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 if (pr->y_offset > 0)
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 pr->y_scroll = 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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3181 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3182 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
3183 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3184
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3185 pixbuf_renderer_sync_scroll_center(pr);
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3186
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3187 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
3188 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3189
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3190 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
3191 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3192 gint old_vw, old_vh;
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 old_vw = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3195 old_vh = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3196
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3197 if (pr->width < pr->window_width)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3198 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3199 pr->vis_width = pr->width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3200 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
3201 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3202 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3203 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3204 pr->vis_width = pr->window_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3205 pr->x_offset = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3206 }
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 if (pr->height < pr->window_height)
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 pr->vis_height = pr->height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3211 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
3212 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3213 else
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 pr->vis_height = pr->window_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3216 pr->y_offset = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3217 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3218
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3219 pixbuf_renderer_sync_scroll_center(pr);
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3220
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3221 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
3222 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3223
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3224 static gint pr_zoom_clamp(PixbufRenderer *pr, gdouble zoom,
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3225 PrZoomFlags flags, gboolean *redrawn)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3226 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3227 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3228 gdouble scale;
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3229 gboolean invalid;
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3230 gboolean force = !!(flags & PR_ZOOM_FORCE);
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3231 gboolean new = !!(flags & PR_ZOOM_NEW);
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3232 gboolean invalidate = !!(flags & PR_ZOOM_INVALIDATE);
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3233 gboolean lazy = !!(flags & PR_ZOOM_LAZY);
23
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 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
3236
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3237 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
3238
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3239 w = pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3240 h = pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3241
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3242 if (zoom == 0.0 && !pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3243 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3244 scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3245 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3246 else if (zoom == 0.0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3247 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3248 gint max_w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3249 gint max_h;
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3250 gboolean sizeable;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3251
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3252 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
3253
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3254 if (sizeable)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3255 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3256 max_w = gdk_screen_width();
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3257 max_h = gdk_screen_height();
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3258
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3259 if (pr->window_limit)
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 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
3262 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
3263 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3264 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3265 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3266 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3267 max_w = pr->window_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3268 max_h = pr->window_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3269 }
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 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
3272 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3273 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
3274 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3275 scale = (gdouble)max_h / h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3276 h = max_h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3277 w = w * scale + 0.5;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3278 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
3279 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3280 else
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 scale = (gdouble)max_w / w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3283 w = max_w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3284 h = h * scale + 0.5;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3285 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
3286 }
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3287
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3288 if (pr->autofit_limit)
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3289 {
336
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3290 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
3291 w = w * factor + 0.5;
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3292 h = h * factor + 0.5;
9122c5da1223 Fix display bug when using "Limit image size when autofitting" option.
zas_
parents: 283
diff changeset
3293 scale = scale * factor;
209
ad78ad18523a configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
nadvornik
parents: 208
diff changeset
3294 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3295
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3296 if (w < 1) w = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3297 if (h < 1) h = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3298 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3299 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3300 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3301 scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3302 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3303 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3304 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
3305 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3306 scale = zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3307 w = w * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3308 h = h * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3309 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3310 else /* zoom out */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3311 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3312 scale = 1.0 / (0.0 - zoom);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3313 w = w * scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3314 h = h * scale;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3317 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
3318
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3319 pr->zoom = zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3320 pr->width = w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3321 pr->height = h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3322 pr->scale = scale;
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 if (invalidate || invalid)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3325 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3326 pr_tile_invalidate_all(pr);
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3327 if (!lazy) pr_redraw(pr, TRUE);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3328 }
27
9c24765c2d3a Sat Apr 2 17:28:16 2005 John Ellis <johne@verizon.net>
gqview
parents: 26
diff changeset
3329 if (redrawn) *redrawn = (invalidate || invalid);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3330
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3331 pixbuf_renderer_sync_scroll_center(pr);
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3332
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3333 return TRUE;
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3336 static void pr_zoom_sync(PixbufRenderer *pr, gdouble zoom,
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3337 PrZoomFlags flags, gint px, gint py)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3338 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3339 gdouble old_scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3340 gint old_cx, old_cy;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3341 gint clamped;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3342 gint sized;
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3343 gboolean redrawn = FALSE;
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3344 gboolean center_point = !!(flags & PR_ZOOM_CENTER);
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3345 gboolean force = !!(flags & PR_ZOOM_FORCE);
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3346 gboolean new = !!(flags & PR_ZOOM_NEW);
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3347 gboolean lazy = !!(flags & PR_ZOOM_LAZY);
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3348 PrZoomFlags clamp_flags = flags;
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3349 gdouble old_center_x = pr->norm_center_x;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3350 gdouble old_center_y = pr->norm_center_y;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3351
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3352 old_scale = pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3353 if (center_point)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3354 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3355 px = CLAMP(px, 0, pr->width);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3356 py = CLAMP(py, 0, pr->height);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3357 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
3358 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
3359 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3360 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3361 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3362 px = py = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3363 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
3364 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
3365 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3366
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3367 if (force) clamp_flags |= PR_ZOOM_INVALIDATE;
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3368 if (lazy) clamp_flags |= PR_ZOOM_LAZY;
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3369 if (!pr_zoom_clamp(pr, zoom, clamp_flags, &redrawn)) return;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3370
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3371 clamped = pr_size_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3372 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
3373
99
d19b0de6d0bb Sat Nov 4 17:14:47 2006 John Ellis <johne@verizon.net>
gqview
parents: 95
diff changeset
3374 if (force && new)
23
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 switch (pr->scroll_reset)
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 case PR_SCROLL_RESET_NOCHANGE:
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3379 /* maintain old scroll position */
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3380 pr->x_scroll = ((gdouble)pr->image_width * old_center_x * pr->scale) - pr->vis_width / 2;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3381 pr->y_scroll = ((gdouble)pr->image_height * old_center_y * pr->scale) - pr->vis_height / 2;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3382 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3383 case PR_SCROLL_RESET_CENTER:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3384 /* center new image */
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3385 pr->x_scroll = ((gdouble)pr->image_width / 2.0 * pr->scale) - pr->vis_width / 2;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3386 pr->y_scroll = ((gdouble)pr->image_height / 2.0 * pr->scale) - pr->vis_height / 2;
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3387 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3388 case PR_SCROLL_RESET_TOPLEFT:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3389 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3390 /* reset to upper left */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3391 pr->x_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3392 pr->y_scroll = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3393 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3394 }
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 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3397 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3398 /* 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
3399 if (center_point)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3400 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3401 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
3402 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
3403 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3404 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3405 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3406 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
3407 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
3408 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3409 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3410
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3411 pr_scroll_clamp(pr);
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 /* 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
3414 * 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
3415 * so redraw the window anyway :/
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3416 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3417 if (sized || clamped) pr_border_clear(pr);
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3418
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3419 if (lazy)
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3420 {
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3421 pr_queue_clear(pr);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3422 }
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3423 else
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3424 {
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3425 pr_redraw(pr, redrawn);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3426 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3427
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3428 pr_scroll_notify_signal(pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3429 pr_zoom_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3430 pr_update_signal(pr);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3433 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
3434 {
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3435 gint zoom_changed = FALSE;
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3436
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3437 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
3438
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3439 pr->window_width = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3440 pr->window_height = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3441
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3442 if (pr->zoom == 0.0)
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3443 {
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3444 gdouble old_scale = pr->scale;
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3445 pr_zoom_clamp(pr, 0.0, PR_ZOOM_FORCE, NULL);
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3446 zoom_changed = (old_scale != pr->scale);
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3447 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3448
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3449 pr_size_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3450 pr_scroll_clamp(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3451
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3452 pr_overlay_update_sizes(pr);
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3453
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3454 /* ensure scroller remains visible */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3455 if (pr->scroller_overlay != -1)
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 gint update = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3458
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3459 if (pr->scroller_x > new_width)
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 pr->scroller_x = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3462 pr->scroller_xpos = new_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3463 update = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3464 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3465 if (pr->scroller_y > new_height)
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 pr->scroller_y = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3468 pr->scroller_ypos = new_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3469 update = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3470 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3471
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3472 if (update)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3473 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3474 GdkPixbuf *pixbuf;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3475
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3476 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
3477 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3478 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3479
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3480 w = gdk_pixbuf_get_width(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3481 h = gdk_pixbuf_get_height(pixbuf);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3482 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
3483 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
3484 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3485 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3486 }
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 pr_border_clear(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3489
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3490 pr_scroll_notify_signal(pr);
61
0c912a2d94f1 Mon Jun 13 20:22:58 2005 John Ellis <johne@verizon.net>
gqview
parents: 42
diff changeset
3491 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
3492 pr_update_signal(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3493 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3494
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3495 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
3496 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3497 PixbufRenderer *pr = data;
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 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
3500 }
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 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
3503 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3504 gint x, y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3505
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3506 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
3507
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3508 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
3509 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
3510
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3511 pr_queue(pr, x, y,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3512 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
3513 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
3514 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
3515 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3516
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3517 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3518 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3519 * scrolling
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3520 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3521 */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3522
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3523 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
3524 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3525 gint old_x, old_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3526 gint x_off, y_off;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3527 gint w, h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3528
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3529 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
3530
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3531 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
3532
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3533 old_x = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3534 old_y = pr->y_scroll;
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 pr->x_scroll += x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3537 pr->y_scroll += y;
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 pr_scroll_clamp(pr);
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3540
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3541 pixbuf_renderer_sync_scroll_center(pr);
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3542
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3543 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
3544
29
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3545 pr_scroll_notify_signal(pr);
8a8ec4b3e769 Sun Apr 3 00:36:22 2005 John Ellis <johne@verizon.net>
gqview
parents: 27
diff changeset
3546
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3547 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
3548 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
3549
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3550 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
3551 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
3552
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3553 if (w < 1 || h < 1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3554 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3555 /* scrolled completely to new material */
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
3556 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
3557 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3558 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3559 else
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3560 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3561 gint x1, y1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3562 gint x2, y2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3563 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3564 GdkGC *gc;
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3565 GdkEvent *event;
23
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 if (x_off < 0)
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 x1 = abs(x_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3570 x2 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3571 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3572 else
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 x1 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3575 x2 = abs(x_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3576 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3577
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3578 if (y_off < 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3579 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3580 y1 = abs(y_off);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3581 y2 = 0;
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 else
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 y1 = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3586 y2 = abs(y_off);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3589 box = GTK_WIDGET(pr);
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 gc = gdk_gc_new(box->window);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3592 gdk_gc_set_exposures(gc, TRUE);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3593 gdk_draw_drawable(box->window, gc,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3594 box->window,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3595 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
3596 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
3597 g_object_unref(gc);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3598
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3599 if (pr->overlay_list)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3600 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3601 pr_overlay_queue_all(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3602 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3603
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3604 w = pr->vis_width - w;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3605 h = pr->vis_height - h;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3606
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3607 if (w > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3608 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3609 pr_queue(pr,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3610 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
3611 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
3612 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3613 if (h > 0)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3614 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3615 /* FIXME, to optimize this, remove overlap */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3616 pr_queue(pr,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3617 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
3618 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
3619 }
87
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3620
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3621 /* 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
3622 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
3623 {
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3624 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
3625
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3626 if (event->expose.count == 0)
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3627 {
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3628 gdk_event_free(event);
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3629 break;
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3630 }
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3631 gdk_event_free(event);
a2b0a7b0b490 Wed Oct 25 15:17:38 2006 John Ellis <johne@verizon.net>
gqview
parents: 77
diff changeset
3632 }
23
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 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3635
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3636 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
3637 gdouble x_align, gdouble y_align)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3638 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3639 gint px, py;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3640 gint ax, ay;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3641
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3642 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
3643 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
3644
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3645 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
3646 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
3647
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3648 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
3649 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
3650
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3651 pixbuf_renderer_scroll(pr, px, py);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3652 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3653
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3654 /* 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
3655
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3656 void pixbuf_renderer_get_scroll_center(PixbufRenderer *pr, gdouble *x, gdouble *y)
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3657 {
1037
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3658 *x = pr->norm_center_x;
86148ec8a299 fixed various problems with preserving viewport on image change,
nadvornik
parents: 1035
diff changeset
3659 *y = pr->norm_center_y;
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3660 }
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3661
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3662 void pixbuf_renderer_set_scroll_center(PixbufRenderer *pr, gdouble x, gdouble y)
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3663 {
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3664 gdouble dst_x, dst_y;
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3665
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3666 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
3667 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
3668
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3669 pr->subpixel_x_scroll = dst_x - (gint)dst_x;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3670 pr->subpixel_y_scroll = dst_y - (gint)dst_y;
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3671
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
3672 pixbuf_renderer_scroll(pr, (gint)dst_x, (gint)dst_y);
131
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3673 }
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3674
b1acdfc7271b relative scroll is working; some cleanup
nadvornik
parents: 128
diff changeset
3675
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3676 /*
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 * mouse
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3679 *-------------------------------------------------------------------
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3682 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
3683 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3684 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3685 gint accel;
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 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3688
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3689 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3690 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3691 pr->scroller_xpos = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3692 pr->scroller_ypos = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3693 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3694
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3695 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
3696
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3697 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
3698 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3699 pr->drag_moved++;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3700 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3701 else
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 widget_set_cursor(widget, GDK_FLEUR);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3704 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3705
1047
81ec7d977d5f use SHIFT for connected scroll and zoom
nadvornik
parents: 1045
diff changeset
3706 if (bevent->state & GDK_CONTROL_MASK)
23
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 accel = PR_PAN_SHIFT_MULTIPLIER;
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 else
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 accel = 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3713 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3714
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3715 /* do the scroll */
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3716 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
3717 (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
3718
128
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3719 pr_drag_signal(pr, bevent);
98e2632b5d3d improved connected scroll and active image switching
nadvornik
parents: 104
diff changeset
3720
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3721 pr->drag_last_x = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3722 pr->drag_last_y = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3723
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3724 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3725 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3726
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3727 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
3728 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3729 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3730 GtkWidget *parent;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3731
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3732 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3733
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3734 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
3735
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3736 switch (bevent->button)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3737 {
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3738 case MOUSE_BUTTON_LEFT:
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3739 pr->in_drag = TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3740 pr->drag_last_x = bevent->x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3741 pr->drag_last_y = bevent->y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3742 pr->drag_moved = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3743 gdk_pointer_grab(widget->window, FALSE,
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3744 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
3745 NULL, NULL, bevent->time);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3746 gtk_grab_add(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3747 break;
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3748 case MOUSE_BUTTON_MIDDLE:
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3749 pr->drag_moved = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3750 break;
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3751 case MOUSE_BUTTON_RIGHT:
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3752 pr_clicked_signal(pr, bevent);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3753 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3754 default:
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3755 break;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3756 }
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 parent = gtk_widget_get_parent(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3759 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
3760 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3761 gtk_widget_grab_focus(parent);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3762 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3763
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3764 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3765 }
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 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
3768 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3769 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3770
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3771 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3772
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3773 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3774 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3775 pr_scroller_stop(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3776 return TRUE;
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 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
3780 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3781 gtk_grab_remove(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3782 gdk_pointer_ungrab(bevent->time);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3783 widget_set_cursor(widget, -1);
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
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3786 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
3787 {
1047
81ec7d977d5f use SHIFT for connected scroll and zoom
nadvornik
parents: 1045
diff changeset
3788 if (bevent->button == MOUSE_BUTTON_LEFT && (bevent->state & GDK_CONTROL_MASK))
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3789 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3790 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
3791 }
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 446
diff changeset
3792 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
3793 {
25
0c3b353b666e Fri Mar 25 22:39:30 2005 John Ellis <johne@verizon.net>
gqview
parents: 24
diff changeset
3794 pr_clicked_signal(pr, bevent);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3795 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3796 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3797
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3798 pr->in_drag = FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3799
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3800 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3801 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3802
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3803 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
3804 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3805 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3806
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3807 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3808
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3809 if (pr->scroller_id != -1)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3810 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3811 pr->scroller_xpos = pr->scroller_x;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3812 pr->scroller_ypos = pr->scroller_y;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3813 pr->scroller_xinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3814 pr->scroller_yinc = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3815 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3816
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3817 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3818 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3819
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3820 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
3821 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3822 PixbufRenderer *pr;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3823
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3824 pr = PIXBUF_RENDERER(widget);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3825
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3826 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
3827 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3828
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3829 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
3830 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3831 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
3832 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
3833 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
3834 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
3835 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
3836 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
3837 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
3838 G_CALLBACK(pr_mouse_leave_cb), pr);
1373
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
3839 g_signal_connect(G_OBJECT(pr), "unmap",
168e5597ddc7 overlay now survives image split
nadvornik
parents: 1284
diff changeset
3840 G_CALLBACK(pr_unmap_cb), pr);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3841
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3842 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
3843 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
3844 GDK_LEAVE_NOTIFY_MASK);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3845
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3846 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
3847 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
3848
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3849 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3850
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3851 /*
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3852 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3853 * public
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3854 *-------------------------------------------------------------------
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3855 */
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3856 static void pr_pixbuf_size_sync(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3857 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3858 if (!pr->pixbuf) return;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3859 switch (pr->orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3860 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3861 case EXIF_ORIENTATION_LEFT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3862 case EXIF_ORIENTATION_RIGHT_TOP:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3863 case EXIF_ORIENTATION_RIGHT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3864 case EXIF_ORIENTATION_LEFT_BOTTOM:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3865 pr->image_width = gdk_pixbuf_get_height(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3866 pr->image_height = gdk_pixbuf_get_width(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3867 break;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3868 default:
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3869 pr->image_width = gdk_pixbuf_get_width(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3870 pr->image_height = gdk_pixbuf_get_height(pr->pixbuf);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3871 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3872 }
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3873
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3874 static void pr_set_pixbuf(PixbufRenderer *pr, GdkPixbuf *pixbuf, gdouble zoom, PrZoomFlags flags)
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3875 {
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3876 if (pixbuf) g_object_ref(pixbuf);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3877 if (pr->pixbuf) g_object_unref(pr->pixbuf);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3878 pr->pixbuf = pixbuf;
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3879
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3880 if (!pr->pixbuf)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3881 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3882 GtkWidget *box;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3883
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3884 /* 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
3885 pr->image_width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3886 pr->image_height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3887 pr->scale = 1.0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3888
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3889 box = GTK_WIDGET(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3890
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3891 if (GTK_WIDGET_REALIZED(box))
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 gdk_window_clear(box->window);
104
8d358a53146e Wed Nov 8 16:59:14 2006 John Ellis <johne@verizon.net>
gqview
parents: 99
diff changeset
3894 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
3895 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3896
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3897 pr_update_signal(pr);
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 return;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3900 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3901
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3902 pr_pixbuf_size_sync(pr);
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3903 pr_zoom_sync(pr, zoom, flags | PR_ZOOM_FORCE | PR_ZOOM_NEW, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3904 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3905
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3906 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
3907 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3908 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
3909
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3910 pr_source_tile_unset(pr);
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3911
1045
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3912 pr_set_pixbuf(pr, pixbuf, zoom, 0);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3913
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3914 pr_update_signal(pr);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3915 }
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3916
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3917 void pixbuf_renderer_set_pixbuf_lazy(PixbufRenderer *pr, GdkPixbuf *pixbuf, gdouble zoom, gint orientation)
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3918 {
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3919 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3920
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3921 pr_source_tile_unset(pr);
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3922
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3923 pr->orientation = orientation;
0ab0deb0cfcc added possibility to redraw only the parts of image that are already
nadvornik
parents: 1043
diff changeset
3924 pr_set_pixbuf(pr, pixbuf, zoom, PR_ZOOM_LAZY);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3925
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
3926 pr_update_signal(pr);
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 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
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), NULL);
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->pixbuf;
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
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3936 void pixbuf_renderer_set_orientation(PixbufRenderer *pr, gint orientation)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3937 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3938 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3939
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3940 pr->orientation = orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3941
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3942 pr_pixbuf_size_sync(pr);
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
3943 pr_zoom_sync(pr, pr->zoom, PR_ZOOM_FORCE, 0, 0);
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3944 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3945
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3946 gint pixbuf_renderer_get_orientation(PixbufRenderer *pr)
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3947 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3948 if (!pr) return 1;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3949 return pr->orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3950 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3951
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3952 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
3953 {
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3954 g_return_if_fail(IS_PIXBUF_RENDERER(pr));
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
3955
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3956 pr->func_post_process = func;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3957 pr->post_process_user_data = user_data;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3958 pr->post_process_slow = func && slow;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3959
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3960 }
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3961
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3962
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3963 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
3964 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3965 GObject *object;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3966 PixbufRendererScrollResetType scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3967
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3968 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
3969 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
3970
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3971 if (pr == source) return;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3972
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3973 object = G_OBJECT(pr);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3974
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3975 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
3976 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
3977 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
3978
42
606fcf461a68 Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
gqview
parents: 38
diff changeset
3979 pr->complete = source->complete;
606fcf461a68 Sat May 14 13:04:23 2005 John Ellis <johne@verizon.net>
gqview
parents: 38
diff changeset
3980
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3981 pr->x_scroll = source->x_scroll;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3982 pr->y_scroll = source->y_scroll;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3983
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3984 scroll_reset = pr->scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3985 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
3986
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3987 pr->func_post_process = source->func_post_process;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3988 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
3989 pr->post_process_slow = source->post_process_slow;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3990 pr->orientation = source->orientation;
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
3991
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3992 if (source->source_tiles_enabled)
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3993 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3994 pr_source_tile_unset(pr);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3995
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
3996 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
3997 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
3998 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
3999 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
4000 pr->image_width = source->image_width;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4001 pr->image_height = source->image_height;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4002
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4003 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
4004 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
4005 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
4006
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4007 pr->source_tiles = source->source_tiles;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4008 source->source_tiles = NULL;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4009
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
4010 pr_zoom_sync(pr, source->zoom, PR_ZOOM_FORCE | PR_ZOOM_NEW, 0, 0);
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4011 pr_redraw(pr, TRUE);
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4012 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4013 else
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4014 {
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4015 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
4016 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4017
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4018 pr->scroll_reset = scroll_reset;
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4019
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4020 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
4021 pr_queue_clear(source);
36
9b01fe7e84d5 Tue Apr 12 07:59:20 2005 John Ellis <johne@verizon.net>
gqview
parents: 34
diff changeset
4022 pr_tile_free_all(source);
24
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4023 }
104e34f9ab1f Wed Mar 23 00:22:28 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
4024
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4025 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
4026 {
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4027 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
4028
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4029 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
4030
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 409
diff changeset
4031 pr_coords_map_orientation_reverse(pr,
398
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4032 src_x, src_y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4033 pr->image_width, pr->image_height,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4034 src_w, src_h,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4035 &x, &y,
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4036 &width, &height);
c4080362d619 image post-processing (rotation and color management) moved to
nadvornik
parents: 386
diff changeset
4037
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4038 if (pr->source_tiles_enabled)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4039 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4040 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
4041 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4042
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4043 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
4044 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4045 /* 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
4046 y -= 1;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4047 height += 2;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4048 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4049
1000
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
4050 x1 = (gint)floor((gdouble)x * pr->scale);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
4051 y1 = (gint)floor((gdouble)y * pr->scale);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
4052 x2 = (gint)ceil((gdouble)(x + width) * pr->scale);
4fe8f9656107 For the sake of consistency, use glib basic types everywhere.
zas_
parents: 872
diff changeset
4053 y2 = (gint)ceil((gdouble)(y + height) * pr->scale);
26
acd9885ebd78 Mon Mar 28 20:23:34 2005 John Ellis <johne@verizon.net>
gqview
parents: 25
diff changeset
4054
31
c42544f31030 Tue Apr 5 05:09:29 2005 John Ellis <johne@verizon.net>
gqview
parents: 29
diff changeset
4055 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
4056 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4057
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4058 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
4059 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4060 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
4061
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
4062 pr_zoom_adjust_real(pr, increment, PR_ZOOM_NONE, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4063 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4064
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4065 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
4066 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4067 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
4068
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
4069 pr_zoom_adjust_real(pr, increment, PR_ZOOM_CENTER, x, y);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4070 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4071
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4072 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
4073 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4074 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
4075
859
63e1161ada52 Use flags for pr_zoom_*() functions.
zas_
parents: 857
diff changeset
4076 pr_zoom_sync(pr, zoom, PR_ZOOM_NONE, 0, 0);
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4077 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4078
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4079 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
4080 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4081 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
4082
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4083 return pr->zoom;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4084 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4085
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4086 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
4087 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4088 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
4089
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4090 return pr->scale;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4091 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4092
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4093 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
4094 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4095 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
4096
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4097 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
4098 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
4099 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
4100
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4101 if (pr->zoom_min != min)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4102 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4103 pr->zoom_min = min;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4104 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
4105 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4106 if (pr->zoom_max != max)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4107 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4108 pr->zoom_max = max;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4109 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
4110 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4111 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4112
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4113 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
4114 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4115 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
4116 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
4117
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4118 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
4119 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4120 *width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4121 *height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4122 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4123 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4124
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4125 *width = pr->image_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4126 *height = pr->image_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4127 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4128 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4129
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4130 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
4131 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4132 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
4133 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
4134
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4135 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
4136 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4137 *width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4138 *height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4139 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4140 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4141
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4142 *width = pr->width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4143 *height = pr->height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4144 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4145 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4146
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4147 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
4148 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4149 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
4150 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
4151
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4152 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
4153 !pr->scale)
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4154 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4155 rect->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4156 rect->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4157 rect->width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4158 rect->height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4159 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4160 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4161
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4162 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
4163 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
4164 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
4165 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
4166 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4167 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4168
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4169 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
4170 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4171 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
4172 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
4173
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4174 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
4175 {
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4176 rect->x = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4177 rect->y = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4178 rect->width = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4179 rect->height = 0;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4180 return FALSE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4181 }
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4182
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4183 rect->x = pr->x_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4184 rect->y = pr->y_scroll;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4185 rect->width = pr->vis_width;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4186 rect->height = pr->vis_height;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4187 return TRUE;
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents:
diff changeset
4188 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1047
diff changeset
4189 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */