pdf2json 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -0
- data/bin/.gitkeep +0 -0
- data/ext/extconf.rb +30 -0
- data/lib/pdf2json.rb +8 -0
- data/pdf2json-0.52-source/AUTHORS +24 -0
- data/pdf2json-0.52-source/CHANGES +11 -0
- data/pdf2json-0.52-source/Makefile +84 -0
- data/pdf2json-0.52-source/Makefile.in +84 -0
- data/pdf2json-0.52-source/aclocal.m4 +274 -0
- data/pdf2json-0.52-source/aconf-win32.h +86 -0
- data/pdf2json-0.52-source/aconf.h +42 -0
- data/pdf2json-0.52-source/aconf.h.in +41 -0
- data/pdf2json-0.52-source/autom4te.cache/output.0 +6908 -0
- data/pdf2json-0.52-source/autom4te.cache/requests +76 -0
- data/pdf2json-0.52-source/autom4te.cache/traces.0 +466 -0
- data/pdf2json-0.52-source/config.log +1259 -0
- data/pdf2json-0.52-source/config.status +1050 -0
- data/pdf2json-0.52-source/configure +6908 -0
- data/pdf2json-0.52-source/configure.ac +93 -0
- data/pdf2json-0.52-source/doc/pdffonts.1 +130 -0
- data/pdf2json-0.52-source/doc/pdffonts.cat +107 -0
- data/pdf2json-0.52-source/doc/pdffonts.hlp +117 -0
- data/pdf2json-0.52-source/doc/pdfimages.1 +102 -0
- data/pdf2json-0.52-source/doc/pdfimages.cat +92 -0
- data/pdf2json-0.52-source/doc/pdfimages.hlp +101 -0
- data/pdf2json-0.52-source/doc/pdfinfo.1 +158 -0
- data/pdf2json-0.52-source/doc/pdfinfo.cat +119 -0
- data/pdf2json-0.52-source/doc/pdfinfo.hlp +129 -0
- data/pdf2json-0.52-source/doc/pdftoppm.1 +115 -0
- data/pdf2json-0.52-source/doc/pdftoppm.cat +105 -0
- data/pdf2json-0.52-source/doc/pdftoppm.hlp +114 -0
- data/pdf2json-0.52-source/doc/pdftops.1 +229 -0
- data/pdf2json-0.52-source/doc/pdftops.cat +221 -0
- data/pdf2json-0.52-source/doc/pdftops.hlp +231 -0
- data/pdf2json-0.52-source/doc/pdftotext.1 +137 -0
- data/pdf2json-0.52-source/doc/pdftotext.cat +120 -0
- data/pdf2json-0.52-source/doc/pdftotext.hlp +133 -0
- data/pdf2json-0.52-source/doc/sample-xpdfrc +91 -0
- data/pdf2json-0.52-source/doc/xpdf.1 +513 -0
- data/pdf2json-0.52-source/doc/xpdf.cat +476 -0
- data/pdf2json-0.52-source/doc/xpdf.hlp +489 -0
- data/pdf2json-0.52-source/doc/xpdfrc.5 +480 -0
- data/pdf2json-0.52-source/doc/xpdfrc.cat +474 -0
- data/pdf2json-0.52-source/doc/xpdfrc.hlp +479 -0
- data/pdf2json-0.52-source/fofi/.DS_Store +0 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.cc +156 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.h +57 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.cc +994 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.h +36 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.cc +2027 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.h +174 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.cc +252 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.h +59 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.cc +2603 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.h +233 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.o +0 -0
- data/pdf2json-0.52-source/fofi/Makefile +70 -0
- data/pdf2json-0.52-source/fofi/Makefile.dep +0 -0
- data/pdf2json-0.52-source/fofi/Makefile.in +70 -0
- data/pdf2json-0.52-source/fofi/libfofi.a +0 -0
- data/pdf2json-0.52-source/fofi/vms_make.com +0 -0
- data/pdf2json-0.52-source/freetype.win32/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftconfig.h +528 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftheader.h +780 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftmodule.h +32 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftoption.h +733 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftstdlib.h +173 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/freetype.h +3919 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftadvanc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbbox.h +94 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbdf.h +209 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbitmap.h +227 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcache.h +1128 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftchapters.h +103 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcid.h +166 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrdef.h +244 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrors.h +206 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgasp.h +120 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftglyph.h +613 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgxval.h +358 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgzip.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftimage.h +1313 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftincrem.h +353 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlcdfil.h +213 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlist.h +277 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlzw.h +99 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmac.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmm.h +378 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmodapi.h +483 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmoderr.h +155 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftotval.h +203 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftoutln.h +537 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftpfr.h +172 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftrender.h +230 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsizes.h +159 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsnames.h +200 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftstroke.h +716 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsynth.h +80 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsystem.h +347 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttrigon.h +350 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttypes.h +588 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftwinfnt.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftxf86.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/autohint.h +231 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftcalc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdebug.h +250 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdriver.h +422 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftgloadr.h +168 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftmemory.h +380 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftobjs.h +1428 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftpic.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftrfork.h +196 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftserv.h +620 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftstream.h +539 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/fttrace.h +139 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftvalid.h +150 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/internal.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pcftypes.h +56 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/psaux.h +873 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pshints.h +712 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svbdf.h +77 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svcid.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgldict.h +82 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgxval.h +72 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svkern.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svmm.h +104 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svotval.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpfr.h +66 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpostnm.h +79 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpscmap.h +164 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpsinfo.h +92 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svsfnt.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttcmap.h +106 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svtteng.h +53 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttglyf.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svwinfnt.h +50 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svxf86nm.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/sfnt.h +897 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/t1types.h +270 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/tttypes.h +1543 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/t1tables.h +504 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttnameid.h +1247 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttables.h +759 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttags.h +107 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttunpat.h +59 -0
- data/pdf2json-0.52-source/freetype.win32/include/ft2build.h +39 -0
- data/pdf2json-0.52-source/freetype.win32/lib/freetype_a.lib +0 -0
- data/pdf2json-0.52-source/goo/.DS_Store +0 -0
- data/pdf2json-0.52-source/goo/FixedPoint.cc +118 -0
- data/pdf2json-0.52-source/goo/FixedPoint.h +155 -0
- data/pdf2json-0.52-source/goo/FixedPoint.o +0 -0
- data/pdf2json-0.52-source/goo/GHash.cc +380 -0
- data/pdf2json-0.52-source/goo/GHash.h +78 -0
- data/pdf2json-0.52-source/goo/GHash.o +0 -0
- data/pdf2json-0.52-source/goo/GList.cc +97 -0
- data/pdf2json-0.52-source/goo/GList.h +96 -0
- data/pdf2json-0.52-source/goo/GList.o +0 -0
- data/pdf2json-0.52-source/goo/GMutex.h +49 -0
- data/pdf2json-0.52-source/goo/GString.cc +724 -0
- data/pdf2json-0.52-source/goo/GString.cc.fixed +718 -0
- data/pdf2json-0.52-source/goo/GString.h +136 -0
- data/pdf2json-0.52-source/goo/GString.o +0 -0
- data/pdf2json-0.52-source/goo/ImgWriter.o +0 -0
- data/pdf2json-0.52-source/goo/JpegWriter.o +0 -0
- data/pdf2json-0.52-source/goo/Makefile +72 -0
- data/pdf2json-0.52-source/goo/Makefile.dep +0 -0
- data/pdf2json-0.52-source/goo/Makefile.in +72 -0
- data/pdf2json-0.52-source/goo/PNGWriter.o +0 -0
- data/pdf2json-0.52-source/goo/gfile.cc +731 -0
- data/pdf2json-0.52-source/goo/gfile.h +138 -0
- data/pdf2json-0.52-source/goo/gfile.o +0 -0
- data/pdf2json-0.52-source/goo/gmem.cc +264 -0
- data/pdf2json-0.52-source/goo/gmem.h +79 -0
- data/pdf2json-0.52-source/goo/gmem.o +0 -0
- data/pdf2json-0.52-source/goo/gmempp.cc +32 -0
- data/pdf2json-0.52-source/goo/gmempp.o +0 -0
- data/pdf2json-0.52-source/goo/gtypes.h +29 -0
- data/pdf2json-0.52-source/goo/libGoo.a +0 -0
- data/pdf2json-0.52-source/goo/parseargs.c +190 -0
- data/pdf2json-0.52-source/goo/parseargs.h +71 -0
- data/pdf2json-0.52-source/goo/parseargs.o +0 -0
- data/pdf2json-0.52-source/goo/vms_directory.c +214 -0
- data/pdf2json-0.52-source/goo/vms_dirent.h +67 -0
- data/pdf2json-0.52-source/goo/vms_make.com +82 -0
- data/pdf2json-0.52-source/goo/vms_sys_dirent.h +54 -0
- data/pdf2json-0.52-source/goo/vms_unix_time.h +102 -0
- data/pdf2json-0.52-source/goo/vms_unix_times.c +42 -0
- data/pdf2json-0.52-source/goo/vms_unlink.c +22 -0
- data/pdf2json-0.52-source/ms_make.bat +199 -0
- data/pdf2json-0.52-source/splash/.DS_Store +0 -0
- data/pdf2json-0.52-source/splash/Makefile +103 -0
- data/pdf2json-0.52-source/splash/Makefile.dep +0 -0
- data/pdf2json-0.52-source/splash/Makefile.in +103 -0
- data/pdf2json-0.52-source/splash/Splash.cc +3310 -0
- data/pdf2json-0.52-source/splash/Splash.h +293 -0
- data/pdf2json-0.52-source/splash/Splash.o +0 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.cc +188 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.h +64 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.o +0 -0
- data/pdf2json-0.52-source/splash/SplashClip.cc +382 -0
- data/pdf2json-0.52-source/splash/SplashClip.h +107 -0
- data/pdf2json-0.52-source/splash/SplashClip.o +0 -0
- data/pdf2json-0.52-source/splash/SplashErrorCodes.h +32 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.cc +357 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.h +58 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.cc +179 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.h +65 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.cc +114 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.h +73 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFont.cc +176 -0
- data/pdf2json-0.52-source/splash/SplashFont.h +104 -0
- data/pdf2json-0.52-source/splash/SplashFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.cc +317 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.h +91 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.cc +55 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.h +60 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.cc +23 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.h +30 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.o +0 -0
- data/pdf2json-0.52-source/splash/SplashGlyphBitmap.h +26 -0
- data/pdf2json-0.52-source/splash/SplashMath.h +89 -0
- data/pdf2json-0.52-source/splash/SplashPath.cc +184 -0
- data/pdf2json-0.52-source/splash/SplashPath.h +121 -0
- data/pdf2json-0.52-source/splash/SplashPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashPattern.cc +40 -0
- data/pdf2json-0.52-source/splash/SplashPattern.h +65 -0
- data/pdf2json-0.52-source/splash/SplashPattern.o +0 -0
- data/pdf2json-0.52-source/splash/SplashScreen.cc +383 -0
- data/pdf2json-0.52-source/splash/SplashScreen.h +56 -0
- data/pdf2json-0.52-source/splash/SplashScreen.o +0 -0
- data/pdf2json-0.52-source/splash/SplashState.cc +165 -0
- data/pdf2json-0.52-source/splash/SplashState.h +103 -0
- data/pdf2json-0.52-source/splash/SplashState.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.cc +287 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.h +57 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.cc +124 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.h +53 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.cc +97 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.h +58 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashTypes.h +132 -0
- data/pdf2json-0.52-source/splash/SplashXPath.cc +438 -0
- data/pdf2json-0.52-source/splash/SplashXPath.h +100 -0
- data/pdf2json-0.52-source/splash/SplashXPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.cc +428 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.h +87 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.o +0 -0
- data/pdf2json-0.52-source/splash/libsplash.a +0 -0
- data/pdf2json-0.52-source/splash/vms_make.com +0 -0
- data/pdf2json-0.52-source/src/.DS_Store +0 -0
- data/pdf2json-0.52-source/src/GVector.h +101 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.cc +1243 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.h +307 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.o +0 -0
- data/pdf2json-0.52-source/src/Makefile +68 -0
- data/pdf2json-0.52-source/src/Makefile.in +68 -0
- data/pdf2json-0.52-source/src/XmlFonts.cc +367 -0
- data/pdf2json-0.52-source/src/XmlFonts.h +91 -0
- data/pdf2json-0.52-source/src/XmlFonts.o +0 -0
- data/pdf2json-0.52-source/src/XmlLinks.cc +101 -0
- data/pdf2json-0.52-source/src/XmlLinks.h +54 -0
- data/pdf2json-0.52-source/src/XmlLinks.o +0 -0
- data/pdf2json-0.52-source/src/pdf2json +0 -0
- data/pdf2json-0.52-source/src/pdf2json.cc +343 -0
- data/pdf2json-0.52-source/src/pdf2json.o +0 -0
- data/pdf2json-0.52-source/src/pdf2xml.dtd +22 -0
- data/pdf2json-0.52-source/src/pdf2xmljson.dtd +9 -0
- data/pdf2json-0.52-source/xpdf/.DS_Store +0 -0
- data/pdf2json-0.52-source/xpdf/Annot.cc +1556 -0
- data/pdf2json-0.52-source/xpdf/Annot.h +142 -0
- data/pdf2json-0.52-source/xpdf/Annot.o +0 -0
- data/pdf2json-0.52-source/xpdf/Array.cc +73 -0
- data/pdf2json-0.52-source/xpdf/Array.h +58 -0
- data/pdf2json-0.52-source/xpdf/Array.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.cc +65 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.h +57 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.cc +4284 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.h +23 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/CMap.cc +408 -0
- data/pdf2json-0.52-source/xpdf/CMap.h +102 -0
- data/pdf2json-0.52-source/xpdf/CMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/Catalog.cc +374 -0
- data/pdf2json-0.52-source/xpdf/Catalog.h +97 -0
- data/pdf2json-0.52-source/xpdf/Catalog.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.cc +540 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.h +117 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharTypes.h +24 -0
- data/pdf2json-0.52-source/xpdf/CompactFontTables.h +464 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.cc +61 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.h +61 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.cc +776 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.h +95 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.o +0 -0
- data/pdf2json-0.52-source/xpdf/Dict.cc +95 -0
- data/pdf2json-0.52-source/xpdf/Dict.h +77 -0
- data/pdf2json-0.52-source/xpdf/Dict.o +0 -0
- data/pdf2json-0.52-source/xpdf/Error.cc +38 -0
- data/pdf2json-0.52-source/xpdf/Error.h +23 -0
- data/pdf2json-0.52-source/xpdf/Error.o +0 -0
- data/pdf2json-0.52-source/xpdf/ErrorCodes.h +36 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.cc +1824 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.h +20 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/Function.cc +1573 -0
- data/pdf2json-0.52-source/xpdf/Function.h +229 -0
- data/pdf2json-0.52-source/xpdf/Function.o +0 -0
- data/pdf2json-0.52-source/xpdf/Gfx.cc +4187 -0
- data/pdf2json-0.52-source/xpdf/Gfx.h +312 -0
- data/pdf2json-0.52-source/xpdf/Gfx.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.cc +1568 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.h +320 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxState.cc +4137 -0
- data/pdf2json-0.52-source/xpdf/GfxState.h +1244 -0
- data/pdf2json-0.52-source/xpdf/GfxState.o +0 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc +2924 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc.old +2908 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h +466 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h.old +463 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.o +0 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.cc +195 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.h +76 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.cc +322 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.h +109 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.o +0 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.cc +3413 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.h +145 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.cc +3144 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.h +351 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.o +0 -0
- data/pdf2json-0.52-source/xpdf/Lexer.cc +485 -0
- data/pdf2json-0.52-source/xpdf/Lexer.h +80 -0
- data/pdf2json-0.52-source/xpdf/Lexer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Link.cc +806 -0
- data/pdf2json-0.52-source/xpdf/Link.cc.old +784 -0
- data/pdf2json-0.52-source/xpdf/Link.h +415 -0
- data/pdf2json-0.52-source/xpdf/Link.h.old +369 -0
- data/pdf2json-0.52-source/xpdf/Link.o +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile +232 -0
- data/pdf2json-0.52-source/xpdf/Makefile.dep +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile.in +232 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.cc +116 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.h +42 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.o +0 -0
- data/pdf2json-0.52-source/xpdf/NameToUnicodeTable.h +1097 -0
- data/pdf2json-0.52-source/xpdf/Object.cc +231 -0
- data/pdf2json-0.52-source/xpdf/Object.h +303 -0
- data/pdf2json-0.52-source/xpdf/Object.o +0 -0
- data/pdf2json-0.52-source/xpdf/Outline.cc +151 -0
- data/pdf2json-0.52-source/xpdf/Outline.h +76 -0
- data/pdf2json-0.52-source/xpdf/Outline.o +0 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.cc +131 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.h +253 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.cc +2044 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.h +321 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.cc +404 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.h +183 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.cc +44 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.h +16 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.cc +6224 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.h +395 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.cc +135 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.h +41 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Page.cc +454 -0
- data/pdf2json-0.52-source/xpdf/Page.h +187 -0
- data/pdf2json-0.52-source/xpdf/Page.o +0 -0
- data/pdf2json-0.52-source/xpdf/Parser.cc +227 -0
- data/pdf2json-0.52-source/xpdf/Parser.h +59 -0
- data/pdf2json-0.52-source/xpdf/Parser.o +0 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.cc +257 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.h +130 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.cc +390 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.h +160 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.o +0 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.cc +2845 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.h +247 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/Stream-CCITT.h +459 -0
- data/pdf2json-0.52-source/xpdf/Stream.cc +4627 -0
- data/pdf2json-0.52-source/xpdf/Stream.h +858 -0
- data/pdf2json-0.52-source/xpdf/Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.cc +4090 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.h +661 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/UTF8.h +56 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc +302 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc.old +293 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h +135 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h.old +123 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMapTables.h +361 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.cc +949 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.h +20 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.o +0 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.cc +447 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.h +114 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.cc +1655 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.h +251 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.cc +931 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.h +45 -0
- data/pdf2json-0.52-source/xpdf/XPDFTreeP.h +87 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.cc +3488 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.h +352 -0
- data/pdf2json-0.52-source/xpdf/XRef.cc +896 -0
- data/pdf2json-0.52-source/xpdf/XRef.h +133 -0
- data/pdf2json-0.52-source/xpdf/XRef.o +0 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.cc +262 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.h +341 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.o +0 -0
- data/pdf2json-0.52-source/xpdf/about-text.h +48 -0
- data/pdf2json-0.52-source/xpdf/about.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/config.h +112 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/find.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/findDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/leftArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/leftArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/libXpdf.a +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.cc +298 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.cc +155 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.cc +387 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftoppm.cc +203 -0
- data/pdf2json-0.52-source/xpdf/pdftops +0 -0
- data/pdf2json-0.52-source/xpdf/pdftops.cc +344 -0
- data/pdf2json-0.52-source/xpdf/pdftops.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.cc +333 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.o +0 -0
- data/pdf2json-0.52-source/xpdf/print.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/printDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/rightArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/rightArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/vms_make.com +129 -0
- data/pdf2json-0.52-source/xpdf/xpdf.cc +344 -0
- data/pdf2json-0.52-source/xpdf/xpdfIcon.xpm +62 -0
- data/pdf2json.gemspec +29 -0
- metadata +518 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// XPDFTree.h
|
4
|
+
//
|
5
|
+
// Copyright 2002-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#ifndef XPDFTREE_H
|
10
|
+
#define XPDFTREE_H
|
11
|
+
|
12
|
+
#include <Xm/Xm.h>
|
13
|
+
|
14
|
+
extern "C" {
|
15
|
+
|
16
|
+
externalref WidgetClass xpdfTreeWidgetClass;
|
17
|
+
|
18
|
+
typedef struct _XPDFTreeClassRec *XPDFTreeWidgetClass;
|
19
|
+
typedef struct _XPDFTreeRec *XPDFTreeWidget;
|
20
|
+
|
21
|
+
#ifndef XPDFIsTree
|
22
|
+
#define XPDFIsTree(w) XtIsSubclass(w, xpdfTreeWidgetClass)
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#define XPDFNentryParent "entryParent"
|
26
|
+
#define XPDFNentryExpanded "entryExpanded"
|
27
|
+
#define XPDFNentryPosition "entryPosition"
|
28
|
+
#define XPDFNselectionCallback "selectionCallback"
|
29
|
+
|
30
|
+
#define XPDFCentryParent "EntryParent"
|
31
|
+
#define XPDFCentryExpanded "EntryExpanded"
|
32
|
+
#define XPDFCentryPosition "EntryPosition"
|
33
|
+
|
34
|
+
typedef struct {
|
35
|
+
int reason;
|
36
|
+
XEvent *event;
|
37
|
+
Widget selectedItem;
|
38
|
+
} XPDFTreeSelectCallbackStruct;
|
39
|
+
|
40
|
+
extern Widget XPDFCreateTree(Widget parent, char *name,
|
41
|
+
ArgList argList, Cardinal argCount);
|
42
|
+
|
43
|
+
} // extern "C"
|
44
|
+
|
45
|
+
#endif
|
@@ -0,0 +1,87 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// XPDFTreeP.h
|
4
|
+
//
|
5
|
+
// Copyright 2002-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#ifndef XPDFTREEP_H
|
10
|
+
#define XPDFTREEP_H
|
11
|
+
|
12
|
+
#include <Xm/ManagerP.h>
|
13
|
+
#include "XPDFTree.h"
|
14
|
+
|
15
|
+
extern "C" {
|
16
|
+
|
17
|
+
typedef void (*XPDFLayoutProc)(Widget widget, Widget instigator);
|
18
|
+
typedef void (*XPDFCalcSizeProc)(Widget widget, Widget instigator,
|
19
|
+
Dimension *totalWidth,
|
20
|
+
Dimension *totalHeight);
|
21
|
+
typedef Boolean (*XPDFNeedRelayoutProc)(Widget oldWidget, Widget newWidget);
|
22
|
+
|
23
|
+
#define XPDFInheritCreateGC ((XtWidgetProc)_XtInherit)
|
24
|
+
#define XPDFInheritDestroyGC ((XtWidgetProc)_XtInherit)
|
25
|
+
#define XPDFInheritLayout ((XPDFLayoutProc)_XtInherit)
|
26
|
+
#define XPDFInheritCalcSize ((XPDFCalcSizeProc)_XtInherit)
|
27
|
+
#define XPDFInheritNeedRelayout ((XPDFNeedRelayoutProc)_XtInherit)
|
28
|
+
|
29
|
+
typedef struct {
|
30
|
+
XtWidgetProc createGC;
|
31
|
+
XtWidgetProc destroyGC;
|
32
|
+
XPDFLayoutProc layout;
|
33
|
+
XPDFCalcSizeProc calcSize;
|
34
|
+
XPDFNeedRelayoutProc needRelayout;
|
35
|
+
XtPointer extension;
|
36
|
+
} XPDFTreeClassPart;
|
37
|
+
|
38
|
+
typedef struct _XPDFTreeClassRec {
|
39
|
+
CoreClassPart coreClass;
|
40
|
+
CompositeClassPart compositeClass;
|
41
|
+
ConstraintClassPart constraintClass;
|
42
|
+
XmManagerClassPart managerClass;
|
43
|
+
XPDFTreeClassPart treeClass;
|
44
|
+
} XPDFTreeClassRec;
|
45
|
+
|
46
|
+
externalref XPDFTreeClassRec xpdfTreeClassRec;
|
47
|
+
|
48
|
+
typedef struct _XPDFTreeEntry XPDFTreeEntry;
|
49
|
+
|
50
|
+
typedef struct {
|
51
|
+
Dimension marginWidth;
|
52
|
+
Dimension marginHeight;
|
53
|
+
XtCallbackList selectCallback;
|
54
|
+
GC plainGC;
|
55
|
+
GC dottedGC;
|
56
|
+
XPDFTreeEntry *root;
|
57
|
+
int redrawY;
|
58
|
+
} XPDFTreePart;
|
59
|
+
|
60
|
+
typedef struct _XPDFTreeRec {
|
61
|
+
CorePart core;
|
62
|
+
CompositePart composite;
|
63
|
+
ConstraintPart constraint;
|
64
|
+
XmManagerPart manager;
|
65
|
+
XPDFTreePart tree;
|
66
|
+
} XPDFTreeRec;
|
67
|
+
|
68
|
+
#define XPDFTreeIndex (XmManagerIndex + 1)
|
69
|
+
|
70
|
+
typedef struct _XPDFTreeConstraintPart {
|
71
|
+
Widget entryParent;
|
72
|
+
Boolean entryExpanded;
|
73
|
+
int entryPosition;
|
74
|
+
XPDFTreeEntry *e;
|
75
|
+
} XPDFTreeConstraintPart, *XPDFTreeConstraint;
|
76
|
+
|
77
|
+
typedef struct _XPDFTreeConstraintRec {
|
78
|
+
XmManagerConstraintPart manager;
|
79
|
+
XPDFTreeConstraintPart tree;
|
80
|
+
} XPDFTreeConstraintRec, *XPDFTreeConstraintPtr;
|
81
|
+
|
82
|
+
#define XPDFTreeCPart(w) \
|
83
|
+
(&((XPDFTreeConstraintPtr)(w)->core.constraints)->tree)
|
84
|
+
|
85
|
+
} // extern "C"
|
86
|
+
|
87
|
+
#endif
|
@@ -0,0 +1,3488 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// XPDFViewer.cc
|
4
|
+
//
|
5
|
+
// Copyright 2002-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#include <aconf.h>
|
10
|
+
|
11
|
+
#ifdef USE_GCC_PRAGMAS
|
12
|
+
#pragma implementation
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#include <stdlib.h>
|
16
|
+
#include <string.h>
|
17
|
+
#include <ctype.h>
|
18
|
+
#include <X11/keysym.h>
|
19
|
+
#include <X11/cursorfont.h>
|
20
|
+
#ifdef HAVE_X11_XPM_H
|
21
|
+
#include <X11/xpm.h>
|
22
|
+
#endif
|
23
|
+
#if defined(__sgi) && (XmVERSION <= 1)
|
24
|
+
#define Object XtObject
|
25
|
+
#include <Sgm/HPanedW.h>
|
26
|
+
#undef Object
|
27
|
+
#endif
|
28
|
+
#include "gmem.h"
|
29
|
+
#include "gfile.h"
|
30
|
+
#include "GString.h"
|
31
|
+
#include "GList.h"
|
32
|
+
#include "Error.h"
|
33
|
+
#include "GlobalParams.h"
|
34
|
+
#include "PDFDoc.h"
|
35
|
+
#include "Link.h"
|
36
|
+
#include "ErrorCodes.h"
|
37
|
+
#include "Outline.h"
|
38
|
+
#include "UnicodeMap.h"
|
39
|
+
#ifndef DISABLE_OUTLINE
|
40
|
+
#define Object XtObject
|
41
|
+
#include "XPDFTree.h"
|
42
|
+
#undef Object
|
43
|
+
#endif
|
44
|
+
#include "XPDFApp.h"
|
45
|
+
#include "XPDFViewer.h"
|
46
|
+
#include "PSOutputDev.h"
|
47
|
+
#include "config.h"
|
48
|
+
|
49
|
+
// these macro defns conflict with xpdf's Object class
|
50
|
+
#ifdef LESSTIF_VERSION
|
51
|
+
#undef XtDisplay
|
52
|
+
#undef XtScreen
|
53
|
+
#undef XtWindow
|
54
|
+
#undef XtParent
|
55
|
+
#undef XtIsRealized
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#if XmVERSION <= 1
|
59
|
+
#define XmSET True
|
60
|
+
#define XmUNSET False
|
61
|
+
#endif
|
62
|
+
|
63
|
+
// hack around old X includes which are missing these symbols
|
64
|
+
#ifndef XK_Page_Up
|
65
|
+
#define XK_Page_Up 0xFF55
|
66
|
+
#endif
|
67
|
+
#ifndef XK_Page_Down
|
68
|
+
#define XK_Page_Down 0xFF56
|
69
|
+
#endif
|
70
|
+
#ifndef XK_KP_Home
|
71
|
+
#define XK_KP_Home 0xFF95
|
72
|
+
#endif
|
73
|
+
#ifndef XK_KP_Left
|
74
|
+
#define XK_KP_Left 0xFF96
|
75
|
+
#endif
|
76
|
+
#ifndef XK_KP_Up
|
77
|
+
#define XK_KP_Up 0xFF97
|
78
|
+
#endif
|
79
|
+
#ifndef XK_KP_Right
|
80
|
+
#define XK_KP_Right 0xFF98
|
81
|
+
#endif
|
82
|
+
#ifndef XK_KP_Down
|
83
|
+
#define XK_KP_Down 0xFF99
|
84
|
+
#endif
|
85
|
+
#ifndef XK_KP_Prior
|
86
|
+
#define XK_KP_Prior 0xFF9A
|
87
|
+
#endif
|
88
|
+
#ifndef XK_KP_Page_Up
|
89
|
+
#define XK_KP_Page_Up 0xFF9A
|
90
|
+
#endif
|
91
|
+
#ifndef XK_KP_Next
|
92
|
+
#define XK_KP_Next 0xFF9B
|
93
|
+
#endif
|
94
|
+
#ifndef XK_KP_Page_Down
|
95
|
+
#define XK_KP_Page_Down 0xFF9B
|
96
|
+
#endif
|
97
|
+
#ifndef XK_KP_End
|
98
|
+
#define XK_KP_End 0xFF9C
|
99
|
+
#endif
|
100
|
+
#ifndef XK_KP_Begin
|
101
|
+
#define XK_KP_Begin 0xFF9D
|
102
|
+
#endif
|
103
|
+
#ifndef XK_KP_Insert
|
104
|
+
#define XK_KP_Insert 0xFF9E
|
105
|
+
#endif
|
106
|
+
#ifndef XK_KP_Delete
|
107
|
+
#define XK_KP_Delete 0xFF9F
|
108
|
+
#endif
|
109
|
+
|
110
|
+
//------------------------------------------------------------------------
|
111
|
+
// GUI includes
|
112
|
+
//------------------------------------------------------------------------
|
113
|
+
|
114
|
+
#include "xpdfIcon.xpm"
|
115
|
+
#include "leftArrow.xbm"
|
116
|
+
#include "leftArrowDis.xbm"
|
117
|
+
#include "dblLeftArrow.xbm"
|
118
|
+
#include "dblLeftArrowDis.xbm"
|
119
|
+
#include "rightArrow.xbm"
|
120
|
+
#include "rightArrowDis.xbm"
|
121
|
+
#include "dblRightArrow.xbm"
|
122
|
+
#include "dblRightArrowDis.xbm"
|
123
|
+
#include "backArrow.xbm"
|
124
|
+
#include "backArrowDis.xbm"
|
125
|
+
#include "forwardArrow.xbm"
|
126
|
+
#include "forwardArrowDis.xbm"
|
127
|
+
#include "find.xbm"
|
128
|
+
#include "findDis.xbm"
|
129
|
+
#include "print.xbm"
|
130
|
+
#include "printDis.xbm"
|
131
|
+
#include "about.xbm"
|
132
|
+
#include "about-text.h"
|
133
|
+
|
134
|
+
//------------------------------------------------------------------------
|
135
|
+
|
136
|
+
struct ZoomMenuInfo {
|
137
|
+
char *label;
|
138
|
+
double zoom;
|
139
|
+
};
|
140
|
+
|
141
|
+
static ZoomMenuInfo zoomMenuInfo[nZoomMenuItems] = {
|
142
|
+
{ "400%", 400 },
|
143
|
+
{ "200%", 200 },
|
144
|
+
{ "150%", 150 },
|
145
|
+
{ "125%", 125 },
|
146
|
+
{ "100%", 100 },
|
147
|
+
{ "50%", 50 },
|
148
|
+
{ "25%", 25 },
|
149
|
+
{ "12.5%", 12.5 },
|
150
|
+
{ "fit page", zoomPage },
|
151
|
+
{ "fit width", zoomWidth }
|
152
|
+
};
|
153
|
+
|
154
|
+
#define maxZoomIdx 0
|
155
|
+
#define defZoomIdx 3
|
156
|
+
#define minZoomIdx 7
|
157
|
+
#define zoomPageIdx 8
|
158
|
+
#define zoomWidthIdx 9
|
159
|
+
|
160
|
+
//------------------------------------------------------------------------
|
161
|
+
|
162
|
+
#define cmdMaxArgs 2
|
163
|
+
|
164
|
+
XPDFViewerCmd XPDFViewer::cmdTab[] = {
|
165
|
+
{ "about", 0, gFalse, gFalse, &XPDFViewer::cmdAbout },
|
166
|
+
{ "closeOutline", 0, gFalse, gFalse, &XPDFViewer::cmdCloseOutline },
|
167
|
+
{ "closeWindow", 0, gFalse, gFalse, &XPDFViewer::cmdCloseWindow },
|
168
|
+
{ "continuousMode", 0, gFalse, gFalse, &XPDFViewer::cmdContinuousMode },
|
169
|
+
{ "endPan", 0, gTrue, gTrue, &XPDFViewer::cmdEndPan },
|
170
|
+
{ "endSelection", 0, gTrue, gTrue, &XPDFViewer::cmdEndSelection },
|
171
|
+
{ "find", 0, gTrue, gFalse, &XPDFViewer::cmdFind },
|
172
|
+
{ "findNext", 0, gTrue, gFalse, &XPDFViewer::cmdFindNext },
|
173
|
+
{ "focusToDocWin", 0, gFalse, gFalse, &XPDFViewer::cmdFocusToDocWin },
|
174
|
+
{ "focusToPageNum", 0, gFalse, gFalse, &XPDFViewer::cmdFocusToPageNum },
|
175
|
+
{ "followLink", 0, gTrue, gTrue, &XPDFViewer::cmdFollowLink },
|
176
|
+
{ "followLinkInNewWin", 0, gTrue, gTrue, &XPDFViewer::cmdFollowLinkInNewWin },
|
177
|
+
{ "followLinkInNewWinNoSel", 0, gTrue, gTrue, &XPDFViewer::cmdFollowLinkInNewWinNoSel },
|
178
|
+
{ "followLinkNoSel", 0, gTrue, gTrue, &XPDFViewer::cmdFollowLinkNoSel },
|
179
|
+
{ "fullScreenMode", 0, gFalse, gFalse, &XPDFViewer::cmdFullScreenMode },
|
180
|
+
{ "goBackward", 0, gFalse, gFalse, &XPDFViewer::cmdGoBackward },
|
181
|
+
{ "goForward", 0, gFalse, gFalse, &XPDFViewer::cmdGoForward },
|
182
|
+
{ "gotoDest", 1, gTrue, gFalse, &XPDFViewer::cmdGotoDest },
|
183
|
+
{ "gotoLastPage", 0, gTrue, gFalse, &XPDFViewer::cmdGotoLastPage },
|
184
|
+
{ "gotoLastPageNoScroll", 0, gTrue, gFalse, &XPDFViewer::cmdGotoLastPageNoScroll },
|
185
|
+
{ "gotoPage", 1, gTrue, gFalse, &XPDFViewer::cmdGotoPage },
|
186
|
+
{ "gotoPageNoScroll", 1, gTrue, gFalse, &XPDFViewer::cmdGotoPageNoScroll },
|
187
|
+
{ "nextPage", 0, gTrue, gFalse, &XPDFViewer::cmdNextPage },
|
188
|
+
{ "nextPageNoScroll", 0, gTrue, gFalse, &XPDFViewer::cmdNextPageNoScroll },
|
189
|
+
{ "open", 0, gFalse, gFalse, &XPDFViewer::cmdOpen },
|
190
|
+
{ "openFile", 1, gFalse, gFalse, &XPDFViewer::cmdOpenFile },
|
191
|
+
{ "openFileAtDest", 2, gFalse, gFalse, &XPDFViewer::cmdOpenFileAtDest },
|
192
|
+
{ "openFileAtDestInNewWin", 2, gFalse, gFalse, &XPDFViewer::cmdOpenFileAtDestInNewWin },
|
193
|
+
{ "openFileAtPage", 2, gFalse, gFalse, &XPDFViewer::cmdOpenFileAtPage },
|
194
|
+
{ "openFileAtPageInNewWin", 2, gFalse, gFalse, &XPDFViewer::cmdOpenFileAtPageInNewWin },
|
195
|
+
{ "openFileInNewWin", 1, gFalse, gFalse, &XPDFViewer::cmdOpenFileInNewWin },
|
196
|
+
{ "openInNewWin", 0, gFalse, gFalse, &XPDFViewer::cmdOpenInNewWin },
|
197
|
+
{ "openOutline", 0, gFalse, gFalse, &XPDFViewer::cmdOpenOutline },
|
198
|
+
{ "pageDown", 0, gTrue, gFalse, &XPDFViewer::cmdPageDown },
|
199
|
+
{ "pageUp", 0, gTrue, gFalse, &XPDFViewer::cmdPageUp },
|
200
|
+
{ "postPopupMenu", 0, gFalse, gTrue, &XPDFViewer::cmdPostPopupMenu },
|
201
|
+
{ "prevPage", 0, gTrue, gFalse, &XPDFViewer::cmdPrevPage },
|
202
|
+
{ "prevPageNoScroll", 0, gTrue, gFalse, &XPDFViewer::cmdPrevPageNoScroll },
|
203
|
+
{ "print", 0, gTrue, gFalse, &XPDFViewer::cmdPrint },
|
204
|
+
{ "quit", 0, gFalse, gFalse, &XPDFViewer::cmdQuit },
|
205
|
+
{ "raise", 0, gFalse, gFalse, &XPDFViewer::cmdRaise },
|
206
|
+
{ "redraw", 0, gTrue, gFalse, &XPDFViewer::cmdRedraw },
|
207
|
+
{ "reload", 0, gTrue, gFalse, &XPDFViewer::cmdReload },
|
208
|
+
{ "run", 1, gFalse, gFalse, &XPDFViewer::cmdRun },
|
209
|
+
{ "scrollDown", 1, gTrue, gFalse, &XPDFViewer::cmdScrollDown },
|
210
|
+
{ "scrollDownNextPage", 1, gTrue, gFalse, &XPDFViewer::cmdScrollDownNextPage },
|
211
|
+
{ "scrollLeft", 1, gTrue, gFalse, &XPDFViewer::cmdScrollLeft },
|
212
|
+
{ "scrollOutlineDown", 1, gTrue, gFalse, &XPDFViewer::cmdScrollOutlineDown },
|
213
|
+
{ "scrollOutlineUp", 1, gTrue, gFalse, &XPDFViewer::cmdScrollOutlineUp },
|
214
|
+
{ "scrollRight", 1, gTrue, gFalse, &XPDFViewer::cmdScrollRight },
|
215
|
+
{ "scrollToBottomEdge", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToBottomEdge },
|
216
|
+
{ "scrollToBottomRight", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToBottomRight },
|
217
|
+
{ "scrollToLeftEdge", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToLeftEdge },
|
218
|
+
{ "scrollToRightEdge", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToRightEdge },
|
219
|
+
{ "scrollToTopEdge", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToTopEdge },
|
220
|
+
{ "scrollToTopLeft", 0, gTrue, gFalse, &XPDFViewer::cmdScrollToTopLeft },
|
221
|
+
{ "scrollUp", 1, gTrue, gFalse, &XPDFViewer::cmdScrollUp },
|
222
|
+
{ "scrollUpPrevPage", 1, gTrue, gFalse, &XPDFViewer::cmdScrollUpPrevPage },
|
223
|
+
{ "singlePageMode", 0, gFalse, gFalse, &XPDFViewer::cmdSinglePageMode },
|
224
|
+
{ "startPan", 0, gTrue, gTrue, &XPDFViewer::cmdStartPan },
|
225
|
+
{ "startSelection", 0, gTrue, gTrue, &XPDFViewer::cmdStartSelection },
|
226
|
+
{ "toggleContinuousMode", 0, gFalse, gFalse, &XPDFViewer::cmdToggleContinuousMode },
|
227
|
+
{ "toggleFullScreenMode", 0, gFalse, gFalse, &XPDFViewer::cmdToggleFullScreenMode },
|
228
|
+
{ "toggleOutline", 0, gFalse, gFalse, &XPDFViewer::cmdToggleOutline },
|
229
|
+
{ "windowMode", 0, gFalse, gFalse, &XPDFViewer::cmdWindowMode },
|
230
|
+
{ "zoomFitPage", 0, gFalse, gFalse, &XPDFViewer::cmdZoomFitPage },
|
231
|
+
{ "zoomFitWidth", 0, gFalse, gFalse, &XPDFViewer::cmdZoomFitWidth },
|
232
|
+
{ "zoomIn", 0, gFalse, gFalse, &XPDFViewer::cmdZoomIn },
|
233
|
+
{ "zoomOut", 0, gFalse, gFalse, &XPDFViewer::cmdZoomOut },
|
234
|
+
{ "zoomPercent", 1, gFalse, gFalse, &XPDFViewer::cmdZoomPercent },
|
235
|
+
{ "zoomToSelection", 0, gTrue, gFalse, &XPDFViewer::cmdZoomToSelection }
|
236
|
+
};
|
237
|
+
|
238
|
+
#define nCmds (sizeof(cmdTab) / sizeof(XPDFViewerCmd))
|
239
|
+
|
240
|
+
//------------------------------------------------------------------------
|
241
|
+
|
242
|
+
XPDFViewer::XPDFViewer(XPDFApp *appA, GString *fileName,
|
243
|
+
int pageA, GString *destName, GBool fullScreen,
|
244
|
+
GString *ownerPassword, GString *userPassword) {
|
245
|
+
LinkDest *dest;
|
246
|
+
int pg;
|
247
|
+
double z;
|
248
|
+
|
249
|
+
app = appA;
|
250
|
+
win = NULL;
|
251
|
+
core = NULL;
|
252
|
+
ok = gFalse;
|
253
|
+
#ifndef DISABLE_OUTLINE
|
254
|
+
outlineLabels = NULL;
|
255
|
+
outlineLabelsLength = outlineLabelsSize = 0;
|
256
|
+
outlinePaneWidth = 175;
|
257
|
+
#endif
|
258
|
+
|
259
|
+
// do Motif-specific initialization and create the window;
|
260
|
+
// this also creates the core object
|
261
|
+
initWindow(fullScreen);
|
262
|
+
initAboutDialog();
|
263
|
+
initFindDialog();
|
264
|
+
initPrintDialog();
|
265
|
+
openDialog = NULL;
|
266
|
+
saveAsDialog = NULL;
|
267
|
+
|
268
|
+
dest = NULL; // make gcc happy
|
269
|
+
pg = pageA; // make gcc happy
|
270
|
+
|
271
|
+
if (fileName) {
|
272
|
+
if (loadFile(fileName, ownerPassword, userPassword)) {
|
273
|
+
getPageAndDest(pageA, destName, &pg, &dest);
|
274
|
+
#ifndef DISABLE_OUTLINE
|
275
|
+
if (outlineScroll != None &&
|
276
|
+
core->getDoc()->getOutline()->getItems() &&
|
277
|
+
core->getDoc()->getOutline()->getItems()->getLength() > 0) {
|
278
|
+
XtVaSetValues(outlineScroll, XmNwidth, outlinePaneWidth, NULL);
|
279
|
+
}
|
280
|
+
#endif
|
281
|
+
} else {
|
282
|
+
return;
|
283
|
+
}
|
284
|
+
}
|
285
|
+
core->resizeToPage(pg);
|
286
|
+
|
287
|
+
// map the window -- we do this after calling resizeToPage to avoid
|
288
|
+
// an annoying on-screen resize
|
289
|
+
mapWindow();
|
290
|
+
|
291
|
+
// display the first page
|
292
|
+
z = core->getZoom();
|
293
|
+
if (dest) {
|
294
|
+
displayDest(dest, z, core->getRotate(), gTrue);
|
295
|
+
delete dest;
|
296
|
+
} else {
|
297
|
+
displayPage(pg, z, core->getRotate(), gTrue, gTrue);
|
298
|
+
}
|
299
|
+
|
300
|
+
ok = gTrue;
|
301
|
+
}
|
302
|
+
|
303
|
+
XPDFViewer::XPDFViewer(XPDFApp *appA, PDFDoc *doc, int pageA,
|
304
|
+
GString *destName, GBool fullScreen) {
|
305
|
+
LinkDest *dest;
|
306
|
+
int pg;
|
307
|
+
double z;
|
308
|
+
|
309
|
+
app = appA;
|
310
|
+
win = NULL;
|
311
|
+
core = NULL;
|
312
|
+
ok = gFalse;
|
313
|
+
#ifndef DISABLE_OUTLINE
|
314
|
+
outlineLabels = NULL;
|
315
|
+
outlineLabelsLength = outlineLabelsSize = 0;
|
316
|
+
outlinePaneWidth = 175;
|
317
|
+
#endif
|
318
|
+
|
319
|
+
// do Motif-specific initialization and create the window;
|
320
|
+
// this also creates the core object
|
321
|
+
initWindow(fullScreen);
|
322
|
+
initAboutDialog();
|
323
|
+
initFindDialog();
|
324
|
+
initPrintDialog();
|
325
|
+
openDialog = NULL;
|
326
|
+
saveAsDialog = NULL;
|
327
|
+
|
328
|
+
dest = NULL; // make gcc happy
|
329
|
+
pg = pageA; // make gcc happy
|
330
|
+
|
331
|
+
if (doc) {
|
332
|
+
core->loadDoc(doc);
|
333
|
+
getPageAndDest(pageA, destName, &pg, &dest);
|
334
|
+
#ifndef DISABLE_OUTLINE
|
335
|
+
if (outlineScroll != None &&
|
336
|
+
core->getDoc()->getOutline()->getItems() &&
|
337
|
+
core->getDoc()->getOutline()->getItems()->getLength() > 0) {
|
338
|
+
XtVaSetValues(outlineScroll, XmNwidth, outlinePaneWidth, NULL);
|
339
|
+
}
|
340
|
+
#endif
|
341
|
+
}
|
342
|
+
core->resizeToPage(pg);
|
343
|
+
|
344
|
+
// map the window -- we do this after calling resizeToPage to avoid
|
345
|
+
// an annoying on-screen resize
|
346
|
+
mapWindow();
|
347
|
+
|
348
|
+
// display the first page
|
349
|
+
z = core->getZoom();
|
350
|
+
if (dest) {
|
351
|
+
displayDest(dest, z, core->getRotate(), gTrue);
|
352
|
+
delete dest;
|
353
|
+
} else {
|
354
|
+
displayPage(pg, z, core->getRotate(), gTrue, gTrue);
|
355
|
+
}
|
356
|
+
|
357
|
+
ok = gTrue;
|
358
|
+
}
|
359
|
+
|
360
|
+
XPDFViewer::~XPDFViewer() {
|
361
|
+
delete core;
|
362
|
+
XmFontListFree(aboutBigFont);
|
363
|
+
XmFontListFree(aboutVersionFont);
|
364
|
+
XmFontListFree(aboutFixedFont);
|
365
|
+
closeWindow();
|
366
|
+
#ifndef DISABLE_OUTLINE
|
367
|
+
if (outlineLabels) {
|
368
|
+
gfree(outlineLabels);
|
369
|
+
}
|
370
|
+
#endif
|
371
|
+
}
|
372
|
+
|
373
|
+
void XPDFViewer::open(GString *fileName, int pageA, GString *destName) {
|
374
|
+
LinkDest *dest;
|
375
|
+
int pg;
|
376
|
+
double z;
|
377
|
+
|
378
|
+
if (!core->getDoc() || fileName->cmp(core->getDoc()->getFileName())) {
|
379
|
+
if (!loadFile(fileName, NULL, NULL)) {
|
380
|
+
return;
|
381
|
+
}
|
382
|
+
}
|
383
|
+
getPageAndDest(pageA, destName, &pg, &dest);
|
384
|
+
z = core->getZoom();
|
385
|
+
if (dest) {
|
386
|
+
displayDest(dest, z, core->getRotate(), gTrue);
|
387
|
+
delete dest;
|
388
|
+
} else {
|
389
|
+
displayPage(pg, z, core->getRotate(), gTrue, gTrue);
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
void XPDFViewer::clear() {
|
394
|
+
char *title;
|
395
|
+
XmString s;
|
396
|
+
|
397
|
+
core->clear();
|
398
|
+
|
399
|
+
// set up title, number-of-pages display
|
400
|
+
title = app->getTitle() ? app->getTitle()->getCString()
|
401
|
+
: (char *)xpdfAppName;
|
402
|
+
XtVaSetValues(win, XmNtitle, title, XmNiconName, title, NULL);
|
403
|
+
s = XmStringCreateLocalized("");
|
404
|
+
XtVaSetValues(pageNumText, XmNlabelString, s, NULL);
|
405
|
+
XmStringFree(s);
|
406
|
+
s = XmStringCreateLocalized(" of 0");
|
407
|
+
XtVaSetValues(pageCountLabel, XmNlabelString, s, NULL);
|
408
|
+
XmStringFree(s);
|
409
|
+
|
410
|
+
// disable buttons
|
411
|
+
XtVaSetValues(prevTenPageBtn, XmNsensitive, False, NULL);
|
412
|
+
XtVaSetValues(prevPageBtn, XmNsensitive, False, NULL);
|
413
|
+
XtVaSetValues(nextTenPageBtn, XmNsensitive, False, NULL);
|
414
|
+
XtVaSetValues(nextPageBtn, XmNsensitive, False, NULL);
|
415
|
+
|
416
|
+
// remove the old outline
|
417
|
+
#ifndef DISABLE_OUTLINE
|
418
|
+
setupOutline();
|
419
|
+
#endif
|
420
|
+
}
|
421
|
+
|
422
|
+
//------------------------------------------------------------------------
|
423
|
+
// load / display
|
424
|
+
//------------------------------------------------------------------------
|
425
|
+
|
426
|
+
GBool XPDFViewer::loadFile(GString *fileName, GString *ownerPassword,
|
427
|
+
GString *userPassword) {
|
428
|
+
return core->loadFile(fileName, ownerPassword, userPassword) == errNone;
|
429
|
+
}
|
430
|
+
|
431
|
+
void XPDFViewer::reloadFile() {
|
432
|
+
int pg;
|
433
|
+
|
434
|
+
if (!core->getDoc()) {
|
435
|
+
return;
|
436
|
+
}
|
437
|
+
pg = core->getPageNum();
|
438
|
+
loadFile(core->getDoc()->getFileName());
|
439
|
+
if (pg > core->getDoc()->getNumPages()) {
|
440
|
+
pg = core->getDoc()->getNumPages();
|
441
|
+
}
|
442
|
+
displayPage(pg, core->getZoom(), core->getRotate(), gFalse, gFalse);
|
443
|
+
}
|
444
|
+
|
445
|
+
void XPDFViewer::displayPage(int pageA, double zoomA, int rotateA,
|
446
|
+
GBool scrollToTop, GBool addToHist) {
|
447
|
+
core->displayPage(pageA, zoomA, rotateA, scrollToTop, addToHist);
|
448
|
+
}
|
449
|
+
|
450
|
+
void XPDFViewer::displayDest(LinkDest *dest, double zoomA, int rotateA,
|
451
|
+
GBool addToHist) {
|
452
|
+
core->displayDest(dest, zoomA, rotateA, addToHist);
|
453
|
+
}
|
454
|
+
|
455
|
+
void XPDFViewer::getPageAndDest(int pageA, GString *destName,
|
456
|
+
int *pageOut, LinkDest **destOut) {
|
457
|
+
Ref pageRef;
|
458
|
+
|
459
|
+
// find the page number for a named destination
|
460
|
+
*pageOut = pageA;
|
461
|
+
*destOut = NULL;
|
462
|
+
if (destName && (*destOut = core->getDoc()->findDest(destName))) {
|
463
|
+
if ((*destOut)->isPageRef()) {
|
464
|
+
pageRef = (*destOut)->getPageRef();
|
465
|
+
*pageOut = core->getDoc()->findPage(pageRef.num, pageRef.gen);
|
466
|
+
} else {
|
467
|
+
*pageOut = (*destOut)->getPageNum();
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
if (*pageOut <= 0) {
|
472
|
+
*pageOut = 1;
|
473
|
+
}
|
474
|
+
if (*pageOut > core->getDoc()->getNumPages()) {
|
475
|
+
*pageOut = core->getDoc()->getNumPages();
|
476
|
+
}
|
477
|
+
}
|
478
|
+
|
479
|
+
//------------------------------------------------------------------------
|
480
|
+
// hyperlinks / actions
|
481
|
+
//------------------------------------------------------------------------
|
482
|
+
|
483
|
+
void XPDFViewer::doLink(int wx, int wy, GBool onlyIfNoSelection,
|
484
|
+
GBool newWin) {
|
485
|
+
XPDFViewer *newViewer;
|
486
|
+
LinkAction *action;
|
487
|
+
int pg, selPg;
|
488
|
+
double xu, yu, selULX, selULY, selLRX, selLRY;
|
489
|
+
|
490
|
+
if (core->getHyperlinksEnabled() &&
|
491
|
+
core->cvtWindowToUser(wx, wy, &pg, &xu, &yu) &&
|
492
|
+
!(onlyIfNoSelection &&
|
493
|
+
core->getSelection(&selPg, &selULX, &selULY, &selLRX, &selLRY))) {
|
494
|
+
if ((action = core->findLink(pg, xu, yu))) {
|
495
|
+
if (newWin &&
|
496
|
+
core->getDoc()->getFileName() &&
|
497
|
+
(action->getKind() == actionGoTo ||
|
498
|
+
action->getKind() == actionGoToR ||
|
499
|
+
(action->getKind() == actionNamed &&
|
500
|
+
((LinkNamed *)action)->getName()->cmp("Quit")))) {
|
501
|
+
newViewer = app->open(core->getDoc()->getFileName());
|
502
|
+
newViewer->core->doAction(action);
|
503
|
+
} else {
|
504
|
+
core->doAction(action);
|
505
|
+
}
|
506
|
+
}
|
507
|
+
}
|
508
|
+
}
|
509
|
+
|
510
|
+
void XPDFViewer::actionCbk(void *data, char *action) {
|
511
|
+
XPDFViewer *viewer = (XPDFViewer *)data;
|
512
|
+
|
513
|
+
if (!strcmp(action, "Quit")) {
|
514
|
+
viewer->app->quit();
|
515
|
+
}
|
516
|
+
}
|
517
|
+
|
518
|
+
//------------------------------------------------------------------------
|
519
|
+
// keyboard/mouse input
|
520
|
+
//------------------------------------------------------------------------
|
521
|
+
|
522
|
+
void XPDFViewer::keyPressCbk(void *data, KeySym key, Guint modifiers,
|
523
|
+
XEvent *event) {
|
524
|
+
XPDFViewer *viewer = (XPDFViewer *)data;
|
525
|
+
int keyCode;
|
526
|
+
GList *cmds;
|
527
|
+
int i;
|
528
|
+
|
529
|
+
if (key >= 0x20 && key <= 0xfe) {
|
530
|
+
keyCode = (int)key;
|
531
|
+
} else if (key == XK_Tab ||
|
532
|
+
key == XK_KP_Tab) {
|
533
|
+
keyCode = xpdfKeyCodeTab;
|
534
|
+
} else if (key == XK_Return) {
|
535
|
+
keyCode = xpdfKeyCodeReturn;
|
536
|
+
} else if (key == XK_KP_Enter) {
|
537
|
+
keyCode = xpdfKeyCodeEnter;
|
538
|
+
} else if (key == XK_BackSpace) {
|
539
|
+
keyCode = xpdfKeyCodeBackspace;
|
540
|
+
} else if (key == XK_Insert ||
|
541
|
+
key == XK_KP_Insert) {
|
542
|
+
keyCode = xpdfKeyCodeInsert;
|
543
|
+
} else if (key == XK_Delete ||
|
544
|
+
key == XK_KP_Delete) {
|
545
|
+
keyCode = xpdfKeyCodeDelete;
|
546
|
+
} else if (key == XK_Home ||
|
547
|
+
key == XK_KP_Home) {
|
548
|
+
keyCode = xpdfKeyCodeHome;
|
549
|
+
} else if (key == XK_End ||
|
550
|
+
key == XK_KP_End) {
|
551
|
+
keyCode = xpdfKeyCodeEnd;
|
552
|
+
} else if (key == XK_Page_Up ||
|
553
|
+
key == XK_KP_Page_Up) {
|
554
|
+
keyCode = xpdfKeyCodePgUp;
|
555
|
+
} else if (key == XK_Page_Down ||
|
556
|
+
key == XK_KP_Page_Down) {
|
557
|
+
keyCode = xpdfKeyCodePgDn;
|
558
|
+
} else if (key == XK_Left ||
|
559
|
+
key == XK_KP_Left) {
|
560
|
+
keyCode = xpdfKeyCodeLeft;
|
561
|
+
} else if (key == XK_Right ||
|
562
|
+
key == XK_KP_Right) {
|
563
|
+
keyCode = xpdfKeyCodeRight;
|
564
|
+
} else if (key == XK_Up ||
|
565
|
+
key == XK_KP_Up) {
|
566
|
+
keyCode = xpdfKeyCodeUp;
|
567
|
+
} else if (key == XK_Down ||
|
568
|
+
key == XK_KP_Down) {
|
569
|
+
keyCode = xpdfKeyCodeDown;
|
570
|
+
} else if (key >= XK_F1 && key <= XK_F35) {
|
571
|
+
keyCode = xpdfKeyCodeF1 + (key - XK_F1);
|
572
|
+
} else {
|
573
|
+
return;
|
574
|
+
}
|
575
|
+
|
576
|
+
if ((cmds = globalParams->getKeyBinding(keyCode,
|
577
|
+
viewer->getModifiers(modifiers),
|
578
|
+
viewer->getContext(modifiers)))) {
|
579
|
+
for (i = 0; i < cmds->getLength(); ++i) {
|
580
|
+
viewer->execCmd((GString *)cmds->get(i), event);
|
581
|
+
}
|
582
|
+
deleteGList(cmds, GString);
|
583
|
+
}
|
584
|
+
}
|
585
|
+
|
586
|
+
void XPDFViewer::mouseCbk(void *data, XEvent *event) {
|
587
|
+
XPDFViewer *viewer = (XPDFViewer *)data;
|
588
|
+
int keyCode;
|
589
|
+
GList *cmds;
|
590
|
+
int i;
|
591
|
+
|
592
|
+
if (event->type == ButtonPress) {
|
593
|
+
if (event->xbutton.button >= 1 && event->xbutton.button <= 7) {
|
594
|
+
keyCode = xpdfKeyCodeMousePress1 + event->xbutton.button - 1;
|
595
|
+
} else {
|
596
|
+
return;
|
597
|
+
}
|
598
|
+
} else if (event->type == ButtonRelease) {
|
599
|
+
if (event->xbutton.button >= 1 && event->xbutton.button <= 7) {
|
600
|
+
keyCode = xpdfKeyCodeMouseRelease1 + event->xbutton.button - 1;
|
601
|
+
} else {
|
602
|
+
return;
|
603
|
+
}
|
604
|
+
} else {
|
605
|
+
return;
|
606
|
+
}
|
607
|
+
|
608
|
+
if ((cmds = globalParams->getKeyBinding(keyCode,
|
609
|
+
viewer->getModifiers(
|
610
|
+
event->xkey.state),
|
611
|
+
viewer->getContext(
|
612
|
+
event->xkey.state)))) {
|
613
|
+
for (i = 0; i < cmds->getLength(); ++i) {
|
614
|
+
viewer->execCmd((GString *)cmds->get(i), event);
|
615
|
+
}
|
616
|
+
deleteGList(cmds, GString);
|
617
|
+
}
|
618
|
+
}
|
619
|
+
|
620
|
+
int XPDFViewer::getModifiers(Guint modifiers) {
|
621
|
+
int mods;
|
622
|
+
|
623
|
+
mods = 0;
|
624
|
+
if (modifiers & ShiftMask) {
|
625
|
+
mods |= xpdfKeyModShift;
|
626
|
+
}
|
627
|
+
if (modifiers & ControlMask) {
|
628
|
+
mods |= xpdfKeyModCtrl;
|
629
|
+
}
|
630
|
+
if (modifiers & Mod1Mask) {
|
631
|
+
mods |= xpdfKeyModAlt;
|
632
|
+
}
|
633
|
+
return mods;
|
634
|
+
}
|
635
|
+
|
636
|
+
int XPDFViewer::getContext(Guint modifiers) {
|
637
|
+
int context;
|
638
|
+
|
639
|
+
context = (core->getFullScreen() ? xpdfKeyContextFullScreen
|
640
|
+
: xpdfKeyContextWindow) |
|
641
|
+
(core->getContinuousMode() ? xpdfKeyContextContinuous
|
642
|
+
: xpdfKeyContextSinglePage) |
|
643
|
+
(core->getLinkAction() ? xpdfKeyContextOverLink
|
644
|
+
: xpdfKeyContextOffLink) |
|
645
|
+
((modifiers & Mod5Mask) ? xpdfKeyContextScrLockOn
|
646
|
+
: xpdfKeyContextScrLockOff);
|
647
|
+
return context;
|
648
|
+
}
|
649
|
+
|
650
|
+
void XPDFViewer::execCmd(GString *cmd, XEvent *event) {
|
651
|
+
GString *name;
|
652
|
+
GString *args[cmdMaxArgs];
|
653
|
+
char *p0, *p1;
|
654
|
+
int nArgs, i;
|
655
|
+
int a, b, m, cmp;
|
656
|
+
|
657
|
+
//----- parse the command
|
658
|
+
name = NULL;
|
659
|
+
nArgs = 0;
|
660
|
+
for (i = 0; i < cmdMaxArgs; ++i) {
|
661
|
+
args[i] = NULL;
|
662
|
+
}
|
663
|
+
p0 = cmd->getCString();
|
664
|
+
for (p1 = p0; *p1 && isalnum(*p1); ++p1) ;
|
665
|
+
if (p1 == p0) {
|
666
|
+
goto err1;
|
667
|
+
}
|
668
|
+
name = new GString(p0, p1 - p0);
|
669
|
+
if (*p1 == '(') {
|
670
|
+
while (nArgs < cmdMaxArgs) {
|
671
|
+
p0 = p1 + 1;
|
672
|
+
for (p1 = p0; *p1 && *p1 != ',' && *p1 != ')'; ++p1) ;
|
673
|
+
args[nArgs++] = new GString(p0, p1 - p0);
|
674
|
+
if (*p1 != ',') {
|
675
|
+
break;
|
676
|
+
}
|
677
|
+
}
|
678
|
+
if (*p1 != ')') {
|
679
|
+
goto err1;
|
680
|
+
}
|
681
|
+
++p1;
|
682
|
+
}
|
683
|
+
if (*p1) {
|
684
|
+
goto err1;
|
685
|
+
}
|
686
|
+
|
687
|
+
//----- find the command
|
688
|
+
a = -1;
|
689
|
+
b = nCmds;
|
690
|
+
// invariant: cmdTab[a].name < name < cmdTab[b].name
|
691
|
+
while (b - a > 1) {
|
692
|
+
m = (a + b) / 2;
|
693
|
+
cmp = strcmp(cmdTab[m].name, name->getCString());
|
694
|
+
if (cmp < 0) {
|
695
|
+
a = m;
|
696
|
+
} else if (cmp > 0) {
|
697
|
+
b = m;
|
698
|
+
} else {
|
699
|
+
a = b = m;
|
700
|
+
}
|
701
|
+
}
|
702
|
+
if (cmp != 0) {
|
703
|
+
goto err1;
|
704
|
+
}
|
705
|
+
|
706
|
+
//----- execute the command
|
707
|
+
if (nArgs != cmdTab[a].nArgs ||
|
708
|
+
(cmdTab[a].requiresEvent && !event)) {
|
709
|
+
goto err1;
|
710
|
+
}
|
711
|
+
if (cmdTab[a].requiresDoc && !core->getDoc()) {
|
712
|
+
// don't issue an error message for this -- it happens, e.g., when
|
713
|
+
// clicking in a window with no open PDF file
|
714
|
+
goto err2;
|
715
|
+
}
|
716
|
+
(this->*cmdTab[a].func)(args, nArgs, event);
|
717
|
+
|
718
|
+
//----- clean up
|
719
|
+
delete name;
|
720
|
+
for (i = 0; i < nArgs; ++i) {
|
721
|
+
if (args[i]) {
|
722
|
+
delete args[i];
|
723
|
+
}
|
724
|
+
}
|
725
|
+
return;
|
726
|
+
|
727
|
+
err1:
|
728
|
+
error(-1, "Invalid command syntax: '%s'", cmd->getCString());
|
729
|
+
err2:
|
730
|
+
if (name) {
|
731
|
+
delete name;
|
732
|
+
}
|
733
|
+
for (i = 0; i < nArgs; ++i) {
|
734
|
+
if (args[i]) {
|
735
|
+
delete args[i];
|
736
|
+
}
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
//------------------------------------------------------------------------
|
741
|
+
// command functions
|
742
|
+
//------------------------------------------------------------------------
|
743
|
+
|
744
|
+
static int mouseX(XEvent *event) {
|
745
|
+
switch (event->type) {
|
746
|
+
case ButtonPress:
|
747
|
+
case ButtonRelease:
|
748
|
+
return event->xbutton.x;
|
749
|
+
case KeyPress:
|
750
|
+
return event->xkey.x;
|
751
|
+
}
|
752
|
+
return 0;
|
753
|
+
}
|
754
|
+
|
755
|
+
static int mouseY(XEvent *event) {
|
756
|
+
switch (event->type) {
|
757
|
+
case ButtonPress:
|
758
|
+
case ButtonRelease:
|
759
|
+
return event->xbutton.y;
|
760
|
+
case KeyPress:
|
761
|
+
return event->xkey.y;
|
762
|
+
}
|
763
|
+
return 0;
|
764
|
+
}
|
765
|
+
|
766
|
+
void XPDFViewer::cmdAbout(GString *args[], int nArgs,
|
767
|
+
XEvent *event) {
|
768
|
+
XtManageChild(aboutDialog);
|
769
|
+
}
|
770
|
+
|
771
|
+
void XPDFViewer::cmdCloseOutline(GString *args[], int nArgs,
|
772
|
+
XEvent *event) {
|
773
|
+
#ifndef DISABLE_OUTLINE
|
774
|
+
Dimension w;
|
775
|
+
|
776
|
+
if (outlineScroll == None) {
|
777
|
+
return;
|
778
|
+
}
|
779
|
+
XtVaGetValues(outlineScroll, XmNwidth, &w, NULL);
|
780
|
+
if (w > 1) {
|
781
|
+
outlinePaneWidth = w;
|
782
|
+
// this ugly kludge is apparently the only way to resize the panes
|
783
|
+
// within an XmPanedWindow
|
784
|
+
XtVaSetValues(outlineScroll, XmNpaneMinimum, 1,
|
785
|
+
XmNpaneMaximum, 1, NULL);
|
786
|
+
XtVaSetValues(outlineScroll, XmNpaneMinimum, 1,
|
787
|
+
XmNpaneMaximum, 10000, NULL);
|
788
|
+
}
|
789
|
+
#endif
|
790
|
+
}
|
791
|
+
|
792
|
+
void XPDFViewer::cmdCloseWindow(GString *args[], int nArgs,
|
793
|
+
XEvent *event) {
|
794
|
+
app->close(this, gFalse);
|
795
|
+
}
|
796
|
+
|
797
|
+
void XPDFViewer::cmdContinuousMode(GString *args[], int nArgs,
|
798
|
+
XEvent *event) {
|
799
|
+
Widget btn;
|
800
|
+
|
801
|
+
if (core->getContinuousMode()) {
|
802
|
+
return;
|
803
|
+
}
|
804
|
+
core->setContinuousMode(gTrue);
|
805
|
+
|
806
|
+
btn = XtNameToWidget(popupMenu, "continuousMode");
|
807
|
+
XtVaSetValues(btn, XmNset, XmSET, NULL);
|
808
|
+
}
|
809
|
+
|
810
|
+
void XPDFViewer::cmdEndPan(GString *args[], int nArgs,
|
811
|
+
XEvent *event) {
|
812
|
+
core->endPan(mouseX(event), mouseY(event));
|
813
|
+
}
|
814
|
+
|
815
|
+
void XPDFViewer::cmdEndSelection(GString *args[], int nArgs,
|
816
|
+
XEvent *event) {
|
817
|
+
core->endSelection(mouseX(event), mouseY(event));
|
818
|
+
}
|
819
|
+
|
820
|
+
void XPDFViewer::cmdFind(GString *args[], int nArgs,
|
821
|
+
XEvent *event) {
|
822
|
+
mapFindDialog();
|
823
|
+
}
|
824
|
+
|
825
|
+
void XPDFViewer::cmdFindNext(GString *args[], int nArgs,
|
826
|
+
XEvent *event) {
|
827
|
+
doFind(gTrue);
|
828
|
+
}
|
829
|
+
|
830
|
+
void XPDFViewer::cmdFocusToDocWin(GString *args[], int nArgs,
|
831
|
+
XEvent *event) {
|
832
|
+
core->takeFocus();
|
833
|
+
}
|
834
|
+
|
835
|
+
void XPDFViewer::cmdFocusToPageNum(GString *args[], int nArgs,
|
836
|
+
XEvent *event) {
|
837
|
+
XmTextFieldSetSelection(pageNumText, 0,
|
838
|
+
strlen(XmTextFieldGetString(pageNumText)),
|
839
|
+
XtLastTimestampProcessed(display));
|
840
|
+
XmProcessTraversal(pageNumText, XmTRAVERSE_CURRENT);
|
841
|
+
}
|
842
|
+
|
843
|
+
void XPDFViewer::cmdFollowLink(GString *args[], int nArgs,
|
844
|
+
XEvent *event) {
|
845
|
+
doLink(mouseX(event), mouseY(event), gFalse, gFalse);
|
846
|
+
}
|
847
|
+
|
848
|
+
void XPDFViewer::cmdFollowLinkInNewWin(GString *args[], int nArgs,
|
849
|
+
XEvent *event) {
|
850
|
+
doLink(mouseX(event), mouseY(event), gFalse, gTrue);
|
851
|
+
}
|
852
|
+
|
853
|
+
void XPDFViewer::cmdFollowLinkInNewWinNoSel(GString *args[], int nArgs,
|
854
|
+
XEvent *event) {
|
855
|
+
doLink(mouseX(event), mouseY(event), gTrue, gTrue);
|
856
|
+
}
|
857
|
+
|
858
|
+
void XPDFViewer::cmdFollowLinkNoSel(GString *args[], int nArgs,
|
859
|
+
XEvent *event) {
|
860
|
+
doLink(mouseX(event), mouseY(event), gTrue, gFalse);
|
861
|
+
}
|
862
|
+
|
863
|
+
void XPDFViewer::cmdFullScreenMode(GString *args[], int nArgs,
|
864
|
+
XEvent *event) {
|
865
|
+
PDFDoc *doc;
|
866
|
+
XPDFViewer *viewer;
|
867
|
+
int pg;
|
868
|
+
Widget btn;
|
869
|
+
|
870
|
+
if (core->getFullScreen()) {
|
871
|
+
return;
|
872
|
+
}
|
873
|
+
pg = core->getPageNum();
|
874
|
+
XtPopdown(win);
|
875
|
+
doc = core->takeDoc(gFalse);
|
876
|
+
viewer = app->reopen(this, doc, pg, gTrue);
|
877
|
+
|
878
|
+
btn = XtNameToWidget(viewer->popupMenu, "fullScreen");
|
879
|
+
XtVaSetValues(btn, XmNset, XmSET, NULL);
|
880
|
+
}
|
881
|
+
|
882
|
+
void XPDFViewer::cmdGoBackward(GString *args[], int nArgs,
|
883
|
+
XEvent *event) {
|
884
|
+
core->goBackward();
|
885
|
+
}
|
886
|
+
|
887
|
+
void XPDFViewer::cmdGoForward(GString *args[], int nArgs,
|
888
|
+
XEvent *event) {
|
889
|
+
core->goForward();
|
890
|
+
}
|
891
|
+
|
892
|
+
void XPDFViewer::cmdGotoDest(GString *args[], int nArgs,
|
893
|
+
XEvent *event) {
|
894
|
+
int pg;
|
895
|
+
LinkDest *dest;
|
896
|
+
|
897
|
+
getPageAndDest(1, args[0], &pg, &dest);
|
898
|
+
if (dest) {
|
899
|
+
displayDest(dest, core->getZoom(), core->getRotate(), gTrue);
|
900
|
+
delete dest;
|
901
|
+
}
|
902
|
+
}
|
903
|
+
|
904
|
+
void XPDFViewer::cmdGotoLastPage(GString *args[], int nArgs,
|
905
|
+
XEvent *event) {
|
906
|
+
displayPage(core->getDoc()->getNumPages(),
|
907
|
+
core->getZoom(), core->getRotate(),
|
908
|
+
gTrue, gTrue);
|
909
|
+
}
|
910
|
+
|
911
|
+
void XPDFViewer::cmdGotoLastPageNoScroll(GString *args[], int nArgs,
|
912
|
+
XEvent *event) {
|
913
|
+
displayPage(core->getDoc()->getNumPages(),
|
914
|
+
core->getZoom(), core->getRotate(),
|
915
|
+
gFalse, gTrue);
|
916
|
+
}
|
917
|
+
|
918
|
+
void XPDFViewer::cmdGotoPage(GString *args[], int nArgs,
|
919
|
+
XEvent *event) {
|
920
|
+
int pg;
|
921
|
+
|
922
|
+
pg = atoi(args[0]->getCString());
|
923
|
+
if (pg < 1 || pg > core->getDoc()->getNumPages()) {
|
924
|
+
return;
|
925
|
+
}
|
926
|
+
displayPage(pg, core->getZoom(), core->getRotate(), gTrue, gTrue);
|
927
|
+
}
|
928
|
+
|
929
|
+
void XPDFViewer::cmdGotoPageNoScroll(GString *args[], int nArgs,
|
930
|
+
XEvent *event) {
|
931
|
+
int pg;
|
932
|
+
|
933
|
+
pg = atoi(args[0]->getCString());
|
934
|
+
if (pg < 1 || pg > core->getDoc()->getNumPages()) {
|
935
|
+
return;
|
936
|
+
}
|
937
|
+
displayPage(pg, core->getZoom(), core->getRotate(), gFalse, gTrue);
|
938
|
+
}
|
939
|
+
|
940
|
+
void XPDFViewer::cmdNextPage(GString *args[], int nArgs,
|
941
|
+
XEvent *event) {
|
942
|
+
core->gotoNextPage(1, gTrue);
|
943
|
+
}
|
944
|
+
|
945
|
+
void XPDFViewer::cmdNextPageNoScroll(GString *args[], int nArgs,
|
946
|
+
XEvent *event) {
|
947
|
+
core->gotoNextPage(1, gFalse);
|
948
|
+
}
|
949
|
+
|
950
|
+
void XPDFViewer::cmdOpen(GString *args[], int nArgs,
|
951
|
+
XEvent *event) {
|
952
|
+
mapOpenDialog(gFalse);
|
953
|
+
}
|
954
|
+
|
955
|
+
void XPDFViewer::cmdOpenFile(GString *args[], int nArgs,
|
956
|
+
XEvent *event) {
|
957
|
+
open(args[0], 1, NULL);
|
958
|
+
}
|
959
|
+
|
960
|
+
void XPDFViewer::cmdOpenFileAtDest(GString *args[], int nArgs,
|
961
|
+
XEvent *event) {
|
962
|
+
open(args[0], 1, args[1]);
|
963
|
+
}
|
964
|
+
|
965
|
+
void XPDFViewer::cmdOpenFileAtDestInNewWin(GString *args[], int nArgs,
|
966
|
+
XEvent *event) {
|
967
|
+
app->openAtDest(args[0], args[1]);
|
968
|
+
}
|
969
|
+
|
970
|
+
void XPDFViewer::cmdOpenFileAtPage(GString *args[], int nArgs,
|
971
|
+
XEvent *event) {
|
972
|
+
open(args[0], atoi(args[1]->getCString()), NULL);
|
973
|
+
}
|
974
|
+
|
975
|
+
void XPDFViewer::cmdOpenFileAtPageInNewWin(GString *args[], int nArgs,
|
976
|
+
XEvent *event) {
|
977
|
+
app->open(args[0], atoi(args[1]->getCString()));
|
978
|
+
}
|
979
|
+
|
980
|
+
void XPDFViewer::cmdOpenFileInNewWin(GString *args[], int nArgs,
|
981
|
+
XEvent *event) {
|
982
|
+
app->open(args[0]);
|
983
|
+
}
|
984
|
+
|
985
|
+
void XPDFViewer::cmdOpenInNewWin(GString *args[], int nArgs,
|
986
|
+
XEvent *event) {
|
987
|
+
mapOpenDialog(gTrue);
|
988
|
+
}
|
989
|
+
|
990
|
+
void XPDFViewer::cmdOpenOutline(GString *args[], int nArgs,
|
991
|
+
XEvent *event) {
|
992
|
+
#ifndef DISABLE_OUTLINE
|
993
|
+
Dimension w;
|
994
|
+
|
995
|
+
if (outlineScroll == None) {
|
996
|
+
return;
|
997
|
+
}
|
998
|
+
XtVaGetValues(outlineScroll, XmNwidth, &w, NULL);
|
999
|
+
if (w == 1) {
|
1000
|
+
// this ugly kludge is apparently the only way to resize the panes
|
1001
|
+
// within an XmPanedWindow
|
1002
|
+
XtVaSetValues(outlineScroll, XmNpaneMinimum, outlinePaneWidth,
|
1003
|
+
XmNpaneMaximum, outlinePaneWidth, NULL);
|
1004
|
+
XtVaSetValues(outlineScroll, XmNpaneMinimum, 1,
|
1005
|
+
XmNpaneMaximum, 10000, NULL);
|
1006
|
+
}
|
1007
|
+
#endif
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
void XPDFViewer::cmdPageDown(GString *args[], int nArgs,
|
1011
|
+
XEvent *event) {
|
1012
|
+
core->scrollPageDown();
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
void XPDFViewer::cmdPageUp(GString *args[], int nArgs,
|
1016
|
+
XEvent *event) {
|
1017
|
+
core->scrollPageUp();
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
void XPDFViewer::cmdPostPopupMenu(GString *args[], int nArgs,
|
1021
|
+
XEvent *event) {
|
1022
|
+
XmMenuPosition(popupMenu, event->type == ButtonPress ? &event->xbutton
|
1023
|
+
: (XButtonEvent *)NULL);
|
1024
|
+
XtManageChild(popupMenu);
|
1025
|
+
|
1026
|
+
// this is magic (taken from DDD) - weird things happen if this
|
1027
|
+
// call isn't made (this is done in two different places, in hopes
|
1028
|
+
// of squashing this stupid bug)
|
1029
|
+
XtUngrabButton(core->getDrawAreaWidget(), AnyButton, AnyModifier);
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
void XPDFViewer::cmdPrevPage(GString *args[], int nArgs,
|
1033
|
+
XEvent *event) {
|
1034
|
+
core->gotoPrevPage(1, gTrue, gFalse);
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
void XPDFViewer::cmdPrevPageNoScroll(GString *args[], int nArgs,
|
1038
|
+
XEvent *event) {
|
1039
|
+
core->gotoPrevPage(1, gFalse, gFalse);
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
void XPDFViewer::cmdPrint(GString *args[], int nArgs,
|
1043
|
+
XEvent *event) {
|
1044
|
+
XtManageChild(printDialog);
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
void XPDFViewer::cmdQuit(GString *args[], int nArgs,
|
1048
|
+
XEvent *event) {
|
1049
|
+
app->quit();
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
void XPDFViewer::cmdRaise(GString *args[], int nArgs,
|
1053
|
+
XEvent *event) {
|
1054
|
+
XMapRaised(display, XtWindow(win));
|
1055
|
+
XFlush(display);
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
void XPDFViewer::cmdRedraw(GString *args[], int nArgs,
|
1059
|
+
XEvent *event) {
|
1060
|
+
displayPage(core->getPageNum(), core->getZoom(), core->getRotate(),
|
1061
|
+
gFalse, gFalse);
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
void XPDFViewer::cmdReload(GString *args[], int nArgs,
|
1065
|
+
XEvent *event) {
|
1066
|
+
reloadFile();
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
void XPDFViewer::cmdRun(GString *args[], int nArgs,
|
1070
|
+
XEvent *event) {
|
1071
|
+
GString *fmt, *cmd, *s;
|
1072
|
+
LinkAction *action;
|
1073
|
+
double selLRX, selLRY, selURX, selURY;
|
1074
|
+
int selPage;
|
1075
|
+
GBool gotSel;
|
1076
|
+
char buf[64];
|
1077
|
+
char *p;
|
1078
|
+
char c0, c1;
|
1079
|
+
int i;
|
1080
|
+
|
1081
|
+
cmd = new GString();
|
1082
|
+
fmt = args[0];
|
1083
|
+
i = 0;
|
1084
|
+
gotSel = gFalse;
|
1085
|
+
while (i < fmt->getLength()) {
|
1086
|
+
c0 = fmt->getChar(i);
|
1087
|
+
if (c0 == '%' && i+1 < fmt->getLength()) {
|
1088
|
+
c1 = fmt->getChar(i+1);
|
1089
|
+
switch (c1) {
|
1090
|
+
case 'f':
|
1091
|
+
if (core->getDoc() && (s = core->getDoc()->getFileName())) {
|
1092
|
+
cmd->append(s);
|
1093
|
+
}
|
1094
|
+
break;
|
1095
|
+
case 'b':
|
1096
|
+
if (core->getDoc() && (s = core->getDoc()->getFileName())) {
|
1097
|
+
if ((p = strrchr(s->getCString(), '.'))) {
|
1098
|
+
cmd->append(s->getCString(), p - s->getCString());
|
1099
|
+
} else {
|
1100
|
+
cmd->append(s);
|
1101
|
+
}
|
1102
|
+
}
|
1103
|
+
break;
|
1104
|
+
case 'u':
|
1105
|
+
if ((action = core->getLinkAction()) &&
|
1106
|
+
action->getKind() == actionURI) {
|
1107
|
+
s = core->mungeURL(((LinkURI *)action)->getURI());
|
1108
|
+
cmd->append(s);
|
1109
|
+
delete s;
|
1110
|
+
}
|
1111
|
+
break;
|
1112
|
+
case 'x':
|
1113
|
+
case 'y':
|
1114
|
+
case 'X':
|
1115
|
+
case 'Y':
|
1116
|
+
if (!gotSel) {
|
1117
|
+
if (!core->getSelection(&selPage, &selURX, &selURY,
|
1118
|
+
&selLRX, &selLRY)) {
|
1119
|
+
selPage = 0;
|
1120
|
+
selURX = selURY = selLRX = selLRY = 0;
|
1121
|
+
}
|
1122
|
+
gotSel = gTrue;
|
1123
|
+
}
|
1124
|
+
sprintf(buf, "%g",
|
1125
|
+
(c1 == 'x') ? selURX :
|
1126
|
+
(c1 == 'y') ? selURY :
|
1127
|
+
(c1 == 'X') ? selLRX : selLRY);
|
1128
|
+
cmd->append(buf);
|
1129
|
+
break;
|
1130
|
+
default:
|
1131
|
+
cmd->append(c1);
|
1132
|
+
break;
|
1133
|
+
}
|
1134
|
+
i += 2;
|
1135
|
+
} else {
|
1136
|
+
cmd->append(c0);
|
1137
|
+
++i;
|
1138
|
+
}
|
1139
|
+
}
|
1140
|
+
#ifdef VMS
|
1141
|
+
cmd->insert(0, "spawn/nowait ");
|
1142
|
+
#elif defined(__EMX__)
|
1143
|
+
cmd->insert(0, "start /min /n ");
|
1144
|
+
#else
|
1145
|
+
cmd->append(" &");
|
1146
|
+
#endif
|
1147
|
+
system(cmd->getCString());
|
1148
|
+
delete cmd;
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
void XPDFViewer::cmdScrollDown(GString *args[], int nArgs,
|
1152
|
+
XEvent *event) {
|
1153
|
+
core->scrollDown(atoi(args[0]->getCString()));
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
void XPDFViewer::cmdScrollDownNextPage(GString *args[], int nArgs,
|
1157
|
+
XEvent *event) {
|
1158
|
+
core->scrollDownNextPage(atoi(args[0]->getCString()));
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
void XPDFViewer::cmdScrollLeft(GString *args[], int nArgs,
|
1162
|
+
XEvent *event) {
|
1163
|
+
core->scrollLeft(atoi(args[0]->getCString()));
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
void XPDFViewer::cmdScrollOutlineDown(GString *args[], int nArgs,
|
1167
|
+
XEvent *event) {
|
1168
|
+
#ifndef DISABLE_OUTLINE
|
1169
|
+
Widget sb;
|
1170
|
+
int val, inc, pageInc, m, slider;
|
1171
|
+
|
1172
|
+
if (outlineScroll == None) {
|
1173
|
+
return;
|
1174
|
+
}
|
1175
|
+
if ((sb = XtNameToWidget(outlineScroll, "VertScrollBar"))) {
|
1176
|
+
XtVaGetValues(sb, XmNvalue, &val, XmNincrement, &inc,
|
1177
|
+
XmNpageIncrement, &pageInc, XmNmaximum, &m,
|
1178
|
+
XmNsliderSize, &slider, NULL);
|
1179
|
+
if ((val += inc * atoi(args[0]->getCString())) > m - slider) {
|
1180
|
+
val = m - slider;
|
1181
|
+
}
|
1182
|
+
XmScrollBarSetValues(sb, val, slider, inc, pageInc, True);
|
1183
|
+
}
|
1184
|
+
#endif
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
void XPDFViewer::cmdScrollOutlineUp(GString *args[], int nArgs,
|
1188
|
+
XEvent *event) {
|
1189
|
+
#ifndef DISABLE_OUTLINE
|
1190
|
+
Widget sb;
|
1191
|
+
int val, inc, pageInc, m, slider;
|
1192
|
+
|
1193
|
+
if (outlineScroll == None) {
|
1194
|
+
return;
|
1195
|
+
}
|
1196
|
+
if ((sb = XtNameToWidget(outlineScroll, "VertScrollBar"))) {
|
1197
|
+
XtVaGetValues(sb, XmNvalue, &val, XmNincrement, &inc,
|
1198
|
+
XmNpageIncrement, &pageInc, XmNminimum, &m,
|
1199
|
+
XmNsliderSize, &slider, NULL);
|
1200
|
+
if ((val -= inc * atoi(args[0]->getCString())) < m) {
|
1201
|
+
val = m;
|
1202
|
+
}
|
1203
|
+
XmScrollBarSetValues(sb, val, slider, inc, pageInc, True);
|
1204
|
+
}
|
1205
|
+
#endif
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
void XPDFViewer::cmdScrollRight(GString *args[], int nArgs,
|
1209
|
+
XEvent *event) {
|
1210
|
+
core->scrollRight(atoi(args[0]->getCString()));
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
void XPDFViewer::cmdScrollToBottomEdge(GString *args[], int nArgs,
|
1214
|
+
XEvent *event) {
|
1215
|
+
core->scrollToBottomEdge();
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
void XPDFViewer::cmdScrollToBottomRight(GString *args[], int nArgs,
|
1219
|
+
XEvent *event) {
|
1220
|
+
core->scrollToBottomRight();
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
void XPDFViewer::cmdScrollToLeftEdge(GString *args[], int nArgs,
|
1224
|
+
XEvent *event) {
|
1225
|
+
core->scrollToLeftEdge();
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
void XPDFViewer::cmdScrollToRightEdge(GString *args[], int nArgs,
|
1229
|
+
XEvent *event) {
|
1230
|
+
core->scrollToRightEdge();
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
void XPDFViewer::cmdScrollToTopEdge(GString *args[], int nArgs,
|
1234
|
+
XEvent *event) {
|
1235
|
+
core->scrollToTopEdge();
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
void XPDFViewer::cmdScrollToTopLeft(GString *args[], int nArgs,
|
1239
|
+
XEvent *event) {
|
1240
|
+
core->scrollToTopLeft();
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
void XPDFViewer::cmdScrollUp(GString *args[], int nArgs,
|
1244
|
+
XEvent *event) {
|
1245
|
+
core->scrollUp(atoi(args[0]->getCString()));
|
1246
|
+
}
|
1247
|
+
|
1248
|
+
void XPDFViewer::cmdScrollUpPrevPage(GString *args[], int nArgs,
|
1249
|
+
XEvent *event) {
|
1250
|
+
core->scrollUpPrevPage(atoi(args[0]->getCString()));
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
void XPDFViewer::cmdSinglePageMode(GString *args[], int nArgs,
|
1254
|
+
XEvent *event) {
|
1255
|
+
Widget btn;
|
1256
|
+
|
1257
|
+
if (!core->getContinuousMode()) {
|
1258
|
+
return;
|
1259
|
+
}
|
1260
|
+
core->setContinuousMode(gFalse);
|
1261
|
+
|
1262
|
+
btn = XtNameToWidget(popupMenu, "continuousMode");
|
1263
|
+
XtVaSetValues(btn, XmNset, XmUNSET, NULL);
|
1264
|
+
}
|
1265
|
+
|
1266
|
+
void XPDFViewer::cmdStartPan(GString *args[], int nArgs,
|
1267
|
+
XEvent *event) {
|
1268
|
+
core->startPan(mouseX(event), mouseY(event));
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
void XPDFViewer::cmdStartSelection(GString *args[], int nArgs,
|
1272
|
+
XEvent *event) {
|
1273
|
+
core->startSelection(mouseX(event), mouseY(event));
|
1274
|
+
}
|
1275
|
+
|
1276
|
+
void XPDFViewer::cmdToggleContinuousMode(GString *args[], int nArgs,
|
1277
|
+
XEvent *event) {
|
1278
|
+
if (core->getContinuousMode()) {
|
1279
|
+
cmdSinglePageMode(NULL, 0, event);
|
1280
|
+
} else {
|
1281
|
+
cmdContinuousMode(NULL, 0, event);
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
void XPDFViewer::cmdToggleFullScreenMode(GString *args[], int nArgs,
|
1286
|
+
XEvent *event) {
|
1287
|
+
if (core->getFullScreen()) {
|
1288
|
+
cmdWindowMode(NULL, 0, event);
|
1289
|
+
} else {
|
1290
|
+
cmdFullScreenMode(NULL, 0, event);
|
1291
|
+
}
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
void XPDFViewer::cmdToggleOutline(GString *args[], int nArgs,
|
1295
|
+
XEvent *event) {
|
1296
|
+
#ifndef DISABLE_OUTLINE
|
1297
|
+
Dimension w;
|
1298
|
+
|
1299
|
+
if (outlineScroll == None) {
|
1300
|
+
return;
|
1301
|
+
}
|
1302
|
+
XtVaGetValues(outlineScroll, XmNwidth, &w, NULL);
|
1303
|
+
if (w > 1) {
|
1304
|
+
cmdCloseOutline(NULL, 0, event);
|
1305
|
+
} else {
|
1306
|
+
cmdOpenOutline(NULL, 0, event);
|
1307
|
+
}
|
1308
|
+
#endif
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
void XPDFViewer::cmdWindowMode(GString *args[], int nArgs,
|
1312
|
+
XEvent *event) {
|
1313
|
+
PDFDoc *doc;
|
1314
|
+
XPDFViewer *viewer;
|
1315
|
+
int pg;
|
1316
|
+
Widget btn;
|
1317
|
+
|
1318
|
+
if (!core->getFullScreen()) {
|
1319
|
+
return;
|
1320
|
+
}
|
1321
|
+
pg = core->getPageNum();
|
1322
|
+
XtPopdown(win);
|
1323
|
+
doc = core->takeDoc(gFalse);
|
1324
|
+
viewer = app->reopen(this, doc, pg, gFalse);
|
1325
|
+
|
1326
|
+
btn = XtNameToWidget(viewer->popupMenu, "fullScreen");
|
1327
|
+
XtVaSetValues(btn, XmNset, XmUNSET, NULL);
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
void XPDFViewer::cmdZoomFitPage(GString *args[], int nArgs,
|
1331
|
+
XEvent *event) {
|
1332
|
+
if (core->getZoom() != zoomPage) {
|
1333
|
+
setZoomIdx(zoomPageIdx);
|
1334
|
+
displayPage(core->getPageNum(), zoomPage,
|
1335
|
+
core->getRotate(), gTrue, gFalse);
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
void XPDFViewer::cmdZoomFitWidth(GString *args[], int nArgs,
|
1340
|
+
XEvent *event) {
|
1341
|
+
if (core->getZoom() != zoomWidth) {
|
1342
|
+
setZoomIdx(zoomWidthIdx);
|
1343
|
+
displayPage(core->getPageNum(), zoomWidth,
|
1344
|
+
core->getRotate(), gTrue, gFalse);
|
1345
|
+
}
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
void XPDFViewer::cmdZoomIn(GString *args[], int nArgs,
|
1349
|
+
XEvent *event) {
|
1350
|
+
int z;
|
1351
|
+
|
1352
|
+
z = getZoomIdx();
|
1353
|
+
if (z <= minZoomIdx && z > maxZoomIdx) {
|
1354
|
+
--z;
|
1355
|
+
setZoomIdx(z);
|
1356
|
+
displayPage(core->getPageNum(), zoomMenuInfo[z].zoom,
|
1357
|
+
core->getRotate(), gTrue, gFalse);
|
1358
|
+
}
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
void XPDFViewer::cmdZoomOut(GString *args[], int nArgs,
|
1362
|
+
XEvent *event) {
|
1363
|
+
int z;
|
1364
|
+
|
1365
|
+
z = getZoomIdx();
|
1366
|
+
if (z < minZoomIdx && z >= maxZoomIdx) {
|
1367
|
+
++z;
|
1368
|
+
setZoomIdx(z);
|
1369
|
+
displayPage(core->getPageNum(), zoomMenuInfo[z].zoom,
|
1370
|
+
core->getRotate(), gTrue, gFalse);
|
1371
|
+
}
|
1372
|
+
}
|
1373
|
+
|
1374
|
+
void XPDFViewer::cmdZoomPercent(GString *args[], int nArgs,
|
1375
|
+
XEvent *event) {
|
1376
|
+
double z;
|
1377
|
+
|
1378
|
+
z = atof(args[0]->getCString());
|
1379
|
+
setZoomVal(z);
|
1380
|
+
displayPage(core->getPageNum(), z, core->getRotate(), gTrue, gFalse);
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
void XPDFViewer::cmdZoomToSelection(GString *args[], int nArgs,
|
1384
|
+
XEvent *event) {
|
1385
|
+
int pg;
|
1386
|
+
double ulx, uly, lrx, lry;
|
1387
|
+
|
1388
|
+
if (core->getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
|
1389
|
+
core->zoomToRect(pg, ulx, uly, lrx, lry);
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
//------------------------------------------------------------------------
|
1394
|
+
// GUI code: main window
|
1395
|
+
//------------------------------------------------------------------------
|
1396
|
+
|
1397
|
+
void XPDFViewer::initWindow(GBool fullScreen) {
|
1398
|
+
Colormap colormap;
|
1399
|
+
XColor xcol;
|
1400
|
+
Atom state, val;
|
1401
|
+
Arg args[20];
|
1402
|
+
int n;
|
1403
|
+
char *title;
|
1404
|
+
|
1405
|
+
display = XtDisplay(app->getAppShell());
|
1406
|
+
screenNum = XScreenNumberOfScreen(XtScreen(app->getAppShell()));
|
1407
|
+
|
1408
|
+
toolBar = None;
|
1409
|
+
#ifndef DISABLE_OUTLINE
|
1410
|
+
outlineScroll = None;
|
1411
|
+
#endif
|
1412
|
+
|
1413
|
+
// private colormap
|
1414
|
+
if (app->getInstallCmap()) {
|
1415
|
+
XtVaGetValues(app->getAppShell(), XmNcolormap, &colormap, NULL);
|
1416
|
+
// ensure that BlackPixel and WhitePixel are reserved in the
|
1417
|
+
// new colormap
|
1418
|
+
xcol.red = xcol.green = xcol.blue = 0;
|
1419
|
+
XAllocColor(display, colormap, &xcol);
|
1420
|
+
xcol.red = xcol.green = xcol.blue = 65535;
|
1421
|
+
XAllocColor(display, colormap, &xcol);
|
1422
|
+
colormap = XCopyColormapAndFree(display, colormap);
|
1423
|
+
}
|
1424
|
+
|
1425
|
+
// top-level window
|
1426
|
+
n = 0;
|
1427
|
+
title = app->getTitle() ? app->getTitle()->getCString()
|
1428
|
+
: (char *)xpdfAppName;
|
1429
|
+
XtSetArg(args[n], XmNtitle, title); ++n;
|
1430
|
+
XtSetArg(args[n], XmNiconName, title); ++n;
|
1431
|
+
XtSetArg(args[n], XmNminWidth, 100); ++n;
|
1432
|
+
XtSetArg(args[n], XmNminHeight, 100); ++n;
|
1433
|
+
XtSetArg(args[n], XmNbaseWidth, 0); ++n;
|
1434
|
+
XtSetArg(args[n], XmNbaseHeight, 0); ++n;
|
1435
|
+
XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); ++n;
|
1436
|
+
win = XtCreatePopupShell("win", topLevelShellWidgetClass,
|
1437
|
+
app->getAppShell(), args, n);
|
1438
|
+
if (app->getInstallCmap()) {
|
1439
|
+
XtVaSetValues(win, XmNcolormap, colormap, NULL);
|
1440
|
+
}
|
1441
|
+
XmAddWMProtocolCallback(win, XInternAtom(display, "WM_DELETE_WINDOW", False),
|
1442
|
+
&closeMsgCbk, this);
|
1443
|
+
|
1444
|
+
// create the full-screen window
|
1445
|
+
if (fullScreen) {
|
1446
|
+
initCore(win, gTrue);
|
1447
|
+
|
1448
|
+
// create the normal (non-full-screen) window
|
1449
|
+
} else {
|
1450
|
+
if (app->getGeometry()) {
|
1451
|
+
n = 0;
|
1452
|
+
XtSetArg(args[n], XmNgeometry, app->getGeometry()->getCString()); ++n;
|
1453
|
+
XtSetValues(win, args, n);
|
1454
|
+
}
|
1455
|
+
|
1456
|
+
n = 0;
|
1457
|
+
form = XmCreateForm(win, "form", args, n);
|
1458
|
+
XtManageChild(form);
|
1459
|
+
|
1460
|
+
#ifdef DISABLE_OUTLINE
|
1461
|
+
initToolbar(form);
|
1462
|
+
n = 0;
|
1463
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
1464
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
1465
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1466
|
+
XtSetValues(toolBar, args, n);
|
1467
|
+
|
1468
|
+
initCore(form, gFalse);
|
1469
|
+
n = 0;
|
1470
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1471
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
1472
|
+
XtSetArg(args[n], XmNbottomWidget, toolBar); ++n;
|
1473
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
1474
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
1475
|
+
XtSetValues(core->getWidget(), args, n);
|
1476
|
+
#else
|
1477
|
+
initToolbar(form);
|
1478
|
+
n = 0;
|
1479
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
1480
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
1481
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1482
|
+
XtSetValues(toolBar, args, n);
|
1483
|
+
|
1484
|
+
initPanedWin(form);
|
1485
|
+
n = 0;
|
1486
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1487
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
1488
|
+
XtSetArg(args[n], XmNbottomWidget, toolBar); ++n;
|
1489
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
1490
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
1491
|
+
XtSetValues(panedWin, args, n);
|
1492
|
+
|
1493
|
+
initCore(panedWin, fullScreen);
|
1494
|
+
n = 0;
|
1495
|
+
XtSetArg(args[n], XmNpositionIndex, 1); ++n;
|
1496
|
+
XtSetArg(args[n], XmNallowResize, True); ++n;
|
1497
|
+
XtSetArg(args[n], XmNpaneMinimum, 1); ++n;
|
1498
|
+
XtSetArg(args[n], XmNpaneMaximum, 10000); ++n;
|
1499
|
+
XtSetValues(core->getWidget(), args, n);
|
1500
|
+
#endif
|
1501
|
+
}
|
1502
|
+
|
1503
|
+
// set the zoom menu to match the initial zoom setting
|
1504
|
+
setZoomVal(core->getZoom());
|
1505
|
+
|
1506
|
+
// set traversal order
|
1507
|
+
XtVaSetValues(core->getDrawAreaWidget(),
|
1508
|
+
XmNnavigationType, XmEXCLUSIVE_TAB_GROUP, NULL);
|
1509
|
+
if (toolBar != None) {
|
1510
|
+
XtVaSetValues(backBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1511
|
+
NULL);
|
1512
|
+
XtVaSetValues(prevTenPageBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1513
|
+
NULL);
|
1514
|
+
XtVaSetValues(prevPageBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1515
|
+
NULL);
|
1516
|
+
XtVaSetValues(nextPageBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1517
|
+
NULL);
|
1518
|
+
XtVaSetValues(nextTenPageBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1519
|
+
NULL);
|
1520
|
+
XtVaSetValues(forwardBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1521
|
+
NULL);
|
1522
|
+
XtVaSetValues(pageNumText, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1523
|
+
NULL);
|
1524
|
+
XtVaSetValues(zoomWidget, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1525
|
+
NULL);
|
1526
|
+
XtVaSetValues(findBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1527
|
+
NULL);
|
1528
|
+
XtVaSetValues(printBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1529
|
+
NULL);
|
1530
|
+
XtVaSetValues(aboutBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1531
|
+
NULL);
|
1532
|
+
XtVaSetValues(quitBtn, XmNnavigationType, XmEXCLUSIVE_TAB_GROUP,
|
1533
|
+
NULL);
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
initPopupMenu();
|
1537
|
+
|
1538
|
+
if (fullScreen) {
|
1539
|
+
// Set both the old-style Motif decorations hint and the new-style
|
1540
|
+
// _NET_WM_STATE property. This is redundant, but might be useful
|
1541
|
+
// for older window managers. We also set the geometry to +0+0 to
|
1542
|
+
// avoid interactive placement. (Note: we need to realize the
|
1543
|
+
// shell, so it has a Window on which to set the _NET_WM_STATE
|
1544
|
+
// property, but we don't want to map it until later, so we set
|
1545
|
+
// mappedWhenManaged to false.)
|
1546
|
+
n = 0;
|
1547
|
+
XtSetArg(args[n], XmNmappedWhenManaged, False); ++n;
|
1548
|
+
XtSetArg(args[n], XmNmwmDecorations, 0); ++n;
|
1549
|
+
XtSetArg(args[n], XmNgeometry, "+0+0"); ++n;
|
1550
|
+
XtSetValues(win, args, n);
|
1551
|
+
XtRealizeWidget(win);
|
1552
|
+
state = XInternAtom(display, "_NET_WM_STATE", False);
|
1553
|
+
val = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False);
|
1554
|
+
XChangeProperty(display, XtWindow(win), state, XA_ATOM, 32,
|
1555
|
+
PropModeReplace, (Guchar *)&val, 1);
|
1556
|
+
}
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
void XPDFViewer::initToolbar(Widget parent) {
|
1560
|
+
Widget label, lastBtn;
|
1561
|
+
#ifndef USE_COMBO_BOX
|
1562
|
+
Widget btn;
|
1563
|
+
#endif
|
1564
|
+
Arg args[20];
|
1565
|
+
int n;
|
1566
|
+
XmString s, emptyString;
|
1567
|
+
int i;
|
1568
|
+
|
1569
|
+
// toolbar
|
1570
|
+
n = 0;
|
1571
|
+
toolBar = XmCreateForm(parent, "toolBar", args, n);
|
1572
|
+
XtManageChild(toolBar);
|
1573
|
+
|
1574
|
+
// create an empty string -- this is used for buttons that will get
|
1575
|
+
// pixmaps later
|
1576
|
+
emptyString = XmStringCreateLocalized("");
|
1577
|
+
|
1578
|
+
// page movement buttons
|
1579
|
+
n = 0;
|
1580
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
1581
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1582
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1583
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1584
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1585
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1586
|
+
backBtn = XmCreatePushButton(toolBar, "back", args, n);
|
1587
|
+
addToolTip(backBtn, "Back");
|
1588
|
+
XtManageChild(backBtn);
|
1589
|
+
XtAddCallback(backBtn, XmNactivateCallback,
|
1590
|
+
&backCbk, (XtPointer)this);
|
1591
|
+
n = 0;
|
1592
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1593
|
+
XtSetArg(args[n], XmNleftWidget, backBtn); ++n;
|
1594
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1595
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1596
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1597
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1598
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1599
|
+
prevTenPageBtn = XmCreatePushButton(toolBar, "prevTenPage", args, n);
|
1600
|
+
addToolTip(prevTenPageBtn, "-10 pages");
|
1601
|
+
XtManageChild(prevTenPageBtn);
|
1602
|
+
XtAddCallback(prevTenPageBtn, XmNactivateCallback,
|
1603
|
+
&prevTenPageCbk, (XtPointer)this);
|
1604
|
+
n = 0;
|
1605
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1606
|
+
XtSetArg(args[n], XmNleftWidget, prevTenPageBtn); ++n;
|
1607
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1608
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1609
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1610
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1611
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1612
|
+
prevPageBtn = XmCreatePushButton(toolBar, "prevPage", args, n);
|
1613
|
+
addToolTip(prevPageBtn, "Previous page");
|
1614
|
+
XtManageChild(prevPageBtn);
|
1615
|
+
XtAddCallback(prevPageBtn, XmNactivateCallback,
|
1616
|
+
&prevPageCbk, (XtPointer)this);
|
1617
|
+
n = 0;
|
1618
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1619
|
+
XtSetArg(args[n], XmNleftWidget, prevPageBtn); ++n;
|
1620
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1621
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1622
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1623
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1624
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1625
|
+
nextPageBtn = XmCreatePushButton(toolBar, "nextPage", args, n);
|
1626
|
+
addToolTip(nextPageBtn, "Next page");
|
1627
|
+
XtManageChild(nextPageBtn);
|
1628
|
+
XtAddCallback(nextPageBtn, XmNactivateCallback,
|
1629
|
+
&nextPageCbk, (XtPointer)this);
|
1630
|
+
n = 0;
|
1631
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1632
|
+
XtSetArg(args[n], XmNleftWidget, nextPageBtn); ++n;
|
1633
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1634
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1635
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1636
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1637
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1638
|
+
nextTenPageBtn = XmCreatePushButton(toolBar, "nextTenPage", args, n);
|
1639
|
+
addToolTip(nextTenPageBtn, "+10 pages");
|
1640
|
+
XtManageChild(nextTenPageBtn);
|
1641
|
+
XtAddCallback(nextTenPageBtn, XmNactivateCallback,
|
1642
|
+
&nextTenPageCbk, (XtPointer)this);
|
1643
|
+
n = 0;
|
1644
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1645
|
+
XtSetArg(args[n], XmNleftWidget, nextTenPageBtn); ++n;
|
1646
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1647
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1648
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1649
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
1650
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1651
|
+
forwardBtn = XmCreatePushButton(toolBar, "forward", args, n);
|
1652
|
+
addToolTip(forwardBtn, "Forward");
|
1653
|
+
XtManageChild(forwardBtn);
|
1654
|
+
XtAddCallback(forwardBtn, XmNactivateCallback,
|
1655
|
+
&forwardCbk, (XtPointer)this);
|
1656
|
+
|
1657
|
+
// page number display
|
1658
|
+
n = 0;
|
1659
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1660
|
+
XtSetArg(args[n], XmNleftWidget, forwardBtn); ++n;
|
1661
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1662
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1663
|
+
s = XmStringCreateLocalized("Page ");
|
1664
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1665
|
+
label = XmCreateLabel(toolBar, "pageLabel", args, n);
|
1666
|
+
XmStringFree(s);
|
1667
|
+
XtManageChild(label);
|
1668
|
+
n = 0;
|
1669
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1670
|
+
XtSetArg(args[n], XmNleftWidget, label); ++n;
|
1671
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1672
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1673
|
+
XtSetArg(args[n], XmNmarginWidth, 3); ++n;
|
1674
|
+
XtSetArg(args[n], XmNmarginHeight, 3); ++n;
|
1675
|
+
XtSetArg(args[n], XmNcolumns, 5); ++n;
|
1676
|
+
pageNumText = XmCreateTextField(toolBar, "pageNum", args, n);
|
1677
|
+
XtManageChild(pageNumText);
|
1678
|
+
XtAddCallback(pageNumText, XmNactivateCallback,
|
1679
|
+
&pageNumCbk, (XtPointer)this);
|
1680
|
+
n = 0;
|
1681
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1682
|
+
XtSetArg(args[n], XmNleftWidget, pageNumText); ++n;
|
1683
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1684
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1685
|
+
s = XmStringCreateLocalized(" of 00000");
|
1686
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1687
|
+
XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); ++n;
|
1688
|
+
XtSetArg(args[n], XmNrecomputeSize, False); ++n;
|
1689
|
+
pageCountLabel = XmCreateLabel(toolBar, "pageCountLabel", args, n);
|
1690
|
+
XmStringFree(s);
|
1691
|
+
XtManageChild(pageCountLabel);
|
1692
|
+
s = XmStringCreateLocalized(" of 0");
|
1693
|
+
XtVaSetValues(pageCountLabel, XmNlabelString, s, NULL);
|
1694
|
+
XmStringFree(s);
|
1695
|
+
|
1696
|
+
// zoom menu
|
1697
|
+
#if USE_COMBO_BOX
|
1698
|
+
XmString st[nZoomMenuItems];
|
1699
|
+
n = 0;
|
1700
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1701
|
+
XtSetArg(args[n], XmNleftWidget, pageCountLabel); ++n;
|
1702
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1703
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1704
|
+
XtSetArg(args[n], XmNmarginWidth, 0); ++n;
|
1705
|
+
XtSetArg(args[n], XmNmarginHeight, 0); ++n;
|
1706
|
+
XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); ++n;
|
1707
|
+
XtSetArg(args[n], XmNpositionMode, XmONE_BASED); ++n;
|
1708
|
+
XtSetArg(args[n], XmNcolumns, 7); ++n;
|
1709
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
1710
|
+
st[i] = XmStringCreateLocalized(zoomMenuInfo[i].label);
|
1711
|
+
}
|
1712
|
+
XtSetArg(args[n], XmNitems, st); ++n;
|
1713
|
+
XtSetArg(args[n], XmNitemCount, nZoomMenuItems); ++n;
|
1714
|
+
zoomComboBox = XmCreateComboBox(toolBar, "zoomComboBox", args, n);
|
1715
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
1716
|
+
XmStringFree(st[i]);
|
1717
|
+
}
|
1718
|
+
addToolTip(zoomComboBox, "Zoom");
|
1719
|
+
XtAddCallback(zoomComboBox, XmNselectionCallback,
|
1720
|
+
&zoomComboBoxCbk, (XtPointer)this);
|
1721
|
+
XtManageChild(zoomComboBox);
|
1722
|
+
zoomWidget = zoomComboBox;
|
1723
|
+
#else
|
1724
|
+
Widget menuPane;
|
1725
|
+
char buf[16];
|
1726
|
+
n = 0;
|
1727
|
+
menuPane = XmCreatePulldownMenu(toolBar, "zoomMenuPane", args, n);
|
1728
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
1729
|
+
n = 0;
|
1730
|
+
s = XmStringCreateLocalized(zoomMenuInfo[i].label);
|
1731
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1732
|
+
XtSetArg(args[n], XmNuserData, (XtPointer)i); ++n;
|
1733
|
+
sprintf(buf, "zoom%d", i);
|
1734
|
+
btn = XmCreatePushButton(menuPane, buf, args, n);
|
1735
|
+
XmStringFree(s);
|
1736
|
+
XtManageChild(btn);
|
1737
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1738
|
+
&zoomMenuCbk, (XtPointer)this);
|
1739
|
+
zoomMenuBtns[i] = btn;
|
1740
|
+
}
|
1741
|
+
n = 0;
|
1742
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1743
|
+
XtSetArg(args[n], XmNleftWidget, pageCountLabel); ++n;
|
1744
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1745
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1746
|
+
XtSetArg(args[n], XmNmarginWidth, 0); ++n;
|
1747
|
+
XtSetArg(args[n], XmNmarginHeight, 0); ++n;
|
1748
|
+
XtSetArg(args[n], XmNsubMenuId, menuPane); ++n;
|
1749
|
+
zoomMenu = XmCreateOptionMenu(toolBar, "zoomMenu", args, n);
|
1750
|
+
addToolTip(zoomMenu, "Zoom");
|
1751
|
+
XtManageChild(zoomMenu);
|
1752
|
+
zoomWidget = zoomMenu;
|
1753
|
+
#endif
|
1754
|
+
|
1755
|
+
// find/print/about buttons
|
1756
|
+
n = 0;
|
1757
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1758
|
+
XtSetArg(args[n], XmNleftWidget, zoomWidget); ++n;
|
1759
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1760
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1761
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1762
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1763
|
+
findBtn = XmCreatePushButton(toolBar, "find", args, n);
|
1764
|
+
addToolTip(findBtn, "Find");
|
1765
|
+
XtManageChild(findBtn);
|
1766
|
+
XtAddCallback(findBtn, XmNactivateCallback,
|
1767
|
+
&findCbk, (XtPointer)this);
|
1768
|
+
n = 0;
|
1769
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1770
|
+
XtSetArg(args[n], XmNleftWidget, findBtn); ++n;
|
1771
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1772
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1773
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1774
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1775
|
+
printBtn = XmCreatePushButton(toolBar, "print", args, n);
|
1776
|
+
addToolTip(printBtn, "Print");
|
1777
|
+
XtManageChild(printBtn);
|
1778
|
+
XtAddCallback(printBtn, XmNactivateCallback,
|
1779
|
+
&printCbk, (XtPointer)this);
|
1780
|
+
n = 0;
|
1781
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1782
|
+
XtSetArg(args[n], XmNleftWidget, printBtn); ++n;
|
1783
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1784
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1785
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1786
|
+
XtSetArg(args[n], XmNlabelString, emptyString); ++n;
|
1787
|
+
aboutBtn = XmCreatePushButton(toolBar, "about", args, n);
|
1788
|
+
addToolTip(aboutBtn, "About / help");
|
1789
|
+
XtManageChild(aboutBtn);
|
1790
|
+
XtAddCallback(aboutBtn, XmNactivateCallback,
|
1791
|
+
&aboutCbk, (XtPointer)this);
|
1792
|
+
lastBtn = aboutBtn;
|
1793
|
+
|
1794
|
+
// quit button
|
1795
|
+
n = 0;
|
1796
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
1797
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1798
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1799
|
+
XtSetArg(args[n], XmNmarginWidth, 6); ++n;
|
1800
|
+
s = XmStringCreateLocalized("Quit");
|
1801
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1802
|
+
quitBtn = XmCreatePushButton(toolBar, "quit", args, n);
|
1803
|
+
XmStringFree(s);
|
1804
|
+
XtManageChild(quitBtn);
|
1805
|
+
XtAddCallback(quitBtn, XmNactivateCallback,
|
1806
|
+
&quitCbk, (XtPointer)this);
|
1807
|
+
|
1808
|
+
// link label
|
1809
|
+
n = 0;
|
1810
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
1811
|
+
XtSetArg(args[n], XmNleftWidget, lastBtn); ++n;
|
1812
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); ++n;
|
1813
|
+
XtSetArg(args[n], XmNrightWidget, quitBtn); ++n;
|
1814
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
1815
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
1816
|
+
s = XmStringCreateLocalized("");
|
1817
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1818
|
+
XtSetArg(args[n], XmNrecomputeSize, True); ++n;
|
1819
|
+
XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); ++n;
|
1820
|
+
linkLabel = XmCreateLabel(toolBar, "linkLabel", args, n);
|
1821
|
+
XmStringFree(s);
|
1822
|
+
XtManageChild(linkLabel);
|
1823
|
+
|
1824
|
+
XmStringFree(emptyString);
|
1825
|
+
}
|
1826
|
+
|
1827
|
+
#ifndef DISABLE_OUTLINE
|
1828
|
+
void XPDFViewer::initPanedWin(Widget parent) {
|
1829
|
+
Widget clipWin;
|
1830
|
+
Arg args[20];
|
1831
|
+
int n;
|
1832
|
+
|
1833
|
+
// paned window
|
1834
|
+
n = 0;
|
1835
|
+
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); ++n;
|
1836
|
+
#if defined(__sgi) && (XmVERSION <= 1)
|
1837
|
+
panedWin = SgCreateHorzPanedWindow(parent, "panedWin", args, n);
|
1838
|
+
#else
|
1839
|
+
panedWin = XmCreatePanedWindow(parent, "panedWin", args, n);
|
1840
|
+
#endif
|
1841
|
+
XtManageChild(panedWin);
|
1842
|
+
|
1843
|
+
// scrolled window for outline container
|
1844
|
+
n = 0;
|
1845
|
+
XtSetArg(args[n], XmNpositionIndex, 0); ++n;
|
1846
|
+
XtSetArg(args[n], XmNallowResize, True); ++n;
|
1847
|
+
XtSetArg(args[n], XmNpaneMinimum, 1); ++n;
|
1848
|
+
XtSetArg(args[n], XmNpaneMaximum, 10000); ++n;
|
1849
|
+
#if !(defined(__sgi) && (XmVERSION <= 1))
|
1850
|
+
XtSetArg(args[n], XmNwidth, 1); ++n;
|
1851
|
+
#endif
|
1852
|
+
XtSetArg(args[n], XmNscrollingPolicy, XmAUTOMATIC); ++n;
|
1853
|
+
outlineScroll = XmCreateScrolledWindow(panedWin, "outlineScroll", args, n);
|
1854
|
+
XtManageChild(outlineScroll);
|
1855
|
+
XtVaGetValues(outlineScroll, XmNclipWindow, &clipWin, NULL);
|
1856
|
+
XtVaSetValues(clipWin, XmNbackground, app->getPaperPixel(), NULL);
|
1857
|
+
|
1858
|
+
// outline tree
|
1859
|
+
n = 0;
|
1860
|
+
XtSetArg(args[n], XmNbackground, app->getPaperPixel()); ++n;
|
1861
|
+
outlineTree = XPDFCreateTree(outlineScroll, "outlineTree", args, n);
|
1862
|
+
XtManageChild(outlineTree);
|
1863
|
+
XtAddCallback(outlineTree, XPDFNselectionCallback, &outlineSelectCbk,
|
1864
|
+
(XtPointer)this);
|
1865
|
+
}
|
1866
|
+
#endif
|
1867
|
+
|
1868
|
+
void XPDFViewer::initCore(Widget parent, GBool fullScreen) {
|
1869
|
+
core = new XPDFCore(win, parent,
|
1870
|
+
app->getPaperRGB(), app->getPaperPixel(),
|
1871
|
+
app->getMattePixel(fullScreen),
|
1872
|
+
fullScreen, app->getReverseVideo(),
|
1873
|
+
app->getInstallCmap(), app->getRGBCubeSize());
|
1874
|
+
core->setUpdateCbk(&updateCbk, this);
|
1875
|
+
core->setActionCbk(&actionCbk, this);
|
1876
|
+
core->setKeyPressCbk(&keyPressCbk, this);
|
1877
|
+
core->setMouseCbk(&mouseCbk, this);
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
void XPDFViewer::initPopupMenu() {
|
1881
|
+
Widget btn;
|
1882
|
+
Arg args[20];
|
1883
|
+
int n;
|
1884
|
+
XmString s, s2;
|
1885
|
+
|
1886
|
+
n = 0;
|
1887
|
+
#if XmVersion < 1002
|
1888
|
+
// older versions of Motif need this, newer ones choke on it,
|
1889
|
+
// sometimes not displaying the menu at all, maybe depending on the
|
1890
|
+
// state of the NumLock key (taken from DDD)
|
1891
|
+
XtSetArg(args[n], XmNmenuPost, "<Btn3Down>"); ++n;
|
1892
|
+
#endif
|
1893
|
+
popupMenu = XmCreatePopupMenu(core->getDrawAreaWidget(), "popupMenu",
|
1894
|
+
args, n);
|
1895
|
+
n = 0;
|
1896
|
+
s = XmStringCreateLocalized("Open...");
|
1897
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1898
|
+
s2 = XmStringCreateLocalized("O");
|
1899
|
+
XtSetArg(args[n], XmNacceleratorText, s2); ++n;
|
1900
|
+
btn = XmCreatePushButton(popupMenu, "open", args, n);
|
1901
|
+
XmStringFree(s);
|
1902
|
+
XmStringFree(s2);
|
1903
|
+
XtManageChild(btn);
|
1904
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1905
|
+
&openCbk, (XtPointer)this);
|
1906
|
+
n = 0;
|
1907
|
+
s = XmStringCreateLocalized("Open in new window...");
|
1908
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1909
|
+
btn = XmCreatePushButton(popupMenu, "openInNewWindow", args, n);
|
1910
|
+
XmStringFree(s);
|
1911
|
+
XtManageChild(btn);
|
1912
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1913
|
+
&openInNewWindowCbk, (XtPointer)this);
|
1914
|
+
n = 0;
|
1915
|
+
s = XmStringCreateLocalized("Reload");
|
1916
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1917
|
+
s2 = XmStringCreateLocalized("R");
|
1918
|
+
XtSetArg(args[n], XmNacceleratorText, s2); ++n;
|
1919
|
+
btn = XmCreatePushButton(popupMenu, "reload", args, n);
|
1920
|
+
XmStringFree(s);
|
1921
|
+
XmStringFree(s2);
|
1922
|
+
XtManageChild(btn);
|
1923
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1924
|
+
&reloadCbk, (XtPointer)this);
|
1925
|
+
n = 0;
|
1926
|
+
s = XmStringCreateLocalized("Save as...");
|
1927
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1928
|
+
btn = XmCreatePushButton(popupMenu, "saveAs", args, n);
|
1929
|
+
XmStringFree(s);
|
1930
|
+
XtManageChild(btn);
|
1931
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1932
|
+
&saveAsCbk, (XtPointer)this);
|
1933
|
+
n = 0;
|
1934
|
+
btn = XmCreateSeparator(popupMenu, "sep1", args, n);
|
1935
|
+
XtManageChild(btn);
|
1936
|
+
n = 0;
|
1937
|
+
s = XmStringCreateLocalized("Continuous view");
|
1938
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1939
|
+
XtSetArg(args[n], XmNindicatorType, XmN_OF_MANY); ++n;
|
1940
|
+
XtSetArg(args[n], XmNvisibleWhenOff, True); ++n;
|
1941
|
+
XtSetArg(args[n], XmNset, core->getContinuousMode() ? XmSET : XmUNSET); ++n;
|
1942
|
+
btn = XmCreateToggleButton(popupMenu, "continuousMode", args, n);
|
1943
|
+
XmStringFree(s);
|
1944
|
+
XtManageChild(btn);
|
1945
|
+
XtAddCallback(btn, XmNvalueChangedCallback,
|
1946
|
+
&continuousModeToggleCbk, (XtPointer)this);
|
1947
|
+
n = 0;
|
1948
|
+
s = XmStringCreateLocalized("Full screen");
|
1949
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1950
|
+
XtSetArg(args[n], XmNindicatorType, XmN_OF_MANY); ++n;
|
1951
|
+
XtSetArg(args[n], XmNvisibleWhenOff, True); ++n;
|
1952
|
+
XtSetArg(args[n], XmNset, core->getFullScreen() ? XmSET : XmUNSET); ++n;
|
1953
|
+
btn = XmCreateToggleButton(popupMenu, "fullScreen", args, n);
|
1954
|
+
XmStringFree(s);
|
1955
|
+
XtManageChild(btn);
|
1956
|
+
XtAddCallback(btn, XmNvalueChangedCallback,
|
1957
|
+
&fullScreenToggleCbk, (XtPointer)this);
|
1958
|
+
n = 0;
|
1959
|
+
s = XmStringCreateLocalized("Rotate counterclockwise");
|
1960
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1961
|
+
btn = XmCreatePushButton(popupMenu, "rotateCCW", args, n);
|
1962
|
+
XmStringFree(s);
|
1963
|
+
XtManageChild(btn);
|
1964
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1965
|
+
&rotateCCWCbk, (XtPointer)this);
|
1966
|
+
n = 0;
|
1967
|
+
s = XmStringCreateLocalized("Rotate clockwise");
|
1968
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1969
|
+
btn = XmCreatePushButton(popupMenu, "rotateCW", args, n);
|
1970
|
+
XmStringFree(s);
|
1971
|
+
XtManageChild(btn);
|
1972
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1973
|
+
&rotateCWCbk, (XtPointer)this);
|
1974
|
+
n = 0;
|
1975
|
+
s = XmStringCreateLocalized("Zoom to selection");
|
1976
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1977
|
+
btn = XmCreatePushButton(popupMenu, "zoomToSelection", args, n);
|
1978
|
+
XmStringFree(s);
|
1979
|
+
XtManageChild(btn);
|
1980
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1981
|
+
&zoomToSelectionCbk, (XtPointer)this);
|
1982
|
+
n = 0;
|
1983
|
+
btn = XmCreateSeparator(popupMenu, "sep2", args, n);
|
1984
|
+
XtManageChild(btn);
|
1985
|
+
n = 0;
|
1986
|
+
s = XmStringCreateLocalized("Close");
|
1987
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1988
|
+
s2 = XmStringCreateLocalized("Ctrl+W");
|
1989
|
+
XtSetArg(args[n], XmNacceleratorText, s2); ++n;
|
1990
|
+
btn = XmCreatePushButton(popupMenu, "close", args, n);
|
1991
|
+
XmStringFree(s);
|
1992
|
+
XmStringFree(s2);
|
1993
|
+
XtManageChild(btn);
|
1994
|
+
XtAddCallback(btn, XmNactivateCallback,
|
1995
|
+
&closeCbk, (XtPointer)this);
|
1996
|
+
n = 0;
|
1997
|
+
s = XmStringCreateLocalized("Quit");
|
1998
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
1999
|
+
s2 = XmStringCreateLocalized("Q");
|
2000
|
+
XtSetArg(args[n], XmNacceleratorText, s2); ++n;
|
2001
|
+
btn = XmCreatePushButton(popupMenu, "quit", args, n);
|
2002
|
+
XmStringFree(s);
|
2003
|
+
XmStringFree(s2);
|
2004
|
+
XtManageChild(btn);
|
2005
|
+
XtAddCallback(btn, XmNactivateCallback,
|
2006
|
+
&quitCbk, (XtPointer)this);
|
2007
|
+
|
2008
|
+
// this is magic (taken from DDD) - weird things happen if this
|
2009
|
+
// call isn't made
|
2010
|
+
XtUngrabButton(core->getDrawAreaWidget(), AnyButton, AnyModifier);
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
void XPDFViewer::addToolTip(Widget widget, char *text) {
|
2014
|
+
#ifdef XmNtoolTipString
|
2015
|
+
XmString s;
|
2016
|
+
Cardinal n, i;
|
2017
|
+
WidgetList children;
|
2018
|
+
|
2019
|
+
if (XtIsComposite(widget)) {
|
2020
|
+
XtVaGetValues(widget, XmNnumChildren, &n, XmNchildren, &children, NULL);
|
2021
|
+
for (i = 0; i < n; ++i) {
|
2022
|
+
addToolTip(children[i], text);
|
2023
|
+
}
|
2024
|
+
} else {
|
2025
|
+
s = XmStringCreateLocalized(text);
|
2026
|
+
XtVaSetValues(widget, XmNtoolTipString, s, NULL);
|
2027
|
+
XmStringFree(s);
|
2028
|
+
}
|
2029
|
+
#endif
|
2030
|
+
}
|
2031
|
+
|
2032
|
+
void XPDFViewer::mapWindow() {
|
2033
|
+
#ifdef HAVE_X11_XPM_H
|
2034
|
+
Pixmap iconPixmap;
|
2035
|
+
#endif
|
2036
|
+
int depth;
|
2037
|
+
Pixel fg, bg, arm;
|
2038
|
+
|
2039
|
+
// show the window
|
2040
|
+
XtPopup(win, XtGrabNone);
|
2041
|
+
core->takeFocus();
|
2042
|
+
|
2043
|
+
// create the icon
|
2044
|
+
#ifdef HAVE_X11_XPM_H
|
2045
|
+
if (XpmCreatePixmapFromData(display, XtWindow(win), xpdfIcon,
|
2046
|
+
&iconPixmap, NULL, NULL) == XpmSuccess) {
|
2047
|
+
XtVaSetValues(win, XmNiconPixmap, iconPixmap, NULL);
|
2048
|
+
}
|
2049
|
+
#endif
|
2050
|
+
|
2051
|
+
// set button bitmaps (must be done after the window is mapped)
|
2052
|
+
if (toolBar != None) {
|
2053
|
+
XtVaGetValues(backBtn, XmNdepth, &depth,
|
2054
|
+
XmNforeground, &fg, XmNbackground, &bg,
|
2055
|
+
XmNarmColor, &arm, NULL);
|
2056
|
+
XtVaSetValues(backBtn, XmNlabelType, XmPIXMAP,
|
2057
|
+
XmNlabelPixmap,
|
2058
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2059
|
+
(char *)backArrow_bits,
|
2060
|
+
backArrow_width,
|
2061
|
+
backArrow_height,
|
2062
|
+
fg, bg, depth),
|
2063
|
+
XmNarmPixmap,
|
2064
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2065
|
+
(char *)backArrow_bits,
|
2066
|
+
backArrow_width,
|
2067
|
+
backArrow_height,
|
2068
|
+
fg, arm, depth),
|
2069
|
+
XmNlabelInsensitivePixmap,
|
2070
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2071
|
+
(char *)backArrowDis_bits,
|
2072
|
+
backArrowDis_width,
|
2073
|
+
backArrowDis_height,
|
2074
|
+
fg, bg, depth),
|
2075
|
+
NULL);
|
2076
|
+
XtVaSetValues(prevTenPageBtn, XmNlabelType, XmPIXMAP,
|
2077
|
+
XmNlabelPixmap,
|
2078
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2079
|
+
(char *)dblLeftArrow_bits,
|
2080
|
+
dblLeftArrow_width,
|
2081
|
+
dblLeftArrow_height,
|
2082
|
+
fg, bg, depth),
|
2083
|
+
XmNarmPixmap,
|
2084
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2085
|
+
(char *)dblLeftArrow_bits,
|
2086
|
+
dblLeftArrow_width,
|
2087
|
+
dblLeftArrow_height,
|
2088
|
+
fg, arm, depth),
|
2089
|
+
XmNlabelInsensitivePixmap,
|
2090
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2091
|
+
(char *)dblLeftArrowDis_bits,
|
2092
|
+
dblLeftArrowDis_width,
|
2093
|
+
dblLeftArrowDis_height,
|
2094
|
+
fg, bg, depth),
|
2095
|
+
NULL);
|
2096
|
+
XtVaSetValues(prevPageBtn, XmNlabelType, XmPIXMAP,
|
2097
|
+
XmNlabelPixmap,
|
2098
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2099
|
+
(char *)leftArrow_bits,
|
2100
|
+
leftArrow_width,
|
2101
|
+
leftArrow_height,
|
2102
|
+
fg, bg, depth),
|
2103
|
+
XmNarmPixmap,
|
2104
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2105
|
+
(char *)leftArrow_bits,
|
2106
|
+
leftArrow_width,
|
2107
|
+
leftArrow_height,
|
2108
|
+
fg, arm, depth),
|
2109
|
+
XmNlabelInsensitivePixmap,
|
2110
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2111
|
+
(char *)leftArrowDis_bits,
|
2112
|
+
leftArrowDis_width,
|
2113
|
+
leftArrowDis_height,
|
2114
|
+
fg, bg, depth),
|
2115
|
+
NULL);
|
2116
|
+
XtVaSetValues(nextPageBtn, XmNlabelType, XmPIXMAP,
|
2117
|
+
XmNlabelPixmap,
|
2118
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2119
|
+
(char *)rightArrow_bits,
|
2120
|
+
rightArrow_width,
|
2121
|
+
rightArrow_height,
|
2122
|
+
fg, bg, depth),
|
2123
|
+
XmNarmPixmap,
|
2124
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2125
|
+
(char *)rightArrow_bits,
|
2126
|
+
rightArrow_width,
|
2127
|
+
rightArrow_height,
|
2128
|
+
fg, arm, depth),
|
2129
|
+
XmNlabelInsensitivePixmap,
|
2130
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2131
|
+
(char *)rightArrowDis_bits,
|
2132
|
+
rightArrowDis_width,
|
2133
|
+
rightArrowDis_height,
|
2134
|
+
fg, bg, depth),
|
2135
|
+
NULL);
|
2136
|
+
XtVaSetValues(nextTenPageBtn, XmNlabelType, XmPIXMAP,
|
2137
|
+
XmNlabelPixmap,
|
2138
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2139
|
+
(char *)dblRightArrow_bits,
|
2140
|
+
dblRightArrow_width,
|
2141
|
+
dblRightArrow_height,
|
2142
|
+
fg, bg, depth),
|
2143
|
+
XmNarmPixmap,
|
2144
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2145
|
+
(char *)dblRightArrow_bits,
|
2146
|
+
dblRightArrow_width,
|
2147
|
+
dblRightArrow_height,
|
2148
|
+
fg, arm, depth),
|
2149
|
+
XmNlabelInsensitivePixmap,
|
2150
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2151
|
+
(char *)dblRightArrowDis_bits,
|
2152
|
+
dblRightArrowDis_width,
|
2153
|
+
dblRightArrowDis_height,
|
2154
|
+
fg, bg, depth),
|
2155
|
+
NULL);
|
2156
|
+
XtVaSetValues(forwardBtn, XmNlabelType, XmPIXMAP,
|
2157
|
+
XmNlabelPixmap,
|
2158
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2159
|
+
(char *)forwardArrow_bits,
|
2160
|
+
forwardArrow_width,
|
2161
|
+
forwardArrow_height,
|
2162
|
+
fg, bg, depth),
|
2163
|
+
XmNarmPixmap,
|
2164
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2165
|
+
(char *)forwardArrow_bits,
|
2166
|
+
forwardArrow_width,
|
2167
|
+
forwardArrow_height,
|
2168
|
+
fg, arm, depth),
|
2169
|
+
XmNlabelInsensitivePixmap,
|
2170
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2171
|
+
(char *)forwardArrowDis_bits,
|
2172
|
+
forwardArrowDis_width,
|
2173
|
+
forwardArrowDis_height,
|
2174
|
+
fg, bg, depth),
|
2175
|
+
NULL);
|
2176
|
+
XtVaSetValues(findBtn, XmNlabelType, XmPIXMAP,
|
2177
|
+
XmNlabelPixmap,
|
2178
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2179
|
+
(char *)find_bits,
|
2180
|
+
find_width,
|
2181
|
+
find_height,
|
2182
|
+
fg, bg, depth),
|
2183
|
+
XmNarmPixmap,
|
2184
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2185
|
+
(char *)find_bits,
|
2186
|
+
find_width,
|
2187
|
+
find_height,
|
2188
|
+
fg, arm, depth),
|
2189
|
+
XmNlabelInsensitivePixmap,
|
2190
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2191
|
+
(char *)findDis_bits,
|
2192
|
+
findDis_width,
|
2193
|
+
findDis_height,
|
2194
|
+
fg, bg, depth),
|
2195
|
+
NULL);
|
2196
|
+
XtVaSetValues(printBtn, XmNlabelType, XmPIXMAP,
|
2197
|
+
XmNlabelPixmap,
|
2198
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2199
|
+
(char *)print_bits,
|
2200
|
+
print_width,
|
2201
|
+
print_height,
|
2202
|
+
fg, bg, depth),
|
2203
|
+
XmNarmPixmap,
|
2204
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2205
|
+
(char *)print_bits,
|
2206
|
+
print_width,
|
2207
|
+
print_height,
|
2208
|
+
fg, arm, depth),
|
2209
|
+
XmNlabelInsensitivePixmap,
|
2210
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2211
|
+
(char *)printDis_bits,
|
2212
|
+
printDis_width,
|
2213
|
+
printDis_height,
|
2214
|
+
fg, bg, depth),
|
2215
|
+
NULL);
|
2216
|
+
XtVaSetValues(aboutBtn, XmNlabelType, XmPIXMAP,
|
2217
|
+
XmNlabelPixmap,
|
2218
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2219
|
+
(char *)about_bits,
|
2220
|
+
about_width,
|
2221
|
+
about_height,
|
2222
|
+
fg, bg, depth),
|
2223
|
+
XmNarmPixmap,
|
2224
|
+
XCreatePixmapFromBitmapData(display, XtWindow(toolBar),
|
2225
|
+
(char *)about_bits,
|
2226
|
+
about_width,
|
2227
|
+
about_height,
|
2228
|
+
fg, arm, depth),
|
2229
|
+
NULL);
|
2230
|
+
}
|
2231
|
+
}
|
2232
|
+
|
2233
|
+
void XPDFViewer::closeWindow() {
|
2234
|
+
XtPopdown(win);
|
2235
|
+
XtDestroyWidget(win);
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
int XPDFViewer::getZoomIdx() {
|
2239
|
+
int i;
|
2240
|
+
|
2241
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
2242
|
+
if (core->getZoom() == zoomMenuInfo[i].zoom) {
|
2243
|
+
return i;
|
2244
|
+
}
|
2245
|
+
}
|
2246
|
+
return -1;
|
2247
|
+
}
|
2248
|
+
|
2249
|
+
void XPDFViewer::setZoomIdx(int idx) {
|
2250
|
+
if (toolBar == None) {
|
2251
|
+
return;
|
2252
|
+
}
|
2253
|
+
#if USE_COMBO_BOX
|
2254
|
+
XtVaSetValues(zoomComboBox, XmNselectedPosition, idx + 1, NULL);
|
2255
|
+
#else
|
2256
|
+
XtVaSetValues(zoomMenu, XmNmenuHistory, zoomMenuBtns[idx], NULL);
|
2257
|
+
#endif
|
2258
|
+
}
|
2259
|
+
|
2260
|
+
void XPDFViewer::setZoomVal(double z) {
|
2261
|
+
if (toolBar == None) {
|
2262
|
+
return;
|
2263
|
+
}
|
2264
|
+
|
2265
|
+
#if USE_COMBO_BOX
|
2266
|
+
char buf[32];
|
2267
|
+
XmString s;
|
2268
|
+
int i;
|
2269
|
+
|
2270
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
2271
|
+
if (z == zoomMenuInfo[i].zoom) {
|
2272
|
+
XtVaSetValues(zoomComboBox, XmNselectedPosition, i + 1, NULL);
|
2273
|
+
return;
|
2274
|
+
}
|
2275
|
+
}
|
2276
|
+
sprintf(buf, "%d%%", (int)z);
|
2277
|
+
s = XmStringCreateLocalized(buf);
|
2278
|
+
XtVaSetValues(zoomComboBox, XmNselectedItem, s, NULL);
|
2279
|
+
XmStringFree(s);
|
2280
|
+
#else
|
2281
|
+
int i;
|
2282
|
+
|
2283
|
+
for (i = 0; i < nZoomMenuItems; ++i) {
|
2284
|
+
if (z == zoomMenuInfo[i].zoom) {
|
2285
|
+
XtVaSetValues(zoomMenu, XmNmenuHistory, zoomMenuBtns[i], NULL);
|
2286
|
+
return;
|
2287
|
+
}
|
2288
|
+
}
|
2289
|
+
for (i = maxZoomIdx; i < minZoomIdx; ++i) {
|
2290
|
+
if (z > zoomMenuInfo[i].zoom) {
|
2291
|
+
break;
|
2292
|
+
}
|
2293
|
+
}
|
2294
|
+
XtVaSetValues(zoomMenu, XmNmenuHistory, zoomMenuBtns[i], NULL);
|
2295
|
+
#endif
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
void XPDFViewer::prevPageCbk(Widget widget, XtPointer ptr,
|
2299
|
+
XtPointer callData) {
|
2300
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2301
|
+
|
2302
|
+
viewer->core->gotoPrevPage(1, gTrue, gFalse);
|
2303
|
+
viewer->core->takeFocus();
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
void XPDFViewer::prevTenPageCbk(Widget widget, XtPointer ptr,
|
2307
|
+
XtPointer callData) {
|
2308
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2309
|
+
|
2310
|
+
viewer->core->gotoPrevPage(10, gTrue, gFalse);
|
2311
|
+
viewer->core->takeFocus();
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
void XPDFViewer::nextPageCbk(Widget widget, XtPointer ptr,
|
2315
|
+
XtPointer callData) {
|
2316
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2317
|
+
|
2318
|
+
viewer->core->gotoNextPage(1, gTrue);
|
2319
|
+
viewer->core->takeFocus();
|
2320
|
+
}
|
2321
|
+
|
2322
|
+
void XPDFViewer::nextTenPageCbk(Widget widget, XtPointer ptr,
|
2323
|
+
XtPointer callData) {
|
2324
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2325
|
+
|
2326
|
+
viewer->core->gotoNextPage(10, gTrue);
|
2327
|
+
viewer->core->takeFocus();
|
2328
|
+
}
|
2329
|
+
|
2330
|
+
void XPDFViewer::backCbk(Widget widget, XtPointer ptr,
|
2331
|
+
XtPointer callData) {
|
2332
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2333
|
+
|
2334
|
+
viewer->core->goBackward();
|
2335
|
+
viewer->core->takeFocus();
|
2336
|
+
}
|
2337
|
+
|
2338
|
+
void XPDFViewer::forwardCbk(Widget widget, XtPointer ptr,
|
2339
|
+
XtPointer callData) {
|
2340
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2341
|
+
|
2342
|
+
viewer->core->goForward();
|
2343
|
+
viewer->core->takeFocus();
|
2344
|
+
}
|
2345
|
+
|
2346
|
+
#if USE_COMBO_BOX
|
2347
|
+
|
2348
|
+
void XPDFViewer::zoomComboBoxCbk(Widget widget, XtPointer ptr,
|
2349
|
+
XtPointer callData) {
|
2350
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2351
|
+
XmComboBoxCallbackStruct *data = (XmComboBoxCallbackStruct *)callData;
|
2352
|
+
double z;
|
2353
|
+
char *s;
|
2354
|
+
XmStringContext context;
|
2355
|
+
XmStringCharSet charSet;
|
2356
|
+
XmStringDirection dir;
|
2357
|
+
Boolean sep;
|
2358
|
+
|
2359
|
+
z = viewer->core->getZoom();
|
2360
|
+
if (data->item_position == 0) {
|
2361
|
+
XmStringInitContext(&context, data->item_or_text);
|
2362
|
+
if (XmStringGetNextSegment(context, &s, &charSet, &dir, &sep)) {
|
2363
|
+
z = atof(s);
|
2364
|
+
if (z <= 1) {
|
2365
|
+
z = defZoom;
|
2366
|
+
}
|
2367
|
+
XtFree(charSet);
|
2368
|
+
XtFree(s);
|
2369
|
+
}
|
2370
|
+
XmStringFreeContext(context);
|
2371
|
+
} else {
|
2372
|
+
z = zoomMenuInfo[data->item_position - 1].zoom;
|
2373
|
+
}
|
2374
|
+
// only redraw if this was triggered by an event; otherwise
|
2375
|
+
// the caller is responsible for doing the redraw
|
2376
|
+
if (z != viewer->core->getZoom() && data->event) {
|
2377
|
+
viewer->displayPage(viewer->core->getPageNum(), z,
|
2378
|
+
viewer->core->getRotate(), gTrue, gFalse);
|
2379
|
+
}
|
2380
|
+
viewer->core->takeFocus();
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
#else // USE_COMBO_BOX
|
2384
|
+
|
2385
|
+
void XPDFViewer::zoomMenuCbk(Widget widget, XtPointer ptr,
|
2386
|
+
XtPointer callData) {
|
2387
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2388
|
+
XmPushButtonCallbackStruct *data = (XmPushButtonCallbackStruct *)callData;
|
2389
|
+
XtPointer userData;
|
2390
|
+
double z;
|
2391
|
+
|
2392
|
+
XtVaGetValues(widget, XmNuserData, &userData, NULL);
|
2393
|
+
z = zoomMenuInfo[(long)userData].zoom;
|
2394
|
+
// only redraw if this was triggered by an event; otherwise
|
2395
|
+
// the caller is responsible for doing the redraw
|
2396
|
+
if (z != viewer->core->getZoom() && data->event) {
|
2397
|
+
viewer->displayPage(viewer->core->getPageNum(), z,
|
2398
|
+
viewer->core->getRotate(), gTrue, gFalse);
|
2399
|
+
}
|
2400
|
+
viewer->core->takeFocus();
|
2401
|
+
}
|
2402
|
+
|
2403
|
+
#endif // USE_COMBO_BOX
|
2404
|
+
|
2405
|
+
void XPDFViewer::findCbk(Widget widget, XtPointer ptr,
|
2406
|
+
XtPointer callData) {
|
2407
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2408
|
+
|
2409
|
+
if (!viewer->core->getDoc()) {
|
2410
|
+
return;
|
2411
|
+
}
|
2412
|
+
viewer->mapFindDialog();
|
2413
|
+
}
|
2414
|
+
|
2415
|
+
void XPDFViewer::printCbk(Widget widget, XtPointer ptr,
|
2416
|
+
XtPointer callData) {
|
2417
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2418
|
+
|
2419
|
+
if (!viewer->core->getDoc()) {
|
2420
|
+
return;
|
2421
|
+
}
|
2422
|
+
XtManageChild(viewer->printDialog);
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
void XPDFViewer::aboutCbk(Widget widget, XtPointer ptr,
|
2426
|
+
XtPointer callData) {
|
2427
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2428
|
+
|
2429
|
+
XtManageChild(viewer->aboutDialog);
|
2430
|
+
}
|
2431
|
+
|
2432
|
+
void XPDFViewer::quitCbk(Widget widget, XtPointer ptr,
|
2433
|
+
XtPointer callData) {
|
2434
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2435
|
+
|
2436
|
+
viewer->app->quit();
|
2437
|
+
}
|
2438
|
+
|
2439
|
+
void XPDFViewer::openCbk(Widget widget, XtPointer ptr,
|
2440
|
+
XtPointer callData) {
|
2441
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2442
|
+
|
2443
|
+
viewer->mapOpenDialog(gFalse);
|
2444
|
+
}
|
2445
|
+
|
2446
|
+
void XPDFViewer::openInNewWindowCbk(Widget widget, XtPointer ptr,
|
2447
|
+
XtPointer callData) {
|
2448
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2449
|
+
|
2450
|
+
viewer->mapOpenDialog(gTrue);
|
2451
|
+
}
|
2452
|
+
|
2453
|
+
void XPDFViewer::reloadCbk(Widget widget, XtPointer ptr,
|
2454
|
+
XtPointer callData) {
|
2455
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2456
|
+
|
2457
|
+
viewer->reloadFile();
|
2458
|
+
}
|
2459
|
+
|
2460
|
+
void XPDFViewer::saveAsCbk(Widget widget, XtPointer ptr,
|
2461
|
+
XtPointer callData) {
|
2462
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2463
|
+
|
2464
|
+
if (!viewer->core->getDoc()) {
|
2465
|
+
return;
|
2466
|
+
}
|
2467
|
+
viewer->mapSaveAsDialog();
|
2468
|
+
}
|
2469
|
+
|
2470
|
+
void XPDFViewer::continuousModeToggleCbk(Widget widget, XtPointer ptr,
|
2471
|
+
XtPointer callData) {
|
2472
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2473
|
+
XmToggleButtonCallbackStruct *data =
|
2474
|
+
(XmToggleButtonCallbackStruct *)callData;
|
2475
|
+
|
2476
|
+
viewer->core->setContinuousMode(data->set == XmSET);
|
2477
|
+
}
|
2478
|
+
|
2479
|
+
void XPDFViewer::fullScreenToggleCbk(Widget widget, XtPointer ptr,
|
2480
|
+
XtPointer callData) {
|
2481
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2482
|
+
XmToggleButtonCallbackStruct *data =
|
2483
|
+
(XmToggleButtonCallbackStruct *)callData;
|
2484
|
+
|
2485
|
+
if (data->set == XmSET) {
|
2486
|
+
viewer->cmdFullScreenMode(NULL, 0, NULL);
|
2487
|
+
} else {
|
2488
|
+
viewer->cmdWindowMode(NULL, 0, NULL);
|
2489
|
+
}
|
2490
|
+
}
|
2491
|
+
|
2492
|
+
void XPDFViewer::rotateCCWCbk(Widget widget, XtPointer ptr,
|
2493
|
+
XtPointer callData) {
|
2494
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2495
|
+
int r;
|
2496
|
+
|
2497
|
+
r = viewer->core->getRotate();
|
2498
|
+
r = (r == 0) ? 270 : r - 90;
|
2499
|
+
viewer->displayPage(viewer->core->getPageNum(), viewer->core->getZoom(),
|
2500
|
+
r, gTrue, gFalse);
|
2501
|
+
}
|
2502
|
+
|
2503
|
+
void XPDFViewer::rotateCWCbk(Widget widget, XtPointer ptr,
|
2504
|
+
XtPointer callData) {
|
2505
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2506
|
+
int r;
|
2507
|
+
|
2508
|
+
r = viewer->core->getRotate();
|
2509
|
+
r = (r == 270) ? 0 : r + 90;
|
2510
|
+
viewer->displayPage(viewer->core->getPageNum(), viewer->core->getZoom(),
|
2511
|
+
r, gTrue, gFalse);
|
2512
|
+
}
|
2513
|
+
|
2514
|
+
void XPDFViewer::zoomToSelectionCbk(Widget widget, XtPointer ptr,
|
2515
|
+
XtPointer callData) {
|
2516
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2517
|
+
int pg;
|
2518
|
+
double ulx, uly, lrx, lry;
|
2519
|
+
|
2520
|
+
if (viewer->core->getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
|
2521
|
+
viewer->core->zoomToRect(pg, ulx, uly, lrx, lry);
|
2522
|
+
}
|
2523
|
+
}
|
2524
|
+
|
2525
|
+
void XPDFViewer::closeCbk(Widget widget, XtPointer ptr,
|
2526
|
+
XtPointer callData) {
|
2527
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2528
|
+
|
2529
|
+
viewer->app->close(viewer, gFalse);
|
2530
|
+
}
|
2531
|
+
|
2532
|
+
void XPDFViewer::closeMsgCbk(Widget widget, XtPointer ptr,
|
2533
|
+
XtPointer callData) {
|
2534
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2535
|
+
|
2536
|
+
viewer->app->close(viewer, gTrue);
|
2537
|
+
}
|
2538
|
+
|
2539
|
+
void XPDFViewer::pageNumCbk(Widget widget, XtPointer ptr,
|
2540
|
+
XtPointer callData) {
|
2541
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2542
|
+
char *s, *p;
|
2543
|
+
int pg;
|
2544
|
+
char buf[20];
|
2545
|
+
|
2546
|
+
if (!viewer->core->getDoc()) {
|
2547
|
+
goto err;
|
2548
|
+
}
|
2549
|
+
s = XmTextFieldGetString(viewer->pageNumText);
|
2550
|
+
for (p = s; *p; ++p) {
|
2551
|
+
if (!isdigit(*p)) {
|
2552
|
+
goto err;
|
2553
|
+
}
|
2554
|
+
}
|
2555
|
+
pg = atoi(s);
|
2556
|
+
if (pg < 1 || pg > viewer->core->getDoc()->getNumPages()) {
|
2557
|
+
goto err;
|
2558
|
+
}
|
2559
|
+
viewer->displayPage(pg, viewer->core->getZoom(),
|
2560
|
+
viewer->core->getRotate(), gFalse, gTrue);
|
2561
|
+
viewer->core->takeFocus();
|
2562
|
+
return;
|
2563
|
+
|
2564
|
+
err:
|
2565
|
+
XBell(viewer->display, 0);
|
2566
|
+
sprintf(buf, "%d", viewer->core->getPageNum());
|
2567
|
+
XmTextFieldSetString(viewer->pageNumText, buf);
|
2568
|
+
}
|
2569
|
+
|
2570
|
+
void XPDFViewer::updateCbk(void *data, GString *fileName,
|
2571
|
+
int pageNum, int numPages, char *linkString) {
|
2572
|
+
XPDFViewer *viewer = (XPDFViewer *)data;
|
2573
|
+
GString *title;
|
2574
|
+
char buf[20];
|
2575
|
+
XmString s;
|
2576
|
+
|
2577
|
+
if (fileName) {
|
2578
|
+
if (!(title = viewer->app->getTitle())) {
|
2579
|
+
title = (new GString(xpdfAppName))->append(": ")->append(fileName);
|
2580
|
+
}
|
2581
|
+
XtVaSetValues(viewer->win, XmNtitle, title->getCString(),
|
2582
|
+
XmNiconName, title->getCString(), NULL);
|
2583
|
+
if (!viewer->app->getTitle()) {
|
2584
|
+
delete title;
|
2585
|
+
}
|
2586
|
+
#ifndef DISABLE_OUTLINE
|
2587
|
+
viewer->setupOutline();
|
2588
|
+
#endif
|
2589
|
+
viewer->setupPrintDialog();
|
2590
|
+
}
|
2591
|
+
|
2592
|
+
if (viewer->toolBar != None) {
|
2593
|
+
if (pageNum >= 0) {
|
2594
|
+
s = XmStringCreateLocalized("");
|
2595
|
+
XtVaSetValues(viewer->linkLabel, XmNlabelString, s, NULL);
|
2596
|
+
XmStringFree(s);
|
2597
|
+
sprintf(buf, "%d", pageNum);
|
2598
|
+
XmTextFieldSetString(viewer->pageNumText, buf);
|
2599
|
+
XtVaSetValues(viewer->prevTenPageBtn, XmNsensitive,
|
2600
|
+
pageNum > 1, NULL);
|
2601
|
+
XtVaSetValues(viewer->prevPageBtn, XmNsensitive,
|
2602
|
+
pageNum > 1, NULL);
|
2603
|
+
XtVaSetValues(viewer->nextTenPageBtn, XmNsensitive,
|
2604
|
+
pageNum < viewer->core->getDoc()->getNumPages(), NULL);
|
2605
|
+
XtVaSetValues(viewer->nextPageBtn, XmNsensitive,
|
2606
|
+
pageNum < viewer->core->getDoc()->getNumPages(), NULL);
|
2607
|
+
XtVaSetValues(viewer->backBtn, XmNsensitive,
|
2608
|
+
viewer->core->canGoBack(), NULL);
|
2609
|
+
XtVaSetValues(viewer->forwardBtn, XmNsensitive,
|
2610
|
+
viewer->core->canGoForward(), NULL);
|
2611
|
+
}
|
2612
|
+
|
2613
|
+
if (numPages >= 0) {
|
2614
|
+
sprintf(buf, " of %d", numPages);
|
2615
|
+
s = XmStringCreateLocalized(buf);
|
2616
|
+
XtVaSetValues(viewer->pageCountLabel, XmNlabelString, s, NULL);
|
2617
|
+
XmStringFree(s);
|
2618
|
+
}
|
2619
|
+
|
2620
|
+
if (linkString) {
|
2621
|
+
s = XmStringCreateLocalized(linkString);
|
2622
|
+
XtVaSetValues(viewer->linkLabel, XmNlabelString, s, NULL);
|
2623
|
+
XmStringFree(s);
|
2624
|
+
}
|
2625
|
+
}
|
2626
|
+
}
|
2627
|
+
|
2628
|
+
|
2629
|
+
//------------------------------------------------------------------------
|
2630
|
+
// GUI code: outline
|
2631
|
+
//------------------------------------------------------------------------
|
2632
|
+
|
2633
|
+
#ifndef DISABLE_OUTLINE
|
2634
|
+
|
2635
|
+
void XPDFViewer::setupOutline() {
|
2636
|
+
GList *items;
|
2637
|
+
UnicodeMap *uMap;
|
2638
|
+
GString *enc;
|
2639
|
+
int i;
|
2640
|
+
|
2641
|
+
if (outlineScroll == None) {
|
2642
|
+
return;
|
2643
|
+
}
|
2644
|
+
|
2645
|
+
// unmanage and destroy the old labels
|
2646
|
+
if (outlineLabels) {
|
2647
|
+
XtUnmanageChildren(outlineLabels, outlineLabelsLength);
|
2648
|
+
for (i = 0; i < outlineLabelsLength; ++i) {
|
2649
|
+
XtDestroyWidget(outlineLabels[i]);
|
2650
|
+
}
|
2651
|
+
gfree(outlineLabels);
|
2652
|
+
outlineLabels = NULL;
|
2653
|
+
outlineLabelsLength = outlineLabelsSize = 0;
|
2654
|
+
}
|
2655
|
+
|
2656
|
+
if (core->getDoc()) {
|
2657
|
+
|
2658
|
+
// create the new labels
|
2659
|
+
items = core->getDoc()->getOutline()->getItems();
|
2660
|
+
if (items && items->getLength() > 0) {
|
2661
|
+
enc = new GString("Latin1");
|
2662
|
+
uMap = globalParams->getUnicodeMap(enc);
|
2663
|
+
delete enc;
|
2664
|
+
setupOutlineItems(items, NULL, uMap);
|
2665
|
+
uMap->decRefCnt();
|
2666
|
+
}
|
2667
|
+
|
2668
|
+
// manage the new labels
|
2669
|
+
XtManageChildren(outlineLabels, outlineLabelsLength);
|
2670
|
+
}
|
2671
|
+
}
|
2672
|
+
|
2673
|
+
void XPDFViewer::setupOutlineItems(GList *items, Widget parent,
|
2674
|
+
UnicodeMap *uMap) {
|
2675
|
+
OutlineItem *item;
|
2676
|
+
GList *kids;
|
2677
|
+
Widget label;
|
2678
|
+
Arg args[20];
|
2679
|
+
GString *title;
|
2680
|
+
char buf[8];
|
2681
|
+
XmString s;
|
2682
|
+
int i, j, n;
|
2683
|
+
|
2684
|
+
for (i = 0; i < items->getLength(); ++i) {
|
2685
|
+
item = (OutlineItem *)items->get(i);
|
2686
|
+
title = new GString();
|
2687
|
+
for (j = 0; j < item->getTitleLength(); ++j) {
|
2688
|
+
n = uMap->mapUnicode(item->getTitle()[j], buf, sizeof(buf));
|
2689
|
+
title->append(buf, n);
|
2690
|
+
}
|
2691
|
+
n = 0;
|
2692
|
+
XtSetArg(args[n], XPDFNentryPosition, i); ++n;
|
2693
|
+
if (parent) {
|
2694
|
+
XtSetArg(args[n], XPDFNentryParent, parent); ++n;
|
2695
|
+
}
|
2696
|
+
XtSetArg(args[n], XPDFNentryExpanded, item->isOpen()); ++n;
|
2697
|
+
s = XmStringCreateLocalized(title->getCString());
|
2698
|
+
delete title;
|
2699
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2700
|
+
XtSetArg(args[n], XmNuserData, item); ++n;
|
2701
|
+
XtSetArg(args[n], XmNmarginWidth, 0); ++n;
|
2702
|
+
XtSetArg(args[n], XmNmarginHeight, 2); ++n;
|
2703
|
+
XtSetArg(args[n], XmNshadowThickness, 0); ++n;
|
2704
|
+
XtSetArg(args[n], XmNforeground,
|
2705
|
+
app->getReverseVideo() ? WhitePixel(display, screenNum)
|
2706
|
+
: BlackPixel(display, screenNum)); ++n;
|
2707
|
+
XtSetArg(args[n], XmNbackground, app->getPaperPixel()); ++n;
|
2708
|
+
label = XmCreateLabelGadget(outlineTree, "label", args, n);
|
2709
|
+
XmStringFree(s);
|
2710
|
+
if (outlineLabelsLength == outlineLabelsSize) {
|
2711
|
+
outlineLabelsSize += 64;
|
2712
|
+
outlineLabels = (Widget *)greallocn(outlineLabels,
|
2713
|
+
outlineLabelsSize, sizeof(Widget *));
|
2714
|
+
}
|
2715
|
+
outlineLabels[outlineLabelsLength++] = label;
|
2716
|
+
item->open();
|
2717
|
+
if ((kids = item->getKids())) {
|
2718
|
+
setupOutlineItems(kids, label, uMap);
|
2719
|
+
}
|
2720
|
+
}
|
2721
|
+
}
|
2722
|
+
|
2723
|
+
void XPDFViewer::outlineSelectCbk(Widget widget, XtPointer ptr,
|
2724
|
+
XtPointer callData) {
|
2725
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2726
|
+
XPDFTreeSelectCallbackStruct *data =
|
2727
|
+
(XPDFTreeSelectCallbackStruct *)callData;
|
2728
|
+
OutlineItem *item;
|
2729
|
+
|
2730
|
+
XtVaGetValues(data->selectedItem, XmNuserData, &item, NULL);
|
2731
|
+
if (item) {
|
2732
|
+
if (item->getAction()) {
|
2733
|
+
viewer->core->doAction(item->getAction());
|
2734
|
+
}
|
2735
|
+
}
|
2736
|
+
viewer->core->takeFocus();
|
2737
|
+
}
|
2738
|
+
|
2739
|
+
#endif // !DISABLE_OUTLINE
|
2740
|
+
|
2741
|
+
//------------------------------------------------------------------------
|
2742
|
+
// GUI code: "about" dialog
|
2743
|
+
//------------------------------------------------------------------------
|
2744
|
+
|
2745
|
+
void XPDFViewer::initAboutDialog() {
|
2746
|
+
Widget scrolledWin, col, label, sep, closeBtn;
|
2747
|
+
Arg args[20];
|
2748
|
+
int n, i;
|
2749
|
+
XmString s;
|
2750
|
+
char buf[20];
|
2751
|
+
|
2752
|
+
//----- dialog
|
2753
|
+
n = 0;
|
2754
|
+
s = XmStringCreateLocalized(xpdfAppName ": About");
|
2755
|
+
XtSetArg(args[n], XmNdialogTitle, s); ++n;
|
2756
|
+
XtSetArg(args[n], XmNwidth, 450); ++n;
|
2757
|
+
XtSetArg(args[n], XmNheight, 300); ++n;
|
2758
|
+
aboutDialog = XmCreateFormDialog(win, "aboutDialog", args, n);
|
2759
|
+
XmStringFree(s);
|
2760
|
+
|
2761
|
+
//----- "close" button
|
2762
|
+
n = 0;
|
2763
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
2764
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
2765
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
2766
|
+
XtSetArg(args[n], XmNbottomOffset, 4); ++n;
|
2767
|
+
closeBtn = XmCreatePushButton(aboutDialog, "Close", args, n);
|
2768
|
+
XtManageChild(closeBtn);
|
2769
|
+
n = 0;
|
2770
|
+
XtSetArg(args[n], XmNdefaultButton, closeBtn); ++n;
|
2771
|
+
XtSetArg(args[n], XmNcancelButton, closeBtn); ++n;
|
2772
|
+
XtSetValues(aboutDialog, args, n);
|
2773
|
+
|
2774
|
+
//----- scrolled window and RowColumn
|
2775
|
+
n = 0;
|
2776
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
2777
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
2778
|
+
XtSetArg(args[n], XmNbottomWidget, closeBtn); ++n;
|
2779
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
2780
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
2781
|
+
XtSetArg(args[n], XmNscrollingPolicy, XmAUTOMATIC); ++n;
|
2782
|
+
scrolledWin = XmCreateScrolledWindow(aboutDialog, "scrolledWin", args, n);
|
2783
|
+
XtManageChild(scrolledWin);
|
2784
|
+
n = 0;
|
2785
|
+
XtSetArg(args[n], XmNorientation, XmVERTICAL); ++n;
|
2786
|
+
XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); ++n;
|
2787
|
+
col = XmCreateRowColumn(scrolledWin, "col", args, n);
|
2788
|
+
XtManageChild(col);
|
2789
|
+
|
2790
|
+
//----- fonts
|
2791
|
+
aboutBigFont =
|
2792
|
+
createFontList("-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1");
|
2793
|
+
aboutVersionFont =
|
2794
|
+
createFontList("-*-times-medium-r-normal--16-*-*-*-*-*-iso8859-1");
|
2795
|
+
aboutFixedFont =
|
2796
|
+
createFontList("-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1");
|
2797
|
+
|
2798
|
+
//----- heading
|
2799
|
+
n = 0;
|
2800
|
+
s = XmStringCreateLocalized("Xpdf");
|
2801
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2802
|
+
XtSetArg(args[n], XmNfontList, aboutBigFont); ++n;
|
2803
|
+
label = XmCreateLabel(col, "h0", args, n);
|
2804
|
+
XmStringFree(s);
|
2805
|
+
XtManageChild(label);
|
2806
|
+
n = 0;
|
2807
|
+
s = XmStringCreateLocalized("Version " xpdfVersion);
|
2808
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2809
|
+
XtSetArg(args[n], XmNfontList, aboutVersionFont); ++n;
|
2810
|
+
label = XmCreateLabel(col, "h1", args, n);
|
2811
|
+
XmStringFree(s);
|
2812
|
+
XtManageChild(label);
|
2813
|
+
n = 0;
|
2814
|
+
s = XmStringCreateLocalized(xpdfCopyright);
|
2815
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2816
|
+
XtSetArg(args[n], XmNfontList, aboutVersionFont); ++n;
|
2817
|
+
label = XmCreateLabel(col, "h2", args, n);
|
2818
|
+
XmStringFree(s);
|
2819
|
+
XtManageChild(label);
|
2820
|
+
n = 0;
|
2821
|
+
s = XmStringCreateLocalized(" ");
|
2822
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2823
|
+
XtSetArg(args[n], XmNfontList, aboutVersionFont); ++n;
|
2824
|
+
label = XmCreateLabel(col, "h3", args, n);
|
2825
|
+
XmStringFree(s);
|
2826
|
+
XtManageChild(label);
|
2827
|
+
n = 0;
|
2828
|
+
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); ++n;
|
2829
|
+
sep = XmCreateSeparator(col, "sep", args, n);
|
2830
|
+
XtManageChild(sep);
|
2831
|
+
n = 0;
|
2832
|
+
s = XmStringCreateLocalized(" ");
|
2833
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2834
|
+
XtSetArg(args[n], XmNfontList, aboutVersionFont); ++n;
|
2835
|
+
label = XmCreateLabel(col, "h4", args, n);
|
2836
|
+
XmStringFree(s);
|
2837
|
+
XtManageChild(label);
|
2838
|
+
n = 0;
|
2839
|
+
|
2840
|
+
//----- text
|
2841
|
+
for (i = 0; aboutWinText[i]; ++i) {
|
2842
|
+
n = 0;
|
2843
|
+
s = XmStringCreateLocalized(aboutWinText[i]);
|
2844
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2845
|
+
XtSetArg(args[n], XmNfontList, aboutFixedFont); ++n;
|
2846
|
+
sprintf(buf, "t%d", i);
|
2847
|
+
label = XmCreateLabel(col, buf, args, n);
|
2848
|
+
XtManageChild(label);
|
2849
|
+
XmStringFree(s);
|
2850
|
+
}
|
2851
|
+
}
|
2852
|
+
|
2853
|
+
//------------------------------------------------------------------------
|
2854
|
+
// GUI code: "open" dialog
|
2855
|
+
//------------------------------------------------------------------------
|
2856
|
+
|
2857
|
+
void XPDFViewer::initOpenDialog() {
|
2858
|
+
Arg args[20];
|
2859
|
+
int n;
|
2860
|
+
XmString s1, s2, s3;
|
2861
|
+
GString *dir;
|
2862
|
+
|
2863
|
+
n = 0;
|
2864
|
+
s1 = XmStringCreateLocalized("Open");
|
2865
|
+
XtSetArg(args[n], XmNokLabelString, s1); ++n;
|
2866
|
+
s2 = XmStringCreateLocalized("*.[Pp][Dd][Ff]");
|
2867
|
+
XtSetArg(args[n], XmNpattern, s2); ++n;
|
2868
|
+
s3 = XmStringCreateLocalized(xpdfAppName ": Open");
|
2869
|
+
XtSetArg(args[n], XmNdialogTitle, s3); ++n;
|
2870
|
+
XtSetArg(args[n], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ++n;
|
2871
|
+
XtSetArg(args[n], XmNautoUnmanage, True); ++n;
|
2872
|
+
openDialog = XmCreateFileSelectionDialog(win, "openDialog", args, n);
|
2873
|
+
XmStringFree(s1);
|
2874
|
+
XmStringFree(s2);
|
2875
|
+
XmStringFree(s3);
|
2876
|
+
XtUnmanageChild(XmFileSelectionBoxGetChild(openDialog,
|
2877
|
+
XmDIALOG_HELP_BUTTON));
|
2878
|
+
XtAddCallback(openDialog, XmNokCallback,
|
2879
|
+
&openOkCbk, (XtPointer)this);
|
2880
|
+
|
2881
|
+
if (core->getDoc() && core->getDoc()->getFileName()) {
|
2882
|
+
dir = makePathAbsolute(grabPath(
|
2883
|
+
core->getDoc()->getFileName()->getCString()));
|
2884
|
+
s1 = XmStringCreateLocalized(dir->getCString());
|
2885
|
+
XtVaSetValues(openDialog, XmNdirectory, s1, NULL);
|
2886
|
+
XmStringFree(s1);
|
2887
|
+
delete dir;
|
2888
|
+
}
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
void XPDFViewer::mapOpenDialog(GBool openInNewWindowA) {
|
2892
|
+
if (!openDialog) {
|
2893
|
+
initOpenDialog();
|
2894
|
+
}
|
2895
|
+
openInNewWindow = openInNewWindowA;
|
2896
|
+
XmFileSelectionDoSearch(openDialog, NULL);
|
2897
|
+
XtManageChild(openDialog);
|
2898
|
+
}
|
2899
|
+
|
2900
|
+
void XPDFViewer::openOkCbk(Widget widget, XtPointer ptr,
|
2901
|
+
XtPointer callData) {
|
2902
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
2903
|
+
XmFileSelectionBoxCallbackStruct *data =
|
2904
|
+
(XmFileSelectionBoxCallbackStruct *)callData;
|
2905
|
+
char *fileName;
|
2906
|
+
XmStringContext context;
|
2907
|
+
XmStringCharSet charSet;
|
2908
|
+
XmStringDirection dir;
|
2909
|
+
Boolean sep;
|
2910
|
+
GString *fileNameStr;
|
2911
|
+
|
2912
|
+
XmStringInitContext(&context, data->value);
|
2913
|
+
if (XmStringGetNextSegment(context, &fileName, &charSet, &dir, &sep)) {
|
2914
|
+
fileNameStr = new GString(fileName);
|
2915
|
+
if (viewer->openInNewWindow) {
|
2916
|
+
viewer->app->open(fileNameStr);
|
2917
|
+
} else {
|
2918
|
+
if (viewer->loadFile(fileNameStr)) {
|
2919
|
+
viewer->displayPage(1, viewer->core->getZoom(),
|
2920
|
+
viewer->core->getRotate(), gTrue, gTrue);
|
2921
|
+
}
|
2922
|
+
}
|
2923
|
+
delete fileNameStr;
|
2924
|
+
XtFree(charSet);
|
2925
|
+
XtFree(fileName);
|
2926
|
+
}
|
2927
|
+
XmStringFreeContext(context);
|
2928
|
+
}
|
2929
|
+
|
2930
|
+
//------------------------------------------------------------------------
|
2931
|
+
// GUI code: "find" dialog
|
2932
|
+
//------------------------------------------------------------------------
|
2933
|
+
|
2934
|
+
void XPDFViewer::initFindDialog() {
|
2935
|
+
Widget form1, label, okBtn, closeBtn;
|
2936
|
+
Arg args[20];
|
2937
|
+
int n;
|
2938
|
+
XmString s;
|
2939
|
+
|
2940
|
+
//----- dialog
|
2941
|
+
n = 0;
|
2942
|
+
s = XmStringCreateLocalized(xpdfAppName ": Find");
|
2943
|
+
XtSetArg(args[n], XmNdialogTitle, s); ++n;
|
2944
|
+
XtSetArg(args[n], XmNnavigationType, XmNONE); ++n;
|
2945
|
+
XtSetArg(args[n], XmNautoUnmanage, False); ++n;
|
2946
|
+
findDialog = XmCreateFormDialog(win, "findDialog", args, n);
|
2947
|
+
XmStringFree(s);
|
2948
|
+
|
2949
|
+
//----- "find" and "close" buttons
|
2950
|
+
n = 0;
|
2951
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
2952
|
+
XtSetArg(args[n], XmNleftOffset, 4); ++n;
|
2953
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
2954
|
+
XtSetArg(args[n], XmNbottomOffset, 4); ++n;
|
2955
|
+
XtSetArg(args[n], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ++n;
|
2956
|
+
okBtn = XmCreatePushButton(findDialog, "Find", args, n);
|
2957
|
+
XtManageChild(okBtn);
|
2958
|
+
XtAddCallback(okBtn, XmNactivateCallback,
|
2959
|
+
&findFindCbk, (XtPointer)this);
|
2960
|
+
n = 0;
|
2961
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
2962
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
2963
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
2964
|
+
XtSetArg(args[n], XmNbottomOffset, 4); ++n;
|
2965
|
+
XtSetArg(args[n], XmNnavigationType, XmEXCLUSIVE_TAB_GROUP); ++n;
|
2966
|
+
closeBtn = XmCreatePushButton(findDialog, "Close", args, n);
|
2967
|
+
XtManageChild(closeBtn);
|
2968
|
+
XtAddCallback(closeBtn, XmNactivateCallback,
|
2969
|
+
&findCloseCbk, (XtPointer)this);
|
2970
|
+
|
2971
|
+
//----- checkboxes
|
2972
|
+
n = 0;
|
2973
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
2974
|
+
XtSetArg(args[n], XmNleftOffset, 4); ++n;
|
2975
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
2976
|
+
XtSetArg(args[n], XmNbottomWidget, okBtn); ++n;
|
2977
|
+
XtSetArg(args[n], XmNindicatorType, XmN_OF_MANY); ++n;
|
2978
|
+
#if XmVERSION <= 1
|
2979
|
+
XtSetArg(args[n], XmNindicatorOn, True); ++n;
|
2980
|
+
#else
|
2981
|
+
XtSetArg(args[n], XmNindicatorOn, XmINDICATOR_FILL); ++n;
|
2982
|
+
#endif
|
2983
|
+
XtSetArg(args[n], XmNset, XmUNSET); ++n;
|
2984
|
+
s = XmStringCreateLocalized("Search backward");
|
2985
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
2986
|
+
findBackwardToggle = XmCreateToggleButton(findDialog, "backward", args, n);
|
2987
|
+
XmStringFree(s);
|
2988
|
+
XtManageChild(findBackwardToggle);
|
2989
|
+
n = 0;
|
2990
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
2991
|
+
XtSetArg(args[n], XmNleftWidget, findBackwardToggle); ++n;
|
2992
|
+
XtSetArg(args[n], XmNleftOffset, 16); ++n;
|
2993
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
2994
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
2995
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
2996
|
+
XtSetArg(args[n], XmNbottomWidget, okBtn); ++n;
|
2997
|
+
XtSetArg(args[n], XmNindicatorType, XmN_OF_MANY); ++n;
|
2998
|
+
#if XmVERSION <= 1
|
2999
|
+
XtSetArg(args[n], XmNindicatorOn, True); ++n;
|
3000
|
+
#else
|
3001
|
+
XtSetArg(args[n], XmNindicatorOn, XmINDICATOR_FILL); ++n;
|
3002
|
+
#endif
|
3003
|
+
XtSetArg(args[n], XmNset, XmUNSET); ++n;
|
3004
|
+
s = XmStringCreateLocalized("Match case");
|
3005
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3006
|
+
findCaseSensitiveToggle =
|
3007
|
+
XmCreateToggleButton(findDialog, "matchCase", args, n);
|
3008
|
+
XmStringFree(s);
|
3009
|
+
XtManageChild(findCaseSensitiveToggle);
|
3010
|
+
|
3011
|
+
//----- search string entry
|
3012
|
+
n = 0;
|
3013
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
3014
|
+
XtSetArg(args[n], XmNtopOffset, 4); ++n;
|
3015
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); ++n;
|
3016
|
+
XtSetArg(args[n], XmNbottomWidget, findBackwardToggle); ++n;
|
3017
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3018
|
+
XtSetArg(args[n], XmNleftOffset, 2); ++n;
|
3019
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3020
|
+
XtSetArg(args[n], XmNrightOffset, 2); ++n;
|
3021
|
+
form1 = XmCreateForm(findDialog, "form", args, n);
|
3022
|
+
XtManageChild(form1);
|
3023
|
+
n = 0;
|
3024
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
3025
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
3026
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3027
|
+
s = XmStringCreateLocalized("Find text: ");
|
3028
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3029
|
+
label = XmCreateLabel(form1, "label", args, n);
|
3030
|
+
XmStringFree(s);
|
3031
|
+
XtManageChild(label);
|
3032
|
+
n = 0;
|
3033
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
3034
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
3035
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_WIDGET); ++n;
|
3036
|
+
XtSetArg(args[n], XmNleftWidget, label); ++n;
|
3037
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3038
|
+
findText = XmCreateTextField(form1, "text", args, n);
|
3039
|
+
XtManageChild(findText);
|
3040
|
+
#ifdef LESSTIF_VERSION
|
3041
|
+
XtAddCallback(findText, XmNactivateCallback,
|
3042
|
+
&findFindCbk, (XtPointer)this);
|
3043
|
+
#endif
|
3044
|
+
|
3045
|
+
//----- dialog parameters
|
3046
|
+
n = 0;
|
3047
|
+
XtSetArg(args[n], XmNdefaultButton, okBtn); ++n;
|
3048
|
+
XtSetArg(args[n], XmNcancelButton, closeBtn); ++n;
|
3049
|
+
#if XmVersion > 1001
|
3050
|
+
XtSetArg(args[n], XmNinitialFocus, findText); ++n;
|
3051
|
+
#endif
|
3052
|
+
XtSetValues(findDialog, args, n);
|
3053
|
+
}
|
3054
|
+
|
3055
|
+
void XPDFViewer::findFindCbk(Widget widget, XtPointer ptr,
|
3056
|
+
XtPointer callData) {
|
3057
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3058
|
+
|
3059
|
+
viewer->doFind(gFalse);
|
3060
|
+
}
|
3061
|
+
|
3062
|
+
void XPDFViewer::mapFindDialog() {
|
3063
|
+
XmTextFieldSetSelection(findText, 0, XmTextFieldGetLastPosition(findText),
|
3064
|
+
XtLastTimestampProcessed(display));
|
3065
|
+
XmTextFieldSetInsertionPosition(findText, 0);
|
3066
|
+
XtManageChild(findDialog);
|
3067
|
+
}
|
3068
|
+
|
3069
|
+
void XPDFViewer::doFind(GBool next) {
|
3070
|
+
if (XtWindow(findDialog)) {
|
3071
|
+
XDefineCursor(display, XtWindow(findDialog), core->getBusyCursor());
|
3072
|
+
}
|
3073
|
+
core->find(XmTextFieldGetString(findText),
|
3074
|
+
XmToggleButtonGetState(findCaseSensitiveToggle),
|
3075
|
+
next,
|
3076
|
+
XmToggleButtonGetState(findBackwardToggle),
|
3077
|
+
gFalse);
|
3078
|
+
if (XtWindow(findDialog)) {
|
3079
|
+
XUndefineCursor(display, XtWindow(findDialog));
|
3080
|
+
}
|
3081
|
+
}
|
3082
|
+
|
3083
|
+
void XPDFViewer::findCloseCbk(Widget widget, XtPointer ptr,
|
3084
|
+
XtPointer callData) {
|
3085
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3086
|
+
|
3087
|
+
XtUnmanageChild(viewer->findDialog);
|
3088
|
+
}
|
3089
|
+
|
3090
|
+
//------------------------------------------------------------------------
|
3091
|
+
// GUI code: "save as" dialog
|
3092
|
+
//------------------------------------------------------------------------
|
3093
|
+
|
3094
|
+
void XPDFViewer::initSaveAsDialog() {
|
3095
|
+
Arg args[20];
|
3096
|
+
int n;
|
3097
|
+
XmString s1, s2, s3;
|
3098
|
+
GString *dir;
|
3099
|
+
|
3100
|
+
n = 0;
|
3101
|
+
s1 = XmStringCreateLocalized("Save");
|
3102
|
+
XtSetArg(args[n], XmNokLabelString, s1); ++n;
|
3103
|
+
s2 = XmStringCreateLocalized("*.[Pp][Dd][Ff]");
|
3104
|
+
XtSetArg(args[n], XmNpattern, s2); ++n;
|
3105
|
+
s3 = XmStringCreateLocalized(xpdfAppName ": Save as");
|
3106
|
+
XtSetArg(args[n], XmNdialogTitle, s3); ++n;
|
3107
|
+
XtSetArg(args[n], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ++n;
|
3108
|
+
XtSetArg(args[n], XmNautoUnmanage, True); ++n;
|
3109
|
+
saveAsDialog = XmCreateFileSelectionDialog(win, "saveAsDialog", args, n);
|
3110
|
+
XmStringFree(s1);
|
3111
|
+
XmStringFree(s2);
|
3112
|
+
XmStringFree(s3);
|
3113
|
+
XtUnmanageChild(XmFileSelectionBoxGetChild(saveAsDialog,
|
3114
|
+
XmDIALOG_HELP_BUTTON));
|
3115
|
+
XtAddCallback(saveAsDialog, XmNokCallback,
|
3116
|
+
&saveAsOkCbk, (XtPointer)this);
|
3117
|
+
|
3118
|
+
if (core->getDoc() && core->getDoc()->getFileName()) {
|
3119
|
+
dir = makePathAbsolute(grabPath(
|
3120
|
+
core->getDoc()->getFileName()->getCString()));
|
3121
|
+
s1 = XmStringCreateLocalized(dir->getCString());
|
3122
|
+
XtVaSetValues(saveAsDialog, XmNdirectory, s1, NULL);
|
3123
|
+
XmStringFree(s1);
|
3124
|
+
delete dir;
|
3125
|
+
}
|
3126
|
+
}
|
3127
|
+
|
3128
|
+
void XPDFViewer::mapSaveAsDialog() {
|
3129
|
+
if (!saveAsDialog) {
|
3130
|
+
initSaveAsDialog();
|
3131
|
+
}
|
3132
|
+
XmFileSelectionDoSearch(saveAsDialog, NULL);
|
3133
|
+
XtManageChild(saveAsDialog);
|
3134
|
+
}
|
3135
|
+
|
3136
|
+
void XPDFViewer::saveAsOkCbk(Widget widget, XtPointer ptr,
|
3137
|
+
XtPointer callData) {
|
3138
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3139
|
+
XmFileSelectionBoxCallbackStruct *data =
|
3140
|
+
(XmFileSelectionBoxCallbackStruct *)callData;
|
3141
|
+
char *fileName;
|
3142
|
+
GString *fileNameStr;
|
3143
|
+
XmStringContext context;
|
3144
|
+
XmStringCharSet charSet;
|
3145
|
+
XmStringDirection dir;
|
3146
|
+
Boolean sep;
|
3147
|
+
|
3148
|
+
XmStringInitContext(&context, data->value);
|
3149
|
+
if (XmStringGetNextSegment(context, &fileName, &charSet, &dir, &sep)) {
|
3150
|
+
fileNameStr = new GString(fileName);
|
3151
|
+
viewer->core->getDoc()->saveAs(fileNameStr);
|
3152
|
+
delete fileNameStr;
|
3153
|
+
XtFree(charSet);
|
3154
|
+
XtFree(fileName);
|
3155
|
+
}
|
3156
|
+
XmStringFreeContext(context);
|
3157
|
+
}
|
3158
|
+
|
3159
|
+
//------------------------------------------------------------------------
|
3160
|
+
// GUI code: "print" dialog
|
3161
|
+
//------------------------------------------------------------------------
|
3162
|
+
|
3163
|
+
void XPDFViewer::initPrintDialog() {
|
3164
|
+
Widget sep1, sep2, row, label1, label2, okBtn, cancelBtn;
|
3165
|
+
Arg args[20];
|
3166
|
+
int n;
|
3167
|
+
XmString s;
|
3168
|
+
GString *psFileName;
|
3169
|
+
|
3170
|
+
//----- dialog
|
3171
|
+
n = 0;
|
3172
|
+
s = XmStringCreateLocalized(xpdfAppName ": Print");
|
3173
|
+
XtSetArg(args[n], XmNdialogTitle, s); ++n;
|
3174
|
+
XtSetArg(args[n], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ++n;
|
3175
|
+
printDialog = XmCreateFormDialog(win, "printDialog", args, n);
|
3176
|
+
XmStringFree(s);
|
3177
|
+
|
3178
|
+
//----- "print with command"
|
3179
|
+
n = 0;
|
3180
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); ++n;
|
3181
|
+
XtSetArg(args[n], XmNtopOffset, 4); ++n;
|
3182
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3183
|
+
XtSetArg(args[n], XmNindicatorType, XmONE_OF_MANY); ++n;
|
3184
|
+
XtSetArg(args[n], XmNset, XmSET); ++n;
|
3185
|
+
s = XmStringCreateLocalized("Print with command:");
|
3186
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3187
|
+
printWithCmdBtn = XmCreateToggleButton(printDialog, "printWithCmd", args, n);
|
3188
|
+
XmStringFree(s);
|
3189
|
+
XtManageChild(printWithCmdBtn);
|
3190
|
+
XtAddCallback(printWithCmdBtn, XmNvalueChangedCallback,
|
3191
|
+
&printWithCmdBtnCbk, (XtPointer)this);
|
3192
|
+
n = 0;
|
3193
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3194
|
+
XtSetArg(args[n], XmNtopWidget, printWithCmdBtn); ++n;
|
3195
|
+
XtSetArg(args[n], XmNtopOffset, 2); ++n;
|
3196
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3197
|
+
XtSetArg(args[n], XmNleftOffset, 16); ++n;
|
3198
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3199
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
3200
|
+
XtSetArg(args[n], XmNcolumns, 40); ++n;
|
3201
|
+
printCmdText = XmCreateTextField(printDialog, "printCmd", args, n);
|
3202
|
+
XtManageChild(printCmdText);
|
3203
|
+
|
3204
|
+
//----- "print to file"
|
3205
|
+
n = 0;
|
3206
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3207
|
+
XtSetArg(args[n], XmNtopWidget, printCmdText); ++n;
|
3208
|
+
XtSetArg(args[n], XmNtopOffset, 4); ++n;
|
3209
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3210
|
+
XtSetArg(args[n], XmNindicatorType, XmONE_OF_MANY); ++n;
|
3211
|
+
XtSetArg(args[n], XmNset, XmUNSET); ++n;
|
3212
|
+
s = XmStringCreateLocalized("Print to file:");
|
3213
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3214
|
+
printToFileBtn = XmCreateToggleButton(printDialog, "printToFile", args, n);
|
3215
|
+
XmStringFree(s);
|
3216
|
+
XtManageChild(printToFileBtn);
|
3217
|
+
XtAddCallback(printToFileBtn, XmNvalueChangedCallback,
|
3218
|
+
&printToFileBtnCbk, (XtPointer)this);
|
3219
|
+
n = 0;
|
3220
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3221
|
+
XtSetArg(args[n], XmNtopWidget, printToFileBtn); ++n;
|
3222
|
+
XtSetArg(args[n], XmNtopOffset, 2); ++n;
|
3223
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3224
|
+
XtSetArg(args[n], XmNleftOffset, 16); ++n;
|
3225
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3226
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
3227
|
+
XtSetArg(args[n], XmNcolumns, 40); ++n;
|
3228
|
+
XtSetArg(args[n], XmNsensitive, False); ++n;
|
3229
|
+
printFileText = XmCreateTextField(printDialog, "printFile", args, n);
|
3230
|
+
XtManageChild(printFileText);
|
3231
|
+
|
3232
|
+
//----- separator
|
3233
|
+
n = 0;
|
3234
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3235
|
+
XtSetArg(args[n], XmNtopWidget, printFileText); ++n;
|
3236
|
+
XtSetArg(args[n], XmNtopOffset, 8); ++n;
|
3237
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3238
|
+
XtSetArg(args[n], XmNleftOffset, 8); ++n;
|
3239
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3240
|
+
XtSetArg(args[n], XmNrightOffset, 8); ++n;
|
3241
|
+
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); ++n;
|
3242
|
+
sep1 = XmCreateSeparator(printDialog, "sep1", args, n);
|
3243
|
+
XtManageChild(sep1);
|
3244
|
+
|
3245
|
+
//----- page range
|
3246
|
+
n = 0;
|
3247
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3248
|
+
XtSetArg(args[n], XmNtopWidget, sep1); ++n;
|
3249
|
+
XtSetArg(args[n], XmNtopOffset, 8); ++n;
|
3250
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3251
|
+
XtSetArg(args[n], XmNleftOffset, 4); ++n;
|
3252
|
+
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); ++n;
|
3253
|
+
XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); ++n;
|
3254
|
+
row = XmCreateRowColumn(printDialog, "row", args, n);
|
3255
|
+
XtManageChild(row);
|
3256
|
+
n = 0;
|
3257
|
+
s = XmStringCreateLocalized("Pages:");
|
3258
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3259
|
+
label1 = XmCreateLabel(row, "label1", args, n);
|
3260
|
+
XmStringFree(s);
|
3261
|
+
XtManageChild(label1);
|
3262
|
+
n = 0;
|
3263
|
+
XtSetArg(args[n], XmNcolumns, 5); ++n;
|
3264
|
+
printFirstPage = XmCreateTextField(row, "printFirstPage", args, n);
|
3265
|
+
XtManageChild(printFirstPage);
|
3266
|
+
n = 0;
|
3267
|
+
s = XmStringCreateLocalized("to");
|
3268
|
+
XtSetArg(args[n], XmNlabelString, s); ++n;
|
3269
|
+
label2 = XmCreateLabel(row, "label2", args, n);
|
3270
|
+
XmStringFree(s);
|
3271
|
+
XtManageChild(label2);
|
3272
|
+
n = 0;
|
3273
|
+
XtSetArg(args[n], XmNcolumns, 5); ++n;
|
3274
|
+
printLastPage = XmCreateTextField(row, "printLastPage", args, n);
|
3275
|
+
XtManageChild(printLastPage);
|
3276
|
+
|
3277
|
+
//----- separator
|
3278
|
+
n = 0;
|
3279
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3280
|
+
XtSetArg(args[n], XmNtopWidget, row); ++n;
|
3281
|
+
XtSetArg(args[n], XmNtopOffset, 8); ++n;
|
3282
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3283
|
+
XtSetArg(args[n], XmNleftOffset, 8); ++n;
|
3284
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3285
|
+
XtSetArg(args[n], XmNrightOffset, 8); ++n;
|
3286
|
+
XtSetArg(args[n], XmNorientation, XmHORIZONTAL); ++n;
|
3287
|
+
sep2 = XmCreateSeparator(printDialog, "sep2", args, n);
|
3288
|
+
XtManageChild(sep2);
|
3289
|
+
|
3290
|
+
//----- "print" and "cancel" buttons
|
3291
|
+
n = 0;
|
3292
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3293
|
+
XtSetArg(args[n], XmNtopWidget, sep2); ++n;
|
3294
|
+
XtSetArg(args[n], XmNtopOffset, 8); ++n;
|
3295
|
+
XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); ++n;
|
3296
|
+
XtSetArg(args[n], XmNleftOffset, 4); ++n;
|
3297
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
3298
|
+
XtSetArg(args[n], XmNbottomOffset, 4); ++n;
|
3299
|
+
okBtn = XmCreatePushButton(printDialog, "Print", args, n);
|
3300
|
+
XtManageChild(okBtn);
|
3301
|
+
XtAddCallback(okBtn, XmNactivateCallback,
|
3302
|
+
&printPrintCbk, (XtPointer)this);
|
3303
|
+
n = 0;
|
3304
|
+
XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); ++n;
|
3305
|
+
XtSetArg(args[n], XmNtopWidget, sep2); ++n;
|
3306
|
+
XtSetArg(args[n], XmNtopOffset, 8); ++n;
|
3307
|
+
XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); ++n;
|
3308
|
+
XtSetArg(args[n], XmNrightOffset, 4); ++n;
|
3309
|
+
XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); ++n;
|
3310
|
+
XtSetArg(args[n], XmNbottomOffset, 4); ++n;
|
3311
|
+
cancelBtn = XmCreatePushButton(printDialog, "Cancel", args, n);
|
3312
|
+
XtManageChild(cancelBtn);
|
3313
|
+
n = 0;
|
3314
|
+
XtSetArg(args[n], XmNdefaultButton, okBtn); ++n;
|
3315
|
+
XtSetArg(args[n], XmNcancelButton, cancelBtn); ++n;
|
3316
|
+
XtSetValues(printDialog, args, n);
|
3317
|
+
|
3318
|
+
//----- initial values
|
3319
|
+
if ((psFileName = globalParams->getPSFile())) {
|
3320
|
+
if (psFileName->getChar(0) == '|') {
|
3321
|
+
XmTextFieldSetString(printCmdText,
|
3322
|
+
psFileName->getCString() + 1);
|
3323
|
+
} else {
|
3324
|
+
XmTextFieldSetString(printFileText, psFileName->getCString());
|
3325
|
+
}
|
3326
|
+
delete psFileName;
|
3327
|
+
}
|
3328
|
+
}
|
3329
|
+
|
3330
|
+
void XPDFViewer::setupPrintDialog() {
|
3331
|
+
PDFDoc *doc;
|
3332
|
+
char buf[20];
|
3333
|
+
GString *pdfFileName, *psFileName, *psFileName2;
|
3334
|
+
char *p;
|
3335
|
+
|
3336
|
+
doc = core->getDoc();
|
3337
|
+
psFileName = globalParams->getPSFile();
|
3338
|
+
if (!psFileName || psFileName->getChar(0) == '|') {
|
3339
|
+
pdfFileName = doc->getFileName();
|
3340
|
+
p = pdfFileName->getCString() + pdfFileName->getLength() - 4;
|
3341
|
+
if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
|
3342
|
+
psFileName2 = new GString(pdfFileName->getCString(),
|
3343
|
+
pdfFileName->getLength() - 4);
|
3344
|
+
} else {
|
3345
|
+
psFileName2 = pdfFileName->copy();
|
3346
|
+
}
|
3347
|
+
psFileName2->append(".ps");
|
3348
|
+
XmTextFieldSetString(printFileText, psFileName2->getCString());
|
3349
|
+
delete psFileName2;
|
3350
|
+
}
|
3351
|
+
if (psFileName && psFileName->getChar(0) == '|') {
|
3352
|
+
XmToggleButtonSetState(printWithCmdBtn, True, False);
|
3353
|
+
XmToggleButtonSetState(printToFileBtn, False, False);
|
3354
|
+
XtVaSetValues(printCmdText, XmNsensitive, True, NULL);
|
3355
|
+
XtVaSetValues(printFileText, XmNsensitive, False, NULL);
|
3356
|
+
} else {
|
3357
|
+
XmToggleButtonSetState(printWithCmdBtn, False, False);
|
3358
|
+
XmToggleButtonSetState(printToFileBtn, True, False);
|
3359
|
+
XtVaSetValues(printCmdText, XmNsensitive, False, NULL);
|
3360
|
+
XtVaSetValues(printFileText, XmNsensitive, True, NULL);
|
3361
|
+
}
|
3362
|
+
if (psFileName) {
|
3363
|
+
delete psFileName;
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
sprintf(buf, "%d", doc->getNumPages());
|
3367
|
+
XmTextFieldSetString(printFirstPage, "1");
|
3368
|
+
XmTextFieldSetString(printLastPage, buf);
|
3369
|
+
}
|
3370
|
+
|
3371
|
+
void XPDFViewer::printWithCmdBtnCbk(Widget widget, XtPointer ptr,
|
3372
|
+
XtPointer callData) {
|
3373
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3374
|
+
XmToggleButtonCallbackStruct *data =
|
3375
|
+
(XmToggleButtonCallbackStruct *)callData;
|
3376
|
+
|
3377
|
+
if (data->set != XmSET) {
|
3378
|
+
XmToggleButtonSetState(viewer->printWithCmdBtn, True, False);
|
3379
|
+
}
|
3380
|
+
XmToggleButtonSetState(viewer->printToFileBtn, False, False);
|
3381
|
+
XtVaSetValues(viewer->printCmdText, XmNsensitive, True, NULL);
|
3382
|
+
XtVaSetValues(viewer->printFileText, XmNsensitive, False, NULL);
|
3383
|
+
}
|
3384
|
+
|
3385
|
+
void XPDFViewer::printToFileBtnCbk(Widget widget, XtPointer ptr,
|
3386
|
+
XtPointer callData) {
|
3387
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3388
|
+
XmToggleButtonCallbackStruct *data =
|
3389
|
+
(XmToggleButtonCallbackStruct *)callData;
|
3390
|
+
|
3391
|
+
if (data->set != XmSET) {
|
3392
|
+
XmToggleButtonSetState(viewer->printToFileBtn, True, False);
|
3393
|
+
}
|
3394
|
+
XmToggleButtonSetState(viewer->printWithCmdBtn, False, False);
|
3395
|
+
XtVaSetValues(viewer->printFileText, XmNsensitive, True, NULL);
|
3396
|
+
XtVaSetValues(viewer->printCmdText, XmNsensitive, False, NULL);
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
void XPDFViewer::printPrintCbk(Widget widget, XtPointer ptr,
|
3400
|
+
XtPointer callData) {
|
3401
|
+
XPDFViewer *viewer = (XPDFViewer *)ptr;
|
3402
|
+
unsigned char withCmd;
|
3403
|
+
GString *psFileName;
|
3404
|
+
int firstPage, lastPage;
|
3405
|
+
PDFDoc *doc;
|
3406
|
+
PSOutputDev *psOut;
|
3407
|
+
|
3408
|
+
doc = viewer->core->getDoc();
|
3409
|
+
if (!doc->okToPrint()) {
|
3410
|
+
error(-1, "Printing this document is not allowed.");
|
3411
|
+
return;
|
3412
|
+
}
|
3413
|
+
|
3414
|
+
viewer->core->setBusyCursor(gTrue);
|
3415
|
+
|
3416
|
+
XtVaGetValues(viewer->printWithCmdBtn, XmNset, &withCmd, NULL);
|
3417
|
+
if (withCmd) {
|
3418
|
+
psFileName = new GString(XmTextFieldGetString(viewer->printCmdText));
|
3419
|
+
psFileName->insert(0, '|');
|
3420
|
+
} else {
|
3421
|
+
psFileName = new GString(XmTextFieldGetString(viewer->printFileText));
|
3422
|
+
}
|
3423
|
+
|
3424
|
+
firstPage = atoi(XmTextFieldGetString(viewer->printFirstPage));
|
3425
|
+
lastPage = atoi(XmTextFieldGetString(viewer->printLastPage));
|
3426
|
+
if (firstPage < 1) {
|
3427
|
+
firstPage = 1;
|
3428
|
+
} else if (firstPage > doc->getNumPages()) {
|
3429
|
+
firstPage = doc->getNumPages();
|
3430
|
+
}
|
3431
|
+
if (lastPage < firstPage) {
|
3432
|
+
lastPage = firstPage;
|
3433
|
+
} else if (lastPage > doc->getNumPages()) {
|
3434
|
+
lastPage = doc->getNumPages();
|
3435
|
+
}
|
3436
|
+
|
3437
|
+
psOut = new PSOutputDev(psFileName->getCString(), doc->getXRef(),
|
3438
|
+
doc->getCatalog(), firstPage, lastPage,
|
3439
|
+
psModePS);
|
3440
|
+
if (psOut->isOk()) {
|
3441
|
+
doc->displayPages(psOut, firstPage, lastPage, 72, 72,
|
3442
|
+
0, gTrue, globalParams->getPSCrop(), gTrue);
|
3443
|
+
}
|
3444
|
+
delete psOut;
|
3445
|
+
delete psFileName;
|
3446
|
+
|
3447
|
+
viewer->core->setBusyCursor(gFalse);
|
3448
|
+
}
|
3449
|
+
|
3450
|
+
//------------------------------------------------------------------------
|
3451
|
+
// Motif support
|
3452
|
+
//------------------------------------------------------------------------
|
3453
|
+
|
3454
|
+
XmFontList XPDFViewer::createFontList(char *xlfd) {
|
3455
|
+
XmFontList fontList;
|
3456
|
+
|
3457
|
+
#if XmVersion <= 1001
|
3458
|
+
|
3459
|
+
XFontStruct *font;
|
3460
|
+
String params;
|
3461
|
+
Cardinal nParams;
|
3462
|
+
|
3463
|
+
font = XLoadQueryFont(display, xlfd);
|
3464
|
+
if (font) {
|
3465
|
+
fontList = XmFontListCreate(font, XmSTRING_DEFAULT_CHARSET);
|
3466
|
+
} else {
|
3467
|
+
params = (String)xlfd;
|
3468
|
+
nParams = 1;
|
3469
|
+
XtAppWarningMsg(app->getAppContext(),
|
3470
|
+
"noSuchFont", "CvtStringToXmFontList",
|
3471
|
+
"XtToolkitError", "No such font: %s",
|
3472
|
+
¶ms, &nParams);
|
3473
|
+
fontList = NULL;
|
3474
|
+
}
|
3475
|
+
|
3476
|
+
#else
|
3477
|
+
|
3478
|
+
XmFontListEntry entry;
|
3479
|
+
|
3480
|
+
entry = XmFontListEntryLoad(display, xlfd,
|
3481
|
+
XmFONT_IS_FONT, XmFONTLIST_DEFAULT_TAG);
|
3482
|
+
fontList = XmFontListAppendEntry(NULL, entry);
|
3483
|
+
XmFontListEntryFree(&entry);
|
3484
|
+
|
3485
|
+
#endif
|
3486
|
+
|
3487
|
+
return fontList;
|
3488
|
+
}
|