home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d7xx / d724 / donsgenies.lha / DonsGenies / DonsGenies.lha / Don'sGenies / BoxesFrontToBack.pprx < prev    next >
Text File  |  1992-08-06  |  4KB  |  122 lines

  1. /* Boxes Front to Back
  2. Select boxes by name or number and rearrange them from front to back in order. Useful in complex layouts where there are several boxes on top of each other.
  3. You will be given a list of boxes, and asked to double-click on the names in order from front to back. You can click on Cancel at any time to finish the process. 
  4. Written by Don Cox © Aug 92   */
  5.  
  6. trace n
  7. signal on error
  8. signal on syntax
  9. call ppm_AutoUpdate(0)
  10. cr = "0a"x
  11.  
  12. address command
  13. call SafeEndEdit.rexx()
  14.  
  15. call ppm_ShowStatus("Making List of Boxes ...")
  16. thispage = ppm_CurrentPage()
  17. totalboxes = ppm_NumBoxes(thispage)
  18. list = ""
  19. numberlist = ""
  20. box = ppm_PageFirstBox(thispage)
  21. do i = 1 to totalboxes
  22.     number = right(ppm_BoxNum(box),3," ")
  23.     numberlist = numberlist" "number 
  24.     info = ppm_GetBoxInfo(box)
  25.     boxtype = word(info,1)
  26.     boxname = ppm_GetBoxName(box)
  27.     select
  28.         when upper(boxtype) = "TEXT" then do
  29.             boxtext = ppm_GetBoxText(box,0)
  30.             shorttext = substr(boxtext,1,15)
  31.             if boxname = "" then boxname = shorttext
  32.             end
  33.         when upper(boxtype) = "BITMAP" then do
  34.             filename = word(info,5)
  35.             filename = substr(filename, lastpos("/",filename)+1)
  36.             if boxname = "" then boxname = filename
  37.             end
  38.         when upper(boxtype) = "EPSF" then do
  39.             filename = word(info,3)
  40.             filename = substr(filename, lastpos("/",filename)+1)
  41.             if boxname = "" then boxname = filename
  42.             end
  43.         when upper(boxtype) = "CLIP" then do
  44.             objects = "Clip, "||word(info,2)||" objects"
  45.             if boxname = "" then boxname = objects
  46.             end
  47.         when upper(boxtype) = "STRUCTURED" then do
  48.             objects = "Struct., "||word(info,2)||" objects"
  49.             if word(info,2)=1 then objects = "Struct., 1 object"
  50.             if boxname = "" then boxname = objects
  51.             end
  52.         when upper(boxtype) = "EMPTY" then do
  53.             if boxname = "" then boxname = "Empty"
  54.             end
  55.         otherwise boxname = "Unknown type of box"
  56.     end
  57.     boxtype = substr(boxtype,1,1)
  58.     list = list||number" "boxname||cr
  59.     box = ppm_PageNextBox(box)
  60.     end
  61.  
  62. call ppm_ClearStatus()
  63. form = ""
  64. series = ""
  65.     box = ppm_SelectFromList("Double-click front box",34,18,0,list)
  66.     series = series||" "||word(box,1)
  67.     form = box||":1"||"0a"x
  68.  
  69. do i = 2 to totalboxes
  70.     box = ppm_SelectFromList("Double-click next box",34,18,0,list)
  71.     if box = "" then break
  72.     series = series||" "||word(box,1)
  73.     form = form||box":"||i||"0a"x
  74.     end
  75.  
  76. accept = ppm_GetForm("Is this OK?",3,form)
  77. if accept = "" then exit_msg("Aborted by user ")
  78.  
  79. newnumbers = numberlist
  80. numselected = words(series)
  81. do i=1 to numselected
  82.     this = word(series,i)
  83.     do w = 1 to words(numberlist)
  84.         that = word(numberlist,w)
  85.         chars = length(that)
  86.         pad = left("XXXXXX",chars)
  87.         pad = " "pad" "
  88.         position = wordindex(newnumbers,w)
  89.         if this = that then do
  90.             newnumbers = insert(pad,newnumbers,position)
  91.             newnumbers = delword(newnumbers,w,1)
  92.             leave w
  93.             end
  94.         end
  95.     end
  96. newnumbers = compress(newnumbers,"X")
  97.  
  98. series = series||" "||newnumbers /* stick the unselected boxes on the end of the list */
  99.  
  100. do until series = ""
  101.     parse var series box series
  102.     call ppm_BoxToBack(box)
  103.     end
  104.  
  105. exit_msg()
  106.  
  107. error:
  108. syntax:
  109.     do
  110.     exit_msg("Genie failed due to error: "errortext(rc))
  111.     end
  112.  
  113. exit_msg:
  114.     do
  115.     parse arg message
  116.     if message ~= "" then
  117.     call ppm_Inform(1,message,"Resume")
  118.     call ppm_ClearStatus()
  119.     call ppm_AutoUpdate(1)
  120.     exit
  121.     end
  122.