From: Tom Tromey Date: Wed, 26 Jun 2019 22:07:45 +0000 (-0600) Subject: Introduce tui_data_window::erase_data_content method X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f76d8b19e80b43a141ce31c0e0230e23f676182d;p=binutils-gdb.git Introduce tui_data_window::erase_data_content method This changes tui_erase_data_content to be a method on tui_data_window, allowing for the removal of some uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey * tui/tui-windata.h (tui_erase_data_content): Don't declare. * tui/tui-windata.c (tui_data_window::erase_data_content): Rename from tui_erase_data_content. (tui_data_window::display_all_data) (tui_data_window::refresh_all) (tui_data_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-data.h (struct tui_data_window) : New method. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e75cbcbf01..03660912759 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2019-07-17 Tom Tromey + + * tui/tui-windata.h (tui_erase_data_content): Don't declare. + * tui/tui-windata.c (tui_data_window::erase_data_content): Rename + from tui_erase_data_content. + (tui_data_window::display_all_data) + (tui_data_window::refresh_all) + (tui_data_window::do_scroll_vertical): Update. + * tui/tui-regs.c (tui_show_registers): Update. + * tui/tui-data.h (struct tui_data_window) : + New method. + 2019-07-17 Tom Tromey * tui/tui-windata.h (tui_delete_data_content_windows): Don't diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 60963c9219f..306f4132819 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -511,6 +511,8 @@ struct tui_data_window : public tui_win_info done when the data window is scrolled. */ void delete_data_content_windows (); + void erase_data_content (const char *prompt); + protected: void do_scroll_vertical (int num_to_scroll) override; diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 59933639f6f..9b396e429e2 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -146,7 +146,7 @@ tui_show_registers (struct reggroup *group) if (ret == TUI_FAILURE) { TUI_DATA_WIN->current_group = 0; - tui_erase_data_content (NO_REGS_STRING); + TUI_DATA_WIN->erase_data_content (NO_REGS_STRING); } else { diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c index eaef1446c56..47d777a16a3 100644 --- a/gdb/tui/tui-windata.c +++ b/gdb/tui/tui-windata.c @@ -71,25 +71,22 @@ tui_data_window::delete_data_content_windows () void -tui_erase_data_content (const char *prompt) +tui_data_window::erase_data_content (const char *prompt) { - werase (TUI_DATA_WIN->handle); - tui_check_and_display_highlight_if_needed (TUI_DATA_WIN); + werase (handle); + tui_check_and_display_highlight_if_needed (this); if (prompt != NULL) { - int half_width = (TUI_DATA_WIN->width - 2) / 2; + int half_width = (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->handle, - (TUI_DATA_WIN->height / 2), - x_pos, - (char *) prompt); + mvwaddstr (handle, (height / 2), x_pos, (char *) prompt); } - wrefresh (TUI_DATA_WIN->handle); + wrefresh (handle); } /* See tui-data.h. */ @@ -98,10 +95,10 @@ void tui_data_window::display_all_data () { if (regs_content.empty ()) - tui_erase_data_content (NO_DATA_STRING); + erase_data_content (NO_DATA_STRING); else { - tui_erase_data_content (NULL); + erase_data_content (NULL); delete_data_content_windows (); tui_check_and_display_highlight_if_needed (this); tui_display_registers_from (0); @@ -113,7 +110,7 @@ tui_data_window::display_all_data () void tui_data_window::refresh_all () { - tui_erase_data_content (NULL); + erase_data_content (NULL); if (!regs_content.empty ()) { int first_element = first_data_item_displayed (); @@ -127,7 +124,7 @@ tui_data_window::refresh_all () if (first_line >= 0) { - tui_erase_data_content (NULL); + erase_data_content (NULL); tui_display_registers_from_line (first_line); } } @@ -153,7 +150,7 @@ tui_data_window::do_scroll_vertical (int num_to_scroll) if (first_line >= 0) { first_line += num_to_scroll; - tui_erase_data_content (NULL); + erase_data_content (NULL); delete_data_content_windows (); tui_display_registers_from_line (first_line); } diff --git a/gdb/tui/tui-windata.h b/gdb/tui/tui-windata.h index 419b22f3658..3b89eefabc0 100644 --- a/gdb/tui/tui-windata.h +++ b/gdb/tui/tui-windata.h @@ -24,6 +24,4 @@ #include "tui/tui-data.h" -extern void tui_erase_data_content (const char *); - #endif /* TUI_TUI_WINDATA_H */