/src/xpdf-4.05/xpdf/DisplayState.h
Line | Count | Source |
1 | | //======================================================================== |
2 | | // |
3 | | // DisplayState.h |
4 | | // |
5 | | // Copyright 2014 Glyph & Cog, LLC |
6 | | // |
7 | | //======================================================================== |
8 | | |
9 | | #ifndef DISPLAYSTATE_H |
10 | | #define DISPLAYSTATE_H |
11 | | |
12 | | #include <aconf.h> |
13 | | |
14 | | #include "gtypes.h" |
15 | | #include "SplashTypes.h" |
16 | | |
17 | | class GString; |
18 | | class GList; |
19 | | class PDFDoc; |
20 | | class TileMap; |
21 | | class TileCache; |
22 | | class TileCompositor; |
23 | | |
24 | | //------------------------------------------------------------------------ |
25 | | // zoom level |
26 | | //------------------------------------------------------------------------ |
27 | | |
28 | | // positive zoom levels are percentage of 72 dpi |
29 | | // (e.g., 50 means 36dpi, 100 means 72dpi, 150 means 108 dpi) |
30 | | |
31 | | #define zoomPage -1 |
32 | | #define zoomWidth -2 |
33 | | #define zoomHeight -3 |
34 | | |
35 | | //------------------------------------------------------------------------ |
36 | | // display mode |
37 | | //------------------------------------------------------------------------ |
38 | | |
39 | | enum DisplayMode { |
40 | | displaySingle, |
41 | | displayContinuous, |
42 | | displaySideBySideSingle, |
43 | | displaySideBySideContinuous, |
44 | | displayHorizontalContinuous |
45 | | }; |
46 | | |
47 | | //------------------------------------------------------------------------ |
48 | | // SelectRect |
49 | | //------------------------------------------------------------------------ |
50 | | |
51 | | class SelectRect { |
52 | | public: |
53 | | |
54 | | SelectRect(int pageA, double x0A, double y0A, double x1A, double y1A): |
55 | 0 | page(pageA), x0(x0A), y0(y0A), x1(x1A), y1(y1A) {} |
56 | | int operator==(SelectRect r) |
57 | 0 | { return page == r.page && x0 == r.x0 && y0 == r.y0 && |
58 | 0 | x1 == r.x1 && y1 == r.y1; } |
59 | | int operator!=(SelectRect r) |
60 | 0 | { return page != r.page || x0 != r.x0 || y0 != r.y0 || |
61 | 0 | x1 != r.x1 || y1 != r.y1; } |
62 | | |
63 | | int page; |
64 | | double x0, y0, x1, y1; // user coords |
65 | | }; |
66 | | |
67 | | |
68 | | //------------------------------------------------------------------------ |
69 | | // DisplayState |
70 | | //------------------------------------------------------------------------ |
71 | | |
72 | | class DisplayState { |
73 | | public: |
74 | | |
75 | | DisplayState(int maxTileWidthA, int maxTileHeightA, |
76 | | int tileCacheSizeA, int nWorkerThreadsA, |
77 | | SplashColorMode colorModeA, int bitmapRowPadA); |
78 | | ~DisplayState(); |
79 | | |
80 | | void setTileMap(TileMap *tileMapA) |
81 | 0 | { tileMap = tileMapA; } |
82 | | void setTileCache(TileCache *tileCacheA) |
83 | 0 | { tileCache = tileCacheA; } |
84 | | void setTileCompositor(TileCompositor *tileCompositorA) |
85 | 0 | { tileCompositor = tileCompositorA; } |
86 | | |
87 | | void setPaperColor(SplashColorPtr paperColorA); |
88 | | void setMatteColor(SplashColorPtr matteColorA); |
89 | | void setSelectColor(SplashColorPtr selectColorA); |
90 | | void setReverseVideo(GBool reverseVideoA); |
91 | | void setDoc(PDFDoc *docA); |
92 | | void setWindowSize(int winWA, int winHA); |
93 | | void setDisplayMode(DisplayMode displayModeA); |
94 | | void setZoom(double zoomA); |
95 | | void setRotate(int rotateA); |
96 | | void setScrollPosition(int scrollPageA, int scrollXA, int scrollYA); |
97 | | void setSelection(int selectPage, double selectX0, double selectY0, |
98 | | double selectX1, double selectY1); |
99 | | void setSelection(GList *selectRectsA); |
100 | | void clearSelection(); |
101 | | void forceRedraw(); |
102 | | |
103 | 0 | int getMaxTileWidth() { return maxTileWidth; } |
104 | 0 | int getMaxTileHeight() { return maxTileHeight; } |
105 | 0 | int getTileCacheSize() { return tileCacheSize; } |
106 | 0 | int getNWorkerThreads() { return nWorkerThreads; } |
107 | 0 | SplashColorMode getColorMode() { return colorMode; } |
108 | 0 | int getBitmapRowPad() { return bitmapRowPad; } |
109 | 0 | SplashColorPtr getPaperColor() { return paperColor; } |
110 | 0 | SplashColorPtr getMatteColor() { return matteColor; } |
111 | 0 | SplashColorPtr getSelectColor() { return selectColor; } |
112 | 0 | GBool getReverseVideo() { return reverseVideo; } |
113 | 0 | PDFDoc *getDoc() { return doc; } |
114 | 0 | int getWinW() { return winW; } |
115 | 0 | int getWinH() { return winH; } |
116 | 0 | DisplayMode getDisplayMode() { return displayMode; } |
117 | | GBool displayModeIsContinuous() |
118 | 0 | { return displayMode == displayContinuous || |
119 | 0 | displayMode == displaySideBySideContinuous || |
120 | 0 | displayMode == displayHorizontalContinuous; } |
121 | | GBool displayModeIsSideBySide() |
122 | 0 | { return displayMode == displaySideBySideSingle || |
123 | 0 | displayMode == displaySideBySideContinuous; } |
124 | 0 | double getZoom() { return zoom; } |
125 | 0 | int getRotate() { return rotate; } |
126 | 0 | int getScrollPage() { return scrollPage; } |
127 | 0 | int getScrollX() { return scrollX; } |
128 | 0 | int getScrollY() { return scrollY; } |
129 | 0 | GBool hasSelection() { return selectRects != NULL; } |
130 | 0 | GList *getSelectRects() { return selectRects; } |
131 | | int getNumSelectRects(); |
132 | | SelectRect *getSelectRect(int idx); |
133 | | void optionalContentChanged(); |
134 | | |
135 | | private: |
136 | | |
137 | | int maxTileWidth, maxTileHeight; |
138 | | int tileCacheSize; |
139 | | int nWorkerThreads; |
140 | | |
141 | | SplashColorMode colorMode; |
142 | | int bitmapRowPad; |
143 | | |
144 | | TileMap *tileMap; |
145 | | TileCache *tileCache; |
146 | | TileCompositor *tileCompositor; |
147 | | |
148 | | SplashColor paperColor; |
149 | | SplashColor matteColor; |
150 | | SplashColor selectColor; |
151 | | GBool reverseVideo; |
152 | | |
153 | | PDFDoc *doc; |
154 | | |
155 | | int winW, winH; // window (draw area) size |
156 | | DisplayMode displayMode; |
157 | | double zoom; // zoom level (see zoom* defines, above) |
158 | | int rotate; // rotation (0, 90, 180, or 270) |
159 | | int scrollPage; // scroll page - only used in |
160 | | // non-continuous modes |
161 | | int scrollX, scrollY; |
162 | | |
163 | | GList *selectRects; // selection rectangles [SelectRect] |
164 | | // (NULL if there is no selection) |
165 | | |
166 | | |
167 | | }; |
168 | | |
169 | | #endif |