Introduce tui_data_window::erase_data_content method
authorTom Tromey <tom@tromey.com>
Wed, 26 Jun 2019 22:07:45 +0000 (16:07 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jul 2019 18:18:59 +0000 (12:18 -0600)
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  <tom@tromey.com>

* 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) <erase_data_content>:
New method.

gdb/ChangeLog
gdb/tui/tui-data.h
gdb/tui/tui-regs.c
gdb/tui/tui-windata.c
gdb/tui/tui-windata.h

index 3e75cbc..0366091 100644 (file)
@@ -1,5 +1,17 @@
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
+       * 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) <erase_data_content>:
+       New method.
+
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
        * tui/tui-windata.h (tui_delete_data_content_windows): Don't
        declare.
        * tui/tui-windata.c
index 60963c9..306f413 100644 (file)
@@ -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;
index 5993363..9b396e4 100644 (file)
@@ -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
     {
index eaef144..47d777a 100644 (file)
@@ -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);
     }
index 419b22f..3b89eef 100644 (file)
@@ -24,6 +24,4 @@
 
 #include "tui/tui-data.h"
 
-extern void tui_erase_data_content (const char *);
-
 #endif /* TUI_TUI_WINDATA_H */