%%
%% Copyright (C) 2013 by:
%% Josef Kleber
%% <josef.kleber@gmx.de>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of LaTeX version
%% 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "author-maintained".
%%
%% The Current Maintainer of this work is Josef Kleber.
%%
%% This work consists of all files listed in manifest.txt.
%%
%
\ProvidesPackage{skyline}[2013/03/27 skyline.sty v1.1 - Josef Kleber (C) 2013]%
%
\RequirePackage{logicpuzzle}%
%
\newcommand*\LP@SL@init@prefix{LP@SL}%
\newcommand*\LP@SL@init@package{skyline}%
%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{rows}{5}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{columns}{5}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{scale}{1}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{counterstyle}{none}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{bgcolor}{}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{width}{6.7cm}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{cvoffset}{-38pt}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{title}{}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titleindent}{0.75cm}%
\LP@define@key{\LP@SL@init@prefix}{\LP@SL@init@package}{titlewidth}{5.85cm}%
\LP@define@choicekey@fontsize{\LP@SL@init@prefix}{\LP@SL@init@package}{Large}%
%
\newcommand*\LP@SL@sudoku{false}%
%
\define@choicekey*{skyline.sty}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@SL@sudoku{true}%
    \renewcommand*\LP@SL@rows{9}%
    \renewcommand*\LP@SL@columns{9}%
  \or%
    \renewcommand*\LP@SL@sudoku{false}%
  \fi%
}%
%
\define@choicekey*{skyline}{sudoku}[\LP@SL@sudoku\nr]{true,false}[true]%
{%
  \ifcase\nr\relax%
    \renewcommand*\LP@SL@sudoku{true}%
    \renewcommand*\LP@SL@rows{9}%
    \renewcommand*\LP@SL@columns{9}%
  \or%
    \renewcommand*\LP@SL@sudoku{false}%
  \fi%
}%
%
\ExecuteOptionsX{rows,columns,width,fontsize,scale,bgcolor,cvoffset,counterstyle,title,titleindent,titlewidth}%
%
\ProcessOptionsX\relax%
%
\LP@init@counter{\LP@SL@init@prefix}%
%
\let\skylineB\LP@bottomrow%
\let\skylineT\LP@toprow%
\let\skylineL\LP@leftcolumn%
\let\skylineR\LP@rightcolumn%
\let\skylinecell\setcell%
%
\newcommand*\skylinesetup[1]%
{%
  \setkeys{skyline.sty}{#1}%
}%
%
\newenvironment{skyline}[1][]%
{%
  \setkeys{skyline}{#1}%
  \LP@set@package{skyline}%
  \LP@set@env@prefix{LP@SL}%
  \setcounter{LP@SL@rows}{\LP@SL@rows}%
  \setcounter{LP@SL@columns}{\LP@SL@columns}%
  \stepcounter{LP@SL@rows}%
  \stepcounter{LP@SL@columns}%
  \begin{minipage}[t]{\LP@SL@width}%
    \ifthenelse{\equal{\LP@SL@title}{}}%
    {\par\enspace\par}% empty
    {\enspace\par\noindent\hspace{\LP@SL@titleindent}\parbox{\LP@SL@titlewidth}{\strut\LP@titleformat\LP@SL@title}\vspace{3mm}\par}%
    \begin{tikzpicture}[scale=\LP@SL@scale]%
      \LP@drawbackground{1}{1}{\LP@SL@columns}{\LP@SL@rows}{\LP@SL@bgcolor}%
      \LP@drawgrid{1}{1}{\LP@SL@columns}{\LP@SL@rows}{1cm}%
      \ifthenelse{\equal{\LP@SL@sudoku}{true}}%
      {\LP@drawsudokugrid}%
      {}%
}%
{%
    \end{tikzpicture}%
    \LP@drawcounter{\LP@SL@counterstyle}%
    \stepcounter{LP@puzzlecounter}%
  \end{minipage}%
}%
%
\endinput%