From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50875 invoked by alias); 23 Jun 2019 22:44:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 49041 invoked by uid 89); 23 Jun 2019 22:43:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:4565, Delete X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.51.6) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 22:43:46 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 0C4DF400E060A for ; Sun, 23 Jun 2019 16:42:07 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBD7hIMbL2PzOfBD7hXxvi; Sun, 23 Jun 2019 17:43:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kl8YNuW5p6Z3/UKgi0fPUiI0qF+gtcp4JBAbOTNQaT8=; b=SdDZ7em+2k4iVotY7SMDNpSnoJ IuRBpJNLsvbMbt+8TRMjzMSRoHovnONBSBCsG0iXKhSGSiGQrYVWkN9U7u+5HfpwHcI0xBGbKrTvk yN9HccKAfpYPfJLpCvOgtPqBy; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBD7-000vDQ-1O; Sun, 23 Jun 2019 17:43:45 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 26/66] Introduce set_new_height method Date: Sun, 23 Jun 2019 22:44:00 -0000 Message-Id: <20190623224329.16060-27-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> X-SW-Source: 2019-06/txt/msg00479.txt.bz2 This introduces tui_win_info::set_new_height and implements it in the subclasses as appropriate. This removes another switch on the window type. gdb/ChangeLog 2019-06-23 Tom Tromey * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_data_window::set_new_height): New methods. (make_invisible_and_set_new_height): Call set_new_height method. * tui/tui-data.h (struct tui_win_info) (struct tui_source_window_base, struct tui_data_window) : New method. --- gdb/ChangeLog | 9 ++++++ gdb/tui/tui-data.h | 10 ++++++ gdb/tui/tui-win.c | 78 ++++++++++++++++++++++------------------------ 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index e838c0e1622..e0d94d645be 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -267,6 +267,12 @@ public: { } + /* Called after a TUI window is given a new height; this updates any + related auxiliary windows. */ + virtual void set_new_height (int height) + { + } + /* Methods to scroll the contents of this window. Note that they are named with "_scroll" coming at the end because the more obvious "scroll_forward" is defined as a macro in term.h. */ @@ -318,6 +324,8 @@ public: /* Set the location of the execution point. */ void set_is_exec_point_at (struct tui_line_or_address l); + void set_new_height (int height) override; + /* Does locator belongs to this window? */ bool m_has_locator = false; /* Execution information window. */ @@ -380,6 +388,8 @@ struct tui_data_window : public tui_win_info void clear_detail () override; void refresh_all () override; + void set_new_height (int height) override; + /* Start of data display content. */ tui_win_content data_content = NULL; int data_content_count = 0; diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 383487e5f7a..fe1e901c741 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1242,6 +1242,43 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info, } +/* See tui-data.h. */ + +void +tui_source_window_base::set_new_height (int height) +{ + tui_make_invisible (execution_info); + execution_info->height = height; + execution_info->origin.y = generic.origin.y; + if (height > 1) + execution_info->viewport_height = height - 1; + else + execution_info->viewport_height = height; + execution_info->viewport_height--; + + if (has_locator ()) + { + tui_gen_win_info *gen_win_info = tui_locator_win_info_ptr (); + tui_make_invisible (gen_win_info); + gen_win_info->origin.y = generic.origin.y + height; + } +} + +/* See tui-data.h. */ + +void +tui_data_window::set_new_height (int height) +{ + /* Delete all data item windows. */ + for (int i = 0; i < generic.content_size; i++) + { + struct tui_gen_win_info *gen_win_info + = &generic.content[i]->which_element.data_window; + tui_delete_win (gen_win_info->handle); + gen_win_info->handle = NULL; + } +} + /* Function make the target window (and auxillary windows associated with the targer) invisible, and set the new height and location. */ @@ -1249,9 +1286,6 @@ static void make_invisible_and_set_new_height (struct tui_win_info *win_info, int height) { - int i; - struct tui_gen_win_info *gen_win_info; - tui_make_invisible (&win_info->generic); win_info->generic.height = height; if (height > 1) @@ -1262,43 +1296,7 @@ make_invisible_and_set_new_height (struct tui_win_info *win_info, win_info->generic.viewport_height--; /* Now deal with the auxillary windows associated with win_info. */ - tui_source_window_base *base; - switch (win_info->generic.type) - { - case SRC_WIN: - case DISASSEM_WIN: - base = (tui_source_window_base *) win_info; - gen_win_info = base->execution_info; - tui_make_invisible (gen_win_info); - gen_win_info->height = height; - gen_win_info->origin.y = win_info->generic.origin.y; - if (height > 1) - gen_win_info->viewport_height = height - 1; - else - gen_win_info->viewport_height = height; - if (win_info != TUI_CMD_WIN) - gen_win_info->viewport_height--; - - if (win_info->has_locator ()) - { - gen_win_info = tui_locator_win_info_ptr (); - tui_make_invisible (gen_win_info); - gen_win_info->origin.y = win_info->generic.origin.y + height; - } - break; - case DATA_WIN: - /* Delete all data item windows. */ - for (i = 0; i < win_info->generic.content_size; i++) - { - gen_win_info - = &win_info->generic.content[i]->which_element.data_window; - tui_delete_win (gen_win_info->handle); - gen_win_info->handle = NULL; - } - break; - default: - break; - } + win_info->set_new_height (height); } -- 2.17.2