+2019-08-15 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-winsource.h (struct tui_source_window_base)
+ <do_erase_source_content>: New method.
+ <erase_source_content>: New method.
+ (tui_erase_source_content): Don't declare.
+ * tui/tui-winsource.c (tui_clear_source_content): Update.
+ (tui_source_window_base::do_erase_source_content): Rename from
+ tui_erase_source_content.
+ (tui_source_window_base::show_source_content): Update.
+ * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
+ * tui/tui-source.h (struct tui_source_window)
+ <erase_source_content>: New method.
+ * tui/tui-disasm.h (struct tui_disasm_window)
+ <erase_source_content>: New method.
+
2019-08-15 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
int line_no, CORE_ADDR addr)
override;
+ void erase_source_content () override
+ {
+ do_erase_source_content (NO_DISASSEM_STRING);
+ }
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
int line_no, CORE_ADDR addr)
override;
+ void erase_source_content () override
+ {
+ do_erase_source_content (NO_SRC_STRING);
+ }
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
first_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
if (src_win->content.empty ())
- tui_erase_source_content (src_win);
+ src_win->erase_source_content ();
break;
default:
if (cur_layout == SRC_DISASSEM_COMMAND)
second_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
if (src_win->content.empty ())
- tui_erase_source_content (src_win);
+ src_win->erase_source_content ();
break;
}
tui_source_window_base *src_base
= (tui_source_window_base *) src_win_info;
if (src_base->content.empty ())
- tui_erase_source_content (src_base);
+ src_base->erase_source_content ();
}
}
else
second_win->make_visible_with_new_height ();
first_win->make_visible_with_new_height ();
if (src1 != nullptr && src1->content.empty ())
- tui_erase_source_content (src1);
+ src1->erase_source_content ();
if (second_win->content.empty ())
- tui_erase_source_content (second_win);
+ second_win->erase_source_content ();
}
}
}
{
int i;
- tui_erase_source_content (win_info);
+ win_info->erase_source_content ();
for (i = 0; i < win_info->content.size (); i++)
{
struct tui_source_element *element = &win_info->content[i];
void
-tui_erase_source_content (struct tui_source_window_base *win_info)
+tui_source_window_base::do_erase_source_content (const char *str)
{
int x_pos;
- int half_width = (win_info->width - 2) / 2;
+ int half_width = (width - 2) / 2;
- if (win_info->handle != NULL)
+ if (handle != NULL)
{
- werase (win_info->handle);
- win_info->check_and_display_highlight_if_needed ();
+ werase (handle);
+ check_and_display_highlight_if_needed ();
- const char *no_src_str;
-
- if (win_info->type == SRC_WIN)
- no_src_str = NO_SRC_STRING;
- else
- no_src_str = NO_DISASSEM_STRING;
- if (strlen (no_src_str) >= half_width)
+ if (strlen (str) >= half_width)
x_pos = 1;
else
- x_pos = half_width - strlen (no_src_str);
- mvwaddstr (win_info->handle,
- (win_info->height / 2),
+ x_pos = half_width - strlen (str);
+ mvwaddstr (handle,
+ (height / 2),
x_pos,
- (char *) no_src_str);
-
- win_info->content.clear ();
- win_info->refresh_window ();
+ (char *) str);
- struct tui_gen_win_info *exec_info = win_info->execution_info;
+ content.clear ();
+ refresh_window ();
- werase (exec_info->handle);
- exec_info->refresh_window ();
+ werase (execution_info->handle);
+ execution_info->refresh_window ();
}
}
tui_show_source_line (this, lineno);
}
else
- tui_erase_source_content (this);
+ erase_source_content ();
check_and_display_highlight_if_needed ();
refresh_window ();
void do_scroll_horizontal (int num_to_scroll) override;
void do_make_visible_with_new_height () override;
+ /* Erase the content and display STRING. */
+ void do_erase_source_content (const char *string);
+
public:
void clear_detail ();
virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
int line_no, CORE_ADDR addr) = 0;
+ /* Erase the source content. */
+ virtual void erase_source_content () = 0;
+
/* Does the locator belong to this window? */
bool m_has_locator = false;
/* Execution information window. */
extern void tui_update_source_windows_with_line (struct symtab *,
int);
extern void tui_clear_source_content (struct tui_source_window_base *);
-extern void tui_erase_source_content (struct tui_source_window_base *);
/* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */