+2019-06-25 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-win.c (window_name_completer, tui_set_focus)
+ (tui_all_windows_info): Use name method.
+ * tui/tui-data.h (struct tui_gen_win_info)
+ (struct tui_source_window, struct tui_disasm_window)
+ (struct tui_data_window, struct tui_cmd_window) <name>: New
+ method.
+ (tui_win_name): Don't declare.
+ * tui/tui-data.c (tui_partial_win_by_name): Use name method.
+ (tui_win_name): Remove.
+
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_update_source_window)
{
if (tui_win_list[i] != 0)
{
- const char *cur_name = tui_win_name (tui_win_list[i]);
+ const char *cur_name = tui_win_list[i]->name ();
if (strlen (name) <= strlen (cur_name)
&& startswith (cur_name, name))
}
-/* Answer the name of the window. */
-const char *
-tui_win_name (const struct tui_gen_win_info *win_info)
-{
- const char *name = NULL;
-
- switch (win_info->type)
- {
- case SRC_WIN:
- name = SRC_NAME;
- break;
- case CMD_WIN:
- name = CMD_NAME;
- break;
- case DISASSEM_WIN:
- name = DISASSEM_NAME;
- break;
- case DATA_WIN:
- name = DATA_NAME;
- break;
- default:
- name = "";
- break;
- }
-
- return name;
-}
-
-
void
tui_initialize_static_data (void)
{
/* Call to refresh this window. */
virtual void refresh_window ();
+ /* Return the name of this type of window. */
+ virtual const char *name () const
+ {
+ return "";
+ }
+
/* Window handle. */
WINDOW *handle = nullptr;
/* Type of window. */
DISABLE_COPY_AND_ASSIGN (tui_source_window);
+ const char *name () const override
+ {
+ return SRC_NAME;
+ }
+
protected:
void do_scroll_vertical (enum tui_scroll_direction,
DISABLE_COPY_AND_ASSIGN (tui_disasm_window);
+ const char *name () const override
+ {
+ return DISASSEM_NAME;
+ }
+
protected:
void do_scroll_vertical (enum tui_scroll_direction,
void refresh_window () override;
+ const char *name () const override
+ {
+ return DATA_NAME;
+ }
+
/* Start of data display content. */
tui_win_content data_content = NULL;
int data_content_count = 0;
{
}
+ const char *name () const override
+ {
+ return CMD_NAME;
+ }
+
int start_line = 0;
protected:
extern void tui_free_data_content (tui_win_content, int);
extern void tui_free_all_source_wins_content (void);
extern struct tui_win_info *tui_partial_win_by_name (const char *);
-extern const char *tui_win_name (const struct tui_gen_win_info *);
extern enum tui_layout_type tui_current_layout (void);
extern void tui_set_current_layout_to (enum tui_layout_type);
extern int tui_term_height (void);
|| !tui_win_list[win_type]->is_visible)
continue;
- completion_name = tui_win_name (tui_win_list [win_type]);
+ completion_name = tui_win_list[win_type]->name ();
gdb_assert (completion_name != NULL);
completion_name_vec.push_back (completion_name);
}
TUI_DATA_WIN->refresh_all ();
xfree (buf_ptr);
printf_filtered (_("Focus set to %s window.\n"),
- tui_win_name (tui_win_with_focus ()));
+ tui_win_with_focus ()->name ());
}
else
warning (_("Incorrect Number of Arguments.\n%s"), FOCUS_USAGE);
{
if (win_with_focus == tui_win_list[type])
printf_filtered (" %s\t(%d lines) <has focus>\n",
- tui_win_name (tui_win_list[type]),
+ tui_win_list[type]->name (),
tui_win_list[type]->height);
else
printf_filtered (" %s\t(%d lines)\n",
- tui_win_name (tui_win_list[type]),
+ tui_win_list[type]->name (),
tui_win_list[type]->height);
}
}