summaryrefslogtreecommitdiff
path: root/tex/context/base/pack-bar.mkiv
blob: 6967173e2e8ed5a9a59a9c6a02e4f8c3bcd0ca60 (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
%D \module
%D   [       file=pack-bar,
%D        version=2009.06.26,
%D          title=\CONTEXT\ Packaging Macros,
%D       subtitle=Bars,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\writestatus{loading}{ConTeXt Packaging Macros / Bars}

%D This code has been moved from scrn-int to here (was some old
%D experimental code). It could be in scrn-bar but it's static.

\unprotect

%D \startbuffer
%D \dorecurse{10}
%D   {\horizontalpositionbar
%D      \pos\recurselevel \min1 \max10
%D      \token\framed{\recurselevel}%
%D    \\}
%D
%D \hbox to 15em
%D   {\hss
%D    \dorecurse{10}
%D      {\verticalpositionbar\pos\recurselevel\min1\max10\token\blackrule\\
%D       \hss}}
%D \stopbuffer

\def\horizontalpositionbar\pos#1\min#2\max#3\token#4\\%
  {\hbox to \hsize
     {\hskip\zeropoint\!!plus #1\!!fill
      \hskip\zeropoint\!!plus-#2\!!fill
      #4\relax
      \hskip\zeropoint\!!plus #3\!!fill
      \hskip\zeropoint\!!plus-#1\!!fill}}

\def\verticalpositionbar\pos#1\min#2\max#3\token#4\\%
  {\vbox to \vsize
     {\vskip\zeropoint\!!plus #1\!!fill
      \vskip\zeropoint\!!plus-#2\!!fill
      \hbox{#4}\relax
      \vskip\zeropoint\!!plus #3\!!fill
      \vskip\zeropoint\!!plus-#1\!!fill}}

\def\horizontalgrowingbar\pos#1\min#2\max#3\height#4\depth#5\\%
  {\hbox to \hsize
     {\scratchcounter\numexpr#1-#2+\plusone\relax
      \leaders\vrule\hskip\zeropoint\!!plus \scratchcounter\!!fill
      \vrule\!!width\zeropoint\!!height#4\!!depth#5%
      \hskip\zeropoint\!!plus #3\!!fill
      \hskip\zeropoint\!!plus-#1\!!fill}}

\def\verticalgrowingbar\pos#1\min#2\max#3\width#4\\%
  {\vbox to \vsize
     {\scratchcounter\numexpr#1-#2+\plusone\relax
      \leaders\hrule\vskip\zeropoint\!!plus\scratchcounter\!!fill
      \hrule\!!width#4\!!height\zeropoint\!!depth\zeropoint
      \vskip\zeropoint\!!plus #3\!!fill
      \vskip\zeropoint\!!plus-#1\!!fill}}

\protect \endinput