Beispiel #1
0
/*
 * Delete a window.
 */
void
deletewin(struct ww *w)
{
	if (fgwin == w)
		fgwin = w->ww_back;
	wwdelete(w);
}
Beispiel #2
0
void
sizewin(struct ww *w, int nrow, int ncol)
{
	struct ww *back = w->ww_back;

	w->ww_alt.nr = w->ww_w.nr;
	w->ww_alt.nc = w->ww_w.nc;
	wwdelete(w);
	if (wwsize(w, nrow, ncol) < 0)
		error("Can't resize window: %s.", wwerror());
	wwadd(w, back);
	reframe();
}
Beispiel #3
0
/*
 * Window size.
 */
void
c_size(struct ww *w)
{
	int col, row;

	if (!terse)
		wwputs("New window size (lower right corner): ", cmdwin);
	col = MIN(w->ww_w.r, wwncol) - 1;
	row = MIN(w->ww_w.b, wwnrow) - 1;
	wwadd(boxwin, framewin->ww_back);
	for (;;) {
		wwbox(boxwin, w->ww_w.t - 1, w->ww_w.l - 1,
			row - w->ww_w.t + 3, col - w->ww_w.l + 3);
		wwsetcursor(row, col);
		while (wwpeekc() < 0)
			wwiomux();
		switch (getpos(&row, &col, w->ww_w.t, w->ww_w.l,
			wwnrow - 1, wwncol - 1)) {
		case 3:
			wwunbox(boxwin);
			wwdelete(boxwin);
			return;
		case 2:
			wwunbox(boxwin);
			break;
		case 1:
			wwunbox(boxwin);
		case 0:
			continue;
		}
		break;
	}
	wwdelete(boxwin);
	if (!terse)
		wwputc('\n', cmdwin);
	wwcurtowin(cmdwin);
	sizewin(w, row - w->ww_w.t + 1, col - w->ww_w.l + 1);
}
Beispiel #4
0
c_window()
{
    int col, row, xcol, xrow;
    int id;

    if ((id = findid()) < 0)
        return;
    if (!terse)
        wwputs("New window (upper left corner): ", cmdwin);
    col = 0;
    row = 1;
    wwadd(boxwin, framewin->ww_back);
    for (;;) {
        wwbox(boxwin, row - 1, col - 1, 3, 3);
        wwsetcursor(row, col);
        while (wwpeekc() < 0)
            wwiomux();
        switch (getpos(&row, &col, row > 1, 0,
                       wwnrow - 1, wwncol - 1)) {
        case 3:
            wwunbox(boxwin);
            wwdelete(boxwin);
            return;
        case 2:
            wwunbox(boxwin);
            break;
        case 1:
            wwunbox(boxwin);
        case 0:
            continue;
        }
        break;
    }
    if (!terse)
        wwputs("\nNew window (lower right corner): ", cmdwin);
    xcol = col;
    xrow = row;
    for (;;) {
        wwbox(boxwin, row - 1, col - 1,
              xrow - row + 3, xcol - col + 3);
        wwsetcursor(xrow, xcol);
        wwflush();
        while (wwpeekc() < 0)
            wwiomux();
        switch (getpos(&xrow, &xcol, row, col, wwnrow - 1, wwncol - 1))
        {
        case 3:
            wwunbox(boxwin);
            wwdelete(boxwin);
            return;
        case 2:
            wwunbox(boxwin);
            break;
        case 1:
            wwunbox(boxwin);
        case 0:
            continue;
        }
        break;
    }
    wwdelete(boxwin);
    if (!terse)
        wwputc('\n', cmdwin);
    wwcurtowin(cmdwin);
    (void) openwin(id, row, col, xrow-row+1, xcol-col+1, nbufline,
                   (char *) 0, 1, 1, shellfile, shell);
}