diff -Nru xpdf-3.03/debian/changelog xpdf-3.03/debian/changelog --- xpdf-3.03/debian/changelog 2013-09-04 15:12:39.000000000 +0000 +++ xpdf-3.03/debian/changelog 2013-09-11 06:57:59.000000000 +0000 @@ -1,3 +1,10 @@ +xpdf (3.03-11ubuntu6) saucy; urgency=low + + * Restore support for reading Xpdf-specific settings. Fixes issues + with *Command settings reported by LilyPond users. + + -- Dmitry Shachnev Wed, 11 Sep 2013 10:48:44 +0400 + xpdf (3.03-11ubuntu5) saucy; urgency=low * Restore keybindings support. diff -Nru xpdf-3.03/debian/code/XPDFParams.cc xpdf-3.03/debian/code/XPDFParams.cc --- xpdf-3.03/debian/code/XPDFParams.cc 2013-09-04 15:11:03.000000000 +0000 +++ xpdf-3.03/debian/code/XPDFParams.cc 2013-09-10 16:32:17.000000000 +0000 @@ -1,5 +1,19 @@ +#include +#include +#include +#include "gfile.h" +#include "config.h" +#include "Error.h" #include "XPDFParams.h" +#if MULTITHREADED +# define lockXpdfParams gLockMutex(&xpdfMutex) +# define unlockXpdfParams gUnlockMutex(&xpdfMutex) +#else +# define lockXpdfParams +# define unlockXpdfParams +#endif + XpdfParams *xpdfParams = NULL; //------------------------------------------------------------------------ @@ -15,7 +29,7 @@ } KeyBinding::KeyBinding(int codeA, int modsA, int contextA, - const char *cmd0, const char *cmd1) { + const char *cmd0, const char *cmd1) { code = codeA; mods = modsA; context = contextA; @@ -39,151 +53,440 @@ // XpdfParams //------------------------------------------------------------------------ +XpdfParams::XpdfParams(char *cfgFileName) { + GString *fileName; + FILE *f; + int i; + +#if MULTITHREADED + gInitMutex(&xpdfMutex); +#endif + + baseDir = appendToPath(getHomeDir(), ".xpdf"); +#if HAVE_PAPER_H + char *paperName; + const struct paper *paperType; + paperinit(); + if ((paperName = systempapername())) { + paperType = paperinfo(paperName); + psPaperWidth = (int)paperpswidth(paperType); + psPaperHeight = (int)paperpsheight(paperType); + } else { + error(errConfig, -1, "No paper information available - using defaults"); + psPaperWidth = defPaperWidth; + psPaperHeight = defPaperHeight; + } + paperdone(); +#else + psPaperWidth = defPaperWidth; + psPaperHeight = defPaperHeight; +#endif + psCrop = gTrue; + psFile = NULL; + initialZoom = new GString("125"); + continuousView = gFalse; + launchCommand = NULL; + urlCommand = NULL; + movieCommand = NULL; + createDefaultKeyBindings(); + + // look for a user config file, then a system-wide config file + f = NULL; + fileName = NULL; + if (cfgFileName && cfgFileName[0]) { + fileName = new GString(cfgFileName); + if (!(f = fopen(fileName->getCString(), "r"))) { + delete fileName; + } + } + if (!f) { + fileName = appendToPath(getHomeDir(), xpdfUserConfigFile); + if (!(f = fopen(fileName->getCString(), "r"))) { + delete fileName; + } + } + if (!f) { + fileName = new GString(xpdfSysConfigFile); + if (!(f = fopen(fileName->getCString(), "r"))) { + delete fileName; + } + } + if (f) { + parseFile(fileName, f); + delete fileName; + fclose(f); + } +} + +XpdfParams::~XpdfParams() { + if (psFile) { + delete psFile; + } + + delete initialZoom; + if (launchCommand) { + delete launchCommand; + } + if (urlCommand) { + delete urlCommand; + } + if (movieCommand) { + delete movieCommand; + } + deleteGList(keyBindings, KeyBinding); + +#if MULTITHREADED + gDestroyMutex(&xpdfMutex); +#endif +} + GList *XpdfParams::getKeyBinding(int code, int mods, int context) { KeyBinding *binding; GList *cmds; int modMask; int i, j; - gLockMutex(&keyMutex); + lockXpdfParams; cmds = NULL; // for ASCII chars, ignore the shift modifier modMask = code <= 0xff ? ~xpdfKeyModShift : ~0; for (i = 0; i < keyBindings->getLength(); ++i) { binding = (KeyBinding *)keyBindings->get(i); if (binding->code == code && - (binding->mods & modMask) == (mods & modMask) && - (~binding->context | context) == ~0) { + (binding->mods & modMask) == (mods & modMask) && + (~binding->context | context) == ~0) { cmds = new GList(); for (j = 0; j < binding->cmds->getLength(); ++j) { - cmds->append(((GString *)binding->cmds->get(j))->copy()); + cmds->append(((GString *)binding->cmds->get(j))->copy()); } break; } } - gUnlockMutex(&keyMutex); + unlockXpdfParams; return cmds; } +void XpdfParams::parseCommand(const char *cmdName, GString **val, + GList *tokens, GString *fileName, int line) { + if (tokens->getLength() != 2) { + error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", + cmdName, fileName, line); + return; + } + if (*val) { + delete *val; + } + *val = ((GString *)tokens->get(1))->copy(); +} + +void XpdfParams::parseYesNo(const char *cmdName, GBool *flag, + GList *tokens, GString *fileName, int line) { + GString *tok; + + if (tokens->getLength() != 2) { + error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", + cmdName, fileName, line); + return; + } + tok = (GString *)tokens->get(1); + if (!parseYesNo2(tok->getCString(), flag)) { + error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", + cmdName, fileName, line); + } +} + +GBool XpdfParams::parseYesNo2(char *token, GBool *flag) { + if (!strcmp(token, "yes")) { + *flag = gTrue; + } else if (!strcmp(token, "no")) { + *flag = gFalse; + } else { + return gFalse; + } + return gTrue; +} + +void XpdfParams::parsePSFile(GList *tokens, GString *fileName, int line) { + if (tokens->getLength() != 2) { + error(errConfig, -1, "Bad 'psFile' config file command ({0:t}:{1:d})", + fileName, line); + return; + } + if (psFile) { + delete psFile; + } + psFile = ((GString *)tokens->get(1))->copy(); +} + +void XpdfParams::parseInitialZoom(GList *tokens, + GString *fileName, int line) { + if (tokens->getLength() != 2) { + error(errConfig, -1, "Bad 'initialZoom' config file command ({0:t}:{1:d})", + fileName, line); + return; + } + delete initialZoom; + initialZoom = ((GString *)tokens->get(1))->copy(); +} + +void XpdfParams::parseFile(GString *fileName, FILE *f) { + int line; + char buf[512]; + + line = 1; + while (getLine(buf, sizeof(buf) - 1, f)) { + parseLine(buf, fileName, line); + ++line; + } +} + +void XpdfParams::parseLine(char *buf, GString *fileName, int line) { + GList *tokens; + GString *cmd, *incFile; + char *p1, *p2; + FILE *f2; + + // break the line into tokens + tokens = new GList(); + p1 = buf; + while (*p1) { + for (; *p1 && isspace(*p1); ++p1) ; + if (!*p1) { + break; + } + if (*p1 == '"' || *p1 == '\'') { + for (p2 = p1 + 1; *p2 && *p2 != *p1; ++p2) ; + ++p1; + } else { + for (p2 = p1 + 1; *p2 && !isspace(*p2); ++p2) ; + } + tokens->append(new GString(p1, (int)(p2 - p1))); + p1 = *p2 ? p2 + 1 : p2; + } + + // parse the line + if (tokens->getLength() > 0 && + ((GString *)tokens->get(0))->getChar(0) != '#') { + cmd = (GString *)tokens->get(0); + if (!cmd->cmp("include")) { + if (tokens->getLength() == 2) { + incFile = (GString *)tokens->get(1); + if ((f2 = openFile(incFile->getCString(), "r"))) { + parseFile(incFile, f2); + fclose(f2); + } else { + error(errConfig, -1, + "Couldn't find included config file: '{0:t}' ({1:t}:{2:d})", + incFile, fileName, line); + } + } else { + error(errConfig, -1, "Bad 'include' config file command ({0:t}:{1:d})", + fileName, line); + } + } else if (!cmd->cmp("psFile")) { + parsePSFile(tokens, fileName, line); + } else if (!cmd->cmp("psCrop")) { + parseYesNo("psCrop", &psCrop, tokens, fileName, line); + } else if (!cmd->cmp("psDuplex")) { + parseYesNo("psDuplex", &psDuplex, tokens, fileName, line); + } else if (!cmd->cmp("initialZoom")) { + parseInitialZoom(tokens, fileName, line); + } else if (!cmd->cmp("continuousView")) { + parseYesNo("continuousView", &continuousView, tokens, fileName, line); + } else if (!cmd->cmp("launchCommand")) { + parseCommand("launchCommand", &launchCommand, tokens, fileName, line); + } else if (!cmd->cmp("urlCommand")) { + parseCommand("urlCommand", &urlCommand, tokens, fileName, line); + } else if (!cmd->cmp("movieCommand")) { + parseCommand("movieCommand", &movieCommand, tokens, fileName, line); + } + } + + deleteGList(tokens, GString); +} + void XpdfParams::createDefaultKeyBindings() { keyBindings = new GList(); //----- mouse buttons keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress1, xpdfKeyModNone, - xpdfKeyContextAny, "startSelection")); + xpdfKeyContextAny, "startSelection")); keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease1, xpdfKeyModNone, - xpdfKeyContextAny, "endSelection", - "followLinkNoSel")); + xpdfKeyContextAny, "endSelection", + "followLinkNoSel")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress2, xpdfKeyModNone, - xpdfKeyContextAny, "startPan")); + xpdfKeyContextAny, "startPan")); keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease2, xpdfKeyModNone, - xpdfKeyContextAny, "endPan")); + xpdfKeyContextAny, "endPan")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress3, xpdfKeyModNone, - xpdfKeyContextAny, "postPopupMenu")); + xpdfKeyContextAny, "postPopupMenu")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress4, xpdfKeyModNone, - xpdfKeyContextAny, - "scrollUpPrevPage(16)")); + xpdfKeyContextAny, + "scrollUpPrevPage(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress5, xpdfKeyModNone, - xpdfKeyContextAny, - "scrollDownNextPage(16)")); + xpdfKeyContextAny, + "scrollDownNextPage(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress6, xpdfKeyModNone, - xpdfKeyContextAny, "scrollLeft(16)")); + xpdfKeyContextAny, "scrollLeft(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress7, xpdfKeyModNone, - xpdfKeyContextAny, "scrollRight(16)")); + xpdfKeyContextAny, "scrollRight(16)")); //----- keys keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModCtrl, - xpdfKeyContextAny, "gotoPage(1)")); + xpdfKeyContextAny, "gotoPage(1)")); keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModNone, - xpdfKeyContextAny, "scrollToTopLeft")); + xpdfKeyContextAny, "scrollToTopLeft")); keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModCtrl, - xpdfKeyContextAny, "gotoLastPage")); + xpdfKeyContextAny, "gotoLastPage")); keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModNone, - xpdfKeyContextAny, - "scrollToBottomRight")); + xpdfKeyContextAny, + "scrollToBottomRight")); keyBindings->append(new KeyBinding(xpdfKeyCodePgUp, xpdfKeyModNone, - xpdfKeyContextAny, "pageUp")); + xpdfKeyContextAny, "pageUp")); keyBindings->append(new KeyBinding(xpdfKeyCodeBackspace, xpdfKeyModNone, - xpdfKeyContextAny, "pageUp")); + xpdfKeyContextAny, "pageUp")); keyBindings->append(new KeyBinding(xpdfKeyCodeDelete, xpdfKeyModNone, - xpdfKeyContextAny, "pageUp")); + xpdfKeyContextAny, "pageUp")); keyBindings->append(new KeyBinding(xpdfKeyCodePgDn, xpdfKeyModNone, - xpdfKeyContextAny, "pageDown")); + xpdfKeyContextAny, "pageDown")); keyBindings->append(new KeyBinding(' ', xpdfKeyModNone, - xpdfKeyContextAny, "pageDown")); + xpdfKeyContextAny, "pageDown")); keyBindings->append(new KeyBinding(xpdfKeyCodeLeft, xpdfKeyModNone, - xpdfKeyContextAny, "scrollLeft(16)")); + xpdfKeyContextAny, "scrollLeft(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeRight, xpdfKeyModNone, - xpdfKeyContextAny, "scrollRight(16)")); + xpdfKeyContextAny, "scrollRight(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeUp, xpdfKeyModNone, - xpdfKeyContextAny, "scrollUp(16)")); + xpdfKeyContextAny, "scrollUp(16)")); keyBindings->append(new KeyBinding(xpdfKeyCodeDown, xpdfKeyModNone, - xpdfKeyContextAny, "scrollDown(16)")); + xpdfKeyContextAny, "scrollDown(16)")); keyBindings->append(new KeyBinding('o', xpdfKeyModNone, - xpdfKeyContextAny, "open")); + xpdfKeyContextAny, "open")); keyBindings->append(new KeyBinding('O', xpdfKeyModNone, - xpdfKeyContextAny, "open")); + xpdfKeyContextAny, "open")); keyBindings->append(new KeyBinding('r', xpdfKeyModNone, - xpdfKeyContextAny, "reload")); + xpdfKeyContextAny, "reload")); keyBindings->append(new KeyBinding('R', xpdfKeyModNone, - xpdfKeyContextAny, "reload")); + xpdfKeyContextAny, "reload")); keyBindings->append(new KeyBinding('f', xpdfKeyModNone, - xpdfKeyContextAny, "find")); + xpdfKeyContextAny, "find")); keyBindings->append(new KeyBinding('F', xpdfKeyModNone, - xpdfKeyContextAny, "find")); + xpdfKeyContextAny, "find")); keyBindings->append(new KeyBinding('f', xpdfKeyModCtrl, - xpdfKeyContextAny, "find")); + xpdfKeyContextAny, "find")); keyBindings->append(new KeyBinding('g', xpdfKeyModCtrl, - xpdfKeyContextAny, "findNext")); + xpdfKeyContextAny, "findNext")); keyBindings->append(new KeyBinding('p', xpdfKeyModCtrl, - xpdfKeyContextAny, "print")); + xpdfKeyContextAny, "print")); keyBindings->append(new KeyBinding('n', xpdfKeyModNone, - xpdfKeyContextScrLockOff, "nextPage")); + xpdfKeyContextScrLockOff, "nextPage")); keyBindings->append(new KeyBinding('N', xpdfKeyModNone, - xpdfKeyContextScrLockOff, "nextPage")); + xpdfKeyContextScrLockOff, "nextPage")); keyBindings->append(new KeyBinding('n', xpdfKeyModNone, - xpdfKeyContextScrLockOn, - "nextPageNoScroll")); + xpdfKeyContextScrLockOn, + "nextPageNoScroll")); keyBindings->append(new KeyBinding('N', xpdfKeyModNone, - xpdfKeyContextScrLockOn, - "nextPageNoScroll")); + xpdfKeyContextScrLockOn, + "nextPageNoScroll")); keyBindings->append(new KeyBinding('p', xpdfKeyModNone, - xpdfKeyContextScrLockOff, "prevPage")); + xpdfKeyContextScrLockOff, "prevPage")); keyBindings->append(new KeyBinding('P', xpdfKeyModNone, - xpdfKeyContextScrLockOff, "prevPage")); + xpdfKeyContextScrLockOff, "prevPage")); keyBindings->append(new KeyBinding('p', xpdfKeyModNone, - xpdfKeyContextScrLockOn, - "prevPageNoScroll")); + xpdfKeyContextScrLockOn, + "prevPageNoScroll")); keyBindings->append(new KeyBinding('P', xpdfKeyModNone, - xpdfKeyContextScrLockOn, - "prevPageNoScroll")); + xpdfKeyContextScrLockOn, + "prevPageNoScroll")); keyBindings->append(new KeyBinding('v', xpdfKeyModNone, - xpdfKeyContextAny, "goForward")); + xpdfKeyContextAny, "goForward")); keyBindings->append(new KeyBinding('b', xpdfKeyModNone, - xpdfKeyContextAny, "goBackward")); + xpdfKeyContextAny, "goBackward")); keyBindings->append(new KeyBinding('g', xpdfKeyModNone, - xpdfKeyContextAny, "focusToPageNum")); + xpdfKeyContextAny, "focusToPageNum")); keyBindings->append(new KeyBinding('0', xpdfKeyModNone, - xpdfKeyContextAny, "zoomPercent(125)")); + xpdfKeyContextAny, "zoomPercent(125)")); keyBindings->append(new KeyBinding('+', xpdfKeyModNone, - xpdfKeyContextAny, "zoomIn")); + xpdfKeyContextAny, "zoomIn")); keyBindings->append(new KeyBinding('-', xpdfKeyModNone, - xpdfKeyContextAny, "zoomOut")); + xpdfKeyContextAny, "zoomOut")); keyBindings->append(new KeyBinding('z', xpdfKeyModNone, - xpdfKeyContextAny, "zoomFitPage")); + xpdfKeyContextAny, "zoomFitPage")); keyBindings->append(new KeyBinding('w', xpdfKeyModNone, - xpdfKeyContextAny, "zoomFitWidth")); + xpdfKeyContextAny, "zoomFitWidth")); keyBindings->append(new KeyBinding('f', xpdfKeyModAlt, - xpdfKeyContextAny, - "toggleFullScreenMode")); + xpdfKeyContextAny, + "toggleFullScreenMode")); keyBindings->append(new KeyBinding('l', xpdfKeyModCtrl, - xpdfKeyContextAny, "redraw")); + xpdfKeyContextAny, "redraw")); keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl, - xpdfKeyContextAny, "closeWindow")); + xpdfKeyContextAny, "closeWindow")); keyBindings->append(new KeyBinding('?', xpdfKeyModNone, - xpdfKeyContextAny, "about")); + xpdfKeyContextAny, "about")); keyBindings->append(new KeyBinding('q', xpdfKeyModNone, - xpdfKeyContextAny, "quit")); + xpdfKeyContextAny, "quit")); keyBindings->append(new KeyBinding('Q', xpdfKeyModNone, - xpdfKeyContextAny, "quit")); + xpdfKeyContextAny, "quit")); +} + +GString *XpdfParams::getPSFile() { + GString *s; + + lockXpdfParams; + s = psFile ? psFile->copy() : (GString *)NULL; + unlockXpdfParams; + return s; +} + +GBool XpdfParams::getPSCrop() { + GBool f; + + lockXpdfParams; + f = psCrop; + unlockXpdfParams; + return f; +} + +GBool XpdfParams::getPSDuplex() { + GBool f; + + lockXpdfParams; + f = psDuplex; + unlockXpdfParams; + return f; +} + +GString *XpdfParams::getInitialZoom() { + GString *s; + + lockXpdfParams; + s = initialZoom->copy(); + unlockXpdfParams; + return s; +} + +GBool XpdfParams::getContinuousView() { + GBool f; + + lockXpdfParams; + f = continuousView; + unlockXpdfParams; + return f; +} + +int XpdfParams::getPSPaperWidth() { + int w; + + lockXpdfParams; + w = psPaperWidth; + unlockXpdfParams; + return w; +} + +int XpdfParams::getPSPaperHeight() { + int h; + + lockXpdfParams; + h = psPaperHeight; + unlockXpdfParams; + return h; } diff -Nru xpdf-3.03/debian/code/XPDFParams.h xpdf-3.03/debian/code/XPDFParams.h --- xpdf-3.03/debian/code/XPDFParams.h 2013-09-04 15:07:25.000000000 +0000 +++ xpdf-3.03/debian/code/XPDFParams.h 2013-09-10 16:31:33.000000000 +0000 @@ -74,23 +74,47 @@ class XpdfParams { public: - XpdfParams() { -#if MULTITHREADED - gInitMutex(&keyMutex); -#endif - createDefaultKeyBindings(); - } - ~XpdfParams() { - deleteGList(keyBindings, KeyBinding); - } - GList *getKeyBinding(int code, int mods, int context); + XpdfParams(char *cfgFileName); + ~XpdfParams(); void createDefaultKeyBindings(); + GList *getKeyBinding(int code, int mods, int context); + GString *getLaunchCommand() { return launchCommand; } + GString *getURLCommand() { return urlCommand; } + GString *getMovieCommand() { return movieCommand; } + GString *getPSFile(); + GBool getPSCrop(); + GBool getPSDuplex(); + GString *getInitialZoom(); + GBool getContinuousView(); + int getPSPaperWidth(); + int getPSPaperHeight(); private: + void parseCommand(const char *cmdName, GString **val, + GList *tokens, GString *fileName, int line); + void parseYesNo(const char *cmdName, GBool *flag, + GList *tokens, GString *fileName, int line); + GBool parseYesNo2(char *token, GBool *flag); + void parsePSFile(GList *tokens, GString *fileName, int line); + void parseInitialZoom(GList *tokens, GString *fileName, int line); + void parseFile(GString *fileName, FILE *f); + void parseLine(char *buf, GString *fileName, int line); + #if MULTITHREADED - GMutex keyMutex; + GMutex xpdfMutex; #endif - GList *keyBindings; // key & mouse button bindings [KeyBinding] + GString *baseDir; + GString *psFile; + int psPaperWidth; + int psPaperHeight; + GBool psCrop; + GBool psDuplex; + GString *initialZoom; + GBool continuousView; + GString *launchCommand; + GString *urlCommand; + GString *movieCommand; + GList *keyBindings; }; extern XpdfParams *xpdfParams; diff -Nru xpdf-3.03/debian/patches/poppler-params.patch xpdf-3.03/debian/patches/poppler-params.patch --- xpdf-3.03/debian/patches/poppler-params.patch 2013-09-04 15:06:24.000000000 +0000 +++ xpdf-3.03/debian/patches/poppler-params.patch 2013-09-11 06:48:01.000000000 +0000 @@ -3,127 +3,76 @@ Bug-Debian: http://bugs.debian.org/640515 Bug-Ubuntu: https://bugs.launchpad.net/bugs/943195 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1205732 -Last-Update: 2013-09-04 +Last-Update: 2013-09-11 --- a/xpdf/PDFCore.cc +++ b/xpdf/PDFCore.cc -@@ -86,7 +86,7 @@ +@@ -18,6 +18,7 @@ + #include "GString.h" + #include "GList.h" + #include "GlobalParams.h" ++#include "XPDFParams.h" + #include "Splash.h" + #include "SplashBitmap.h" + #include "SplashPattern.h" +@@ -86,7 +87,7 @@ int i; - + doc = NULL; - continuousMode = globalParams->getContinuousView(); -+ continuousMode = NULL; ++ continuousMode = xpdfParams->getContinuousView(); drawAreaWidth = drawAreaHeight = 0; maxPageW = totalDocH = 0; pageY = NULL; --- a/xpdf/XPDFCore.cc +++ b/xpdf/XPDFCore.cc -@@ -116,7 +116,7 @@ +@@ -22,6 +22,7 @@ + #include "GList.h" + #include "Error.h" + #include "GlobalParams.h" ++#include "XPDFParams.h" + #include "PDFDoc.h" + #include "Link.h" + #include "FileSpec.h" +@@ -116,7 +117,7 @@ if (fullScreen) { zoom = zoomPage; } else { - initialZoom = globalParams->getInitialZoom(); -+ initialZoom = new GString("125"); ++ initialZoom = xpdfParams->getInitialZoom();; if (!initialZoom->cmp("page")) { zoom = zoomPage; } else if (!initialZoom->cmp("width")) { -@@ -567,35 +567,22 @@ +@@ -567,9 +568,9 @@ #else fileName->append(" &"); #endif - if (globalParams->getLaunchCommand()) { -- fileName->insert(0, ' '); ++ if (xpdfParams->getLaunchCommand()) { + fileName->insert(0, ' '); - fileName->insert(0, globalParams->getLaunchCommand()); -- errcode = system(fileName->getCString()); -+ msg = new GString("About to execute the command:\n"); -+ msg->append(fileName); -+ if (doQuestionDialog("Launching external application", msg)) { -+ errcode = system(fileName->getCString()); ++ fileName->insert(0, xpdfParams->getLaunchCommand()); + errcode = system(fileName->getCString()); if (errcode != 0) { error(errInternal, -1 , "non-zero error code returned by system call"); - } -- } else { -- msg = new GString("About to execute the command:\n"); -- msg->append(fileName); -- if (doQuestionDialog("Launching external application", msg)) { -- errcode = system(fileName->getCString()); -- if (errcode != 0) { -- error(errInternal, -1 , "non-zero error code returned by system call"); -- } -- } -- delete msg; - } -+ delete msg; - delete fileName; - } - break; +@@ -591,7 +592,7 @@ // URI action case actionURI: - if (!(cmd = globalParams->getURLCommand())) { -- error(errConfig, -1, "No urlCommand defined in config file"); -- break; -- } -- runCommand(cmd, ((LinkURI *)action)->getURI()); -+ error(errConfig, -1, "No urlCommand defined in config file"); - break; - - // Named action -@@ -629,53 +616,7 @@ ++ if (!(cmd = xpdfParams->getURLCommand())) { + error(errConfig, -1, "No urlCommand defined in config file"); + break; + } +@@ -629,7 +630,7 @@ // Movie action case actionMovie: - if (!(cmd = globalParams->getMovieCommand())) { -- error(errConfig, -1, "No movieCommand defined in config file"); -- break; -- } -- if (((LinkMovie *)action)->hasAnnotRef()) { -- doc->getXRef()->fetch(((LinkMovie *)action)->getAnnotRef()->num, -- ((LinkMovie *)action)->getAnnotRef()->gen, -- &movieAnnot); -- } else { -- //~ need to use the correct page num here -- doc->getCatalog()->getPage(topPage)->getAnnots(&obj1); -- if (obj1.isArray()) { -- for (i = 0; i < obj1.arrayGetLength(); ++i) { -- if (obj1.arrayGet(i, &movieAnnot)->isDict()) { -- if (movieAnnot.dictLookup("Subtype", &obj2)->isName("Movie")) { -- obj2.free(); -- break; -- } -- obj2.free(); -- } -- movieAnnot.free(); -- } -- obj1.free(); -- } -- } -- if (movieAnnot.isDict()) { -- if (movieAnnot.dictLookup("Movie", &obj1)->isDict()) { -- if (obj1.dictLookup("F", &obj2)) { -- if (getFileSpecNameForPlatform(&obj2, &obj3)) { -- fileName = obj3.getString()->copy(); -- obj3.free(); -- if (!isAbsolutePath(fileName->getCString())) { -- fileName2 = appendToPath( -- grabPath(doc->getFileName()->getCString()), -- fileName->getCString()); -- delete fileName; -- fileName = fileName2; -- } -- runCommand(cmd, fileName); -- delete fileName; -- } -- obj2.free(); -- } -- obj1.free(); -- } -- } -- movieAnnot.free(); -+ error(errConfig, -1, "No movieCommand defined in config file"); - break; - - // unknown action type ++ if (!(cmd = xpdfParams->getMovieCommand())) { + error(errConfig, -1, "No movieCommand defined in config file"); + break; + } --- a/xpdf/XPDFViewer.cc +++ b/xpdf/XPDFViewer.cc @@ -33,6 +33,7 @@ @@ -152,33 +101,25 @@ viewer->getModifiers( event->xkey.state), viewer->getContext( -@@ -3523,16 +3524,6 @@ - XtSetArg(args[n], XmNcancelButton, cancelBtn); ++n; +@@ -3524,7 +3525,7 @@ XtSetValues(printDialog, args, n); -- //----- initial values + //----- initial values - if ((psFileName = globalParams->getPSFile())) { -- if (psFileName->getChar(0) == '|') { -- XmTextFieldSetString(printCmdText, -- psFileName->getCString() + 1); -- } else { -- XmTextFieldSetString(printFileText, psFileName->getCString()); -- } -- delete psFileName; -- } - } - - void XPDFViewer::printAllPagesBtnCbk(Widget widget, -@@ -3596,7 +3587,7 @@ ++ if ((psFileName = xpdfParams->getPSFile())) { + if (psFileName->getChar(0) == '|') { + XmTextFieldSetString(printCmdText, + psFileName->getCString() + 1); +@@ -3596,7 +3597,7 @@ char *p; doc = core->getDoc(); - psFileName = globalParams->getPSFile(); -+ psFileName = NULL; ++ psFileName = xpdfParams->getPSFile(); if (!psFileName || psFileName->getChar(0) == '|') { pdfFileName = doc->getFileName(); p = pdfFileName->getCString() + pdfFileName->getLength() - 4; -@@ -3711,12 +3702,12 @@ +@@ -3711,12 +3712,13 @@ // Normal print mode if (printAll && !printBack) { @@ -187,15 +128,16 @@ - psModePS); + psOut = new PSOutputDev(psFileName->getCString(), doc, + NULL, firstPage, lastPage, -+ psModePS, defPaperWidth, defPaperHeight, gFalse); ++ psModePS, xpdfParams->getPSPaperWidth(), ++ xpdfParams->getPSPaperHeight(), xpdfParams->getPSDuplex()); if (psOut->isOk()) { doc->displayPages(psOut, firstPage, lastPage, 72, 72, - 0, gTrue, globalParams->getPSCrop(), gFalse); -+ 0, gTrue, gTrue, gFalse); ++ 0, gTrue, xpdfParams->getPSCrop(), gFalse); } delete psOut; } -@@ -3757,11 +3748,12 @@ +@@ -3757,11 +3759,13 @@ { for (i=beginPage;; i+=step) { @@ -203,11 +145,12 @@ - doc->getCatalog(), NULL, i, i, psModePS); + psOut = new PSOutputDev(psFileName->getCString(), doc, + NULL, i, i, psModePS, -+ defPaperWidth, defPaperHeight, gFalse); ++ xpdfParams->getPSPaperWidth(), ++ xpdfParams->getPSPaperHeight(), xpdfParams->getPSDuplex()); if (psOut->isOk()) { doc->displayPages(psOut, i, i, 72, 72, - 0, gTrue, globalParams->getPSCrop(), gFalse); -+ 0, gTrue, gTrue, gFalse); ++ 0, gTrue, xpdfParams->getPSCrop(), gFalse); } else { @@ -225,7 +168,7 @@ // read config file globalParams = new GlobalParams(cfgFileName); -+ xpdfParams = new XpdfParams(); ++ xpdfParams = new XpdfParams(cfgFileName); globalParams->setupBaseFonts(NULL); - if (contView) { - globalParams->setContinuousView(contView);