From 9ac495d6543dbd65992791bb41d5f8fbf90e549c Mon Sep 17 00:00:00 2001 From: Martin Kretzschmar Date: Mon, 31 Mar 2003 21:55:40 +0000 Subject: [PATCH] Import of Xpdf 2.01 for merge --- pdf/xpdf/FontEncodingTables.cc | 30 +++++++++---------- pdf/xpdf/Outline.cc | 2 +- pdf/xpdf/XPDFApp.cc | 22 ++++++++++---- pdf/xpdf/XPDFApp.h | 1 + pdf/xpdf/XPDFCore.cc | 5 ++-- pdf/xpdf/XPDFCore.h | 1 + pdf/xpdf/XPDFViewer.cc | 55 +++++++++++++++++++++------------- pdf/xpdf/XPDFViewer.h | 2 +- 8 files changed, 72 insertions(+), 46 deletions(-) diff --git a/pdf/xpdf/FontEncodingTables.cc b/pdf/xpdf/FontEncodingTables.cc index bd5f9cff..6deff95c 100644 --- a/pdf/xpdf/FontEncodingTables.cc +++ b/pdf/xpdf/FontEncodingTables.cc @@ -184,32 +184,32 @@ char *macRomanEncoding[256] = { "trademark", "acute", "dieresis", - NULL, + "notequal", "AE", "Oslash", - NULL, + "infinity", "plusminus", - NULL, - NULL, + "lessequal", + "greaterequal", "yen", "mu", - NULL, - NULL, - NULL, - NULL, - NULL, + "partialdiff", + "summation", + "product", + "pi", + "integral", "ordfeminine", "ordmasculine", - NULL, + "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", - NULL, + "radical", "florin", - NULL, - NULL, + "approxequal", + "Delta", "guillemotleft", "guillemotright", "ellipsis", @@ -226,7 +226,7 @@ char *macRomanEncoding[256] = { "quoteleft", "quoteright", "divide", - NULL, + "lozenge", "ydieresis", "Ydieresis", "fraction", @@ -251,7 +251,7 @@ char *macRomanEncoding[256] = { "Igrave", "Oacute", "Ocircumflex", - NULL, + "apple", "Ograve", "Uacute", "Ucircumflex", diff --git a/pdf/xpdf/Outline.cc b/pdf/xpdf/Outline.cc index 256d38d4..267c6a04 100644 --- a/pdf/xpdf/Outline.cc +++ b/pdf/xpdf/Outline.cc @@ -96,7 +96,7 @@ OutlineItem::OutlineItem(Dict *dict, XRef *xrefA) { OutlineItem::~OutlineItem() { close(); if (title) { - delete title; + gfree(title); } if (action) { delete action; diff --git a/pdf/xpdf/XPDFApp.cc b/pdf/xpdf/XPDFApp.cc index e456310b..864dabb4 100644 --- a/pdf/xpdf/XPDFApp.cc +++ b/pdf/xpdf/XPDFApp.cc @@ -306,6 +306,12 @@ void XPDFApp::remoteOpenAtDest(GString *fileName, GString *dest, GBool raise) { XFlush(display); } +void XPDFApp::remoteReload(GBool raise) { + XChangeProperty(display, remoteXWin, remoteAtom, remoteAtom, 8, + PropModeReplace, raise ? (Guchar *)"L" : (Guchar *)"l", 2); + XFlush(display); +} + void XPDFApp::remoteRaise() { XChangeProperty(display, remoteXWin, remoteAtom, remoteAtom, 8, PropModeReplace, (Guchar *)"r", 2); @@ -348,12 +354,6 @@ void XPDFApp::remoteMsgCbk(Widget widget, XtPointer ptr, return; } - // raise window - if (cmd[0] == 'D' || cmd[0] == 'r'){ - XMapRaised(app->display, XtWindow(app->remoteWin)); - XFlush(app->display); - } - // display file / page if (cmd[0] == 'd' || cmd[0] == 'D') { p = cmd + 2; @@ -379,8 +379,18 @@ void XPDFApp::remoteMsgCbk(Widget widget, XtPointer ptr, delete destName; } + // reload + } else if (cmd[0] == 'l' || cmd[0] == 'L') { + app->remoteViewer->reloadFile(); + // quit } else if (cmd[0] == 'q') { app->quit(); } + + // raise window + if (cmd[0] == 'D' || cmd[0] == 'L' || cmd[0] == 'r'){ + XMapRaised(app->display, XtWindow(app->remoteWin)); + XFlush(app->display); + } } diff --git a/pdf/xpdf/XPDFApp.h b/pdf/xpdf/XPDFApp.h index 4875456e..d4841e7b 100644 --- a/pdf/xpdf/XPDFApp.h +++ b/pdf/xpdf/XPDFApp.h @@ -54,6 +54,7 @@ public: GBool remoteServerRunning(); void remoteOpen(GString *fileName, int page, GBool raise); void remoteOpenAtDest(GString *fileName, GString *dest, GBool raise); + void remoteReload(GBool raise); void remoteRaise(); void remoteQuit(); diff --git a/pdf/xpdf/XPDFCore.cc b/pdf/xpdf/XPDFCore.cc index 8376ce97..554154cb 100644 --- a/pdf/xpdf/XPDFCore.cc +++ b/pdf/xpdf/XPDFCore.cc @@ -150,6 +150,7 @@ XPDFCore::XPDFCore(Widget shellA, Widget parentWidgetA, zoom = maxZoom; } } + delete initialZoom; scrollX = 0; scrollY = 0; @@ -961,7 +962,7 @@ GString *XPDFCore::extractText(int pageNum, if (!doc->okToCopy()) { return NULL; } - textOut = new TextOutputDev(NULL, gFalse, gFalse); + textOut = new TextOutputDev(NULL, gFalse, gFalse, gFalse); if (!textOut->isOk()) { delete textOut; return NULL; @@ -1275,7 +1276,7 @@ void XPDFCore::find(char *s) { } // search following pages - textOut = new TextOutputDev(NULL, gFalse, gFalse); + textOut = new TextOutputDev(NULL, gFalse, gFalse, gFalse); if (!textOut->isOk()) { delete textOut; goto done; diff --git a/pdf/xpdf/XPDFCore.h b/pdf/xpdf/XPDFCore.h index 348486f0..cf5308e3 100644 --- a/pdf/xpdf/XPDFCore.h +++ b/pdf/xpdf/XPDFCore.h @@ -169,6 +169,7 @@ public: int getDrawAreaWidth() { return drawAreaWidth; } int getDrawAreaHeight() { return drawAreaHeight; } void setBusyCursor(GBool busy); + Cursor getBusyCursor() { return busyCursor; } void takeFocus(); void enableHyperlinks(GBool on) { hyperlinksEnabled = on; } void enableSelect(GBool on) { selectEnabled = on; } diff --git a/pdf/xpdf/XPDFViewer.cc b/pdf/xpdf/XPDFViewer.cc index a8c8f8f0..83f8c778 100644 --- a/pdf/xpdf/XPDFViewer.cc +++ b/pdf/xpdf/XPDFViewer.cc @@ -1560,6 +1560,7 @@ void XPDFViewer::initAboutDialog() { int n, i; XmString s; char buf[20]; + XmFontListEntry entry; //----- dialog n = 0; @@ -1600,18 +1601,24 @@ void XPDFViewer::initAboutDialog() { XtManageChild(col); //----- fonts - aboutBigFont = XmFontListAppendEntry(NULL, - XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, XmFONT_IS_FONT, - XLoadQueryFont(display, - "-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1"))); - aboutVersionFont = XmFontListAppendEntry(NULL, - XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, XmFONT_IS_FONT, - XLoadQueryFont(display, - "-*-times-medium-r-normal--16-*-*-*-*-*-iso8859-1"))); - aboutFixedFont = XmFontListAppendEntry(NULL, - XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, XmFONT_IS_FONT, - XLoadQueryFont(display, - "-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1"))); + entry = XmFontListEntryLoad( + display, + "-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1", + XmFONT_IS_FONT, XmFONTLIST_DEFAULT_TAG); + aboutBigFont = XmFontListAppendEntry(NULL, entry); + XmFontListEntryFree(&entry); + entry = XmFontListEntryLoad( + display, + "-*-times-medium-r-normal--16-*-*-*-*-*-iso8859-1", + XmFONT_IS_FONT, XmFONTLIST_DEFAULT_TAG); + aboutVersionFont = XmFontListAppendEntry(NULL, entry); + XmFontListEntryFree(&entry); + entry = XmFontListEntryLoad( + display, + "-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1", + XmFONT_IS_FONT, XmFONTLIST_DEFAULT_TAG); + aboutFixedFont = XmFontListAppendEntry(NULL, entry); + XmFontListEntryFree(&entry); //----- heading n = 0; @@ -1816,7 +1823,10 @@ void XPDFViewer::findFindCbk(Widget widget, XtPointer ptr, XtPointer callData) { XPDFViewer *viewer = (XPDFViewer *)ptr; + XDefineCursor(viewer->display, XtWindow(viewer->findDialog), + viewer->core->getBusyCursor()); viewer->core->find(XmTextFieldGetString(viewer->findText)); + XUndefineCursor(viewer->display, XtWindow(viewer->findDialog)); } void XPDFViewer::findCloseCbk(Widget widget, XtPointer ptr, @@ -2052,34 +2062,37 @@ void XPDFViewer::initPrintDialog() { void XPDFViewer::setupPrintDialog() { PDFDoc *doc; char buf[20]; - GString *pdfFileName, *psFileName; + GString *pdfFileName, *psFileName, *psFileName2; char *p; doc = core->getDoc(); - psFileName = globalParams->getPSFile(); + if (psFileName && psFileName->getChar(0) != '|') { XmTextFieldSetString(printFileText, psFileName->getCString()); } else { pdfFileName = doc->getFileName(); p = pdfFileName->getCString() + pdfFileName->getLength() - 4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) { - psFileName = new GString(pdfFileName->getCString(), - pdfFileName->getLength() - 4); + psFileName2 = new GString(pdfFileName->getCString(), + pdfFileName->getLength() - 4); } else { - psFileName = pdfFileName->copy(); + psFileName2 = pdfFileName->copy(); } - psFileName->append(".ps"); - XmTextFieldSetString(printFileText, psFileName->getCString()); - delete psFileName; + psFileName2->append(".ps"); + XmTextFieldSetString(printFileText, psFileName2->getCString()); + delete psFileName2; } - psFileName = globalParams->getPSFile(); if (psFileName && psFileName->getChar(0) == '|') { XmTextFieldSetString(printCmdText, psFileName->getCString() + 1); } + if (psFileName) { + delete psFileName; + } + sprintf(buf, "%d", doc->getNumPages()); XmTextFieldSetString(printFirstPage, "1"); XmTextFieldSetString(printLastPage, buf); diff --git a/pdf/xpdf/XPDFViewer.h b/pdf/xpdf/XPDFViewer.h index 77875c41..124650ad 100644 --- a/pdf/xpdf/XPDFViewer.h +++ b/pdf/xpdf/XPDFViewer.h @@ -46,6 +46,7 @@ public: void open(GString *fileName, int pageA, GString *destName); void clear(); + void reloadFile(); Widget getWindow() { return win; } @@ -54,7 +55,6 @@ private: //----- load / display GBool loadFile(GString *fileName, GString *ownerPassword = NULL, GString *userPassword = NULL); - void reloadFile(); void displayPage(int pageA, int zoomA, int rotateA, GBool scrollToTop, GBool addToHist); void displayDest(LinkDest *dest, int zoomA, int rotateA, -- 2.43.5