#! /bin/sh
#
# This generates Cvo HTML document index pages. It expects
# a file 'files' which contains all of the objects to
# go in various indexes, as well as a master index.

. $1

##
## Create the Cvo object index, categorized by object type.
##

echo "Creating Cvo object index, by category"

fn="../html/index.html"
rm -f ${fn}
title="Cvo Object Documentation Indices"
echo "<HTML><HEAD><TITLE>${title}</TITLE> \
</HEAD><BODY> \
<H1>${title}</H1> \
<P> \
Cvo provides many different objects. They can be organized into \
several general categories. This document displays the objects \
separated into their categories, listed below. Also available is a \
master index of all Cvo objects. \
</P> \
<UL> \
<LI><A HREF="master.index.html">Master Index of Cvo Objects</A><BR></LI> \
<LI><A HREF="#CONTAINER">Container Objects</A></LI> \
<LI><A HREF="#CONTROL">Visual Control Objects</A></LI> \
<LI><A HREF="#MENUS">Menu Objects</A></LI> \
<LI><A HREF="#BUTTONS">Button Objects</A></LI> \
<LI><A HREF="#IO">Input and Output Objects</A></LI> \
<LI><A HREF="#VIEWPORT">Viewport Objects</A></LI> \
<LI><A HREF="#DIALOG">Dialog Interaction Objects</A></LI> \
<LI><A HREF="#NONVISUAL">Nonvisual Utility Objects</A></LI> \
<LI><A HREF="#BASE">Base Objects</A></LI> \
</UL> \
<HR><HR>" > ${fn}

##
## Container Objects
##

echo "<H2><A NAME="CONTAINER">Container Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}
echo "The Cvo container objects are used to organize the visual display" >> ${fn}
echo "of other objects. They generally have little functionality of their" >> ${fn}
echo "own, as they are simply used as the parent object for a collection" >> ${fn}
echo "of more functional objects." >> ${fn}
echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${containers}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Visual Control Objects
##

echo "<H2><A NAME="CONTROL">Visual Control Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}

echo "These Cvo objects are used to control some visual aspects of the \
application. Some modify the behavior of other objects, or add \
functionality to an object. Others simply provide methods to \
visually separate objects, etc." >> ${fn}

echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${control}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Menu Objects
##

echo "<H2><A NAME="MENUS">Menu Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}
echo "These Cvo objects allow the creation of menus, such as menu bars," >> ${fn}
echo "pull down menus, and menus displayed when a button is pressed." >> ${fn}
echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${menus}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Button Objects
##

echo "<H2><A NAME="BUTTONS">Button Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}
echo "These Cvo objects provide visual buttons, and the objects used" >> ${fn}
echo "to construct such buttons." >> ${fn}
echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${buttons}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Input/Output Objects
##

echo "<H2><A NAME="IO">Input and Output Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}
echo "These Cvo objects provide the ability to display and enter information." >> ${fn}
echo "This information may be of a textual or graphical nature. These objects" >> ${fn}
echo "are generally used to construct the visual display of an application," >> ${fn}
echo "which differentiates them from the <A HREF="#DIALOG">dialog type objects</A>" >> ${fn}
echo "listed previously," >> ${fn}
echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${IO}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Viewport Objects
##

echo "<H2><A NAME="VIEWPORT">Viewport Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}

echo "These Cvo objects provide what are called viewports. A viewport is \
a wrapper around other Cvo objects, which allows a user to scroll \
and perhaps pan the Cvo objects in the viewport." >> ${fn}

echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${viewports}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Dialog Objects
##

echo "<H2><A NAME="DIALOG">Dialog Interaction Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}

echo "These Cvo objects provide the means to gather information from \
a user, and to inform the user of something. They are generally used \
as transient objects. They include list boxes, radio boxes, inform boxes \
and other such objects." >> ${fn}

echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${dialog}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Nonvisual Utility Objects
##

echo "<H2><A NAME="NONVISUAL">Nonvisual Utility Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}
echo "These Cvo objects are used to provide utility functions. There are objects" >> ${fn}
echo "for text and graphics storage, lists, linking object behavior, and others." >> ${fn}
echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}
for file in ${nonvisual}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "<HR>" >> ${fn}

##
## Base Objects
##

echo "<H2><A NAME="BASE">Base Objects</A></H2>" >> ${fn}
echo "<P>" >> ${fn}

