Well, I have a script for a layout. The status window gets 200px vertically in the 1st column; the "@dev" window, a combined window I use, gets the rest. The 1st column has 1.1 times the width of the channels column if there's only one channels column, and 1.2 times the width (of each) if there's more than one. The case with 0 chans appears to work, but may cause a silent error. Only the chan windows in the 'normal' state are counted. The formula for assigning chans per column is hard-coded for only 3 rows.
The code is not polished. 'echo' statements are commented. You're invited to take a look. I'd welcome suggestions on trimming down lines, or generalizing the 'chans per column' formula. Also, someone suggested executing the command at short (0.1 sec) intervals instead of executing it when you exchange which windows are open (not minimized), or resize the master window.
Regarding the usefulness, communication is important, and layout is important to effective information display. That much goes unsaid often, and "the literature" on information display is scant, especially effective digital display, not to mention interface controls additionally. One example I was introduced to is:
http://www.edwardtufte.com/tufte/http://en.wikipedia.org/wiki/Edward_TufteNotably, Tufte is critical of MS PowerPoint, which I agree with.
alias layout {
var %numrows = 3
var %numchans = 0
var %j = 1
while (%j <= $chan(0)) {
if ($window($chan(%j)).state == normal) {
inc %numchans
}
inc %j
}
var %numcols = $ceil($calc(%numchans / %numrows))
var %col0prop = $iif(%numcols > 1, 1.2, 1.1)
var %col0px = $int($calc(%col0prop * $window(-3).w / (%numcols + 1)))
window "status window" 0 0 %col0px 300
var %x = $window(-3).h - $window(status window).h
%x = %x - 2
window @dev 0 $window(status window).h %col0px %x
var %colNpx = $int($calc(($window(-3).w - %col0px) / %numcols))
;echo -s %numchans %numcols %numrows $window(-3).w %col0px %colNpx
%x = %col0px
var %yI = 0, %xI = 0
var %chanN = 0
var %h0, %h, %y
%j = 0
while (%chanN < $chan(0)) {
inc %chanN
;echo -s $chan(%chanN) $window($chan(%chanN)) $window($chan(%chanN)).state
if ($window($chan(%chanN)).state == normal) {
%h0 = $calc( (%numrows - (%numchans % %numrows)) % %numrows)
;echo -s %h0
%h0 = $iif(%xI < %h0, %numrows - 1, %numrows)
if (%numchans < %numrows) {
%h0 = %numchans
}
;echo -s %h0 $window(-3).h $calc($window(-3).h / 3)
%h = $int($calc($window(-3).h / %h0))
%x = $calc(%col0px + %xI * %colNpx)
%y = %yI * %h
window $window($chan(%chanN)) %x %y %colNpx %h
;echo -s %yI %h0 %h %col0px %xI %colNpx $window($chan(%chanN)) %x %y %colNpx %h
inc %yI
inc %j
if (%yI >= %h0) {
inc %xI
%yI = 0
}
}
}
;echo -s _
}
Regarding the 'chans per column' formula, I tabulated the results I would expect. It's somewhat mysterious. I don't know how the app does it, or what other ways there might be.
3 4 5
1 1 1 1
2 2 2 2
3 3 3 3
4 22 4 4
5 23 23 5
6 33 33 33
7 223 34 34
8 233 44 44
9 333 333 45
10 2233 334 55
11 2333 344 344
12 3333 444 444
13 22333 3334 445
14 23333 3344 455
15 33333 3444 555
16 223333 4444 4444
17 233333 33344 4445
18 333333 33444 4455
19 2233333 34444 4555
20 2333333 44444 5555
21 3333333 333444 44445
22 22333333 334444 44455