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
|
%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}
\unprotect
%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. In
%D the meantime the interface has been adapted to a key|/|value one.
%D
%D \startbuffer
%D \dorecurse{10}{
%D \ruledhbox{\horizontalpositionbar[n=#1,min=1,max=10,text=!,color=red]}
%D \par
%D }
%D \stopbuffer
%D
%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection
%D
%D \startbuffer
%D \dorecurse{10}{
%D \ruledhbox{\horizontalgrowingbar[n=#1,min=1,max=10,text=!,color=red]}
%D \par
%D }
%D \stopbuffer
%D
%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection
\installcorenamespace{positionbar}
\installsimplecommandhandler \??positionbar {positionbar}
\setuppositionbar
[\c!min=1,
\c!max=1,
\c!n=1,
\c!text=?,
\c!width=\emwidth,
\c!height=\strutheight,
\c!depth=\strutdepth]
\unexpanded\def\horizontalpositionbar[#1]%
{\hbox to \hsize
{\setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
\hskip\zeropoint\s!plus \positionbarparameter\c!n \s!fill
\hskip\zeropoint\s!plus-\positionbarparameter\c!min\s!fill
\positionbarparameter\c!text\relax
\hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
\unexpanded\def\verticalpositionbar[#1]%
{\vbox to \vsize
{\setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
\vskip\zeropoint\s!plus \positionbarparameter\c!n \s!fill
\vskip\zeropoint\s!plus-\positionbarparameter\c!min\s!fill
\positionbarparameter\c!text\relax
\vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
\unexpanded\def\horizontalgrowingbar[#1]%
{\hbox to \hsize
{\setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
\leaders\vrule\hskip\zeropoint\s!plus \numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\vrule\s!width\zeropoint\s!height\positionbarparameter\c!height\s!depth\positionbarparameter\c!depth
\hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
\unexpanded\def\verticalgrowingbar[#1]%
{\vbox to \vsize
{\setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
\leaders\hrule\vskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\hrule\s!width\positionbarparameter\c!width\s!height\zeropoint\s!depth\zeropoint
\vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
\protect \endinput
|