aboutsummaryrefslogtreecommitdiff
path: root/xpdf/DisplayState.h
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@pobox.com>2023-04-05 14:13:39 -0400
committerCalvin Morrison <calvin@pobox.com>2023-04-05 14:13:39 -0400
commit835e373b3eeaabcd0621ed6798ab500f37982fae (patch)
treedfa16b0e2e1b4956b38f693220eac4e607802133 /xpdf/DisplayState.h
xpdf-no-select-disableHEADmaster
Diffstat (limited to 'xpdf/DisplayState.h')
-rw-r--r--xpdf/DisplayState.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/xpdf/DisplayState.h b/xpdf/DisplayState.h
new file mode 100644
index 0000000..12c8170
--- /dev/null
+++ b/xpdf/DisplayState.h
@@ -0,0 +1,173 @@
+//========================================================================
+//
+// DisplayState.h
+//
+// Copyright 2014 Glyph & Cog, LLC
+//
+//========================================================================
+
+#ifndef DISPLAYSTATE_H
+#define DISPLAYSTATE_H
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "gtypes.h"
+#include "SplashTypes.h"
+
+class GString;
+class GList;
+class PDFDoc;
+class TileMap;
+class TileCache;
+class TileCompositor;
+
+//------------------------------------------------------------------------
+// zoom level
+//------------------------------------------------------------------------
+
+// positive zoom levels are percentage of 72 dpi
+// (e.g., 50 means 36dpi, 100 means 72dpi, 150 means 108 dpi)
+
+#define zoomPage -1
+#define zoomWidth -2
+#define zoomHeight -3
+
+//------------------------------------------------------------------------
+// display mode
+//------------------------------------------------------------------------
+
+enum DisplayMode {
+ displaySingle,
+ displayContinuous,
+ displaySideBySideSingle,
+ displaySideBySideContinuous,
+ displayHorizontalContinuous
+};
+
+//------------------------------------------------------------------------
+// SelectRect
+//------------------------------------------------------------------------
+
+class SelectRect {
+public:
+
+ SelectRect(int pageA, double x0A, double y0A, double x1A, double y1A):
+ page(pageA), x0(x0A), y0(y0A), x1(x1A), y1(y1A) {}
+ int operator==(SelectRect r)
+ { return page == r.page && x0 == r.x0 && y0 == r.y0 &&
+ x1 == r.x1 && y1 == r.y1; }
+ int operator!=(SelectRect r)
+ { return page != r.page || x0 != r.x0 || y0 != r.y0 ||
+ x1 != r.x1 || y1 != r.y1; }
+
+ int page;
+ double x0, y0, x1, y1; // user coords
+};
+
+
+//------------------------------------------------------------------------
+// DisplayState
+//------------------------------------------------------------------------
+
+class DisplayState {
+public:
+
+ DisplayState(int maxTileWidthA, int maxTileHeightA,
+ int tileCacheSizeA, int nWorkerThreadsA,
+ SplashColorMode colorModeA, int bitmapRowPadA);
+ ~DisplayState();
+
+ void setTileMap(TileMap *tileMapA)
+ { tileMap = tileMapA; }
+ void setTileCache(TileCache *tileCacheA)
+ { tileCache = tileCacheA; }
+ void setTileCompositor(TileCompositor *tileCompositorA)
+ { tileCompositor = tileCompositorA; }
+
+ void setPaperColor(SplashColorPtr paperColorA);
+ void setMatteColor(SplashColorPtr matteColorA);
+ void setSelectColor(SplashColorPtr selectColorA);
+ void setReverseVideo(GBool reverseVideoA);
+ void setDoc(PDFDoc *docA);
+ void setWindowSize(int winWA, int winHA);
+ void setDisplayMode(DisplayMode displayModeA);
+ void setZoom(double zoomA);
+ void setRotate(int rotateA);
+ void setScrollPosition(int scrollPageA, int scrollXA, int scrollYA);
+ void setSelection(int selectPage, double selectX0, double selectY0,
+ double selectX1, double selectY1);
+ void setSelection(GList *selectRectsA);
+ void clearSelection();
+ void forceRedraw();
+
+ int getMaxTileWidth() { return maxTileWidth; }
+ int getMaxTileHeight() { return maxTileHeight; }
+ int getTileCacheSize() { return tileCacheSize; }
+ int getNWorkerThreads() { return nWorkerThreads; }
+ SplashColorMode getColorMode() { return colorMode; }
+ int getBitmapRowPad() { return bitmapRowPad; }
+ SplashColorPtr getPaperColor() { return paperColor; }
+ SplashColorPtr getMatteColor() { return matteColor; }
+ SplashColorPtr getSelectColor() { return selectColor; }
+ GBool getReverseVideo() { return reverseVideo; }
+ PDFDoc *getDoc() { return doc; }
+ int getWinW() { return winW; }
+ int getWinH() { return winH; }
+ DisplayMode getDisplayMode() { return displayMode; }
+ GBool displayModeIsContinuous()
+ { return displayMode == displayContinuous ||
+ displayMode == displaySideBySideContinuous ||
+ displayMode == displayHorizontalContinuous; }
+ GBool displayModeIsSideBySide()
+ { return displayMode == displaySideBySideSingle ||
+ displayMode == displaySideBySideContinuous; }
+ double getZoom() { return zoom; }
+ int getRotate() { return rotate; }
+ int getScrollPage() { return scrollPage; }
+ int getScrollX() { return scrollX; }
+ int getScrollY() { return scrollY; }
+ GBool hasSelection() { return selectRects != NULL; }
+ GList *getSelectRects() { return selectRects; }
+ int getNumSelectRects();
+ SelectRect *getSelectRect(int idx);
+ void optionalContentChanged();
+
+private:
+
+ int maxTileWidth, maxTileHeight;
+ int tileCacheSize;
+ int nWorkerThreads;
+
+ SplashColorMode colorMode;
+ int bitmapRowPad;
+
+ TileMap *tileMap;
+ TileCache *tileCache;
+ TileCompositor *tileCompositor;
+
+ SplashColor paperColor;
+ SplashColor matteColor;
+ SplashColor selectColor;
+ GBool reverseVideo;
+
+ PDFDoc *doc;
+
+ int winW, winH; // window (draw area) size
+ DisplayMode displayMode;
+ double zoom; // zoom level (see zoom* defines, above)
+ int rotate; // rotation (0, 90, 180, or 270)
+ int scrollPage; // scroll page - only used in
+ // non-continuous modes
+ int scrollX, scrollY;
+
+ GList *selectRects; // selection rectangles [SelectRect]
+ // (NULL if there is no selection)
+
+
+};
+
+#endif