summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex161
1 files changed, 130 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
index f0b862575b7..bad6e237ecb 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex
@@ -1,9 +1,13 @@
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.12 2005/11/15 17:46:37 tantau Exp $
-
-% Copyright 2005 by Till Tantau <tantau@cs.tu-berlin.de>.
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
%
-% This program can be redistributed and/or modified under the terms
-% of the GNU Public License, version 2.
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.18 2006/10/11 15:22:25 tantau Exp $
% Globals
@@ -12,6 +16,61 @@
\newbox\pgf@layerbox@main
+\newcount\pgf@picture@serial@count
+
+
+
+% This if decides whether the position of pictures on the page is
+% protocolled or not. Normally,
+% this is switched off as it works only with certain drivers and it
+% causes external files to be written. When switched on, the position
+% of pgfpictures are protocolled and can be referenced using
+% \pgfsys@getposition{XXX} where XXX is the value of \pgfpictureid
+% inside the picture.
+\newif\ifpgfrememberpicturepositiononpage
+
+
+
+% Library files inclusion
+
+
+% Include a library file.
+%
+% #1 = List of names of library file.
+%
+% Description:
+%
+% This command includes a list of library files. For each file X in the
+% list, the file pgflibraryX.code.tex is included, provided this has
+% not been done earlier.
+%
+% For the convenience of Context users, both round and square brackets
+% are possible for the argument.
+%
+% Example:
+%
+% \usepgflibrary{arrows}
+% \usepgflibrary[patterns,snakes]
+
+\def\usepgflibrary{\pgf@ifnextchar[{\use@pgflibrary}{\use@@pgflibrary}}%}
+\def\use@pgflibrary[#1]{\use@@pgflibrary{#1}}
+\def\use@@pgflibrary#1{%
+ \edef\pgf@list{#1}%
+ \@for\pgf@temp:=\pgf@list\do{%
+ \expandafter\ifx\csname pgf@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\let\csname pgf@library@\pgf@temp @loaded\endcsname=\pgf@empty%
+ \expandafter\edef\csname pgf@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname pgf@library@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \input pgflibrary\pgf@temp.code.tex
+ \catcode`\@=\csname pgf@library@#1@atcode\endcsname
+ \catcode`\|=\csname pgf@library@#1@barcode\endcsname
+ \fi%
+ }%
+}
+
+
% Scopes
@@ -27,7 +86,7 @@
% \end{pgfscope}
\def\pgfscope{%
- \pgfsyssoftpath@setcurrentpath\@empty%
+ \pgfsyssoftpath@setcurrentpath\pgf@empty%
\pgfsys@beginscope%
\pgf@resetpathsizes%
\edef\pgfscope@linewidth{\the\pgflinewidth}%
@@ -86,7 +145,7 @@
% \pgftransformshift{\pgfpoint{1cm}{0cm}}
% \pgftext{Hello World!}
-\def\pgftext{\@ifnextchar[\pgf@text{\pgf@text[]}}%
+\def\pgftext{\pgf@ifnextchar[\pgf@text{\pgf@text[]}}%
\def\pgf@text[#1]{%
\def\pgf@text@options{#1}%
\pgf@maketext\pgf@after@text}
@@ -141,7 +200,7 @@
\let\next=%
}
\def\pgf@collectresetcolor{%
- \@ifnextchar\reset@color%
+ \pgf@ifnextchar\reset@color%
{\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}%
{\pgf@textdone}%
}
@@ -157,7 +216,6 @@
#1%
\endpgfinterruptpicture%
}}}
-
@@ -176,14 +234,16 @@
\def\pgfpicture{%
\begingroup%
- \pgfpicturetrue%
- \pgf@picmaxx=-16000pt\relax%
- \pgf@picminx=16000pt\relax%
- \pgf@picmaxy=-16000pt\relax%
- \pgf@picminy=16000pt\relax%
- \pgf@relevantforpicturesizetrue%
- \pgf@resetpathsizes%
- \@ifnextchar\bgroup\pgf@oldpicture\pgf@picture}
+ \pgfpicturetrue%
+ \global\advance\pgf@picture@serial@count by1\relax%
+ \edef\pgfpictureid{pgfid@\the\pgf@picture@serial@count}%
+ \pgf@picmaxx=-16000pt\relax%
+ \pgf@picminx=16000pt\relax%
+ \pgf@picmaxy=-16000pt\relax%
+ \pgf@picminy=16000pt\relax%
+ \pgf@relevantforpicturesizetrue%
+ \pgf@resetpathsizes%
+ \pgf@ifnextchar\bgroup\pgf@oldpicture\pgf@picture}
\def\pgf@oldpicture#1#2#3#4{%
\setlength\pgf@picminx{#1}%
\setlength\pgf@picminy{#2}%
@@ -198,10 +258,10 @@
\pgfsys@beginpicture%
\pgfsys@beginscope%
\begingroup%
- \color{.}%
+ \pgfsetcolor{.}%
\pgfsetlinewidth{0.4pt}%
\pgftransformreset%
- \pgfsyssoftpath@setcurrentpath\@empty%
+ \pgfsyssoftpath@setcurrentpath\pgf@empty%
\begingroup%
\let\pgf@setlengthorig=\setlength%
\let\pgf@addtolengthorig=\addtolength%
@@ -214,8 +274,21 @@
\begingroup%
}
\def\endpgfpicture{%
+ \ifpgfrememberpicturepositiononpage%
+ \hbox to0pt{\pgfsys@markposition{\pgfpictureid}}%
+ \fi%
+ % ok, now let's position the box
+ \ifdim\pgf@picmaxx=-16000pt\relax%
+ % empty picture. make size 0.
+ \global\pgf@picmaxx=0pt\relax%
+ \global\pgf@picminx=0pt\relax%
+ \global\pgf@picmaxy=0pt\relax%
+ \global\pgf@picminy=0pt\relax%
+ \fi%
% Shift baseline outside:
- \global\let\pgf@shift@baseline=\pgf@baseline%
+ \pgf@relevantforpicturesizefalse%
+ \pgf@process{\pgf@baseline}%
+ \gdef\pgf@shift@baseline{\the\pgf@y}%
\endgroup%
\hss%
\egroup%
@@ -228,14 +301,6 @@
\endgroup%
\hss
\egroup%
- % ok, now let's position the box
- \ifdim\pgf@picmaxx=-16000pt\relax%
- % empty picture. make size 0.
- \pgf@picmaxx=0pt\relax%
- \pgf@picminx=0pt\relax%
- \pgf@picmaxy=0pt\relax%
- \pgf@picminy=0pt\relax%
- \fi%
\pgfsys@typesetpicturebox\pgfpic%
\endgroup%
}
@@ -245,6 +310,41 @@
}
+
+
+% Sets the baseline at the y-coordinate of a given point
+%
+% #1 = point
+%
+% Sets the baseline of the picture to the y-coordinate of a given
+% point. However, the point will be evaluated *at the end of the
+% picture*.
+%
+% Example:
+%
+% \pgfsetbaselinepointlater{\pgfpointanchor{mynode}{base}}
+
+\def\pgfsetbaselinepointlater#1{\def\pgf@baseline{#1}}
+
+
+% Sets the baseline at the y-coordinate of a given point, now
+%
+% #1 = point
+%
+% Sets the baseline of the picture to the y-coordinate of a given
+% point.
+%
+% Example:
+%
+% \pgfsetbaselinepointnow{\pgfpoint{1cm}{2pt}}
+
+\def\pgfsetbaselinepointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsetbaselinepointlater{\pgf@setter@baseline}%
+}
+
+
% Sets the baseline
%
% #1 = baseline
@@ -256,13 +356,12 @@
%
% \pgfsetbaseline{1cm+2pt}
-\def\pgfsetbaseline#1{\def\pgf@baseline{#1}}
+\def\pgfsetbaseline#1{\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}}
\pgfsetbaseline{\pgf@picminy}
-
% Interrupt path
%
% Description:
@@ -291,7 +390,7 @@
\edef\pgf@interrupt@savey{\the\pgf@path@lasty}%
\pgf@getpathsizes\pgf@interrupt@pathsizes%
\pgfsyssoftpath@getcurrentpath\pgf@interrupt@path%
- \pgfsyssoftpath@setcurrentpath\@empty%
+ \pgfsyssoftpath@setcurrentpath\pgf@empty%
\edef\pgfscope@linewidth{\the\pgflinewidth}%
\let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto%
\begingroup%