Package: xpdf
Version: 3.02-3
Severity: normal
Hi, Michael.
Here is a better patch for the choice of zoom levels.
Please note that almost everything here is done during compilation time
and only an allocation of a small vector (and its deallocation) is
performed during runtime.
Please, join me at <http://github.com/rbrito/xpdf-poppler>.
Regards, Rogério Brito.
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.34 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.utf-8, LC_CTYPE=pt_BR.utf-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages xpdf depends on:
ii lesstif2 1:0.95.2-1 OSF/Motif 2.1 implementation relea
ii libc6 2.11.1-2 Embedded GNU C Library: Shared lib
ii libgcc1 1:4.4.4-4 GCC support library
ii libpoppler5 0.12.4-1 PDF rendering library
ii libstdc++6 4.4.4-4 The GNU Standard C++ Library v3
ii libx11-6 2:1.3.3-3 X11 client-side library
ii libxt6 1:1.0.7-1 X11 toolkit intrinsics library
Versions of packages xpdf recommends:
ii poppler-utils 0.12.4-1 PDF utilitites (based on libpopple
xpdf suggests no packages.
-- no debconf information
--
Rogério Brito : rbr...@{ime.usp.br,gmail.com} : GPG key 1024D/7C2CAEB8
http://rb.doesntexist.org : Packages for LaTeX : algorithms.berlios.de
DebianQA: http://qa.debian.org/developer.php?login=rbrito%40ime.usp.br
diff --git a/XPDFViewer.cc b/XPDFViewer.cc
index 41cf80d..5485b3c 100644
--- a/XPDFViewer.cc
+++ b/XPDFViewer.cc
@@ -140,7 +140,11 @@ struct ZoomMenuInfo {
double zoom;
};
-static ZoomMenuInfo zoomMenuInfo[nZoomMenuItems] = {
+static ZoomMenuInfo zoomMenuInfo[] = {
+ { "1600%", 1600 },
+ { "1200%", 1200 },
+ { "800%", 800 },
+ { "600%", 600 },
{ "400%", 400 },
{ "200%", 200 },
{ "150%", 150 },
@@ -153,11 +157,13 @@ static ZoomMenuInfo zoomMenuInfo[nZoomMenuItems] = {
{ "fit width", zoomWidth }
};
+#define nZoomMenuItems (sizeof(zoomMenuInfo)/sizeof(struct ZoomMenuInfo))
+
#define maxZoomIdx 0
-#define defZoomIdx 3
-#define minZoomIdx 7
-#define zoomPageIdx 8
-#define zoomWidthIdx 9
+#define defZoomIdx 7
+#define minZoomIdx nZoomMenuItems - 3
+#define zoomPageIdx nZoomMenuItems - 2
+#define zoomWidthIdx nZoomMenuItems - 1
//------------------------------------------------------------------------
@@ -361,6 +367,7 @@ XPDFViewer::XPDFViewer(XPDFApp *appA, PDFDoc *doc, int pageA,
XPDFViewer::~XPDFViewer() {
delete core;
+ delete zoomMenuBtns;
XmFontListFree(aboutBigFont);
XmFontListFree(aboutVersionFont);
XmFontListFree(aboutFixedFont);
@@ -1731,6 +1738,7 @@ void XPDFViewer::initToolbar(Widget parent) {
#else
Widget menuPane;
char buf[16];
+ zoomMenuBtns = new Widget[nZoomMenuItems];
n = 0;
menuPane = XmCreatePulldownMenu(toolBar, "zoomMenuPane", args, n);
for (i = 0; i < nZoomMenuItems; ++i) {
diff --git a/XPDFViewer.h b/XPDFViewer.h
index d09adde..6132a70 100644
--- a/XPDFViewer.h
+++ b/XPDFViewer.h
@@ -40,11 +40,6 @@ class XPDFViewer;
//------------------------------------------------------------------------
-// NB: this must match the defn of zoomMenuBtnInfo in XPDFViewer.cc
-#define nZoomMenuItems 10
-
-//------------------------------------------------------------------------
-
struct XPDFViewerCmd {
char *name;
int nArgs;
@@ -54,6 +49,8 @@ struct XPDFViewerCmd {
};
//------------------------------------------------------------------------
+
+//------------------------------------------------------------------------
// XPDFViewer
//------------------------------------------------------------------------
@@ -327,7 +324,7 @@ private:
Widget zoomComboBox;
#else
Widget zoomMenu;
- Widget zoomMenuBtns[nZoomMenuItems];
+ Widget *zoomMenuBtns;
#endif
Widget zoomWidget;
Widget findBtn;