Merge refresh and refresh_window methods
[deliverable/binutils-gdb.git] / gdb / tui / tui-wingeneral.c
index 98eb5abde16a0c8720930faaeb3ab1c98cd9d008..2902b8006b75621c371ec3a1fc1072aa1c1d5a48 100644 (file)
@@ -37,7 +37,10 @@ void
 tui_gen_win_info::refresh_window ()
 {
   if (handle != NULL)
-    wrefresh (handle);
+    {
+      touchwin (handle);
+      wrefresh (handle);
+    }
 }
 
 /* See tui-data.h.  */
@@ -45,20 +48,15 @@ tui_gen_win_info::refresh_window ()
 void
 tui_data_window::refresh_window ()
 {
-  if (content_size > 0)
+  if (!regs_content.empty ())
     {
-      for (int i = 0; i < content_size; i++)
+      for (auto &&win : regs_content)
        {
-         struct tui_gen_win_info *data_item_win_ptr;
-
-         data_item_win_ptr = content[i]->which_element.data_window;
-         if (data_item_win_ptr != NULL
-             && data_item_win_ptr->handle != NULL)
-           wrefresh (data_item_win_ptr->handle);
+         if (win != NULL)
+           win->refresh_window ();
        }
     }
-  else
-    tui_gen_win_info::refresh_window ();
+  tui_gen_win_info::refresh_window ();
 }
 
 /* Function to delete the curses window, checking for NULL.  */
@@ -67,8 +65,6 @@ tui_delete_win (WINDOW *window)
 {
   if (window != NULL)
     delwin (window);
-
-  return;
 }
 
 
@@ -134,7 +130,7 @@ tui_highlight_win (struct tui_win_info *win_info)
 void
 tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
 {
-  if (win_info != NULL && win_info->type != CMD_WIN)
+  if (win_info != NULL && win_info->can_highlight)
     {
       if (win_info->is_highlighted)
        tui_highlight_win (win_info);
@@ -176,7 +172,7 @@ tui_gen_win_info::make_visible (bool visible)
     {
       if (!is_visible)
        {
-         tui_make_window (this, (tui_win_is_auxillary (type)
+         tui_make_window (this, (tui_win_is_auxiliary (type)
                                  ? DONT_BOX_WINDOW : BOX_WINDOW));
          is_visible = true;
        }
@@ -218,15 +214,8 @@ tui_source_window_base::make_visible (bool visible)
 static void
 make_all_visible (bool visible)
 {
-  int i;
-
-  for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
-    {
-      if (tui_win_list[i] != NULL)
-       tui_win_list[i]->make_visible (visible);
-    }
-
-  return;
+  for (tui_win_info *win_info : all_tui_windows ())
+    win_info->make_visible (visible);
 }
 
 void
@@ -244,40 +233,26 @@ tui_make_all_invisible (void)
 /* See tui-data.h.  */
 
 void
-tui_win_info::refresh ()
+tui_source_window_base::refresh_window ()
 {
-  touchwin (handle);
-  refresh_window ();
-}
-
-/* See tui-data.h.  */
-
-void
-tui_source_window_base::refresh ()
-{
-  touchwin (execution_info->handle);
   execution_info->refresh_window ();
-  tui_win_info::refresh ();
+  tui_win_info::refresh_window ();
 }
 
 /* Function to refresh all the windows currently displayed.  */
 
 void
-tui_refresh_all (struct tui_win_info **list)
+tui_refresh_all ()
 {
-  int type;
-  struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+  struct tui_locator_window *locator = tui_locator_win_info_ptr ();
 
-  for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
+  for (tui_win_info *win_info : all_tui_windows ())
     {
-      if (list[type] && list[type]->is_visible)
-       list[type]->refresh ();
+      if (win_info->is_visible)
+       win_info->refresh_window ();
     }
   if (locator->is_visible)
-    {
-      touchwin (locator->handle);
-      locator->refresh_window ();
-    }
+    locator->refresh_window ();
 }
 
 
This page took 0.031502 seconds and 4 git commands to generate.