diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty | 97 |
1 files changed, 56 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty index 445d42a2752..33794d6558d 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgbase.sty @@ -2,7 +2,7 @@ % % ocgbase.sty % -% low-level macros for OCG creation, /OC-marked content and +% low-level macros for OCG creation, marking optional content and % for managment of global (document-wide) OCG related lists; % % (automatic) OCG configuration in the PDF catalog @@ -29,7 +29,7 @@ % % Commands defined: % -% \ocgbase_new_ocg:xxx +% \ocgbase_new_ocg:nnn % \ocgbase@new@ocg (LaTeX2e version) % #1: name (as shown in the Layers Tab of the Reader GUI) % #2: usage dict (may be empty), see PDF reference: @@ -40,7 +40,7 @@ % \ocgbase_last_ocg: % \ocgbase@last@ocg (LaTeX2e version) % inserts ID of PDF object created during most recent call of -% \ocgbase_new_ocg:xxx +% \ocgbase_new_ocg:nnn % % -------- % @@ -55,11 +55,18 @@ % \ocgbase_add_to_off_list:n % \ocgbase@add@to@off@list (LaTeX2e version) % #1: PDF object ID of OCG -% macro for belated setting of initial non-visibility of an OCG +% macro for setting initial visibility to `off' % % -------- % -% \ocgbase_add_ocg_to_radiobtn_grp:xxx +% \ocgbase_del_from_off_list:n +% \ocgbase@del@from@off@list (LaTeX2e version) +% #1: PDF object ID of OCG +% macro for setting initial visibility to `on' +% +% -------- +% +% \ocgbase_add_ocg_to_radiobtn_grp:nnn % \ocgbase@add@ocg@to@radiobtn@grp % add OCG #2 (obj ref) to radio button group `#1' (string), % #3: (0|1|false|true) list OCG as part of group `#1' in the Layers Tab) @@ -70,11 +77,11 @@ % \ocgbase@oc@bdc % #1: OCG obj ref % mark begin of optional content belonging to OCG #1 in the current -% content stream +% content stream % % \ocgbase_oc_emc: % \ocgbase@oc@emc -% mark end of optional content in the current content stream +% mark end of optional content in the current content stream % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -94,8 +101,8 @@ \RequirePackage{l3keys2e} \RequirePackage{atenddvi} -\def\g@ocgbase@date@tl{2015/11/23} -\def\g@ocgbase@version@tl{0.3} +\def\g@ocgbase@date@tl{2015/11/26} +\def\g@ocgbase@version@tl{0.4} \ProvidesExplPackage{ocgbase}{\g@ocgbase@date@tl}{\g@ocgbase@version@tl} {support package for ocgx2.sty} @@ -120,8 +127,8 @@ } \tl_new:N\g_ocgbase_ocgs_tl %takes ocg object refs -\tl_new:N\g_ocgbase_offocgs_tl \seq_new:N\g_ocgbase_ocgorder_seq +\seq_new:N\g_ocgbase_offocgs_seq \AtEndDvi{ \tl_if_empty:NF\g_ocgbase_ocgs_tl{ @@ -130,8 +137,8 @@ \tl_set:Nx\l_ocgbase_ocgarray_tl{\pbs_pdflastobj:} \tl_new:N\l_ocgbase_offocgentry_tl %global OFF list - \tl_if_empty:NF\g_ocgbase_offocgs_tl{ - \pbs_pdfobj:nnn{}{array}{\g_ocgbase_offocgs_tl} + \seq_if_empty:NF\g_ocgbase_offocgs_seq{ + \pbs_pdfobj:nnn{}{array}{\seq_use:Nn\g_ocgbase_offocgs_seq{~}} \tl_set:Nx\l_ocgbase_offocgentry_tl{/OFF~\pbs_pdflastobj:} } %global Order list @@ -229,76 +236,84 @@ } %macro for inserting new OCG object -\cs_new:Nn\ocgbase_new_ocg:nnn{ +\cs_new_nopar:Nn\ocgbase_new_ocg:nnn{ \pbs_pdfobj:nnn{}{dict}{ /Type/OCG/Name~(#1)~\tl_if_blank:oF{#2}{/Usage<<#2>>} } \tl_gput_right:Nx\g_ocgbase_ocgs_tl{~\g_pbs_pdflastobj_tl} \bool_if:nT{ - \str_if_eq_p:nn{#3}{\c_zero} || - \str_if_eq_p:nn{#3}{off} || - \str_if_eq_p:nn{#3}{false} + \str_if_eq_x_p:nn{#3}{\c_zero} || + \str_if_eq_x_p:nn{#3}{off} || + \str_if_eq_x_p:nn{#3}{false} }{ - \tl_gput_right:Nx\g_ocgbase_offocgs_tl{~\g_pbs_pdflastobj_tl} - \tl_new:c{off:\g_pbs_pdflastobj_tl} + \ocgbase_add_to_off_list:n{\g_pbs_pdflastobj_tl} } \tl_gset_eq:NN\g_ocgbase_last_ocg_tl\g_pbs_pdflastobj_tl } -\cs_generate_variant:Nn\ocgbase_new_ocg:nnn{xxx} -\cs_new:Nn\ocgbase_last_ocg:{\g_ocgbase_last_ocg_tl} +\cs_new_nopar:Nn\ocgbase_last_ocg:{\g_ocgbase_last_ocg_tl} %macro for appending OCG object to global `Order' list % in Layers Tab of the GUI -\cs_new:Nn\ocgbase_add_to_order_list:n{ +\cs_new_nopar:Nn\ocgbase_add_to_order_list:n{ \seq_gput_right:Nx\g_ocgbase_ocgorder_seq{#1} } -%macro for belated appending an OCG object ref to the global `OFF' list +%macro for appending an OCG object to the global `OFF' list +%(initial non-visibility) +\cs_new_nopar:Nn\ocgbase_add_to_off_list:n{ + \seq_if_in:NxF\g_ocgbase_offocgs_seq{#1}{ + \seq_gput_right:Nx\g_ocgbase_offocgs_seq{#1} + } +} + +%macro for removing an OCG object from global `OFF' list %(initial non-visibility) -\cs_new:Nn\ocgbase_add_to_off_list:n{ - \tl_if_exist:cF{off:#1}{ - \tl_gput_right:Nx\g_ocgbase_offocgs_tl{~#1}\tl_new:c{off:#1} +\cs_new_nopar:Nn\ocgbase_del_from_off_list:n{ + \seq_if_in:NxT\g_ocgbase_offocgs_seq{#1}{ + \ocgbase_seq_gremove_all:Nx\g_ocgbase_offocgs_seq{#1} } } +\cs_set_eq:NN\ocgbase_seq_gremove_all:Nn\seq_gremove_all:Nn +\cs_generate_variant:Nn\ocgbase_seq_gremove_all:Nn{Nx} -\cs_new:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{ +\cs_new_nopar:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{ % #1: rbtn group name, % #2: OCG obj ref, % #3: visible in Layers Tab - \seq_if_in:NnF\g_ocgbase_ocgorder_seq{#1}{ - \seq_gput_right:Nn\g_ocgbase_ocgorder_seq{#1} + \seq_if_in:NxF\g_ocgbase_ocgorder_seq{#1}{ + \seq_gput_right:Nx\g_ocgbase_ocgorder_seq{#1} \seq_new:c{g_ocgbase_#1_rbtn_order_seq} \seq_new:c{g_ocgbase_#1_rbtn_groups_seq} } - \seq_if_in:cnTF{g_ocgbase_#1_rbtn_order_seq}{#2}{ + \seq_if_in:cxTF{g_ocgbase_#1_rbtn_order_seq}{#2}{ \bool_if:nT{ - \str_if_eq_p:nn{#3}{\c_zero} || - \str_if_eq_p:nn{#3}{false} + \str_if_eq_x_p:nn{#3}{\c_zero} || + \str_if_eq_x_p:nn{#3}{false} }{ - \seq_gremove_all:cn{g_ocgbase_#1_rbtn_order_seq}{#2} + \ocgbase_seq_gremove_all:cx{g_ocgbase_#1_rbtn_order_seq}{#2} } }{ \bool_if:nF{ - \str_if_eq_p:nn{#3}{\c_zero} || - \str_if_eq_p:nn{#3}{false} + \str_if_eq_x_p:nn{#3}{\c_zero} || + \str_if_eq_x_p:nn{#3}{false} }{ - \seq_gput_right:cn{g_ocgbase_#1_rbtn_order_seq}{#2} + \seq_gput_right:cx{g_ocgbase_#1_rbtn_order_seq}{#2} } } - \seq_gput_right:cn{g_ocgbase_#1_rbtn_groups_seq}{#2} + \seq_gput_right:cx{g_ocgbase_#1_rbtn_groups_seq}{#2} } -\cs_generate_variant:Nn\ocgbase_add_ocg_to_radiobtn_grp:nnn{xxx} % OC-marked content -\cs_new:Nn\ocgbase_oc_bdc:n{\pbs_pdfbdc:nn{/OC}{#1}} -\cs_new:Nn\ocgbase_oc_emc:{\pbs_pdfemc:} +\cs_new_nopar:Nn\ocgbase_oc_bdc:n{\pbs_pdfbdc:nn{/OC}{#1}} +\cs_new_nopar:Nn\ocgbase_oc_emc:{\pbs_pdfemc:} %l2e versions -\cs_gset_eq:NN\ocgbase@new@ocg\ocgbase_new_ocg:xxx +\cs_gset_eq:NN\ocgbase@new@ocg\ocgbase_new_ocg:nnn \cs_gset_eq:NN\ocgbase@last@ocg\ocgbase_last_ocg: \cs_gset_eq:NN\ocgbase@add@to@order@list\ocgbase_add_to_order_list:n \cs_gset_eq:NN\ocgbase@add@to@off@list\ocgbase_add_to_off_list:n -\cs_gset_eq:NN\ocgbase@add@ocg@to@radiobtn@grp\ocgbase_add_ocg_to_radiobtn_grp:xxx +\cs_gset_eq:NN\ocgbase@del@from@off@list\ocgbase_del_from_off_list:n +\cs_gset_eq:NN\ocgbase@add@ocg@to@radiobtn@grp\ocgbase_add_ocg_to_radiobtn_grp:nnn \cs_gset_eq:NN\ocgbase@oc@bdc\ocgbase_oc_bdc:n \cs_gset_eq:NN\ocgbase@oc@emc\ocgbase_oc_emc: |