public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change make_invisible_and_set_new_height to be a method
@ 2019-07-17 18:41 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-07-17 18:41 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=daa15dde7202d948da694bdfe0df9e5294c7ee9a

commit daa15dde7202d948da694bdfe0df9e5294c7ee9a
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jul 2 17:05:49 2019 -0600

    Change make_invisible_and_set_new_height to be a method
    
    This changes make_invisible_and_set_new_height to be a method on
    tui_win_info.  I felt that this was cleaner.
    
    gdb/ChangeLog
    2019-07-17  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-win.c (tui_resize_all)
    	(tui_source_window_base::update_tab_width)
    	(tui_adjust_win_heights): Update.
    	(tui_win_info::make_invisible_and_set_new_height): Rename from
    	make_invisible_and_set_new_height.
    	* tui/tui-data.h (struct tui_win_info)
    	<make_invisible_and_set_new_height>: New method.

Diff:
---
 gdb/ChangeLog      | 10 +++++++
 gdb/tui/tui-data.h |  5 ++++
 gdb/tui/tui-win.c  | 78 ++++++++++++++++++++++++------------------------------
 3 files changed, 50 insertions(+), 43 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 00c1f30..3c26381 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-win.c (tui_resize_all)
+	(tui_source_window_base::update_tab_width)
+	(tui_adjust_win_heights): Update.
+	(tui_win_info::make_invisible_and_set_new_height): Rename from
+	make_invisible_and_set_new_height.
+	* tui/tui-data.h (struct tui_win_info)
+	<make_invisible_and_set_new_height>: New method.
+
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui.c: Update.
 	* tui/tui-source.h (struct tui_source_window): Move from
 	tui-data.h.
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index aae1a6a..5b436a1 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -299,6 +299,11 @@ public:
   {
   }
 
+  /* Function make the target window (and auxiliary windows associated
+     with the target) invisible, and set the new height and
+     location.  */
+  void make_invisible_and_set_new_height (int height);
+
   /* Make the window visible after the height has been changed.  */
   void make_visible_with_new_height ();
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 124fdb1..227ab94 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -55,8 +55,6 @@
 /*******************************
 ** Static Local Decls
 ********************************/
-static void make_invisible_and_set_new_height (struct tui_win_info *, 
-					       int);
 static enum tui_status tui_adjust_win_heights (struct tui_win_info *, 
 					       int);
 static int new_height_ok (struct tui_win_info *, int);
@@ -601,11 +599,11 @@ tui_resize_all (void)
 	    new_height = first_win->height + split_diff;
 
 	  locator->origin.y = new_height + 1;
-	  make_invisible_and_set_new_height (first_win, new_height);
+	  first_win->make_invisible_and_set_new_height (new_height);
 	  TUI_CMD_WIN->origin.y = locator->origin.y + 1;
 	  TUI_CMD_WIN->width += width_diff;
 	  new_height = screenheight - TUI_CMD_WIN->origin.y;
-	  make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
+	  TUI_CMD_WIN->make_invisible_and_set_new_height (new_height);
 	  first_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
 	  if (src_win->content.empty ())
@@ -640,7 +638,7 @@ tui_resize_all (void)
 	    new_height = MIN_WIN_HEIGHT;
 	  else
 	    new_height = first_win->height + split_diff;
-	  make_invisible_and_set_new_height (first_win, new_height);
+	  first_win->make_invisible_and_set_new_height (new_height);
 
 	  locator->width += width_diff;
 
@@ -663,13 +661,12 @@ tui_resize_all (void)
 	  else
 	    new_height = second_win->height + split_diff;
 	  second_win->origin.y = first_win->height - 1;
-	  make_invisible_and_set_new_height (second_win, new_height);
+	  second_win->make_invisible_and_set_new_height (new_height);
 
 	  /* Change the command window's height/width.  */
 	  TUI_CMD_WIN->origin.y = locator->origin.y + 1;
-	  make_invisible_and_set_new_height (TUI_CMD_WIN,
-					     TUI_CMD_WIN->height
-					     + cmd_split_diff);
+	  TUI_CMD_WIN->make_invisible_and_set_new_height (TUI_CMD_WIN->height
+							  + cmd_split_diff);
 	  first_win->make_visible_with_new_height ();
 	  second_win->make_visible_with_new_height ();
 	  TUI_CMD_WIN->make_visible_with_new_height ();
@@ -911,7 +908,7 @@ tui_source_window_base::update_tab_width ()
      calling these 2 functions causes a complete regeneration
      and redisplay of the window's contents, which will take
      the new tab width into account.  */
