home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 July
/
AMIGA_1996_7.BIN
/
patches
/
pagestream
/
3.0cfupdate
/
macros.lha
/
RotateAboutPoint.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-20
|
6KB
|
179 lines
/* $VER: RotateAboutPoint.rexx 1.0 (02.9.94)
Copyright 1994 Soft-Logik Publishing Corporation
May not be distributed without Soft-Logik Publishing Corporation's express written permission */
OPTIONS RESULTS
TRACE OFF
ADDRESS 'PAGESTREAM'
/* Get the current rotation values and strip off the degree and measurement symbols */
getobject type objtype rotation rstem about astem
/* Are there any objects selected? If not, alert the user */
if rc>0 then do
allocarexxrequester '"RotateAboutPoint Alert"' 368 59
reqhandle=result
addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
Exithandle=result
addarexxgadget reqhandle TEXT 8 10 352 border none string "'There are no objects selected. Select one'"
addarexxgadget reqhandle TEXT 8 20 352 border none string "'or more objects and choose the macro again.'"
doarexxrequester reqhandle
freearexxrequester reqhandle
EXIT
end
/* if objects are locked, we don't want the actual lock requester opening */
/* 2 or more times, so let's simulate it and temporarily reset the lock */
/* status if required. */
getobjectlock
lockstatus=result
ignorehandle=1
lockaction=0
if lockstatus='ON' | lockstatus='UNKNOWN' then do
allocarexxrequester '"Locked"' 254 55
reqhandle=result
addarexxgadget reqhandle EXIT 172 38 70 label "_Cancel"
cancelhandle=result
addarexxgadget reqhandle EXIT 12 38 70 label "_Ignore"
ignorehandle=result
addarexxgadget reqhandle EXIT 92 38 70 label "_Unlock"
unlockhandle=result
addarexxgadget reqhandle TEXT 8 10 232 border none string "'A selected object is locked.'"
doarexxrequester reqhandle
lockaction=result
freearexxrequester reqhandle
/* If Cancel, then exit */
if lockaction=cancelhandle then do
exit
end
/* If Unlock, then unlock. If Ignore, temporarily unlock */
/* Note, this doesn't properly handle the situation of some objects being locked and others not. They'll all be locked at the end of this script. */
if lockaction=unlockhandle | lockaction=ignorehandle then unlock
end
rstem.slant=left(rstem.slant,length(rstem.slant)-1)
rstem.twist=left(rstem.twist,length(rstem.twist)-1)
astem.x=left(astem.x,length(astem.x)-1)||'"'
astem.y=left(astem.y,length(astem.y)-1)||'"'
/* PGS3 returns slant and twist. Reduce to rotate and remainder. */
aslant=abs(rstem.slant)
atwist=abs(rstem.twist)
if rstem.slant=rstem.twist then do
rstem.rotate=rstem.slant||'°'
rstem.slant='0°'
rstem.twist='0°'
end
else do
if aslant<atwist then do
rstem.rotate=rstem.slant||'°'
mult=rstem.slant*-1
end
else do
rstem.rotate=rstem.twist||'°'
mult=rstem.twist*-1
end
rstem.slant=rstem.slant+mult||'°'
rstem.twist=rstem.twist+mult||'°'
end
/* Allocate requester */
allocarexxrequester '"Rotate About Point"' 290 93
reqhandle=result
/* Allocate a list for the about cycle */
allocarexxlist
aboutlist=result
addarexxlist aboutlist 'Center'
addarexxlist aboutlist 'Point'
/* Add gadgets */
addarexxgadget reqhandle EXIT 12 76 70 label "_Ok"
Okhandle=result
addarexxgadget reqhandle EXIT 210 76 70 label "_Cancel"
Cancelhandle=result
addarexxgadget reqhandle TEXT 8 8 128 highdata true border none string "'Rotation Amount'"
addarexxgadget reqhandle STRING 12 22 122 label "_Rotate" string rstem.rotate
rotatehandle=result
addarexxgadget reqhandle STRING 20 36 114 label "_Slant" string rstem.slant
slanthandle=result
addarexxgadget reqhandle STRING 20 50 114 label "_Twist" string rstem.twist
twisthandle=result
addarexxgadget reqhandle TEXT 146 8 120 highdata true border none string "'Rotation Point'"
addarexxgadget reqhandle CYCLE 150 22 130 label '"_About"' list aboutlist current 0
abouthandle=result
if astem.mode='POINT' then do
setarexxgadget reqhandle abouthandle current 1
addarexxgadget reqhandle STRING 158 36 106 label "_Horz" string astem.x
horzhandle=result
addarexxgadget reqhandle STRING 158 50 106 label "_Vert" string astem.y
verthandle=result
end
else do
setarexxgadget reqhandle abouthandle current 0
addarexxgadget reqhandle STRING 158 36 106 label "_Horz"
horzhandle=result
addarexxgadget reqhandle STRING 158 50 106 label "_Vert"
verthandle=result
end
/* Show requester */
doarexxrequester reqhandle
action=result
/* If Cancel, then exit */
if action=CancelHandle then signal cancel
/* If Rotate, then rotate it and exit */
/* Get gadget status */
getarexxgadget reqhandle rotatehandle string
rot=result
if lastpos('°',rot)~=0 then rot=left(rot,lastpos('°',rot)-1)
getarexxgadget reqhandle slanthandle string
sla=result
if lastpos('°',sla)~=0 then sla=left(sla,lastpos('°',sla)-1)
getarexxgadget reqhandle twisthandle string
twi=result
if lastpos('°',twi)~=0 then twi=left(twi,lastpos('°',twi)-1)
getarexxgadget reqhandle horzhandle string
horz=result
getarexxgadget reqhandle verthandle string
vert=result
if rot="" then rot=0
if sla="" then sla=0
if twi="" then twi=0
if horz="" then horz astem.horz
if vert="" then vert astem.vert
/* Determine if the rotation point was changed from center, then set rotation point */
if right(horz,1)='"' | right(horz,1)=i then horz=left(horz,length(horz)-1)
if left(horz,1)='"' | left(horz,1)=i then vert=left(vert,length(vert)-1)
astem.x=left(astem.x,length(astem.x)-1)
astem.y=left(astem.y,length(astem.y)-1)
refresh wait
getarexxgadget reqhandle abouthandle current
if result=0 then do
editobject aboutcenter
end
else do
editobject about horz vert
end
sla=sla+rot
twi=twi+rot
/* rotate the selected objects */
editobject skew sla twi
if lockaction=ignorehandle then lock
refresh continue
/* clean up and exit */
CANCEL:
freearexxrequester reqhandle
freearexxlist aboutlist
exit
return 0