summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikzcodeblocks
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-18 21:37:01 +0000
committerKarl Berry <karl@freefriends.org>2017-07-18 21:37:01 +0000
commit1f97875f5539ae5a035a4c2934f55bd0b170c9ae (patch)
treed9a8d431ca0e12c9b883fca35e3aa8ca289477c6 /Master/texmf-dist/tex/latex/tikzcodeblocks
parent1259233aec698e07b7aedb390f151aec2f552a22 (diff)
tikzcodeblocks (18jul17)
git-svn-id: svn://tug.org/texlive/trunk@44841 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzcodeblocks')
-rw-r--r--Master/texmf-dist/tex/latex/tikzcodeblocks/tikzcodeblocks.sty650
1 files changed, 448 insertions, 202 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzcodeblocks/tikzcodeblocks.sty b/Master/texmf-dist/tex/latex/tikzcodeblocks/tikzcodeblocks.sty
index de90a723a29..05c9f6007e6 100644
--- a/Master/texmf-dist/tex/latex/tikzcodeblocks/tikzcodeblocks.sty
+++ b/Master/texmf-dist/tex/latex/tikzcodeblocks/tikzcodeblocks.sty
@@ -1,11 +1,12 @@
% -*- coding: utf-8; -*-
-% CC-BY Adrian Salamon
+% Adrian Salamon
% Bergische Universitaet Wuppertal
-% 2017-07-06
+% 2017-07-18
+% LaTeX project public license, version 1.3c
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikzcodeblocks}[2016/07/04 TikZ Styles und Makros zum Setzen von graphischen Programmcodes, wie beim Calliopeeditor, NEPO oder Scratch]
+\ProvidesPackage{tikzcodeblocks}[2016/07/18 v.0.11 - TikZ Styles and macros for typesetting blockwise graphic programming languages like scratch, nepo or pxt]
\RequirePackage{adjustbox}
\RequirePackage{xcolor}
@@ -16,79 +17,64 @@
\usetikzlibrary{matrix, positioning, fit,calc,shapes,backgrounds,math,trees,decorations.markings,shapes,arrows.meta,arrows}
\usetikzlibrary{decorations,decorations.pathmorphing}
-\RequirePackage{xspace}
+\RequirePackage{translations}
+\RequirePackage{xspace}
\RequirePackage{ifthen}
-\newboolean{pxt-colors}
-\setboolean{pxt-colors}{true}
-\newboolean{nepo-colors}
-\setboolean{nepo-colors}{false}
+\newboolean{no-colors}
+\setboolean{no-colors}{false}
-\DeclareOption{pxt}{
- \setboolean{pxt-colors}{true}
+\DeclareOption{print}{
+ \setboolean{no-colors}{true}
}
-\DeclareOption{openroberta}{
- \setboolean{nepo-colors}{true}
-}
-
-\ExecuteOptions{pxt} %calliope colors are standard
\ProcessOptions\relax
+% % %
+% Translations
+% % %
+\DeclareTranslationFallback {if}{if}
+\DeclareTranslation{English}{if}{if}
+\DeclareTranslation{German} {if}{wenn}
+\DeclareTranslationFallback {then}{then}
+\DeclareTranslation{English}{then}{then}
+\DeclareTranslation{German} {then}{dann}
-% % %
-% Variablen für Einzüge und Positonierungen
-% % %
+\DeclareTranslationFallback {else}{else}
+\DeclareTranslation{English}{else}{else}
+\DeclareTranslation{German} {else}{sonst}
-% xshift= \einzug
-% xshift= -\einzug
-\newlength{\einzug}
-\setlength{\einzug}{1em}
-\newlength{\abstand}
-\setlength{\abstand}{2pt}
+\DeclareTranslationFallback {do}{do}
+\DeclareTranslation{English}{do}{do}
+\DeclareTranslation{German} {do}{mache}
-\newboolean{keineinzug}
-\setboolean{keineinzug}{true}
-\newcommand{\einruecken}[1]{\setboolean{keineinzug}{false}#1\setboolean{keineinzug}{true}}
-\ifthenelse{\boolean{nepo-colors}}{
% % %
-% Colordefinitions like lab.open-roberta.org
+% Variablen für Einzüge und Positonierungen
% % %
-%
-\definecolor{start-color}{HTML}{E2001A}
-\definecolor{aktion-color}{HTML}{F29400}
-\definecolor{sensoren-color}{HTML}{8FA402}
-\definecolor{kontrolle-color}{HTML}{EB6A0A}
-\definecolor{logik-color}{HTML}{33B8CA}
-\definecolor{mathematik-color}{HTML}{005A94}
-\definecolor{text-color}{HTML}{BACC1E}
-\definecolor{listen-color}{HTML}{39378B}
-\definecolor{farben-color}{HTML}{EBC300}
-\definecolor{bilder-color}{HTML}{DF01D7}
-\definecolor{variablen-color}{HTML}{9085BA}
-\definecolor{funktionen-color}{HTML}{179C7D}
-\definecolor{nachrichten-color}{HTML}{FF69B4}
-%
-\definecolor{int-color}{HTML}{005A94}
-\definecolor{string-color}{HTML}{BACC1E}
-\definecolor{boolean-color}{HTML}{33B8CA}
-\definecolor{color-color}{HTML}{EBC300}
-}{}
+% xshift= \blockhspace
+% xshift= -\blockhspace
+\newlength{\blockhspace}
+\setlength{\blockhspace}{1em}
+\newlength{\blockvspace}
+\setlength{\blockvspace}{2pt}
-\ifthenelse{\boolean{pxt-colors}}{
+\newboolean{noIndentForPin}
+\setboolean{noIndentForPin}{true}
+\newcommand{\einruecken}[1]{\setboolean{noIndentForPin}{false}#1\setboolean{noIndentForPin}{true}}
+
% % %
% Colordefinitions like pxt.calliope.cc
% % %
- %
+ %
\definecolor{grundlagen-color}{HTML}{54C9C9}
\definecolor{eingaben-color}{HTML}{C90072}
\definecolor{musik-color}{HTML}{DF4600}
@@ -106,15 +92,11 @@
\definecolor{konsole-color}{HTML}{002050}
\definecolor{steuerung-color}{HTML}{42495F}
\definecolor{bluetooth-color}{HTML}{0082FB}
- %
+ %
\definecolor{int-color}{HTML}{C6A8C7}
\definecolor{string-color}{HTML}{D6C299}
\definecolor{boolean-color}{HTML}{99C3C6}
\definecolor{color-color}{HTML}{BBE9E9}
-}{}
-%
-
-
\pgfdeclarelayer{background}
@@ -126,6 +108,7 @@
% Code-Block Objects
% % %
+% global styles
\tikzset{
codeblocks/.style = {
font = \ttfamily,rounded corners=2pt, rectangle,thick,
@@ -135,17 +118,18 @@
anchor=base, baseline,
robertashape,
},
- eckig/.style ={rounded corners = 0pt, }
+ eckig/.style ={rounded corners = 0pt},
+ nocolor/.style={fill=white, text = black, draw = black!60},
}
-
+% % PXT-Nodes % %
+%
%
-% Calliope-Nodes
+% Colordefinitions like lab.open-roberta.org
%
-\ifthenelse{\boolean{pxt-colors}}{
- \tikzset{
+\tikzset{
%
- grundlage/.style = {fill=grundlagen-color, text = white, draw = grundlagen-color!60!black, },
+ grundlage/.style = {fill=grundlagen-color, text = white, draw = grundlagen-color!60!black,},
eingabe/.style = {fill=eingaben-color, text = white, draw = eingaben-color!60!black, },
schleife/.style = {fill=schleifen-color, text = white, draw = schleifen-color!60!black, },
logik/.style = {fill=logik-color, text = white, draw = logik-color!60!black, },
@@ -162,70 +146,94 @@
konsole/.style = {fill=konsole-color, text = white, draw = konsole-color!60!black, },
steuerung/.style = {fill=steuerung-color, text = white, draw = steuerung-color!60!black, },
bluetooth/.style = {fill=bluetooth-color, text = white, draw = bluetooth-color!60!black, },
+ %
% Fallback styles / Für NEPO Kommandos
- aktion/.style = {grundlage},
- farbe/.style={grundlage},
+ aktion/.style = {grundlage},
+ farbe/.style={grundlage},
%
- kontrolle/.style = {schleife},
- sensor/.style={pins},
- start/.style={grundlage},
- sensor/.style={eingabe},
- liste/.style={konsole},
- variablen/.style={platzhalter},
- nachricht/.style={bluetooth},
- funktion/.style={steuerung},
+ kontrolle/.style = {schleife},
+ sensor/.style={pins},
+ start/.style={grundlage},
+ sensor/.style={eingabe},
+ liste/.style={konsole},
+ variablen/.style={platzhalter},
+ nachricht/.style={bluetooth},
+ funktion/.style={steuerung},
}
-}{}
-
-
%
-% OpenRoberta-Nodes
+% % % PXT % %
+
+% % OpenRoberta-Nodes %
%
+% OpenRoberta Farben als Option setzbar:
%
-\ifthenelse{\boolean{nepo-colors}}{
+\tikzset{
+ define color/.code 2 args={
+ \definecolor{#1}{HTML}{#2}
+},
+openroberta/.style={
+ square, %keine Rundungen
+ define color={start-color}{E2001A},
+ define color={aktion-color}{F29400},
+ define color={sensoren-color}{8FA402},
+ define color={kontrolle-color}{EB6A0A},
+ define color={logik-color}{33B8CA},
+ define color={mathematik-color}{005A94},
+ define color={text-color}{BACC1E},
+ define color={listen-color}{39378B},
+ define color={farben-color}{EBC300},
+ define color={bilder-color}{DF01D7},
+ define color={variablen-color}{9085BA},
+ define color={funktionen-color}{179C7D},
+ define color={nachrichten-color}{FF69B4},
+ %
+ define color={int-color}{005A94},
+ define color={string-color}{BACC1E},
+ define color={boolean-color}{33B8CA},
+ define color={color-color}{EBC300},
+ %
+ start/.style = {fill=start-color, text = white, draw = start-color!60!black,},
+ aktion/.style = {fill=aktion-color, text = white, draw = aktion-color!60!black,},
+ sensor/.style = {fill=sensoren-color, text = white, draw = sensoren-color!60!black,},
+ kontrolle/.style = {fill=kontrolle-color, text = white, draw = kontrolle-color!60!black,},
+ logik/.style = {fill=logik-color, text = white, draw = logik-color!60!black,},
+ mathe/.style = {fill=mathematik-color, text = white, draw = mathematik-color!60!black,},
+ zeichenkette/.style = {fill=text-color, text = white, draw = text-color!60!black,},
+ liste/.style = {fill=listen-color, text = white, draw = listen-color!60!black,},
+ farbe/.style = {fill=farben-color, text = white, draw = farben-color!60!black,},
+ bild/.style = {fill=bilder-color, text = white, draw = bilder-color!60!black,},
+ variablen/.style = {fill=variablen-color, text = white, draw = variablen-color!60!black,},
+ funktion/.style = {fill=funktionen-color, text = white, draw = funktionen-color!60!black,},
+ nachricht/.style = {fill=nachrichten-color, text = white, draw = nachrichten-color!60!black,},
+ %
+ % Fallback styles / Für PXT Kommandos
+ schleife/.style = {kontrolle},
+ pins/.style={sensor},
+ grundlage/.style={start},
+ eingabe/.style={sensor},
+ konsole/.style={liste},
+ platzhalter/.style={variablen},
+ bluetooth/.style={nachricht},
+ steuerung/.style={funktion},
+ }%robertafarben
+}%tikzset
+
%
- \tikzset{
- %
- start/.style = {fill=start-color, text = white, draw = start-color!60!black,},
- aktion/.style = {fill=aktion-color, text = white, draw = aktion-color!60!black,},
- sensor/.style = {fill=sensoren-color, text = white, draw = sensoren-color!60!black,},
- kontrolle/.style = {fill=kontrolle-color, text = white, draw = kontrolle-color!60!black,},
- logik/.style = {fill=logik-color, text = white, draw = logik-color!60!black,},
- mathe/.style = {fill=mathematik-color, text = white, draw = mathematik-color!60!black,},
- zeichenkette/.style = {fill=text-color, text = white, draw = text-color!60!black,},
- liste/.style = {fill=listen-color, text = white, draw = listen-color!60!black,},
- farbe/.style = {fill=farben-color, text = white, draw = farben-color!60!black,},
- bild/.style = {fill=bilder-color, text = white, draw = bilder-color!60!black,},
- variablen/.style = {fill=variablen-color, text = white, draw = variablen-color!60!black,},
- funktion/.style = {fill=funktionen-color, text = white, draw = funktionen-color!60!black,},
- nachricht/.style = {fill=nachrichten-color, text = white, draw = nachrichten-color!60!black,},
- %
- %openroberta/.style = {rounded corners=0cm, },
- % Fallback styles / Für PXT Kommandos
- schleife/.style = {kontrolle},
- pins/.style={sensor},
- grundlage/.style={start},
- eingabe/.style={sensor},
- konsole/.style={liste},
- platzhalter/.style={variablen},
- bluetooth/.style={nachricht},
- steuerung/.style={funktion},
-% }
-}
-}{}
+%
+% % % Open Roberta % % % % %
-
-% Allgemeine Styles
+
+
+% % Allgemeine Styles
+%
\tikzset{
umgebung/.style = {draw,line width=2pt,transform shape=false}, % yshift ausgleich für die einzelnen elemente
% Bilder/Pictures/LED-Matrix
- punktvoll/.style = {node distance = 1mm, circle,radius=2mm,fill=red, draw=black,opacity=1,draw},
- punktleer/.style = {node distance = 1mm, circle,radius=2mm,fill=white,opacity=0.7,draw=black,draw},
-%
+ ledOn/.style = {node distance = 1mm, circle,radius=2mm,fill=red, draw=black,opacity=1,draw},
+ ledOff/.style = {node distance = 1mm, circle,radius=2mm,fill=white,opacity=0.7,draw=black,draw},
%
-% % %
-% Boxes and smaller elements
-% % %
+%
+% Boxes and smaller elements
%
dropdown/.style = {
fill=white,
@@ -260,16 +268,6 @@
anchor=west,
},
boolbox/.style = {
- fill=boolean-color,boden
- draw=none,
- opacity=0.7, % Leider auch Schriftsichtbarkeit
- rectangle,
- rounded corners=2pt,
- inner sep=3pt,
- text = black,
- anchor=west,
- },
- boolbox/.style = {
fill=color-color,
draw=none,
opacity=0.7, % Leider auch Schriftsichtbarkeit
@@ -280,7 +278,7 @@
anchor=west,
},
% Empty LEDs Help
- ledanzeige/.style ={matrix of nodes, nodes = {punktleer},row sep=4pt,column sep=4pt,ampersand replacement=\&, anchor=base},
+ ledanzeige/.style ={matrix of nodes, nodes = {ledOff},row sep=4pt,column sep=4pt,ampersand replacement=\&, anchor=base},
%
boden/.style = {% Für Baseline anordnung der Dropdown
baseline,anchor=base, text height=1.7ex,text depth=0.3ex, minimum width=1em
@@ -293,7 +291,7 @@
},
%
% unter={NODENAME}{X--ABSTAND}{Y-ABSTAND}
- unter/.style n args={3}{below right = #3\abstand and #2\einzug of #1.south west},
+ unter/.style n args={3}{below right = #3\blockvspace and #2\blockhspace of #1.south west},
%
% https://tex.stackexchange.com/questions/223910/reference-a-nodes-color-by-using-node-name
% Farbe des 'aktuellen' Elementes bestimmen
@@ -338,13 +336,19 @@ every text node part/.add code={}{
;};\xspace
}
-\newcommand{\setupquotes}{\normalfont \bfseries \color{white} } % vielleicht \huge ?
+\ifthenelse{\boolean{no-colors}}
+{
+ \newcommand{\setupquotes}{\normalfont \bfseries \huge \vspace*{1em}\color{black}}
+}
+{
+ \newcommand{\setupquotes}{\normalfont \bfseries \huge \vspace*{1em}\color{white}}
+}
\newcommand{\stringbox}[2][]{
\begin{tikzpicture}[anchor=center,baseline=-4.0pt,]
\strut\node[stringbox,#1](string1){
- {\setupquotes ``}\,\tikz[boden]\strut\node[fill=white,rounded corners=2pt,opacity=1,keinezacken]{#2}
- ;\setupquotes\,''};
+ {\setupquotes ``}\,\tikz[boden]\strut\node[yshift=0.5em,fill=white,rounded corners=2pt,opacity=1,keinezacken]{#2}
+ ;\setupquotes\,''\vspace*{-0.9em}};
\end{tikzpicture}
}
@@ -366,8 +370,8 @@ every text node part/.add code={}{
}
}
-\newcommand{\0}{|[punktleer]|\&}
-\newcommand{\X}{|[punktvoll]|\&}
+\newcommand{\0}{|[ledOff]|\&}
+\newcommand{\X}{|[ledOn]|\&}
\newcommand{\emptyled}
{
@@ -388,19 +392,21 @@ every text node part/.add code={}{
}
+% Structures: Branches and Loops
+% Strukturen: Wenn-Dann/ Wenn-Dann-Sonst / Schleife
%
-% Strukturen: Wenn-Dann/ Wenn-Dann-Sonst
-%
+
\def\myspace{\vspace{5pt}}
+\def\myshift{0.95em}
\newcommand{\wenndann}[4][]{
\node[logik,#1](#4){%
%
\renewcommand{\arraystretch}{1}
- \hspace*{-1em}\setboolean{keineinzug}{true}
+ \hspace*{-1em}\setboolean{noIndentForPin}{true}
\begin{tabular}{@{}ll}
- Wenn &#2\myspace\\%\hline
- dann &\begin{tikzpicture}[anchor=north,yshift=0.95em ]#3\end{tikzpicture}\myspace\\[0.5em]
+ \GetTranslation{if} &#2\myspace\\%\hline
+ \GetTranslation{then} &\begin{tikzpicture}[anchor=north,yshift=\myshift ]#3\end{tikzpicture}\myspace\\[0.5em]
\end{tabular}};
}
@@ -409,59 +415,98 @@ every text node part/.add code={}{
\node[logik,#1](#5){%
%
\renewcommand{\arraystretch}{1}
- \hspace*{-1em}\setboolean{keineinzug}{true}
+ \hspace*{-1em}\setboolean{noIndentForPin}{true}
\begin{tabular}{@{}ll}
- Wenn &#2\myspace\\ %\hline
- dann &\begin{tikzpicture}[anchor=north, yshift=0.95em ]#3\end{tikzpicture}\myspace\\
- sonst&\begin{tikzpicture}[anchor=north, yshift=0.95em ]#4\end{tikzpicture}\myspace\\
+ \GetTranslation{if} &#2\myspace\\ %\hline
+ \GetTranslation{then} &\begin{tikzpicture}[anchor=north, yshift=\myshift ]#3\end{tikzpicture}\myspace\\
+ \GetTranslation{else}&\begin{tikzpicture}[anchor=north, yshift=\myshift ]#4\end{tikzpicture}\myspace\\
\end{tabular}};
}
\newcommand{\schleife}[5][]{
\node[kontrolle,#1](#5){\\
\renewcommand{\arraystretch}{1}
- \hspace*{-1em}\setboolean{keineinzug}{true}
+ \hspace*{-1em}\setboolean{noIndentForPin}{true}
\begin{tabular}{@{}ll}
#2 & #3\\[0,5em]
- mache & \begin{tikzpicture}[anchor=north, yshift=0.95em]#4\end{tikzpicture}\\
+ \GetTranslation{do} & \begin{tikzpicture}[anchor=north, yshift=\myshift]#4\end{tikzpicture}\\
\end{tabular}
};
}
+% Lokale Farbdefinitonen erlauben
+\newcommand{\setcolor}[2]{\definecolor{#1}{HTML}{#2}}
-\newcommand{\setzenippel}[1]{\foreach \i in {#1}
- {
- \begin{scope}
- \draw[draw=none,rounded corners,fill=\i.fill]%!80!white,draw=none]
- ($(\i.south west) + (1,0.4\einzug)$) -- ($(\i.south west) + (0.8,-0.4\einzug)$) -- ($(\i.south west) + (1.2,-0.4\einzug)$)--cycle;
- \end{scope}
-}}
+% % Open Roberta Shapes mit Zacken oben und unten % %
+%
+%
+\makeatletter
+\pgfdeclareshape{robertashape}
+{
+ % This bit from \pgflibarayshapes.code.tex
+ \inheritsavedanchors[from=rectangle]
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
-\newcommand{\setzepuzzle}[1]{\foreach \i in {#1}
- {
- \begin{scope}
- \node[, fill=\i.fill%!60!white
- ,rounded corners=2.5mm,circle,
- ]
- at ($(\i.west)+ (-0.05,0)$){};
+ \inheritbackgroundpath[from=rectangle]
+ \inheritbeforebackgroundpath[from=rectangle]
+ \inheritbehindforegroundpath[from=rectangle]
+ \inheritforegroundpath[from=rectangle]
+ \inheritbeforeforegroundpath[from=rectangle]
- \end{scope}
-}}
+ \backgroundpath{
+ %
+ \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \xdef\blockhspaceoben{1\blockhspace}
-% Lokale Farbdefinitonen erlauben
-\newcommand{\setcolor}[2]{\definecolor{#1}{HTML}{#2}}
+ \ifthenelse{\boolean{noIndentForPin}}{ % TODO Bedingungen verschönern? Aktuell globales boolean
+ \xdef\blockhspaceunten{\blockhspaceoben}}{
+ \xdef\blockhspaceunten{2*\blockhspaceoben}}
-% %
-%
-% Open Roberta Shapes mit Zacken oben und unten
-%
-% %
+ \def\dreieckseite{4}
+
+ \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} %<-- south west
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten}{\pgf@ya}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+\dreieckseite}{\pgf@ya-\dreieckseite}} %Spitze unten
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+2*\dreieckseite}{\pgf@ya}}
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} % south east
+ \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}} % north east
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+2*\dreieckseite}{\pgf@yb}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+\dreieckseite}{\pgf@yb-\dreieckseite}} %Spitze oben
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben}{\pgf@yb}}
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} %<-- north west
+ \pgfpathclose
+ }
+}
+\makeatother
+% % Open Roberta Shapes mit Zacken NUR unten % %
+%
+%
\makeatletter
-\pgfdeclareshape{robertashape}
+\pgfdeclareshape{pinlow}
{
% This bit from \pgflibarayshapes.code.tex
\inheritsavedanchors[from=rectangle]
@@ -481,53 +526,114 @@ every text node part/.add code={}{
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{south east}
-
+
\inheritbackgroundpath[from=rectangle]
\inheritbeforebackgroundpath[from=rectangle]
\inheritbehindforegroundpath[from=rectangle]
\inheritforegroundpath[from=rectangle]
\inheritbeforeforegroundpath[from=rectangle]
-
+
\backgroundpath{
- %
+ %
\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
-
- \xdef\einzugoben{1\einzug}
-
- \ifthenelse{\boolean{keineinzug}}{ % TODO Bedingungen verschönern? Aktuell globales boolean
- \xdef\einzugunten{\einzugoben}}{
- \xdef\einzugunten{2*\einzugoben}}
-
+
+ \xdef\blockhspaceoben{1\blockhspace}
+
+ \ifthenelse{\boolean{noIndentForPin}}{ % TODO Bedingungen verschönern? Aktuell globales boolean
+ \xdef\blockhspaceunten{\blockhspaceoben}}{
+ \xdef\blockhspaceunten{2*\blockhspaceoben}}
+
\def\dreieckseite{4}
-
+
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} %<-- south west
%
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugunten}{\pgf@ya}}
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugunten+\dreieckseite}{\pgf@ya-\dreieckseite}} %Spitze unten
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugunten+2*\dreieckseite}{\pgf@ya}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten}{\pgf@ya}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+\dreieckseite}{\pgf@ya-\dreieckseite}} %Spitze unten
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+2*\dreieckseite}{\pgf@ya}}
%
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} % south east
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}} % north east
%
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugoben+2*\dreieckseite}{\pgf@yb}}
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugoben+\dreieckseite}{\pgf@yb-\dreieckseite}} %Spitze oben
- \pgfpathlineto{\pgfpoint{\pgf@xa+\einzugoben}{\pgf@yb}}
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+2*\dreieckseite}{\pgf@yb}}
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+\dreieckseite}{\pgf@yb-\dreieckseite}} %Spitze oben
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben}{\pgf@yb}}
%
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} %<-- north west
\pgfpathclose
}
-
}
\makeatother
-% %
-%
-% puzzleteil Shapes mit Ausbuchtung links
+% % Open Roberta Shapes mit Zacken NUR oben % %
%
-% %
+%
+\makeatletter
+\pgfdeclareshape{pinhigh}
+{
+ % This bit from \pgflibarayshapes.code.tex
+ \inheritsavedanchors[from=rectangle]
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{north west}
+ \inheritanchor[from=rectangle]{north east}
+ \inheritanchor[from=rectangle]{center}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{mid}
+ \inheritanchor[from=rectangle]{mid west}
+ \inheritanchor[from=rectangle]{mid east}
+ \inheritanchor[from=rectangle]{base}
+ \inheritanchor[from=rectangle]{base west}
+ \inheritanchor[from=rectangle]{base east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{south west}
+ \inheritanchor[from=rectangle]{south east}
+
+ \inheritbackgroundpath[from=rectangle]
+ \inheritbeforebackgroundpath[from=rectangle]
+ \inheritbehindforegroundpath[from=rectangle]
+ \inheritforegroundpath[from=rectangle]
+ \inheritbeforeforegroundpath[from=rectangle]
+
+ \backgroundpath{
+ %
+ \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+
+ \xdef\blockhspaceoben{1\blockhspace}
+
+ \ifthenelse{\boolean{noIndentForPin}}{ % TODO Bedingungen verschönern? Aktuell globales boolean
+ \xdef\blockhspaceunten{\blockhspaceoben}}{
+ \xdef\blockhspaceunten{2*\blockhspaceoben}}
+
+ \def\dreieckseite{4}
+
+ \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} %<-- south west
+ %
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten}{\pgf@ya}}
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+\dreieckseite}{\pgf@ya-\dreieckseite}} %Spitze unten
+ %\pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceunten+2*\dreieckseite}{\pgf@ya}}
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} % south east
+ \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}} % north east
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+2*\dreieckseite}{\pgf@yb}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben+\dreieckseite}{\pgf@yb-\dreieckseite}} %Spitze oben
+ \pgfpathlineto{\pgfpoint{\pgf@xa+\blockhspaceoben}{\pgf@yb}}
+ %
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} %<-- north west
+ \pgfpathclose
+ }
+}
+\makeatother
+
+
+% % puzzleteil Shapes mit Ausbuchtung links %
+%
+%
\makeatletter
\pgfdeclareshape{puzzleteil}
{
@@ -549,43 +655,183 @@ every text node part/.add code={}{
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{south west}
\inheritanchor[from=rectangle]{south east}
-
+
\inheritbackgroundpath[from=rectangle]
\inheritbeforebackgroundpath[from=rectangle]
\inheritbehindforegroundpath[from=rectangle]
\inheritforegroundpath[from=rectangle]
\inheritbeforeforegroundpath[from=rectangle]
-
+
\backgroundpath{
- %
+ %
\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
-
-
+
+
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} %<-- south west
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} % south east
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}} % north east
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} %<-- north west
% Anpassung
- \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb-4pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb-4pt}}
%
\pgfpathlineto{\pgfpoint{\pgf@xa-5pt}{\pgf@yb-2pt}}
- \pgfpathlineto{\pgfpoint{\pgf@xa-5pt}{\pgf@yb-5pt}}
- \pgfpathlineto{\pgfpoint{\pgf@xa-5pt}{\pgf@yb-13pt}}
- \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb-11pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa-5pt}{\pgf@yb-5pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa-5pt}{\pgf@yb-13pt}}
+ \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb-11pt}}
\pgfpathclose
}
}
\makeatother
-%
-% Farben
-%
+% % colors
+%
\newcommand{\farbe}[1]{\tikz\node[rectangle,minimum width=1em,minimum height = 1em,fill=#1]{};}
+% % symbols
+%
+\newcommand{\usb}{\faUsb}
+
+
+
+% % Option: print (no-colors) % %
%
-% Symbole
+% TODO: Geht das mir einer Schleife?
+\ifthenelse{\boolean{no-colors}}{
+\tikzset{
%
-\newcommand{\usb}{\faUsb}
+% pxt
+%
+grundlage/.append style={nocolor},
+eingabe/.append style={nocolor},
+schleife/.append style={nocolor},
+logik/.append style={nocolor},
+musik/.append style={nocolor},
+led/.append style={nocolor},
+platzhalter/.append style={nocolor},
+mathe/.append style={nocolor},
+funk/.append style={nocolor},
+motor/.append style={nocolor},
+zeichenkette/.append style={nocolor},
+spiel/.append style={nocolor},
+bild/.append style={nocolor},
+pins/.append style={nocolor},
+konsole/.append style={nocolor},
+steuerung/.append style={nocolor},
+bluetooth/.append style={nocolor},
+%
+% openroberta
+%
+start/.append style={nocolor},
+aktion/.append style={nocolor},
+sensor/.append style={nocolor},
+kontrolle/.append style={nocolor},
+logik/.append style={nocolor},
+mathe/.append style={nocolor},
+zeichenkette/.append style={nocolor},
+liste/.append style={nocolor},
+farbe/.append style={nocolor},
+bild/.append style={nocolor},
+variablen/.append style={nocolor},
+funktion/.append style={nocolor},
+nachricht/.append style={nocolor},
+%
+% Fallback styles / Für PXT Kommandos
+schleife/.append style={nocolor},
+pins/.append style={nocolor},
+grundlage/.append style={nocolor},
+eingabe/.append style={nocolor},
+konsole/.append style={nocolor},
+platzhalte/.append style={nocolor},
+bluetooth/.append style={nocolor},
+steuerung/.append style={nocolor},
+%
+% etc.
+dropdown/.append style={fill=white, draw=black!60, opacity=1},
+ledOn/.append style={nocolor},
+intbox/.append style={nocolor},
+stringbox/.append style={nocolor},
+boolbox/.append style={nocolor},
+}
+}{}
+
+\tikzset{
+ print/.style={
+ %
+ % pxt
+ %
+ grundlage/.append style={nocolor},
+ eingabe/.append style={nocolor},
+ schleife/.append style={nocolor},
+ logik/.append style={nocolor},
+ musik/.append style={nocolor},
+ led/.append style={nocolor},
+ platzhalter/.append style={nocolor},
+ mathe/.append style={nocolor},
+ funk/.append style={nocolor},
+ motor/.append style={nocolor},
+ zeichenkette/.append style={nocolor},
+ spiel/.append style={nocolor},
+ bild/.append style={nocolor},
+ pins/.append style={nocolor},
+ konsole/.append style={nocolor},
+ steuerung/.append style={nocolor},
+ bluetooth/.append style={nocolor},
+ %
+ % openroberta
+ %
+ start/.append style={nocolor},
+ aktion/.append style={nocolor},
+ sensor/.append style={nocolor},
+ kontrolle/.append style={nocolor},
+ logik/.append style={nocolor},
+ mathe/.append style={nocolor},
+ zeichenkette/.append style={nocolor},
+ liste/.append style={nocolor},
+ farbe/.append style={nocolor},
+ bild/.append style={nocolor},
+ variablen/.append style={nocolor},
+ funktion/.append style={nocolor},
+ nachricht/.append style={nocolor},
+ %
+ % Fallback styles / Für PXT Kommandos
+ schleife/.append style={nocolor},
+ pins/.append style={nocolor},
+ grundlage/.append style={nocolor},
+ eingabe/.append style={nocolor},
+ konsole/.append style={nocolor},
+ platzhalte/.append style={nocolor},
+ bluetooth/.append style={nocolor},
+ steuerung/.append style={nocolor},
+ %
+ % etc.
+ dropdown/.append style={fill=white, draw=black!60, opacity=1},
+ ledOn/.append style={nocolor},
+ intbox/.append style={nocolor},
+ stringbox/.append style={text-color=black, nocolor,}, % quotationmarks are still white...
+ boolbox/.append style={nocolor},
+ }
+}% print
+
+
+% % Redefine Commands for international usage % %
+%
+%
+
+% Controlstructures
+\newcommand{\ifthenblocks}{\wenndann}
+\newcommand{\ifthenelseblocks}{\wenndannsonst}
+\newcommand{\loopblocks}{\schleife}
+
+\newcommand{\moveindent}{\einruecken}
+
+%styles:
+\tikzset{
+ floor/.style={boden},
+ under/.style n args={3}{below right = #3\blockvspace and #2\blockhspace of #1.south west},
+ square/.style={eckig},
+ nopins/.style={keinezacken},
+ puzzlepiece/.style={puzzleteil},
+} \ No newline at end of file