% fmmcc.sth
% mmcc style with frames
% HtX (1.0)  (c) 1997, Richard M. Salter
% Please read copyright and distribution agreement

\input{report.sth}
\typeout{Substyle:  mmcc}
\typeout{Substyle:  frames}
\seticondir{icons/}
\setlibdir{./}
\base{}
%\seticondir{http://klingon.cs.iupui.edu/~aharris/mmcc/icons/}
\setappletdir{http://www.cs.oberlin.edu/~rms/applets/}
%\setappletdir{http://www.cs.indiana.edu/mmcc/applets/}
\newcommand{\htx}{HtX}
\newctr{exctr}\newctr{exsol}\newctr{hntctr}

\newenvironment{framesetdoc}[1][2]{
\begin{excursion}{#3}{w}
\mkp*{/head}
\ifdef[\mkp*[rows="#1"]{frameset}]{#1}
\ifdef[\mkp*[cols="#2"]{frameset}]{#2}}
{\mkp*{/frameset}\mkp*{/html}\end{excursion}}

\newenvironment{frameset}[0][2]{
\ifdef[\mkp*[rows="#1"]{frameset}]{#1}
\ifdef[\mkp*[cols="#2"]{frameset}]{#2}}
{\mkp*{/frameset}}

\newcommand{\frame}[1][2]{
\mkp*[name="#1" #2 src="#3"]{frame}
}

% Section, subsection, subsubsection with frames

\newcommand{\section}[1][1]{
\setbuf{sect}{Section: #2}
\ifthen {\or{\or{\numeq{\ctr{nav}}{2}}{\numle{\ctr{navlvl}}{0}}}
	    {\nonempty{#1}}}
	\ifdef[\header{2}{\bundle*{0}[#1]{|#2|}}]
	      [\header{2}{\bundle*{0}{#2}}]{#1}\par
\ifelse	\pghead{\header{3}{\buf{sect}}\par}
	\bundle{0}{#2}\setctr{pgdepth}{\depth}
	\pgfoot{\hr\address{\buf{me}}}
\endif}

\newcommand{\subsection}[1][1]{
\setbuf{subsect}{Subsection: #2}
\ifthen {\or{\or{\numeq{\ctr{nav}}{2}}{\numle{\ctr{navlvl}}1}}
	    {\nonempty{#1}}}
	\ifdef[\header{3}{\bundle*{1}[#1]{|#2|}}]
	      [\header{3}{\bundle*{1}{#2}}]{#1}\par
\ifelse	\pghead{\header{3}{\buf{sect}\break ...\buf{subsect}}\par}
	\bundle{1}{#2}\setctr{pgdepth}{\depth}
	\pgfoot{\hr\address{\buf{me}}}
\endif}

\newcommand{\subsubsection}[1][1]{
\setbuf{subsubsect}{Subsubsection: #2}
\ifthen {\or{\or{\numeq{\ctr{nav}}{2}}{\numle{\ctr{navlvl}}2}}
	    {\nonempty{#1}}}
	\ifdef[\header{3}{\bundle*{2}[#1]{|#2|}}]
	      [\header{3}{\bundle*{2}{#2}}]{#1}\par
\ifelse \pghead{\header{3}
	  {\buf{sect}\break ...\buf{subsect}\break
 ... ...\buf{subsubsect}}\par}
	\bundle{2}{#2}\setctr{pgdepth}{\depth}
	\pgfoot{\hr\address{\buf{11}}}
\endif}

\newcommand{\section*}[1][1]{\section[#1]{#2}}
\newcommand{\subsection*}[1][1]{\subsection[#1]{#2}}
\newcommand{\subsubsection*}[1][1]{\subsubsection[#1]{#2}}

\newcommand{\vlentry}[1][1]{
\libbuf*\nl\setlibbuf*{
\end{verbatim}\nl\header{5}{Use {\bf Back} to return}\eanchor}
\nl\nl
|\hr\anchor{rf#2}{\header{2}{\alt{#1}{#2}}}\par\begin{verbatim}|}

\newcommand{\lentry}[1][1]{
\libbuf*\nl\setlibbuf*{\header{5}{Use {\bf Back} to return}\eanchor}
\nl\nl
|\hr\anchor{rf#2}{\header{2}{\alt{#1}{#2}}}\par\nl|}

\newbibfile[ffffbb][References]{refs}

\newcommand{\docheader}[3]{
\begin{center}
\title{Module \hash #2: #3}
\begin{table}[cellpadding=10][][halign=center]
\image{\icondir mmcc.gif}\col[valign=middle halign=center]
\header{3}{\centering\it #1}\row[][halign=center]\par
\header{4}
{\centering Indiana University\\Multi-campus Modular\\Computing Curriculum}
\end{table}
\end{center}
\hr[noshade size=2]
{\div[center]\header{1}{Module \hash #2: #3}}
\hr[noshade size=2]}

\newenvironment{goallist}{
\header{2}{\it\image[middle][][hspace=15]{\icondir goal.gif} Goals}
\begin{itemize}}
{\end{itemize}\hr[noshade size=2]}

\newenvironment{prereqs}{
\header{2}{\it\image[middle][][hspace=15]{\icondir suitcase.gif}
 Prerequisite Skills}
\begin{itemize}}
{\end{itemize}\hr[noshade size=2]}

\newenvironment{lab}{\section{Laboratory Assignment}}{}
\newenvironment{lab*}{\section*{Laboratory Assignment}}{}
\newenvironment{summary}{\section{Summary}}{}
\newenvironment{summary*}{\section*{Summary}}{}

\newenvironment{vocab}{
\section{Vocabulary}
\hr[noshade size=2]
\header{2}{\it\it\image[middle][][hspace=15]{\icondir type.gif} 
Vocabulary / Main Concepts}
\begin{description}}
{\end{description}\hr[noshade size=2]}

\newenvironment{leftimage}[1]{
\image[left][][hspace=15 vspace=10]{#1}}
{\break[left]}

\newenvironment{rightimage}[1]{
\image[right][][hspace=15 vspace=10]{#1}}
{\break[right]}

% q and a

\newbuf{ansf}
\newctr{qctr}
\newctr{cellans}

\newcommand{\cellans}{\setctr{cellans}1}
\newcommand{\keyans}{\clrctr{cellans}}

\newenvironment{quest} {
\incctr{qctr}
\anchor{Q\ctr{qctr}}{\par\image[BOTTOM]{\icondir begin_colorline.gif}}
\begin{description}
\item[\bf Q. \ctr{qctr}]}
{
\ifthen {\numeq{\ctr{cellans}}0}
	\par \cdots\cdots Click here to return:\cdots\link{Q\ctr{qctr}}
	{\image[TOP][HERE]{\icondir curved_back.GIF}}
	\vspace{50}
	\end{excursion}\par
\ifelse \par \cdots\cdots 
	Click here to return:\cdots\xlink{../\uref{Q\ctr{qctr}}}
	{\image[TOP][HERE]{\icondir curved_back.GIF}}
	\end{cell}\par
\endif
\image[TOP]{\icondir end_colorline.GIF}\par}

\newcommand{\ans} {\par
\end{description}\hr
Click here for the answer:
\ifthen {\numeq{\ctr{cellans}}0}
	\link{A\ctr{qctr}}{\image[MIDDLE]{\icondir green_query.GIF}}
	\begin{excursion}{\buf{ansf}}{a}
	\anchor{A\ctr{qctr}}{\bf A. \ctr{qctr}}\cdots\cdots\cdots
\ifelse \cellref[A\ctr{qctr}]{\image[MIDDLE]{\icondir green_query.GIF}}
	\begin{cell}{A\ctr{qctr}}
\endif}

\newenvironment{hint}[1]{
\incctr{hntctr}
{\bf Hint:} \begin{gloss*}[#1]
{\image[TOP][Click Here]{\icondir green_bang!.GIF}}}
{\end{gloss*}}

\newcommand{\newansfile}[1][1]{
\begin{excursion}{#2}{w}
\preamb[#1]{Answers}
\end{excursion}
\setbuf{ansf}{#2}}

% multiple choice question using applet

\newctr{mcq}\newctr{mcstar}\newbuf{mcalt}
\newenvironment{mcquest}{
\setctr{mcq}{-1}
\clrctr{mcstar}
\incctr{qctr}
\anchor{Q\ctr{qctr}}{\par\image[BOTTOM]{\icondir end_colorline.GIF}}
\begin{quote}
\begin{applet}[\appletdir Mcquest]
[\substr{1}{6}{\getprop{bgprop}}]{200}{300}{mcquest}
\begin{capture}{0}
\semiverb[\mans:\mans*][\end{capture}]{mcquest}}
{\ifthen {\numeq{\ctr{mcq}}{0}}
	\jparam{quest}{\ctr{qctr}. \buf0}
\ifelse \jparam{A\ctr{mcq}}{\buf*{mcalt}}
	\jparam{R\ctr{mcq}}{\buf0}
	\ifthen {\numeq{\ctr{mcstar}}{1}}
		\jparam{C\ctr{mcq}}{\ctr{mcq}}
		\clrctr{mcstar}
	\endif
\endif	
\incctr{mcq}
\jparam{alts}{\ctr{mcq}}
\end{applet}\end{quote}
\image[TOP]{\icondir end_colorline.GIF}\par
}

\newcommand{\mans}[1]{
\end{capture}
\ifthen {\numeq{\ctr{mcq}}{-1}}
	\jparam{quest}{\ctr{qctr}. \buf0}
\ifelse \jparam{A\ctr{mcq}}{\buf*{mcalt}}
	\jparam{R\ctr{mcq}}{\buf*0}
	\ifthen {\numeq{\ctr{mcstar}}{1}}
		\jparam{C\ctr{mcq}}{\ctr{mcq}}
		\clrctr{mcstar}
	\endif
\endif
\setbuf{mcalt}{#1}
\incctr{mcq}
\begin{capture}{0}
}

\newcommand{\mans*}[1]{
\end{capture}
\ifthen {\numeq{\ctr{mcq}}{-1}}
	\jparam{quest}{\ctr{qctr}. \buf0}
\ifelse \jparam{A\ctr{mcq}}{\buf*{mcalt}}
	\jparam{R\ctr{mcq}}{\buf*0}
	\ifthen {\numeq{\ctr{mcstar}}{1}}
		\jparam{C\ctr{mcq}}{\ctr{mcq}}
		\clrctr{mcstar}
	\endif
\endif
\setbuf{mcalt}{#1}
\incctr{mcq}
\incctr{mcstar}
\begin{capture}{0}
}

% exercises
% new method

\newctr{exdpth}
\newenvironment{exercise}[0][1]{
\incctr{exctr}
\setctr{exdpth}{\depth}
\hr[noshade]
\ifthen	{\nonempty{#1}}
	\header{2}{\bundle*{3}{Exercise \ctr{exctr}: #1}}
\ifelse \header{2}{\bundle*{3}{Exercise \ctr{exctr}}}
\endif}
{\\\hr[noshade]\unbundle\par}

\newcommand{\solutionon}{\setctr{exsol}{1}}
\newcommand{\solutionoff}{\clrctr{exsol}}

\newenvironment{exsol}[0][1]{
\ifthen {\ctr{exsol}}
	\\Click here for the solution:
	\ifthen {\nonempty{#1}}
		\setbuf{99}{.#1}
	\ifelse \setbuf{99}{}
	\endif
	\begin{gloss*}[Solution to Exercise \ctr{exctr}\buf{99}]
	{\image[MIDDLE]{\icondir pink_query.GIF}}
\ifelse \begin{excursion}{/dev/null}{w}
\endif
}
{\ifthen {\ctr{exsol}} \end{gloss*}\ifelse \end{excursion}\endif}

% vocabulary

\newcommand{\vref}[1][1]{
\setrefbuf{rf\alt{#1}{#2}\/ \refbuf}
\setbuf0{\tagclean{rf\alt{#1}{#2}}}
\ifthen {\isref\buf0}
	\link{\buf0}{{\it #2\/}}
\ifelse {\it #2} \image{\icondir smenaw.gif}
\endif}

\newcommand{\vocab}{    % {\library{vcbl}}
\section{Vocabulary}
\centerline{\image{\icondir type.gif}}\par
\dblsrt[\refbuf]{anchor}{\libfile.htx}
%\postamb
}

%  html display

\newctr{htmld}
\newenvironment{html-display}{
\incctr{htmld}
\begin{capture}{0}
\semiverb[][\end{capture}]{html-display}}
{\mkp*{pre}
\buf0\nl
\mkp*{/pre}
\par
\xlink{htmld\ctr{htmld}.html}{Click here to View}
\begin{excursion}{htmld\ctr{htmld}}{w}
\preamb{HTML Example \ctr{htmld}}
\buf*0\nl\postamb
\end{excursion}
}

\newcommand{\sp}[0][1]{
\ifthen {\empty{#1}} \'160
\ifelse \newctr{ictr}
	\for{ictr}{#1}{1}{\'160}
\endif}

\newcommand{\latex}{LaTeX}
\newcommand{\LaTeX}{LaTeX}
\newcommand{\doindex}{\section{Index}\makeindex}

\newcommand{\indx}[1][1][Vt]{
\incctr{index}
\setbuf1{@i\depth @\ctr{index}}
\anchor{\buf1}{} 
\asinsert{#2}[|#1|]{\buf1}}

\newcommand{\makeindex}{
{\centering\header{2}{Index}}\par
\mkp*[cellpadding=5]{table}
\aslist[\mkp*{b}][\mkp*{/b}\sp[2]][\par]
{\image[][][border=0]{\icondir bsmiley.gif}}
\mkp*{/table}
}

\newcommand{\htxonly}[1]{#1}
\newcommand{\latexonly}[1]{}

%% TOC

\newctr{toclvl}
\newenvironment{toc}{\incctr{toclvl}}{\decctr{toclvl}}

\newcommand{\tocitem}[2]{
\ifthen {\numeq{\ctr{toclvl}}{1}}
	\par{\mkp{nobr}\bf\xlink[][target="main"]{#1}{#2}}
\ifelse
	\newctr{tctr}
	{\mkp{nobr}\for{tctr}{\plus{\ctr{toclvl}}{-1}}{1}{-}
	\xlink[][target="main"]{#1}{#2}}
\endif
\ifthen {\empty{\substr{20}{21}{#2}}}\break
\ifelse\nl
\endif
}

Colors

\newcommand{\paleBlue}{\wallpaint{fbd8ff}}
\newcommand{\palePink}{\wallpaint{ffbfe1}}
\newcommand{\paleGreen}{\wallpaint{bfffcb}}
\newcommand{\paleLavender}{\wallpaint{d8bfff}}
\newcommand{\robinsEggBlue}{\wallpaint{c0ffff}}
\newcommand{\pastelGreen}{\wallpaint{d4ffd4}}
\newcommand{\palePurple}{\wallpaint{ffd4ff}}

\newkeyhole[\mainfileroot\ key][d8bfff]{\curfileroot key}
\newansfile[ffbfe1]{\curfileroot ans}
\newcelldir{\mainfileroot cell}

% frame creation

\nobody
\title{\mainfileroot}
\outputon
\getbase
\mkp*{/head}
\rtoc{0:1:2:3}{toc}[][tocitem]
\begin{frameset}[][30\pct,70\pct]\nl
\frame[contents]{\curfileroot tc.html}
\frame[main]{\curfileroot 0.html}
\end{frameset}
\begin{excursion}{\curfileroot tc}{w}
\setbuf0{\getprop{lnprop}}
\setbuf1{\getprop{txprop}}
\setbuf2{\getprop{vlprop}}
\setprop{lnprop}{ffffff}
\setprop{txprop}{ff0000}
\setprop{vlprop}{ffff00}
\preamb[000000]{Contents}
\header{2}{Contents}
\ifthen{\numeq{\pass}{2}}\input{\mainfileroot toc}\endif
\par\postamb
\end{excursion}
\setprop{lnprop}{\buf0}\setprop{txprop}{\buf1}\setprop{vlprop}{\buf2}
\robinsEggBlue
\bundle{0}{Title Page}
\outputoff
