%%
%% This is file `smartdiagramlibrarycore.definitions.code.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% smartdiagram.dtx  (with options: `definitions')
%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
%% smartdiagram --- Automatic creation of smart diagrams from lists of items.
%% 
%% E-mail: claudio <dot> fiandrino <at> gmail <dot> com
%% 
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
%% 

\@namedef{color@1}{red!40}
\@namedef{color@2}{cyan!40}
\@namedef{color@3}{blue!40}
\@namedef{color@4}{green!40}
\@namedef{color@5}{orange!40}
\@namedef{color@6}{yellow!40}
\@namedef{color@7}{magenta!40}
\@namedef{color@8}{brown!40}
\@namedef{color@9}{violet!40}
\@namedef{color@10}{teal!40}
\tikzset{rnd rectangle/.style={rectangle,rounded corners}
}

\def\CalcHeight(#1,#2)#3{%
\pgfpointdiff{\pgfpointanchor{#1}{south west}}{\pgfpointanchor{#2}{north west}}
\pgfmathsetmacro{\myheight}{veclen(\pgf@x,\pgf@y)}
\global\expandafter\edef\csname #3\endcsname{\myheight}
}
\pgfkeys{/smart diagram/.cd, module minimum width/.initial=2cm,
   module minimum height/.initial={1cm},
   module y sep/.initial={1.65},
   module x sep/.initial={2.75},
   descriptive items y sep/.initial={1.75},
   text width/.initial={1.5cm},
   description title width/.initial={1.5cm},
   description text width/.initial={5cm},
   description title text width/.initial={1.25cm},
   description title font/.initial={\small},
   description font/.initial={\small},
   description width/.initial={5.5cm},
   font/.initial={\small},
   border color/.initial={gray},
   circular distance/.initial={2.75cm},
   arrow line width/.initial={0.1cm},
   module shape/.initial={rnd rectangle},
   insert decoration/.initial={},
   arrow tip/.initial={stealth},
   arrow color/.initial={gray},
   bubble center node size/.initial={4cm},
   bubble center node font/.initial={\large},
   bubble center node color/.initial={lightgray!60},
   distance center/other bubbles/.initial=0.8cm,
   distance text center bubble/.initial={0.5cm},
   bubble fill opacity/.initial={0.5},
   bubble node size/.initial={2.5cm},
   bubble text opacity/.initial={0.8},
   bubble node font/.initial={\normalfont},
   planet size/.initial={2.5cm},
   planet color/.initial={lightgray!60},
   planet font/.initial={\large},
   distance planet-connection/.initial={0.1cm},
   distance planet-text/.initial={0.5cm},
   planet text width/.initial={1.75cm},
   satellite size/.initial={1.75cm},
   satellite font/.initial={\normalfont},
   satellite fill opacity/.initial={0.5},
   satellite text opacity/.initial={0.8},
   satellite text width/.initial={1.5cm},
   distance satellite-connection/.initial={0.075cm},
   connection line width/.initial={0.1cm},
   connection color/.initial={gray},
   distance planet-satellite/.initial={3.5cm},
   priority arrow width/.initial={1.5cm},
   priority arrow head extend/.initial={0.15cm},
   priority tick size/.initial={5pt},
   priority arrow height advance/.initial={2cm},
   sequence item height/.initial={1cm},
   sequence item width/.initial={2cm},
   sequence item border color/.initial={gray},
   sequence item border size/.initial={1.75\pgflinewidth},
   sequence item font size/.initial={\normalfont},
   sequence item fill opacity/.initial={1},
   sequence item text opacity/.initial={1},
   sequence item text width/.initial={1.9cm},
   sequence item text color/.initial={black},
   sequence item uniform color/.initial={gray!60!black},
   arrow style/.initial={<-},
   text color/.initial={black},
   back arrow distance/.initial={0.5},
}%

\pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
   module minimum height/.get=\sm@core@moduleheight,
   module y sep/.get=\sm@core@moduleysep,
   module x sep/.get=\sm@core@modulexsep,
   descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
   text width/.get=\sm@core@moduletextwidth,
   description title width/.get=\sm@core@descriptiontitlewidth,
   description text width/.get=\sm@core@descriptiontextwidth,
   description title text width/.get=\sm@core@descriptiontitletextwidth,
   description title font/.get=\sm@core@descriptiontitlefontsize,
   description font/.get=\sm@core@descriptionfontsize,
   description width/.get=\sm@core@descriptionwidth,
   font/.get=\sm@core@modulefontsize,
   border color/.get=\sm@core@bordercolor,
   circular distance/.get=\sm@core@circulardistance,
   arrow line width/.get=\sm@core@arrowlinewidth,
   module shape/.get=\sm@core@moduleshape,
   insert decoration/.get=\sm@core@borderdecoration,
   arrow tip/.get=\sm@core@arrowtip,
   arrow color/.get=\sm@core@arrowcolor,
   bubble center node size/.get=\sm@core@bubblecenternodesize,
   bubble center node font/.get=\sm@core@bubblecenternodefont,
   bubble center node color/.get=\sm@core@bubblecenternodecolor,
   distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
   distance text center bubble/.get=\sm@core@distancetextcenterbubble,
   bubble fill opacity/.get=\sm@core@bubblefillopacity,
   bubble node size/.get=\sm@core@bubblenodesize,
   bubble text opacity/.get=\sm@core@bubbletextopacity,
   bubble node font/.get=\sm@core@bubblenodefont,
   planet size/.get=\sm@core@planetminimumsize,
   planet color/.get=\sm@core@planetcolor,
   planet font/.get=\sm@core@planetfont,
   distance planet-connection/.get=\sm@core@planetoutersep,
   distance planet-text/.get=\sm@core@planetinnersep,
   planet text width/.get=\sm@core@planettextwidth,
   satellite size/.get=\sm@core@satelliteminimumsize,
   satellite font/.get=\sm@core@satellitefont,
   satellite fill opacity/.get=\sm@core@satellitefillopacity,
   satellite text opacity/.get=\sm@core@satellitetextopacity,
   satellite text width/.get=\sm@core@satellitetextwidth,
   distance satellite-connection/.get=\sm@core@satelliteoutersep,
   connection line width/.get=\sm@core@connectionlinewidth,
   connection color/.get=\sm@core@connectioncolor,
   distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
   priority arrow width/.get=\sm@core@priorityarrowwidth,
   priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
   priority tick size/.get=\sm@core@prioritytick,
   priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
   sequence item height/.get=\sm@core@seqitemheight,
   sequence item width/.get=\sm@core@seqitemwidth,
   sequence item border color/.get=\sm@core@seqitembordercolor,
   sequence item border size/.get=\sm@core@seqlinewidth,
   sequence item font size/.get=\sm@core@seqitemfont,
   sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
   sequence item text opacity/.get=\sm@core@seqitemtextopacity,
   sequence item text width/.get=\sm@core@seqitemtextwidth,
   sequence item text color/.get=\sm@core@seqitemtextcolor,
   sequence item uniform color/.get=\sm@core@seqitemuniformcol,
   arrow style/.get=\sm@core@arrowstyle,
   text color/.get=\sm@core@textcolor,
   back arrow distance/.get=\sm@core@backarrowdistance,
}%
\pgfkeys{/smart diagram/.cd, set color list/.code={
      \foreach \listitem [count=\i] in {#1}{
         \global\@namedef{color@\i\expandafter}\expandafter{\listitem}
      }
   }
}

\pgfkeys{/smart diagram/.cd, uniform color list/.code args={#1 for #2 items}{
      \foreach \listitem [count=\i] in {1,...,#2}{
         \global\@namedef{color@\i\expandafter}\expandafter{#1}
      }
   }
}

\pgfkeys{/smart diagram/.cd, use predefined color list/.code={
      \@namedef{color@1}{red!30}
      \@namedef{color@2}{cyan!30}
      \@namedef{color@3}{blue!30}
      \@namedef{color@4}{green!30}
      \@namedef{color@5}{orange!30}
      \@namedef{color@6}{yellow!30}
      \@namedef{color@7}{magenta!30}
      \@namedef{color@8}{brown!30}
      \@namedef{color@9}{violet!30}
      \@namedef{color@10}{teal!30}
   }
}
\newif\ifbackarrowdisabled
\pgfkeys{/smart diagram/.cd,
  back arrow disabled/.is if=backarrowdisabled,
  back arrow disabled=false,
}
\newif\ifcircularfinalarrowdisabled
\pgfkeys{/smart diagram/.cd,
  circular final arrow disabled/.is if=circularfinalarrowdisabled,
  circular final arrow disabled=false,
}
\NewDocumentCommand{\smartdiagramset}{m}{%
  \pgfkeys{/smart diagram/.cd,#1}%
  \pgfkeys{/smart diagram/.cd, module minimum width/.get=\sm@core@modulewidth,
   module minimum height/.get=\sm@core@moduleheight,
   module y sep/.get=\sm@core@moduleysep,
   module x sep/.get=\sm@core@modulexsep,
   descriptive items y sep/.get=\sm@core@descriptiveitemsysep,
   text width/.get=\sm@core@moduletextwidth,
   description title width/.get=\sm@core@descriptiontitlewidth,
   description text width/.get=\sm@core@descriptiontextwidth,
   description title text width/.get=\sm@core@descriptiontitletextwidth,
   description title font/.get=\sm@core@descriptiontitlefontsize,
   description font/.get=\sm@core@descriptionfontsize,
   description width/.get=\sm@core@descriptionwidth,
   font/.get=\sm@core@modulefontsize,
   border color/.get=\sm@core@bordercolor,
   circular distance/.get=\sm@core@circulardistance,
   arrow line width/.get=\sm@core@arrowlinewidth,
   module shape/.get=\sm@core@moduleshape,
   insert decoration/.get=\sm@core@borderdecoration,
   arrow tip/.get=\sm@core@arrowtip,
   arrow color/.get=\sm@core@arrowcolor,
   bubble center node size/.get=\sm@core@bubblecenternodesize,
   bubble center node font/.get=\sm@core@bubblecenternodefont,
   bubble center node color/.get=\sm@core@bubblecenternodecolor,
   distance center/other bubbles/.get=\sm@core@distancecenterotherbubbles,
   distance text center bubble/.get=\sm@core@distancetextcenterbubble,
   bubble fill opacity/.get=\sm@core@bubblefillopacity,
   bubble node size/.get=\sm@core@bubblenodesize,
   bubble text opacity/.get=\sm@core@bubbletextopacity,
   bubble node font/.get=\sm@core@bubblenodefont,
   planet size/.get=\sm@core@planetminimumsize,
   planet color/.get=\sm@core@planetcolor,
   planet font/.get=\sm@core@planetfont,
   distance planet-connection/.get=\sm@core@planetoutersep,
   distance planet-text/.get=\sm@core@planetinnersep,
   planet text width/.get=\sm@core@planettextwidth,
   satellite size/.get=\sm@core@satelliteminimumsize,
   satellite font/.get=\sm@core@satellitefont,
   satellite fill opacity/.get=\sm@core@satellitefillopacity,
   satellite text opacity/.get=\sm@core@satellitetextopacity,
   satellite text width/.get=\sm@core@satellitetextwidth,
   distance satellite-connection/.get=\sm@core@satelliteoutersep,
   connection line width/.get=\sm@core@connectionlinewidth,
   connection color/.get=\sm@core@connectioncolor,
   distance planet-satellite/.get=\sm@core@distanceplanetsatellite,
   priority arrow width/.get=\sm@core@priorityarrowwidth,
   priority arrow head extend/.get=\sm@core@priorityarrowheadextend,
   priority tick size/.get=\sm@core@prioritytick,
   priority arrow height advance/.get=\sm@core@priorityarrowheightadvance,
   sequence item height/.get=\sm@core@seqitemheight,
   sequence item width/.get=\sm@core@seqitemwidth,
   sequence item border color/.get=\sm@core@seqitembordercolor,
   sequence item border size/.get=\sm@core@seqlinewidth,
   sequence item font size/.get=\sm@core@seqitemfont,
   sequence item fill opacity/.get=\sm@core@seqitemfillopacity,
   sequence item text opacity/.get=\sm@core@seqitemtextopacity,
   sequence item text width/.get=\sm@core@seqitemtextwidth,
   sequence item text color/.get=\sm@core@seqitemtextcolor,
   sequence item uniform color/.get=\sm@core@seqitemuniformcol,
   arrow style/.get=\sm@core@arrowstyle,
   text color/.get=\sm@core@textcolor,
   back arrow distance/.get=\sm@core@backarrowdistance,
  }%
}%
\pgfkeys{/smart diagram/.cd,%
    uniform sequence color/.is choice,%
    uniform sequence color/true/.code={%
      \tikzset{sequence item/.append style={
         fill=\sm@core@seqitemuniformcol,
         },
       }
    },%
    uniform sequence color/false/.style={sequence item},%
    uniform sequence color/.default=false,
}%
\pgfkeys{/smart diagram/.cd,%
      uniform connection color/.is choice,%
      uniform connection color/true/.code={%
        \tikzset{connection planet satellite/.append style={
           \sm@core@connectioncolor
           },
        }
      },%
      uniform connection color/false/.style={connection planet satellite},%
    uniform connection color/.default=false,
}%
\pgfkeys{/smart diagram/.cd,%
      uniform arrow color/.is choice,%
      uniform arrow color/true/.code={%
        \tikzset{diagram arrow type/.append style={
           \sm@core@arrowcolor
           },
        }
      },%
      uniform arrow color/false/.style={diagram arrow type},%
    uniform arrow color/.default=false,
}%


%% 
%% Copyright (C) 2012-2013 by Claudio Fiandrino
%% E-mail: <claudio <dot> fiandrino <at> gmail <dot> com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version.  The latest version of this license is in the file:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%% Claudio Fiandrino.
%% 
%% This work consists of the file  smartdiagram.dtx
%% and the derived files           smartdiagram.ins,
%%                                 smartdiagram.pdf,
%%                                 smartdiagramlibrarycore.definitions.code.tex,
%%                                 smartdiagramlibrarycore.styles.code.tex,
%%                                 smartdiagramlibrarycore.commands.code.tex
%%                                 smartdiagramlibraryadditions.code.tex and
%%                                 smartdiagram.sty.
%% 
%%
%% End of file `smartdiagramlibrarycore.definitions.code.tex'.
