%% start of file `moderncvstylecasual.sty'.
%% Copyright 2006-2012 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


%-------------------------------------------------------------------------------
%                identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvstylecasual}[2012/02/05 v0.18 modern curriculum vitae style scheme: casual]


%-------------------------------------------------------------------------------
%                required packages
%-------------------------------------------------------------------------------


%-------------------------------------------------------------------------------
%                package options
%-------------------------------------------------------------------------------
\RequirePackage{moderncvstyleclassic}


%-------------------------------------------------------------------------------
%                style scheme definition
%-------------------------------------------------------------------------------
% fonts
\renewcommand*{\namefont}{\fontsize{38}{40}\mdseries\upshape}
\renewcommand*{\addressfont}{\small\mdseries\slshape}

% cv footer
%   footer symbol used to separate footer elements
\newcommand*{\footersymbol}{%
    {~~~\textbullet~~~}}% \textbullet forces the use of the CMSY font, even when latin modern fonts are used :(
%   internal command to add an element to the footer
%   it collects the elements in a temporary box, and checks when to flush the box
\newsavebox{\footerbox}%
\newsavebox{\footertempbox}%
\newlength{\footerwidth}%
\newlength{\footerboxwidth}%
\newif\if@firstfooterelement\@firstfooterelementtrue%
%   adds an element to the footer, separated by footersymbol
%   usage: \addtofooter[footersymbol]{element}
\newcommand*{\addtofooter}[2][\footersymbol]{%
  \if@firstfooterelement%
    \savebox{\footertempbox}{\usebox{\footerbox}#2}%
  \else%
    \savebox{\footertempbox}{\usebox{\footerbox}#1#2}\fi%
  \settowidth{\footerboxwidth}{\usebox{\footertempbox}}%
  \ifnum\footerboxwidth<\footerwidth%
    \savebox{\footerbox}{\usebox{\footertempbox}}%
    \@firstfooterelementfalse%
  \else%
    \flushfooter{}\\%
    \savebox{\footerbox}{#2}%
    \savebox{\footertempbox}{#2}%
    \@firstfooterelementfalse\fi}
%   internal command to flush the footer
\newcommand*{\flushfooter}{%
  \strut\usebox{\footerbox}%
  \savebox{\footerbox}{}%
  \savebox{\footertempbox}{}}
\renewcommand*{\makefooter}{%
  \setlength{\footerwidth}{0.8\textwidth}%
  \fancypagestyle{plain}{%
    \fancyfoot[c]{%
      \parbox{\footerwidth}{%
        \centering%
        \color{color2}\addressfont%
        \ifthenelse{\isundefined{\@addressstreet}}{}{\addtofooter[]{\addresssymbol\@addressstreet}%
          \ifthenelse{\isundefined{\@addresscity}}{}{\addtofooter[~--~]{\@addresscity}}\flushfooter\@firstfooterelementtrue\\}%
        \ifthenelse{\isundefined{\@mobile}}{}{\addtofooter{\mobilesymbol\@mobile}}%
        \ifthenelse{\isundefined{\@phone}}{}{\addtofooter{\phonesymbol\@phone}}%
        \ifthenelse{\isundefined{\@fax}}{}{\addtofooter{\faxsymbol\@fax}}%
        \ifthenelse{\isundefined{\@email}}{}{\addtofooter{\emailsymbol\emaillink{\@email}}}%
        \ifthenelse{\isundefined{\@homepage}}{}{\addtofooter{\homepagesymbol\httplink{\@homepage}}}%
        \ifthenelse{\isundefined{\@extrainfo}}{}{\addtofooter{\@extrainfo}}%
        \flushfooter}}}%
  \pagestyle{plain}}

% maketitle
\renewcommand*{\maketitle}{%
  \makefooter{}%
  \newbox{\maketitlepicturebox}%
  \savebox{\maketitlepicturebox}{%
    \ifthenelse{\isundefined{\@photo}}%
      {}%
      {%
       \setlength\fboxrule{\@photoframewidth}%
       \ifdim\@photoframewidth=0pt%
         \setlength{\fboxsep}{0pt}\fi%
       {\color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}}%
  \usebox{\maketitlepicturebox}%
  \newlength{\maketitlepicturewidth}\settowidth{\maketitlepicturewidth}{\usebox{\maketitlepicturebox}}%
  \parbox[b]{\textwidth-\maketitlepicturewidth}{%
    \raggedleft\namefont{\color{color2!50}\@firstname} {\color{color2}\@familyname}}\\[-.35em]% alternate design: \MakeLowercase and no space
  {\color{color2!50}\rule{\textwidth}{.25ex}}%
  % optional title
  \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\raggedleft\titlestyle{\@title}}\\[2.5em]%
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
  \par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle


\endinput


%% end of file `moderncvstylecasual.sty'.
