+2019-06-25 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-winsource.c
+ (tui_source_window_base::do_scroll_horizontal): Remove direction
+ parameter.
+ * tui/tui-windata.c (tui_data_window::do_scroll_vertical): Remove
+ direction parameter.
+ * tui/tui-win.c (tui_win_info::forward_scroll)
+ (tui_win_info::backward_scroll, tui_win_info::left_scroll)
+ (tui_win_info::right_scroll): Update.
+ * tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove
+ direction parameter.
+ * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Remove
+ direction parameter.
+ * tui/tui-data.h (enum tui_scroll_direction): Remove.
+ (struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>:
+ Remove direction parameter.
+ (struct tui_source_window_base, struct tui_source_window)
+ (struct tui_disasm_window, struct tui_data_window)
+ (struct tui_cmd_window): Update.
+
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_set_exec_info_content)
#define MAX_TARGET_WIDTH 10
#define MAX_PID_WIDTH 19
-/* Scroll direction enum. */
-enum tui_scroll_direction
-{
- FORWARD_SCROLL,
- BACKWARD_SCROLL,
- LEFT_SCROLL,
- RIGHT_SCROLL
-};
-
-
/* The kinds of layouts available. */
enum tui_layout_type
{
/* Scroll the contents vertically. This is only called via
forward_scroll and backward_scroll. */
- virtual void do_scroll_vertical (enum tui_scroll_direction,
- int num_to_scroll) = 0;
+ virtual void do_scroll_vertical (int num_to_scroll) = 0;
/* Scroll the contents horizontally. This is only called via
left_scroll and right_scroll. */
- virtual void do_scroll_horizontal (enum tui_scroll_direction,
- int num_to_scroll) = 0;
+ virtual void do_scroll_horizontal (int num_to_scroll) = 0;
public:
~tui_source_window_base () override;
DISABLE_COPY_AND_ASSIGN (tui_source_window_base);
- void do_scroll_horizontal (enum tui_scroll_direction,
- int num_to_scroll) override;
+ void do_scroll_horizontal (int num_to_scroll) override;
public:
protected:
- void do_scroll_vertical (enum tui_scroll_direction,
- int num_to_scroll) override;
+ void do_scroll_vertical (int num_to_scroll) override;
};
/* A TUI disassembly window. */
protected:
- void do_scroll_vertical (enum tui_scroll_direction,
- int num_to_scroll) override;
+ void do_scroll_vertical (int num_to_scroll) override;
};
struct tui_data_window : public tui_win_info
protected:
- void do_scroll_vertical (enum tui_scroll_direction,
- int num_to_scroll) override;
- void do_scroll_horizontal (enum tui_scroll_direction,
- int num_to_scroll) override
+ void do_scroll_vertical (int num_to_scroll) override;
+ void do_scroll_horizontal (int num_to_scroll) override
{
}
};
protected:
- void do_scroll_vertical (enum tui_scroll_direction,
- int num_to_scroll) override
+ void do_scroll_vertical (int num_to_scroll) override
{
}
- void do_scroll_horizontal (enum tui_scroll_direction,
- int num_to_scroll) override
+ void do_scroll_horizontal (int num_to_scroll) override
{
}
};
/* Scroll the disassembly forward or backward vertically. */
void
-tui_disasm_window::do_scroll_vertical
- (enum tui_scroll_direction scroll_direction, int num_to_scroll)
+tui_disasm_window::do_scroll_vertical (int num_to_scroll)
{
if (content != NULL)
{
CORE_ADDR pc;
struct tui_line_or_address val;
- int dir;
pc = content[0]->which_element.source.line_or_addr.u.addr;
- num_to_scroll++;
- dir = (scroll_direction == FORWARD_SCROLL)
- ? num_to_scroll : -num_to_scroll;
+ if (num_to_scroll >= 0)
+ num_to_scroll++;
+ else
+ --num_to_scroll;
val.loa = LOA_ADDRESS;
- val.u.addr = tui_find_disassembly_address (gdbarch, pc, dir);
+ val.u.addr = tui_find_disassembly_address (gdbarch, pc, num_to_scroll);
tui_update_source_window_as_is (this, gdbarch,
NULL, val, FALSE);
}
/* Scroll the source forward or backward vertically. */
void
-tui_source_window::do_scroll_vertical
- (enum tui_scroll_direction scroll_direction, int num_to_scroll)
+tui_source_window::do_scroll_vertical (int num_to_scroll)
{
if (content != NULL)
{
s = cursal.symtab;
l.loa = LOA_LINE;
- if (scroll_direction == FORWARD_SCROLL)
- {
- l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
- + num_to_scroll;
- if (l.u.line_no > s->nlines)
- /* line = s->nlines - win_info->content_size + 1; */
- /* elz: fix for dts 23398. */
- l.u.line_no
- = content[0]->which_element.source.line_or_addr.u.line_no;
- }
- else
- {
- l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
- - num_to_scroll;
- if (l.u.line_no <= 0)
- l.u.line_no = 1;
- }
+ l.u.line_no = content[0]->which_element.source.line_or_addr.u.line_no
+ + num_to_scroll;
+ if (l.u.line_no > s->nlines)
+ /* line = s->nlines - win_info->content_size + 1; */
+ /* elz: fix for dts 23398. */
+ l.u.line_no
+ = content[0]->which_element.source.line_or_addr.u.line_no;
+ if (l.u.line_no <= 0)
+ l.u.line_no = 1;
print_source_lines (s, l.u.line_no, l.u.line_no + 1, 0);
}
if (num_to_scroll == 0)
num_to_scroll = height - 3;
- do_scroll_vertical (FORWARD_SCROLL, num_to_scroll);
+ do_scroll_vertical (num_to_scroll);
}
void
if (num_to_scroll == 0)
num_to_scroll = height - 3;
- do_scroll_vertical (BACKWARD_SCROLL, num_to_scroll);
+ do_scroll_vertical (-num_to_scroll);
}
if (num_to_scroll == 0)
num_to_scroll = 1;
- do_scroll_horizontal (LEFT_SCROLL, num_to_scroll);
+ do_scroll_horizontal (num_to_scroll);
}
if (num_to_scroll == 0)
num_to_scroll = 1;
- do_scroll_horizontal (RIGHT_SCROLL, num_to_scroll);
+ do_scroll_horizontal (-num_to_scroll);
}
/* Scroll the data window vertically forward or backward. */
void
-tui_data_window::do_scroll_vertical
- (enum tui_scroll_direction scroll_direction, int num_to_scroll)
+tui_data_window::do_scroll_vertical (int num_to_scroll)
{
int first_element_no;
int first_line = (-1);
if (first_line >= 0)
{
- if (scroll_direction == FORWARD_SCROLL)
- first_line += num_to_scroll;
- else
- first_line -= num_to_scroll;
+ first_line += num_to_scroll;
tui_erase_data_content (NULL);
tui_delete_data_content_windows ();
tui_display_data_from_line (first_line);
/* Scroll the source forward or backward horizontally. */
void
-tui_source_window_base::do_scroll_horizontal
- (enum tui_scroll_direction direction, int num_to_scroll)
+tui_source_window_base::do_scroll_horizontal (int num_to_scroll)
{
if (content != NULL)
{
- int offset;
-
- if (direction == LEFT_SCROLL)
- offset = horizontal_offset + num_to_scroll;
- else
- {
- offset = horizontal_offset - num_to_scroll;
- if (offset < 0)
- offset = 0;
- }
+ int offset = horizontal_offset + num_to_scroll;
+ if (offset < 0)
+ offset = 0;
horizontal_offset = offset;
refill ();
}