summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2011-09-04 08:53:07 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2011-09-04 08:53:07 +0000
commit447de1ea6569d6f08f37e330c961f21606c82252 (patch)
tree998336cdb9b8fba9486612218548b1d2da8795b6 /Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex
parentc81271744b808935ae2c1fd5f30fbddd69a1e970 (diff)
relocate context-gantt
git-svn-id: svn://tug.org/texlive/trunk@23789 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex')
-rw-r--r--Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex370
1 files changed, 0 insertions, 370 deletions
diff --git a/Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex b/Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex
deleted file mode 100644
index f41f534ec29..00000000000
--- a/Master/texmf-dist/doc/latex/context-gantt/tex/context/third/gantt/gantt-s-mp.tex
+++ /dev/null
@@ -1,370 +0,0 @@
-%D \module
-%D [ file=t-gantt,
-%D version=2011.08.27,
-%D title=\CONTEXT\ User Module,
-%D subtitle=Drawing gantt diagrams,
-%D author={Adam Reviczky},
-%D date=\currentdate,
-%D copyright=Adam Reviczky,
-%D license=Public Domain]
-
-%D Some macros for drawing gantt diagrams using MetaPost.
-%D
-%D Adam Reviczky, 27.08.2011 (Version 3.2)
-
-\writestatus{loading}{ConTeXt User Module / Drawing gantt diagrams}
-
-\startmodule[gantt-s-mp]
-\unprotect
-
-\def\????gantt{@@@@gantt}
-
-\definesystemvariable{gantt}
-
-\startMPinclusions
- % temporary solution for a pattern substitute
- input mp-hatching;
-\stopMPinclusions
-
-\newcount\ganttnum
-\newcount\gantttitlenum
-\newcount\ganttwidth
-
-\newdimen\ganttlastx \ganttlastx = 0cm
-\newdimen\nextganttlastx
-\newdimen\titleunitlength \titleunitlength = 1cm
-\newdimen\ganttunitlength \ganttunitlength = 1cm
-
-\newdimen\gantttmpa
-\newdimen\gantttmpb
-
-% workaround for titleelement
-\def\!!row{\numexpr\ganttnum*-1\relax}
-
-\def\setupgantt
- {\bgroup
- \catcode`\#=\@@other
- \dosingleempty
- \dosetupgantt}
-
-\def\dosetupgantt[#1]%
- {\egroup
- \getparameters[\??gantt][#1]}
-
-\setupgantt
- [sx=1,
- sy=1,
- xunitlength=1cm,
- fontsize=\tf,
- titlefontsize=\tfx,
- drawledgerline=false]
-
-\def\setupganttbar
- {\bgroup
- \catcode`\#=\@@other
- \dosingleempty
- \dosetupganttbar}
-
-\def\dosetupganttbar[#1]%
- {\egroup
- \getparameters[\??gantt][#1]}
-
-\setupganttbar
- [pattern=north east lines,
- color=black]
-
-% The gantt environment draws the canvas of a gantt figure (realized as tikzpicture)
-% The usage is \startgantt[...]{no of Tasks to plot}{no of time slots}
-% The optional argument [...] can be filled in a key=value syntax, using one or more of the following keys:
-%
-% xunitlength - length of one time slot (default: 1cm)
-% fontsize - fontsize of labels (default: \tf)
-% titlefontsize - fontsize of title section (default: \tfx)
-% drawledgerline - Switch to enable/disable the drawing of horizontal ledger lines (default value: false)
-\long\def\dostartgantt[#1]#2#3%
- {\getparameters[\??gantt][#1]%
- \gdef\v!sx{\@@ganttsx}
- \gdef\v!sy{\@@ganttsy}
- \gdef\v!ganttunitlength{\@@ganttxunitlength}
- \gdef\v!fontsize{\getvalue{@@ganttfontsize}}
- \gdef\v!titlefontsize{\getvalue{@@gantttitlefontsize}}
- \gdef\v!drawledgerline{\@@ganttdrawledgerline}
-
- \bgroup
- \newcount\ganttx \ganttx=0
- \newcount\ganttheight
-
- \def\ganttxstringtop{}
- \def\ganttxstringbottom{}
-
- \global\ganttwidth=#3
- \global\ganttnum=0
-
- \ganttheight=#2
- \advance\ganttheight by 1
-
- \startMPdrawing
- linecap := squared;
- linejoin := mitered;
-
- draw (0,0.5cm)--(0,1.4cm-\the\ganttheight*cm);
- draw (\the\ganttwidth*\v!ganttunitlength,0.5cm)--(\the\ganttwidth*\v!ganttunitlength,1.4cm-\the\ganttheight*cm);
- % draw x axis
- draw (0cm,-#2*cm+0.4cm)--(\the\ganttwidth*\v!ganttunitlength,-#2*cm+0.4cm);
-
- % draw grid
- for t=1 upto \the\ganttwidth:
- draw (\v!ganttunitlength*t,-0.5cm)--(\v!ganttunitlength*t,1.4cm-\the\ganttheight*cm) dashed withdots;
- endfor
- \stopMPdrawing
- \egroup
- }
-
-\def\startgantt%
- {\dosingleempty\dostartgantt}
-
-\def\stopgantt%
- {\startMPdrawing
- % debug
- % draw bbox currentpicture withcolor .625red;
- \stopMPdrawing
- \scale[sx=\v!sx,sy=\v!sy]{\MPdrawingdonetrue\getMPdrawing}
- }
-
-% ganttitle is the environment for drawing the title section
-\definestartstop[ganttitle][
- before={
- \ganttlastx = 0cm
- },
- after={
- \ganttlastx = 0cm
- \doglobal\decrement\ganttnum
- }
- ]
-
-% \titleelement draws one element of the title
-% usage: \titleelement{label}{length}
-\long\def\dotitleelement#1#2%
- {\gantttmpa=\dimexpr\v!ganttunitlength*#2\relax
- \divide\gantttmpa by 2
-
- \startMPdrawing
- draw (\the\ganttlastx,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\v!ganttunitlength,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\v!ganttunitlength,0.5cm-0.6cm-\the\!!row*cm)--(\the\ganttlastx,0.5cm-0.6cm-\the\!!row*cm)--cycle;
- path diam; diam = (\the\ganttlastx,0.5cm-\the\!!row*cm)--(\the\ganttlastx+#2*\v!ganttunitlength,0.5cm-0.6cm-\the\!!row*cm);
- label (btex \getvalue{v!titlefontsize} #1 etex, center diam);
- \stopMPdrawing
-
- \ganttlastx=\dimexpr\ganttlastx+\v!ganttunitlength*#2\relax
- }
-
-\def\titleelement%
- {\dotitleelement}
-
-% \numtitle draws a numbered sequence of title elements
-% usage: \numtitle{start number}{increment}{end number}{length of each title element}
-\long\def\donumtitle#1#2#3#4%
- {\gantttitlenum=#1
- \dostepwiserecurse{#1}{#3}{#2}{
- \titleelement{\the\gantttitlenum}{#4}
- \advance\gantttitlenum by #2
- }
- }
-
-\def\numtitle%
- {\donumtitle}
-
-% \ganttbar draws a single, unconnected bar for representing a task
-% usage: \ganttbar[pattern=<pattern>,color=<color>]{label}{start}{length}
-% where the optional comma separated arguments are:
-% pattern - not implemented with MetaPost yet! (FIXME)
-% color - a color of the pattern (e.g. red, green blue gray, dark gray)
-\long\def\doganttbar[#1]#2#3#4%
- {\bgroup
- \getparameters[\??gantt][#1]%
- \edef\v!pattern{\@@ganttpattern}
- \edef\v!color{\@@ganttcolor}
-
- \gantttmpa=\dimexpr\v!ganttunitlength*#3\relax
- \gantttmpb=\dimexpr\v!ganttunitlength*#4+\gantttmpa\relax
-
- \doif{\v!drawledgerline}{true}{
- \startMPdrawing
- draw (0,\ganttnum*cm-0.2cm)--(\the\ganttwidth*\v!ganttunitlength,\ganttnum*cm-0.2cm) dashed withdots;
- \stopMPdrawing
- }
- \startMPdrawing
- path diag; diag = (0,\ganttnum*cm+0.1cm)--(0,\ganttnum*cm+0.5cm);
- label.lft (btex \getvalue{v!fontsize} #2 etex, center diag);
- path f; f := (\the\gantttmpa,\ganttnum*cm+0.1cm)--(\the\gantttmpb,\ganttnum*cm+0.1cm)--(\the\gantttmpb,\ganttnum*cm+0.5cm)--(\the\gantttmpa,\ganttnum*cm+0.5cm)--cycle;
-
- hatchoptions(withcolor \v!color);
- draw f withcolor black;
- % workaround for transparent bug
- % hatchfill f withcolor transparent("normal",0,white) withcolor (45,1mm,-0.5bp);
- hatchfill f withcolor (45,1mm,-0.5bp);
- \stopMPdrawing
-
- \global\ganttlastx=\gantttmpb
- \doglobal\decrement\ganttnum
- \egroup
- }
-
-\def\ganttbar
- {\dosingleempty\doganttbar}
-
-% \ganttcon draws an arrow between to bars with specified coordinates
-% usage: \ganttcon{startx}{starty}{endx}{endy}
-\long\def\doganttcon#1#2#3#4%
- {\bgroup
- \startMPdrawing
- begingroup;
- interim linecap := squared;
- interim linejoin := rounded;
-
- drawarrow (#1*\v!ganttunitlength,-#2*cm+0.1cm+0.2cm)--(#1*\v!ganttunitlength+0.4*\v!ganttunitlength,-#2*cm+0.1*cm+0.2*cm)--(#1*\v!ganttunitlength+0.4*\v!ganttunitlength,-#2*cm-0.4*cm+0.2*cm)--(#1*\v!ganttunitlength-0.4*\v!ganttunitlength,-#2*cm-0.4*cm+0.2*cm)--(#1*\v!ganttunitlength-0.4*\v!ganttunitlength,-#4*cm+0.1*cm+0.2*cm)--(#3*\v!ganttunitlength,-#4*cm+0.1*cm+0.2*cm);
- endgroup;
- \stopMPdrawing
- \egroup
- }
-
-\def\ganttcon
- {\doganttcon}
-
-% \ganttbarcon draws a single bar *and* connects the bar with the previous bar for
-% consecutive tasks
-% usage: \ganttbarcon[pattern=<pattern>,color=<color>]{label}{start}{length}
-% where the optional pattern argument are the same as for \ganttbar
-\long\def\doganttbarcon[#1]#2#3#4%
- {\bgroup
- \getparameters[\??gantt][#1]%
- \edef\v!pattern{\@@ganttpattern}
- \edef\v!color{\@@ganttcolor}
-
- \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax
- \ifdim\nextganttlastx>\dimexpr\v!ganttunitlength*#3\relax
- \startMPdrawing
- begingroup;
- interim linecap := squared;
- interim linejoin := rounded;
-
- drawarrow (\the\ganttlastx,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\v!ganttunitlength,\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\v!ganttunitlength,\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\v!ganttunitlength,\ganttnum*cm+0.1*cm+0.2*cm);
- endgroup;
- \stopMPdrawing
- \else
- \startMPdrawing
- begingroup;
- interim linecap := squared;
- interim linejoin := rounded;
-
- drawarrow (\the\ganttlastx,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\v!ganttunitlength,\ganttnum*cm+0.1*cm+0.2*cm);
- endgroup;
- \stopMPdrawing
- \fi
-
- \ganttbar[#1]{#2}{#3}{#4}
- \egroup
- }
-
-\def\ganttbarcon
- {\dosingleempty\doganttbarcon}
-
-% \ganttgroup draws a bar to group tasks
-% usage: \ganttgroup{label}{start}{length}
-\long\def\doganttgroup#1#2#3%
- {\bgroup
- \gantttmpa=\dimexpr\v!ganttunitlength*#2\relax
- \gantttmpb=\dimexpr\v!ganttunitlength*#3+\gantttmpa\relax
-
- \doif{\v!drawledgerline}{true}{
- \startMPdrawing
- draw (0,\ganttnum*cm-0.2cm)--(\the\ganttwidth*\v!ganttunitlength,\ganttnum*cm-0.2cm) dashed withdots;
- \stopMPdrawing
- }
- \startMPdrawing
- pen diamond; diamond := makepen fulldiamond;
- path diag; diag = (0,\ganttnum*cm+0.1cm)--(0,\ganttnum*cm+0.5cm);
- label.lft (btex \getvalue{v!fontsize}\bf #1 etex, center diag);
- fill (\the\gantttmpa-0.14*cm,\ganttnum*cm+0.2cm)--(\the\gantttmpb+0.14*cm,\ganttnum*cm+0.2cm)--(\the\gantttmpb+0.14*cm,\ganttnum*cm+0.4cm)--(\the\gantttmpa-0.14*cm,\ganttnum*cm+0.4cm)--cycle withcolor black;
- fill fulldiamond scaled 0.3cm shifted (\the\gantttmpa+0.01cm,\ganttnum*cm+0.2cm) withcolor black;
- fill fulldiamond scaled 0.3cm shifted (\the\gantttmpb-0.01cm,\ganttnum*cm+0.2cm) withcolor black;
- \stopMPdrawing
-
- \global\ganttlastx=\gantttmpb
- \doglobal\decrement\ganttnum
- \egroup
- }
-
-\def\ganttgroup
- {\doganttgroup}
-
-% \ganttmilestone, draw a diamond to represent a milestone
-% usage: \ganttgroup[color=<color>]{label}{start}
-% color - a tikz color of the pattern (e.g. red, green blue gray, dark gray)
-% for more information see the tikz documentation
-
-% Declaring layers to abvoid superposition when you connect a \ganttmileston with a task
-\long\def\doganttmilestone[#1]#2#3%
- {\bgroup
- \getparameters[\??gantt][#1]%
- \edef\v!color{\@@ganttcolor}
-
- \gantttmpa=\dimexpr\v!ganttunitlength*#3\relax
- \gantttmpb=\dimexpr\v!ganttunitlength*0+\gantttmpa\relax
-
- \doif{\v!drawledgerline}{true}{
- \startMPdrawing
- draw (0,\ganttnum*cm-0.2cm)--(\the\ganttwidth*\v!ganttunitlength,\ganttnum*cm-0.2cm) dashed withdots;
- \stopMPdrawing
- }
- \startMPdrawing
- pen diamond; diamond := makepen fulldiamond;
- path diag; diag = (0,\ganttnum*cm+0.1cm)--(0,\ganttnum*cm+0.5cm);
- label.lft (btex \getvalue{v!fontsize} #2 etex, center diag);
- fill fulldiamond scaled 0.3cm shifted (\the\gantttmpb,\ganttnum*cm+0.3cm) withcolor \v!color;
- \stopMPdrawing
-
- \global\ganttlastx=\gantttmpb
- \doglobal\decrement\ganttnum
- \egroup
- }
-
-\def\ganttmilestone
- {\dosingleempty\doganttmilestone}
-
-% \ganttmilestonecon draws a single diamond *and* connects the diamond with the previous task
-% usage: \ganttmilestonecon[color=<color>]{label}{start}{length}
-% where the optional color argument are the same as for \ganttbar and \ganttmilestone
-\long\def\doganttmilestonecon[#1]#2#3%
- {\bgroup
- \getparameters[\??gantt][#1]%
- \edef\v!color{\@@ganttcolor}
-
- \nextganttlastx = \dimexpr\ganttlastx+\ganttunitlength*1\relax
- \ifdim\nextganttlastx>\dimexpr\v!ganttunitlength*#3\relax
- \startMPdrawing
- begingroup;
- interim linecap := squared;
- interim linejoin := rounded;
-
- drawarrow (\the\ganttlastx,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\v!ganttunitlength-0.14*cm,\ganttnum*cm+0.6*cm+0.2*cm)--(\the\ganttlastx-0.4*\v!ganttunitlength-0.14*cm,\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\v!ganttunitlength-0.14*cm,\ganttnum*cm+0.1*cm+0.2*cm);
- endgroup;
- \stopMPdrawing
- \else
- \startMPdrawing
- begingroup;
- interim linecap := squared;
- interim linejoin := rounded;
-
- drawarrow (\the\ganttlastx,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+1.1*cm+0.2*cm)--(\the\ganttlastx+0.4*\v!ganttunitlength,\ganttnum*cm+0.1*cm+0.2*cm)--(#3*\v!ganttunitlength-0.14*cm,\ganttnum*cm+0.1*cm+0.2*cm);
- endgroup;
- \stopMPdrawing
- \fi
-
- \ganttmilestone[#1]{#2}{#3}
- \egroup
- }
-
-\def\ganttmilestonecon
- {\dosingleempty\doganttmilestonecon}
-
-\protect \stopmodule