texlive[43530] Master/texmf-dist: ocgx2 (17may17)

commits+karl at tug.org commits+karl at tug.org
Fri Mar 17 22:36:21 CET 2017


Revision: 43530
          http://tug.org/svn/texlive?view=revision&revision=43530
Author:   karl
Date:     2017-03-17 22:36:21 +0100 (Fri, 17 Mar 2017)
Log Message:
-----------
ocgx2 (17may17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
    trunk/Master/texmf-dist/doc/latex/ocgx2/README
    trunk/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
    trunk/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty

Modified: trunk/Master/texmf-dist/doc/latex/ocgx2/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ocgx2/ChangeLog	2017-03-17 21:36:06 UTC (rev 43529)
+++ trunk/Master/texmf-dist/doc/latex/ocgx2/ChangeLog	2017-03-17 21:36:21 UTC (rev 43530)
@@ -1,3 +1,8 @@
+2017-03-16
+	* v0.20 : ocgx2.sty
+	* v0.8  : ocgbase.sty
+	* fix: compatibility with other pkgs (pdfbase, xsavebox, media9, animate)
+
 2017-03-09
 	* v0.19 : ocgx2.sty
 	* v0.7  : ocgbase.sty

Modified: trunk/Master/texmf-dist/doc/latex/ocgx2/README
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty	2017-03-17 21:36:06 UTC (rev 43529)
+++ trunk/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty	2017-03-17 21:36:21 UTC (rev 43530)
@@ -97,7 +97,10 @@
 \RequirePackage{atenddvi}
 \RequirePackage{pdfbase}
 
-\ProvidesExplPackage{ocgbase}{2017/03/09}{0.7}
+\def\g at ocgbase@date at tl{2017/03/16}
+\def\g at ocgbase@version at tl{0.8}
+
+\ProvidesExplPackage{ocgbase}{\g at ocgbase@date at tl}{\g at ocgbase@version at tl}
 {support package for ocgx2.sty}
 
 \tl_new:N\g_ocgbase_ocgs_tl %takes ocg object refs
@@ -283,6 +286,25 @@
 \cs_new_nopar:Nn\ocgbase_oc_bdc:n{\pbs_pdfbdc:nn{/OC}{#1}}
 \cs_new_nopar:Nn\ocgbase_oc_emc:{\pbs_pdfemc:}
 
+%stack of PDF obj references of currently open OCGs
+\seq_new:N\g_ocgbase_ocgstack_seq
+%push OCG to stack
+\cs_new_nopar:Nn\ocgbase_ocgstack_push:n{
+  \seq_gpush:Nx\g_ocgbase_ocgstack_seq{#1}}
+%pop OCG from stack into tl
+\cs_new_nopar:Nn\ocgbase_ocgstack_pop:N{\seq_gpop:NN\g_ocgbase_ocgstack_seq#1}
+%get top OCG on stack, without removing it
+\cs_new_nopar:Nn\ocgbase_ocgstack_top:{
+  \seq_item:Nn\g_ocgbase_ocgstack_seq{c_one}}
+
+%command that inserts /OC <<OCMD with currently open OCGs>> entry;
+%for use within annotation/xobject dicts
+\cs_new_nopar:Nn\ocgbase_insert_oc:{
+  \seq_if_empty:NF\g_ocgbase_ocgstack_seq{
+    /OC~<</Type/OCMD/OCGs~[\seq_use:Nn\g_ocgbase_ocgstack_seq{~}]/P/AllOn>>
+  }
+}
+
 %l2e versions
 \cs_gset_eq:NN\ocgbase at new@ocg\ocgbase_new_ocg:nnn
 \cs_gset_eq:NN\ocgbase at last@ocg\ocgbase_last_ocg:
@@ -292,3 +314,7 @@
 \cs_gset_eq:NN\ocgbase at add@ocg at to@radiobtn at grp\ocgbase_add_ocg_to_radiobtn_grp:nnn
 \cs_gset_eq:NN\ocgbase at oc@bdc\ocgbase_oc_bdc:n
 \cs_gset_eq:NN\ocgbase at oc@emc\ocgbase_oc_emc:
+\cs_gset_eq:NN\ocgbase at insert@oc\ocgbase_insert_oc:
+\cs_gset_eq:NN\ocgbase at ocgstack@top\ocgbase_ocgstack_top:
+\cs_gset_eq:NN\ocgbase at ocgstack@pop\ocgbase_ocgstack_pop:N
+\cs_gset_eq:NN\ocgbase at ocgstack@push\ocgbase_ocgstack_push:n

Modified: trunk/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty	2017-03-17 21:36:06 UTC (rev 43529)
+++ trunk/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty	2017-03-17 21:36:21 UTC (rev 43530)
@@ -37,7 +37,10 @@
 \RequirePackage{xparse}
 \RequirePackage{l3keys2e}
 
-\ProvidesExplPackage{ocgx2}{2017/03/09}{0.19}
+\def\g at ocgxii@date at tl{2017/03/16}
+\def\g at ocgxii@version at tl{0.20}
+
+\ProvidesExplPackage{ocgx2}{\g at ocgxii@date at tl}{\g at ocgxii@version at tl}
 {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
 
 %creating global definitions
@@ -135,9 +138,7 @@
 
 \cs_new_nopar:Nn\ocgxii_beginocg:nnnn{
   \bool_if:NT\g_ocgxii_nestedB_bool{
-    \seq_gput_left:Nx\g_ocgxii_nested_seq{
-      \seq_item:Nn\g_ocgxii_ocgstack_seq{\c_one}
-    }
+    \seq_gput_left:Nx\g_ocgxii_nested_seq{\ocgbase_ocgstack_top:}
     \ocgbase_add_to_order_list:n{[}
   }
   \bool_gset_true:N\g_ocgxii_nestedB_bool
@@ -197,8 +198,8 @@
       }
     }
     \tl_gset:cx{ocgx2.ocg.#3}{\tl_use:c{ocgxii@#3}}
-    \seq_gput_left:Nx\g_ocgxii_ocgstack_seq{\tl_use:c{ocgxii@#3}}
-    \ocgxii_ocgstack_shipout:N\g_ocgxii_ocgstack_seq
+    \ocgbase_ocgstack_push:n{\tl_use:c{ocgxii@#3}}
+    \ocgxii_ocgstack_shipout:N\g_ocgbase_ocgstack_seq
   \group_end:
   \ocgbase_oc_bdc:n{\tl_use:c{ocgxii@#3}}
   \ignorespaces
@@ -212,14 +213,14 @@
     \str_if_eq_x_p:nn{
       \seq_item:Nn\g_ocgxii_nested_seq{\c_one}
     }{
-      \seq_item:Nn\g_ocgxii_ocgstack_seq{\c_one}
+      \ocgbase_ocgstack_top:
     }
   }{
     \ocgbase_add_to_order_list:n{]}
     \seq_gpop_left:NN\g_ocgxii_nested_seq\l_trash_tl
   }
-  \seq_gpop_left:NN\g_ocgxii_ocgstack_seq\l_trash_tl
-  \ocgxii_ocgstack_shipout:N\g_ocgxii_ocgstack_seq
+  \ocgbase_ocgstack_pop:N\l_trash_tl
+  \ocgxii_ocgstack_shipout:N\g_ocgbase_ocgstack_seq
   \bool_gset_false:N\g_ocgxii_nestedB_bool
   \bool_gset_true:N\g_ocgxii_nestedE_bool
 }
@@ -313,17 +314,6 @@
   \ocgxii_outputpage_orig:
 }
 
-%stack of PDF obj references of currently open OCGs
-\seq_new:N\g_ocgxii_ocgstack_seq
-
-%macro that inserts /OC <<OCMD with currently open OCGs>> entry;
-%for use within annotation dicts
-\cs_new_nopar:Npn\ocgxii at insert@OC{
-  \seq_if_empty:NF\g_ocgxii_ocgstack_seq{
-    /OC~<</Type/OCMD/OCGs~[\seq_use:Nn\g_ocgxii_ocgstack_seq{~}]/P/AllOn>>
-  }
-}
-
 \cs_new_nopar:Nn\ocgxii_ocglist_reset:{
   \tl_clear_new:N\l_ocgxii_u_list_tl
   \tl_clear_new:N\l_ocgxii_d_list_tl
@@ -373,176 +363,32 @@
 
 \int_new:N\g_ocgxii_widcount_int% widget counter
 
-%re-implement commands from ocg-p.sty / ocgx.sty (all engines including
-%ps2pdf [gs>=9.15])
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% re-implement commands from ocgx.sty (all engines including ps2pdf [gs>=9.15])
+% adding optional `*` (arg 1) -> non-breakable Button Widget & mouse-up trigger
+%   instead of plain (multiline) Link
+% adding optional 2nd argument -> Button Widget with one of various mouse
+% triggers
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \DeclareDocumentCommand\switchocg{s o m +m}{
-  \leavevmode
-  \bool_if:nTF{
-    \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} ||
-    \IfValueTF{#2}{\c_true_bool}{\c_false_bool}
-  }{
-    % implemented as Widget annot (non-breakable)
-    \ocgxii_ocglist_process_idlist:nn{
-      \IfValueTF{#2}{#2}{triggerocg=onmouseup}
-    }{#3}
-    \hbox_set:Nn\l_tmpa_box{#4}
-    %dummy Widget, workaround for pre AR-DC bug;
-    %see https://forums.adobe.com/message/5787612#5787612
-    \str_if_eq_x:nnF{\ocgxii at insert@OC}{}{\pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{/Subtype/Widget/F~2}}
-    \pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{
-      /Subtype/Widget/Ff~65536/FT/Btn/H/I
-      /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int)
-      \ocgxii at insert@OC
-      /AA <<
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{
-          /U <</S/SetOCGState/State [/Toggle~\l_ocgxii_u_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_d_list_tl{}{
-          /D <</S/SetOCGState/State [/Toggle~\l_ocgxii_d_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_e_list_tl{}{
-          /E <</S/SetOCGState/State [/Toggle~\l_ocgxii_e_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_x_list_tl{}{
-          /X <</S/SetOCGState/State [/Toggle~\l_ocgxii_x_list_tl]>>
-        }
-      >>
-    }\box_use_clear:N\l_tmpa_box
-    \pbs_appendtofields:n{\pbs_pdflastann:}
-    \int_gincr:N\g_ocgxii_widcount_int
-  }{
-    \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3}
-    \pbs_pdflink:nn{
-      /Subtype/Link\ocgxii at insert@OC
-      /A <</S/SetOCGState/State [
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/Toggle~\l_ocgxii_u_list_tl}]>>
-      /Border [0~0~0]
-    }{#4}
-  }
+  \ocgxii_actionsocg:nnnnnn{#1}{#2}{#3}{}{}{#4}
 }
 
 \DeclareDocumentCommand\showocg{s o m +m}{
-  \leavevmode
-  \bool_if:nTF{
-    \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} ||
-    \IfValueTF{#2}{\c_true_bool}{\c_false_bool}
-  }{
-    % implemented as Widget annot (non-breakable)
-    \ocgxii_ocglist_process_idlist:nn{
-      \IfValueTF{#2}{#2}{triggerocg=onmouseup}
-    }{#3}
-    \hbox_set:Nn\l_tmpa_box{#4}
-    %dummy Widget, workaround for pre AR-DC bug;
-    %see https://forums.adobe.com/message/5787612#5787612
-    \str_if_eq_x:nnF{\ocgxii at insert@OC}{}{\pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{/Subtype/Widget/F~2}}
-    \pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{
-      /Subtype/Widget/Ff~65536/FT/Btn/H/I
-      /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int)
-      \ocgxii at insert@OC
-      /AA <<
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{
-          /U <</S/SetOCGState/State [/ON~\l_ocgxii_u_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_d_list_tl{}{
-          /D <</S/SetOCGState/State [/ON~\l_ocgxii_d_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_e_list_tl{}{
-          /E <</S/SetOCGState/State [/ON~\l_ocgxii_e_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_x_list_tl{}{
-          /X <</S/SetOCGState/State [/ON~\l_ocgxii_x_list_tl]>>
-        }
-      >>
-    }\box_use_clear:N\l_tmpa_box
-    \pbs_appendtofields:n{\pbs_pdflastann:}
-    \int_gincr:N\g_ocgxii_widcount_int
-  }{
-    \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3}
-    \pbs_pdflink:nn{
-      /Subtype/Link\ocgxii at insert@OC
-      /A <</S/SetOCGState/State [
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/ON~\l_ocgxii_u_list_tl}]>>
-      /Border [0~0~0]
-    }{#4}
-  }
+  \ocgxii_actionsocg:nnnnnn{#1}{#2}{}{#3}{}{#4}
 }
 
 \DeclareDocumentCommand\hideocg{s o m +m}{
-  \leavevmode
-  \bool_if:nTF{
-    \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} ||
-    \IfValueTF{#2}{\c_true_bool}{\c_false_bool}
-  }{
-    % implemented as Widget annot (non-breakable)
-    \ocgxii_ocglist_process_idlist:nn{
-      \IfValueTF{#2}{#2}{triggerocg=onmouseup}
-    }{#3}
-    \hbox_set:Nn\l_tmpa_box{#4}
-    %dummy Widget, workaround for pre AR-DC bug;
-    %see https://forums.adobe.com/message/5787612#5787612
-    \str_if_eq_x:nnF{\ocgxii at insert@OC}{}{\pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{/Subtype/Widget/F~2}}
-    \pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{
-      /Subtype/Widget/Ff~65536/FT/Btn/H/I
-      /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int)
-      \ocgxii at insert@OC
-      /AA <<
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{
-          /U <</S/SetOCGState/State [/OFF~\l_ocgxii_u_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_d_list_tl{}{
-          /D <</S/SetOCGState/State [/OFF~\l_ocgxii_d_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_e_list_tl{}{
-          /E <</S/SetOCGState/State [/OFF~\l_ocgxii_e_list_tl]>>
-        }
-        \str_if_eq:VnF\l_ocgxii_x_list_tl{}{
-          /X <</S/SetOCGState/State [/OFF~\l_ocgxii_x_list_tl]>>
-        }
-      >>
-    }\box_use_clear:N\l_tmpa_box
-    \pbs_appendtofields:n{\pbs_pdflastann:}
-    \int_gincr:N\g_ocgxii_widcount_int
-  }{
-    \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#3}
-    \pbs_pdflink:nn{
-      /Subtype/Link\ocgxii at insert@OC
-      /A <</S/SetOCGState/State [
-        \str_if_eq:VnF\l_ocgxii_u_list_tl{}{/OFF~\l_ocgxii_u_list_tl}]>>
-      /Border [0~0~0]
-    }{#4}
-  }
+  \ocgxii_actionsocg:nnnnnn{#1}{#2}{}{}{#3}{#4}
 }
 
 \DeclareDocumentCommand\actionsocg{s o m m m +m}{
+  \ocgxii_actionsocg:nnnnnn{#1}{#2}{#3}{#4}{#5}{#6}
+}
+
+\cs_new:Nn\ocgxii_actionsocg:nnnnnn{
   \leavevmode
-  \bool_if:nTF{
-    \IfBooleanTF{#1}{\c_true_bool}{\c_false_bool} ||
-    \IfValueTF{#2}{\c_true_bool}{\c_false_bool}
-  }{
+  \bool_if:nTF{#1 || \IfValueTF{#2}{\c_true_bool}{\c_false_bool}}{
     % implemented as Widget annot (non-breakable)
     \ocgxii_ocglist_process_idlist:nn{
       \IfValueTF{#2}{#2}{triggerocg=onmouseup}
@@ -566,13 +412,6 @@
     \tl_set_eq:NN\l_ocgxii_tohide_d_tl\l_ocgxii_d_list_tl
     \tl_set_eq:NN\l_ocgxii_tohide_u_tl\l_ocgxii_u_list_tl
     \hbox_set:Nn\l_tmpa_box{#6}
-    %dummy Widget, workaround for pre AR-DC bug;
-    %see https://forums.adobe.com/message/5787612#5787612
-    \str_if_eq_x:nnF{\ocgxii at insert@OC}{}{\pbs_pdfannot:nnnn{
-      \dim_use:N\box_wd:N\l_tmpa_box}{
-      \dim_use:N\box_ht:N\l_tmpa_box}{
-      \dim_use:N\box_dp:N\l_tmpa_box
-    }{/Subtype/Widget/F~2}}
     \pbs_pdfannot:nnnn{
       \dim_use:N\box_wd:N\l_tmpa_box}{
       \dim_use:N\box_ht:N\l_tmpa_box}{
@@ -580,7 +419,6 @@
     }{
       /Subtype/Widget/Ff~65536/FT/Btn/H/I
       /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int)
-      \ocgxii at insert@OC
       /AA <<
         \str_if_eq_x:nnF{}{
           \l_ocgxii_toswitch_u_tl\l_ocgxii_toshow_u_tl\l_ocgxii_tohide_u_tl
@@ -654,7 +492,7 @@
     \ocgxii_ocglist_process_idlist:nn{triggerocg=onmouseup}{#5}
     \tl_set_eq:NN\l_ocgxii_tohide_u_tl\l_ocgxii_u_list_tl
     \pbs_pdflink:nn{
-      /Subtype/Link\ocgxii at insert@OC
+      /Subtype/Link
       /A <</S/SetOCGState
         /State [
           \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{
@@ -668,11 +506,12 @@
   }
 }
 
-% mimic commands from ocg-p
-\def\toggleocgs{\switchocg*}
-\def\showocgs{\showocg*}
-\def\hideocgs{\hideocg*}
-\def\setocgs{\actionsocg*}
+%mimic commands from ocg-p
+\cs_new:Npn\toggleocgs{\switchocg*}
+\cs_new:Npn\showocgs{\showocg*}
+\cs_new:Npn\hideocgs{\hideocg*}
+\cs_new:Npn\setocgs{\actionsocg*}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \cs_new:Nn\ocgxii_process_ocgref:NN{
   \str_if_eq_x:nnF{#2}{}{
@@ -816,8 +655,10 @@
 \RequirePackage{tikz}
 \usetikzlibrary{calc}
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Copyright notice: The code that follows until the end of the file was
 % taken from Paul Gaborit's `tikzlibraryocgx.code.tex' with minor additions.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \tikzset{
   ocg/.style={ocg/.cd,#1,/tikz/.cd},
   ocg={



More information about the tex-live-commits mailing list