home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Bonus
/
WSTAR2
/
DISK4
/
WIDOWCTL.WM_
/
WIDOWCTL.bin
Wrap
Text File
|
1994-02-28
|
12KB
|
153 lines
REM Description: Widow control on/off
REM Filename: widowctl.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 Change this value to 0 to make the change globally
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)
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
REM Use the first paragraph to figure out whether Widow control should be turned on or off. Then perform
REM the same operation on the entire selection.
GetStyleParagraph first%, left%, right%, above%, below%, align%, location%, span%, hyphen%, numHyph%, keep%, allowBreak%, widow%
REM Toggle the setting of the first paragraph.
if widow% = 1 then
widow% = 0
else
widow% = 1
endif
FOR i% = 1 TO numParagraphs%
REM Get the style information
currStyle$ = GetStyle$()
REM Redefine the style with the new widow setting
DefineStyle currStyle$, local%
DefineStyleParagraph , , , , , , , , , , , , widow%
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.