echo "The Cvo base objects are those which are used to construct other \
objects. These objects generally have no visual display, or if \
they do, it is minimal and partially non-functional." >> ${fn}

echo "</P>" >> ${fn}
echo "<UL>" >> ${fn}

for file in ${bases}
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done
echo "</UL>" >> ${fn}
echo "</BODY><HTML>" >> ${fn}

#########################################################################
#########################################################################
#########################################################################

##
## Create the master index of Cvo objects
##

echo "Creating the Cvo object master index"

sfn="/tmp/masters.$$"
rm -f ${sfn}
if [ -f ${sfn} ]
then
  sfn="/tmp/xxxxxxxxxxxmastersyyyy.$$"
  rm -f ${sfn}
fi

touch ${sfn}

for file in ${bases} ${containers} ${control} ${buttons} ${dialog} ${menus} ${IO} ${nonvisual} ${aux}
do
  echo ${file} >> ${sfn}
done

sort -o${sfn} ${sfn}

fn="master.index.html"
title="Master Index of Cvo Objects"
echo "<HTML><HEAD><TITLE>${title}</TITLE>" > ${fn}
echo "</HEAD><BODY>" >> ${fn}
echo "<H1>${title}</H1>" >> ${fn}
echo "<UL>" >> ${fn}

for file in `cat ${sfn}`
do
  name="`basename ${file} .html`"
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done

echo "</UL>" >> ${fn}
echo "</BODY><HTML>" >> ${fn}

rm -f ${sfn}

#########################################################################
#########################################################################
#########################################################################

##
## Create the Cvo object cross reference
##

echo "Creating the Cvo object cross reference"

fn="cref.html"
rm -f ${fn}
title="Cvo Object Cross Reference Index"
echo "<HTML><HEAD><TITLE>${title}</TITLE>" > ${fn}
echo "</HEAD><BODY>" >> ${fn}
echo "<H1>${title}</H1>" >> ${fn}
echo "<UL>" >> ${fn}

for file in *.cref.html
do
  name="`basename ${file} .cref`".html
  echo "<LI><A HREF=\"${file}\">${name}</A>" >> ${fn}
done

echo "</UL></BODY><HTML>" >> ${fn}

#########################################################################
#########################################################################
#########################################################################

##
## Create the initial Cvo documentation page
##

echo "Creating the Cvo documentation page"

fn="cvo.html"
rm -f ${fn}
title="C++ Visual Objects Documentation"
echo "<HTML><HEAD><TITLE>${title}</TITLE>" > ${fn}
echo "</HEAD><BODY>" >> ${fn}
echo "<H1>${title}</H1>" >> ${fn}
echo "<UL>" >> ${fn}
echo "<LI><A HREF=\"overview.html\">Cvo Overview</A>" >> ${fn}
echo "<LI><A HREF=\"using.html\">Using the Documentation</A>" >> ${fn}
echo "<LI><A HREF=\"methods.html\">Using Cvo - Methodology</A>" >> ${fn}
echo "<LI><A HREF=\"index.html\">Cvo Object Documentation Indices</A>" >> ${fn}
echo "<LI><A HREF=\"cref.html\">Cvo Object Cross Reference</A>" >> ${fn}
echo "</UL></BODY><HTML>" >> ${fn}

#########################################################################
#########################################################################
#########################################################################

##
## Create the Cvo Methodology index page
##

echo "Creating the Cvo methodology index page"

fn="methods.html"
rm -f ${fn}
title="Using Cvo - Methodology"
echo "<HTML><HEAD><TITLE>${title}</TITLE>" > ${fn}
echo "</HEAD><BODY>" >> ${fn}
echo "<H1>${title}</H1>" >> ${fn}
echo "<UL>" >> ${fn}
echo "<LI><A HREF=\"objects.html\">Cvo Object Usage Overview</A>" >> ${fn}
echo "<LI><A HREF=\"resources.html\">Using X Resources</A>" >> ${fn}
echo "<LI><A HREF=\"events.html\">Events and Event Registration</A>" >> ${fn}
echo "<LI><A HREF=\"translations.html\">Translations</A>" >> ${fn}
echo "<LI><A HREF=\"international.html\">Internationalization of Cvo Applications</A>" >> ${fn}
echo "</UL></BODY><HTML>" >> ${fn}
