home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 58
/
af058b.adf
/
PV21.lha
/
REXX
/
Center.pvrx
< prev
next >
Wrap
Text File
|
1991-09-21
|
1KB
|
49 lines
/* Center.pvrx---This macro will get the coordinates of the center of the
bounding box of all selected objects, and move those objects so
that the new coordinates for the center of the bounding box are the
CENTER OF THE PAGE.
Copyright © 1989 by Taliesin, Inc.
Author: Jeff Blume & Ross Cunniff
Usage: Assign to Ctrl-Key or RX tool
The macro expects to find at least one selected object. */
address "ProVector"
options results
/* Try to get exclusive lock on project window.
If can't get lock, not polite to interrupt. */
'Lock'
if rc ~= 0 then exit
/* Get coords of bounding box center */
'SelExtent' Ext
if RC ~= 0 then call ERROR "No object selected!"
CX = (Ext.X1 + Ext.X2) / 2
CY = (Ext.Y1 + Ext.Y2) / 2
'GetPageSize' Pdims
CPX = (Pdims.X2 + Pdims.X1) / 2
CPY = (Pdims.Y2 + Pdims.Y1) / 2
MX = (CPX - CX); MY = (CPY - CY) /* Move X Y (distance from center) */
'SelectList' Sel; SelN = Result
'PushUndo'
do i = 0 to SelN-1
'Move' Sel.i MX MY
end
'Repair'
ERROR:
arg ErrTxt
if RC ~= 0 | ErrTxt ~= "" then do
'GetBool ErrTxt "Cancel" "Cancel"'
end
'UnLock'
exit
/* This page size is a problem - 3,2,7,6 */