aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-wingeneral.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-13 16:47:31 -0600
committerTom Tromey <tom@tromey.com>2019-08-20 16:45:50 -0600
commitab0e1f1a4507f91536b583c57a492cb9d3aaf6f2 (patch)
treecea4886a288944d3af598bb3fc9d26af76dbd3ec /gdb/tui/tui-wingeneral.c
parent100c2bf31fa9bde80d997a5b39d1a07e0505a1cb (diff)
downloadbinutils-ab0e1f1a4507f91536b583c57a492cb9d3aaf6f2.zip
binutils-ab0e1f1a4507f91536b583c57a492cb9d3aaf6f2.tar.gz
binutils-ab0e1f1a4507f91536b583c57a492cb9d3aaf6f2.tar.bz2
Change tui_make_window to be a method
I combined several small changes into one patch here. I believe I started by noticing that the "title" is not needed by tui_gen_win_info and could be self-managing (i.e. std::string). Moving this revealed that "can_box" is also a property of tui_win_info and not tui_gen_win_info; and this in turn caused the changes to tui_make_window and box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Don't declare. * tui/tui-wingeneral.c (box_win): Change type of win_info. (box_win): Update. (tui_gen_win_info::make_window): Rename from tui_make_window. (tui_win_info::make_window): New method. (tui_gen_win_info::make_visible): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-regs.c (tui_data_window::show_register_group): Update. (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <make_window>: Declare. <can_box>: Remove. <title>: Remove. (struct tui_win_info) <make_window>: Declare. <can_box>: Now virtual. <title>: New member. * tui/tui-data.c (~tui_gen_win_info): Don't free title. * tui/tui-command.c (tui_cmd_window::resize): Update.
Diffstat (limited to 'gdb/tui/tui-wingeneral.c')
-rw-r--r--gdb/tui/tui-wingeneral.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 4e565bd..5fa4cfd 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -55,7 +55,7 @@ tui_delete_win (WINDOW *window)
/* Draw a border arround the window. */
static void
-box_win (struct tui_gen_win_info *win_info,
+box_win (struct tui_win_info *win_info,
int highlight_flag)
{
if (win_info && win_info->handle)
@@ -78,8 +78,8 @@ box_win (struct tui_gen_win_info *win_info,
#else
box (win, tui_border_vline, tui_border_hline);
#endif
- if (win_info->title)
- mvwaddstr (win, 0, 3, win_info->title);
+ if (!win_info->title.empty ())
+ mvwaddstr (win, 0, 3, win_info->title.c_str ());
wattroff (win, attrs);
}
}
@@ -126,23 +126,20 @@ tui_win_info::check_and_display_highlight_if_needed ()
void
-tui_make_window (struct tui_gen_win_info *win_info)
+tui_gen_win_info::make_window ()
{
- WINDOW *handle;
-
- handle = newwin (win_info->height,
- win_info->width,
- win_info->origin.y,
- win_info->origin.x);
- win_info->handle = handle;
+ handle = newwin (height, width, origin.y, origin.x);
if (handle != NULL)
- {
- if (win_info->can_box ())
- box_win (win_info, NO_HILITE);
- scrollok (handle, TRUE);
- }
+ scrollok (handle, TRUE);
}
+void
+tui_win_info::make_window ()
+{
+ tui_gen_win_info::make_window ();
+ if (handle != NULL && can_box ())
+ box_win (this, NO_HILITE);
+}
/* We can't really make windows visible, or invisible. So we have to
delete the entire window when making it visible, and create it
@@ -154,7 +151,7 @@ tui_gen_win_info::make_visible (bool visible)
return;
if (visible)
- tui_make_window (this);
+ make_window ();
else
{
tui_delete_win (handle);