/* 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; }
/* if_layout: Update the layout of the screen based on current terminal size. * ---------- * * Return Value: Zero on success, -1 on failure. */ static int if_layout() { SWINDOW *gdb_scroller_win = NULL; SWINDOW *src_viewer_win = NULL; if (!curses_initialized) return -1; /* Verify the window size is reasonable */ validate_window_sizes(); /* Resize the source viewer window */ create_swindow(&src_viewer_win, get_src_height(), get_src_width(), get_src_row(), get_src_col()); if (src_viewer) { source_move(src_viewer, src_viewer_win); } else { src_viewer = source_new(src_viewer_win); } /* Resize the GDB I/O window */ create_swindow(&gdb_scroller_win, get_gdb_height(), get_gdb_width(), get_gdb_row(), get_gdb_col()); if (gdb_scroller) { scr_move(gdb_scroller, gdb_scroller_win); } else { gdb_scroller = scr_new(gdb_scroller_win); } /* Initialize the status bar window */ create_swindow(&status_win, get_src_status_height(), get_src_status_width(), get_src_status_row(), get_src_status_col()); /* Redraw the interface */ if_draw(); return 0; }
static int get_sep_col(void) { return get_src_col() + get_src_width(); }
static int get_src_status_width(void) { return get_src_width(); }