home *** CD-ROM | disk | FTP | other *** search
- /* This Genie sets up a grid to a user-defined position (rather than size), with snap enabled.
- Written by Don Cox © Feb 93. Mods Aug 93. Not public domain but freely usable for non-commercial purposes. */
-
-
- signal on error
- signal on syntax
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
- cr="0a"x
-
- currentunits = ppm_GetUnits()
-
- gsize = ppm_GetGridSize()
- gwidth = word(gsize,1)
- gheight = word(gsize,2)
- call ppm_SaveText("ram:gridsize",gsize)
-
- form = "From Left"cr"From Top"
- form = ppm_GetForm("Type Left or Top position",8,form)
- if form = "" then exit_msg("No position set")
- parse var form xpos "0a"x ypos
-
- if xpos>=4 then do
- xnum = xpos%2.0
- xspacing = xpos/xnum
- end
- else if xpos>=2 then xspacing = xpos/2
- else xspacing = xpos
-
- if ypos>2 then do
- ynum = ypos%2.0
- yspacing = ypos/ynum
- end
- else if ypos>=2 then yspacing = ypos/2
- else yspacing = ypos
-
- select
- when xpos = 0 | xpos = "" then call ppm_SetGridSize(0.01,yspacing)
- when ypos = 0 | ypos = "" then call ppm_SetGridSize(xspacing,0.01)
- otherwise call ppm_SetGridSize(xspacing,yspacing)
- end
-
- call ppm_SetGrid(1)
- call ppm_SetGridSnap(1)
-
- call exit_msg()
-
- end
-
- error:
- syntax:
- do
- exit_msg("Genie failed due to error: "errortext(rc))
- end
-
- exit_msg:
- do
- parse arg message
- if message ~= "" then
- call ppm_Inform(1,message)
- call ppm_ClearStatus()
- call ppm_AutoUpdate(1)
- exit
- end
-
-