% -*- coding:utf-8; mode:latex; -*- %

\newcommand{\makemytitle}{%
  \begin{titlepage}%
    \begin{tikzpicture}
      [
        remember picture,
        overlay,
        kitborder/.style = {
          %fill = white,
          %draw = black!20,
          %ultra thin,
          draw = black!30,
          thick,
        },
        fineprint/.style = {
          inner sep = 2mm,
        },
        kitslogan/.style = {
          fineprint,
          font = {\logofont\tiny},
        },
        kiturl/.style = {
          fineprint,
          font = {\logofont\LARGE\bfseries},
          text = black!30,
        },
        content/.style = {
          %draw = yellow, ultra thin,
          inner sep = 0pt,
        },
      ]

      \newlength{\diameter}%
      \setlength{\diameter}{10mm}%

      \coordinate[xshift =  20mm, yshift = -10mm] (bgnw) at (current page.north west);
      \coordinate[xshift = -10mm, yshift = -10mm] (bgne) at (current page.north east);
      \coordinate[xshift =  20mm, yshift =  15mm] (bgsw) at (current page.south west);
      \coordinate[xshift = -10mm, yshift =  15mm] (bgse) at (current page.south east);

      \coordinate (top) at ($(bgnw)!0.5!(bgne)$);
      \coordinate (bot) at ($(bgsw)!0.5!(bgse)$);

      \coordinate[xshift = -\diameter] (prebgne) at (bgne);
      \coordinate[xshift = +\diameter] (prebgsw) at (bgsw);

      %\fill[black!15] (current page.north west) rectangle (current page.south east);
      \path[kitborder] (bgnw) -- (prebgne) arc (90:0:\diameter) -- (bgse) -- (prebgsw) arc (270:180:\diameter) -- cycle;

      \node[inner sep = 10mm, anchor = north west] at (bgnw) {\pgfimage[height=20mm]{logos/kit.pdf}};
      \node[inner sep = 10mm, anchor = north east] at (bgne) {\pgfimage[height=20mm]{logos/algo.pdf}};

      \node[kitslogan, anchor = south west, yshift = -10mm] at (bgsw) {%
        KIT -- University of the State of Baden-Württemberg and National Laboratory of the Helmholtz Association
      };

      \node[kiturl, anchor = south east, yshift = -10mm] at (bgse) {%
        \href{https://www.kit.edu/}{www.kit.edu}
      };

      \node[content] (title) at ($(top)!0.25!(bot)$) {%
        \usekomafont{title}%
        \ifdefvoid{\@title}{Title of the Thesis}{\@title}
      };

      \node[content, anchor = north, below = 4ex of title] (subtitle) {%
        \usekomafont{subtitle}%
        \ifdefvoid{\@subtitle}{}{\@subtitle}
      };

      \node[content] (author) at ($(top)!0.45!(bot)$) {%
        \usekomafont{author}%
        \ifdefvoid{\@author}{Author Name}{\@author}
      };

      \node[content, anchor = south, above = 6ex of author] {%
        \usekomafont{subject}%
        Master's Thesis of
      };

      \node[content] (institute) at ($(top)!0.55!(bot)$) {%
        \usekomafont{subject}%
        \begin{tabular}{c}
          Department of Informatics\\[0.5ex]
          Institute of Theoretical Computer Science
        \end{tabular}
      };

      \node[content] (supervisor) at ($(top)!0.75!(bot)$) {%
        \usekomafont{subject}%
        \begin{tabular}[ht]{ll}
          Reviewers: & \reviewerone\\
                     & \reviewertwo\\[1ex]
          Advisors:  & \advisorone\\
                     & \advisortwo\\
        \end{tabular}
      };

      \node[content] (date) at ($(top)!0.9!(bot)$) {%
        \usekomafont{subject}%
        Time Period:\quad\ifdefvoid{\@date}{\today}{\@date}
      };

    \end{tikzpicture}
  \end{titlepage}
  \clearpage
}
