home *** CD-ROM | disk | FTP | other *** search
- REM Description: Change paragraph(s) to single spacing
- REM Filename: sglspace.wmc
- REM Created by: Steve Wylie - 11/08/93
-
- REM Can't run if no document open
- IF GetDocName$() = "" THEN
- MESSAGE "Please create a new document or open an existing document first."
- STOP
- ENDIF
-
- REM Can't run in a graphic or table frame
- frameType% = GetFrameType()
- IF frameType% <> 0 THEN
- Message "The current frame must be a text frame."
- STOP
- ENDIF
-
- REM Can't run in frame mode
- ret% = ViewEditMode(1)
- IF ret% = 2 THEN
- ret% = ViewEditMode(2)
- BEEP
- STOP
- ENDIF
-
- REM Changed local% to 0 if you want the change to apply globally to the paragraph style.
- local% = 1
-
- REM Save the beginning and end of the selection
- yes% = GetTextOffset(strt%, end%)
- IF strt% = 0 THEN strt% = 4
-
- REM Freeze the screen so that the activity isn't visible
- freeze% = ViewFreezeScreen(1)
-
- REM Count the number of paragraphs
- EditGotoOffset strt%,
- DO
- ret% = GetTextOffset(savestart%, saveend%)
- ParaDown 1,
- ret% = GetTextOffset(start2%, end2%)
- numParagraphs% = numParagraphs% + 1
- LOOP UNTIL end2% >= end% OR end2% = saveend%
-
- REM Go to the beginning of the selection
- EditGotoOffset strt%, 0
-
- FOR i% = 1 TO numParagraphs%
- REM Get the style information
- GetStyleFont typeFace$, size%, lineHeight%, bold%, italic%, underline%, strikeout%, hidden%, placeUnderline%, strikeoutChar$
-
- REM Set the line height to 120% of the font size. Change the number from 240
- REM to a different value to change the default line height.
- lineHeight% = (size% * 120) / 100
-
- REM Redefine the style with the new line height.
- DefineStyle , local%
- DefineStyleFont , , lineHeight%, , , , , , ,
- EndDefineStyle 1
-
- REM Go to the next paragraph.
- ParaDown 1,0
- IF GetNextChar$(1) <> "<Cr>" THEN CharRight 1,0,
- NEXT i%
-
- REM Restore the selection
- EditGotoOffset strt%, 0
- if yes%=1 then EditGotoOffset end%, 1
-
- REM Restore the screen
- freeze% = ViewFreezeScreen(freeze%)
-
- ***** WARNING *****
- This is a WSWin macro file.
- Subsequent data is binary information and should not be modified.