From 7812f054be35c2a0bb3c7c94b4c138a6238d7c6e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 13 Jul 2017 10:31:28 +0900 Subject: add acrosort and aebslicing --- texmf-dist/source/latex/acrosort/acrosort.dtx | 378 +++++++++++++++++++++ texmf-dist/source/latex/acrosort/acrosort.ins | 59 ++++ .../source/latex/acrosort/aeb_pro/aeb_pro.js | 106 ++++++ .../source/latex/aebslicing/AeB Slicing.sequ | 22 ++ texmf-dist/source/latex/aebslicing/aebslice.js | 345 +++++++++++++++++++ 5 files changed, 910 insertions(+) create mode 100644 texmf-dist/source/latex/acrosort/acrosort.dtx create mode 100644 texmf-dist/source/latex/acrosort/acrosort.ins create mode 100644 texmf-dist/source/latex/acrosort/aeb_pro/aeb_pro.js create mode 100644 texmf-dist/source/latex/aebslicing/AeB Slicing.sequ create mode 100644 texmf-dist/source/latex/aebslicing/aebslice.js (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/acrosort/acrosort.dtx b/texmf-dist/source/latex/acrosort/acrosort.dtx new file mode 100644 index 00000000..9218aeef --- /dev/null +++ b/texmf-dist/source/latex/acrosort/acrosort.dtx @@ -0,0 +1,378 @@ +%% +% \iffalse +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% acrosort package, 2011-12-22 %% +%% Copyright (C) 2006--2011 D. P. Story %% +%% dpstory@acrotex.net %% +%% storyd@nwfsc.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{acrosort} +% [2011/12/22 v1.5 AcroSort (dps)] +%<*driver> +\documentclass{ltxdoc} +\usepackage[dviwindo,colorlinks,hyperindex]{hyperref} +\pdfstringdefDisableCommands{\let\\\textbackslash}% +\EnableCrossrefs \CodelineIndex +\OnlyDescription % comment out for implementation details +\begin{document} + \GetFileInfo{acromemory.sty} + \title{The \texttt{AcroSort} Package\texorpdfstring{\\}{: } + A member of the AeB Pro family} + \author{D. P. Story\\ + Email: \texttt{storyd@nwfsc.edu}} + \date{processed \today} + \maketitle + \tableofcontents + \let\Email\texttt + \DocInput{acrosort.dtx} + \PrintIndex +\end{document} +% +% \fi +% \section{Main Code} +% When setting up your AcroSort document, you need to provide this package with +% certain information, as listed below. +% \begin{macro}{\theTotalTiles} +% \begin{macro}{\theNumRows} +% \begin{macro}{\theNumCols} +% \begin{macro}{\theImportPath} +% \begin{macro}{\theIconExt} +% \begin{macro}{\theTeXImageWidth} +% \begin{macro}{\isPackage} +%\begin{itemize} +% \item \cs{theTotalTiles}: The total number of tiles in the game board. For example, +% \verb!\theTotalTiles{20}!. This parameter is required. +% \item \cs{theNumRows}: The number of rows in the game board. For example, +% \verb!\theNumRows{5}!. This parameter is required. +% \item \cs{theNumCols}: The number of columns in the game board. For example, +% \verb!\theNumCols{4}!. This parameter is required. +% \item \cs{theImportPath}: The import path to the basename of the image. The path +% should use the path specification as defined in the PDF Ref, and the file name should +% have no extension. For example, \verb!\theImportPath{myFig/myimages}!. Required. +% \item \cs{theIconExt}: The extension of the image file(s), Required if different +% from \texttt{pdf}. +% \item \cs{theTeXImageWidth}: The scaled width of the rectangular game board. The +% game board will be rescaled so that its width is equal to the value specified +% by the argument of this command, e.g., \verb!\theTeXImageWidth{2in}!. +% \item \cs{isPackage} executed in the preamble signals that the icon files are +% packaged. +%\end{itemize} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \paragraph*{Required Packages.} +% \begin{macrocode} +\RequirePackage[execJS]{eforms} +\RequirePackage{graphicx} +% \end{macrocode} +% \begin{macrocode} +\def\theTotalTiles#1{\def\nTotalTiles{#1}} +\let\nTotalTiles\@empty +% \end{macrocode} +% For \cs{theNumRows} and \cs{theNumCols} we try to calculate the total +% number of tiles, \cs{nTotalTiles}. We must wait until both the row and +% column command have been expanded. +% \begin{macrocode} +\def\theNumRows#1{% + \def\nRows{#1}% + \ifx\nCols\@empty\else + \ifx\nTotalTiles\@empty + {\count0=#1\relax\multiply\count0by\nCols + \xdef\nTotalTiles{\the\count0}}% + \fi + \fi + } +\let\nRows\@empty +\def\theNumCols#1{% + \def\nCols{#1}% + \ifx\nRows\@empty\else + \ifx\nTotalTiles\@empty + {\count0=#1\relax\multiply\count0by\nRows + \xdef\nTotalTiles{\the\count0}}% + \fi + \fi +} +\let\nCols\@empty +\def\theImportPath#1{\def\importpath{#1}} +\def\theIconExt#1{\def\iconsExt{#1}} +\def\iconsExt{pdf} +\def\theTeXImageWidth#1{\def\texImageWidth{#1}% + {\dimen0=\texImageWidth \xdef\imageWidth{\strip@pt\dimen0 }}% +} +\def\isPackage{\def\bIsPackage{true}} +\def\bIsPackage{false} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\ulCornerHere} +% \begin{macro}{\reserveSpaceByDimension} +% \begin{macro}{\reserveSpaceByFile} +% This group of buttons appear together. \cs{ulCornerHere} is used to +% set the upper left corner of the image. One of the two commands +% \cs{reserveSpaceByDimension} or \cs{reserveSpaceByFile} immediately follow +% the `corner' commands. +% \begin{macrocode} +\def\ulCornerHere{\makebox[0pt][l]% + {\pushButton[\autoCenter{n}]{ulcorner}{0pt}{0pt}}} +% \end{macrocode} +% The two arguments are $\texttt{\#1} = \mbox{width}$ and $\texttt{\#2} = \mbox{height}$. +% \begin{macrocode} +\def\reserveSpaceByDimension#1#2{% + \hbox{\ifpreview\setlength\fboxrule{0.4pt}\setlength\fboxsep{0pt}% + \@tempdima=#1\advance\@tempdima by-\fboxrule + \@tempdimb=#2\advance\@tempdimb by-\fboxrule + \fbox{\parbox[t][\@tempdimb][t]{\@tempdima}{\kern0pt\hfill\vfill}}% + \else\parbox[t][#2][t]{#1}{\kern0pt\hfill\vfill}\fi}% +} +\newcommand{\reserveSpaceByFile}[1][\importpath]% + {{\setbox0=\hbox{\includegraphics[draft,width=\texImageWidth]{#1}}% + \reserveSpaceByDimension{\wd0}{\ht0}}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\StartSort} +% \begin{macro}{\ClearSort} +% \begin{macro}{\StopSort} +% Some buttons to control the starting, stopping and clearing of the image. You can +% change the appearance of these buttons by using the optional parameter, see the +% \textsf{eForms} documentation. +% \begin{macrocode} +\newcommand{\StartSort}[1][]{{\small\pushButton[\CA{Press Me}#1 + \A{\JS{% + ok2Continue = true;\r + mixupDPS();\r + showDPS();\r + sortoutDPS(); + }}]{StartButton}{}{12bp}}% +} +\newcommand{\ClearSort}[1][]% + {\small{\pushButton[\CA{Clear}#1\A{\JS{% + clearDPS();\sortCustomStartJS}}% + ]{StartButton}{}{12bp}}% +} +\newcommand{\StopSort}[1][]% + {\small{\pushButton[\CA{Stop}#1\A{\JS{ok2Continue = false;}}% + ]{StartButton}{}{12bp}}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macro}{\bDebug} +% Debugging command. Get back more info when you assemble the document. +% \begin{macrocode} +\def\bDebug{\def\memDebug{true}} +\def\memDebug{false} +% \end{macrocode} +% \end{macro} +% \section{Document JavaScript for \textsf{AcroSort}} +% Most of the work of this package is done with document JavaScript, and here +% it is. +%\par\medskip\noindent +%\StopEventually{JavaScript listing suppressed, +% comment out \cs{OnlyDescription} at the beginning of this file to see +% the JavaScript.} +% \begin{macrocode} +\newcommand{\customStartJS}[1]{\def\sortCustomStartJS{#1}} +\let\sortCustomStartJS\@empty +\newcommand{\customFinishJS}[1]{\def\sortCustomFinishJS{#1}} +\def\sortCustomFinishJS{;} +\begin{insDLJS}[randomDPS]{sort}{JS for bubble sort} +// Global Data: +var randomDPS = new Array(\nTotalTiles+1); +var ldps = randomDPS.length; +var timeout = 10; +var shutdown; +var debug = \memDebug; +var ok2Continue = true; +for (i=1; i<=\nTotalTiles; i++) randomDPS[i]=i; + +// Clear DPS: +try {this.addIcon("nullIcon", this.createIcon("", 0, 0));} catch(e) {} + +function clearDPS() +{ + for ( var i=1; i<=\nTotalTiles; i++ ) + { + var oIcon = this.getIcon("nullIcon"); + var f = this.getField("button."+i); + f.buttonSetIcon(oIcon); + } +} + +// Mixup DPS: +function mixupDPS() +{ + var i, rand, temp; + for (i=1; i<= \nTotalTiles; i++) + { + var rand = Math.random(); + rand *= ldps*ldps; + rand = Math.ceil(rand); + rand = rand \% ldps; + if (rand == 0 ) rand = 1; + temp = randomDPS[i]; + randomDPS[i]=randomDPS[rand]; + randomDPS[rand]=temp; + } +} + +// Show DPS: +function showDPS() +{ + \sortCustomStartJS + for ( var i=1; i<=\nTotalTiles; i++ ) + { + var oIcon = this.getIcon("pic."+randomDPS[i]); + var f = this.getField("button."+i); + f.buttonSetIcon(oIcon); + } +} + +// Sortout DPS: +function sortoutDPS() +{ + outerLoop(randomDPS.length-1); +} +function outerLoop(i) +{ + if ( ok2Continue && (i >= 0) ) shutdown = app.setTimeOut("app.clearTimeOut(shutdown); innerLoop("+i+",1);", timeout); + else { + \sortCustomFinishJS + } +} +function innerLoop(i,j) +{ + if ( j <= i ) + { + if (randomDPS[j-1] > randomDPS[j]) + { + var temp = randomDPS[j-1]; + randomDPS[j-1] = randomDPS[j]; + randomDPS[j] = temp; + var oIcon = this.getIcon("pic."+randomDPS[j-1]); + var f = this.getField("button."+(j-1)); + f.buttonSetIcon(oIcon); + var oIcon = this.getIcon("pic."+randomDPS[j]); + var f = this.getField("button."+j); + f.buttonSetIcon(oIcon); + } + j++ + if ( ok2Continue ) shutdown = app.setTimeOut("app.clearTimeOut(shutdown); innerLoop("+i+","+j+");", timeout); + else { + \sortCustomFinishJS + } + } + else + { + i--; + outerLoop(i); + } +} +\end{insDLJS} + +\begin{execJS}{acrosortjs} +var index, ip="\importpath"; +var re=/_package$/; +var isPackage=\bIsPackage; +if (debug) console.println("isPackage: " + isPackage); +if (debug) console.println("nTotalTiles = " + \nTotalTiles) +if (isPackage) { + ip = ip+"_package"; + for ( var i = 1; i <= \nTotalTiles; i++) + { + try { aebTrustedFunctions(this, aebImportIcon, {cName: "pic."+i, + nPage: (i-1), cDIPath: ip+".\iconsExt"}, this); + } catch(e) {console.println("exception: " + e.toSource())} + + } +} else { + for ( var i = 1; i <= \nTotalTiles; i++) + { + index = ( i < 10 ) ? "0"+i : ""+i; + if (debug) console.println(ip+"_"+index+".\iconsExt") + try { aebTrustedFunctions(this, aebImportIcon, {cName: "pic."+i, cDIPath: ip+"_"+index+".\iconsExt"}, this); + } catch(e) {console.println("exception: " + e.toSource())} + } +} +// Now lay out the icon fields. +var f = this.getField("ulcorner"); +var nPage = f.page; +var ulCorner = f.rect; +this.removeField("ulcorner"); + +ip = ip.replace(re,""); +ip=ip+".pdf"; +var doc = aebTrustedFunctions( this, aebAppOpenDoc, { cPath: ip, oDoc: this, bHidden: true }); +var aRect = doc.getPageBox({cBox:"Crop"}) +doc.closeDoc(true); + +if (debug) console.println("aRect: " + aRect.toSource()); + +var nRows = \nRows; +var nCols = \nCols; + + +var width = aRect[2]-aRect[0]; +var height = aRect[1]-aRect[3]; + +var scaleFactor = \imageWidth/width; + +if (debug) console.println("scaleFactor = " + scaleFactor); + +var scaledWidth = width*scaleFactor; +var scaledHeight = height*scaleFactor; + +if (debug) console.println("scaledWidth = " + scaledWidth); +if (debug) console.println("scaledHeight = " + scaledHeight); + +var mWidth = scaledWidth/nCols +var mHeight = scaledHeight/nRows + +if (debug) console.println("mWidth = " + mWidth); +if (debug) console.println("mHeight = " + mHeight); + +var nCnt = 0; + +for ( var i=0; i +% \end{macrocode} +% \Finale +\endinput diff --git a/texmf-dist/source/latex/acrosort/acrosort.ins b/texmf-dist/source/latex/acrosort/acrosort.ins new file mode 100644 index 00000000..b4776eb6 --- /dev/null +++ b/texmf-dist/source/latex/acrosort/acrosort.ins @@ -0,0 +1,59 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2006 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 of this license or (at your option) any +%% later version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2006/11/06} +\def\batchfile{acrosort.ins} +% +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble +\generate +{% + \file{acrosort.sty}{\from{acrosort.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/texmf-dist/source/latex/acrosort/aeb_pro/aeb_pro.js b/texmf-dist/source/latex/acrosort/aeb_pro/aeb_pro.js new file mode 100644 index 00000000..02b1e658 --- /dev/null +++ b/texmf-dist/source/latex/acrosort/aeb_pro/aeb_pro.js @@ -0,0 +1,106 @@ +/* + AEB Pro Document Assembly Methods + + Copyright (C) 2009 AcroTeX.Net + D. P. Story + http://www.acrotex.net + + Version 1.1 +*/ + +if ( typeof aebTrustedFunctions == "undefined") { + aebTrustedFunctions = app.trustedFunction( function ( doc, oFunction, oArgs ) + { + app.beginPriv(); + var retn = oFunction( oArgs, doc ) + app.endPriv(); + return retn; + }); +} +aebAddWatermarkFromFile = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.addWatermarkFromFile(oArgs); + app.endPriv(); +}); +aebImportIcon = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importIcon(oArgs); + app.endPriv(); +}); +aebInsertPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + try { doc.insertPages(oArgs); } catch(e) {console.println("Error: " + e.toString());} + app.endPriv(); +}) +aebAppOpenDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + try { var retn = app.openDoc(oArgs); } catch(e) {console.println("Error: " + e.toString());} + app.endPriv(); + return retn; +}) +aebImportSound = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importSound(oArgs); + app.endPriv(); +}); +aebSaveAs = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + app.execMenuItem("Save"); + app.endPriv(); +}); +aebExtractPages = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.extractPages(oArgs); + app.endPriv(); +}); +aebMailDoc = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.mailDoc(oArgs); + app.endPriv(); +}); +aebImportDataObject = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + return retn = doc.importDataObject(oArgs); + app.endPriv(); +}); +aebSignatureSign = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return retn = field.signatureSign(oArgs); + app.endPriv(); +}); +aebSecurityHandlerLogin = app.trustPropagatorFunction( function ( oArgs, securityHandler ) +{ + app.beginPriv(); + return retn = securityHandler.login(oArgs); + app.endPriv(); +}); +aebSecurityGetHandler = app.trustPropagatorFunction( function ( oArgs, security ) +{ + app.beginPriv(); + return retn = security.getHandler(oArgs); + app.endPriv(); +}); +aebAppGetPath = app.trustPropagatorFunction( function ( oArgs, doc ) +{ + app.beginPriv(); + var retn = app.getPath(oArgs); + app.endPriv(); + return retn; +}) +aebSignatureSetSeedValue = app.trustPropagatorFunction( function ( oArgs, field ) +{ + app.beginPriv(); + return retn = field.signatureSetSeedValue(oArgs); + app.endPriv(); +}); + diff --git a/texmf-dist/source/latex/aebslicing/AeB Slicing.sequ b/texmf-dist/source/latex/aebslicing/AeB Slicing.sequ new file mode 100644 index 00000000..c115fe89 --- /dev/null +++ b/texmf-dist/source/latex/aebslicing/AeB Slicing.sequ @@ -0,0 +1,22 @@ +<>] + /HandlerName [/a /JavaScript] + /Params [/c << /ScriptCode [/t (/* AeB Slicing */\r\n\r\nvar sData = global.aebSliceDialogData;\r\nvar path2Save = /.*\\//i.exec\(this.path\)[0];\r\npath2Save = path2Save.substring\(0,path2Save.length-1\);\r\nvar thisPath = path2Save;\r\n\r\nvar baseName = this.documentFileName.replace\(/\\.pdf$/,""\);\r\n\r\nbaseName = \(sData.basename == "" \) ? baseName : sData.basename;\r\n\r\nvar isRelativePath = sData.relativepath;\r\nvar packageIt = sData.package\r\n\r\nif \(isRelativePath\) path2Save = thisPath + \( \(sData.path == "" \) ? "" : "/" + path2Save \);\r\nelse path2Save = \(sData.path == "" \) ? path2Save : sData.path;\r\n\r\nvar nRows = 1*sData.nRows\r\nvar nCols = 1*sData.nCols\r\n\r\nvar nPage = \(sData.page == "" \) ? 0 : 1*eval\(sData.page\);\r\n\r\nvar aRect = this.getPageBox\({cBox:"Crop",nPage:nPage}\);\r\n\r\nvar width = aRect[2]-aRect[0];\r\nvar height = aRect[1]-aRect[3];\r\n\r\nvar mWidth = width/nCols;\r\nvar mHeight = height/nRows;\r\nvar nCnt = 0;\r\n\r\nvar t = app.thermometer;\r\nt.duration = nRows*nCols;\r\nt.begin\(\);\r\n\r\nfor \( var i=0; i>] + /Title [/t (Execute JavaScript)] +>>] +>>] +/Input [/c << /FileVariation [/i 3] + /SourceFileOptions [/c <<>>] +>>] +/Output [/c << /AddToBaseName [/b false] + /DontOverwrite [/b false] + /FileVariation [/i 2] + /InsertAfterBaseName [/t ()] + /InsertBeforeBaseName [/t ()] + /OptimizePDF [/b true] + /PresetName [/t (Standard)] + /RunPDFOptimizer [/b false] +>>] +>> \ No newline at end of file diff --git a/texmf-dist/source/latex/aebslicing/aebslice.js b/texmf-dist/source/latex/aebslicing/aebslice.js new file mode 100644 index 00000000..6844b28b --- /dev/null +++ b/texmf-dist/source/latex/aebslicing/aebslice.js @@ -0,0 +1,345 @@ +/* + AeB Slicing Dialog Box for AeB Slice batch sequence + Copyright (C) 2006 AcroTeX.Net + D. P. Story + http://www.acrotex.net + + Version 1.0 + +*/ + +app.addMenuItem( { cName: "aebSlicemenuItem", cUser: "AeB Slicing Parameters", + cParent: "Tools", cExec: "aebGetSliceData();", nPos: 0 } ); + +function aebGetSliceData() +{ + var retn = aebTrustedFunctions(this, aebExecDialog, aebGetSliceDialog); + if ( retn == "cancel" ) delete global.aebGetSliceData; + else { + console.show(); + console.println("\nAeB Slice settings are set, now run the AeB Slice batch sequence"); + } +} + +if ( typeof aebTrustedFunctions == "undefined") { + aebTrustedFunctions = app.trustedFunction( function ( doc, oFunction, oArgs ) + { + app.beginPriv(); + var retn = oFunction( oArgs, doc ) + app.endPriv(); + return retn; + }); +} +if ( typeof aebExecDialog == "undefined" ) { + var aebExecDialog = app.trustedFunction( function (dialog,parentDoc) + { + app.beginPriv(); + dialog.doc = parentDoc; + try { return retn = app.execDialog(dialog); } catch(e){} + app.endPriv(); + }) +} +var aebGetSliceDialog = { + initialize: function (dialog) + { + if ( typeof global.aebSliceDialogData == "undefined" ) { + this.loadDefaults(dialog); + } else { + var sData = global.aebSliceDialogData; + dialog.load({ + sFmt: { + "PDF": (sData.format =="") ? +1 : -1, + "EPS": (sData.format =="com.adobe.acrobat.eps") ? +2 : -2, + "JPEG": (sData.format =="com.adobe.acrobat.jpeg") ? +3 : -3, + "JP2K": (sData.format =="com.adobe.acrobat.jp2k") ? +4 : -4, + "PNG": (sData.format =="com.adobe.acrobat.png") ? +5 : -5, + "PS": -(sData.format =="com.adobe.acrobat.ps") ? +6 : -6, + "TIFF": (sData.format =="com.adobe.acrobat.tiff") ? +7 : -7 + }, + nRow: sData.nRows, + nCol: sData.nCols, + path: sData.path, + bNam: sData.basename, + nPag: sData.page, + relp: sData.relativepath, + pack: sData.package + }); + dialog.enable({ + pack: ( sData.format == "") ? true : false, + }); + } + + }, + loadDefaults: function (dialog) { + dialog.load({ + sFmt: { + "PDF": +1, + "EPS": -2, + "JPEG": -3, + "JP2K": -4, + "PNG": -5, + "PS": -6, + "TIFF": -7 + }, + relp: true, + pack: false + }) + }, + commit:function (dialog) { // called when OK pressed + var results = dialog.store(); + // sFmt -- save format + // nRow -- number of rows + // nCol -- number of columns + // path -- save path + // bNam -- base name + // nPag -- page number + global.aebSliceDialogData = new Object(); + var sData = global.aebSliceDialogData; + var elements = results["sFmt"]; + for(var i in elements) if ( elements[i] > 0 ) break; + switch ( elements[i] ) { + case 1: sData.format = ""; + sData.ext = "pdf"; + break; + case 2: sData.format = "com.adobe.acrobat.eps"; + sData.ext = "eps"; + break; + case 3: sData.format = "com.adobe.acrobat.jpeg"; + sData.ext = "jpg"; + break; + case 4: sData.format = "com.adobe.acrobat.jp2k"; + sData.ext = "jp2k"; + break; + case 5: sData.format = "com.adobe.acrobat.png"; + sData.ext = "png"; + break; + case 6: sData.format = "com.adobe.acrobat.ps"; + sData.ext = "ps"; + break; + case 7: sData.format = "com.adobe.acrobat.tiff"; + sData.ext = "tif"; + } + var nRows = results["nRow"]; + nRows = this.ck4Int(nRows,"Rows",2); + sData.nRows = ""+nRows; + + var nCols = results["nCol"]; + nCols = this.ck4Int(nCols,"Columns",2); + sData.nCols = ""+nCols; + + sData.path = results["path"]; + sData.basename = results["bNam"]; + + var nPage = results["nPag"]; + nPage = this.ck4Int(nPage,"Page Number",this.doc.pageNum); + sData.page = ""+nPage; + + sData.relativepath = results["relp"]; + sData.package = results["pack"]; + }, + ck4Int: function (n,str,def) { + if (isFinite(n)) { + n = parseFloat(n); + n = (isNaN(n)) ? def : n; + n = parseInt(n); + } else { + console.println("The value of the \""+str + +"\" field specified was not an integer, changing it to a value of " + +def+" for now, please fix."); + n = def; + } + return n; + }, + sFmt: function (dialog) { + var results = dialog.store(); + var elements = results["sFmt"]; + for(var i in elements) if ( elements[i] > 0 ) break; + switch ( elements[i] ) { + case 1: + dialog.enable({ pack: true }); + break; + default: + dialog.enable({ pack: false }); + } + }, + rest: function (dialog) { + dialog.load({ + sFmt: { + "PDF": +1, + "EPS": -2, + "JPEG": -3, + "JP2K": -4, + "PNG": -5, + "PS": -6, + "TIFF": -7 + }, + nRow: "", + nCol: "", + path: "", + bNam: "", + nPag: "", + relp: true, + pack: false + }); + }, + description: + { + name: "AcroTeX.Net: AeB Slicing Batch Sequence Dialog Box", // dialog title + align_children: "align_left", + elements: + [ + { + type: "view", + align_children: "align_left", + elements: + [ + { + type: "cluster", + name: "aeb: Slicing Parameters", + item_id: "info", + align_children: "align_right", + elements: + [ + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Save Format:" + }, + { + item_id: "sFmt", + type: "popup", + alignment: "align_fill", + width: 200, + height: 20 + }, + { + type: "gap", + width: 65, + height: 20 + } + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Rows:", + height: 20 + }, + { + item_id: "nRow", + type: "edit_text", + alignment: "align_fill", + width: 300, + height: 20 + } + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Columns:", + height: 20 + }, + { + item_id: "nCol", + type: "edit_text", + alignment: "align_fill", + width: 300, + height: 20 + } + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Base name:", + height: 20 + }, + { + item_id: "bNam", + type: "edit_text", + alignment: "align_fill", + width: 300, + height: 20 + } + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Page Number:", + height: 20 + }, + { + item_id: "nPag", + type: "edit_text", + alignment: "align_fill", + width: 300, + height: 20 + } + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { + type: "static_text", + name: "Path:", + height: 20 + }, + { + item_id: "path", + type: "edit_text", + alignment: "align_fill", + width: 300, + height: 20 + } + ] + }, + { type: "view", align_children: "align_row", width:300, + elements: + [ {type: "check_box", item_id: "relp", name: "Relative path"}, + {type: "check_box", item_id: "pack", name: "Package files"} + ] + }, + ] + }, + { + type: "view", + align_children: "align_row", + elements: + [ + { alignment: "align_right",type: "ok_cancel" }, + { type: "gap", width: 100 }, + { type: "button", item_id: "rest", name: "Reset" } + ] + } + ] + } + ] + } +}; + + -- cgit v1.2.3