#!/bin/csh
# This is a program for the example Genesis Tooling Forms.
# This file will exist in both forms (1 and 2).
# The purpose of this program is to open the graphic editor for the job.
# It is called by the "Open Graphic Editor" button.
# 
# Written by Ian Ticehurst (Autom8 Ltd.)
# Version 1A. Date: 08.09.00 - Initial design and development.
# Version 1B. Date: 11.12.00 - Add source of info. file to support gui creation.
# Version 1C. Date: 12.12.00 - Re-write the gui windows to use the sourced font and colours.
# Version 1D. Date: 05.02.01 - Modify to only check job path if job moved from original location.
# Version 1E. Date: 09.02.01 - Modify the setting and useage of $TMP.
# Version 1F. Date: 14.03.01 - Check how "$GENESIS_EDIR" is set to ensure paths are set correctly.
######################################################################### 
# Define correct temp. dir. depending on env. vars.

source $_genesis_root/sys/scripts/include_me

# Check number of steps, if more than one ask user which one to open in graphic editor.
DO_INFO -t job -e $JOB
set STEPCT = $#gSTEPS_LIST

if ($STEPCT == 1) then
   set SEL_STEP = "$gSTEPS_LIST"
else	
   while (! $?SEL_STEP)
      o_tooling
      o FONT $NORM_FNT
      o BG $NORM_COL
      o BW 0
      o LABEL Step Selection Popup
      o LABEL Multiple Steps Detected.
      o LABEL Select The Entity To Open:
      o BG $LSTBG_COL
      o LIST SEL_STEP 5 S
      foreach M_STEP ($gSTEPS_LIST)
         o $M_STEP
      end
      o END
      o BG $NORM_COL
      o END

      do_gui
   end
endif

# Open the graphic editor on selected step page.
COM open_entity,job=$JOB,type=step,name=$SEL_STEP
AUX set_group,group=$COMANS

exit 0
