From patchwork Sun Jun 23 22:42:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33300 Received: (qmail 50633 invoked by alias); 23 Jun 2019 22:44:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 48779 invoked by uid 89); 23 Jun 2019 22:43:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 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=invisible, HX-Languages-Length:3598, PUBLIC, 3886 X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.49.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 22:43:45 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway23.websitewelcome.com (Postfix) with ESMTP id C64FB77F2 for ; Sun, 23 Jun 2019 17:43:43 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBD5hwglKdnCefBD5hWq2o; Sun, 23 Jun 2019 17:43:43 -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=U/mga8dNNbCWkNjsrwW3dyTCJW4Zp1SbpayklLPGduQ=; b=GcjGlk4FXJwpZItqm9tJKOygFe 9Q05txywTqBLsQZkNE56H7+1xvahtgUbNEa1wmcSZc7swC5LWclLRyv47GDwPR2jgV0QG9OFdz0QF 5cWgafCz8MA5fURAQS56al3S+; 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 1hfBD5-000vDQ-If; Sun, 23 Jun 2019 17:43:43 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 21/66] Introduce make_visible method Date: Sun, 23 Jun 2019 16:42:44 -0600 Message-Id: <20190623224329.16060-22-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This introduceds the make_visible to tui_win_info and overrides it in subclasses as appropriate. This allows the removal of the tui_win_is_source_type, as it is no longer used. gdb/ChangeLog 2019-06-23 Tom Tromey * tui/tui-wingeneral.c (tui_win_info::make_visible) (tui_source_window_base::make_visible): New methods. (make_all_visible): Make method call. * tui/tui-data.h (struct tui_win_info) : New method. (struct tui_source_window_base, struct tui_cmd_window): Override make_visible. (tui_win_is_source_type): Don't declare. * tui/tui-data.c (tui_win_is_source_type): Remove. --- gdb/ChangeLog | 11 +++++++++++ gdb/tui/tui-data.c | 6 ------ gdb/tui/tui-data.h | 10 +++++++++- gdb/tui/tui-wingeneral.c | 29 ++++++++++++++++++----------- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index c9c0bdf3f21..39381ea0859 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -63,12 +63,6 @@ static void free_content_elements (tui_win_content, ** PUBLIC FUNCTIONS **********************************/ -int -tui_win_is_source_type (enum tui_win_type win_type) -{ - return (win_type == SRC_WIN || win_type == DISASSEM_WIN); -} - int tui_win_is_auxillary (enum tui_win_type win_type) { diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 48c92bf99f0..249f3cc81f4 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -255,6 +255,9 @@ public: return false; } + /* Make this window visible or invisible. */ + virtual void make_visible (int visible); + /* 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. */ @@ -295,6 +298,8 @@ public: return m_has_locator; } + void make_visible (int visible) override; + /* Does locator belongs to this window? */ bool m_has_locator = false; /* Execution information window. */ @@ -388,6 +393,10 @@ struct tui_cmd_window : public tui_win_info void clear_detail () override; + void make_visible (int visible) override + { + } + int start_line = 0; protected: @@ -403,7 +412,6 @@ protected: } }; -extern int tui_win_is_source_type (enum tui_win_type win_type); extern int tui_win_is_auxillary (enum tui_win_type win_type); extern void tui_set_win_highlight (struct tui_win_info *win_info, int highlight); diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index 542881779fa..1308437befd 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -211,6 +211,22 @@ tui_make_invisible (struct tui_gen_win_info *win_info) make_visible (win_info, 0); } +/* See tui-data.h. */ + +void +tui_win_info::make_visible (int visible) +{ + ::make_visible (&generic, visible); +} + +/* See tui-data.h. */ + +void +tui_source_window_base::make_visible (int visible) +{ + ::make_visible (execution_info, visible); + tui_win_info::make_visible (visible); +} /* Makes all windows invisible (except the command and locator windows). */ @@ -221,17 +237,8 @@ make_all_visible (int visible) for (i = 0; i < MAX_MAJOR_WINDOWS; i++) { - if (tui_win_list[i] != NULL - && ((tui_win_list[i])->generic.type) != CMD_WIN) - { - if (tui_win_is_source_type ((tui_win_list[i])->generic.type)) - { - tui_source_window_base *base - = (tui_source_window_base *) tui_win_list[i]; - make_visible (base->execution_info, visible); - } - make_visible (&tui_win_list[i]->generic, visible); - } + if (tui_win_list[i] != NULL) + tui_win_list[i]->make_visible (visible); } return;