diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex | 116 |
1 files changed, 68 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex index 5535010cbbb..dc9f660d0c2 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfbaseshapes.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaseshapes.code.tex,v 1.16 2006/10/16 22:32:58 tantau Exp $ +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfbaseshapes.code.tex,v 1.19 2007/06/07 07:41:10 tantau Exp $ \newbox\pgfnodeparttextbox @@ -28,12 +28,12 @@ % pgf's transformation matrix prior to calling this command. % % When this command is called, the shape-specific TeX boxes of the -% node must be have been setup correctly. +% node must have been setup correctly. % % Example: % % \pgftransformshift{\pgfpoint{1cm}{1cm}} -% \pgfmultipartnode{rectangle}{center}{Hello}{hellonode}{\pgfusepath{stroke}} +% \pgfmultipartnode{rectangle}{center}{hellonode}{\pgfusepath{stroke}} \def\pgfmultipartnode#1#2#3#4{% \pgfutil@ifundefined{pgf@sh@s@#1}% @@ -79,11 +79,31 @@ {\csname pgf@sh@fg@#1\endcsname#4}% \pgfutil@ifundefined{pgf@sh@ffg@#1}{}% {{\pgfscope\csname pgf@sh@ffg@#1\endcsname\endpgfscope}}% + \pgf@nodecallback{#3}% }% }% } +\def\pgf@shift@node#1#2{% + % This internal command shifts the recorded coordinates for node #1 + % by the vector #2. It is used to + % correct the position of the node if the recorded coordinate + % happens to be wrong + {% + \pgfsettransform{\csname pgf@sh@nt@#1\endcsname}% + \pgf@process{#2}% + \advance\pgf@pt@x by\pgf@x% + \advance\pgf@pt@y by\pgf@y% + \pgfgettransform{\pgf@temp}% + \expandafter\xdef\csname pgf@sh@nt@#1\endcsname{\pgf@temp}% + }% +} + +\let\pgf@nodecallback=\pgfutil@gobble + + + % Creates a node % % #1 = shape type @@ -120,7 +140,7 @@ \pgf@process{#2}% \edef\pgf@sh@marshal{% \noexpand\pgfutil@g@addto@macro\noexpand\pgf@sh@savedpoints{% - \noexpand\def\noexpand#1{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + \noexpand\def\noexpand#1{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% }}% \pgf@sh@marshal% } @@ -139,8 +159,8 @@ \def\pgf@sh@reanchor#1#2{% \pgfutil@ifundefined{pgf@anchor@#1@#2}% {% - \pgflatex@setcounter{pgf@counta}{#2}% - \csname pgf@anchor@#1@border\endcsname{\pgfpointpolar{\c@pgf@counta}{1pt}}% + \pgfmathsetcounter{pgf@counta}{#2}% + \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\c@pgf@counta}{1pt}}% }% {\csname pgf@anchor@#1@#2\endcsname}% } @@ -243,7 +263,7 @@ \pgf@process{\pgf@shape@interpictureshift{#1}}%% \advance\pgf@xa by-\pgf@x% \advance\pgf@ya by-\pgf@y% - \csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @border\endcsname{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \csname pgf@anchor@\csname pgf@sh@ns@#1\endcsname @border\endcsname{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \pgfsettransform{\csname pgf@sh@nt@#1\endcsname}% \pgf@pos@transform{\pgf@x}{\pgf@y}% \global\pgf@x=\pgf@x% @@ -523,9 +543,9 @@ % % First, is width < minimum width? \pgf@x=\the\wd\pgfnodeparttextbox% - \setlength\pgf@xc{\pgfshapeinnerxsep}% + \pgfmathsetlength\pgf@xc{\pgfshapeinnerxsep}% \advance\pgf@x by 2\pgf@xc% - \setlength\pgf@xb{\pgfshapeminwidth}% + \pgfmathsetlength\pgf@xb{\pgfshapeminwidth}% \ifdim\pgf@x<\pgf@xb% % yes, too small. Enlarge... \pgf@x=\pgf@xb% @@ -533,16 +553,16 @@ % Now, calculate right border: .5\wd\pgfnodeparttextbox + .5 \pgf@x + outer sep \pgf@x=.5\pgf@x% \advance\pgf@x by.5\wd\pgfnodeparttextbox% - \setlength\pgf@xa{\pgfshapeouterxsep}% + \pgfmathsetlength\pgf@xa{\pgfshapeouterxsep}% \advance\pgf@x by\pgf@xa% % Calculate y % % First, is height+depth < minimum height? \pgf@y=\ht\pgfnodeparttextbox% \advance\pgf@y by\dp\pgfnodeparttextbox% - \setlength\pgf@yc{\pgfshapeinnerysep}% + \pgfmathsetlength\pgf@yc{\pgfshapeinnerysep}% \advance\pgf@y by 2\pgf@yc% - \setlength\pgf@yb{\pgfshapeminheight}% + \pgfmathsetlength\pgf@yb{\pgfshapeminheight}% \ifdim\pgf@y<\pgf@yb% % yes, too small. Enlarge... \pgf@y=\pgf@yb% @@ -551,7 +571,7 @@ \pgf@y=.5\pgf@y% \advance\pgf@y by-.5\dp\pgfnodeparttextbox% \advance\pgf@y by.5\ht\pgfnodeparttextbox% - \setlength\pgf@ya{\pgfshapeouterysep}% + \pgfmathsetlength\pgf@ya{\pgfshapeouterysep}% \advance\pgf@y by\pgf@ya% } @@ -560,9 +580,9 @@ % % First, is width < minimum width? \pgf@x=\wd\pgfnodeparttextbox% - \setlength\pgf@xc{\pgfshapeinnerxsep}% + \pgfmathsetlength\pgf@xc{\pgfshapeinnerxsep}% \advance\pgf@x by 2\pgf@xc% - \setlength\pgf@xb{\pgfshapeminwidth}% + \pgfmathsetlength\pgf@xb{\pgfshapeminwidth}% \ifdim\pgf@x<\pgf@xb% % yes, too small. Enlarge... \pgf@x=\pgf@xb% @@ -570,16 +590,16 @@ % Now, calculate left border: .5\wd\pgfnodeparttextbox - .5 \pgf@x - outer sep \pgf@x=-.5\pgf@x% \advance\pgf@x by.5\wd\pgfnodeparttextbox% - \setlength\pgf@xa{\pgfshapeouterxsep}% + \pgfmathsetlength\pgf@xa{\pgfshapeouterxsep}% \advance\pgf@x by-\pgf@xa% % Calculate y % % First, is height+depth < minimum height? \pgf@y=\ht\pgfnodeparttextbox% \advance\pgf@y by\dp\pgfnodeparttextbox% - \setlength\pgf@yc{\pgfshapeinnerysep}% + \pgfmathsetlength\pgf@yc{\pgfshapeinnerysep}% \advance\pgf@y by 2\pgf@yc% - \setlength\pgf@yb{\pgfshapeminheight}% + \pgfmathsetlength\pgf@yb{\pgfshapeminheight}% \ifdim\pgf@y<\pgf@yb% % yes, too small. Enlarge... \pgf@y=\pgf@yb% @@ -588,7 +608,7 @@ \pgf@y=-.5\pgf@y% \advance\pgf@y by-.5\dp\pgfnodeparttextbox% \advance\pgf@y by.5\ht\pgfnodeparttextbox% - \setlength\pgf@ya{\pgfshapeouterysep}% + \pgfmathsetlength\pgf@ya{\pgfshapeouterysep}% \advance\pgf@y by-\pgf@ya% } @@ -605,7 +625,7 @@ \advance\pgf@x by \pgf@xa% \advance\pgf@y by \pgf@ya% } - \anchor{mid}{\pgf@anchor@rectangle@center\setlength\pgf@y{.5ex}} + \anchor{mid}{\pgf@anchor@rectangle@center\pgfmathsetlength\pgf@y{.5ex}} \anchor{base}{\pgf@anchor@rectangle@center\pgf@y=0pt} \anchor{north}{ \pgf@process{\southwest}% @@ -628,7 +648,7 @@ \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% } - \anchor{mid west}{\southwest\setlength\pgf@y{.5ex}} + \anchor{mid west}{\southwest\pgfmathsetlength\pgf@y{.5ex}} \anchor{base west}{\southwest\pgf@y=0pt} \anchor{north west}{ \southwest @@ -643,7 +663,7 @@ \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% } - \anchor{mid east}{\northeast\setlength\pgf@y{.5ex}} + \anchor{mid east}{\northeast\pgfmathsetlength\pgf@y{.5ex}} \anchor{base east}{\northeast\pgf@y=0pt} \anchor{north east}{\northeast} \anchor{south east}{ @@ -667,8 +687,8 @@ \advance\pgf@ya by\pgf@yc% \edef\pgf@marshal{% \noexpand\pgfpointborderrectangle - {\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@yb}} - {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}} + {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% }% \pgf@process{\pgf@marshal}% \advance\pgf@x by\pgf@xa% @@ -690,8 +710,8 @@ % Special current bounding box rectangle: \expandafter\def\csname pgf@sh@ns@current bounding box\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current bounding box\endcsname{% - \def\southwest{\pgfpoint{\pgf@picminx}{\pgf@picminy}}% - \def\northeast{\pgfpoint{\pgf@picmaxx}{\pgf@picmaxy}}% + \def\southwest{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}% + \def\northeast{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}% } \expandafter\def\csname pgf@sh@nt@current bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} \expandafter\def\csname pgf@sh@pi@current bounding box\endcsname{\pgfpictureid} @@ -700,8 +720,8 @@ % Special current path bounding box rectangle: \expandafter\def\csname pgf@sh@ns@current path bounding box\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current path bounding box\endcsname{% - \def\southwest{\pgfpoint{\pgf@pathminx}{\pgf@pathminy}}% - \def\northeast{\pgfpoint{\pgf@pathmaxx}{\pgf@pathmaxy}}% + \def\southwest{\pgfqpoint{\pgf@pathminx}{\pgf@pathminy}}% + \def\northeast{\pgfqpoint{\pgf@pathmaxx}{\pgf@pathmaxy}}% } \expandafter\def\csname pgf@sh@nt@current path bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} \expandafter\def\csname pgf@sh@pi@current path bounding box\endcsname{\pgfpictureid} @@ -710,8 +730,8 @@ % Special current page bounding box rectangle: \expandafter\def\csname pgf@sh@ns@current page\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current page\endcsname{% - \def\southwest{\pgfpoint{0pt}{0pt}}% - \def\northeast{\pgfpoint{\paperwidth}{\paperheight}}% + \def\southwest{\pgfqpoint{0pt}{0pt}}% + \def\northeast{\pgfqpoint{\paperwidth}{\paperheight}}% } \expandafter\def\csname pgf@sh@nt@current page\endcsname{{1}{0}{0}{1}{0pt}{0pt}} \expandafter\def\csname pgf@sh@pi@current page\endcsname{pgfpageorigin} @@ -739,18 +759,18 @@ % \pgf@ya=.5\ht\pgfnodeparttextbox% \advance\pgf@ya by.5\dp\pgfnodeparttextbox% - \setlength\pgf@yb{\pgfshapeinnerysep}% + \pgfmathsetlength\pgf@yb{\pgfshapeinnerysep}% \advance\pgf@ya by\pgf@yb% % % Caculate ``width radius'' % \pgf@xa=.5\wd\pgfnodeparttextbox% - \setlength\pgf@xb{\pgfshapeinnerxsep}% + \pgfmathsetlength\pgf@xb{\pgfshapeinnerxsep}% \advance\pgf@xa by\pgf@xb% % % Calculate length of radius vector: % - \pgf@process{\pgfpointnormalised{\pgfpoint{\pgf@xa}{\pgf@ya}}}% + \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% \ifdim\pgf@x>\pgf@y% \c@pgf@counta=\pgf@x% \ifnum\c@pgf@counta=0\relax% @@ -775,8 +795,8 @@ % If necessary, adjust radius so that the size requirements are % met: % - \setlength{\pgf@xb}{\pgfshapeminwidth}% - \setlength{\pgf@yb}{\pgfshapeminheight}% + \pgfmathsetlength{\pgf@xb}{\pgfshapeminwidth}% + \pgfmathsetlength{\pgf@yb}{\pgfshapeminheight}% \ifdim\pgf@x<.5\pgf@xb% \pgf@x=.5\pgf@xb% \fi% @@ -786,8 +806,8 @@ % % Now, add larger of outer sepearations. % - \setlength{\pgf@xb}{\pgfshapeouterxsep}% - \setlength{\pgf@yb}{\pgfshapeouterysep}% + \pgfmathsetlength{\pgf@xb}{\pgfshapeouterxsep}% + \pgfmathsetlength{\pgf@yb}{\pgfshapeouterysep}% \ifdim\pgf@xb<\pgf@yb% \advance\pgf@x by\pgf@yb% \else% @@ -799,14 +819,14 @@ % Anchors % \anchor{center}{\centerpoint} - \anchor{mid}{\centerpoint\setlength\pgf@y{.5ex}} + \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}} \anchor{base}{\centerpoint\pgf@y=0pt} \anchor{north}{\centerpoint\advance\pgf@y by\radius} \anchor{south}{\centerpoint\advance\pgf@y by-\radius} \anchor{west}{\centerpoint\advance\pgf@x by-\radius} \anchor{east}{\centerpoint\advance\pgf@x by\radius} - \anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\setlength\pgf@y{.5ex}} - \anchor{mid east}{\centerpoint\advance\pgf@x by\radius\setlength\pgf@y{.5ex}} + \anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\pgfmathsetlength\pgf@y{.5ex}} + \anchor{mid east}{\centerpoint\advance\pgf@x by\radius\pgfmathsetlength\pgf@y{.5ex}} \anchor{base west}{\centerpoint\advance\pgf@x by-\radius\pgf@y=0pt} \anchor{base east}{\centerpoint\advance\pgf@x by\radius\pgf@y=0pt} \anchor{north west}{ @@ -838,8 +858,8 @@ \pgf@ya=\pgf@y% \edef\pgf@marshal{% \noexpand\pgfpointborderellipse - {\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}} - {\noexpand\pgfpoint{\radius}{\radius}}% + {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}} + {\noexpand\pgfqpoint{\radius}{\radius}}% }% \pgf@marshal% \pgf@xa=\pgf@x% @@ -853,15 +873,15 @@ % Background path % \backgroundpath{ - \@tempdima=\radius% - \setlength{\pgf@xb}{\pgfshapeouterxsep}% - \setlength{\pgf@yb}{\pgfshapeouterysep}% + \pgfutil@tempdima=\radius% + \pgfmathsetlength{\pgf@xb}{\pgfshapeouterxsep}% + \pgfmathsetlength{\pgf@yb}{\pgfshapeouterysep}% \ifdim\pgf@xb<\pgf@yb% - \advance\@tempdima by-\pgf@yb% + \advance\pgfutil@tempdima by-\pgf@yb% \else% - \advance\@tempdima by-\pgf@xb% + \advance\pgfutil@tempdima by-\pgf@xb% \fi% - \pgfpathcircle{\centerpoint}{\@tempdima}% + \pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% } } |