| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
%%% This file is a copy of some part of PGF/Tikz. |
| 3 |
%%% It has been copied here to provide : |
| 4 |
%%% - compatibility with older PGF versions |
| 5 |
%%% - availability of PGF contributions by Christian Feuersaenger |
| 6 |
%%% which are necessary or helpful for pgfplots. |
| 7 |
%%% |
| 8 |
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND |
| 9 |
%%% PGF parts. The copyrights are as they appear in PGF. |
| 10 |
%%% |
| 11 |
%%% Note that pgfplots has compatible licenses. |
| 12 |
%%% |
| 13 |
%%% This copy has been modified in the following ways: |
| 14 |
%%% - nested \input commands have been updated |
| 15 |
%%% |
| 16 |
% |
| 17 |
% Support for the contents of this file will NOT be done by the PGF/TikZ team. |
| 18 |
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction |
| 19 |
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything: |
| 20 |
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help. |
| 21 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 |
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
% Copyright 2006 by Till Tantau |
| 27 |
% |
| 28 |
% This file may be distributed and/or modified |
| 29 |
% |
| 30 |
% 1. under the LaTeX Project Public License and/or |
| 31 |
% 2. under the GNU Public License. |
| 32 |
% |
| 33 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 34 |
|
| 35 |
\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.5 2012/11/07 19:23:16 ludewich Exp $ |
| 36 |
|
| 37 |
|
| 38 |
% Creates a new pgf layer |
| 39 |
% |
| 40 |
% #1 = layer name |
| 41 |
% |
| 42 |
% Declares a new layer for pgf. |
| 43 |
% |
| 44 |
% Example: |
| 45 |
% |
| 46 |
% \pgfdeclarelayer{background} |
| 47 |
|
| 48 |
\def\pgfdeclarelayer#1{% |
| 49 |
\pgfutil@ifundefined{pgf@layerbox@#1}{% |
| 50 |
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerbox@#1\endcsname% |
| 51 |
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerboxsaved@#1\endcsname% |
| 52 |
}{}% |
| 53 |
} |
| 54 |
\let\pgf@newbox=\newbox % avoid plain TeX outer problem |
| 55 |
|
| 56 |
% Sets the layers that compose the picture |
| 57 |
% |
| 58 |
% #1 = List of layers |
| 59 |
% |
| 60 |
% Description: |
| 61 |
% |
| 62 |
% Sets the list of layers that make up the picture. The layers will be |
| 63 |
% put on top of each other in the order given. |
| 64 |
% |
| 65 |
% This command can also be given inside of a picture in which case it |
| 66 |
% applies only to that very picture. |
| 67 |
% |
| 68 |
% Example: |
| 69 |
% |
| 70 |
% \pgfsetlayers{background,main} |
| 71 |
|
| 72 |
\def\pgfsetlayers#1{\edef\pgf@layerlist{#1}} |
| 73 |
\pgfsetlayers{main} |
| 74 |
|
| 75 |
% Adds code to a layer |
| 76 |
% |
| 77 |
% #1 = layer name |
| 78 |
% |
| 79 |
% Note: |
| 80 |
% |
| 81 |
% You cannot add anything to the ``main'' layer using this command. |
| 82 |
% |
| 83 |
% Example: |
| 84 |
% |
| 85 |
% \begin{pgfonlayer}{background} |
| 86 |
% \fill[red] (0,0) -- (1,1); |
| 87 |
% \end{pgfonlayer} |
| 88 |
|
| 89 |
\def\pgfonlayer@name{main} |
| 90 |
|
| 91 |
\def\pgfonlayer#1{% |
| 92 |
\pgfutil@ifundefined{pgf@layerbox@#1}{% |
| 93 |
\PackageError{pgf}{Sorry, the requested layer '#1' could not be found. Maybe you misspelled it?}{}% |
| 94 |
\bgroup |
| 95 |
\begingroup |
| 96 |
}{% |
| 97 |
\begingroup |
| 98 |
\edef\pgf@temp{#1}% |
| 99 |
\ifx\pgf@temp\pgfonlayer@name |
| 100 |
% we are already on this layer. |
| 101 |
\def\pgf@temp{% |
| 102 |
\bgroup |
| 103 |
\begingroup |
| 104 |
}% |
| 105 |
\else |
| 106 |
\let\pgfonlayer@name=\pgf@temp |
| 107 |
\pgfonlayer@assert@is@active |
| 108 |
\def\pgf@temp{% |
| 109 |
\expandafter\global\expandafter% |
| 110 |
\setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt% |
| 111 |
\bgroup% |
| 112 |
\expandafter\box\csname pgf@layerbox@#1\endcsname% |
| 113 |
\begingroup% |
| 114 |
}% |
| 115 |
\fi |
| 116 |
\pgf@temp |
| 117 |
}% |
| 118 |
} |
| 119 |
\def\endpgfonlayer{% |
| 120 |
\endgroup% |
| 121 |
\hss |
| 122 |
\egroup% |
| 123 |
\endgroup |
| 124 |
} |
| 125 |
|
| 126 |
\let\startpgfonlayer=\pgfonlayer |
| 127 |
\let\stoppgfonlayer=\endpgfonlayer |
| 128 |
|
| 129 |
\def\pgfdiscardlayername{discard} |
| 130 |
|
| 131 |
\def\pgfonlayer@assert@is@active{% |
| 132 |
\ifx\pgfonlayer@name\pgfdiscardlayername |
| 133 |
% this special layer name can be used as /dev/null without |
| 134 |
% warning. |
| 135 |
\else |
| 136 |
\begingroup |
| 137 |
\def\pgfonlayer@isactive{0}% |
| 138 |
\expandafter\pgf@assert@layer@is@active@loop\pgf@layerlist,,\relax% |
| 139 |
\if0\pgfonlayer@isactive |
| 140 |
\pgfonlayer@assert@fail |
| 141 |
\fi |
| 142 |
\endgroup |
| 143 |
\fi |
| 144 |
}% |
| 145 |
\def\pgfonlayer@assert@fail{% |
| 146 |
\PackageError{pgf}{Sorry, the requested layer '\pgfonlayer@name' is not |
| 147 |
part of the layer list. Please verify that you provided |
| 148 |
\string\pgfsetlayers\space and that '\pgfonlayer@name' is part of this list}{}% |
| 149 |
}% |
| 150 |
\def\pgf@assert@layer@is@active@loop#1,#2,\relax{% |
| 151 |
\edef\pgf@test{#1}% |
| 152 |
\ifx\pgf@test\pgfonlayer@name |
| 153 |
\def\pgfonlayer@isactive{1}% |
| 154 |
\else |
| 155 |
\def\pgf@test{#2}% |
| 156 |
\ifx\pgf@test\pgfutil@empty% |
| 157 |
\else% |
| 158 |
\pgf@assert@layer@is@active@loop#2,\relax% |
| 159 |
\fi% |
| 160 |
\fi |
| 161 |
} |
| 162 |
|
| 163 |
% Hooks into the scoping: |
| 164 |
|
| 165 |
\def\pgf@insertlayers{% |
| 166 |
\expandafter\pgf@dolayer\pgf@layerlist,,\relax% |
| 167 |
} |
| 168 |
\def\pgf@maintext{main}% |
| 169 |
\def\pgf@dolayer#1,#2,\relax{% |
| 170 |
\def\pgf@test{#1}% |
| 171 |
\ifx\pgf@test\pgf@maintext% |
| 172 |
\box\pgf@layerbox@main% |
| 173 |
\else% |
| 174 |
\pgfsys@beginscope% |
| 175 |
\expandafter\box\csname pgf@layerbox@#1\endcsname% |
| 176 |
\pgfsys@endscope% |
| 177 |
\fi% |
| 178 |
\def\pgf@test{#2}% |
| 179 |
\ifx\pgf@test\pgfutil@empty% |
| 180 |
\else% |
| 181 |
\pgf@dolayer#2,\relax% |
| 182 |
\fi% |
| 183 |
} |
| 184 |
|
| 185 |
\def\pgf@savelayers{% |
| 186 |
\expandafter\pgf@dosavelayer\pgf@layerlist,,\relax% |
| 187 |
} |
| 188 |
\def\pgf@dosavelayer#1,#2,\relax{% |
| 189 |
\def\pgf@test{#1}% |
| 190 |
\ifx\pgf@test\pgf@maintext% |
| 191 |
\else% |
| 192 |
\setbox\csname pgf@layerboxsaved@#1\endcsname=\box\csname pgf@layerbox@#1\endcsname% |
| 193 |
\fi% |
| 194 |
\def\pgf@test{#2}% |
| 195 |
\ifx\pgf@test\pgfutil@empty% |
| 196 |
\else% |
| 197 |
\pgf@dosavelayer#2,\relax% |
| 198 |
\fi% |
| 199 |
} |
| 200 |
|
| 201 |
\def\pgf@restorelayers{% |
| 202 |
\expandafter\pgf@dorestorelayer\pgf@layerlist,,\relax% |
| 203 |
} |
| 204 |
\def\pgf@dorestorelayer#1,#2,\relax{% |
| 205 |
\def\pgf@test{#1}% |
| 206 |
\ifx\pgf@test\pgf@maintext% |
| 207 |
\else% |
| 208 |
\global\setbox\csname pgf@layerbox@#1\endcsname=\box\csname pgf@layerboxsaved@#1\endcsname% |
| 209 |
\fi% |
| 210 |
\def\pgf@test{#2}% |
| 211 |
\ifx\pgf@test\pgfutil@empty% |
| 212 |
\else% |
| 213 |
\pgf@dorestorelayer#2,\relax% |
| 214 |
\fi% |
| 215 |
} |
| 216 |
|
| 217 |
\endinput |