home *** CD-ROM | disk | FTP | other *** search
- /* $VER: AutomaticTextFrame.rexx 1.1 (14.09.99)
- Copyright 1995 Soft-Logik Publishing Corporation
- May not be distributed without Soft-Logik Publishing Corporation's express written permission */
-
- OPTIONS RESULTS
- ADDRESS 'PAGESTREAM'
-
- /* Two arguments are accepted:
- DEFAULT: creates a default size text frame on the next page
- SAME: creates an identical size text frame on the next page
- If no argument is given, SAME is assumed */
-
- arg sMode .
-
- /* MAIN LOOP */
- call OPENLIBS()
-
- call VERIFYFRAME() /* check and see if a text frame is selected */
- call GETFRAMEINFO() /* get info on the current frame */
-
- 'refresh wait'
- display page iCurrentPage+1
-
- if sMode = DEFAULT then do /* DEFAULT */
- 'createcolumns default page 'iCurrentPage+1
- hFrameNew=result
- end
- else do /* SAME */
- sCoord=sPos.left' 'sPos.top' 'sPos.right' 'sPos.bottom' skew 'sPos.slant' 'sPos.twist' columns 'number' gutter 'space
- if sPos.mode=POINT then sCoord=sCoord' about 'sPos.x' 'sPos.y
- 'drawcolumn 'sCoord
- hFrameNew=result
- end
-
- if cflag=ON then 'editobject constrain'
- if pflag=OFF then 'editobject noprint'
-
- /* LINK THE FRAMES */
- 'settextrouting from objectid 'hFrameCurrent' to objectid 'hFrameNew
- 'refresh continue'
-
- EXIT
-
- VERIFYFRAME:
- /* CHECK AND SEE IF A TEXT FRAME IS SELECTED */
- 'getcursor type objtype'
- if RC>0 | objtype='TEXTOBJ' then do
- call doalert('The insertion point must be in a text frame to use this macro.')
- EXIT
- end
- RETURN
-
- GETFRAMEINFO:
- /* GET INFO ON THE CURRENT FRAME */
-
- /* FIND HOW MANY FRAMES ARE IN THE ARTICLE, AND THE CURRENT FRAME'S ID */
- 'getcursor framestart iFrameSelect'
- 'getarticle frames aFrames'
- iFrameCount=aFrames.count-1
- iFrameSelect=iFrameSelect
- hFrameCurrent=aFrames.iFrameSelect
- iFrameLast=aFrames.iFrameCount
-
- /* CHECK THAT THERE ARE NO LINKED FRAMES AFTER THE CURRENT FRAME */
- if hFrameCurrent~=iFrameLast then do
- call doalert('There are linked text frames after the current one!.')
- EXIT
- end
-
- /* GET THE CURRENT PAGE # */
- 'currentpage'
- iCurrentPage = result
-
- /* GET INFO ON THE CURRENT FRAME */
- getcolumn position sPos columns number gutter space rotation sPos about sPos constrain cflag print pflag
-
- RETURN
-
- 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
-
- DOALERT:
- parse arg sAlertText
- iAlertLength=length(sAlertText)
- /* Display an alert requester */
- allocarexxrequester '"Macro Alert"' iAlertLength*8+24 55
- hAlertReq=result
- addarexxgadget hAlertReq TEXT 8 12 iAlertLength*8+8 border none string '"'sAlertText'"'
- addarexxgadget hAlertReq EXIT iALertLength*8-58 38 70 label "_Exit"
- doarexxrequester hAlertReq
- freearexxrequester hAlertReq
- RETURN
-