コード例 #1
0
ファイル: display.c プロジェクト: JakeSc/tig
void
redraw_display(bool clear)
{
    struct view *view;
    int i;

    foreach_displayed_view (view, i) {
        if (clear)
            wclear(view->win);
        redraw_view(view);
        update_view_title(view);
    }

    redraw_display_separator(clear);
}
コード例 #2
0
ファイル: display.c プロジェクト: JakeSc/tig
void
resize_display(void)
{
    int x, y, i;
    struct view *base = display[0];
    struct view *view = display[1] ? display[1] : display[0];
    bool vsplit;

    /* Setup window dimensions */

    getmaxyx(stdscr, base->height, base->width);

    /* Make room for the status window. */
    base->height -= 1;

    vsplit = vertical_split_is_enabled();

    if (view != base) {
        if (vsplit) {
            apply_vertical_split(base, view);

            /* Make room for the separator bar. */
            view->width -= 1;
        } else {
            apply_horizontal_split(base, view);
        }

        /* Make room for the title bar. */
        view->height -= 1;
    }

    string_format(opt_env_columns, "COLUMNS=%d", base->width);
    string_format(opt_env_lines, "LINES=%d", base->height);

    /* Make room for the title bar. */
    base->height -= 1;

    x = y = 0;

    foreach_displayed_view (view, i) {
        if (!display_win[i]) {
            display_win[i] = newwin(view->height, view->width, y, x);
            if (!display_win[i])
                die("Failed to create %s view", view->name);

            scrollok(display_win[i], FALSE);

            display_title[i] = newwin(1, view->width, y + view->height, x);
            if (!display_title[i])
                die("Failed to create title window");

        } else {
            wresize(display_win[i], view->height, view->width);
            mvwin(display_win[i], y, x);
            wresize(display_title[i], 1, view->width);
            mvwin(display_title[i], y + view->height, x);
        }

        if (i > 0 && vsplit) {
            if (!display_sep) {
                display_sep = newwin(view->height, 1, 0, x - 1);
                if (!display_sep)
                    die("Failed to create separator window");

            } else {
                wresize(display_sep, view->height, 1);
                mvwin(display_sep, 0, x - 1);
            }
        }

        view->win = display_win[i];
        view->title = display_title[i];

        if (vsplit)
            x += view->width + 1;
        else
            y += view->height + 1;
    }

    redraw_display_separator(FALSE);
}
コード例 #3
0
ファイル: display.c プロジェクト: noscripter/tig
void
resize_display(void)
{
	int x, y, i;
	int height, width;
	struct view *base = display[0];
	struct view *view = display[1] ? display[1] : display[0];
	bool vsplit;

	/* Setup window dimensions */

	getmaxyx(stdscr, height, width);

	/* Make room for the status window. */
	base->height = height - 1;
	base->width = width;

	vsplit = vertical_split_is_enabled(opt_vertical_split, height, width);

	if (view != base) {
		if (vsplit) {
			view->height = base->height;
			view->width = apply_vertical_split(base->width);
			base->width -= view->width;

			/* Make room for the separator bar. */
			view->width -= 1;

			create_or_move_display_separator(base->height, base->width);
			redraw_display_separator(false);
		} else {
			remove_display_separator();
			apply_horizontal_split(base, view);
		}

		/* Make room for the title bar. */
		view->height -= 1;

	} else {
		remove_display_separator();
	}

	/* Make room for the title bar. */
	base->height -= 1;

	x = y = 0;

	foreach_displayed_view (view, i) {
		if (!display_win[i]) {
			display_win[i] = newwin(view->height, view->width, y, x);
			if (!display_win[i])
				die("Failed to create %s view", view->name);

			scrollok(display_win[i], false);

			display_title[i] = newwin(1, view->width, y + view->height, x);
			if (!display_title[i])
				die("Failed to create title window");

		} else {
			wresize(display_win[i], view->height, view->width);
			mvwin(display_win[i], y, x);
			wresize(display_title[i], 1, view->width);
			mvwin(display_title[i], y + view->height, x);
		}

		view->win = display_win[i];
		view->title = display_title[i];

		if (vsplit)
			x += view->width + 1;
		else
			y += view->height + 1;
	}

	redraw_display_separator(false);
}