diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/media9/media9.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/media9/media9.sty | 201 |
1 files changed, 127 insertions, 74 deletions
diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty index 5b099609fd2..9f8e54cff82 100644 --- a/Master/texmf-dist/tex/latex/media9/media9.sty +++ b/Master/texmf-dist/tex/latex/media9/media9.sty @@ -42,8 +42,8 @@ \RequirePackage{atbegshi} \RequirePackage{tikz} -\def\g@mix@date@tl{2014/03/06} -\def\g@mix@version@tl{0.41} +\def\g@mix@date@tl{2014/03/21} +\def\g@mix@version@tl{0.42} \def\g@mix@liiikerneldate{2013/07/28} \def\g@mix@liiipkgdate{2013/07/28} @@ -121,8 +121,7 @@ \tl_gclear:N\g_mix_pkgopt_ls_tl \tl_gclear:N\g_mix_pkgopt_rm_tl \bool_new:N\g_mix_pkgiiidcalc_bool -\bool_new:N\g_mix_pkgpbtn_bool -\bool_gset_true:N\g_mix_pkgpbtn_bool +\tl_gset:Nn\g_mix_pkgpbtn_tl{fancy} %floating window settings \group_begin: @@ -169,10 +168,15 @@ final .default:n = {true}, noplaybutton .choice:, - noplaybutton / true .code:n = {\bool_gset_false:N\g_mix_pkgpbtn_bool}, - noplaybutton / false .code:n = {\bool_gset_true:N\g_mix_pkgpbtn_bool}, + noplaybutton / true .code:n = {\tl_gset:Nn\g_mix_pkgpbtn_tl{none}}, noplaybutton .default:n = {true}, + playbutton .choice:, + playbutton / fancy .code:n = {\tl_gset:Nn\g_mix_pkgpbtn_tl{fancy}}, + playbutton / plain .code:n = {\tl_gset:Nn\g_mix_pkgpbtn_tl{plain}}, + playbutton / none .code:n = {\tl_gset:Nn\g_mix_pkgpbtn_tl{none}}, + playbutton .default:n = {fancy}, + activate .choice:, activate / pagevisible .code:n = {\tl_gset:Nn\g_mix_pkgact_tl{/PV}}, activate / pageopen .code:n = {\tl_gset:Nn\g_mix_pkgact_tl{/PO}}, @@ -366,7 +370,7 @@ \box_clear:N\l_mix_poster_box \tl_clear:N\l_mix_scripts_tl \bool_gset_eq:NN\g_mix_usrdraft_bool\g_mix_pkgdraft_bool - \bool_gset_eq:NN\g_mix_usrpbtn_bool\g_mix_pkgpbtn_bool + \tl_gset_eq:NN\g_mix_usrpbtn_tl\g_mix_pkgpbtn_tl \seq_gclear:N\g_mix_res_seq \seq_gclear:N\g_mix_script_seq \int_gzero:N\g_mix_resizeflag_int @@ -507,16 +511,14 @@ } } \cs_new:Nn\mix_insert_btnocg:{%OCG for play button overlay - \tl_if_exist:NF\g_mix_btnocg_tl{ - \mix_pdfobj:nnn{}{dict}{ - /Type/OCG/Name~(MediaPlayButton) - /Usage<</Print<</PrintState/OFF>>/Export<</ExportState/OFF>>>> - } - \tl_gput_right:Nx\@anim@ocgs{\space\g_mix_pdflastobj_tl} - \tl_gput_right:Nx\@anim@offocgs{\space\g_mix_pdflastobj_tl} - \tl_gset:Nx\g_mix_btnocg_tl{\g_mix_pdflastobj_tl} + \mix_pdfobj:nnn{}{dict}{ + /Type/OCG/Name~(MediaPlayButton\int_use:N\g_mix_rmcnt_int) + /Usage<</Print<</PrintState/OFF>>/Export<</ExportState/OFF>>>> } - \mix_pdfresources:n{/Properties<</OC@rm@play\space\g_mix_btnocg_tl>>} + \tl_gput_right:Nx\@anim@ocgs{\space\g_mix_pdflastobj_tl} + \tl_gput_right:Nx\@anim@offocgs{\space\g_mix_pdflastobj_tl} + \tl_gset:Nx\g_mix_btnocg_tl{\g_mix_pdflastobj_tl} + \mix_pdfresources: } %commands for creating PDF objects, annots etc. @@ -583,13 +585,21 @@ } \cs_new:Nn\mix_pdfcatalog:n{\pdfcatalog{#1}} - \cs_new:Nn\mix_pdfresources:n{ + + \tl_new:N\g_mix_ocgnames_tl + \cs_new:Nn\mix_pdfresources:{ + \tl_gput_right:Nx\g_mix_ocgnames_tl{ + ~/OC@rm@play@\int_use:N\g_mix_rmcnt_int\space\g_mix_btnocg_tl} \group_begin: \tl_set:Nx\l_mix_temp_tl{\group_end: - \global\pdfpageresources{\the\pdfpageresources #1} + \global\pdfpageresources{\the\pdfpageresources + /Properties<<\g_mix_ocgnames_tl>> + } }\l_mix_temp_tl } - \cs_new:Nn\mix_pdfbdc:{\pdfliteral{/OC/OC@rm@play~BDC}} + \cs_new:Nn\mix_pdfbdc:{ + \pdfliteral{/OC/OC@rm@play@\int_use:N\g_mix_rmcnt_int\space BDC} + } \cs_new:Nn\mix_pdfemc:{\pdfliteral{EMC}} }{ \int_new:N\g_mix_obj_int % object ID @@ -673,8 +683,13 @@ } \cs_new:Nn\mix_pdfcatalog:n{\special{pdf:put~@catalog~<<#1>>}} - \cs_new:Nn\mix_pdfresources:n{\special{pdf:put~@resources~<<#1>>}} - \cs_new:Nn\mix_pdfbdc:{\special{pdf:~content~/OC/OC@rm@play~BDC}} + \cs_new:Nn\mix_pdfresources:{\special{pdf:put~@resources~<< + /Properties<</OC@rm@play@\int_use:N\g_mix_rmcnt_int\space + \g_mix_btnocg_tl>> + >>}} + \cs_new:Nn\mix_pdfbdc:{ + \special{pdf:~content~/OC/OC@rm@play@\int_use:N\g_mix_rmcnt_int\space BDC} + } \cs_new:Nn\mix_pdfemc:{\special{pdf:~content~EMC}} }{ % dvips @@ -950,7 +965,7 @@ \special{ps:~mark~{Catalog}~<<#1>>~/PUT~pdfmark} } - \cs_new:Nn\mix_pdfresources:n{} %no-op + \cs_new:Nn\mix_pdfresources:{} %no-op, Distiller does it automatically \cs_new:Nn\mix_pdfbdc:{\special{ps:~mark~/OC~\g_mix_btnocg_tl~/BDC~pdfmark}} \cs_new:Nn\mix_pdfemc:{\special{ps:~mark~/EMC~pdfmark}} } @@ -1036,14 +1051,10 @@ } %add FileSpec to assets tree of current annot \cs_if_exist:cF{fileAsset_\int_use:c{g_mix_rmcnt_int}_#1}{ - \tl_gput_right:Nx\g_mix_assets_tl{ - ~(#1)~\tl_use:c{ImgFileSpecFor3D_#1} - } + \tl_gput_right:Nx\g_mix_assets_tl{~(#1)~\tl_use:c{ImgFileSpecFor3D_#1}} \tl_new:c{fileAsset_\int_use:c{g_mix_rmcnt_int}_#1} } - \tl_gset:Nx\g_mix_lastasset_tl{ - \tl_use:c{ImgFileSpecFor3D_#1} - } + \tl_gset:Nx\g_mix_lastasset_tl{\tl_use:c{ImgFileSpecFor3D_#1}} }{ %remaining file types in 3D context and any file type in case of Flash %context will be embedded as ordinary fstreams; @@ -1056,23 +1067,17 @@ %create FileSpec for current file name if not yet existent \cs_if_exist:cF{fileSpec_#1}{ \mix_pdfobj:nnn{}{dict}{ - /Type/Filespec - /F~(#1) - /UF~(#1) + /Type/Filespec/F~(#1)/UF~(#1) /EF~<</F~\tl_use:c{fileEmb_\mix_filemdfivesum:n{\l_mix_file_tl}}>> } \tl_gset:cx{fileSpec_#1}{\g_mix_pdflastobj_tl} } %add FileSpec to assets tree of current annot \cs_if_exist:cF{fileAsset_\int_use:c{g_mix_rmcnt_int}_#1}{ - \tl_gput_right:Nx\g_mix_assets_tl{ - ~(#1)~\tl_use:c{fileSpec_#1} - } + \tl_gput_right:Nx\g_mix_assets_tl{~(#1)~\tl_use:c{fileSpec_#1}} \tl_new:c{fileAsset_\int_use:c{g_mix_rmcnt_int}_#1} } - \tl_gset:Nx\g_mix_lastasset_tl{ - \tl_use:c{fileSpec_#1} - } + \tl_gset:Nx\g_mix_lastasset_tl{\tl_use:c{fileSpec_#1}} } } } @@ -1206,19 +1211,42 @@ \NewDocumentCommand\addmediapath{m}{\file_path_include:n{#1/}} -%play button overlay +%play button overlay; two versions: fancy and plain \box_new:N\l_mix_pbtn_box \ExplSyntaxOff -\def\g@mix@pbtn@tl{% - \tikz[opacity=.7,transparency group]{% - \useasboundingbox (-5,-5) rectangle (5,5); - \fill [color=gray,even odd rule] (0,0) circle (2.5) - (-0.95,1.4)--(-0.95,-1.4)--+(30:2.8)--cycle; - \fill [color=white] (-0.95,1.4)--(-0.95,-1.4)--+(30:2.8)--cycle; +\def\g@mix@pbtn@fancy@tl#1#2{% width, total height + \ifdim#2<\dimexpr\baselineskip*3\relax% + \edef\mix@tikzunit{#2}% + \else% + \edef\mix@tikzunit{\the\dimexpr\baselineskip*3\relax}% + \fi% + \tikz[x=\mix@tikzunit,y=\mix@tikzunit,transparency group]{% + \shade [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.6\else0\fi, + shading angle=-180,even odd rule] + (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5) + (0,0) circle (0.4); + \shade [ball color=gray,opacity=0.6] (0,0) circle (0.4); + \fill [color=white,opacity=0.6] + (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle; + }% +} +\def\g@mix@pbtn@plain@tl#1#2{% width, total height + \ifdim#2<\dimexpr\baselineskip*3\relax% + \edef\mix@tikzunit{#2}% + \else% + \edef\mix@tikzunit{\the\dimexpr\baselineskip*3\relax}% + \fi% + \tikz[x=\mix@tikzunit,y=\mix@tikzunit,transparency group]{% + \fill [opacity=\ifdim#2>\dimexpr\baselineskip*6\relax0.5\else0\fi, + color=gray,even odd rule] + (-\dimexpr#1/2\relax,-0.5) rectangle (\dimexpr#1/2\relax,0.5); + (0,0) circle (0.4); + \fill [color=black,opacity=0.5] (0,0) circle (0.4); + \fill [color=white,opacity=0.8] + (-0.152,0.224)--(-0.152,-0.224)--+(30:0.4844)--cycle; }% } \ExplSyntaxOn -\tl_set_eq:NN\g_mix_pbtn_tl\g@mix@pbtn@tl \ior_new:N\l_mix_vfile_stream %file stream for 3D views files \NewDocumentCommand\includemedia{O{}mm}{%#1 options, #2 text/image #3 media file @@ -1246,7 +1274,8 @@ \dim_compare_p:n{\l_mix_tt_tl=\c_zero_dim}|| \dim_compare_p:n{\l_mix_wd_tl=\c_zero_dim} }{ - \bool_gset_false:N\g_mix_usrpbtn_bool + %\bool_gset_false:N\g_mix_usrpbtn_bool + \tl_gset:Nn\g_mix_usrpbtn_tl{none} } \bool_if:NTF\g_mix_usrdraft_bool{ \tl_if_empty:NF\g_mix_usrlabel_tl{ @@ -1260,6 +1289,24 @@ } } }{ + \bool_if:nF{\str_if_eq_p:Vn\g_mix_usrpbtn_tl{none}}{ + %attach script that switches off play button overlay upon activation + \mix_pdfobj:nnn{}{stream}{ + var~ocgs=host.getOCGs(host.pageNum); + for(var~i=0;i<ocgs.length;i++){ + if(ocgs[i].name=='MediaPlayButton\int_use:N\g_mix_rmcnt_int'){ + ocgs[i].state=false; + } + } + } + \mix_pdfobj:nnn{}{dict}{ + /Type/Filespec/F~(btnoff)/UF~(btnoff)/EF~<</F~\g_mix_pdflastobj_tl>> + } + \tl_gset:Nx\g_mix_assets_tl{(btnoff)~\g_mix_pdflastobj_tl} + \tl_set:Nx\l_mix_scripts_tl{\g_mix_pdflastobj_tl} + %enforce plain playbutton overlay for XeTeX + \xetex_if_engine:T{\tl_gset:Nn\g_mix_usrpbtn_tl{plain}} + } %embed main asset \mix_uribegin: \mix_embedasset:n{#3} @@ -1288,7 +1335,7 @@ %attach 3D calculation script \bool_if:nT{\g_mix_iiid_bool && \g_mix_iiidcalc_bool}{ \mix_embedasset:n{3Dmenu.js} - \tl_put_left:Nx\l_mix_scripts_tl{~\g_mix_lastasset_tl} + \tl_put_left:Nx\l_mix_scripts_tl{\g_mix_lastasset_tl~} } %create 3D views from file (option 3Dviews) \bool_if:nT{\g_mix_iiid_bool && !(\tl_if_blank_p:V\g_mix_vfile_tl)}{ @@ -1454,21 +1501,28 @@ \mix_pdfobj:nnn{}{dict}{ /S/JavaScript/JS~( try{ - var~ocgAll=this.getOCGs(this.pageNum); - for(var~i=0;i<ocgAll.length;i++){ + if(typeof(annotRM)=='undefined'){annotRM=new~Array();} + if(typeof(annotRM['\g_mix_label_tl'])=='undefined'){ + annotRM['\g_mix_label_tl']= + this.getAnnotRichMedia(this.pageNum,'\g_mix_label_tl'); + } + \str_if_eq_x:nnF{\g_mix_usrpbtn_tl}{none}{ + if(typeof(ocgBtn\int_use:N\g_mix_rmcnt_int)=='undefined'){ + var~ocgs=this.getOCGs(this.pageNum); + for(var~i=0;i<ocgs.length;i++){ + if(ocgs[i].name=='MediaPlayButton\int_use:N\g_mix_rmcnt_int'){ + var~ocgBtn\int_use:N\g_mix_rmcnt_int=ocgs[i]; + } + } + } if( - ocgAll[i].name=='MediaPlayButton'&&( + !annotRM['\g_mix_label_tl'].activated&&( app.viewerType=='Reader'|| app.viewerType=='Exchange'|| app.viewerType=='Exchange-Pro' )&&app.viewerVersion>=9 - )ocgAll[i].state=true; - } - \tl_if_empty:NF\g_mix_usrlabel_tl{ - if(typeof(annotRM)=='undefined'){annotRM=new~Array();} - if(typeof(annotRM['\g_mix_label_tl'])=='undefined'){ - annotRM['\g_mix_label_tl']= - this.getAnnotRichMedia(this.pageNum,'\g_mix_label_tl'); + ){ + ocgBtn\int_use:N\g_mix_rmcnt_int.state=true; } } }catch(e){} @@ -1489,33 +1543,25 @@ \box_use:N\l_mix_poster_box } } - \bool_if:NTF\g_mix_usrpbtn_bool{ - %scale and insert play button overlay + \str_if_eq_x:nnTF{\g_mix_usrpbtn_tl}{none}{ + \hbox_to_wd:nn{\l_mix_wd_tl}{ + \vrule~width~\c_zero_dim~height~\l_mix_ht_tl~depth~\l_mix_dp_tl\hss + } + }{%insert play button overlay \mix_insert_btnocg: %create OCG \mix_insert_ocprops: - \hbox_set:Nn\l_mix_pbtn_box{\g_mix_pbtn_tl} - \dim_compare:nTF{\l_mix_tt_tl>\l_mix_wd_tl}{ - \box_resize_to_wd:Nn\l_mix_pbtn_box{\l_mix_wd_tl} - }{ - \box_resize_to_ht_plus_dp:Nn\l_mix_pbtn_box{\l_mix_tt_tl} - } + \cs_gset_eq:Nc\mix_pbtn:NN{g@mix@pbtn@\g_mix_usrpbtn_tl @tl} + \hbox_set:Nn\l_mix_pbtn_box{\mix_pbtn:NN\l_mix_wd_tl\l_mix_tt_tl} \box_move_down:nn{\l_mix_dp_tl}{ \hbox_to_wd:nn{\l_mix_wd_tl}{ - \hss \vbox_to_ht:nn{\l_mix_tt_tl}{ \vss \mix_pdfbdc: \box_use:N\l_mix_pbtn_box \mix_pdfemc: - \vss } - \hss } } - }{ - \hbox_to_wd:nn{\l_mix_wd_tl}{ - \vrule~width~\c_zero_dim~height~\l_mix_ht_tl~depth~\l_mix_dp_tl\hss - } } \int_gincr:N\g_mix_rmcnt_int } @@ -1781,10 +1827,15 @@ final .default:n = {true}, noplaybutton .choice:, - noplaybutton / true .code:n = {\bool_gset_false:N\g_mix_usrpbtn_bool}, - noplaybutton / false .code:n = {\bool_gset_true:N\g_mix_usrpbtn_bool}, + noplaybutton / true .code:n = {\tl_gset:Nn\g_mix_usrpbtn_tl{none}}, noplaybutton .default:n = {true}, + playbutton .choice:, + playbutton / fancy .code:n = {\tl_gset:Nn\g_mix_usrpbtn_tl{fancy}}, + playbutton / plain .code:n = {\tl_gset:Nn\g_mix_usrpbtn_tl{plain}}, + playbutton / none .code:n = {\tl_gset:Nn\g_mix_usrpbtn_tl{none}}, + playbutton .default:n = {fancy}, + transparent .choice_code:n = {\tl_gset:Nx\g_mix_transp_tl{\l_keys_choice_tl}}, transparent .generate_choices:n = {true,false}, transparent .default:n = {true}, @@ -2371,6 +2422,7 @@ \cs_generate_variant:Nn\regex_match:nnTF{nV} \cs_generate_variant:Nn\regex_match:nnT{nV} \cs_generate_variant:Nn\tl_if_blank:nF{c} +\cs_generate_variant:Nn\tl_if_eq:NNTF{Vn} \bool_new:N\g_mix_btndraft_bool \keys_define:nn{media9/mbtndraft}{ @@ -2620,3 +2672,4 @@ } \group_end: } +\bool_if:NF\g_mix_pdfoutput_bool{\mix_insert_ocprops:\mix_insert_acroform:} |