home *** CD-ROM | disk | FTP | other *** search
- /* This Genie centres the boxes on the page, from left to right only (not top-to-bottom).
- Written by Don Cox Aug 92 Copyright but freely usable for non-commercial purposes */
-
- trace n
- signal on error
- signal on syntax
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
- cr="0a"x
-
- cpage = ppm_CurrentPage()
- counter=0
-
- choice = ppm_Inform(2,"Which boxes?","All on page","Click to select")
-
- select
- when choice = 1 then do
- do forever
- box=ppm_ClickOnBox(" Click on boxes to be repositioned")
- if box=0 then break
- counter=counter+1
- boxes.counter=box
- call ppm_SelectBox(box)
- end
- end
-
- when choice = 0 then do
- boxes.1 = ppm_PageFirstBox()
- box = boxes.1
- totalboxes = ppm_NumBoxes(cpage)
- counter = totalboxes
- do i=2 to totalboxes
- box = ppm_PageNextBox(box)
- boxes.i = box
- end
- end
-
- otherwise exit_msg()
- end
-
- if counter=0 then exit_msg("No boxes selected")
- currentunits=ppm_GetUnits()
- call ppm_SetUnits(2)
-
- pagewidth = word(ppm_GetPageSize(),1)
-
- call ppm_ShowStatus(" Centring boxes...")
- do i=1 to counter
- box=boxes.i
-
- Ypos = word(ppm_GetBoxPosition(box),2)
- width = word(ppm_GetBoxSize(box),1)
- Xpos = (pagewidth-width)/2
- call ppm_SetBoxPosition(box,Xpos,Ypos)
-
- end
-
- call ppm_SetUnits(currentunits)
-
- 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,"Resume")
- call ppm_ClearStatus()
- call ppm_AutoUpdate(1)
- exit
- end
-