/*------------------------------------------------------------------------- /* Environmental Systems Research Institute /*------------------------------------------------------------------------- /* Program: GETCOVER.AML /* Purpose: Tool for browsing the file system to select a coverage. /* /*------------------------------------------------------------------------- /* Usage: getcover INIT {wildcard} {coverage_type} /* {'position'} {'stripe'} /* Usage: getcover /* /* Arguments: routine - name of the routine to be called. /* /* varname - name of the variable to receive the value returned /* from the menu - used with the INIT routine /* wildcard - the string (filter) for listing file names - /* defaults to '*' /* covtype - coverage type to list /* position - (quoted string) opening menu position. /* stripe - (quoted string) menu stripe displayed. /* /* Globals: /*------------------------------------------------------------------------- /* Calls: /*------------------------------------------------------------------------- /* Notes: /*------------------------------------------------------------------------- /* Input: /* Output: /*------------------------------------------------------------------------- /* History: Matt McGrath - 02/06/92 - Original coding /* Matt McGrath - 11/21/92 - Added ability to save previous path /*========================================================================= /* &args routine varname wildcard type position stripe &severity &error &routine bailout /* Check arguments &if [NULL %routine%] &then &call usage &call %routine% &return /*------------------- &routine USAGE /*------------------- /* &type Usage: getcover INIT {wildcard} {coverage_type} &type {'''position'''} {'''stripe'''} &type Usage: getcover &return &inform /*------------------- &routine INIT /*------------------- /* Display the menu /* &set covtypes = ALL ADDRESS ANNOTATIONS ARC LINE LINK NETWORK NODE POINT POLYGON TIC &set type = [TRANSLATE %type%] &if [NULL %type%] or %type% = # &then &set type = All /* Check for the correct coverage type &if [KEYWORD %type% %covtypes%] lt 1 &then &do &type Coverage type must be: &type %covtypes% &type &call usage &end &if [NULL %varname%] &then &call usage /* &if [NULL %position%] or %position%_ = #_ &then &set position = &cc &screen &cc &if [NULL %stripe%] or %stripe%_ = #_ &then &set stripe = Select a Coverage - Type: %type% /* Set the name of the variable to receive the value set in the menu &set .getcover$varname = %varname% /* Initialize other variables /* string for listing files (directories) &set .getcover$pathstring = '/*' /* /* Current directory /* Set path to previous one if this tool has already been used &if not [VARIABLE .arctools$get_savepath] &then &set .arctools$get_savepath &if [NULL %.arctools$get_savepath%] &then &set .getcover$curdir = [SHOW &workspace] &else &set .getcover$curdir = %.arctools$get_savepath% /* /* Subdirectories in the current directory &set .getcover$subdir = %.getcover$curdir% /* Pathname for defining scrolling list of files (coverages and directories) &set .getcover$fileloc = %.getcover$curdir%[UNQUOTE %.getcover$pathstring%] /* Wildcard for listing files (list only files containing the wildcard) &if [NULL %wildcard%] &then &set wildcard = * &if [QUOTE %wildcard%] = '#' &then &set wildcard = * /* &if [SHOW &thread &exists tool$getcover] &then &thread &delete tool$getcover &thread &create tool$getcover ~ &menu getcover.menu ~ &position [UNQUOTE %position%] ~ &stripe [QUOTE [UNQUOTE %stripe%]] ~ &pinaction '&run getcover cancel' /* Make this menu modal &run modal open tool$getcover /* &return /*------------------- &routine CURDIR /*------------------- /* Change the current directory to the specified directory and update /* the list of subdirectories and coverages &if [NULL %.getcover$curdir%] &then &do &set .getcover$curdir = [DIR %.getcover$fileloc%] &return &end /* /* Expand possible environment variables &set .getcover$curdir = [PATHNAME [EXTRACT 1 %.getcover$curdir%]] /* &if not [EXISTS %.getcover$curdir% -DIR] &then &do &set temp = [DIR %.getcover$fileloc%] &set .getcover$message = Directory %.getcover$curdir% does not exist &set .getcover$curdir = %temp% &end &set .getcover$fileloc = %.getcover$curdir%[UNQUOTE %.getcover$pathstring%] /* &return /*------------------- &routine SUBDIR /*------------------- /* Change the current directory to the specified subdirectory /* &set .getcover$curdir = %.getcover$subdir% &set .getcover$fileloc = %.getcover$subdir%[UNQUOTE %.getcover$pathstring%] &return /*------------------- &routine UP /*------------------- /* Move up one directory. &set temp = [DIR %.getcover$fileloc%] &set temp = [DIR %temp%] &set .getcover$curdir = %temp% &if [QUOTE %temp%] = '/' &then &set temp &set .getcover$fileloc = %temp%[UNQUOTE %.getcover$pathstring%] &set .getcover$message /* &return /*------------------- &routine OK /*------------------- /* Quit from menu, cleanup /* &set [VALUE .getcover$varname] = %.getcover$cover% /* /* Save the path for future use of this tool &set .arctools$get_savepath = %.getcover$curdir% &call exit /* &return /*------------------- &routine CANCEL /*------------------- /* Set values to null to indicate to calling program that nothing was /* selected &set [VALUE .getcover$varname] &call exit /* &return /*------------------- &routine EXIT /*------------------- /* Quit from menu, cleanup /* &dv .getcover$* /* /* Close the modal menu and re-establish thread environment &run modal close tool$getcover /* &return /*------------------- &routine BAILOUT /*------------------- /* &severity &error &ignore &severity &warning &ignore /*&call exit &return &warning An error has occurred in routine: %routine% (GETCOVER.AML) /*----------------- &routine SAFETY_NET /*----------------- &return