-  make_invisible_and_set_new_height (this, height);
+  make_invisible_and_set_new_height (height);
   make_visible_with_new_height ();
 }
 
@@ -1081,7 +1078,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 	    {
 	      struct tui_win_info *src_win_info;
 
-	      make_invisible_and_set_new_height (primary_win_info, new_height);
+	      primary_win_info->make_invisible_and_set_new_height (new_height);
 	      if (primary_win_info->type == CMD_WIN)
 		{
 		  win_info = tui_source_windows ()[0];
@@ -1092,8 +1089,8 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 		  win_info = tui_win_list[CMD_WIN];
 		  src_win_info = primary_win_info;
 		}
-	      make_invisible_and_set_new_height (win_info,
-					     win_info->height + diff);
+	      win_info->make_invisible_and_set_new_height
+		(win_info->height + diff);
 	      TUI_CMD_WIN->origin.y = locator->origin.y + 1;
 	      win_info->make_visible_with_new_height ();
 	      primary_win_info->make_visible_with_new_height ();
@@ -1159,15 +1156,13 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 		      second_split_diff++;
 		      first_split_diff--;
 		    }
-		  make_invisible_and_set_new_height (
-						  first_win,
-				 first_win->height + first_split_diff);
+		  first_win->make_invisible_and_set_new_height
+		    (first_win->height + first_split_diff);
 		  second_win->origin.y = first_win->height - 1;
-		  make_invisible_and_set_new_height (second_win,
-						     second_win->height
-						     + second_split_diff);
+		  second_win->make_invisible_and_set_new_height
+		    (second_win->height + second_split_diff);
 		  TUI_CMD_WIN->origin.y = locator->origin.y + 1;
-		  make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
+		  TUI_CMD_WIN->make_invisible_and_set_new_height (new_height);
 		}
 	      else
 		{
@@ -1188,23 +1183,22 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
 			}
 		    }
 		  if (primary_win_info == first_win)
-		    make_invisible_and_set_new_height (first_win, new_height);
+		    first_win->make_invisible_and_set_new_height (new_height);
 		  else
-		    make_invisible_and_set_new_height (
-						    first_win,
-						  first_win->height);
+		    first_win->make_invisible_and_set_new_height
+		      (first_win->height);
 		  second_win->origin.y = first_win->height - 1;
 		  if (primary_win_info == second_win)
-		    make_invisible_and_set_new_height (second_win, new_height);
+		    second_win->make_invisible_and_set_new_height (new_height);
 		  else
-		    make_invisible_and_set_new_height (
-				      second_win, second_win->height);
+		    second_win->make_invisible_and_set_new_height
+		      (second_win->height);
 		  TUI_CMD_WIN->origin.y = locator->origin.y + 1;
 		  if ((TUI_CMD_WIN->height + diff) < 1)
-		    make_invisible_and_set_new_height (TUI_CMD_WIN, 1);
+		    TUI_CMD_WIN->make_invisible_and_set_new_height (1);
 		  else
-		    make_invisible_and_set_new_height (TUI_CMD_WIN,
-						       TUI_CMD_WIN->height + diff);
+		    TUI_CMD_WIN->make_invisible_and_set_new_height
+		      (TUI_CMD_WIN->height + diff);
 		}
 	      TUI_CMD_WIN->make_visible_with_new_height ();
 	      second_win->make_visible_with_new_height ();
@@ -1243,24 +1237,22 @@ tui_source_window_base::set_new_height (int height)
     }
 }
 
-/* Function make the target window (and auxiliary windows associated
-   with the targer) invisible, and set the new height and
-   location.  */
-static void
-make_invisible_and_set_new_height (struct tui_win_info *win_info, 
-				   int height)
+/* See tui-data.h.  */
+
+void
+tui_win_info::make_invisible_and_set_new_height (int height)
 {
-  win_info->make_visible (false);
-  win_info->height = height;
+  make_visible (false);
+  height = height;
   if (height > 1)
-    win_info->viewport_height = height - 1;
+    viewport_height = height - 1;
   else
-    win_info->viewport_height = height;
-  if (win_info != TUI_CMD_WIN)
-    win_info->viewport_height--;
+    viewport_height = height;
+  if (this != TUI_CMD_WIN)
+    viewport_height--;
 
   /* Now deal with the auxiliary windows associated with win_info.  */
-  win_info->set_new_height (height);
+  set_new_height (height);
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-17 18:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 18:41 [binutils-gdb] Change make_invisible_and_set_new_height to be a method Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).