Example #1
0
/* if_layout: Update the layout of the screen based on current terminal size.
 * ----------
 *
 * Return Value: Zero on success, non-zero on failure.
 */
static int if_layout()
{
    /* Verify the window size is reasonable */
    validate_window_sizes();

    /* Initialize the GDB I/O window */
    if (gdb_win == NULL) {
        gdb_win =
                scr_new(get_gdb_row(), get_gdb_col(), get_gdb_height(),
                get_gdb_width());
        if (gdb_win == NULL)
            return 2;
    } else {                    /* Resize the GDB I/O window */
        if (get_gdb_height() > 0)
            scr_move(gdb_win, get_gdb_row(), get_gdb_col(), get_gdb_height(),
                    get_gdb_width());
    }

    /* Initialize TTY I/O window */
    if (tty_win == NULL) {
        tty_win =
                scr_new(get_tty_row(), get_tty_col(), get_tty_height(),
                get_tty_width());
        if (tty_win == NULL)
            return 2;
    } else {                    /* Resize the GDB I/O window */
        if (get_tty_height() > 0)
            scr_move(tty_win, get_tty_row(), get_tty_col(), get_tty_height(),
                    get_tty_width());
    }

    /* Initialize the source viewer window */
    if (src_win == NULL) {
        src_win =
                source_new(get_src_row(), get_src_col(), get_src_height(),
                get_src_width());
        if (src_win == NULL)
            return 3;
    } else {                    /* Resize the source viewer window */
        if (get_src_height() > 0)
            source_move(src_win, get_src_row(), get_src_col(),
                    get_src_height(), get_src_width());
    }

    /* Initialize the status bar window */
    status_win = newwin(get_src_status_height(), get_src_status_width(),
            get_src_status_row(), get_src_status_col());

    /* Initialize the tty status bar window */
    if (tty_win_on)
        tty_status_win =
                newwin(get_tty_status_height(), get_tty_status_width(),
                get_tty_status_row(), get_tty_status_col());

    if_draw();

    return 0;
}
Example #2
0
static int get_tty_status_width(void)
{
    return get_tty_width();
}