From 57df68d21de1b2bd14611df0f545834e2fbe26ce Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 5 Feb 2022 21:23:01 +0000
Subject: yquant (5feb22)

git-svn-id: svn://tug.org/texlive/trunk@61897 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/yquant/yquant-circuit.tex | 70 ++++++++++++++--------
 1 file changed, 44 insertions(+), 26 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex')

diff --git a/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex b/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex
index 14f6a1f77bc..c4c99eceb2c 100644
--- a/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex
+++ b/Master/texmf-dist/tex/latex/yquant/yquant-circuit.tex
@@ -6,16 +6,18 @@
          \edef\wirexpos{\the\dimen0}%
       \else%
          \pgfpointanchor{yquantbox}{#2}%
-         \edef\wirexpos{\the\pgf@x}%
+         \edef\wirexpos{\the\yquant@pgf@x}%
       \fi%
-      \ifdim\wirexpos>0pt % may be negative for init gates
+      \ifdim\yquant@orientation@plus\wirexpos>0pt % may be negative for init gates
          \yquant@register@get@typeywire{#1}\wiretype\wireypos\wirelast%
          \edef\wirexprevpos{\expandafter\@firstoffour\wirelast}%
          \ifnum\wiretype=\yquant@register@type@none%
             % the clippings of the previous operator will for sure not be needed, but the type might be turned into an active one, so we need the last clipping.
             \yquant@register@set@lastwire{#1}{%
                {\wirexprevpos}{\wirexpos}{}%
-               {\unexpanded\expandafter{\pgfshapeclippathhorzresult}}%
+               {\ifyquant@config@draw@quality%
+                   \unexpanded\expandafter{\pgfshapeclippathhorzresult}%
+                \fi}%
             }%
          \else%
             % append the previous `last' clipping to the old list and insert the new one
@@ -25,7 +27,9 @@
                    \expandafter\@thirdandfourthoffour\wirelast%
                 }%
                }%
-               {\unexpanded\expandafter{\pgfshapeclippathhorzresult}}%
+               {\ifyquant@config@draw@quality%
+                  \unexpanded\expandafter{\pgfshapeclippathhorzresult}%
+                \fi}%
             }%
          \fi%
       \fi%
@@ -41,10 +45,14 @@
    % to have a symmetric situation, we extend again one separation at the end, unless this is supposed to be seamless and we don't have outputs (for seamless circuits with outputs, extend - since this extension will be between last register and output)
    \ifyquant@env@seamless{%
       \expandafter\unless\expandafter\ifx\csname\yquant@prefix outputs\endcsname\relax%
-         \dimdef\yquant@circuit@endwires@x{\yquant@circuit@endwires@x+\yquant@config@operator@sep}%
+         \dimdef\yquant@circuit@endwires@x{%
+            \yquant@circuit@endwires@x\yquant@orientation@plus\yquant@config@operator@sep%
+         }%
       \fi%
    }{%
-      \dimdef\yquant@circuit@endwires@x{\yquant@circuit@endwires@x+\yquant@config@operator@sep}%
+      \dimdef\yquant@circuit@endwires@x{%
+         \yquant@circuit@endwires@x\yquant@orientation@plus\yquant@config@operator@sep%
+      }%
    }%
    \let\yquant@circuit@endwires@finalize=\relax%
    \yquant@for \yquant@circuit@endwires@i := 1 to \csname\yquant@prefix registers\endcsname {%
@@ -52,9 +60,15 @@
       \ifcsname\yquant@prefix registermap@\yquant@circuit@endwires@i\endcsname%
          \xifinlistcs\yquant@circuit@endwires@i{\yquant@prefix inonly}{%
             % however, the wire is to be discarded after this circuit
-            \edef\storedleft{\the\pgf@picminx}%
-            \yquant@draw@wire\yquant@circuit@endwires@i1%
-            \global\pgf@picminx=\storedleft%
+            \ifyquanthorz{%
+               \edef\storedleft{\the\pgf@picminx}%
+               \yquant@draw@wire\yquant@circuit@endwires@i1%
+               \global\pgf@picminx=\storedleft%
+            }{%
+               \edef\storedtop{\the\pgf@picmaxy}%
+               \yquant@draw@wire\yquant@circuit@endwires@i1%
+               \global\pgf@picmaxy=\storedtop%
+            }%
             \eappto\yquant@circuit@endwires@finalize{%
                \yquant@register@set@type%
                   \yquant@circuit@endwires@i\noexpand\yquant@register@type@none%
@@ -84,9 +98,11 @@
 % BEGIN_FOLD Drawing control lines
 % populates a drawing macro with the current control line with style #1 at position #2. Assumes a node called yquantbox is set up, and the \pgfshapeclippathvertresult was set up appropriately for this node. At the first call, \yquant@circuit@extendcontrolline@cmd must be \let to \empty and \yquant@circuit@extendcontrolline@prev to \relax.
 \protected\def\yquant@circuit@extendcontrolline#1#2{%
-   \eappto\yquant@circuit@extendcontrolline@clip{%
-      \unexpanded\expandafter{\pgfshapeclippathvertresult}%
-   }%
+   \ifyquant@config@draw@quality%
+      \eappto\yquant@circuit@extendcontrolline@clip{%
+         \unexpanded\expandafter{\pgfshapeclippathvertresult}%
+      }%
+   \fi%
    \begingroup%
       \tikzset{/yquant/every control line}%
       \expandafter%
@@ -100,7 +116,7 @@
       \unless\ifx\yquant@circuit@extendcontrolline@prev\relax%
          \eappto\yquant@circuit@extendcontrolline@cmd{%
             \expandafter\@secondofthree\yquant@circuit@extendcontrolline@prev%
-            -- (#2,\the\pgf@y)%
+            -- \yquant@coords(#2,\the\yquant@pgf@y)%
          }%
       \fi%
       \yquant@circuit@extendcontrolline@store{#2}%
@@ -110,9 +126,9 @@
       \unless\ifx\yquant@circuit@extendcontrolline@prev\relax%
          \eappto\yquant@circuit@extendcontrolline@cmd{%
             \expandafter\@firstofthree\yquant@circuit@extendcontrolline@prev%
-            -- (\the\dimexpr#2-2\@tempdima\relax,\the\pgf@y)%
+            -- \yquant@coords(\the\dimexpr#2-2\@tempdima\relax,\the\yquant@pgf@y)%
             \expandafter\@thirdofthree\yquant@circuit@extendcontrolline@prev%
-            -- (\the\dimexpr#2+2\@tempdima\relax,\the\pgf@y)%
+            -- \yquant@coords(\the\dimexpr#2+2\@tempdima\relax,\the\yquant@pgf@y)%
          }%
       \fi%
       \yquant@circuit@extendcontrolline@store{#2}%
@@ -122,11 +138,11 @@
       \unless\ifx\yquant@circuit@extendcontrolline@prev\relax%
          \eappto\yquant@circuit@extendcontrolline@cmd{%
             \expandafter\@firstofthree\yquant@circuit@extendcontrolline@prev%
-            -- (\the\dimexpr#2-2\@tempdima\relax,\the\pgf@y)%
+            -- \yquant@coords(\the\dimexpr#2-2\@tempdima\relax,\the\yquant@pgf@y)%
             \expandafter\@secondofthree\yquant@circuit@extendcontrolline@prev%
-            -- (\the\dimexpr#2\relax,\the\pgf@y)%
+            -- \yquant@coords(\the\dimexpr#2\relax,\the\yquant@pgf@y)%
             \expandafter\@thirdofthree\yquant@circuit@extendcontrolline@prev%
-            -- (\the\dimexpr#2+2\@tempdima\relax,\the\pgf@y)%
+            -- \yquant@coords(\the\dimexpr#2+2\@tempdima\relax,\the\yquant@pgf@y)%
          }%
       \fi%
       \yquant@circuit@extendcontrolline@store{#2}%
@@ -138,9 +154,9 @@
 
 \protected\def\yquant@circuit@extendcontrolline@store#1{%
    \edef\yquant@circuit@extendcontrolline@prev{%
-      {(\the\dimexpr#1-2\@tempdima\relax,\the\pgf@y)}%
-      {(\the\dimexpr#1\relax,\the\pgf@y)}%
-      {(\the\dimexpr#1+2\@tempdima\relax,\the\pgf@y)}%
+      {\yquant@coords(\the\dimexpr#1-2\@tempdima\relax,\the\yquant@pgf@y)}%
+      {\yquant@coords(\the\dimexpr#1\relax,\the\yquant@pgf@y)}%
+      {\yquant@coords(\the\dimexpr#1+2\@tempdima\relax,\the\yquant@pgf@y)}%
    }%
 }
 
@@ -150,18 +166,20 @@
       \tikzset{/yquant/every multi line}%
       \expandafter%
    \endgroup%
-   \eappto\yquant@circuit@extendmultiline@clip{%
-      \unexpanded\expandafter{\pgfshapeclippathvertresult}%
-   }%
+   \ifyquant@config@draw@quality%
+      \eappto\yquant@circuit@extendmultiline@clip{%
+         \unexpanded\expandafter{\pgfshapeclippathvertresult}%
+      }%
+   \fi%
    \expandafter\@tempdima\the\pgflinewidth%
    \pgfpointanchor{yquantbox}{center}%
    \unless\ifx\yquant@circuit@extendmultiline@prev\relax%
       \eappto\yquant@circuit@extendmultiline@cmd{%
-         \yquant@circuit@extendmultiline@prev -- (#1,\the\pgf@y)%
+         \yquant@circuit@extendmultiline@prev -- \yquant@coords(#1,\the\yquant@pgf@y)%
       }%
    \fi%
    \edef\yquant@circuit@extendmultiline@prev{%
-      (\the\dimexpr#1\relax,\the\pgf@y)%
+      \yquant@coords(\the\dimexpr#1\relax,\the\yquant@pgf@y)%
    }%
 }
 % END_FOLD
-- 
cgit v1.2.3

