diff options
Diffstat (limited to 'graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex')
-rw-r--r-- | graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex | 168 |
1 files changed, 145 insertions, 23 deletions
diff --git a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex index 672cbf78b0..6eecb72c99 100644 --- a/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex +++ b/graphics/pgf/contrib/circuitikz/tex/pgfcirctripoles.tex @@ -1262,12 +1262,39 @@ % #2 - text inside % #3 - number of inputs % #4 = is it a not? +% +% option to add a circle for not-output, see +% https://github.com/circuitikz/circuitikz/issues/385 +% +\newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse +\ctikzset{tripoles/european not shape/.initial=ocirc} +\ctikzset{tripoles/european not symbol/.is choice} +\ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}} +\ctikzset{tripoles/european not symbol/circle/.code={% +\pgf@circ@european@port@circletrue\ctikzset{tripoles/european not shape=ocirc}}} +\ctikzset{tripoles/european not symbol/ieee circle/.code={% +\pgf@circ@european@port@circletrue\ctikzset{tripoles/european not shape=notcirc}}} \long\def\pgfcircdeclareeurologicport#1#2#3#4{ \pgfdeclareshape{european #1 port} { \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}} \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}} + \saveddimen{\boutshift}{% + \ifpgf@circ@european@port@circle + \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} + \edef\pgf@temp{ocirc} + \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}} + \ifx\pgf@temp\pgf@circ@temp % it's ocirc + \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen} + \else % it's ieee not circ + \pgf@circ@notradius % defined together with ieeestd ports + \pgf@x=2\pgf@circ@res@temp + \fi + \else + \pgf@x=0pt + \fi + } \savedmacro\resize{% automatic \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen} \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen @@ -1324,7 +1351,7 @@ } \fi \anchor{out}{\northeast\pgf@y=0pt} - \anchor{bout}{\right\pgf@y=0pt} + \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt} \anchor{left}{\left}% edges of component minus leads \anchor{right}{\right} @@ -1379,16 +1406,25 @@ \pgfpathlineto{% \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}} % + \pgfusepath{draw} + % \edef\pgf@temp{not} \edef\pgf@circ@temp{#4} \ifx\pgf@temp\pgf@circ@temp % is a not - \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} - \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% - {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \ifpgf@circ@european@port@circle + \pgfscope + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right} + \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}} + \endpgfscope + \else + \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}} + \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}% + {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}} + \pgfusepath{draw} + \fi \fi % - \pgfusepath{draw} - % \pgfpathmoveto{\pgfpointorigin} \pgftext{#2} } @@ -2209,12 +2245,19 @@ %draw thicker gate lines \pgfscope - \pgfpathmoveto{\pgfpoint - {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} - \pgfpathlineto{\pgfpoint - {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} - {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfscope + \pgfpathmoveto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} + \pgfpathlineto{\pgfpoint + {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left} + {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}} + % set the normal thickness + \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} + \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}} + \pgfsetlinewidth{\@@extrat\pgflinewidth} + \pgfusepath{draw} + \endpgfscope \pgfpathmoveto{\pgfpoint {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left} {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}} @@ -3188,7 +3231,15 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3359,7 +3410,15 @@ \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3595,7 +3654,15 @@ \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -3905,7 +3972,15 @@ \anchor{north east}{ \northwest \pgf@x=-\pgf@x } \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } % let's start drawing the component \backgroundpath{ @@ -4107,7 +4182,15 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -4329,7 +4412,15 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } % let's start drawing the component \backgroundpath{ @@ -4608,7 +4699,15 @@ \anchor{north west}{ \northwest } \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y } - \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } % drawing of the component \backgroundpath{ @@ -4736,7 +4835,15 @@ \pgf@x=-0.7\pgf@x } - \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \northwest + \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -4889,7 +4996,15 @@ \pgf@x=-\pgf@x } - \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} @@ -5017,8 +5132,15 @@ \pgf@x=-\pgf@x } - \anchor{text}{\pgfpoint{-.6\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}} - + \anchor{text}{ + \ifpgf@circ@center@text + \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax + \else + \leftedge + \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}} + \fi + \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax + } \backgroundpath{ \pgfsetcolor{\ctikzvalof{color}} |