home *** CD-ROM | disk | FTP | other *** search
/ DTP Toolbox / DTPToolbox.iso / propage4.0 / arexx / groupmove.pprx < prev    next >
Encoding:
Text File  |  1992-03-15  |  2.0 KB  |  104 lines

  1. /*
  2. @BGroupMove  @P@ICopyright Gold Disk Inc., February, 1992
  3.  
  4. This Genie will move a group by a specified amount or to a specified position. You may use a negative or positive offset to current values.
  5. Example:    Left Pos 1 - .5
  6.             Top Pos 1 + 1
  7.  
  8. This would offset the current group by -.5 inches horizontally and 1 inch vertically
  9.           
  10. */
  11. parse arg sx, sy
  12. signal on error
  13. signal on syntax
  14.  
  15. address command
  16. call SafeEndEdit.rexx()
  17. cr          = '0a'x
  18. call ppm_AutoUpdate(0)
  19.  
  20. units = ppm_GetUnits()
  21. if units = 3 then
  22.     call ppm_SetUnits(1)
  23.  
  24. signal on halt
  25. signal on break_c
  26. signal on break_e
  27. signal on break_d
  28.  
  29.     
  30. box = ppm_GroupFirstBox()
  31. if box  = 0 then exit_msg("Select a group of boxes first")
  32.  
  33. grppos  = ppm_GetGroupRect()
  34. grpleft = word(grppos, 1)
  35. grptop  = word(grppos, 2)
  36.  
  37. if sx = '' then do
  38.  
  39.    if units = 3 then
  40.        form    = "Left Pos:" || ppm_ConvertUnits(1, 3, grpleft) || cr"Top Pos:" || ppm_ConvertUnits(1, 3, grptop)
  41.    else
  42.        form    = "Left Pos:"grpleft||cr"Top Pos:"grptop
  43.  
  44.     form    = ppm_GetForm("Enter coordinates", 12, form)
  45.     if form = '' then exit_msg()
  46.  
  47.     parse var form  sx '0a'x sy 
  48.  
  49. end
  50.  
  51. interpret "sx ="sx
  52. interpret "sy ="sy
  53.  
  54. if ~(datatype(sx, n) & datatype(sy, n)) then exit_msg("Invalid Entry")
  55.  
  56. if units = 3 then 
  57. do
  58.    sx = ppm_ConvertUnits(3, 1, sx)
  59.    sy = ppm_ConvertUnits(3, 1, sy)
  60. end
  61.  
  62.  
  63. do while box ~= 0
  64.  
  65.     boxpos  = ppm_GetBoxPosition(box)
  66.     boxsize = ppm_GetBoxSize(box)
  67.     left    = word(boxpos, 1)
  68.     top     = word(boxpos, 2)
  69.  
  70.  
  71.     newboxleft  =   sx + left - grpleft
  72.     newboxtop   =   sy + top  - grptop
  73.  
  74.     call ppm_SetBoxPosition(box, newboxleft, newboxtop)
  75.     box = ppm_GroupNextBox(box)
  76.  
  77. end
  78.  
  79. exit_msg()
  80. break_d:
  81. break_e:
  82. break_c:
  83. halt:
  84.     call exit_msg("User aborted Genie!")
  85.  
  86. exit_msg: procedure expose units
  87. do
  88.  
  89.     parse arg message
  90.  
  91.     if message ~= '' then call ppm_Inform(1,message,)
  92.  
  93.     call ppm_AutoUpdate(1)
  94.  
  95.    if units = 3 then call ppm_SetUnits(3)
  96.     exit
  97. end
  98.  
  99.  
  100. error:
  101. syntax:
  102. do
  103.     call exit_msg("Invalid Entry")