diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-30 23:50:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-30 23:50:24 +0000 |
commit | e62f8e9bbbd4c6360b4f2b054505c13c5cfc05e7 (patch) | |
tree | a69e10b9bdf68821e8bf72434ba33b0374a695bb /Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex | |
parent | 58679cc130f6f05e33c54456b379a2b878211c29 (diff) |
tikz-qtree
git-svn-id: svn://tug.org/texlive/trunk@20895 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex b/Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex index 4acd7d57b28..baa35846ff0 100644 --- a/Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex +++ b/Master/texmf-dist/tex/latex/tikz-qtree/pgfsubpic.tex @@ -22,9 +22,6 @@ % - nodes in subpictures are tracked if the subpicture is placed with arbitrary transforms % - new \pgffitsubpicture macro to transform a subpicture (preserving aspect) to fit in a desired box -% To do: -% - speed up interpictureshift hook by promoting subsubpictures - \newdimen\pgf@subpicminx \newdimen\pgf@subpicminy \newdimen\pgf@subpicmaxx @@ -70,32 +67,54 @@ % saved subpictures are local to the current group \def\pgfsavesubpicture#1{% -\expandafter\setbox\csname pgf@subpic@hbox@#1\endcsname\copy\pgf@hbox +\expandafter\setbox\csname pgf@subpic@hbox@#1\endcsname\box\pgf@hbox +\csname pgf@subpic@minx@#1\endcsname\pgf@subpicminx +\csname pgf@subpic@miny@#1\endcsname\pgf@subpicminy +\csname pgf@subpic@maxx@#1\endcsname\pgf@subpicmaxx +\csname pgf@subpic@maxy@#1\endcsname\pgf@subpicmaxy +\expandafter\edef\csname pgf@subpic@id@#1\endcsname{\subpictureid}% +} + +% place current subpicture into named subpicture +\def\pgfmergesubpicture#1{% +\begin{pgfsubpicture} +% place current subpicture +\pgfplacesubpicture +% override containing picture +\expandafter\xdef\csname pgf@sh@pi@\subpictureid\endcsname{\csname pgf@subpic@id@#1\endcsname}% +% copy contents of #1 +\pgfrestoresubpicture{#1} +\pgflowlevelobj{\pgftransformshift{\pgfqpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}}{\pgfqbox\pgf@hbox} +\pgfpathrectanglecorners{\pgfqpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfqpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}% +\pgfusepath{use as bounding box}% +% +\end{pgfsubpicture} +\expandafter\setbox\csname pgf@subpic@hbox@#1\endcsname\box\pgf@hbox \csname pgf@subpic@minx@#1\endcsname\pgf@subpicminx \csname pgf@subpic@miny@#1\endcsname\pgf@subpicminy \csname pgf@subpic@maxx@#1\endcsname\pgf@subpicmaxx \csname pgf@subpic@maxy@#1\endcsname\pgf@subpicmaxy -\expandafter\edef\csname pgf@subpic@id@#1\endcsname{\subpictureid} +% but don't save the new picture id, keep the existing one } \def\pgfrestoresubpicture#1{% -\edef\act{\global\noexpand\setbox\pgf@hbox\noexpand\copy\csname pgf@subpic@hbox@#1\endcsname}\act +\edef\act{\global\noexpand\setbox\pgf@hbox\noexpand\box\csname pgf@subpic@hbox@#1\endcsname}\act \expandafter\global\expandafter\pgf@subpicminx\csname pgf@subpic@minx@#1\endcsname \expandafter\global\expandafter\pgf@subpicminy\csname pgf@subpic@miny@#1\endcsname \expandafter\global\expandafter\pgf@subpicmaxx\csname pgf@subpic@maxx@#1\endcsname \expandafter\global\expandafter\pgf@subpicmaxy\csname pgf@subpic@maxy@#1\endcsname -\xdef\subpictureid{\csname pgf@subpic@id@#1\endcsname} +\xdef\subpictureid{\csname pgf@subpic@id@#1\endcsname}% } % Place a previously-created subpicture, lining up its origin with the current origin \def\pgfplacesubpicture{ \pgfscope % expand current bounding box to accommodate subpicture -\pgfpathrectanglecorners{\pgfpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}% +\pgfpathrectanglecorners{\pgfqpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfqpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}% \pgfusepath{use as bounding box}% % % make the subpicture a node in the containing picture -\expandafter\gdef\csname pgf@sh@ns@\subpictureid\endcsname{rectangle} +\expandafter\gdef\csname pgf@sh@ns@\subpictureid\endcsname{rectangle}% \expandafter\xdef\csname pgf@sh@np@\subpictureid\endcsname{% \noexpand\def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}% \noexpand\def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}% @@ -105,7 +124,7 @@ \expandafter\xdef\csname pgf@sh@pi@\subpictureid\endcsname{\pgfpictureid}% % % align origin of subpicture with origin -\pgftransformshift{\pgfpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}% +\pgftransformshift{\pgfqpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}% \pgfqboxsynced{\pgf@hbox}% \endpgfscope } |