+2019-06-25 Tom Tromey <tom@tromey.com>
+
+ * tui/tui.c (tui_rl_other_window, tui_enable)
+ (tui_is_window_visible, tui_get_command_dimension): Update.
+ * tui/tui-winsource.c (tui_update_source_window_as_is)
+ (tui_clear_source_content, tui_erase_source_content)
+ (tui_show_source_line, tui_source_window_base::refill)
+ (tui_source_window_base::do_scroll_horizontal)
+ (tui_source_window_base::set_is_exec_point_at)
+ (tui_update_breakpoint_info, tui_set_exec_info_content)
+ (tui_alloc_source_buffer, tui_line_is_displayed)
+ (tui_addr_is_displayed): Update.
+ * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
+ (tui_check_and_display_highlight_if_needed)
+ (tui_win_info::make_visible, tui_win_info::refresh)
+ (tui_refresh_all): Update.
+ * tui/tui-windata.c (tui_first_data_item_displayed)
+ (tui_delete_data_content_windows, tui_erase_data_content)
+ (tui_display_all_data, tui_data_window::refresh_all)
+ (tui_check_data_values): Update.
+ * tui/tui-win.c (window_name_completer, tui_update_gdb_sizes)
+ (tui_set_win_focus_to, tui_win_info::forward_scroll)
+ (tui_win_info::backward_scroll, tui_refresh_all_win)
+ (tui_resize_all, tui_set_focus, tui_all_windows_info)
+ (update_tab_width, tui_set_win_height, tui_adjust_win_heights)
+ (tui_source_window_base::set_new_height)
+ (tui_data_window::set_new_height)
+ (make_invisible_and_set_new_height)
+ (make_visible_with_new_height, new_height_ok)
+ (parse_scrolling_args): Update.
+ * tui/tui-stack.c (tui_show_frame_info): Update.
+ * tui/tui-source.c (tui_set_source_content)
+ (tui_set_source_content_nil, tui_source_is_displayed)
+ (tui_source_window::do_scroll_vertical): Update.
+ * tui/tui-regs.c (tui_show_registers, tui_show_register_group)
+ (tui_display_registers_from, tui_display_reg_element_at_line)
+ (tui_check_register_values, tui_reg_command): Update.
+ * tui/tui-layout.c (tui_default_win_height)
+ (show_source_disasm_command, show_data, init_and_make_win)
+ (show_source_or_disasm_and_command): Update.
+ * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts)
+ (tui_redisplay_readline, tui_mld_flush)
+ (tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig)
+ (tui_getc): Update.
+ * tui/tui-disasm.c (tui_set_disassem_content)
+ (tui_disasm_window::do_scroll_vertical): Update.
+ * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>:
+ Now virtual.
+ (struct tui_win_info): Derive from tui_gen_win_info.
+ <~tui_win_info>: Mark as override.
+ <generic>: Remove member.
+ * tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win)
+ (tui_prev_win, tui_partial_win_by_name, tui_win_info)
+ (~tui_data_window, ~tui_win_info)
+ (tui_free_all_source_wins_content): Update.
+ * tui/tui-command.c (tui_refresh_cmd_win): Update.
+
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-layout.c (init_and_make_win): Use new.
void
tui_refresh_cmd_win (void)
{
- WINDOW *w = TUI_CMD_WIN->generic.handle;
+ WINDOW *w = TUI_CMD_WIN->handle;
wrefresh (w);
void
tui_cmd_window::clear_detail ()
{
- wmove (generic.handle, 0, 0);
+ wmove (handle, 0, 0);
}
/* See tui-data.h. */
struct tui_win_info *
tui_next_win (struct tui_win_info *cur_win)
{
- int type = cur_win->generic.type;
+ int type = cur_win->type;
struct tui_win_info *next_win = NULL;
- if (cur_win->generic.type == CMD_WIN)
+ if (cur_win->type == CMD_WIN)
type = SRC_WIN;
else
- type = cur_win->generic.type + 1;
- while (type != cur_win->generic.type && (next_win == NULL))
+ type = cur_win->type + 1;
+ while (type != cur_win->type && (next_win == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
+ && tui_win_list[type]->is_visible)
next_win = tui_win_list[type];
else
{
struct tui_win_info *
tui_prev_win (struct tui_win_info *cur_win)
{
- int type = cur_win->generic.type;
+ int type = cur_win->type;
struct tui_win_info *prev = NULL;
- if (cur_win->generic.type == SRC_WIN)
+ if (cur_win->type == SRC_WIN)
type = CMD_WIN;
else
- type = cur_win->generic.type - 1;
- while (type != cur_win->generic.type && (prev == NULL))
+ type = cur_win->type - 1;
+ while (type != cur_win->type && (prev == NULL))
{
if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
+ && tui_win_list[type]->is_visible)
prev = tui_win_list[type];
else
{
{
if (tui_win_list[i] != 0)
{
- const char *cur_name =
- tui_win_name (&tui_win_list[i]->generic);
+ const char *cur_name = tui_win_name (tui_win_list[i]);
if (strlen (name) <= strlen (cur_name)
&& startswith (cur_name, name))
}
tui_win_info::tui_win_info (enum tui_win_type type)
- : generic (type)
+ : tui_gen_win_info (type)
{
}
tui_data_window::~tui_data_window ()
{
- if (generic.content != NULL)
+ if (content != NULL)
{
tui_free_data_content (regs_content, regs_content_count);
regs_content = NULL;
data_content_count = 0;
regs_column_count = 1;
display_regs = false;
- generic.content = NULL;
- generic.content_size = 0;
+ content = NULL;
+ content_size = 0;
}
}
tui_win_info::~tui_win_info ()
{
- if (generic.handle != NULL)
+ if (handle != NULL)
{
- tui_delete_win (generic.handle);
- generic.handle = NULL;
- tui_free_win_content (&generic);
+ tui_delete_win (handle);
+ handle = NULL;
+ tui_free_win_content (this);
}
- if (generic.title)
- xfree (generic.title);
+ if (title)
+ xfree (title);
}
{
for (tui_source_window_base *win_info : tui_source_windows ())
{
- tui_free_win_content (&(win_info->generic));
+ tui_free_win_content (win_info);
tui_free_win_content (win_info->execution_info);
}
}
{
}
- ~tui_gen_win_info ()
+ virtual ~tui_gen_win_info ()
{
}
};
/* This defines information about each logical window. */
-struct tui_win_info
+struct tui_win_info : public tui_gen_win_info
{
protected:
public:
- virtual ~tui_win_info ();
+ ~tui_win_info () override;
/* Clear the pertinent detail in the window. */
virtual void clear_detail () = 0;
void left_scroll (int num_to_scroll);
void right_scroll (int num_to_scroll);
- struct tui_gen_win_info generic; /* General window information. */
-
/* Can this window ever be highlighted? */
bool can_highlight = false;
cur_pc = locator->content[0]->which_element.locator.addr;
/* Window size, excluding highlight box. */
- max_lines = TUI_DISASM_WIN->generic.height - 2;
- line_width = TUI_DISASM_WIN->generic.width - 2;
+ max_lines = TUI_DISASM_WIN->height - 2;
+ line_width = TUI_DISASM_WIN->width - 2;
/* Get temporary table that will hold all strings (addr & insn). */
asm_lines = XALLOCAVEC (struct tui_asm_line, max_lines);
struct tui_source_element *src;
int cur_len;
- element = TUI_DISASM_WIN->generic.content[i];
+ element = TUI_DISASM_WIN->content[i];
src = &element->which_element.source;
strcpy (line, asm_lines[i].addr_string);
cur_len = strlen (line);
xfree (asm_lines[i].addr_string);
xfree (asm_lines[i].insn);
}
- TUI_DISASM_WIN->generic.content_size = i;
+ TUI_DISASM_WIN->content_size = i;
return TUI_SUCCESS;
}
tui_disasm_window::do_scroll_vertical
(enum tui_scroll_direction scroll_direction, int num_to_scroll)
{
- if (generic.content != NULL)
+ if (content != NULL)
{
CORE_ADDR pc;
- tui_win_content content;
struct tui_line_or_address val;
int dir;
- content = generic.content;
-
pc = content[0]->which_element.source.line_or_addr.u.addr;
num_to_scroll++;
dir = (scroll_direction == FORWARD_SCROLL)
update_cmdwin_start_line ()
{
TUI_CMD_WIN->start_line
- = getcury (TUI_CMD_WIN->generic.handle);
+ = getcury (TUI_CMD_WIN->handle);
}
/* Print a character in the curses command window. The output is
static void
tui_putc (char c)
{
- WINDOW *w = TUI_CMD_WIN->generic.handle;
+ WINDOW *w = TUI_CMD_WIN->handle;
do_tui_putc (w, c);
update_cmdwin_start_line ();
tui_puts (const char *string, WINDOW *w)
{
if (w == nullptr)
- w = TUI_CMD_WIN->generic.handle;
+ w = TUI_CMD_WIN->handle;
tui_puts_internal (w, string, nullptr);
}
c_pos = -1;
c_line = -1;
- w = TUI_CMD_WIN->generic.handle;
+ w = TUI_CMD_WIN->handle;
start_line = TUI_CMD_WIN->start_line;
wmove (w, start_line, 0);
prev_col = 0;
height = 1;
if (prompt != nullptr)
- tui_puts_internal (TUI_CMD_WIN->generic.handle, prompt, &height);
+ tui_puts_internal (TUI_CMD_WIN->handle, prompt, &height);
prev_col = getcurx (w);
for (in = 0; in <= rl_end; in++)
static void
tui_mld_flush (const struct match_list_displayer *displayer)
{
- wrefresh (TUI_CMD_WIN->generic.handle);
+ wrefresh (TUI_CMD_WIN->handle);
}
/* TUI version of displayer.erase_entire_line. */
static void
tui_mld_erase_entire_line (const struct match_list_displayer *displayer)
{
- WINDOW *w = TUI_CMD_WIN->generic.handle;
+ WINDOW *w = TUI_CMD_WIN->handle;
int cur_y = getcury (w);
wmove (w, cur_y, 0);
static int
tui_mld_getc (FILE *fp)
{
- WINDOW *w = TUI_CMD_WIN->generic.handle;
+ WINDOW *w = TUI_CMD_WIN->handle;
int c = gdb_wgetch (w);
return c;
/* Force a refresh of the screen. */
tui_refresh_all_win ();
- wrefresh (TUI_CMD_WIN->generic.handle);
+ wrefresh (TUI_CMD_WIN->handle);
}
signal (sig, tui_cont_sig);
}
int ch;
WINDOW *w;
- w = TUI_CMD_WIN->generic.handle;
+ w = TUI_CMD_WIN->handle;
#ifdef TUI_USE_PIPE_FOR_READLINE
/* Flush readline output. */
int px, py;
getyx (w, py, px);
px += rl_end - rl_point;
- py += px / TUI_CMD_WIN->generic.width;
- px %= TUI_CMD_WIN->generic.width;
+ py += px / TUI_CMD_WIN->width;
+ px %= TUI_CMD_WIN->width;
wmove (w, py, px);
tui_putc ('\n');
}
int h;
if (tui_win_list[type] != NULL)
- h = tui_win_list[type]->generic.height;
+ h = tui_win_list[type]->height;
else
{
switch (layout)
if (TUI_CMD_WIN == NULL)
h = tui_term_height () / 2;
else
- h = tui_term_height () - TUI_CMD_WIN->generic.height;
+ h = tui_term_height () - TUI_CMD_WIN->height;
break;
case SRC_DISASSEM_COMMAND:
case SRC_DATA_COMMAND:
if (TUI_CMD_WIN == NULL)
h = tui_term_height () / 3;
else
- h = (tui_term_height () - TUI_CMD_WIN->generic.height) / 2;
+ h = (tui_term_height () - TUI_CMD_WIN->height) / 2;
break;
default:
h = 0;
int cmd_height, src_height, asm_height;
if (TUI_CMD_WIN != NULL)
- cmd_height = TUI_CMD_WIN->generic.height;
+ cmd_height = TUI_CMD_WIN->height;
else
cmd_height = tui_term_height () / 3;
tui_win_list[SRC_WIN] = make_source_window (src_height, 0);
else
{
- init_gen_win_info (&TUI_SRC_WIN->generic,
- TUI_SRC_WIN->generic.type,
+ init_gen_win_info (TUI_SRC_WIN,
+ TUI_SRC_WIN->type,
src_height,
- TUI_SRC_WIN->generic.width,
+ TUI_SRC_WIN->width,
TUI_SRC_WIN->execution_info->width,
0);
TUI_SRC_WIN->can_highlight = true;
3,
0,
0);
- tui_make_visible (&TUI_SRC_WIN->generic);
+ tui_make_visible (TUI_SRC_WIN);
tui_make_visible (TUI_SRC_WIN->execution_info);
TUI_SRC_WIN->m_has_locator = false;
}
0,
(src_height + asm_height) - 1);
TUI_DISASM_WIN->m_has_locator = true;
- init_gen_win_info (&TUI_DISASM_WIN->generic,
- TUI_DISASM_WIN->generic.type,
+ init_gen_win_info (TUI_DISASM_WIN,
+ TUI_DISASM_WIN->type,
asm_height,
- TUI_DISASM_WIN->generic.width,
+ TUI_DISASM_WIN->width,
TUI_DISASM_WIN->execution_info->width,
src_height - 1);
init_gen_win_info (TUI_DISASM_WIN->execution_info,
0,
src_height - 1);
TUI_DISASM_WIN->can_highlight = true;
- tui_make_visible (&TUI_DISASM_WIN->generic);
+ tui_make_visible (TUI_DISASM_WIN);
tui_make_visible (TUI_DISASM_WIN->execution_info);
}
TUI_SRC_WIN->m_has_locator = false;
= make_command_window (cmd_height, tui_term_height () - cmd_height);
else
{
- init_gen_win_info (&TUI_CMD_WIN->generic,
- TUI_CMD_WIN->generic.type,
- TUI_CMD_WIN->generic.height,
- TUI_CMD_WIN->generic.width,
+ init_gen_win_info (TUI_CMD_WIN,
+ TUI_CMD_WIN->type,
+ TUI_CMD_WIN->height,
+ TUI_CMD_WIN->width,
0,
- TUI_CMD_WIN->generic.origin.y);
+ TUI_CMD_WIN->origin.y);
TUI_CMD_WIN->can_highlight = false;
- tui_make_visible (&TUI_CMD_WIN->generic);
+ tui_make_visible (TUI_CMD_WIN);
}
- tui_refresh_win (&TUI_CMD_WIN->generic);
+ tui_refresh_win (TUI_CMD_WIN);
tui_set_current_layout_to (SRC_DISASSEM_COMMAND);
}
}
static void
show_data (enum tui_layout_type new_layout)
{
- int total_height = (tui_term_height () - TUI_CMD_WIN->generic.height);
+ int total_height = (tui_term_height () - TUI_CMD_WIN->height);
int src_height, data_height;
enum tui_win_type win_type;
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
else
{
base = (tui_source_window_base *) tui_win_list[win_type];
- init_gen_win_info (&tui_win_list[win_type]->generic,
- tui_win_list[win_type]->generic.type,
+ init_gen_win_info (tui_win_list[win_type],
+ tui_win_list[win_type]->type,
src_height,
- tui_win_list[win_type]->generic.width,
+ tui_win_list[win_type]->width,
base->execution_info->width,
data_height - 1);
init_gen_win_info (base->execution_info,
3,
0,
data_height - 1);
- tui_make_visible (&tui_win_list[win_type]->generic);
+ tui_make_visible (tui_win_list[win_type]);
tui_make_visible (base->execution_info);
init_gen_win_info (locator,
LOCATOR_WIN,
if (tui_win_is_auxillary (win_type))
generic = (struct tui_gen_win_info *) opaque_win_info;
else
- generic = &((struct tui_win_info *) opaque_win_info)->generic;
+ generic = (struct tui_win_info *) opaque_win_info;
init_gen_win_info (generic, win_type, height, width, origin_x, origin_y);
if (!tui_win_is_auxillary (win_type))
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
if (TUI_CMD_WIN != NULL)
- cmd_height = TUI_CMD_WIN->generic.height;
+ cmd_height = TUI_CMD_WIN->height;
else
cmd_height = tui_term_height () / 3;
src_height = tui_term_height () - cmd_height;
0,
src_height - 1);
base->m_has_locator = true;
- init_gen_win_info (&(*win_info_ptr)->generic,
- (*win_info_ptr)->generic.type,
+ init_gen_win_info (*win_info_ptr,
+ (*win_info_ptr)->type,
src_height - 1,
- (*win_info_ptr)->generic.width,
+ (*win_info_ptr)->width,
base->execution_info->width,
0);
init_gen_win_info (base->execution_info,
0,
0);
base->can_highlight = true;
- tui_make_visible (&(*win_info_ptr)->generic);
+ tui_make_visible (*win_info_ptr);
tui_make_visible (base->execution_info);
}
{
tui_win_list[CMD_WIN] = make_command_window (cmd_height,
src_height);
- tui_refresh_win (&TUI_CMD_WIN->generic);
+ tui_refresh_win (TUI_CMD_WIN);
}
else
{
- init_gen_win_info (&TUI_CMD_WIN->generic,
- TUI_CMD_WIN->generic.type,
- TUI_CMD_WIN->generic.height,
- TUI_CMD_WIN->generic.width,
- TUI_CMD_WIN->generic.origin.x,
- TUI_CMD_WIN->generic.origin.y);
+ init_gen_win_info (TUI_CMD_WIN,
+ TUI_CMD_WIN->type,
+ TUI_CMD_WIN->height,
+ TUI_CMD_WIN->width,
+ TUI_CMD_WIN->origin.x,
+ TUI_CMD_WIN->origin.y);
TUI_CMD_WIN->can_highlight = false;
- tui_make_visible (&TUI_CMD_WIN->generic);
+ tui_make_visible (TUI_CMD_WIN);
}
tui_set_current_layout_to (layout_type);
}
/* Make sure the register window is visible. If not, select an
appropriate layout. */
- if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible)
+ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible)
tui_set_layout_by_name (DATA_NAME);
if (group == 0)
/* Make a new title showing which group we display. */
snprintf (title, sizeof (title) - 1, "Register group: %s",
reggroup_name (group));
- xfree (TUI_DATA_WIN->generic.title);
- TUI_DATA_WIN->generic.title = xstrdup (title);
+ xfree (TUI_DATA_WIN->title);
+ TUI_DATA_WIN->title = xstrdup (title);
/* See how many registers must be displayed. */
nr_regs = 0;
{
if (!refresh_values_only || allocated_here)
{
- TUI_DATA_WIN->generic.content = NULL;
- TUI_DATA_WIN->generic.content_size = 0;
- tui_add_content_elements (&TUI_DATA_WIN->generic, nr_regs);
- TUI_DATA_WIN->regs_content = TUI_DATA_WIN->generic.content;
+ TUI_DATA_WIN->content = NULL;
+ TUI_DATA_WIN->content_size = 0;
+ tui_add_content_elements (TUI_DATA_WIN, nr_regs);
+ TUI_DATA_WIN->regs_content = TUI_DATA_WIN->content;
TUI_DATA_WIN->regs_content_count = nr_regs;
}
pos++;
}
- TUI_DATA_WIN->generic.content_size =
+ TUI_DATA_WIN->content_size =
TUI_DATA_WIN->regs_content_count + TUI_DATA_WIN->data_content_count;
ret = TUI_SUCCESS;
}
i = start_element_no;
TUI_DATA_WIN->regs_column_count =
- (TUI_DATA_WIN->generic.width - 2) / item_win_width;
+ (TUI_DATA_WIN->width - 2) / item_win_width;
if (TUI_DATA_WIN->regs_column_count == 0)
TUI_DATA_WIN->regs_column_count = 1;
item_win_width =
- (TUI_DATA_WIN->generic.width - 2) / TUI_DATA_WIN->regs_column_count;
+ (TUI_DATA_WIN->width - 2) / TUI_DATA_WIN->regs_column_count;
/* Now create each data "sub" window, and write the display into
it. */
cur_y = 1;
while (i < TUI_DATA_WIN->regs_content_count
- && cur_y <= TUI_DATA_WIN->generic.viewport_height)
+ && cur_y <= TUI_DATA_WIN->viewport_height)
{
for (j = 0;
j < TUI_DATA_WIN->regs_column_count
last_line_no = tui_last_regs_line_no ();
first_line_on_last_page
- = last_line_no - (TUI_DATA_WIN->generic.height - 2);
+ = last_line_no - (TUI_DATA_WIN->height - 2);
if (first_line_on_last_page < 0)
first_line_on_last_page = 0;
tui_check_register_values (struct frame_info *frame)
{
if (TUI_DATA_WIN != NULL
- && TUI_DATA_WIN->generic.is_visible)
+ && TUI_DATA_WIN->is_visible)
{
if (TUI_DATA_WIN->regs_content_count <= 0
&& TUI_DATA_WIN->display_regs)
/* Make sure the register window is visible. If not, select an
appropriate layout. We need to do this before trying to run the
'next' or 'prev' commands. */
- if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->generic.is_visible)
+ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible)
tui_set_layout_by_name (DATA_NAME);
if (strncmp (args, "next", len) == 0)
if ((ret = tui_alloc_source_buffer (TUI_SRC_WIN)) == TUI_SUCCESS)
{
- line_width = TUI_SRC_WIN->generic.width - 1;
+ line_width = TUI_SRC_WIN->width - 1;
/* Take hilite (window border) into account, when
calculating the number of lines. */
- nlines = (line_no + (TUI_SRC_WIN->generic.height - 2)) - line_no;
+ nlines = (line_no + (TUI_SRC_WIN->height - 2)) - line_no;
std::string srclines;
if (!g_source_cache.get_source_lines (s, line_no, line_no + nlines,
= (struct tui_source_window_base *) TUI_SRC_WIN;
const char *s_filename = symtab_to_filename_for_display (s);
- if (TUI_SRC_WIN->generic.title)
- xfree (TUI_SRC_WIN->generic.title);
- TUI_SRC_WIN->generic.title = xstrdup (s_filename);
+ if (TUI_SRC_WIN->title)
+ xfree (TUI_SRC_WIN->title);
+ TUI_SRC_WIN->title = xstrdup (s_filename);
xfree (src->fullname);
src->fullname = xstrdup (symtab_to_fullname (s));
while (cur_line < nlines)
{
struct tui_win_element *element
- = TUI_SRC_WIN->generic.content[cur_line];
+ = TUI_SRC_WIN->content[cur_line];
std::string text;
if (*iter != '\0')
== locator->content[0]
->which_element.locator.line_no);
- xfree (TUI_SRC_WIN->generic.content[cur_line]
+ xfree (TUI_SRC_WIN->content[cur_line]
->which_element.source.line);
- TUI_SRC_WIN->generic.content[cur_line]
+ TUI_SRC_WIN->content[cur_line]
->which_element.source.line
= xstrdup (text.c_str ());
cur_line++;
cur_line_no++;
}
- TUI_SRC_WIN->generic.content_size = nlines;
+ TUI_SRC_WIN->content_size = nlines;
ret = TUI_SUCCESS;
}
}
int n_lines;
int curr_line = 0;
- line_width = win_info->generic.width - 1;
- n_lines = win_info->generic.height - 2;
+ line_width = win_info->width - 1;
+ n_lines = win_info->height - 2;
/* Set to empty each line in the window, except for the one which
contains the message. */
- while (curr_line < win_info->generic.content_size)
+ while (curr_line < win_info->content_size)
{
/* Set the information related to each displayed line to null:
i.e. the line number is 0, there is no bp, it is not where
the program is stopped. */
- struct tui_win_element *element = win_info->generic.content[curr_line];
+ struct tui_win_element *element = win_info->content[curr_line];
element->which_element.source.line_or_addr.loa = LOA_LINE;
element->which_element.source.line_or_addr.u.line_no = 0;
tui_source_is_displayed (const char *fullname)
{
return (TUI_SRC_WIN != NULL
- && TUI_SRC_WIN->generic.content_in_use
+ && TUI_SRC_WIN->content_in_use
&& (filename_cmp (tui_locator_win_info_ptr ()->content[0]
->which_element.locator.full_name,
fullname) == 0));
tui_source_window::do_scroll_vertical
(enum tui_scroll_direction scroll_direction, int num_to_scroll)
{
- if (generic.content != NULL)
+ if (content != NULL)
{
struct tui_line_or_address l;
struct symtab *s;
- tui_win_content content = generic.content;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab == NULL)
l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
+ num_to_scroll;
if (l.u.line_no > s->nlines)
- /* line = s->nlines - win_info->generic.content_size + 1; */
+ /* line = s->nlines - win_info->content_size + 1; */
/* elz: fix for dts 23398. */
l.u.line_no
= content[0]->which_element.source.line_or_addr.u.line_no;
if (win_info == TUI_SRC_WIN)
{
start_line = (item->locator.line_no -
- (win_info->generic.viewport_height / 2)) + 1;
+ (win_info->viewport_height / 2)) + 1;
if (start_line <= 0)
start_line = 1;
}
/* We can't focus on an invisible window. */
if (tui_win_list[win_type] == NULL
- || !tui_win_list[win_type]->generic.is_visible)
+ || !tui_win_list[win_type]->is_visible)
continue;
- completion_name = tui_win_name (&tui_win_list [win_type]->generic);
+ completion_name = tui_win_name (tui_win_list [win_type]);
gdb_assert (completion_name != NULL);
completion_name_vec.push_back (completion_name);
}
if (tui_active)
{
- width = TUI_CMD_WIN->generic.width;
- height = TUI_CMD_WIN->generic.height;
+ width = TUI_CMD_WIN->width;
+ height = TUI_CMD_WIN->height;
}
else
{
struct tui_win_info *win_with_focus = tui_win_with_focus ();
if (win_with_focus != NULL
- && win_with_focus->generic.type != CMD_WIN)
+ && win_with_focus->type != CMD_WIN)
tui_unhighlight_win (win_with_focus);
tui_set_win_with_focus (win_info);
- if (win_info->generic.type != CMD_WIN)
+ if (win_info->type != CMD_WIN)
tui_highlight_win (win_info);
}
}
tui_win_info::forward_scroll (int num_to_scroll)
{
if (num_to_scroll == 0)
- num_to_scroll = generic.height - 3;
+ num_to_scroll = height - 3;
do_scroll_vertical (FORWARD_SCROLL, num_to_scroll);
}
tui_win_info::backward_scroll (int num_to_scroll)
{
if (num_to_scroll == 0)
- num_to_scroll = generic.height - 3;
+ num_to_scroll = height - 3;
do_scroll_vertical (BACKWARD_SCROLL, num_to_scroll);
}
tui_refresh_all (tui_win_list);
for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
{
- if (tui_win_list[type] && tui_win_list[type]->generic.is_visible)
+ if (tui_win_list[type] && tui_win_list[type]->is_visible)
tui_win_list[type]->refresh_all ();
}
tui_show_locator_content ();
#endif
/* Turn keypad off while we resize. */
if (win_with_focus != TUI_CMD_WIN)
- keypad (TUI_CMD_WIN->generic.handle, FALSE);
+ keypad (TUI_CMD_WIN->handle, FALSE);
tui_update_gdb_sizes ();
tui_set_term_height_to (screenheight);
tui_set_term_width_to (screenwidth);
case SRC_COMMAND:
case DISASSEM_COMMAND:
first_win = tui_source_windows ()[0];
- first_win->generic.width += width_diff;
+ first_win->width += width_diff;
locator->width += width_diff;
/* Check for invalid heights. */
if (height_diff == 0)
- new_height = first_win->generic.height;
- else if ((first_win->generic.height + split_diff) >=
+ new_height = first_win->height;
+ else if ((first_win->height + split_diff) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1;
- else if ((first_win->generic.height + split_diff) <= 0)
+ else if ((first_win->height + split_diff) <= 0)
new_height = MIN_WIN_HEIGHT;
else
- new_height = first_win->generic.height + split_diff;
+ new_height = first_win->height + split_diff;
locator->origin.y = new_height + 1;
make_invisible_and_set_new_height (first_win, new_height);
- TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
- TUI_CMD_WIN->generic.width += width_diff;
- new_height = screenheight - TUI_CMD_WIN->generic.origin.y;
+ TUI_CMD_WIN->origin.y = locator->origin.y + 1;
+ TUI_CMD_WIN->width += width_diff;
+ new_height = screenheight - TUI_CMD_WIN->origin.y;
make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
make_visible_with_new_height (first_win);
make_visible_with_new_height (TUI_CMD_WIN);
- if (first_win->generic.content_size <= 0)
+ if (first_win->content_size <= 0)
tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
break;
default:
if (cur_layout == SRC_DISASSEM_COMMAND)
{
first_win = TUI_SRC_WIN;
- first_win->generic.width += width_diff;
+ first_win->width += width_diff;
second_win = TUI_DISASM_WIN;
- second_win->generic.width += width_diff;
+ second_win->width += width_diff;
}
else
{
first_win = TUI_DATA_WIN;
- first_win->generic.width += width_diff;
+ first_win->width += width_diff;
second_win = tui_source_windows ()[0];
- second_win->generic.width += width_diff;
+ second_win->width += width_diff;
}
/* Change the first window's height/width. */
/* Check for invalid heights. */
if (height_diff == 0)
- new_height = first_win->generic.height;
- else if ((first_win->generic.height +
- second_win->generic.height + (split_diff * 2)) >=
+ new_height = first_win->height;
+ else if ((first_win->height +
+ second_win->height + (split_diff * 2)) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
new_height = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2;
- else if ((first_win->generic.height + split_diff) <= 0)
+ else if ((first_win->height + split_diff) <= 0)
new_height = MIN_WIN_HEIGHT;
else
- new_height = first_win->generic.height + split_diff;
+ new_height = first_win->height + split_diff;
make_invisible_and_set_new_height (first_win, new_height);
locator->width += width_diff;
/* Change the second window's height/width. */
/* Check for invalid heights. */
if (height_diff == 0)
- new_height = second_win->generic.height;
- else if ((first_win->generic.height +
- second_win->generic.height + (split_diff * 2)) >=
+ new_height = second_win->height;
+ else if ((first_win->height +
+ second_win->height + (split_diff * 2)) >=
(screenheight - MIN_CMD_WIN_HEIGHT - 1))
{
new_height = screenheight - MIN_CMD_WIN_HEIGHT - 1;
else
new_height /= 2;
}
- else if ((second_win->generic.height + split_diff) <= 0)
+ else if ((second_win->height + split_diff) <= 0)
new_height = MIN_WIN_HEIGHT;
else
- new_height = second_win->generic.height + split_diff;
- second_win->generic.origin.y = first_win->generic.height - 1;
+ new_height = second_win->height + split_diff;
+ second_win->origin.y = first_win->height - 1;
make_invisible_and_set_new_height (second_win, new_height);
/* Change the command window's height/width. */
- TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ TUI_CMD_WIN->origin.y = locator->origin.y + 1;
make_invisible_and_set_new_height (TUI_CMD_WIN,
- TUI_CMD_WIN->generic.height
+ TUI_CMD_WIN->height
+ cmd_split_diff);
make_visible_with_new_height (first_win);
make_visible_with_new_height (second_win);
make_visible_with_new_height (TUI_CMD_WIN);
- if (first_win->generic.content_size <= 0)
+ if (first_win->content_size <= 0)
tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
- if (second_win->generic.content_size <= 0)
+ if (second_win->content_size <= 0)
tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
break;
}
{
if (win_type != CMD_WIN
&& (tui_win_list[win_type] != NULL)
- && !tui_win_list[win_type]->generic.is_visible)
+ && !tui_win_list[win_type]->is_visible)
{
delete tui_win_list[win_type];
tui_win_list[win_type] = NULL;
/* Turn keypad back on, unless focus is in the command
window. */
if (win_with_focus != TUI_CMD_WIN)
- keypad (TUI_CMD_WIN->generic.handle, TRUE);
+ keypad (TUI_CMD_WIN->handle, TRUE);
}
}
else
win_info = tui_partial_win_by_name (buf_ptr);
- if (win_info == NULL || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
{
tui_set_win_focus_to (win_info);
- keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN));
+ keypad (TUI_CMD_WIN->handle, (win_info != TUI_CMD_WIN));
}
- if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible)
+ if (TUI_DATA_WIN && TUI_DATA_WIN->is_visible)
TUI_DATA_WIN->refresh_all ();
xfree (buf_ptr);
printf_filtered (_("Focus set to %s window.\n"),
- tui_win_name (&tui_win_with_focus ()->generic));
+ tui_win_name (tui_win_with_focus ()));
}
else
warning (_("Incorrect Number of Arguments.\n%s"), FOCUS_USAGE);
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
if (tui_win_list[type]
- && tui_win_list[type]->generic.is_visible)
+ && tui_win_list[type]->is_visible)
{
if (win_with_focus == tui_win_list[type])
printf_filtered (" %s\t(%d lines) <has focus>\n",
- tui_win_name (&tui_win_list[type]->generic),
- tui_win_list[type]->generic.height);
+ tui_win_name (tui_win_list[type]),
+ tui_win_list[type]->height);
else
printf_filtered (" %s\t(%d lines)\n",
- tui_win_name (&tui_win_list[type]->generic),
- tui_win_list[type]->generic.height);
+ tui_win_name (tui_win_list[type]),
+ tui_win_list[type]->height);
}
}
and redisplay of the window's contents, which will take
the new tab width into account. */
if (tui_win_list[SRC_WIN]
- && tui_win_list[SRC_WIN]->generic.is_visible)
+ && tui_win_list[SRC_WIN]->is_visible)
{
make_invisible_and_set_new_height (TUI_SRC_WIN,
- TUI_SRC_WIN->generic.height);
+ TUI_SRC_WIN->height);
make_visible_with_new_height (TUI_SRC_WIN);
}
if (tui_win_list[DISASSEM_WIN]
- && tui_win_list[DISASSEM_WIN]->generic.is_visible)
+ && tui_win_list[DISASSEM_WIN]->is_visible)
{
make_invisible_and_set_new_height (TUI_DISASM_WIN,
- TUI_DISASM_WIN->generic.height);
+ TUI_DISASM_WIN->height);
make_visible_with_new_height (TUI_DISASM_WIN);
}
}
wname[i] = tolower (wname[i]);
win_info = tui_partial_win_by_name (wname);
- if (win_info == NULL || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
if (fixed_size)
new_height = input_no;
else
- new_height = win_info->generic.height + input_no;
+ new_height = win_info->height + input_no;
/* Now change the window's height, and adjust
all other windows around it. */
if (new_height_ok (primary_win_info, new_height))
{
status = TUI_SUCCESS;
- if (new_height != primary_win_info->generic.height)
+ if (new_height != primary_win_info->height)
{
int diff;
struct tui_win_info *win_info;
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
enum tui_layout_type cur_layout = tui_current_layout ();
- diff = (new_height - primary_win_info->generic.height) * (-1);
+ diff = (new_height - primary_win_info->height) * (-1);
if (cur_layout == SRC_COMMAND
|| cur_layout == DISASSEM_COMMAND)
{
struct tui_win_info *src_win_info;
make_invisible_and_set_new_height (primary_win_info, new_height);
- if (primary_win_info->generic.type == CMD_WIN)
+ if (primary_win_info->type == CMD_WIN)
{
win_info = tui_source_windows ()[0];
src_win_info = win_info;
src_win_info = primary_win_info;
}
make_invisible_and_set_new_height (win_info,
- win_info->generic.height + diff);
- TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ win_info->height + diff);
+ TUI_CMD_WIN->origin.y = locator->origin.y + 1;
make_visible_with_new_height (win_info);
make_visible_with_new_height (primary_win_info);
- if (src_win_info->generic.content_size <= 0)
+ if (src_win_info->content_size <= 0)
tui_erase_source_content (src_win_info, EMPTY_SOURCE_PROMPT);
}
else
if (diff % 2)
{
- if (first_win->generic.height >
- second_win->generic.height)
+ if (first_win->height >
+ second_win->height)
if (diff < 0)
first_split_diff--;
else
}
/* Make sure that the minimum hieghts are
honored. */
- while ((first_win->generic.height + first_split_diff) < 3)
+ while ((first_win->height + first_split_diff) < 3)
{
first_split_diff++;
second_split_diff--;
}
- while ((second_win->generic.height + second_split_diff) < 3)
+ while ((second_win->height + second_split_diff) < 3)
{
second_split_diff++;
first_split_diff--;
}
make_invisible_and_set_new_height (
first_win,
- first_win->generic.height + first_split_diff);
- second_win->generic.origin.y = first_win->generic.height - 1;
+ first_win->height + first_split_diff);
+ second_win->origin.y = first_win->height - 1;
make_invisible_and_set_new_height (second_win,
- second_win->generic.height
+ second_win->height
+ second_split_diff);
- TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
+ TUI_CMD_WIN->origin.y = locator->origin.y + 1;
make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
}
else
{
- if ((TUI_CMD_WIN->generic.height + diff) < 1)
+ if ((TUI_CMD_WIN->height + diff) < 1)
{ /* If there is no way to increase the command
window take real estate from the 1st or 2nd
window. */
- if ((TUI_CMD_WIN->generic.height + diff) < 1)
+ if ((TUI_CMD_WIN->height + diff) < 1)
{
int i;
- for (i = TUI_CMD_WIN->generic.height + diff;
+ for (i = TUI_CMD_WIN->height + diff;
(i < 1); i++)
if (primary_win_info == first_win)
- second_win->generic.height--;
+ second_win->height--;
else
- first_win->generic.height--;
+ first_win->height--;
}
}
if (primary_win_info == first_win)
else
make_invisible_and_set_new_height (
first_win,
- first_win->generic.height);
- second_win->generic.origin.y = first_win->generic.height - 1;
+ first_win->height);
+ second_win->origin.y = first_win->height - 1;
if (primary_win_info == second_win)
make_invisible_and_set_new_height (second_win, new_height);
else
make_invisible_and_set_new_height (
- second_win, second_win->generic.height);
- TUI_CMD_WIN->generic.origin.y = locator->origin.y + 1;
- if ((TUI_CMD_WIN->generic.height + diff) < 1)
+ second_win, second_win->height);
+ TUI_CMD_WIN->origin.y = locator->origin.y + 1;
+ if ((TUI_CMD_WIN->height + diff) < 1)
make_invisible_and_set_new_height (TUI_CMD_WIN, 1);
else
make_invisible_and_set_new_height (TUI_CMD_WIN,
- TUI_CMD_WIN->generic.height + diff);
+ TUI_CMD_WIN->height + diff);
}
make_visible_with_new_height (TUI_CMD_WIN);
make_visible_with_new_height (second_win);
make_visible_with_new_height (first_win);
- if (first_win->generic.content_size <= 0)
+ if (first_win->content_size <= 0)
tui_erase_source_content (first_win, EMPTY_SOURCE_PROMPT);
- if (second_win->generic.content_size <= 0)
+ if (second_win->content_size <= 0)
tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
}
}
{
tui_make_invisible (execution_info);
execution_info->height = height;
- execution_info->origin.y = generic.origin.y;
+ execution_info->origin.y = origin.y;
if (height > 1)
execution_info->viewport_height = height - 1;
else
{
tui_gen_win_info *gen_win_info = tui_locator_win_info_ptr ();
tui_make_invisible (gen_win_info);
- gen_win_info->origin.y = generic.origin.y + height;
+ gen_win_info->origin.y = origin.y + height;
}
}
tui_data_window::set_new_height (int height)
{
/* Delete all data item windows. */
- for (int i = 0; i < generic.content_size; i++)
+ for (int i = 0; i < content_size; i++)
{
struct tui_gen_win_info *gen_win_info
- = generic.content[i]->which_element.data_window;
+ = content[i]->which_element.data_window;
tui_delete_win (gen_win_info->handle);
gen_win_info->handle = NULL;
}
make_invisible_and_set_new_height (struct tui_win_info *win_info,
int height)
{
- tui_make_invisible (&win_info->generic);
- win_info->generic.height = height;
+ tui_make_invisible (win_info);
+ win_info->height = height;
if (height > 1)
- win_info->generic.viewport_height = height - 1;
+ win_info->viewport_height = height - 1;
else
- win_info->generic.viewport_height = height;
+ win_info->viewport_height = height;
if (win_info != TUI_CMD_WIN)
- win_info->generic.viewport_height--;
+ win_info->viewport_height--;
/* Now deal with the auxillary windows associated with win_info. */
win_info->set_new_height (height);
{
struct symtab *s;
- tui_make_visible (&win_info->generic);
+ tui_make_visible (win_info);
tui_check_and_display_highlight_if_needed (win_info);
tui_source_window_base *base;
- switch (win_info->generic.type)
+ switch (win_info->type)
{
case SRC_WIN:
case DISASSEM_WIN:
base = (tui_source_window_base *) win_info;
tui_free_win_content (base->execution_info);
tui_make_visible (base->execution_info);
- if (win_info->generic.content != NULL)
+ if (win_info->content != NULL)
{
struct gdbarch *gdbarch = base->gdbarch;
struct tui_line_or_address line_or_addr;
= get_current_source_symtab_and_line ();
line_or_addr = base->start_line_or_addr;
- tui_free_win_content (&win_info->generic);
+ tui_free_win_content (win_info);
tui_update_source_window (win_info, gdbarch,
cursal.symtab, line_or_addr, TRUE);
}
struct gdbarch *gdbarch = get_frame_arch (frame);
s = find_pc_line_symtab (get_frame_pc (frame));
- if (win_info->generic.type == SRC_WIN)
+ if (win_info->type == SRC_WIN)
{
line.loa = LOA_LINE;
line.u.line_no = cursal.line;
break;
case CMD_WIN:
#ifdef HAVE_WRESIZE
- wresize (TUI_CMD_WIN->generic.handle,
- TUI_CMD_WIN->generic.height,
- TUI_CMD_WIN->generic.width);
+ wresize (TUI_CMD_WIN->handle,
+ TUI_CMD_WIN->height,
+ TUI_CMD_WIN->width);
#endif
- mvwin (TUI_CMD_WIN->generic.handle,
- TUI_CMD_WIN->generic.origin.y,
- TUI_CMD_WIN->generic.origin.x);
- wmove (win_info->generic.handle, 0, 0);
+ mvwin (TUI_CMD_WIN->handle,
+ TUI_CMD_WIN->origin.y,
+ TUI_CMD_WIN->origin.x);
+ wmove (win_info->handle, 0, 0);
break;
default:
break;
int diff;
enum tui_layout_type cur_layout = tui_current_layout ();
- diff = (new_height - primary_win_info->generic.height) * (-1);
+ diff = (new_height - primary_win_info->height) * (-1);
if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND)
{
ok = (new_height <= primary_win_info->max_height ()
else
win_info = TUI_CMD_WIN;
ok = ((new_height +
- (win_info->generic.height + diff)) <= tui_term_height ());
+ (win_info->height + diff)) <= tui_term_height ());
}
}
else
the line that the first and second windows share, and add
one for the locator. */
total_height = cur_total_height =
- (first_win->generic.height + second_win->generic.height - 1)
- + TUI_CMD_WIN->generic.height + 1; /* Locator. */
+ (first_win->height + second_win->height - 1)
+ + TUI_CMD_WIN->height + 1; /* Locator. */
if (primary_win_info == TUI_CMD_WIN)
{
/* Locator included since first & second win share a line. */
- ok = ((first_win->generic.height +
- second_win->generic.height + diff) >=
+ ok = ((first_win->height +
+ second_win->height + diff) >=
(MIN_WIN_HEIGHT * 2)
&& new_height >= MIN_CMD_WIN_HEIGHT);
if (ok)
{
total_height = new_height +
- (first_win->generic.height +
- second_win->generic.height + diff);
+ (first_win->height +
+ second_win->height + diff);
min_height = MIN_CMD_WIN_HEIGHT;
}
}
/* First see if we can increase/decrease the command
window. And make sure that the command window is at
least 1 line. */
- ok = ((TUI_CMD_WIN->generic.height + diff) > 0);
+ ok = ((TUI_CMD_WIN->height + diff) > 0);
if (!ok)
{ /* Looks like we have to increase/decrease one of
the other windows. */
if (primary_win_info == first_win)
- ok = (second_win->generic.height + diff) >= min_height;
+ ok = (second_win->height + diff) >= min_height;
else
- ok = (first_win->generic.height + diff) >= min_height;
+ ok = (first_win->height + diff) >= min_height;
}
if (ok)
{
if (primary_win_info == first_win)
total_height = new_height +
- second_win->generic.height +
- TUI_CMD_WIN->generic.height + diff;
+ second_win->height +
+ TUI_CMD_WIN->height + diff;
else
total_height = new_height +
- first_win->generic.height +
- TUI_CMD_WIN->generic.height + diff;
+ first_win->height +
+ TUI_CMD_WIN->height + diff;
}
}
/* Now make sure that the proposed total height doesn't
*win_to_scroll = tui_partial_win_by_name (wname);
if (*win_to_scroll == NULL
- || !(*win_to_scroll)->generic.is_visible)
+ || !(*win_to_scroll)->is_visible)
error (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else if (*win_to_scroll == TUI_CMD_WIN)
int i;
for (i = 0;
- i < TUI_DATA_WIN->generic.content_size && element_no < 0;
+ i < TUI_DATA_WIN->content_size && element_no < 0;
i++)
{
struct tui_gen_win_info *data_item_win;
data_item_win
- = TUI_DATA_WIN->generic.content[i]->which_element.data_window;
+ = TUI_DATA_WIN->content[i]->which_element.data_window;
if (data_item_win->handle != NULL
&& data_item_win->is_visible)
element_no = i;
int i;
struct tui_gen_win_info *data_item_win_ptr;
- for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++)
+ for (i = 0; (i < TUI_DATA_WIN->content_size); i++)
{
data_item_win_ptr
- = TUI_DATA_WIN->generic.content[i]->which_element.data_window;
+ = TUI_DATA_WIN->content[i]->which_element.data_window;
tui_delete_win (data_item_win_ptr->handle);
data_item_win_ptr->handle = NULL;
data_item_win_ptr->is_visible = false;
void
tui_erase_data_content (const char *prompt)
{
- werase (TUI_DATA_WIN->generic.handle);
+ werase (TUI_DATA_WIN->handle);
tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
if (prompt != NULL)
{
- int half_width = (TUI_DATA_WIN->generic.width - 2) / 2;
+ int half_width = (TUI_DATA_WIN->width - 2) / 2;
int x_pos;
if (strlen (prompt) >= half_width)
x_pos = 1;
else
x_pos = half_width - strlen (prompt);
- mvwaddstr (TUI_DATA_WIN->generic.handle,
- (TUI_DATA_WIN->generic.height / 2),
+ mvwaddstr (TUI_DATA_WIN->handle,
+ (TUI_DATA_WIN->height / 2),
x_pos,
(char *) prompt);
}
- wrefresh (TUI_DATA_WIN->generic.handle);
+ wrefresh (TUI_DATA_WIN->handle);
}
void
tui_display_all_data (void)
{
- if (TUI_DATA_WIN->generic.content_size <= 0)
+ if (TUI_DATA_WIN->content_size <= 0)
tui_erase_data_content (NO_DATA_STRING);
else
{
tui_data_window::refresh_all ()
{
tui_erase_data_content (NULL);
- if (generic.content_size > 0)
+ if (content_size > 0)
{
int first_element = tui_first_data_item_displayed ();
tui_check_register_values (frame);
/* Now check any other data values that there are. */
- if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
+ if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->is_visible)
{
int i;
tui_unhighlight_win (struct tui_win_info *win_info)
{
if (win_info != NULL
- && win_info->generic.handle != NULL)
+ && win_info->handle != NULL)
{
- box_win (&win_info->generic, NO_HILITE);
- wrefresh (win_info->generic.handle);
+ box_win (win_info, NO_HILITE);
+ wrefresh (win_info->handle);
win_info->set_highlight (false);
}
}
{
if (win_info != NULL
&& win_info->can_highlight
- && win_info->generic.handle != NULL)
+ && win_info->handle != NULL)
{
- box_win (&win_info->generic, HILITE);
- wrefresh (win_info->generic.handle);
+ box_win (win_info, HILITE);
+ wrefresh (win_info->handle);
win_info->set_highlight (true);
}
}
void
tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
{
- if (win_info != NULL && win_info->generic.type != CMD_WIN)
+ if (win_info != NULL && win_info->type != CMD_WIN)
{
if (win_info->is_highlighted)
tui_highlight_win (win_info);
void
tui_win_info::make_visible (bool visible)
{
- ::make_visible (&generic, visible);
+ ::make_visible (this, visible);
}
/* See tui-data.h. */
void
tui_win_info::refresh ()
{
- touchwin (generic.handle);
- tui_refresh_win (&generic);
+ touchwin (handle);
+ tui_refresh_win (this);
}
/* See tui-data.h. */
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
{
- if (list[type] && list[type]->generic.is_visible)
+ if (list[type] && list[type]->is_visible)
list[type]->refresh ();
}
if (locator->is_visible)
{
enum tui_status ret;
- if (win_info->generic.type == SRC_WIN)
+ if (win_info->type == SRC_WIN)
ret = tui_set_source_content (s, line_or_addr.u.line_no, noerror);
else
ret = tui_set_disassem_content (gdbarch, line_or_addr.u.addr);
tui_update_breakpoint_info (win_info, 0);
tui_show_source_content (win_info);
tui_update_exec_info (win_info);
- if (win_info->generic.type == SRC_WIN)
+ if (win_info->type == SRC_WIN)
{
symtab_and_line sal;
sal.line = line_or_addr.u.line_no +
- (win_info->generic.content_size - 2);
+ (win_info->content_size - 2);
sal.symtab = s;
sal.pspace = SYMTAB_PSPACE (s);
set_current_source_symtab_and_line (sal);
{
int i;
- win_info->generic.content_in_use = FALSE;
+ win_info->content_in_use = FALSE;
tui_erase_source_content (win_info, display_prompt);
- for (i = 0; i < win_info->generic.content_size; i++)
+ for (i = 0; i < win_info->content_size; i++)
{
- struct tui_win_element *element = win_info->generic.content[i];
+ struct tui_win_element *element = win_info->content[i];
element->which_element.source.has_break = FALSE;
element->which_element.source.is_exec_point = FALSE;
int display_prompt)
{
int x_pos;
- int half_width = (win_info->generic.width - 2) / 2;
+ int half_width = (win_info->width - 2) / 2;
- if (win_info->generic.handle != NULL)
+ if (win_info->handle != NULL)
{
- werase (win_info->generic.handle);
+ werase (win_info->handle);
tui_check_and_display_highlight_if_needed (win_info);
if (display_prompt == EMPTY_SOURCE_PROMPT)
{
const char *no_src_str;
- if (win_info->generic.type == SRC_WIN)
+ if (win_info->type == SRC_WIN)
no_src_str = NO_SRC_STRING;
else
no_src_str = NO_DISASSEM_STRING;
x_pos = 1;
else
x_pos = half_width - strlen (no_src_str);
- mvwaddstr (win_info->generic.handle,
- (win_info->generic.height / 2),
+ mvwaddstr (win_info->handle,
+ (win_info->height / 2),
x_pos,
(char *) no_src_str);
tui_set_source_content_nil (win_info, no_src_str);
}
- tui_refresh_win (&win_info->generic);
+ tui_refresh_win (win_info);
}
}
struct tui_win_element *line;
int x;
- line = win_info->generic.content[lineno - 1];
+ line = win_info->content[lineno - 1];
if (line->which_element.source.is_exec_point)
- tui_set_reverse_mode (win_info->generic.handle, true);
+ tui_set_reverse_mode (win_info->handle, true);
- wmove (win_info->generic.handle, lineno, 1);
+ wmove (win_info->handle, lineno, 1);
tui_puts (line->which_element.source.line,
- win_info->generic.handle);
+ win_info->handle);
if (line->which_element.source.is_exec_point)
- tui_set_reverse_mode (win_info->generic.handle, false);
+ tui_set_reverse_mode (win_info->handle, false);
/* Clear to end of line but stop before the border. */
- x = getcurx (win_info->generic.handle);
- while (x + 1 < win_info->generic.width)
+ x = getcurx (win_info->handle);
+ while (x + 1 < win_info->width)
{
- waddch (win_info->generic.handle, ' ');
- x = getcurx (win_info->generic.handle);
+ waddch (win_info->handle, ' ');
+ x = getcurx (win_info->handle);
}
}
void
tui_show_source_content (struct tui_win_info *win_info)
{
- if (win_info->generic.content_size > 0)
+ if (win_info->content_size > 0)
{
int lineno;
- for (lineno = 1; lineno <= win_info->generic.content_size; lineno++)
+ for (lineno = 1; lineno <= win_info->content_size; lineno++)
tui_show_source_line (win_info, lineno);
}
else
tui_erase_source_content (win_info, TRUE);
tui_check_and_display_highlight_if_needed (win_info);
- tui_refresh_win (&win_info->generic);
- win_info->generic.content_in_use = TRUE;
+ tui_refresh_win (win_info);
+ win_info->content_in_use = TRUE;
}
/* See tui-data.h. */
{
symtab *s = nullptr;
- if (generic.type == SRC_WIN)
+ if (type == SRC_WIN)
{
symtab_and_line cursal = get_current_source_symtab_and_line ();
s = (cursal.symtab == NULL
}
tui_update_source_window_as_is (this, gdbarch, s,
- generic.content[0]
+ content[0]
->which_element.source.line_or_addr,
FALSE);
}
tui_source_window_base::do_scroll_horizontal
(enum tui_scroll_direction direction, int num_to_scroll)
{
- if (generic.content != NULL)
+ if (content != NULL)
{
int offset;
{
int changed = 0;
int i;
- tui_win_content content = generic.content;
i = 0;
- while (i < generic.content_size)
+ while (i < content_size)
{
int new_state;
struct tui_line_or_address content_loa =
int need_refresh = 0;
tui_source_window_base *src = (tui_source_window_base *) win;
- for (i = 0; i < win->generic.content_size; i++)
+ for (i = 0; i < win->content_size; i++)
{
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
int mode;
struct tui_source_element *line;
- line = &win->generic.content[i]->which_element.source;
+ line = &win->content[i]->which_element.source;
if (current_only && !line->is_exec_point)
continue;
if (exec_info_ptr->content == NULL)
exec_info_ptr->content =
- tui_alloc_content (win_info->generic.height, exec_info_ptr->type);
+ tui_alloc_content (win_info->height, exec_info_ptr->type);
if (exec_info_ptr->content != NULL)
{
int i;
tui_update_breakpoint_info (win_info, 1);
- for (i = 0; i < win_info->generic.content_size; i++)
+ for (i = 0; i < win_info->content_size; i++)
{
struct tui_win_element *element;
struct tui_win_element *src_element;
int mode;
element = exec_info_ptr->content[i];
- src_element = win_info->generic.content[i];
+ src_element = win_info->content[i];
memset(element->which_element.simple_string, ' ',
sizeof(element->which_element.simple_string));
if (src_element->which_element.source.is_exec_point)
element->which_element.simple_string[TUI_EXEC_POS] = '>';
}
- exec_info_ptr->content_size = win_info->generic.content_size;
+ exec_info_ptr->content_size = win_info->content_size;
}
else
ret = TUI_FAILURE;
/* The window width/height includes the highlight box. Determine actual
content dimensions, including string null-terminators. */
- max_lines = win_info->generic.height - 2;
- line_width = win_info->generic.width - 2 + 1;
+ max_lines = win_info->height - 2;
+ line_width = win_info->width - 2 + 1;
/* Allocate the buffer for the source lines. */
- if (win_info->generic.content == NULL)
+ if (win_info->content == NULL)
{
/* Allocate the content list. */
- win_info->generic.content = tui_alloc_content (max_lines, SRC_WIN);
+ win_info->content = tui_alloc_content (max_lines, SRC_WIN);
for (i = 0; i < max_lines; i++)
- win_info->generic.content[i]->which_element.source.line
+ win_info->content[i]->which_element.source.line
= (char *) xmalloc (line_width);
}
else
threshold = 0;
i = 0;
- while (i < win_info->generic.content_size - threshold
+ while (i < win_info->content_size - threshold
&& !is_displayed)
{
is_displayed
- = win_info->generic.content[i]
+ = win_info->content[i]
->which_element.source.line_or_addr.loa == LOA_LINE
- && win_info->generic.content[i]
+ && win_info->content[i]
->which_element.source.line_or_addr.u.line_no == line;
i++;
}
else
threshold = 0;
i = 0;
- while (i < win_info->generic.content_size - threshold
+ while (i < win_info->content_size - threshold
&& !is_displayed)
{
is_displayed
- = win_info->generic.content[i]
+ = win_info->content[i]
->which_element.source.line_or_addr.loa == LOA_ADDRESS
- && win_info->generic.content[i]
+ && win_info->content[i]
->which_element.source.line_or_addr.u.addr == addr;
i++;
}
if (win_info)
{
tui_set_win_focus_to (win_info);
- if (TUI_DATA_WIN && TUI_DATA_WIN->generic.is_visible)
+ if (TUI_DATA_WIN && TUI_DATA_WIN->is_visible)
TUI_DATA_WIN->refresh_all ();
- keypad (TUI_CMD_WIN->generic.handle, (win_info != TUI_CMD_WIN));
+ keypad (TUI_CMD_WIN->handle, (win_info != TUI_CMD_WIN));
}
return 0;
}
tui_show_frame_info (0);
tui_set_layout (SRC_COMMAND);
tui_set_win_focus_to (TUI_SRC_WIN);
- keypad (TUI_CMD_WIN->generic.handle, TRUE);
- wrefresh (TUI_CMD_WIN->generic.handle);
+ keypad (TUI_CMD_WIN->handle, TRUE);
+ wrefresh (TUI_CMD_WIN->handle);
tui_finish_init = 0;
}
else
if (tui_win_list[type] == 0)
return false;
- return tui_win_list[type]->generic.is_visible;
+ return tui_win_list[type]->is_visible;
}
int
return 0;
}
- *width = TUI_CMD_WIN->generic.width;
- *height = TUI_CMD_WIN->generic.height;
+ *width = TUI_CMD_WIN->width;
+ *height = TUI_CMD_WIN->height;
return 1;
}