diff options
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex')
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex | 121 |
1 files changed, 94 insertions, 27 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex index a023e058d3..ed5399d441 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcircmultipoles.tex @@ -1229,6 +1229,11 @@ % draw "inverting" circles on outputs, they must be last % \pgfscope + \ifpgf@circuit@ieeelogicport + \def\@@notcirc{notcirc} + \else + \def\@@notcirc{ocirc} + \fi \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} \pgf@circ@count@a=\numpins\relax \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a @@ -1239,14 +1244,14 @@ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} \ifnum\@@tmp>0\pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} - \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} \endpgfscope\fi % right side pins \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}} \ifnum\@@tmp>0\pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}} - \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} + \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}} \endpgfscope\fi \advance\pgf@circ@count@a by -1\relax% \repeatpgfmathloop @@ -1254,13 +1259,13 @@ \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}} \ifnum\@@tmp>0\pgfscope \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}} - \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}} + \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}} \endpgfscope\fi % down side \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}} \ifnum\@@tmp>0\pgfscope \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}} - \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}} + \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}} \endpgfscope\fi \endpgfscope }% @@ -1431,7 +1436,7 @@ \pgf@circ@draworfill \endpgfscope % now we have to draw the pins, if needed - \ifdim\extshift>0pt\ifpgfcirc@draw@leads\pgfscope % let's avoid too much indent + \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent % Ok, we have to draw the leads (a.k.a. pins) \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth} % We mimic the anchors here --- probably there is a better way @@ -1814,7 +1819,11 @@ % % integrate with the other logic ports % -\ctikzset{logic ports/ieee/.code= {\pgf@circuit@europeanlogicportfalse +% +\newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse +\ctikzset{logic ports/ieee/.code= {% + \pgf@circuit@ieeelogicporttrue + \pgf@circuit@europeanlogicportfalse \tikzset{and port/.style={shape=ieeestd and port}}% \tikzset{or port/.style={shape=ieeestd or port}}% \tikzset{xor port/.style={shape=ieeestd xor port}}% @@ -1824,8 +1833,11 @@ \tikzset{nor port/.style={shape=ieeestd nor port}}% \tikzset{xnor port/.style={shape=ieeestd xnor port}}% \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}% - \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}% + \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}% }} +% add code to be compatible with the other ports +\ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}} +\ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}} \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}} % % the base angle for the or port. See the drawings. This will not change with height @@ -2244,9 +2256,11 @@ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball \advance\pgf@circ@res@other by \pinlen\relax \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi \fi \ifnum #3=1\relax\pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -2270,7 +2284,7 @@ \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind} \pgfextractx{\pgf@circ@res@left}{\bodyleft} \pgfextracty{\pgf@circ@res@down}{\bodyleft} - \ifpgfcirc@draw@leads + \ifpgfcirc@draw@input@leads %input leads --- all the same for AND ports \loop\ifnum\pgf@circ@count@a>0 \advance\pgf@circ@res@temp by -\pind @@ -2318,7 +2332,7 @@ % Find the pins on the rack; they are 1... \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up! \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1 - \ifpgfcirc@draw@leads + \ifpgfcirc@draw@input@leads %input leads --- for or ports \loop\ifnum\pgf@circ@count@a>0 \pgfextractx{\pgf@circ@res@right}{\topleft} @@ -2490,10 +2504,7 @@ \anchor{body right}{\bodyright\pgf@y=0pt} \anchor{right}{\bottomright\pgf@y=0pt} \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body - \anchor{left}{% central edge of the component - \pgf@circ@ieeestd@xorbar% save \xorbar in temp - \bodyleft\pgf@y=0pt\advance\pgf@x by -\pgf@circ@res@temp - } + \anchor{left}{\bodyleft\pgf@y=0pt} \anchor{up}{% \bodyleft \pgf@y=+0.5\pgf@y\pgf@x=0pt @@ -2502,7 +2513,57 @@ \bodyleft \pgf@y=-0.5\pgf@y\pgf@x=0pt } - + % this is for when it's used as a bipole + % we use the enclosing rectangle (see below) + \anchorborder{% + %% This (commented out) is the correct border anchor. But if we use the correct + %% border anchor there is no horizontal space for the label ;-) because + %% the triangle is too steep. So we will use a simple square border + %% + %% find the border anchor of a triangle (like a not port or an + %% amplifier) --- + %% + %% -----^ up + %% I --- | + %% I -|-- + %%left I | --- right + %% ----I-----|-------I----- + %% + %% + %\pgf@xa=\pgf@x + %% it's simmetrical w/ vertical side, use only positive y + %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)} + %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)} + %\pgfextracty{\pgf@circ@res@up}{\bodyleft} + %\pgfextractx{\pgf@circ@res@left}{\bodyleft} + %\pgfextractx{\pgf@circ@res@right}{\bodyright} + %% limit angle for the left (vertical) side + %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)} + %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)} + %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)} + %% find the border + %\ifnum\@@leftside>0 + % % vertical side + % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + %\else + % % triangle upper line + % \pgfpointintersectionoflines + % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}} + % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}} + %\fi + %% readjust y sign + %\pgf@y=\@@switchy\pgf@y + % + % this is the square border to position the path label with a bit of horizontal space + % + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgfextracty{\pgf@circ@res@up}{\bodyleft} + \pgfextractx{\pgf@circ@res@left}{\bodyleft} + \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}} + {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}} + } % geographical anchors \anchor{nw}{\northwest} \anchor{ne}{\northeast} @@ -2533,9 +2594,11 @@ \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball \advance\pgf@circ@res@other by \pinlen\relax \ifdim \pgf@circ@res@other > \pgf@circ@res@right - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} - \pgfusepath{draw} + \ifpgfcirc@draw@output@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}} + \pgfusepath{draw} + \fi \fi \ifnum #2=1\relax\pgfscope \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}} @@ -2556,9 +2619,11 @@ \pgfextracty{\pgf@circ@res@up}{\bodyleft} \pgfextractx{\pgf@circ@res@right}{\bodyright} % \draw input pin - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi \pgfscope \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} @@ -2569,14 +2634,16 @@ \endpgfscope } -\pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{% +\pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{% \pgfextractx{\pgf@circ@res@left}{\bodyleft} \pgfextracty{\pgf@circ@res@up}{\bodyleft} \pgfextractx{\pgf@circ@res@right}{\bodyright} % \draw input pin - \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} - \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} - \pgfusepath{draw} + \ifpgfcirc@draw@input@leads + \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}} + \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}} + \pgfusepath{draw} + \fi \pgfscope \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}} |