home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright 1992 StarTeck. All rights reserved.
-
- This Genie sets the grid SIZE !!!
-
- *** It is up to you to turn the grid ON or OFF. ***
- Key-Board Shortcut CTRL-G
- */
-
- /* Trace ?results */
-
- call pdm_AutoUpdate(0)
- cr = '0a'x
- count = 0
- units = pdm_getunits()
- datafile = 'datafile'
- filename = 'sys:S/GridSet.STk'
-
- if open(datafile, filename, 'r') then do /* open gridlist */
- if datafile = '' then exit_msg(filename' is empty...')
- do while ~eof(datafile) /* do until end of file */
- count = count + 1
- line = readln(datafile)
- numberofwords = words(line)
- if numberofwords = 2 then do
- gridlistline.count.X = word(line,1)
- if ~(datatype(gridlistline.count.X,n)) then exit_msg('Invalid input in 'filename' not a number.')
- if ~(gridlistline.count.X > 0) then exit_msg('Invalid input in 'filename' negative number.')
- gridlistline.count.Y = word(line,2)
- if ~(datatype(gridlistline.count.Y,n)) then exit_msg('Invalid input in 'filename' not a number.')
- if ~(gridlistline.count.Y > 0) then exit_msg('Invalid input in 'filename' negative number.')
- end /* if numberofwords = 2 */
- else do
- if ~numberofwords = 0 then exit_msg('Invalid format in 'filename)
- count = count - 1
- end /* else */
- end /* do while */
- end /* if then do */
- else exit_msg('Could not find file: 'filename)
-
- call close(datafile)
-
- if units > 2 then do /* convert units if picas */
- do i = 1 to count
- gridlistline.i.X = pdm_ConvertUnits(1,units,gridlistline.i.X)
- gridlistline.i.Y = pdm_ConvertUnits(1,units,gridlistline.i.Y)
- end
- end
-
- gridlist = ''
-
- do i = 1 to count - 1 /* build list into a varible to use in pdm_selectfromlist */
- gridlist = insert(gridlist, 'X'gridlistline.i.X' ')
- gridlist = insert(gridlist, 'Y'gridlistline.i.Y " "cr)
- end
- gridlist = insert(gridlist, 'X'gridlistline.count.X' ')
- gridlist = insert(gridlist, 'Y'gridlistline.count.Y)
-
- userchoice = pdm_selectfromlist("Choose grid size...",11,count,2,gridlist)
- if userchoice = '' then exit_msg()
-
- parse var userchoice 'X'Xsize ' Y'Ysize
- Ysize = strip(Ysize)
-
- call pdm_setgridsize(Xsize,Ysize)
-
-
- exit_msg:
- do
- parse arg message
- if message ~= '' then
- call pdm_Inform(1, message,)
- call pdm_ClearStatus()
- call pdm_SetUnits(units)
- exit
- end
-