diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/pack-bar.mkxl')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkxl/pack-bar.mkxl | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/pack-bar.mkxl b/Master/texmf-dist/tex/context/base/mkxl/pack-bar.mkxl new file mode 100644 index 00000000000..c6a11153165 --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/pack-bar.mkxl @@ -0,0 +1,94 @@ +%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 experimental code). +%D It could be in scrn-bar but it's static. In the meantime the interface has been +%D 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} \??positionbar + +\setuppositionbar + [\c!min=\plusone, + \c!max=\plusone, + \c!n=\plusone + \c!text=?, + \c!width=\emwidth, + \c!height=\strutheight, + \c!depth=\strutdepth] + +\permanent\protected\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}} + +\permanent\protected\def\verticalpositionbar[#1]% + {\vbox to \vsize + {\hsize\positionbarparameter\c!width + \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}} + +\permanent\protected\def\horizontalgrowingbar[#1]% + {\hpack to \hsize + {\setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \vrule\s!width\zeropoint\s!height\positionbarparameter\c!height\s!depth\positionbarparameter\c!depth + \leaders\vrule\hskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill + \hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill + \hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}} + +\permanent\protected\def\verticalgrowingbar[#1]% + {\vpack to \vsize + {\hsize\positionbarparameter\c!width + \setuppositionbar[#1]% + \usepositionbarstyleandcolor\c!style\c!color + \hrule\s!width\positionbarparameter\c!width\s!height\zeropoint\s!depth\zeropoint + \leaders\hrule\vskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill + \vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill + \vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}} + +\protect \endinput |