void
-tui_scroll_forward (struct tui_win_info *win_to_scroll,
- int num_to_scroll)
+tui_win_info::forward_scroll (int num_to_scroll)
{
- if (win_to_scroll != TUI_CMD_WIN)
- {
- int _num_to_scroll = num_to_scroll;
-
- if (num_to_scroll == 0)
- _num_to_scroll = win_to_scroll->generic.height - 3;
-
- /* If we are scrolling the source or disassembly window, do a
- "psuedo" scroll since not all of the source is in memory,
- only what is in the viewport. If win_to_scroll is the
- command window do nothing since the term should handle
- it. */
- if (win_to_scroll == TUI_SRC_WIN)
- tui_vertical_source_scroll (FORWARD_SCROLL, _num_to_scroll);
- else if (win_to_scroll == TUI_DISASM_WIN)
- tui_vertical_disassem_scroll (FORWARD_SCROLL, _num_to_scroll);
- else if (win_to_scroll == TUI_DATA_WIN)
- tui_vertical_data_scroll (FORWARD_SCROLL, _num_to_scroll);
- }
-}
+ if (num_to_scroll == 0)
+ num_to_scroll = generic.height - 3;
-void
-tui_scroll_backward (struct tui_win_info *win_to_scroll,
- int num_to_scroll)
-{
- if (win_to_scroll != TUI_CMD_WIN)
- {
- int _num_to_scroll = num_to_scroll;
-
- if (num_to_scroll == 0)
- _num_to_scroll = win_to_scroll->generic.height - 3;
-
- /* If we are scrolling the source or disassembly window, do a
- "psuedo" scroll since not all of the source is in memory,
- only what is in the viewport. If win_to_scroll is the
- command window do nothing since the term should handle
- it. */
- if (win_to_scroll == TUI_SRC_WIN)
- tui_vertical_source_scroll (BACKWARD_SCROLL, _num_to_scroll);
- else if (win_to_scroll == TUI_DISASM_WIN)
- tui_vertical_disassem_scroll (BACKWARD_SCROLL, _num_to_scroll);
- else if (win_to_scroll == TUI_DATA_WIN)
- tui_vertical_data_scroll (BACKWARD_SCROLL, _num_to_scroll);
- }
+ do_scroll_vertical (FORWARD_SCROLL, num_to_scroll);
}
-
void
-tui_scroll_left (struct tui_win_info *win_to_scroll,
- int num_to_scroll)
+tui_win_info::backward_scroll (int num_to_scroll)
{
- if (win_to_scroll != TUI_CMD_WIN)
- {
- int _num_to_scroll = num_to_scroll;
-
- if (_num_to_scroll == 0)
- _num_to_scroll = 1;
-
- /* If we are scrolling the source or disassembly window, do a
- "psuedo" scroll since not all of the source is in memory,
- only what is in the viewport. If win_to_scroll is the command
- window do nothing since the term should handle it. */
- if (win_to_scroll == TUI_SRC_WIN
- || win_to_scroll == TUI_DISASM_WIN)
- tui_horizontal_source_scroll (win_to_scroll, LEFT_SCROLL,
- _num_to_scroll);
- }
+ if (num_to_scroll == 0)
+ num_to_scroll = generic.height - 3;
+
+ do_scroll_vertical (BACKWARD_SCROLL, num_to_scroll);
}
void
-tui_scroll_right (struct tui_win_info *win_to_scroll,
- int num_to_scroll)
+tui_win_info::left_scroll (int num_to_scroll)
{
- if (win_to_scroll != TUI_CMD_WIN)
- {
- int _num_to_scroll = num_to_scroll;
-
- if (_num_to_scroll == 0)
- _num_to_scroll = 1;
-
- /* If we are scrolling the source or disassembly window, do a
- "psuedo" scroll since not all of the source is in memory,
- only what is in the viewport. If win_to_scroll is the command
- window do nothing since the term should handle it. */
- if (win_to_scroll == TUI_SRC_WIN
- || win_to_scroll == TUI_DISASM_WIN)
- tui_horizontal_source_scroll (win_to_scroll, RIGHT_SCROLL,
- _num_to_scroll);
- }
+ if (num_to_scroll == 0)
+ num_to_scroll = 1;
+
+ do_scroll_horizontal (LEFT_SCROLL, num_to_scroll);
}
-/* Scroll a window. Arguments are passed through a va_list. */
void
-tui_scroll (enum tui_scroll_direction direction,
- struct tui_win_info *win_to_scroll,
- int num_to_scroll)
+tui_win_info::right_scroll (int num_to_scroll)
{
- switch (direction)
- {
- case FORWARD_SCROLL:
- tui_scroll_forward (win_to_scroll, num_to_scroll);
- break;
- case BACKWARD_SCROLL:
- tui_scroll_backward (win_to_scroll, num_to_scroll);
- break;
- case LEFT_SCROLL:
- tui_scroll_left (win_to_scroll, num_to_scroll);
- break;
- case RIGHT_SCROLL:
- tui_scroll_right (win_to_scroll, num_to_scroll);
- break;
- default:
- break;
- }
+ if (num_to_scroll == 0)
+ num_to_scroll = 1;
+
+ do_scroll_horizontal (RIGHT_SCROLL, num_to_scroll);
}
{
case SRC_COMMAND:
case DISASSEM_COMMAND:
- first_win = tui_source_windows ()->list[0];
+ first_win = tui_source_windows ()[0];
first_win->generic.width += width_diff;
locator->width += width_diff;
/* Check for invalid heights. */
{
first_win = TUI_DATA_WIN;
first_win->generic.width += width_diff;
- second_win = tui_source_windows ()->list[0];
+ second_win = tui_source_windows ()[0];
second_win->generic.width += width_diff;
}
/* Change the first window's height/width. */
&& (tui_win_list[win_type] != NULL)
&& !tui_win_list[win_type]->generic.is_visible)
{
- tui_free_window (tui_win_list[win_type]);
+ delete tui_win_list[win_type];
tui_win_list[win_type] = NULL;
}
}
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
- tui_scroll (FORWARD_SCROLL, win_to_scroll, num_to_scroll);
+ win_to_scroll->forward_scroll (num_to_scroll);
}
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- parse_scrolling_args (arg, &win_to_scroll, (int *) NULL);
+ parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
- tui_scroll (BACKWARD_SCROLL, win_to_scroll, num_to_scroll);
+ win_to_scroll->backward_scroll (num_to_scroll);
}
/* Make sure the curses mode is enabled. */
tui_enable ();
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
- tui_scroll (LEFT_SCROLL, win_to_scroll, num_to_scroll);
+ win_to_scroll->left_scroll (num_to_scroll);
}
/* Make sure the curses mode is enabled. */
tui_enable ();
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
- tui_scroll (RIGHT_SCROLL, win_to_scroll, num_to_scroll);
+ win_to_scroll->right_scroll (num_to_scroll);
}
else
win_info = tui_partial_win_by_name (buf_ptr);
- if (win_info == (struct tui_win_info *) NULL
- || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->generic.is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
wname[i] = tolower (wname[i]);
win_info = tui_partial_win_by_name (wname);
- if (win_info == (struct tui_win_info *) NULL
- || !win_info->generic.is_visible)
+ if (win_info == NULL || !win_info->generic.is_visible)
warning (_("Invalid window specified. \n\
The window name specified must be valid and visible.\n"));
else
make_invisible_and_set_new_height (primary_win_info, new_height);
if (primary_win_info->generic.type == CMD_WIN)
{
- win_info = (tui_source_windows ())->list[0];
+ win_info = tui_source_windows ()[0];
src_win_info = win_info;
}
else
else
{
first_win = TUI_DATA_WIN;
- second_win = (tui_source_windows ())->list[0];
+ second_win = tui_source_windows ()[0];
}
if (primary_win_info == TUI_CMD_WIN)
{ /* Split the change in height accross the 1st & 2nd
win_info->generic.viewport_height--;
/* Now deal with the auxillary windows associated with win_info. */
+ tui_source_window_base *base;
switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- gen_win_info = win_info->detail.source_info.execution_info;
+ base = (tui_source_window_base *) win_info;
+ gen_win_info = base->execution_info;
tui_make_invisible (gen_win_info);
gen_win_info->height = height;
gen_win_info->origin.y = win_info->generic.origin.y;
if (win_info != TUI_CMD_WIN)
gen_win_info->viewport_height--;
- if (tui_win_has_locator (win_info))
+ if (win_info->has_locator ())
{
gen_win_info = tui_locator_win_info_ptr ();
tui_make_invisible (gen_win_info);
tui_make_visible (&win_info->generic);
tui_check_and_display_highlight_if_needed (win_info);
+ tui_source_window_base *base;
switch (win_info->generic.type)
{
case SRC_WIN:
case DISASSEM_WIN:
- tui_free_win_content (win_info->detail.source_info.execution_info);
- tui_make_visible (win_info->detail.source_info.execution_info);
+ 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)
{
- struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch;
+ struct gdbarch *gdbarch = base->gdbarch;
struct tui_line_or_address line_or_addr;
struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
- line_or_addr = win_info->detail.source_info.start_line_or_addr;
+ line_or_addr = base->start_line_or_addr;
tui_free_win_content (&win_info->generic);
tui_update_source_window (win_info, gdbarch,
cursal.symtab, line_or_addr, TRUE);
}
tui_update_source_window (win_info, gdbarch, s, line, TRUE);
}
- if (tui_win_has_locator (win_info))
+ if (win_info->has_locator ())
{
tui_make_visible (tui_locator_win_info_ptr ());
tui_show_locator_content ();
struct tui_win_info *win_info;
if (primary_win_info == TUI_CMD_WIN)
- win_info = (tui_source_windows ())->list[0];
+ win_info = tui_source_windows ()[0];
else
win_info = TUI_CMD_WIN;
ok = ((new_height +
else
{
first_win = TUI_DATA_WIN;
- second_win = (tui_source_windows ())->list[0];
+ second_win = tui_source_windows ()[0];
}
/* We could simply add all the heights to obtain the same
result but below is more explicit since we subtract 1 for
*win_to_scroll = tui_partial_win_by_name (wname);
- if (*win_to_scroll == (struct tui_win_info *) NULL
+ if (*win_to_scroll == NULL
|| !(*win_to_scroll)->generic.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)
- *win_to_scroll = (tui_source_windows ())->list[0];
+ *win_to_scroll = tui_source_windows ()[0];
}
}
}