% -*- latex -*-
\documentclass{InsightSoftwareGuide}
\usepackage[
  paper=letterpaper,
  paperwidth=8in,
  paperheight=10in,
  lmargin=0.75in,
  rmargin=0.5in,
  tmargin=0.75in,
  bmargin=0.75in]{geometry}

\usepackage{xcolor}
\definecolor{yellow}{rgb}{1,1,0}
\definecolor{black}{rgb}{0,0,0}
\definecolor{ltcyan}{rgb}{.75,1,1}
\definecolor{red}{rgb}{1,0,0}
\definecolor{gray}{rgb}{.6,.6,.6}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.5,0}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Uncomment for draft mode.
%% \usepackage{draftwatermark}
%% \SetWatermarkText{DRAFT}
%% \SetWatermarkColor[rgb]{{.9,1,.9}}
%% \newcommand{\fix}[1]{{\color{red}\textsc{[#1]}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Uncomment to hide fix markup for final mode.
\newcommand{\fix}[1]{}


\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{isomath}
\usepackage{varioref}
\usepackage{fancyvrb}
\usepackage{ifthen}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{cite}
\usepackage{relsize}
\usepackage{subfig}
\usepackage{url}
\usepackage{xspace}
\usepackage{xstring}
\usepackage{xparse}

% to minimize item separation in lists.
\usepackage{enumitem}

% This wonderful package allows hyphenation in tt fonts and hyphenation of
% words with underscores in them.
\usepackage[htt]{hyphenat}

% This package defines a tt font that supports boldface (albeit not very
% distinctly). The default package has no boldface for tt fonts.
\usepackage{lmodern}

\usepackage{makeidx}
\makeindex

%% \usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=black,linkcolor=black,final=true]{hyperref}
\usepackage{verbatim}

\input{Macros}
\input{LanguageDefinitions}

% Make fancy headers and everything...
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LE,RO]{\small \nouppercase{\rightmark}}
\fancyfoot{}
\fancyfoot[LE,RO]{\small \thepage}
\fancyfoot[RE,LO]{\small \nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
%\setlength{\headheight}{14pt}

\fancypagestyle{plain}{%
  \fancyhead{} % get rid of headers on plain pages
  \fancyfoot{} % get rid of the footer on plain pages
  \renewcommand{\headrulewidth}{0pt} % and the top line
  \renewcommand{\footrulewidth}{0pt} % and the bottom line
}

% Avoid putting figures on their own page.
\renewcommand{\textfraction}{0.05}
\renewcommand{\topfraction}{0.95}
\renewcommand{\bottomfraction}{0.95}

% Make sure this is big enough so that only big figures end up on their own
% page but small enough so that if a figure does have to be on its own
% page, it won't push everything to the bottom because it's not big enough
% to have its own page.
\renewcommand{\floatpagefraction}{.75}

\setcounter{tocdepth}{4}
\input{TitlePage}

\begin{document}

\sloppy

\frontmatter
\pagestyle{empty}
\titleGM

\clearpage
\input{Contributors}

\pagestyle{fancy}
{\small
\tableofcontents
\listoffigures
%\listoftables
\lstlistoflistings
}

\mainmatter

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{GettingStarted}}{

  \part{Getting Started}
  \label{part:GettingStarted}

  \input{Introduction}

  \input{BuildAndInstall}

  \input{QuickStart}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Using}}{

  \part{Using \VTKm}
  \label{part:Using}

  \input{BaseTypes}

  \input{Version}

  \input{Initialization}

  \input{DataSet}

  \input{IO}

  \input{RunningFilters}

  \input{Rendering}

  \input{ErrorHandling}

  \input{ManagingDevices}

  \input{Timer}

  \input{ImplicitFunctions}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Developing}}{

  \part{Developing Algorithms}
  \label{part:Developing}

  \input{GeneralApproach}

  \input{BasicArrayHandles}

  \input{SimpleWorklets}

  \input{BasicFilterImpl}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Advanced}}{

  \part{Advanced Development}
  \label{part:Advanced}

  \input{AdvancedTypes}

  \input{Logging}

  \input{WorkletTypes}

  \input{FilterTypes}

  \input{WorkletErrorHandling}

  \input{Math}

  \input{WorkingWithCells}

  \input{FancyArrayHandles}

  \input{AccessingAllocatingArrays}

  \input{Globals}

  \input{ExecutionObjects}

  \input{Locators}

  \input{WorkletInOut}

  \input{GeneratingCellSets}

  \input{UnknownArrayHandle}

  \input{DeviceAlgorithms}

  \fix{Need to re-add this if Policies survive the transition to dynamic objects.}
  %% \input{Policies}

  \fix{At some point add a chapter on OpenGL interoperability (I guess).}
  %% \input{OpenGLInteroperability}

  \input{CustomArrayStorage}

  \input{Testing}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Core}}{

  \part{Core Development}
  \label{part:Core}

  \input{TryExecute}

  \input{ImplementingDeviceAdapters}

  \input{FunctionInterface}

  \input{WorkletArguments}

  \input{NewWorkletTypes}

}{}

\appendix
\part{Appendix}
\label{part:Appendix}
%% \input{CodingConventions}


\backmatter
%\chapter{Index}
{\small
\printindex
}
\end{document}
