summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-16 22:04:20 +0000
committerKarl Berry <karl@freefriends.org>2019-06-16 22:04:20 +0000
commit588cee1666f2db2a58b592abbde6111eeab979a9 (patch)
tree3b6a3e79577707e820dea7ec7609a0bffa0555ed /Master/texmf-dist/tex/generic/circuitikz
parent361113517781be1c859fe04b53b0886f8737ab42 (diff)
circuitikz (16jun19)
git-svn-id: svn://tug.org/texlive/trunk@51387 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex191
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex109
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex10
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex57
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex470
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex53
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex460
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex173
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex384
9 files changed, 1411 insertions, 496 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
index 8814c336a4f..ca121a6e0c7 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirc.defines.tex
@@ -147,6 +147,8 @@
\ctikzset{monopoles/rground/thickness/.initial=2}
\ctikzset{monopoles/tground/thickness/.initial=3}
\ctikzset{monopoles/vcc/width/.initial=.2}
+\ctikzset{monopoles/vcc/arrow/.initial=legacy}
+\ctikzset{monopoles/vee/arrow/.initial=legacy}
\ctikzset{monopoles/match/width/.initial=.4}
\ctikzset{monopoles/chassis/width/.initial=.25}
\ctikzset{monopoles/alternative chassis/width/.initial=.25}
@@ -247,6 +249,7 @@
\ctikzset{bipoles/oosource/width/.initial=.60}
\ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
\ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
+\ctikzset{bipoles/dcisource/angle/.initial=80}
\ctikzset{bipoles/dcisource/height/.initial=.60}
\ctikzset{bipoles/dcisource/width/.initial=.60}
\ctikzset{bipoles/dcvsource/height/.initial=.60}
@@ -995,6 +998,7 @@
\ctikzset{tripoles/triac/diode width right/.initial=.3}
%% Cute switches
+\ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
\ctikzset{bipoles/cuteswitch/height/.initial=.6}
\ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
\ctikzset{bipoles/cuteswitch/width/.initial=.50}
@@ -1017,14 +1021,17 @@
\ctikzset{tripoles/wilkinson/height/.initial=1.3}
\ctikzset{tripoles/wilkinson/width/.initial=1.3}
+\ctikzset{quadpoles/transformer/inner/.initial=0.4}
\ctikzset{quadpoles/transformer/width/.initial=1.5}
\ctikzset{quadpoles/transformer/width1/.initial=.4}
\ctikzset{quadpoles/transformer/height/.initial=1.5}
\ctikzset{quadpoles/transformer/height1/.initial=.8}
+\ctikzset{quadpoles/transformer core/inner/.initial=0.4}
\ctikzset{quadpoles/transformer core/width/.initial=1.5}
\ctikzset{quadpoles/transformer core/height/.initial=1.5}
\ctikzset{quadpoles/transformer core/core height/.initial=.5}
\ctikzset{quadpoles/transformer core/core width/.initial=.05}
+\ctikzset{quadpoles/gyrator/inner/.initial=0.4}
\ctikzset{quadpoles/gyrator/width/.initial=1.5}
\ctikzset{quadpoles/gyrator/height/.initial=1.5}
\ctikzset{quadpoles/fourport/width/.initial=1.3}
@@ -1036,6 +1043,27 @@
\ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
+\ctikzset{quadpoles style/.is choice}
+\ctikzset{quadpoles style/inward/.code={ % default value
+ \ctikzset{quadpoles/transformer/inner=0.4}
+ \ctikzset{quadpoles/transformer/width=1.5}
+ \ctikzset{quadpoles/transformer core/inner=0.4}
+ \ctikzset{quadpoles/transformer core/width=1.5}
+ \ctikzset{quadpoles/gyrator/inner=0.4}
+ \ctikzset{quadpoles/gyrator/width=1.5}
+ }
+}
+\ctikzset{quadpoles style/inline/.code={ % now horizontal baffle
+ \ctikzset{quadpoles/transformer/inner=1}
+ \ctikzset{quadpoles/transformer/width=0.6}
+ \ctikzset{quadpoles/transformer core/inner=1}
+ \ctikzset{quadpoles/transformer core/width=0.6}
+ \ctikzset{quadpoles/gyrator/inner=1}
+ \ctikzset{quadpoles/gyrator/width=0.6}
+ }
+}
+
+
%
% multipoles
%
@@ -1074,7 +1102,51 @@
\pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
\ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
-
+% rotary switch by Romano
+\ctikzset{multipoles/rotary/thickness/.initial=1}
+\ctikzset{multipoles/rotary/shape/.initial=ocirc}
+\ctikzset{multipoles/rotary/channels/.initial=5}
+\ctikzset{multipoles/rotary/angle/.initial=60}
+\ctikzset{multipoles/rotary/wiper/.initial=20}
+\ctikzset{multipoles/rotary/arrow/.is choice}
+\newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
+\newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
+\newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
+\ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
+\ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
+\ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
+
+\tikzset{%
+ rotary switch/.style args={#1in#2wiper#3}{
+ shape=rotaryswitch,
+ /tikz/circuitikz/multipoles/rotary/channels=#1,
+ /tikz/circuitikz/multipoles/rotary/angle=#2,
+ /tikz/circuitikz/multipoles/rotary/wiper=#3,
+ },
+ rotary switch -/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=none,
+ },
+ rotary switch <-/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=ccw,
+ },
+ rotary switch ->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=cw,
+ },
+ rotary switch <->/.style args={#1in#2wiper#3}{
+ rotary switch=#1 in #2 wiper #3,
+ /tikz/circuitikz/multipoles/rotary/arrow=both,
+ },
+ % Notice that these should be the same as the initial values of the keys
+ rotary switch/.default={5 in 60 wiper 20 },
+ rotary switch -/.default={5 in 60 wiper 20 },
+ rotary switch <-/.default={5 in 60 wiper 20 },
+ rotary switch ->/.default={5 in 60 wiper 20 },
+ rotary switch <->/.default={5 in 60 wiper 20 },
+}
% %Mechanical section
\ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
@@ -1149,7 +1221,6 @@
\ctikzset{flow/distance/.initial = .5}
\ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
-
\ctikzset{bipole/label/.is family}
\ctikzset{bipole/label/position/.initial=90}
\ctikzset{bipole/label/unit/.initial=}
@@ -1158,19 +1229,6 @@
\ctikzset{bipole/annotation/position/.initial=-90}
\ctikzset{bipole/annotation/unit/.initial=}
\ctikzset{bipole/annotation/name/.initial=}
-\ctikzset{bipole/nodes/.is family}
-\ctikzset{bipole/nodes/left/.is choice}
-\ctikzset{bipole/nodes/left/none/.code={\ctikzsetvalof{bipole/nodes/left}{none}}}
-\ctikzset{bipole/nodes/left/empty/.code={\ctikzsetvalof{bipole/nodes/left}{empty}}}
-\ctikzset{bipole/nodes/left/full/.code={\ctikzsetvalof{bipole/nodes/left}{full}}}
-\ctikzset{bipole/nodes/left/diamond/.code={\ctikzsetvalof{bipole/nodes/left}{diamond}}}
-\ctikzset{bipole/nodes/left/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/left}{rectjoinfill}}}
-\ctikzset{bipole/nodes/right/.is choice}
-\ctikzset{bipole/nodes/right/none/.code={\ctikzsetvalof{bipole/nodes/right}{none}}}
-\ctikzset{bipole/nodes/right/empty/.code={\ctikzsetvalof{bipole/nodes/right}{empty}}}
-\ctikzset{bipole/nodes/right/full/.code={\ctikzsetvalof{bipole/nodes/right}{full}}}
-\ctikzset{bipole/nodes/right/diamond/.code={\ctikzsetvalof{bipole/nodes/right}{diamond}}}
-\ctikzset{bipole/nodes/right/rectjoinfill/.code={\ctikzsetvalof{bipole/nodes/right}{rectjoinfill}}}
\newif\ifpgf@circuit@europeanresistor
\ctikzset{resistor/.is choice}
@@ -1307,5 +1365,108 @@
\ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
\ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
+% seven segment displays by RGtti
+
+\newif\ifpgf@circ@sevenseg@dot
+\newif\ifpgf@circ@sevenseg@box
+\def\pgf@circ@sevenseg@dotstate{empty}
+\ctikzset{seven seg/.is family}
+\ctikzset{seven seg/dot/.is choice}
+% none means no dot, not space for it. Empty means no dot, but space
+\ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
+\ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
+\ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
+\ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
+%
+\ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
+\ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
+\ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
+\ctikzset{seven seg/box sep/.initial=1pt}% external box gap
+\ctikzset{seven seg/color on/.initial=red}% color for segment "on"
+\ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
+\ctikzset{seven seg/box/.is choice}
+\ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
+\ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
+
+\ctikzset{seven seg/bits/.initial=0000000}
+
+\ctikzset{seven seg/value/.code={
+ \edef\@@tmp{#1}
+ \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
+ \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
+ \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
+ \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
+ \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
+ \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
+ \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
+ \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
+ \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
+ \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
+ \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
+ \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
+ \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
+ \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
+ \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
+ \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
+ \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
+}}
+
+\tikzset{%
+ seven segment val/.style args={#1dot#2box#3}{
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/value=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+ seven segment bits/.style args={#1dot#2box#3}{
+ shape=bare7seg,
+ /tikz/circuitikz/seven seg/bits=#1,
+ /tikz/circuitikz/seven seg/dot=#2,
+ /tikz/circuitikz/seven seg/box=#3,
+ },
+}
+
+
%%%%%%%%%% new
\pgfkeys{\circuitikzbasekey/.search also={/tikz}}
+
+% Electronic tubes: diodetube, triode, tetrode and pentode
+\ctikzset{tubes/width/.initial=1} % relative width
+\ctikzset{tubes/height/.initial=1.4} % relative height
+\ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
+\ctikzset{tubes/anode distance/.initial=0.40} % distance from center
+\ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
+\ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
+\ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
+\ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
+\ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
+\ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
+\ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
+\ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
+\ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
+\ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
+\ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
+
+\newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
+\pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
+\ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
+\newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
+\pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
+\ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
+\newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
+\pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
+\ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex
index b69e9c47708..bf024ec473f 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircbipoles.tex
@@ -936,10 +936,11 @@
\pgfpathmoveto{\pgfpointorigin}
\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
\pgf@circ@maybefill
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}}\pgfpatharc{0}{90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}}\pgfpatharc{0}{-90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}\pgfpatharc{180}{270}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}\pgfpatharc{180}{90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
+ \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
+ \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
+ \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
+ \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
+ \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
\pgfusepath{draw}
\pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
@@ -950,7 +951,6 @@
\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
\endpgfscope
}
-
%% DC-Voltage source
\pgfcircdeclarebipole
{}
@@ -2088,10 +2088,19 @@
\pgf@x=0pt
\pgf@y=.5\pgf@circ@res@other
}
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
% mid of the lever, to stack switches
\anchor{mid}{\midlever}
- \anchor{out}{\northeast \pgf@y=0cm}
- \anchor{in}{\southwest\pgf@y=0cm}
+ \anchor{cout}{\northeast \pgf@y=0cm}
+ \anchor{cin}{\southwest\pgf@y=0cm}
+ \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
+ \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
}
{\ctikzvalof{bipoles/cuteswitch/height 2}}
{#1}
@@ -2110,9 +2119,9 @@
#3
\endpgfscope
\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
- \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
\pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
- \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
}
}
@@ -2743,87 +2752,6 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Handling of terminals
-
-
-%% Easily usable styles
-
-\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=empty}}
-\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=empty}}
-\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=none}}
-\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=empty}}
-\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=full}}
-\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=empty}}
-\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=diamond}}
-\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=none}}
-\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=full}}
-\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=none}}
-\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamond}}
-\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=full}}
-\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=full}}
-\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=diamond}}
-\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=diamond}}
-
-\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
-\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=full}}
-\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=empty}}
-\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamond}}
-\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
-\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
-\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
-\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
-\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
-
-\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
-
-
-%% The output routine
-
-\def\drawpoles{
- \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{diamond} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztostart) node[diamondpole] {}
- \else
- \pgfextra{ \def\pgf@temp{empty} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztostart) node[ocirc] {}
- \else
- \pgfextra{ \def\pgf@temp{full} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztostart) node[circ] {}
- \else
- \pgfextra{ \def\pgf@temp{rectjoinfill} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztostart) node[rectjoinfill] {}
- \else
- \fi
- \fi
- \fi
- \fi
- \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \def\pgf@temp{diamond} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztotarget) node[diamondpole] {}
- \else
- \pgfextra{ \def\pgf@temp{empty} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztotarget) node[ocirc] {}
- \else
- \pgfextra{ \def\pgf@temp{full} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztotarget) node[circ] {}
- \else
- \pgfextra{ \def\pgf@temp{rectjoinfill} }
- \ifx\pgf@temp\pgf@circ@temp
- (\tikztotarget) node[rectjoinfill] {}
- \else
- \fi
- \fi
- \fi
- \fi
-}
-
-
%% Lamp
@@ -4968,4 +4896,5 @@
\endpgfscope
}
+
% end of pgfcircbipoles.tex
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex
index 1d386b5480b..4dc91d9eb66 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirclabel.tex
@@ -102,15 +102,23 @@
\pgfmathadd{\pgf@circ@labanc}{180}
\edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
\fi
+ % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
+ %
+ % normalize the angle values
+ %
+ \pgfmathmod{\pgf@circ@labanc}{360}
+ \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
+ %
\ifpgf@circuit@bipole@inverted
\pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
\edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
\fi
-
+ %
\ifnum \ctikzvalof{mirror value} = -1
\pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
\edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
\fi
+ % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
}
%Firstly, place a coordinate directly at the edge of the shape
(\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor)
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex
index 66f2d8dd511..8e26b7a668c 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmonopoles.tex
@@ -792,23 +792,25 @@
\behindforegroundpath{
\pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen
\pgfscope
- \pgfpathmoveto{\pgfpointorigin}
- \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
- \pgfusepath{draw}
-
- \pgfstartlinewidth=\pgflinewidth
- \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
-
- \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
- \pgfusepath{draw}
+ \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
+ \ifx\pgf@temp\pgf@circ@temp
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
- \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
+ \pgfusepath{draw}
- \endpgfscope
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf@circ@temp}
+ \fi
+ \pgfpathmoveto{\pgfpointorigin}
+ \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
+ \pgfusepath{draw}
+ \endpgfscope
}
-
}
% Vee
@@ -839,27 +841,28 @@
\behindforegroundpath{
\pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@Rlen
-
\pgfscope
+ \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
+ \ifx\pgf@temp\pgf@circ@temp
+
+ \pgfstartlinewidth=\pgflinewidth
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
+
+ \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
+ \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
+ \pgfusepath{draw}
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \else
+ \pgfsetarrowsend{\pgf@circ@temp}
+ \fi
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
\pgfusepath{draw}
-
- \pgfstartlinewidth=\pgflinewidth
- \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
-
- \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
- \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
- \pgfusepath{draw}
- \pgfsetlinewidth{\pgfstartlinewidth}
-
\endpgfscope
}
-
}
-
% match
\pgfdeclareshape{match}{
\savedanchor{\northeast}{%
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
index 48c9c91a9d7..b2a626b63d9 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircmultipoles.tex
@@ -27,6 +27,10 @@
% DIP (dual in line package) chips
\pgfdeclareshape{dipchip}{
+ \savedmacro\numpins{%
+ \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}%
+ \def\numpins{\the\c@pgf@counta}
+ }
\savedanchor\centerpoint{%
\pgf@x=-.5\wd\pgfnodeparttextbox%
\pgf@y=-.5\ht\pgfnodeparttextbox%
@@ -36,7 +40,7 @@
\anchor{center}{\origin}
\anchor{text}{\centerpoint}% to adjust text
\saveddimen\height{%
- \pgfmathsetlength\pgf@x{((\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins})
+ \pgfmathsetlength\pgf@x{((\numpins)
*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}%
}%
\saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing}}}
@@ -44,7 +48,7 @@
\saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}}
% standard anchors
\savedanchor\northwest{%
- \pgfmathsetlength\pgf@y{0.5*((\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins})
+ \pgfmathsetlength\pgf@y{0.5*((\numpins)
*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/pin spacing})*\pgf@circ@Rlen/2}%
\pgfmathsetlength\pgf@x{-0.5*\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/width}}
}
@@ -90,7 +94,7 @@
\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
% Adding the pin number
\ifpgf@circuit@chip@shownumbers
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}%
+ \c@pgf@counta=\numpins\relax
\divide\c@pgf@counta by 2 \pgf@circ@count@b=\c@pgf@counta
% thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
\ifpgf@circuit@chip@straightnumbers
@@ -157,7 +161,7 @@
\ifdim\pgf@circ@res@other>0pt
\pgfscope
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth}
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}%
+ \c@pgf@counta=\numpins\relax
\divide\c@pgf@counta by 2 \pgf@circ@count@b=\c@pgf@counta
\pgfmathloop%
\ifnum\c@pgf@counta>0
@@ -192,29 +196,18 @@
% and is executed just before a node is drawn.
\pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
% Start with the maximum pin number and go backwards.
- % If the anchor is undefined, create it. Otherwise stop.
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/dipchip/num pins}%
- \divide\c@pgf@counta by 2 \pgf@circ@count@b=\c@pgf@counta
+ \c@pgf@counta=\numpins\relax
\pgfmathloop%
\ifnum\c@pgf@counta>0
- % left side, pins 1..npins/2
% we will create two anchors per pin: the "normal one" like `pin 1` for the
% electrical contact, and the "border one" like `bpin 1` for labels.
% they will coincide if `external pins width` is set to 0.
- \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\c@pgf@counta\endcsname{%
- \noexpand\pgf@circ@chippinanchorLB{\the\c@pgf@counta}%
- }
\expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\c@pgf@counta\endcsname{%
- \noexpand\pgf@circ@chippinanchorL{\the\c@pgf@counta}%
+ \noexpand\pgf@circ@dippinanchor{\the\c@pgf@counta}{1}%
+ }
+ \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@circ@dippinanchor{\the\c@pgf@counta}{0}%
}
- % right side
- \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\c@pgf@counta+1\relax
- \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorRB{\the\c@pgf@counta}%
- }%
- \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorR{\the\c@pgf@counta}%
- }%
\advance\c@pgf@counta by -1\relax%
\repeatpgfmathloop%
}%
@@ -223,6 +216,10 @@
% QFP (quad flat package) chips
\pgfdeclareshape{qfpchip}{
+ \savedmacro\numpins{%
+ \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}%
+ \def\numpins{\the\c@pgf@counta}
+ }
\savedanchor\centerpoint{%
\pgf@x=-.5\wd\pgfnodeparttextbox%
\pgf@y=-.5\ht\pgfnodeparttextbox%
@@ -232,18 +229,18 @@
\anchor{center}{\origin}
\anchor{text}{\centerpoint}% to adjust text
\saveddimen\height{%
- \pgfmathsetlength\pgf@x{((\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}+2)
+ \pgfmathsetlength\pgf@x{((\numpins+2)
*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}%
}%
\saveddimen\width{%
- \pgfmathsetlength\pgf@x{((\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}+2)
+ \pgfmathsetlength\pgf@x{((\numpins+2)
*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}%
}%
\saveddimen{\chipspacing}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing}}}
\saveddimen{\extshift}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins width}}}
% standard anchors
\savedanchor\northwest{%
- \pgfmathsetlength\pgf@y{0.5*((\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}+2)
+ \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
*\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/pin spacing})*\pgf@circ@Rlen/4}%
\pgf@x=-\pgf@y
}
@@ -294,7 +291,7 @@
% Adding the pin number
\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
\ifpgf@circuit@chip@shownumbers
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}%
+ \c@pgf@counta=\numpins%
\divide\c@pgf@counta by 4 \pgf@circ@count@b=\c@pgf@counta
% thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
\ifpgf@circuit@chip@straightnumbers
@@ -401,7 +398,7 @@
\ifdim\pgf@circ@res@other>0pt
\pgfscope
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/multipoles/external pins thickness}\pgflinewidth}
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}%
+ \c@pgf@counta=\numpins%
\divide\c@pgf@counta by 4 \pgf@circ@count@b=\c@pgf@counta
\pgfmathloop%
\ifnum\c@pgf@counta>0
@@ -452,41 +449,14 @@
% and is executed just before a node is drawn.
\pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
% Start with the maximum pin number and go backwards.
- % If the anchor is undefined, create it. Otherwise stop.
- \c@pgf@counta=\pgfkeysvalueof{/tikz/circuitikz/multipoles/qfpchip/num pins}%
- \divide\c@pgf@counta by 4 \pgf@circ@count@b=\c@pgf@counta
+ \c@pgf@counta=\numpins%
\pgfmathloop%
\ifnum\c@pgf@counta>0
- % left side; 1..npins/4
\expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\c@pgf@counta\endcsname{%
- \noexpand\pgf@circ@chippinanchorQL{\the\c@pgf@counta}%
+ \noexpand\pgf@circ@qfppinanchor{\the\c@pgf@counta}{1}%
}
\expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\c@pgf@counta\endcsname{%
- \noexpand\pgf@circ@chippinanchorQLB{\the\c@pgf@counta}%
- }
- % bottom side;
- \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\c@pgf@counta+1\relax
- \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQB{\the\c@pgf@counta}%
- }
- \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQBB{\the\c@pgf@counta}%
- }
- % right side; 2*npins/4+1, 3*npins/4
- \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\c@pgf@counta+1\relax
- \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQR{\the\c@pgf@counta}%
- }
- \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQRB{\the\c@pgf@counta}%
- }
- % top side
- \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\c@pgf@counta\relax
- \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQT{\the\c@pgf@counta}%
- }
- \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@c\endcsname{%
- \noexpand\pgf@circ@chippinanchorQTB{\the\c@pgf@counta}%
+ \noexpand\pgf@circ@qfppinanchor{\the\c@pgf@counta}{0}%
}
\advance\c@pgf@counta-1\relax%
\repeatpgfmathloop%
@@ -494,66 +464,352 @@
}
%% anchors for DIP
-\def\pgf@circ@chippinanchorR#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}%
-}
-\def\pgf@circ@chippinanchorL#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{-\width/2-\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}%
-}
-\def\pgf@circ@chippinanchorRB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}%
-}
-\def\pgf@circ@chippinanchorLB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{-\width/2}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}%
+\def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \c@pgf@countc=\numpins\relax
+ \divide\c@pgf@countc by 2
+ \ifnum #1 > \the\c@pgf@countc
+ % right side
+ \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
+ \else
+ \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
+\fi
}
%% anchors for QFP
-\def\pgf@circ@chippinanchorQR#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
+\def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
+ \c@pgf@countc=\numpins\relax
+ \divide\c@pgf@countc by 4
+ \ifnum #1 > \the\c@pgf@countc
+ \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
+ \ifnum #1 > \the\c@pgf@countb
+ \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
+ \ifnum #1 > \the\c@pgf@countb
+ % 3*npins/4 < pin, top side
+ \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
+ \else
+ % 2*npins/4 < pin <= 3*npins/4, right side
+ \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
+ \fi
+ \else
+ % npins/4 < pin <= 2*npins/4, bottom side
+ \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
+ \fi
+ \else
+ % <= npins/4, left side
+ \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
+ \fi
+}
+
+
+%% Rotary Switch
+
+\pgfdeclareshape{rotaryswitch}
+{
+ \savedanchor\northeast{%
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen
+ \pgf@circ@res@temp=.3052\pgf@circ@res@temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@Rlen + \pgf@circ@res@temp}
+ }
+ \savedanchor\northwest{%
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen
+ \pgf@circ@res@temp=.3052\pgf@circ@res@temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
+ }
+ \savedanchor\central{%
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ % the magic number is 0.25/cos(35)
+ % try to recalculate it for the actual switch
+ \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen
+ \pgf@circ@res@temp=.3052\pgf@circ@res@temp
+ \edef\a{\ctikzvalof{multipoles/rotary/angle}}
+ \edef\r{\ctikzvalof{nodes width}}
+ \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
+ \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
+ }
+ % external square limits
+ \savedanchor\extnorthwest{%
+ \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@Rlen
+ % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
+ \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
+ \pgf@x=2.5\pgf@x % external square size
+ \pgf@y=-\pgf@x %square thing when angle=180?
+ }
+ \saveddimen{\width}{\pgfmathsetlength\pgf@x{0.3052*\pgf@circ@Rlen*\ctikzvalof{tripoles/spdt/width}}}
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
+ \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
+ \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
+ \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
+ \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
+ % mid of the lever, to stack switches
+ %\anchor{mid}{\midlever}
+ \anchor{mid}{\northwest
+ \pgf@circ@res@temp=-\pgf@x
+ \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
+ \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
+ }
+ % center anchors
+ \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
+ % horizontal angles
+ \anchor{in}{ \northwest \pgf@y=0pt}
+ \anchor{ain}{ \northwest \pgf@y=0pt}
+
+ \anchor{center}{ \central \pgf@y=0pt }
+ \anchor{east}{ \northeast \pgf@y=0pt }
+ \anchor{west}{ \northwest \pgf@y=0pt }
+ \anchor{south}{ \central \pgf@y=-\pgf@y }
+ \anchor{north}{ \central }
+ \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
+ \anchor{north east}{ \northeast }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
+
+ \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
+ \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
+ \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
+ \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
+ \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
+ \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
+ \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
+ \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
+ \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
+
+ \backgroundpath{
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+ \pgf@circ@res@right = \width
+ \pgf@circ@res@left = -\width
+
+ \pgfscope %wiper
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \pgf@circ@res@temp=\radius\relax
+ \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
+ \pgfsetlinewidth{2\pgf@circ@res@temp}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
+ \pgfsetroundcap\pgfusepath{draw}
+ \endpgfscope
+
+ \ifpgf@circ@rotaryarrow
+ \pgfscope % arrow
+ \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth}
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
+ \pgftransformrotate{\wiper}
+ \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
+ \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
+ \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
+ \pgfusepath{draw}
+ \endpgfscope
+ \fi
+
+ % \typeout{CHANNELS\space\channels\space ANGLE\space\angle}
+ \c@pgf@counta=\channels\relax
+ \pgfmathsetmacro{\currenta}{-\angle}
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0
+ % \typeout{LOOP\space\the\c@pgf@counta\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
+ \pgfscope
+ \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out \the\c@pgf@counta}{\pgfusepath{stroke}}
+ \endpgfscope
+ \pgfmathsetmacro{\currenta}{\currenta+\stepa}
+ \advance\c@pgf@counta by -1\relax%
+ \repeatpgfmathloop
+
+ \pgfscope % input
+ \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
+ \endpgfscope
+ }
+ % \pgf@sh@s@<name of the shape here> contains all the code for the shape
+ % and is executed just before a node is drawn.
+ \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
+ % Start with the maximum pin number and go backwards.
+ \c@pgf@counta=\channels\relax
+ \pgfmathloop%
+ \ifnum\c@pgf@counta>0
+ % we will create two anchors per pin: the "normal one" like `pin 1` for the
+ % electrical contact, and the "border one" like `bpin 1` for labels.
+ % they will coincide if `external pins width` is set to 0.
+ \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@circ@rotaryanchor{\the\c@pgf@counta}{1}{0}%
+ }
+ \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@circ@rotaryanchor{\the\c@pgf@counta}{0}{0}%
+ }
+ \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@circ@rotaryanchor{\the\c@pgf@counta}{0}{1}%
+ }
+ \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\c@pgf@counta\endcsname{%
+ \noexpand\pgf@circ@rotarysqanchor{\the\c@pgf@counta}{0}%
+ }
+ \advance\c@pgf@counta by -1\relax%
+ \repeatpgfmathloop%
+ }%
}
-\def\pgf@circ@chippinanchorQL#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{-\width/2-\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
+
+\def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
+ \pgf@circ@res@temp=\width
+ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
+ \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
+ \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
+ \advance\pgf@x by -\pgf@circ@res@temp
}
-\def\pgf@circ@chippinanchorQT#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}{\height/2+\extshift}%
+
+\def\pgf@circ@rotarysqanchor#1{% external square anchors
+ \pgf@circ@res@temp=\width
+ \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
+ \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
+ \advance\pgf@x by -\pgf@circ@res@temp
}
-\def\pgf@circ@chippinanchorQB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}{-\height/2-\extshift}%
+
+% Seven segments displays
+
+\pgfdeclareshape{bare7seg}{
+ \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
+ \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
+ \ifpgf@circ@sevenseg@dot
+ \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
+ \else
+ \pgf@x=0pt
+ \fi
+ }
+ % The object extension is more or less (-width/2,-width) to (width/2,width)
+ % and adjusted for line thickness (both sides) and eventually the dot
+ \saveddimen{\width}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}}
+ \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
+ \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
+ \savedanchor{\southwest}{% both negative
+ \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen
+ -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
+ \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@Rlen
+ -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
+ }
+ \savedanchor{\northeast}{% both positive
+ \ifpgf@circ@sevenseg@dot
+ \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
+ \else
+ \pgf@circ@res@other=0pt
+ \fi
+ \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen
+ +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
+ \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen
+ +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
+ }
+ \savedanchor{\topright}{% anchor without the box sep and the thickness
+ \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@Rlen}
+ }
+ \anchor{center}{\pgfpointorigin}
+ \anchor{north west}{\southwest\pgf@y=-\pgf@y}
+ \anchor{north east}{\northeast}
+ \anchor{south east}{\northeast\pgf@y=-\pgf@y}
+ \anchor{south west}{\southwest}
+ \anchor{north}{\northeast\pgf@x=0pt}
+ \anchor{east}{\northeast\pgf@y=0pt}
+ \anchor{south}{\southwest\pgf@x=0pt}
+ \anchor{west}{\southwest\pgf@y=0pt}
+ \anchor{a}{\topright\pgf@x=0pt}
+ \anchor{b}{\topright\pgf@y=0.5\pgf@y}
+ \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
+ \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
+ \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
+ \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
+ \anchor{g}{\pgfpointorigin}
+ \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
+ \behindbackgroundpath{%
+ \southwest % I do not want the dot here, it will stick out
+ \pgf@circ@res@up = -\pgf@y
+ \pgf@circ@res@down = \pgf@y
+ \pgf@circ@res@right = \pgf@x
+ \pgf@circ@res@left = -\pgf@x
+ \pgfscope
+ \pgfsetlinewidth{\ctikzvalof{multipoles/thickness}\pgflinewidth}
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+ \pgfpathrectanglecorners%
+ {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
+ {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
+ \ifpgf@circ@sevenseg@box
+ \pgf@circ@draworfill
+ \else
+ \pgf@circ@maybefill
+ \fi
+ \endpgfscope
+ \edef\bits{\ctikzvalof{seven seg/bits}}
+ \pgfscope
+ \pfg@circ@sseg@drawbits{\bits}
+ \endpgfscope
+ \pgfscope
+ \ifpgf@circ@sevenseg@dot
+ \pgf@circ@sseg@drawdots
+ \fi
+ \endpgfscope
+ }
}
-\def\pgf@circ@chippinanchorQRB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
+
+\def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
+ \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
}
-\def\pgf@circ@chippinanchorQLB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{-\width/2}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
+\def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
+ \ifnum #1 > 0\relax
+ \pgfsetcolor{\ctikzvalof{seven seg/color on}}
+ \else
+ \pgfsetcolor{\ctikzvalof{seven seg/color off}}
+ \fi
+ \pgfpathmoveto{\pgfpoint{#2}{#3}}
+ \pgfpathlineto{\pgfpoint{#4}{#5}}
+ \pgfusepath{draw}
}
-\def\pgf@circ@chippinanchorQTB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}{\height/2}%
+\def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
+ \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
+ \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
+ \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
+ % \pgfsetroundcap
+ \pgfsetarrowsstart{Triangle Cap[]}
+ \pgfsetarrowsend{Triangle Cap[]}
+ % segments
+ \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
+ \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
+ \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
+ \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
+ \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
+ \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
+ \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
}
-\def\pgf@circ@chippinanchorQBB#1{%
- % When this macro is called,
- % \extshift, \height and \chipspacing will be defined.
- \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}{-\height/2}%
+\def\pgf@circ@sseg@drawdots{% dots
+ \edef\what{empty}
+ \ifx\what\pgf@circ@sevenseg@dotstate
+ % do nothing
+ \else
+ \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
+ \edef\what{off}
+ \ifx\what\pgf@circ@sevenseg@dotstate
+ % dot off
+ \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
+ \pgfsetcolor{\ctikzvalof{seven seg/color off}}
+ \else
+ % dot on
+ \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
+ \pgfsetcolor{\ctikzvalof{seven seg/color on}}
+ \fi
+ \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
+ \pgfusepath{draw,fill}
+ \fi
}
-
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
index cb1c15022bd..bc10b95dc44 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
@@ -23,14 +23,11 @@
\newif\ifpgf@circuit@bipole@inverted
\ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
-
\newif\ifpgf@circuit@bipole@voltage@backward
\ctikzset{bipole/voltage/direction/.is choice}
\ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
\ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
-
-
% Initialize paths
\def\pgfcircresetpath{
\ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
@@ -139,6 +136,56 @@
\tikztonodes%draw pending nodes an path
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Handling of terminals
+
+\ctikzset{bipole/nodes/.is family}
+\ctikzset{bipole/nodes/left/.initial=none}
+\ctikzset{bipole/nodes/right/.initial=none}
+\tikzset{bipole nodes/.style n args={2}{%
+ \circuitikzbasekey/bipole/nodes/left=#1,
+ \circuitikzbasekey/bipole/nodes/right=#2
+ }
+}
+
+%% Easily usable styles
+
+\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+
+% rectjoinfill workarounds
+
+\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
+\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
+\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
+\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
+\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
+
+\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
+
+\def\drawpoles{
+ \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
+ \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
+ \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
+ \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
+}
%% Path definitions
\def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex
index b1082ac4a12..a09d2076e66 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircquadpoles.tex
@@ -18,7 +18,7 @@
\pgf@x=0pt
\pgf@y=0pt
}
- \savedmacro{\stretto}{\def\stretto{0.4}}
+ \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
\savedanchor\northwest{%
\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen
\pgf@y=.5\pgf@y
@@ -254,6 +254,234 @@
}
+\pgfcircdeclarequadpole{transformer}{
+ \pgf@circ@drawtransformerbasicbody
+}{\pgf@circ@drawtransformerbasicanchor}
+
+\pgfcircdeclarequadpole{transformer core}{
+
+ \pgf@circ@drawtransformerbasicbody
+
+ \pgfmoveto{\pgfpoint%
+ {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
+ }
+ \pgflineto{
+ \pgfpoint
+ {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
+ }
+
+ \pgfmoveto{\pgfpoint%
+ {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
+ }
+ \pgflineto{
+ \pgfpoint
+ {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}%
+ {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
+ }
+
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth}
+ \pgfusepath{draw}
+}{\pgf@circ@drawtransformerbasicanchor}
+
+
+\pgfcircdeclarequadpole{gyrator}{
+
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
+
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
+
+ \pgfusepath{draw}
+
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth}
+ \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}}
+ \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down}
+
+ \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}}
+ \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down}
+ \pgfusepath{draw}
+
+}{}
+
+%% four-port
+% defines a general outer box for four-ports
+% TikZ usage:
+% \draw (0,0) node[coupler](coup){\SI{-3}{dB}}
+% (coup.port1) to[short,-o] ++(-1,0)
+%
+
+\long\def\pgfcircdeclarefourport#1#2{
+ \pgfdeclareshape{#1}{
+ \anchor{center}{
+ \northwest
+ \pgf@x=0pt
+ \pgf@y=0pt
+ }
+ \savedanchor\northwest{%
+ \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen
+ \pgf@y=.5\pgf@y
+ \pgf@x=.5\pgf@circ@Rlen
+ \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x
+ }
+ \anchor{north}{
+ \northwest
+ \pgf@x=0pt
+ }
+ \anchor{south}{
+ \northwest
+ \pgf@x=0pt
+ \pgf@y=-\pgf@y
+ }
+ \anchor{west}{
+ \northwest
+ \pgf@y=0pt
+ }
+ \anchor{east}{
+ \northwest
+ \pgf@y=0pt
+ \pgf@x=-\pgf@x
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf@y=-\pgf@y
+ }
+ \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{port1}{
+ \northwest
+ \pgf@y=-0.5\pgf@y
+ }
+ \anchor{port2}{
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=-0.5\pgf@y
+ }
+ \anchor{port3}{
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=0.5\pgf@y
+ }
+ \anchor{port4}{
+ \northwest
+ \pgf@y=0.5\pgf@y
+ }
+ \anchor{1}{
+ \northwest
+ \pgf@y=-0.5\pgf@y
+ }
+ \anchor{2}{
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=-0.5\pgf@y
+ }
+ \anchor{3}{
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=0.5\pgf@y
+ }
+ \anchor{4}{
+ \northwest
+ \pgf@y=0.5\pgf@y
+ }
+
+ \anchor{text}{
+ \northwest
+ \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
+ \pgf@x=-.5\wd\pgfnodeparttextbox
+ }
+ \backgroundpath{
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+
+ \northwest
+ \pgf@circ@res@up = \pgf@y
+ \pgf@circ@res@down = -\pgf@y
+ \pgf@circ@res@right = -\pgf@x
+ \pgf@circ@res@left = \pgf@x
+
+ \pgfstartlinewidth=\pgflinewidth
+
+ % draw outer box
+ \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
+ \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
+ \pgfusepath{draw}
+
+ % draw inner stuff
+ #2
+
+ % draw inner text
+ \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
+ }
+ }
+}
+
+% four-port
+\pgfcircdeclarefourport{fourport}{}
+
+
+% straight coupler
+\pgfcircdeclarefourport{coupler}{
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
+ \pgfsetarrows{latex-latex}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
+ \pgfsetarrows{latex-latex}
+ \pgfusepath{draw}
+}
+
+% "bended" coupler
+\pgfcircdeclarefourport{coupler2}{
+ \pgfsetlinewidth{\pgfstartlinewidth}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
+ \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
+ \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+
+ \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
+ \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+ \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
+ \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
+ \pgfsetarrowsend{latex}
+ \pgfusepath{draw}
+}
% contrib Kristofer M. Monisit
@@ -650,233 +878,3 @@
\pgfusepath{draw}
}
}
-
-
-\pgfcircdeclarequadpole{transformer}{
- \pgf@circ@drawtransformerbasicbody
-}{\pgf@circ@drawtransformerbasicanchor}
-
-\pgfcircdeclarequadpole{transformer core}{
-
- \pgf@circ@drawtransformerbasicbody
-
- \pgfmoveto{\pgfpoint%
- {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}%
- {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
- }
- \pgflineto{
- \pgfpoint
- {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@right}%
- {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
- }
-
- \pgfmoveto{\pgfpoint%
- {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}%
- {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
- }
- \pgflineto{
- \pgfpoint
- {\ctikzvalof{quadpoles/transformer core/core width}\pgf@circ@res@left}%
- {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
- }
-
- \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth}
- \pgfusepath{draw}
-}{\pgf@circ@drawtransformerbasicanchor}
-
-
-\pgfcircdeclarequadpole{gyrator}{
-
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
-
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
-
- \pgfusepath{draw}
-
- \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/quadpoles/thickness}\pgflinewidth}
- \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}}
- \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down}
-
- \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}}
- \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down}
- \pgfusepath{draw}
-
-}{}
-
-%% four-port
-% defines a general outer box for four-ports
-% TikZ usage:
-% \draw (0,0) node[coupler](coup){\SI{-3}{dB}}
-% (coup.port1) to[short,-o] ++(-1,0)
-%
-
-\long\def\pgfcircdeclarefourport#1#2{
- \pgfdeclareshape{#1}{
- \anchor{center}{
- \northwest
- \pgf@x=0pt
- \pgf@y=0pt
- }
- \savedanchor\northwest{%
- \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/height}\pgf@circ@Rlen
- \pgf@y=.5\pgf@y
- \pgf@x=.5\pgf@circ@Rlen
- \pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/quadpoles/#1/width}\pgf@x
- }
- \anchor{north}{
- \northwest
- \pgf@x=0pt
- }
- \anchor{south}{
- \northwest
- \pgf@x=0pt
- \pgf@y=-\pgf@y
- }
- \anchor{west}{
- \northwest
- \pgf@y=0pt
- }
- \anchor{east}{
- \northwest
- \pgf@y=0pt
- \pgf@x=-\pgf@x
- }
- \anchor{south west}{
- \northwest
- \pgf@y=-\pgf@y
- }
- \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{port1}{
- \northwest
- \pgf@y=-0.5\pgf@y
- }
- \anchor{port2}{
- \northwest
- \pgf@x=-\pgf@x
- \pgf@y=-0.5\pgf@y
- }
- \anchor{port3}{
- \northwest
- \pgf@x=-\pgf@x
- \pgf@y=0.5\pgf@y
- }
- \anchor{port4}{
- \northwest
- \pgf@y=0.5\pgf@y
- }
- \anchor{1}{
- \northwest
- \pgf@y=-0.5\pgf@y
- }
- \anchor{2}{
- \northwest
- \pgf@x=-\pgf@x
- \pgf@y=-0.5\pgf@y
- }
- \anchor{3}{
- \northwest
- \pgf@x=-\pgf@x
- \pgf@y=0.5\pgf@y
- }
- \anchor{4}{
- \northwest
- \pgf@y=0.5\pgf@y
- }
-
- \anchor{text}{
- \northwest
- \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
- \pgf@x=-.5\wd\pgfnodeparttextbox
- }
- \backgroundpath{
- \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
-
- \northwest
- \pgf@circ@res@up = \pgf@y
- \pgf@circ@res@down = -\pgf@y
- \pgf@circ@res@right = -\pgf@x
- \pgf@circ@res@left = \pgf@x
-
- \pgfstartlinewidth=\pgflinewidth
-
- % draw outer box
- \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
- \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
- \pgfusepath{draw}
-
- % draw inner stuff
- #2
-
- % draw inner text
- \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
- }
- }
-}
-
-% four-port
-\pgfcircdeclarefourport{fourport}{}
-
-
-% straight coupler
-\pgfcircdeclarefourport{coupler}{
- \pgfsetlinewidth{\pgfstartlinewidth}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
- \pgfusepath{draw}
-
- \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
- \pgfsetarrows{latex-latex}
- \pgfusepath{draw}
- \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
- \pgfsetarrows{latex-latex}
- \pgfusepath{draw}
-}
-
-% "bended" coupler
-\pgfcircdeclarefourport{coupler2}{
- \pgfsetlinewidth{\pgfstartlinewidth}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
- \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
- \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
- \pgfusepath{draw}
-
- \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
- \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
- \pgfsetarrowsend{latex}
- \pgfusepath{draw}
- \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
- \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
- \pgfsetarrowsend{latex}
- \pgfusepath{draw}
-
- \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
- \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
- \pgfsetarrowsend{latex}
- \pgfusepath{draw}
- \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
- \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
- \pgfsetarrowsend{latex}
- \pgfusepath{draw}
-}
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex
index 82eddb17453..657d0664f60 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircshapes.tex
@@ -126,7 +126,7 @@
\pgfpointorigin
}
\savedanchor\northwest{%
- \pgf@y=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen
+ \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
\pgf@x=-\pgf@y
}
\anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
@@ -143,23 +143,184 @@
\anchor{north west}{ \northwest }
\anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
\anchorborder{
- \pgf@circ@res@left=\pgf@x
- \pgf@circ@res@up=\pgf@y
+ % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
+ \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
+ \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
+ \pgfextracty{\pgf@circ@res@up}{\northwest}
+ % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
+ \pgf@x=\@@switchx\pgf@x
+ \pgf@y=\@@switchy\pgf@y
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgftransformrotate{45}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
+ {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+ \pgfsetfillopacity{1.0}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% Diamond terminal, unfilled
+
+\pgfdeclareshape{odiamondpole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgf@x=-\pgf@y
+ }
+ \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
+ \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{west}{ \northwest \pgf@y=0pt }
+ \anchor{w}{ \northwest \pgf@y=0pt }
+ \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{north}{ \northwest \pgf@x=0pt }
+ \anchor{n}{ \northwest \pgf@x=0pt }
+ \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
+ \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
+ \anchorborder{
+ % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
+ \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
+ \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
+ \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
+ \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
+ \pgfextracty{\pgf@circ@res@up}{\northwest}
+ % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
+ % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
+ \pgfpointintersectionoflines
+ {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
+ % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
+ \pgf@x=\@@switchx\pgf@x
+ \pgf@y=\@@switchy\pgf@y
}
\behindforegroundpath{
\pgfscope
- \pgfmathsetlength{\pgf@circ@res@temp}{\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgf@circ@Rlen}
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
\pgftransformrotate{45}
\pgfpathrectanglecorners
- {\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@temp}{\pgf@circ@res@up+\pgf@circ@res@temp}}
- {\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up-\pgf@circ@res@temp}}
+ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
+ {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+ \ifx\tikz@fillcolor\pgfutil@empty
+ \pgfsetfillcolor{white}
+ \else
+ \pgfsetfillcolor{\tikz@fillcolor}
+ \fi
+ \pgfsetfillopacity{1.0}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
+
+%% square terminal, filled
+
+\pgfdeclareshape{squarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgf@x=-\pgf@y
+ }
+ \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
+ \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{west}{ \northwest \pgf@y=0pt }
+ \anchor{w}{ \northwest \pgf@y=0pt }
+ \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{north}{ \northwest \pgf@x=0pt }
+ \anchor{n}{ \northwest \pgf@x=0pt }
+ \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
+ \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
+ \anchorborder{
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgfextracty{\pgf@circ@res@up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
+ {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
\pgfsetfillopacity{1.0}
\pgfusepath{draw,fill}
\endpgfscope
}
}
+%% square terminal, unfilled
+\pgfdeclareshape{osquarepole}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgf@x=-\pgf@y
+ }
+ \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
+ \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
+ \anchor{west}{ \northwest \pgf@y=0pt }
+ \anchor{w}{ \northwest \pgf@y=0pt }
+ \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
+ \anchor{north}{ \northwest \pgf@x=0pt }
+ \anchor{n}{ \northwest \pgf@x=0pt }
+ \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
+ \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
+ \anchor{north west}{ \northwest }
+ \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
+ \anchorborder{
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgfextracty{\pgf@circ@res@up}{\northwest}
+ \pgfpointborderrectangle
+ {\pgfqpoint{\pgf@xa}{\pgf@ya}}
+ {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
+ }
+ \behindforegroundpath{
+ \pgfscope
+ \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
+ \pgfpathrectanglecorners
+ {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
+ {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
+ \pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
+ \ifx\tikz@fillcolor\pgfutil@empty
+ \pgfsetfillcolor{white}
+ \else
+ \pgfsetfillcolor{\tikz@fillcolor}
+ \fi
+ \pgfsetfillopacity{1.0}
+ \pgfusepath{draw,fill}
+ \endpgfscope
+ }
+}
% BNC connector
\pgfdeclareshape{bnc}{
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex
index 5a0417ed240..bfcffe9d359 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcirctripoles.tex
@@ -145,13 +145,23 @@
\pgf@x=0pt
\pgf@y=.5\pgf@circ@res@other
}
+ % radius of the connector
+ % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
+ \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
+ % shapename
+ \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
+ % shape type
+ \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
% mid of the lever, to stack switches
\anchor{mid}{\midlever}
-
- \anchor{left}{\northwest \pgf@y=0pt }
- \anchor{in}{ \northwest \pgf@y=0pt}
- \anchor{out 1}{ \northwest \pgf@x=-\pgf@x }
- \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
+ % center anchors
+ \anchor{cin}{ \northwest \pgf@y=0pt}
+ \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
+ \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
+ % horizontal angles
+ \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
+ \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
+ \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
\anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
\anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
@@ -173,7 +183,7 @@
\pgfscope
% This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
- \pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/nodes width}\pgf@circ@Rlen
+ \pgf@circ@res@temp=\radius\relax
\pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
\pgfsetlinewidth{2\pgf@circ@res@temp}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
@@ -186,15 +196,15 @@
% terminals
\pgfscope
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
- \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
\endpgfscope
\pgfscope
\pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
- \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
+ \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
\endpgfscope
\pgfscope
\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
- \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
+ \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
\endpgfscope
}
@@ -347,14 +357,14 @@
\pgf@circ@res@right = \pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/width}\pgf@circ@Rlen
\pgf@circ@res@right = .5\pgf@circ@res@right
\pgf@circ@res@left = -\pgf@circ@res@right
- }%
- \savedmacro\inputs{% get number of inputs
- \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
- \ifnum\pgf@circ@res@count=0
- \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax%
- \fi
+ }%
+ \savedmacro\inputs{% get number of inputs
+ \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
+ \ifnum\pgf@circ@res@count=0
+ \pgf@circ@res@count=\pgfkeysvalueof{/tikz/circuitikz/tripoles/american #1 port/inputs}\relax%
+ \fi
\ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
- \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
+ \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
\def\inputs{\the\pgf@circ@res@count}%
}%
\savedanchor\step{% 1/2 gap at edges
@@ -4178,4 +4188,346 @@
}
}
+% Electronic tubes, submitted by J. op den Brouw
+
+% Draw tube outline
+\def\pgf@circ@tubes@drawtube{%
+ \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
+ \pgfutil@tempdima=\pgf@circ@res@right
+ \advance\pgfutil@tempdima by -\pgf@circ@res@up
+ \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
+ \pgfpatharc{90}{-90}{\pgf@circ@res@up}
+ \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
+ \pgfpatharc{270}{90}{\pgf@circ@res@up}
+ \else
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
+ \pgfutil@tempdima=\pgf@circ@res@up
+ \advance\pgfutil@tempdima by -\pgf@circ@res@right
+ \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
+ \pgfpatharc{180}{0}{\pgf@circ@res@right}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
+ \pgfpatharc{180}{0}{-\pgf@circ@res@right}
+ \fi
+ \pgfpathclose
+}
+
+%% The diode (tube), triode, tetrode and pentode only differ in the
+%% number of grids. So we construct a generic declare function in
+%% which we can put code for the grid anchors and grid drawing code
+%% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
+\long\def\pgfcircdeclaretube#1#2#3{%
+ \pgfdeclareshape{#1}{
+ \anchor{center}{
+ \pgfpointorigin
+ }
+ \savedanchor\northwest{%
+ \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen
+ \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen
+ % x and y should be half the Rlen
+ \pgf@y=\pgf@circ@res@up
+ \pgf@y=.5\pgf@y
+ \pgf@x=-\pgf@circ@res@right
+ \pgf@x=.5\pgf@x
+ }
+ \anchor{north} {%
+ \northwest
+ \pgf@x=0pt
+ }
+ \anchor{east}{%
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=0pt
+ }
+ \anchor{south}{%
+ \northwest
+ \pgf@y=-\pgf@y
+ \pgf@x=0pt
+ }
+ \anchor{west}{%
+ \northwest
+ \pgf@y=0pt
+ }
+ \anchor{north west}{%
+ \northwest
+ }
+ \anchor{north east}{%
+ \northwest
+ \pgf@x=-\pgf@x
+ }
+ \anchor{south east}{
+ \northwest
+ \pgf@x=-\pgf@x
+ \pgf@y=-\pgf@y
+ }
+ \anchor{south west}{
+ \northwest
+ \pgf@y=-\pgf@y
+ }
+ \anchor{anode} {%
+ \northwest
+ \pgf@x=0pt
+ }
+ \anchor{cathode}{%
+ \northwest
+ \pgf@y=-\pgf@y
+ \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
+ }
+ \anchor{cathode 1}{%
+ \northwest
+ \pgf@y=-\pgf@y
+ \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
+ }
+ \anchor{cathode 2}{%
+ \northwest
+ \pgf@y=-\pgf@y
+ \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
+ }
+ \anchor{filament 1}{%
+ \northwest
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf@x=\pgfmathresult\pgf@x
+ \pgf@y=-\pgf@y
+ }
+ \anchor{filament 2}{%
+ \northwest
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf@x=-\pgfmathresult\pgf@x
+ \pgf@y=-\pgf@y
+ }
+
+ % Extra anchors
+ #2
+
+ \backgroundpath{
+ \pgfscope
+ % Line width for tripoles
+ \pgfsetlinewidth{\ctikzvalof{tripoles/thickness}\pgflinewidth}
+
+ % Setup to draw tube
+ \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen
+ \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen
+ \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
+ \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
+
+ % Tube fill color (if any)
+ \ifx\tikz@fillcolor\pgfutil@empty
+ \else
+ \pgfscope
+ \pgfsetfillcolor{\tikz@fillcolor}
+ \pgf@circ@tubes@drawtube
+ \pgfusepath{fill}
+ \endpgfscope
+ \fi
+
+ % Tube outline
+ \pgf@circ@tubes@drawtube
+
+ % Setup to draw grid, filament, anode and cathode
+ \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@Rlen
+ \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@Rlen
+ \pgf@circ@res@up=0.5\pgf@circ@res@up
+ \pgf@circ@res@right=0.5\pgf@circ@res@right
+
+ % Grid drawing
+ #3
+
+ % Filament (is not drawn by default)
+ \ifpgf@circuit@tubes@filament
+ \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
+ \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
+ \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
+ \pgf@xa=\pgfmathresult\pgf@circ@res@right
+ \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
+ \pgf@ya=\pgfmathresult\pgf@circ@res@up
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
+ \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
+ \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
+ \pgf@circuit@tubes@filamentfalse
+ \fi
+
+ % Anode (or plate)
+ \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
+ \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
+
+ % Cathode
+ \ifpgf@circuit@tubes@nocathode
+ \pgf@circuit@tubes@nocathodefalse
+ \else
+ \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
+ \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
+ \ifpgf@circuit@tubes@fullcathode
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
+ \pgf@circuit@tubes@fullcathodefalse
+ \else
+ \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}}
+ \fi
+ \fi
+
+ % Draw the background
+ \pgfusepath{draw}
+
+ \endpgfscope
+ }
+ }
+}
+
+\pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
+
+\pgfcircdeclaretube{triode}
+{
+ \anchor{grid} {%
+ \northwest
+ \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
+ }
+}
+{
+ % Grid protrusion
+ \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
+ \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
+ % Grid dashes: calculations
+ \pgf@xb=2\pgf@circ@res@right
+ \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
+ \@tempcnta=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\@tempcnta by 2\relax
+ \advance\@tempcnta by 1\relax
+ \advance\pgf@circ@res@step by -\pgf@xa
+ \divide\pgf@circ@res@step by \@tempcnta
+ % Grid dashes: draw
+ \pgf@circ@res@temp=\pgf@xa
+ \@tempcnta=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
+ \advance\@tempcnta by-1
+ \ifnum\@tempcnta>0\relax
+ \repeat
+}
+
+\pgfcircdeclaretube{tetrode}
+{
+ \anchor{grid} {%
+ \northwest
+ \pgfutil@tempdima=\pgf@y
+ \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
+ \pgf@y=0.5\pgf@y
+ \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
+ }
+ \anchor{screen} {%
+ \northwest
+ \pgfutil@tempdima=\pgf@y
+ \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
+ \pgf@y=0.5\pgf@y
+ \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
+ }
+}
+{
+ % Grid x/y points
+ \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
+ \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
+ \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
+ \pgfutil@tempdimb=-\pgfutil@tempdima
+ \pgfutil@tempdima=0.5\pgfutil@tempdima
+ \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
+ \pgfutil@tempdimb=0.5\pgfutil@tempdimb
+ \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
+ % Grid protrusion
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
+ % Grid dashes: calculations
+ \pgf@xb=2\pgf@circ@res@right
+ \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
+ \@tempcnta=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\@tempcnta by 2\relax
+ \advance\@tempcnta by 1\relax
+ \advance\pgf@circ@res@step by -\pgf@xa
+ \divide\pgf@circ@res@step by \@tempcnta
+ % Grid dashes: draw
+ \pgf@circ@res@temp=\pgf@xa
+ \@tempcnta=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \advance\@tempcnta by-1
+ \ifnum\@tempcnta>0\relax
+ \repeat
+}
+
+\pgfcircdeclaretube{pentode}
+{
+ \anchor{grid} {%
+ \northwest
+ \pgfutil@tempdima=\pgf@y
+ \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
+ \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
+ }
+ \anchor{screen} {%
+ \northwest
+ \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
+ }
+ \anchor{suppressor} {%
+ \northwest
+ \pgfutil@tempdima=\pgf@y
+ \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
+ \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
+ }
+}
+{
+ % Grid x/y points
+ \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
+ \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
+ \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
+ \pgfutil@tempdimb=-\pgfutil@tempdima
+ \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
+ \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
+ \@tempdimc=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
+ % Grid protrusion
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
+ \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\@tempdimc}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\@tempdimc}}
+ % Grid dashes: calculations
+ \pgf@xb=2\pgf@circ@res@right
+ \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
+ \@tempcnta=\ctikzvalof{tubes/grid dashes} % dashes*2+1
+ \multiply\@tempcnta by 2\relax
+ \advance\@tempcnta by 1\relax
+ \advance\pgf@circ@res@step by -\pgf@xa
+ \divide\pgf@circ@res@step by \@tempcnta
+ % Grid dashes: draw
+ \pgf@circ@res@temp=\pgf@xa
+ \@tempcnta=\ctikzvalof{tubes/grid dashes}
+ \loop
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
+ \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\@tempdimc}}
+ \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\@tempdimc}}
+ \advance\pgf@circ@res@temp by\pgf@circ@res@step
+ \advance\@tempcnta by-1
+ \ifnum\@tempcnta>0\relax
+ \repeat
+}
+
\endinput