summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/lecturer/ltr-steps.tex
blob: eb2424aadccc77c0d1d758f2bb7c3f608cf193f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
% This file is part of the Lecturer package.
% Paul Isambert -- July 2010.
% 
% ATTRIBUTES
%
\def\ltr@step_restrictions{%
  vskip hskip everyvstep everyhstep left right
  transition handout visible group color font on off pdftitle }
\ltr@boolean_attr{step:handout}
\ltr@boolean_attr{step:visible}
\ltr@boolean_attr{step:group}
\ltr@setattribute step:handout;=true
\defactiveparameter step {%
  \ltr@delete_empty{#1:font}%
  }%
    
\def\ltr@step_clear{%
  \ifltr@step_open
    \ltr@ifattribute ltr@inner_step:font;
      {\ltr@usevalueor ltr@inner_slide:font;{\ltr@usevalue job:font;}}{}%
    \ltr@ifvalue ltr@inner_step:group; = true
      {\endgroup}{}%
    \ltr@passvalueand{\reverse\iffemptystring}ltr@inner_step:color;
      {{\pdfcolorstack0 pop}}{}%
    \pdfliteral direct {EMC}%
    \ltr@setattribute ltr@inner_step:meta; = step
    \passexpanded{\ltr@attribute_deletion{ltr@inner_step}}\ltr@step_restrictions
  \fi
  }
\passexpandednobraces{\restrictparameter step ltr@inner_step:}\ltr@step_restrictions\par
\ltr@boolean_attr{ltr@inner_step:handout}
\ltr@boolean_attr{ltr@inner_step:visible}
\ltr@boolean_attr{ltr@inner_step:group}

\long\def\setstep#1#2\par{%
  \ltr@setstep_do{#2}{#1}%
  }%
\newfor\ltr@setstep_do{1}#2{%
  \ltr@ifattribute {ltr@\commandtoname#2@inner_step}:meta;
    {\setparameter{ltr@\commandtoname#2@inner_step}:}
    {\ltr@setstep_new{#2}}%
    #1\par
  }
\def\ltr@setstep_new#1{%
  \def#1{%
    \ltr@step_clear
    \ltr@setattribute ltr@inner_step:meta;={ltr@\commandtoname#1@inner_step}
    \ltr@step_do}%
  \passexpandednobraces{\restrictparameter {ltr@\commandtoname#1@inner_step}:}\ltr@step_restrictions\par
  \ltr@boolean_attr{{ltr@\commandtoname#1@inner_step}:visible}%
  \ltr@boolean_attr{{ltr@\commandtoname#1@inner_step}:handout}%
  \ltr@boolean_attr{{ltr@\commandtoname#1@inner_step}:group}%
  \defactiveparameter{ltr@\commandtoname#1@inner_step}{%
    \ltr@delete_empty{##1:font}%
    }%
  \setparameter{ltr@\commandtoname#1@inner_step}:
    meta = step
  }  
\setparameter ltr@inner_step:
  meta = step

%
%
%
%
%
% The \step command.
% 
\newif\ifltr@step_open
\newcount\ltr@steps_count
\newcount\ltr@activesteps_count
\def\step{%
  % Close the current step, if any.
  \ltr@step_clear
  \ltr@step_do
  }
% Steps created with \newstep goes there directly.
\def\ltr@step_do{%
  \global\ltr@step_opentrue
  \ifnextnospace[{\ltr@step_create}{\ltr@step_create[]}%
  }

\newif\ifltr@step_standalone
%
% For the options.
%
\newif\ifltr@step_named
\def\ltr@stepcheck_useatom#1{%
  \ltr@step_namedtrue
  \reverse\iffcs{ltr@step_objnum:#1_\the\slideno}
    {\pdfobj reserveobjnum%
     \xdefcs{ltr@step_objnum:#1_\the\slideno}{\the\pdflastobj\spacecs}}%
  \global\lettocs\ltr@step_current{ltr@step_objnum:#1_\the\slideno}%
  }
\def\ltr@stepcheck_usepair#1#2{}
%
\def\ltr@step_useatom#1{%
  \ifstring{#1}{here}
    {\ltr@error{You can't name a step `here', it's a keyword}}
    {\def\ltr@step_ref{#1}%
     \iffemptycommand\ltr@step_pdftitle{\def\ltr@step_pdftitle{#1}}}%
  }
\def\ltr@step_usepair#1#2{%
  \ifstring{#1}{on}
    {\ltr@step_standalonefalse\ltr@step_onoff{on}{#2 }}
    {\ifstring{#1}{off}
      {\ltr@step_onoff{off}{#2 }}
      {\ifstring{#1}{pdftitle}
         {\def\ltr@step_pdftitle{#2}}
         {\ltr@setattribute ltr@inner_step:#1;={#2} }}}%
  }
\def\ltr@step_usepair#1#2{%
  \ifstring{#1}{pdftitle}
         {\def\ltr@step_pdftitle{#2}}
         {\ltr@setattribute ltr@inner_step:#1;={#2} }%
  }
\def\ltr@step_onoff#1#2{%
  \reverse\iffemptystring{#2}
    {\ltr@step_onoffloop{#1}{#2 }}%
  }
\newfornoempty\ltr@step_onoffloop{1}#2 {%
  \ifstring{#2}{here}{\ltr@step_standalonetrue}{%
    \ifcs{ltr@step_#2:#1}
      {\global\eaddrightcs}
      {\xdefcs}
      {ltr@step_#2:#1}{\ltr@step_current 0 R }}%
      % Add the object to ltr@step_OCG:on/off
  }
\def\ltr@step_current{}
\def\ltr@step_create[#1]{%
  \global\advance\ltr@steps_count1
  \ltr@step_namedfalse
  \ltr@option_launchloop{stepcheck}{#1}%
  \unless\ifltr@step_named
    \pdfobj reserveobjnum
    \xdef\ltr@step_current{\the\pdflastobj\spacecs}%
  \fi
  \def\ltr@step_ref{}\def\ltr@step_pdftitle{}%
  \ltr@step_standalonefalse
  \ltr@option_launchloop{step}{#1}%
  \ltr@delete_empty{ltr@inner_step:font}%
  \ltr@passvalueor{\ltr@step_onoff{on}}ltr@inner_step:on;\ltr@step_standalonetrue
  \ltr@passvalue{\ltr@step_onoff{off}}ltr@inner_step:off;%
  \immediate\pdfobj useobjnum\ltr@step_current {%
    << /Type/OCG /Name(%
      \ifemptycommand\ltr@step_ref
        {\ifemptycommand\ltr@step_pdftitle
           {[step \the\ltr@steps_count]}
           {\ltr@step_pdftitle}}%
        {\ltr@step_pdftitle}) >>
    }%
  % ... and, if the object has a reference name, it might be referenced,
  % so its object number now returns its name.
  \reverse\iffemptycommand\ltr@step_ref{\global\letcs{ltr@step_\ltr@step_current:name}\ltr@step_ref}%
  % According to the value to the attribute "handout" or "visible"
  % this group has base state ON or OFF (see catalog).
  \ltr@ifvalue job:mode; = handout
    {\ltr@ifvalue ltr@inner_step:handout; = true
       {\addvisibleOCG{\ltr@step_current}}
       {\addOCG{\ltr@step_current}}}
    {\ltr@ifvalue ltr@inner_step:visible; = true
       {\addvisibleOCG{\ltr@step_current}\ltr@step_standalonefalse}
       {\addOCG{\ltr@step_current}}}%
  % Link the step to the OCG.
  \addproperties{ltr@step_\the\ltr@steps_count:content}{\ltr@step_current}%
  % If the step appears by itself, it is added it to the list to
  % be chained in the output routine, and its transition is stored, if any.
  \ifltr@step_standalone
    \global\advance\ltr@activesteps_count1
    \global\eaddright\ltr@page_steplist{\ltr@step_current,}%
    \iffcs{ltr@inner_transition:\ltr@usevalueor ltr@inner_step:transition;{ltr@no_value}}
          {\xdefcs{ltr@step_\ltr@step_current:transition}{%
            \usecs{ltr@inner_transition:\ltr@usevalueor ltr@inner_step:transition;{ltr@no_value}} 0 R}}%
  \fi
  % The step is opened, and the every...'s released.
  \pdfliteral direct {/OC/ltr@step_\the\ltr@steps_count:content BDC}%
  \ltr@ifvalue ltr@inner_step:group; = true
    {\begingroup}{}%
  \ltr@passvalueand{\reverse\iffemptystring}ltr@inner_step:color;
    {{\pdfcolorstack0 push {\ltr@passvalue\ltr@color_use ltr@inner_step:color;}}}{}%
  \ltr@usevalue ltr@inner_step:font;%
  \ifvmode
    \ltr@settovalue\vskip ltr@inner_step:vskip;%
    \leftskip=0pt \rightskip=0pt plus 1fill\relax
    \ltr@ifcasevalue ltr@inner_slide:hpos;
      \val ff \rightskip=0pt
      \val rr \leftskip=0pt plus 1fill\relax
      \val rf \leftskip=0pt plus 1fill\rightskip=0pt
    \endval
    \ltr@settovalue{\advance\leftskip}ltr@inner_step:left;%
    \ltr@settovalue{\advance\rightskip}ltr@inner_step:right;%
    \ltr@usevalue ltr@inner_step:everyvstep;%
  \else
    \ifhmode
      \ltr@settovalue\hskip ltr@inner_step:hskip;%
      \ltr@usevalue ltr@inner_step:everyhstep;%
    \fi
  \fi
  \ignorespaces
  }

\endinput