Introduce enum tui_box
[deliverable/binutils-gdb.git] / gdb / tui / tui-wingeneral.c
index 06d7ad5a030b881d9cf67fc06eaa03c5b9ff1763..cfa4a08701cac0e7672e4c51b4a10a6e50adc966 100644 (file)
 ** PUBLIC FUNCTIONS
 ***********************/
 
-/* Refresh the window.  */
+/* See tui-data.h.  */
+
 void
-tui_refresh_win (struct tui_gen_win_info *win_info)
+tui_gen_win_info::refresh_window ()
 {
-  if (win_info->type == DATA_WIN && win_info->content_size > 0)
-    {
-      int i;
+  if (handle != NULL)
+    wrefresh (handle);
+}
+
+/* See tui-data.h.  */
 
-      for (i = 0; (i < win_info->content_size); i++)
+void
+tui_data_window::refresh_window ()
+{
+  if (content_size > 0)
+    {
+      for (int i = 0; i < content_size; i++)
        {
          struct tui_gen_win_info *data_item_win_ptr;
 
-         data_item_win_ptr = win_info->content[i]->which_element.data_window;
+         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);
        }
     }
-  else if (win_info->type == CMD_WIN)
-    {
-      /* Do nothing.  */
-    }
   else
-    {
-      if (win_info->handle != NULL)
-       wrefresh (win_info->handle);
-    }
-
-  return;
+    tui_gen_win_info::refresh_window ();
 }
 
-
 /* Function to delete the curses window, checking for NULL.  */
 void
 tui_delete_win (WINDOW *window)
@@ -148,7 +146,7 @@ tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
 
 
 void
-tui_make_window (struct tui_gen_win_info *win_info, int box_it)
+tui_make_window (struct tui_gen_win_info *win_info, enum tui_box box_it)
 {
   WINDOW *handle;
 
@@ -170,51 +168,38 @@ tui_make_window (struct tui_gen_win_info *win_info, int box_it)
 /* We can't really make windows visible, or invisible.  So we have to
    delete the entire window when making it visible, and create it
    again when making it visible.  */
-static void
-make_visible (struct tui_gen_win_info *win_info, bool visible)
+void
+tui_gen_win_info::make_visible (bool visible)
 {
-  /* Don't tear down/recreate command window.  */
-  if (win_info->type == CMD_WIN)
-    return;
-
   if (visible)
     {
-      if (!win_info->is_visible)
+      if (!is_visible)
        {
-         tui_make_window (win_info, !tui_win_is_auxillary (win_info->type));
-         win_info->is_visible = true;
+         tui_make_window (this, (tui_win_is_auxillary (type)
+                                 ? DONT_BOX_WINDOW : BOX_WINDOW));
+         is_visible = true;
        }
     }
   else if (!visible
-          && win_info->is_visible
-          && win_info->handle != NULL)
+          && is_visible
+          && handle != NULL)
     {
-      win_info->is_visible = false;
-      tui_delete_win (win_info->handle);
-      win_info->handle = NULL;
+      is_visible = false;
+      tui_delete_win (handle);
+      handle = NULL;
     }
-
-  return;
 }
 
 void
 tui_make_visible (struct tui_gen_win_info *win_info)
 {
-  make_visible (win_info, true);
+  win_info->make_visible (true);
 }
 
 void
 tui_make_invisible (struct tui_gen_win_info *win_info)
 {
-  make_visible (win_info, false);
-}
-
-/* See tui-data.h.  */
-
-void
-tui_win_info::make_visible (bool visible)
-{
-  ::make_visible (this, visible);
+  win_info->make_visible (false);
 }
 
 /* See tui-data.h.  */
@@ -222,7 +207,8 @@ tui_win_info::make_visible (bool visible)
 void
 tui_source_window_base::make_visible (bool visible)
 {
-  ::make_visible (execution_info, visible);
+  if (execution_info != nullptr)
+    execution_info->make_visible (visible);
   tui_win_info::make_visible (visible);
 }
 
@@ -260,7 +246,7 @@ void
 tui_win_info::refresh ()
 {
   touchwin (handle);
-  tui_refresh_win (this);
+  refresh_window ();
 }
 
 /* See tui-data.h.  */
@@ -269,7 +255,7 @@ void
 tui_source_window_base::refresh ()
 {
   touchwin (execution_info->handle);
-  tui_refresh_win (execution_info);
+  execution_info->refresh_window ();
   tui_win_info::refresh ();
 }
 
@@ -289,7 +275,7 @@ tui_refresh_all (struct tui_win_info **list)
   if (locator->is_visible)
     {
       touchwin (locator->handle);
-      tui_refresh_win (locator);
+      locator->refresh_window ();
     }
 }
 
This page took 0.026156 seconds and 4 git commands to generate.