#! /bin/csh -f
# Print FERRET documentation
# PostScript, possibly double-sided
# *sh* - 11/91
# *jd* - 10.93 to print out files appropriate for current version
# *jd* -  4.94 for Ferret 3.10
# *jd& -  5.95 for Ferret GUI doc by Oz

#cd $FER_DIR/doc

echo " "
echo This procedure will print your choice of FERRET documentation
echo " "

if (! -e ferret_users_guide.ps) then
  if (-e ferret_users_guide.ps.Z) then
    echo "Note: The file ferret_users_guide.ps is compressed."
    echo "      Your FERRET manager must uncompress it in order to print it."
    echo " "
  endif
endif

if (! -e ferret_gui_doc_1.ps) then
  if (-e ferret_gui_doc_1.ps.Z) then
    echo "Note: The files ferret_gui_doc_*.ps are compressed."
    echo "      Your FERRET manager must uncompress them in order to print the GUI doc."
    echo " "
  endif
endif

get_doc:
echo Available documents:
echo ""
echo "    1) FERRET Users Guide        - 200 pages"
echo "    2) FERRET GUI Users Guide    -  32 pages"
echo "    3) FERRET Installation Guide -  10 pages"
echo "    4) PLOT PLUS Users Guide     - 100 pages"
echo "    5) PLOT PLUS fonts           -  35 pages"
echo "    6) TMAP-format documents     -  13 pages"
echo "    7) TMAP grid concepts        -   1 page "
echo "    8) FERRET concepts overview  -   1 page "
echo "    9) Plot hard copy info       -   1 page "
echo ""
echo -n "Select desired document (0=no selection): "

set ndoc = $<
switch($ndoc)

case 0:
# no selection
   exit

case "":
# no selection
   exit

case 1:
# FERRET Users Guide
   set doc = ferret_users_guide.ps 
   breaksw

case 2:
# FERRET GUI Users Guide
   set doc = "ferret_gui_doc_*.ps"
   breaksw

case 3:
# FERRET Installation Guide 
# the files from $FER_DIR/bin are "attachments" to the installers guide
   set doc = "*ferret_install_guide.ps"
   set ascii_doc = ($FER_DIR/bin/ferret_paths_template \
                    $FER_DIR/bin/Fprint_template \
                    $FER_DIR/bin/my_ferret_paths_template)
   breaksw


case 4:
# PLOT PLUS Users Guide
   set doc = (pplus_cover_sheet.ps \
              blank_page.ps \
	      pplus_enhance_user_guide.ps \
	      pplus_manual.ps)
   breaksw

case 5:
# PLOT PLUS fonts
   set doc = pplus_fonts.ps 
   breaksw

case 6:
# TMAP-format documents 
   set doc = (tmap_format_toc.ps \
   blank_page.ps \
   tmap_format_intro.ps \
   gt_format.ps \
   gt_figure.ps \
   blank_page.ps \
   gt_des_annot.ps \
   blank_page.ps \
   ts_format.ps \
   ts_figure.ps \
   blank_page.ps \
   ts_des_annot.ps \
   blank_page.ps \
   about_grid_files.ps \
   grid_file_examp.ps)
   breaksw

case 7:
# TMAP grid concepts
   set doc = grid_concepts.ps
   breaksw

case 8:
# FERRET concepts overview
   set doc = think_ferret.ps
   breaksw

case 9:
# Plot hard copy info
   set doc = Fprint.ps
   breaksw

default:
   echo "* * * Out of range * * *"
   goto get_doc
   breaksw
endsw

echo -n "Postscript printer name [<CR> for default system printer] ?"
set prnt = $<
if ( $prnt ==  ) then
   set printer
else
   set printer = -P$prnt
endif

get_sides:
echo -n "Double-sided (y or n) [default y] ? "
set doub = $<
switch($doub)
case y:
   set sides = -K2
   breaksw
case n:
   set sides
   breaksw
case "":
   set sides = -K2
   breaksw
default:
   goto get_sides
   breaksw
endsw

# go print it
echo Now printing:
echo lpr -s $printer $sides $doc
lpr -s $printer $sides $doc

# any ascii attachments ?
if ( $?ascii_doc ) then
   echo ASCII attachments:
   echo lpr -s $printer $sides $ascii_doc
   lpr -s $printer $sides $ascii_doc
endif



