From c97f81e751680c5d701f238849741eb545777965 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 15 Jun 2015 23:26:34 +0000 Subject: media9 (3jun15) git-svn-id: svn://tug.org/texlive/trunk@37551 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/media9/ChangeLog | 4 + Master/texmf-dist/doc/latex/media9/media9.pdf | Bin 3694577 -> 3643906 bytes .../source/latex/media9/files/config.xml | 96 ++++++++++++--------- .../latex/media9/files/ctan_lion_350x350.png | Bin 81950 -> 0 bytes Master/texmf-dist/source/latex/media9/media9.tex | 15 ++-- .../source/latex/media9/players/APlayer.mxml | 5 +- .../source/latex/media9/players/APlayer9.mxml | 4 +- .../source/latex/media9/players/SlideShow.mxml | 94 ++++++++++++++++---- .../source/latex/media9/players/VPlayer.mxml | 5 +- .../source/latex/media9/players/VPlayer9.mxml | 4 +- Master/texmf-dist/tex/latex/media9/media9.sty | 4 +- .../tex/latex/media9/players/APlayer.swf | Bin 353080 -> 353059 bytes .../tex/latex/media9/players/APlayer9.swf | Bin 206160 -> 206151 bytes .../tex/latex/media9/players/SlideShow.swf | Bin 303674 -> 324812 bytes .../tex/latex/media9/players/VPlayer.swf | Bin 526187 -> 526184 bytes .../tex/latex/media9/players/VPlayer9.swf | Bin 219388 -> 219365 bytes 16 files changed, 155 insertions(+), 76 deletions(-) delete mode 100644 Master/texmf-dist/source/latex/media9/files/ctan_lion_350x350.png diff --git a/Master/texmf-dist/doc/latex/media9/ChangeLog b/Master/texmf-dist/doc/latex/media9/ChangeLog index 7151a707fba..14e79d29a0e 100644 --- a/Master/texmf-dist/doc/latex/media9/ChangeLog +++ b/Master/texmf-dist/doc/latex/media9/ChangeLog @@ -1,3 +1,7 @@ +2015-06-03 + * v0.53 + * New: `SlideShow.swf' with support added for dynamic resolution images + 2015-05-11 * v0.52 * New: `SlideShow.swf' (image gallery viewer for embedded and remote diff --git a/Master/texmf-dist/doc/latex/media9/media9.pdf b/Master/texmf-dist/doc/latex/media9/media9.pdf index 60fd5f7947e..ce15737eb0c 100644 Binary files a/Master/texmf-dist/doc/latex/media9/media9.pdf and b/Master/texmf-dist/doc/latex/media9/media9.pdf differ diff --git a/Master/texmf-dist/source/latex/media9/files/config.xml b/Master/texmf-dist/source/latex/media9/files/config.xml index 2c7907c61f7..043a39b1c47 100644 --- a/Master/texmf-dist/source/latex/media9/files/config.xml +++ b/Master/texmf-dist/source/latex/media9/files/config.xml @@ -1,57 +1,73 @@ - - - Live remote image. + + Mow-the-lawn simulation (live remote image). http://dev.eightbeers.org/tex/corner-icon.png - - Aurora australis forecast (live remote image). - http://services.swpc.noaa.gov/images/aurora-forecast-southern-hemisphere.png - - - Aurora borealis forecast (live remote image). - http://services.swpc.noaa.gov/images/aurora-forecast-northern-hemisphere.png + + "An algorithm must be seen to be believed." (Donald E. Knuth) +Remote image URL with dynamic size that is reloaded while resizing the display. + https://openclipart.org/image/@@@@@px/svg_to_png/137407/1304882618.png - - - CTAN lion drawing by Duane Bibby. Thanks to www.ctan.org. - files/ctan_lion_350x350.png + + CTAN lion drawing by Duane Bibby. Thanks to www.ctan.org. +Remote image with URLs at various resolutions ("responsive image"). + http://mirrors.ctan.org/macros/latex/contrib/media9/doc/files/ctan_lion_200.png + http://mirrors.ctan.org/macros/latex/contrib/media9/doc/files/ctan_lion_400.png + http://mirrors.ctan.org/macros/latex/contrib/media9/doc/files/ctan_lion_800.png + http://mirrors.ctan.org/macros/latex/contrib/media9/doc/files/ctan_lion_1200.png - - - Lion from the LaTeX project site, rotated by 3x90°. -Press `r' or `R' to change orientation. - http://latex-project.org/lib/img/lion.png + + Static embedded image file with initial rotation of 3x90°. +Press "r" or "R" to change orientation. + files/cubeposter.png diff --git a/Master/texmf-dist/source/latex/media9/files/ctan_lion_350x350.png b/Master/texmf-dist/source/latex/media9/files/ctan_lion_350x350.png deleted file mode 100644 index c24d9a98f25..00000000000 Binary files a/Master/texmf-dist/source/latex/media9/files/ctan_lion_350x350.png and /dev/null differ diff --git a/Master/texmf-dist/source/latex/media9/media9.tex b/Master/texmf-dist/source/latex/media9/media9.tex index 83ea652d847..997bf1e3347 100644 --- a/Master/texmf-dist/source/latex/media9/media9.tex +++ b/Master/texmf-dist/source/latex/media9/media9.tex @@ -681,10 +681,10 @@ function & argument &description\\\hline\hline {\tt pause} & & pause slide-show\\ {\tt playPause} & & toggle between play and pause\\ {\tt setXML} & string & load another configuration file (path to file, embedded using option `{\tt addresource}', or URL)\\ -{\tt seek} & int number & go to slide `number', zero-based\\ -{\tt slideNum} & & returns current slide number, zero-based; only useful in JavaScript via `{\tt callAS}' method\\ +{\tt seek} & int number & go to slide `number' (zero-based)\\ +{\tt slideNum} & & returns current slide number (zero-based); only useful in JavaScript via `{\tt callAS}' method\\ {\tt numSlides} & & returns total number of slides in the slide-show; only useful in JavaScript via `{\tt callAS}' method\\ -{\tt playing} & & returns boolean value `{\tt true}', if the media is currently playing, `{\tt true}' otherwise; only useful in JavaScript via `{\tt callAS}' method\\ +{\tt playing} & & returns boolean value `{\tt true}', if the slide-show is currently playing, `{\tt true}' otherwise; only useful in JavaScript via `{\tt callAS}' method\\ {\tt rotate} & int number (optional) & rotate current slide by number$\times\SI{90}{\degree}$\\\hline \end{tabular} \end{table} @@ -774,7 +774,8 @@ parameter & description\\\hline\hline \begin{figure}%[bp] \centering %\lstinputlisting[basicstyle=\scriptsize\ttfamily,language=XML]{config.xml} -\inputminted[fontsize=\footnotesize]{xml}{test/config.xml} +\vspace{-10\baselineskip} +\inputminted[fontsize=\footnotesize]{xml}{files/config.xml} \caption{Configuration file template (XML format) for `SlideShow.swf'}\label{SlideShowXML} \end{figure} @@ -789,7 +790,7 @@ parameter & description\\\hline\hline width=\linewidth,height=\linewidth, activate=pageopen, addresource=config.xml, %embedded configuration - addresource=files/ctan_lion_350x350.png, %embedded image file + addresource=files/cubeposter.png, %embedded image file flashvars={xml=config.xml}, passcontext %show the player's context menu ]{}{SlideShow.swf} @@ -801,12 +802,12 @@ parameter & description\\\hline\hline width=\linewidth,height=\linewidth, activate=pageopen, addresource=config.xml, %embedded configuration - addresource=files/ctan_lion_350x350.png, %embedded image file + addresource=files/cubeposter.png, %embedded image file flashvars={xml=config.xml}, passcontext %show the player's context menu ]{}{SlideShow.swf} \hfill} -\caption{Slide-show example with one embedded and several remote image files, some of which are live images. The listing in Fig.~\ref{SlideShowXML} is used as content of file \myAcrobatmenu{ShowHideFileAttachment}{`config.xml'}. Manually cycle forwards through the images by mouse-click or backwards by \usebox{\COO}+mouse-click. Play/pause auto-cycling through the slide-show by hitting \usebox{\CtoC}. Also, the context (right-click) menu of the player can be used.}\label{slideshowex} +\caption{Slide-show example with one embedded and several remote image files, one of which is a live image. Images 2 and 3 are examples of remote images with variable resolution; the best fitting image resolution is requested from the server depending on the current display size. The listing in Fig.~\ref{SlideShowXML} is used as content of file \myAcrobatmenu{ShowHideFileAttachment}{`config.xml'}. Manually cycle forwards through the images by mouse-click or backwards by \usebox{\COO}+mouse-click. Play/pause auto-cycling through the slide-show by hitting \usebox{\CtoC}. Also, the context (right-click) menu of the player can be used.}\label{slideshowex} \end{figure} \begin{figure}[bp] diff --git a/Master/texmf-dist/source/latex/media9/players/APlayer.mxml b/Master/texmf-dist/source/latex/media9/players/APlayer.mxml index 9be181f2f5d..263123a369d 100644 --- a/Master/texmf-dist/source/latex/media9/players/APlayer.mxml +++ b/Master/texmf-dist/source/latex/media9/players/APlayer.mxml @@ -4,7 +4,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -24,7 +24,7 @@ - + @@ -38,8 +38,9 @@ @@ -73,15 +74,15 @@ { slideshowXML = new XML(loader.data); setXMLDone=true; + rotations=new Object(); seek(0); if(autoPlay) play(); } } - import mx.core.FlexGlobals; [Bindable] private var delay:Number=5; [Bindable] private var autoPlay:Boolean=false; - private var xmlfile:String; + private var xmlfile:String=null; private function initialise(flashVars:Object):void { xmlfile=flashVars.xml; @@ -95,6 +96,7 @@ private var curFile:String; private var idx:Number=0; + private var urlIdx:Number=0; [Bindable] private var src1:String; [Bindable] private var src2:String; @@ -104,15 +106,22 @@ if(Img1.visible){ n==0 ? Img1.rotation=0 : Img1.rotation+=90*Math.floor(n); Img1.rotation%=360; - rotations[slideshowXML.Img[idx].URL.toString()]=Img1.rotation/90; + rotations[slideshowXML.Img[idx].URL[urlIdx].toString()]= + Img1.rotation/90; } else { n==0 ? Img2.rotation=0 : Img2.rotation+=90*Math.floor(n); Img2.rotation%=360; - rotations[slideshowXML.Img[idx].URL.toString()]=Img2.rotation/90; + rotations[slideshowXML.Img[idx].URL[urlIdx].toString()]= + Img2.rotation/90; } } + import mx.collections.ArrayCollection; + import spark.collections.Sort; + import spark.collections.SortField; + private var forcedByUsr:Boolean; + private var dynResolution:Boolean; private function setImgSrc():void { if(reloadTimer && reloadTimer.hasEventListener(TimerEvent.TIMER)){ @@ -126,7 +135,57 @@ CursorManager.setBusyCursor(); timeoutTimer.start(); isIOError=true; - curFile=slideshowXML.Img[idx].URL.toString(); + + urlIdx=0; + if(slideshowXML.Img[idx].URL.length()>1){ + var sizes:ArrayCollection = new ArrayCollection(); + for(var i:Number=0; i0){ + dynResolution=true; + var sort:Sort = new Sort(); + sort.fields=[new SortField("size",true,true)]; + sizes.sort=sort;// ^--descending order + sizes.refresh(); + + urlIdx=sizes.getItemAt(0).index; + for(i=0; i= this.width || + sizes.getItemAt(i).y >= this.height + ) urlIdx=sizes.getItemAt(i).index; + } + } + } + + curFile=slideshowXML.Img[idx].URL[urlIdx].toString(); + + var pattern:RegExp; + if(slideshowXML.Img[idx].URL[urlIdx].attribute('height').length() > 0){ + pattern = new RegExp( + slideshowXML.Img[idx].URL[urlIdx].attribute('height'), "g"); + if(curFile.search(pattern)>-1){ + dynResolution=true; + curFile=curFile.replace(pattern, this.toString()); + } + } + + if(slideshowXML.Img[idx].URL[urlIdx].attribute('width').length() > 0){ + pattern = new RegExp( + slideshowXML.Img[idx].URL[urlIdx].attribute('width'), "g"); + if(curFile.search(pattern)>-1){ + dynResolution=true; + curFile=curFile.replace(pattern, this.width.toString()); + } + } + if(Img1.visible) { src2=null; src2=curFile; } else { @@ -305,10 +364,10 @@ } }); - rotations=new Object(); timeoutTimer=new Timer(30000, 1); timeoutTimer.addEventListener(TimerEvent.TIMER, onAnyError); - curFile=xmlfile; setXML(xmlfile); + curFile=xmlfile; if(xmlfile) setXML(xmlfile); + CursorManager.hideCursor(); } private var isIOError:Boolean; @@ -322,7 +381,7 @@ src1=null; src1="/dev/null" } caption.text=e.type+': '+curFile; - if(caption.text==TimerEvent.TIMER) + if(e.type==TimerEvent.TIMER) caption.text="timeout after 30 s: "+curFile; CursorManager.removeBusyCursor(); }else{ @@ -350,8 +409,8 @@ slideNo.visible=slideNo.includeInLayout=false; } var curRot:Number=0; - if (rotations.hasOwnProperty(slideshowXML.Img[idx].URL.toString())) - curRot=rotations[slideshowXML.Img[idx].URL.toString()]; + if (rotations.hasOwnProperty(slideshowXML.Img[idx].URL[urlIdx].toString())) + curRot=rotations[slideshowXML.Img[idx].URL[urlIdx].toString()]; else curRot=Number(slideshowXML.Img[idx].attribute('rot90')); rotate(0); @@ -363,10 +422,10 @@ } else { caption.text=""; caption.visible=false; - } - if(!isReload) anim.play(); + } + if(!isReload) anim.play(); if(slideshowXML.Img[idx].attribute('live')>0) - cache.removeCacheEntry(slideshowXML.Img[idx].URL.toString()); + cache.removeCacheEntry(curFile); } CursorManager.removeBusyCursor(); isEnabled=true; @@ -420,7 +479,8 @@ diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml index d3ef5e17fad..ff3dc7962b0 100644 --- a/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer.mxml @@ -4,7 +4,7 @@ - + @@ -39,7 +39,7 @@ @@ -60,7 +60,6 @@ private var pauseAtPos:Number = -1; private var toBePaused:Boolean = false; - import mx.core.FlexGlobals; private function initialise(flashVars:Object):void { source=flashVars.source; if(flashVars.autoPlay=='true'){autoPlay=true} diff --git a/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml index 7d748112a95..5ecbaaf4d53 100644 --- a/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml +++ b/Master/texmf-dist/source/latex/media9/players/VPlayer9.mxml @@ -4,7 +4,7 @@ - + @@ -24,7 +24,7 @@