#!/bin/csh
# File Name:    cprsheet
# File Purpose: This file is a c-shell script that is designed to open and load
#               a spread-sheet with copper / exposed area information.
# Written by:   Ian Ticehurst (Autom8 Ltd.)
# Version 1A.:  Date: 09.08.00 - Initial design and development.
# Version 1B.:  Date: 16.08.00 - Minor modification to include parameter file.
# Version 1C.:  Date: 26.10.00 - Addition of $TMP definition and useage.
# Version 1D.:  Date: 05.12.00 - Removal of "gui" alias.
############################# Start of notes ###############################
# This file is called from one place within the system. From the layer tools menu
# call copper/exposed area, from this pop-up open report, from the report options
# pop-up select the third picture button (external spreadsheet report). This button
# runs this hook. This script gets a single parameter passed to it ($1) which is the
# name of a file which contains some copper area information. Thus this script could
# have a single command line which called up a spread-sheet with this file name. But
# as the hook is a c-shell script, it can perform any action dictated by the code
# below. A more complex series of operations might be this:-
#
#        Run a DO_INFO command for the matrix (get layer list)
#        foreach $LAYER ($LAYER_LIST)
#            if ($LAYER is a circuit layer) then
#                Run command line to get copper area for $LAYER
#                Output copper area results and $LAYER to tmp. file
#            endif
#        end
#        Run a command to open spreadsheet and loading the tmp. file
#
############################# End of notes ###############################
# Define correct temp. dir. depending on env. vars.
if ($?GENESIS_TMP) then
	set TMP = $GENESIS_TMP
else if ($?GENESIS_DIR) then
	set TMP = $GENESIS_DIR/tmp
else
	set TMP = /genesis/tmp
endif

# Set up gui data and response files
set GUI_DATA = $TMP/gui_data.$$
set GUI_RESP = $TMP/gui_resp.$$

# Give the parameter a suitable variable name.
set CU_AREA_FILE = `echo "$1"`

# Put window on screen.
echo "WIN 200 200" >> $GUI_DATA
echo "FONT tbr14" >> $GUI_DATA
echo "BG 222299" >> $GUI_DATA
echo "FG 999999" >> $GUI_DATA
echo "LABEL Frontline Default Hook Pop-up" >> $GUI_DATA
echo "LABEL This is the default hook cprsheet" >> $GUI_DATA
echo "LABEL It is located in $GENESIS_DIR/sys/hooks" >> $GUI_DATA
echo "LABEL The hook is designed to open a spread-sheet and load copper / exposed area data into it" >> $GUI_DATA
echo "LABEL Some copper area data is available in the file $CU_AREA_FILE" >> $GUI_DATA
echo "LABEL Comments and possible applications can be found in the header of this hook" >> $GUI_DATA
echo "LABEL Also see the hooks readme file and on-line manual 0203 (chapter 9) for more details" >> $GUI_DATA
echo "END" >> $GUI_DATA

gui $GUI_DATA
\rm $GUI_DATA

abort:

exit 
############################ END OF PROGRAM #####################
