home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0925.lha / DonsGenies / DonsGenies.lha / Don'sGenies / GridSetPosition.pprx < prev    next >
Text File  |  1993-08-07  |  1KB  |  67 lines

  1. /* This Genie sets up a grid to a user-defined position (rather than size), with snap enabled.
  2. Written by Don Cox  ⌐ Feb 93. Mods Aug 93. Not public domain but freely usable for non-commercial purposes. */
  3.  
  4.  
  5. signal on error
  6. signal on syntax
  7. address command
  8. call SafeEndEdit.rexx()
  9. call ppm_AutoUpdate(0)
  10. cr="0a"x
  11.  
  12. currentunits = ppm_GetUnits()
  13.  
  14. gsize = ppm_GetGridSize()
  15. gwidth = word(gsize,1)
  16. gheight = word(gsize,2)
  17. call ppm_SaveText("ram:gridsize",gsize)
  18.  
  19. form = "From Left"cr"From Top"
  20. form = ppm_GetForm("Type Left or Top position",8,form)
  21. if form = "" then exit_msg("No position set")
  22. parse var form xpos "0a"x ypos
  23.  
  24. if xpos>=4 then do
  25.     xnum = xpos%2.0
  26.     xspacing = xpos/xnum
  27.     end
  28. else if xpos>=2 then xspacing = xpos/2
  29. else xspacing = xpos
  30.  
  31. if ypos>2 then do
  32.     ynum = ypos%2.0
  33.     yspacing = ypos/ynum
  34.     end
  35. else if ypos>=2 then yspacing = ypos/2
  36. else yspacing = ypos
  37.  
  38. select
  39.     when xpos = 0 | xpos = "" then call ppm_SetGridSize(0.01,yspacing)
  40.     when ypos = 0 | ypos = "" then call ppm_SetGridSize(xspacing,0.01)
  41.     otherwise call ppm_SetGridSize(xspacing,yspacing)
  42.     end
  43.  
  44. call ppm_SetGrid(1)
  45. call ppm_SetGridSnap(1)
  46.  
  47. call exit_msg()
  48.  
  49. end
  50.  
  51. error:
  52. syntax:
  53.     do
  54.     exit_msg("Genie failed due to error: "errortext(rc))
  55.     end
  56.  
  57. exit_msg:
  58.     do
  59.     parse arg message
  60.     if message ~= "" then
  61.     call ppm_Inform(1,message)
  62.     call ppm_ClearStatus()
  63.     call ppm_AutoUpdate(1)
  64.     exit
  65.     end
  66.  
  67.