home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 3
/
Merciful_Release_3.bin
/
software
/
b
/
blacksedv1.0.lha
/
BED
/
Rexx
/
OrganizeWindows.bed
< prev
next >
Wrap
Text File
|
1996-01-28
|
3KB
|
166 lines
/*
** $VER: OrganizeWindows.bed 1.0 (02.01.96)
**
** Organizes all the windows on the screen as follows:
**
** STACK
** Puts the windows in horizontal slices, stacked vertically on the
** screen
**
** CASCADE
** Puts the windows in a cascade, one top of the other. All title bars
** then become visible.
**
** TILE
** Puts all windows in a 2D tile pattern.
**
** ICONIFY
** Iconifies all windows, and aligns them on the left side of the screen.
*/
OPTIONS RESULTS
OPTIONS FAILAT 11
PARSE ARG style
IF style ~= "" THEN DO
style = UPPER(style)
GetScreenInfo
PARSE VAR RESULT . . screenwidth screenheight . . . '"'screenname'"'
GetDocuments
docs = RESULT
GetPort
originalport = RESULT
numicons = 0
iconheight = 0
n=0
DO WHILE docs ~= ""
PARSE VAR docs '"'names.n'"' ports.n docs
ADDRESS VALUE ports.n
icons.n = FALSE
GetWindowInfo
IF WORD(RESULT,1) = "ON" THEN DO
icons.n = TRUE;
numicons = numicons + 1
iconheight = WORD(RESULT,5)
END
n = n+1
END
availheight = (screenheight - (numicons * iconheight))
numfull = n - numicons
IF numfull = 0 THEN DO
style = 'ICONIFY'
END
IF style = 'STACK' THEN DO
h = availheight % numfull
w = 0
y=0
DO i=0 TO n-1
IF icons.i = FALSE THEN DO
w = w + 1
IF (w = numfull) THEN DO
h = h + (availheight // numfull)
END
ADDRESS VALUE ports.i
MoveSizeWindow 0 y screenwidth h
Window2Front
y = y + h
END
END
END
IF style = 'CASCADE' THEN DO
h = availheight
y = 0
IF iconheight = 0 THEN iconheight = 15
DO i=0 TO n-1
ADDRESS VALUE ports.i
IF icons.i = FALSE THEN DO
MoveSizeWindow 0 y screenwidth h
Window2Front
h = h - iconheight
y = y + iconheight
END
END
END
IF style = 'ICONIFY' THEN DO
y = 0
DO i=0 TO n-1
ADDRESS VALUE ports.i
IconifyWindow ON
GetWindowInfo
h = WORD(RESULT,5)
y = y + h + 1
MoveSizeWindow 0 y
END
END
IF style = 'TILE' THEN DO
DO i=2 TO 100
IF i*i > numfull THEN LEAVE
END
i = i-1
numw = i
numh = i
extras = numfull - (i*i)
IF extras > numh THEN DO
numh = numh + 1
extras = extras - numw
END
extras = - (numh - extras)
win = 0
wininrow = numw + (extras >= 0)
wwidth = screenwidth % wininrow
wheight = availheight % numh
x = 0
y = 0
row = 0
DO i=0 TO n-1
IF icons.i = FALSE THEN DO
win = win + 1
row = row + 1
ADDRESS VALUE ports.i
IF row // wininrow = 0 THEN DO
MoveSizeWindow x y (screenwidth - x) wheight
x = 0
y = y + wheight
extras = extras + 1
wininrow = numw + (extras >= 0)
wwidth = screenwidth % wininrow
row = 0
IF win + wininrow = numfull THEN wheight = availheight - y
END; ELSE DO
MoveSizeWindow x y wwidth wheight
x = x + wwidth
END
Window2Front
END
END
END
END