Commit | Line | Data |
---|---|---|
f377b406 | 1 | /* TUI display registers in window. |
55fb0713 | 2 | |
42a4f53d | 3 | Copyright (C) 1998-2019 Free Software Foundation, Inc. |
55fb0713 | 4 | |
f377b406 SC |
5 | Contributed by Hewlett-Packard Company. |
6 | ||
7 | This file is part of GDB. | |
8 | ||
9 | This program is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 11 | the Free Software Foundation; either version 3 of the License, or |
f377b406 SC |
12 | (at your option) any later version. |
13 | ||
14 | This program is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
f377b406 | 21 | |
1a5c2598 TT |
22 | #ifndef TUI_TUI_REGS_H |
23 | #define TUI_TUI_REGS_H | |
c906108c | 24 | |
18ab23af TT |
25 | #include "tui/tui-data.h" |
26 | ||
96bd6233 TT |
27 | /* A data item window. */ |
28 | ||
29 | struct tui_data_item_window : public tui_gen_win_info | |
30 | { | |
31 | tui_data_item_window () | |
32 | : tui_gen_win_info (DATA_ITEM_WIN) | |
33 | { | |
34 | } | |
35 | ||
fa4dc567 TT |
36 | DISABLE_COPY_AND_ASSIGN (tui_data_item_window); |
37 | ||
38 | tui_data_item_window (tui_data_item_window &&) = default; | |
39 | ||
cdaa6eb4 TT |
40 | void rerender () override; |
41 | ||
42 | void refresh_window () override; | |
43 | ||
96bd6233 TT |
44 | const char *name = nullptr; |
45 | /* The register number, or data display number. */ | |
46 | int item_no = -1; | |
96bd6233 | 47 | bool highlight = false; |
b9ad3686 | 48 | gdb::unique_xmalloc_ptr<char> content; |
96bd6233 TT |
49 | }; |
50 | ||
18ab23af TT |
51 | /* The TUI registers window. */ |
52 | struct tui_data_window : public tui_win_info | |
53 | { | |
54 | tui_data_window () | |
55 | : tui_win_info (DATA_WIN) | |
56 | { | |
57 | } | |
58 | ||
59 | DISABLE_COPY_AND_ASSIGN (tui_data_window); | |
60 | ||
18ab23af TT |
61 | void refresh_window () override; |
62 | ||
63 | const char *name () const override | |
64 | { | |
65 | return DATA_NAME; | |
66 | } | |
67 | ||
04c72a68 | 68 | void check_register_values (struct frame_info *frame); |
18ab23af | 69 | |
04c72a68 | 70 | void show_registers (struct reggroup *group); |
18ab23af | 71 | |
89df7f90 TT |
72 | struct reggroup *get_current_group () const |
73 | { | |
74 | return current_group; | |
75 | } | |
76 | ||
04c72a68 | 77 | protected: |
18ab23af | 78 | |
04c72a68 TT |
79 | void do_scroll_vertical (int num_to_scroll) override; |
80 | void do_scroll_horizontal (int num_to_scroll) override | |
81 | { | |
82 | } | |
18ab23af | 83 | |
04c72a68 | 84 | void rerender () override; |
18ab23af | 85 | |
04c72a68 | 86 | private: |
18ab23af TT |
87 | |
88 | /* Display the registers in the content from 'start_element_no' | |
89 | until the end of the register content or the end of the display | |
90 | height. No checking for displaying past the end of the registers | |
91 | is done here. */ | |
92 | void display_registers_from (int start_element_no); | |
93 | ||
94 | /* Display the registers starting at line line_no in the data | |
95 | window. Answers the line number that the display actually | |
96 | started from. If nothing is displayed (-1) is returned. */ | |
97 | int display_registers_from_line (int line_no); | |
98 | ||
18ab23af TT |
99 | /* Return the index of the first element displayed. If none are |
100 | displayed, then return -1. */ | |
101 | int first_data_item_displayed (); | |
102 | ||
103 | /* Display the registers in the content from 'start_element_no' on | |
104 | 'start_line_no' until the end of the register content or the end | |
105 | of the display height. This function checks that we won't | |
106 | display off the end of the register display. */ | |
107 | void display_reg_element_at_line (int start_element_no, int start_line_no); | |
3df505f6 | 108 | |
ca02d7c8 TT |
109 | void show_register_group (struct reggroup *group, |
110 | struct frame_info *frame, | |
111 | int refresh_values_only); | |
04c72a68 TT |
112 | |
113 | /* Answer the number of the last line in the regs display. If there | |
114 | are no registers (-1) is returned. */ | |
115 | int last_regs_line_no () const; | |
116 | ||
117 | /* Answer the line number that the register element at element_no is | |
118 | on. If element_no is greater than the number of register | |
119 | elements there are, -1 is returned. */ | |
120 | int line_from_reg_element_no (int element_no) const; | |
121 | ||
122 | /* Answer the index of the first element in line_no. If line_no is | |
123 | past the register area (-1) is returned. */ | |
124 | int first_reg_element_no_inline (int line_no) const; | |
125 | ||
04c72a68 TT |
126 | /* Delete all the item windows in the data window. This is usually |
127 | done when the data window is scrolled. */ | |
128 | void delete_data_content_windows (); | |
129 | ||
130 | void erase_data_content (const char *prompt); | |
89df7f90 TT |
131 | |
132 | /* Windows that are used to display registers. */ | |
133 | std::vector<tui_data_item_window> regs_content; | |
134 | int regs_column_count = 0; | |
135 | struct reggroup *current_group = nullptr; | |
ca02d7c8 | 136 | }; |
c906108c | 137 | |
1a5c2598 | 138 | #endif /* TUI_TUI_REGS_H */ |