Turn tui_first_data_item_displayed into a method

tui_first_data_item_displayed is only called from tui_data_window
methods, so turn it into a method as well.

gdb/ChangeLog
2019-06-25  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_first_data_item_displayed): Don't
	declare.
	* tui/tui-windata.c (tui_data_window::first_data_item_displayed):
	Rename from tui_first_data_item_displayed.  Update.
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-data.h (struct tui_data_window)
	<first_data_item_displayed>: Declare new method.
This commit is contained in:
Tom Tromey 2019-06-22 11:55:33 -06:00
parent 31ca47237f
commit eaf9738bed
4 changed files with 23 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-windata.h (tui_first_data_item_displayed): Don't
declare.
* tui/tui-windata.c (tui_data_window::first_data_item_displayed):
Rename from tui_first_data_item_displayed. Update.
(tui_data_window::refresh_all)
(tui_data_window::do_scroll_vertical): Update.
* tui/tui-data.h (struct tui_data_window)
<first_data_item_displayed>: Declare new method.
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-data.h (tui_init_generic_part): Don't declare.

View File

@ -505,6 +505,10 @@ protected:
{
}
void do_make_visible_with_new_height () override;
/* Return the index of the first element displayed. If none are
displayed, then return -1. */
int first_data_item_displayed ();
};
struct tui_cmd_window : public tui_win_info

View File

@ -42,25 +42,18 @@
/* Answer the index first element displayed. If none are displayed,
then return (-1). */
int
tui_first_data_item_displayed (void)
tui_data_window::first_data_item_displayed ()
{
int element_no = (-1);
int i;
for (i = 0;
i < TUI_DATA_WIN->content_size && element_no < 0;
i++)
for (int i = 0; i < content_size; i++)
{
struct tui_gen_win_info *data_item_win;
data_item_win
= TUI_DATA_WIN->content[i]->which_element.data_window;
if (data_item_win->handle != NULL
&& data_item_win->is_visible)
element_no = i;
data_item_win = content[i]->which_element.data_window;
if (data_item_win->handle != NULL && data_item_win->is_visible)
return i;
}
return element_no;
return -1;
}
@ -198,7 +191,7 @@ tui_data_window::refresh_all ()
tui_erase_data_content (NULL);
if (content_size > 0)
{
int first_element = tui_first_data_item_displayed ();
int first_element = first_data_item_displayed ();
if (first_element >= 0) /* Re-use existing windows. */
tui_display_data_from (first_element, TRUE);
@ -248,7 +241,7 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
int first_element_no;
int first_line = (-1);
first_element_no = tui_first_data_item_displayed ();
first_element_no = first_data_item_displayed ();
if (first_element_no < regs_content_count)
first_line = tui_line_from_reg_element_no (first_element_no);
else

View File

@ -28,7 +28,6 @@ extern void tui_erase_data_content (const char *);
extern void tui_display_all_data (void);
extern void tui_check_data_values (struct frame_info *);
extern void tui_display_data_from_line (int);
extern int tui_first_data_item_displayed (void);
extern void tui_delete_data_content_windows (void);
extern void tui_refresh_data_win (void);
extern void tui_display_data_from (int, int);