#!/bin/csh
# This is a program for the example Genesis Tooling Forms.
# This file will exist in form 1.
# The purpose of this program is to open the drill tool manager for every drill file and
# allow the user to define the drill sizes.
# It is called by the "Set-up Drill Sizes" button.
# 
# Written by Ian Ticehurst (Autom8 Ltd.)
# Version 1A. 11.09.00 - Initial design and development.
# Version 1B. 11.12.00 - Add source of info. file to support gui creation.
# Version 1C. 12.12.00 - Re-write the gui windows to use the sourced font and colours.
# Version 1D. 05.02.01 - Modify to only check job path if job moved from original location.
#                      - Text changes to ensure abbreviations are removed.
#                      - Add save time update to forms.
# Version 1E. 09.02.01 - Modify the setting and useage of $TMP.
# Version 1F. 14.03.01 - Check how "$GENESIS_EDIR" is set to ensure paths are set correctly.
# Version 1G. 23.07.01 - Revamped
######################################################################### 

source $_genesis_root/sys/scripts/include_me

set_in_progress genform1 dtm

# Close Form
COM close_form,job=$JOB,form=genform1

# Open editor to enable graphic editor command lines.
COM open_entity,job=$JOB,type=step,name=pcb
set group = $COMANS
AUX set_group,group=$group

# Close editor.
COM editor_page_close

# Open the drill tool manager for every drill layer.
DO_INFO -t matrix -e $JOB/matrix
@ COUNT = 1
foreach LAYER ($gROWname)
   if ($gROWlayer_type[$COUNT] == "drill") then
      COM tools_show,layer=$gROWname[$COUNT]

      # Put window on screen asking user to set the drills for this layer.
      o_tooling
      o FONT $NORM_FNT
      o BG $NORM_COL
      o BW 0
      o LABEL Drill Tool Pop-up.
      o LABEL Drill Tool Manager is open on layer - $LAYER
      o LABEL Program will pause.
      o LABEL Set up drills for this layer.
      o LABEL Close pause box when drills are set
      o FONT $HINT_FNT
      o BG $HINT_COL
      o LABEL Hint - Remember to apply the changes
      o BG $NORM_COL
      o END

      do_gui

      # Pause script and ask user to complete drill setting.
      PAUSE Press continue when drills are set

   endif
   @ COUNT ++
end	

COM tools_close,force=no

# Open Form
COM show_form,job=$JOB,form=genform1

set_complete genform1 dtm

save_job

exit 0
