View Raw SPL
#include 


setally(win, yb, yt)
{
        local winnum, f, i;

        /* parse args */
        (winnum, yb, yt) = setally_args(win, yb, yt);

        /* window number returned - convert to window */
        win = castwindow(winnum);

        /* current focus */
        f = getfocus(win);

        /* number of overlays */
        nfoc = getfocus(win, -1);

        /* loop through overlays setting Y range */
        loop (i = 1..nfoc)
        {
                focus(win, i);
                sety(win, yb, yt);
        }

        /* restore focus */
        focus(win, f);
}


/* get args for setally */
setally_args(win, yb, yt)
{
        local winnum;

        switch (argc)
        {
                case 0:
                        win = refwindow(w0);
                        yb = getyb(w0);
                        yt = getyt(w0);
                        break;

                case 1:
                        if (iswindow(win))
                        {
                                yb = getyb(win);
                                yt = getyt(win);
                        }
                        else
                        {
                                error("setally - window required");
                        }
                        break;
                
                case 2:
                        if (iswindow(win))
                        {
                                yt = getyt(win);
                        }
                        else
                        {
                                yt = yb;
                                yb = win;
                                win = refwindow(w0);
                        }
                        break;

                default:
                        break;
        }

        /* convert to window number */
        winnum = getwnum(win);

        return(winnum, yb, yt);
}