summaryrefslogtreecommitdiff
path: root/tex/context/base/s-pre-02.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/s-pre-02.tex')
-rw-r--r--tex/context/base/s-pre-02.tex104
1 files changed, 71 insertions, 33 deletions
diff --git a/tex/context/base/s-pre-02.tex b/tex/context/base/s-pre-02.tex
index f5c4e7381..865a9fb08 100644
--- a/tex/context/base/s-pre-02.tex
+++ b/tex/context/base/s-pre-02.tex
@@ -8,7 +8,7 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
%D This environment can be used to typeset interactive
@@ -16,6 +16,8 @@
%D publishers conference of the European Portable Document
%D Association.
+\usemodule[pre-general] % mode=step
+
%D \macros
%D {setupbodyfont, switchtobodyfont, setuplayout}
%D
@@ -36,7 +38,7 @@
%D have navigational tools at the bottom of the screen.
\setuppapersize
- [S6]
+ [S6][S6]
\setuplayout
[backspace=1cm,
@@ -108,9 +110,19 @@
%D
%D The navigational elements and the backgrounds are
%D provided by \METAPOST. The next few macros are meant for the
-%D more experienced \CONTEXT\ user.
+%D more experienced \CONTEXT\ user. When, as demonstrated
+%D here, we make the dimensions part of the name, we can be
+%D sure that new ones are generated when we change the page
+%D size in between.
+%D
+%D When \METAPOST\ is used, it makes sense to generate the
+%D graphics at runtime. This is supported when one enables
+%D system calls in the local \type {texmf.cnf} file and add the
+%D switch \type {\runMPgraphicstrue} to the local file \type
+%D {cont-sys.tex}. When direct processing is disabled or not
+%D supported, \TEXEXEC\ will tke care of graphic generation.
-\MPinclusions{input mp-tool}
+\MPinclusions{input mp-tool}
\def\MPpagebackground#1#2#3%
{\startreusableMPgraphic{pb:#1#2#3}
@@ -138,6 +150,17 @@
%D {setuptexttexts}
%D
%D By clicking on the text area, one goes to the next page.
+%D We could also have use the overlay mechanism, but this
+%D takes more settings and requires to generate the backgounds
+%D each page.
+%D
+%D \starttypen
+%D \defineoverlay[BackgroundButton][\BackgroundButton]
+%D \setupbackgrounds[text][text][background=BackgroundButton]
+%D \setupbackgrounds[state=repeat]
+%D \stoptypen
+%D
+%D We go for the fast one.
\def\MPtextbackground#1#2#3%
{\startreusableMPgraphic{tx:#1#2#3}
@@ -177,7 +200,7 @@
z2 = (#1, .5y3) ;
z3 = ( 0, #2) ;
path p ; p := z1--z2--z3--cycle;
- lw = #2/5 ; pickup pencircle scaled lw;
+ lw := #2/5 ; pickup pencircle scaled lw;
filldraw p withcolor \MPcolor{Backgrounds} ;
set_outer_boundingbox currentpicture;
\stopreusableMPgraphic
@@ -189,7 +212,7 @@
z2 = ( 0, .5y3) ;
z3 = (#1, #2) ;
path p ; p := z1--z2--z3--cycle;
- lw = #2/5 ; pickup pencircle scaled lw;
+ lw := #2/5 ; pickup pencircle scaled lw;
filldraw p withcolor \MPcolor{Backgrounds} ;
set_outer_boundingbox currentpicture;
\stopreusableMPgraphic
@@ -197,9 +220,9 @@
\def\MPcircle#1#2%
{\startreusableMPgraphic{ci:#1#2}
- rx = #1; ry = #2;
+ rx := #1; ry := #2;
path p ; p := fullcircle xscaled rx yscaled ry;
- lw = #2/5 ; pickup pencircle scaled lw;
+ lw := #2/5 ; pickup pencircle scaled lw;
filldraw p withcolor \MPcolor{Backgrounds} ;
set_outer_boundingbox currentpicture;
\stopreusableMPgraphic
@@ -211,24 +234,24 @@
z2 = ( #1, 0) ;
z3 = (.5x2, #2) ;
path p ; p := z1--z2--z3--cycle;
- lw = #2/5 ; pickup pencircle scaled lw;
+ lw := #2/5 ; pickup pencircle scaled lw;
filldraw p withcolor \MPcolor{Backgrounds} ;
set_outer_boundingbox currentpicture;
\stopreusableMPgraphic
\reuseMPgraphic{wh:#1#2}}
\unexpanded\def\BackwardButton%
- {\naarbox{\MPleft{\the\bottomheight}{\the\bottomheight}}[previouspage]}
+ {\gotobox{\MPleft{\the\bottomheight}{\the\bottomheight}}[previouspage]}
\unexpanded\def\ForwardButton%
- {\naarbox{\MPright{\the\bottomheight}{\the\bottomheight}}[nextpage]}
+ {\gotobox{\MPright{\the\bottomheight}{\the\bottomheight}}[nextpage]}
\unexpanded\def\ExitButton%
- {\naarbox{\MPcircle{\the\bottomheight}{\the\bottomheight}}[CloseDocument]}
+ {\gotobox{\MPcircle{\the\bottomheight}{\the\bottomheight}}[CloseDocument]}
\unexpanded\def\WhateverButton%
{\doifreferencefoundelse{Whatever}
- {\naarbox{\MPwhat{\the\bottomheight}{\the\bottomheight}}[Whatever]}
+ {\gotobox{\MPwhat{\the\bottomheight}{\the\bottomheight}}[Whatever]}
{}}
\def\BottomButton%
@@ -248,7 +271,27 @@
\kern.5\bottomheight
\ForwardButton
\kern.5\bottomheight]
- []
+ [] % redundant
+
+% an alternative way:
+%
+% \setupinteractionmenu[bottom][state=start]
+%
+% \setupinteraction[menu=on]
+%
+% \startinteractionmenu[bottom]
+% \button[frame=off,height=\bottomheight,width=.3\textwidth]{}[Topics]
+% \hfill
+% \doifreferencefoundelse{Whatever}
+% {\gotobox{\MPwhat{\the\bottomheight}{\the\bottomheight}}[Whatever]}{}%
+% \kern2\bottomheight
+% \gotobox{\MPleft{\the\bottomheight}{\the\bottomheight}}[previouspage]%
+% \kern.5\bottomheight
+% \gotobox{\MPcircle{\the\bottomheight}{\the\bottomheight}}[CloseDocument]%
+% \kern.5\bottomheight
+% \gotobox{\MPright{\the\bottomheight}{\the\bottomheight}}[nextpage]%
+% \kern.5\bottomheight
+% \stopinteractionmenu
%D \macros
%D {TitlePage, Topics, Topic, Subject}
@@ -281,7 +324,7 @@
%D \StopTitlepage
%D \stoptypen
%D
-%D or more straightforward:
+%D or as one||liner:
%D
%D \starttypen
%D \TitlePage{text\\text\\text}
@@ -292,7 +335,7 @@
\def\StartTitlePage%
{\startstandardmakeup
- \bfd
+ \bfd\setupinterlinespace
\setupalign[middle]
\vfil
\let\\=\vfil}
@@ -339,25 +382,13 @@
continue=no,
style=\tfa]
+%D The next piece of code is new.
+
%D \macros
%D {setuplist}
%D
-%D The subject list is automatically placed. We center each
-%D subject line by using one of the default alternatives (g). We
-%D could have said:
-%D
-%D \starttypen
-%D \setuplist
-%D [Subject]
-%D [alternative=none,
-%D command=\SubjectListLine,
-%D interaction=all]
-%D
-%D \def\SubjectListLine#1#2#3%
-%D {\midaligned{#2}}
-%D \stoptypen
-%D
-%D But why should we complicate things when we can say:
+%D When found, the subject list is automatically placed
+%D after the topic head.
\setuplist
[Topic,Subject]
@@ -376,6 +407,13 @@
\fi}
\def\Subjects%
- {\placelist[Subject]}
+ {\determinelistcharacteristics[Subject][criterium=Topic]
+ \ifcase\utilitylistlength\else
+ \placelist[Subject][criterium=Topic]
+ \fi}
+
+\setuphead
+ [Topic]
+ [after={\blank[3*medium]\Subjects}]
\endinput