From: Martin Kretzschmar Date: Sun, 23 Feb 2003 13:35:35 +0000 (+0000) Subject: new widget: table with labels displaying properties of PDFs X-Git-Tag: XPDF_1_01~4 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=939b9d12f2919ceea85575e6b7e1d67874da91a8;p=evince.git new widget: table with labels displaying properties of PDFs * xpdf/pdf-properties-display.c, xpdf/pdf-properties-display.h, xpdf/gpdf-properties-dialog.glade: new widget: table with labels displaying properties of PDFs * xpdf/gpdf-control.cc (has_unicode_marker) (utf16_big_endian_to_utf8, info_dict_get_string) (info_dict_get_date, gpdf_control_process_string_property) (gpdf_control_process_date_property) (gpdf_control_process_properties) (gpdf_control_properties_dialog_response_cb) (verb_FileProperties_cb): new: a PDF properties command * xpdf/Makefile.am: build pdf-properties-display.[ch], install glade file * xpdf/.cvsignore: ignore gpdf-properties-dialog.gladep * xpdf/gpdf-persist-stream.h, xpdf/gpdf-persist-stream.cc (gpdf_persist_stream_get_length): new function * xpdf/gpdf-control-ui.xml: add FileProperties command and menu item inside a "File Items Placeholder" * shell/gpdf-window-ui.xml: add "File Items Placeholder" * configure.in: check for libglade-2.0 * Makefile.am (EXTRA_DIST): don't dist gpdf.mime * xpdf/PDFDoc.cc, xpdf/Function.cc, xpdf/FontFile.cc, goo/parseargs.c: call atof only in the "C" locale --- diff --git a/pdf/goo/parseargs.c b/pdf/goo/parseargs.c index ad8460ae..1f2c986a 100644 --- a/pdf/goo/parseargs.c +++ b/pdf/goo/parseargs.c @@ -6,6 +6,7 @@ * Copyright 1996-2002 Glyph & Cog, LLC */ +#include #include #include #include @@ -117,7 +118,11 @@ static GBool grabArg(ArgDesc *arg, int i, int *argc, char *argv[]) { break; case argFP: if (i + 1 < *argc && isFP(argv[i+1])) { - *(double *)arg->val = atof(argv[i+1]); + { + char *theLocale = setlocale(LC_NUMERIC, "C"); + *(double *)arg->val = atof(argv[i+1]); + setlocale(LC_NUMERIC, theLocale); + } n = 2; } else { ok = gFalse; diff --git a/pdf/xpdf/.cvsignore b/pdf/xpdf/.cvsignore index 6ebaacb4..9df01f32 100644 --- a/pdf/xpdf/.cvsignore +++ b/pdf/xpdf/.cvsignore @@ -9,6 +9,7 @@ gnome-pdf-viewer gpdf gpdf-marshal.c gpdf-marshal.h +gpdf-properties-dialog.gladep pdfimages pdfinfo pdftopbm diff --git a/pdf/xpdf/FontFile.cc b/pdf/xpdf/FontFile.cc index ae585470..56807a4b 100644 --- a/pdf/xpdf/FontFile.cc +++ b/pdf/xpdf/FontFile.cc @@ -11,6 +11,7 @@ #endif #include +#include #include #include #include @@ -2130,7 +2131,11 @@ double Type1CFontFile::getNum(Guchar **ptr, GBool *isFP) { } } while (i < 64); buf[i] = '\0'; - x = atof(buf); + { + char *theLocale = setlocale(LC_NUMERIC, "C"); + x = atof(buf); + setlocale(LC_NUMERIC, theLocale); + } *isFP = gTrue; } else if (b0 == 31) { x = 0; diff --git a/pdf/xpdf/Function.cc b/pdf/xpdf/Function.cc index 64ea60c1..6d70858a 100644 --- a/pdf/xpdf/Function.cc +++ b/pdf/xpdf/Function.cc @@ -11,6 +11,7 @@ #endif #include +#include #include #include #include @@ -1071,7 +1072,11 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { resizeCode(*codePtr); if (isReal) { code[*codePtr].type = psReal; - code[*codePtr].real = atof(tok->getCString()); + { + char *theLocale = setlocale(LC_NUMERIC, "C"); + code[*codePtr].real = atof(tok->getCString()); + setlocale(LC_NUMERIC, theLocale); + } } else { code[*codePtr].type = psInt; code[*codePtr].intg = atoi(tok->getCString()); diff --git a/pdf/xpdf/Makefile.am b/pdf/xpdf/Makefile.am index dbaa4e4e..d346d607 100644 --- a/pdf/xpdf/Makefile.am +++ b/pdf/xpdf/Makefile.am @@ -125,6 +125,8 @@ gnome_pdf_viewer_SOURCES = \ gtkgesture.h \ page-control.c \ page-control.h \ + pdf-properties-display.c \ + pdf-properties-display.h \ $(BUILT_SOURCES) # Font embedding hack for Gnome Print < 2.1.?2? @@ -224,13 +226,11 @@ gpdf-marshal.c: gpdf-marshal.list $(GLIB_GENMARSHAL) stockdir = $(datadir)/pixmaps/gpdf stock_DATA = fitwidth.png -ltk = \ - xpdf-flip.ltk \ - xpdf-top.ltk \ - xpdf.ltk +gladedir = $(datadir)/gpdf/glade +glade_DATA = \ + gpdf-properties-dialog.glade server_in_files = GNOME_PDF.server.in.in - serverdir = $(libdir)/bonobo/servers server_DATA = $(server_in_files:.server.in.in=.server) $(server_in_files:.server.in.in=.server.in): $(server_in_files) diff --git a/pdf/xpdf/PDFDoc.cc b/pdf/xpdf/PDFDoc.cc index 683e4d2d..f3b7f799 100644 --- a/pdf/xpdf/PDFDoc.cc +++ b/pdf/xpdf/PDFDoc.cc @@ -11,6 +11,7 @@ #endif #include +#include #include #include #include @@ -168,7 +169,11 @@ void PDFDoc::checkHeader() { } str->moveStart(i); p = strtok(&hdrBuf[i+5], " \t\n\r"); - pdfVersion = atof(p); + { + char *theLocale = setlocale(LC_NUMERIC, "C"); + pdfVersion = atof(p); + setlocale(LC_NUMERIC, theLocale); + } if (!(hdrBuf[i+5] >= '0' && hdrBuf[i+5] <= '9') || pdfVersion > supportedPDFVersionNum + 0.0001) { error(-1, "PDF version %s -- xpdf supports version %s"