home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $VER: ReplaceGraphic.rexx 1.1a (4.10.96) Copyright 1996 SoftLogik Publishing Corporation May not be distributed without SoftLogik Publishing Corporation's express written permission */ OPTIONS RESULTS ADDRESS 'PAGESTREAM' call OPENLIBS() /* IS A BOX OR GRAPHIC SELECTED */ 'getobject type iOType' hOGraphic=result /* OBJECT TYPES: 12:picture, 5:box, 2:drawing, 13:eps */ if iOType=12 | iOType=5 | iOType=2 | iOType=13 then do 'refresh wait' if iOType=5 then getbox position aOPos rotation aORotate about aORotate constrain sConstrain print sPrint if iOType=12 then getpicture position aOPos rotation aORotate about aORotate contentoffset aOContent contentscale aOContent frame sFramed constrain sConstrain print sPrint if iOType=2 then getdrawing position aOPos rotation aORotate about aORotate contentoffset aOContent contentscale aOContent frame sFramed constrain sConstrain print sPrint if iOType=13 then geteps position aOPos rotation aORotate about aORotate contentoffset aOContent contentscale aOContent frame sFramed constrain sConstrain print sPrint gettextwrap region wmode wrap wtype standoff aOWrap objectid hOGraphic /* PLACE THE NEW OBJECT */ placegraphic status if rc~=0 then signal cancel 'getobject type iNType' hNGraphic=result /* IF CONSTRAINED, SCALE PROPORTIONALLY TO FIT */ if sConstrain=ON then do if iNType=12 then getpicture position aNPos if iNType=2 then getdrawing position aNPos if iNType=13 then geteps position aNPos dOWidth = aOPos.right - aOPos.left dOHeight = aOPos.bottom - aOPos.top dOAspect = dOWidth / dOHeight dNWidth = aNPos.right - aNPos.left dNHeight = aNPos.bottom - aNPos.top dNAspect = dNWidth / dNHeight if dOAspect > dNAspect then do aOContent.v=(dOHeight / dNHeight) * 100 aOContent.h=aOContent.v sFramed=ON end if dOAspect < dNAspect then do aOContent.h=(dOWidth / dNWidth) * 100 aOContent.v=aOContent.h sFramed=ON end end /* SET THE NEW OBJECT TO MATCH THE OLD OBJECT */ pstring=position' 'aOPos.left' 'aOPos.top' 'aOPos.right' 'aOPos.bottom' skew 'aORotate.slant' 'aORotate.twist if sFramed=ON then pstring=pstring' framed contentoffset 'aOContent.x' 'aOContent.y' contentscale 'aOContent.h' 'aOContent.v if aORotate.mode=POINT then pstring=pstring' about 'aORotate.x' 'aORotate.y if sConstrain=ON then pstring=pstring' constrain' if sPrint=OFF then pstring=pstring' noprint' if iNType=12 then 'editpicture 'pstring if iNType=2 then 'editdrawing 'pstring if iNType=13 then 'editeps 'pstring if wtype~=NOWRAP then settextwrap wmode wtype standoff aOWrap.x aOWrap.y /* DELETE THE OLD OBJECT */ deleteobject objectid hOGraphic selectobject objectid hNGraphic 'refresh continue' end else do allocarexxrequester '"Replace Graphic Error!"' 540 61 hAlertBox=result addarexxgadget hAlertBox EXIT 235 44 70 label "Exit" addarexxgadget hAlertBox TEXT 8 10 520 border none string "'A box or graphic must be selected to replace with a new graphic.'" addarexxgadget hAlertBox TEXT 8 22 520 border none string "'Select one box or graphic and choose Replace Graphic again.'" doarexxrequester hAlertBox freearexxrequester hAlertBox EXIT end EXIT CANCEL: selectobject objectid hOGraphic 'refresh continue' EXIT OPENLIBS: /* OPEN LIBRARIES */ IF ~SHOW('L','rexxsupport.library') THEN call addlib('rexxsupport.library',0,-30) IF ~SHOW('L','softlogik:libs/slarexxsupport.library') THEN call addlib("softlogik:libs/slarexxsupport.library", 0, -30) RETURN