public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Change make_invisible_and_set_new_height to be a method
Date: Wed, 17 Jul 2019 18:41:00 -0000	[thread overview]
Message-ID: <20190717184124.92399.qmail@sourceware.org> (raw)

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);
 }


                 reply	other threads:[~2019-07-17 18:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190717184124.92399.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).