]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/tui/tui-data.c
8f7d257e9457a8ef344b56f198e9f722abae6317
1 /* TUI data manipulation routines.
3 Copyright (C) 1998-2020 Free Software Foundation, Inc.
5 Contributed by Hewlett-Packard Company.
7 This file is part of GDB.
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
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "tui/tui-data.h"
26 #include "tui/tui-win.h"
27 #include "tui/tui-wingeneral.h"
28 #include "tui/tui-winsource.h"
29 #include "gdb_curses.h"
32 struct tui_win_info
*tui_win_list
[MAX_MAJOR_WINDOWS
];
34 static int term_height
, term_width
;
35 static struct tui_win_info
*win_with_focus
= NULL
;
37 static bool win_resized
= false;
39 /* Answer a whether the terminal window has been resized or not. */
47 /* Set a whether the terminal window has been resized or not. */
49 tui_set_win_resized_to (bool resized
)
51 win_resized
= resized
;
55 /* Answer the window with the logical focus. */
57 tui_win_with_focus (void)
59 return win_with_focus
;
63 /* Set the logical focus to win_info. */
65 tui_set_win_focus_to (struct tui_win_info
*win_info
)
69 tui_unhighlight_win (win_with_focus
);
70 win_with_focus
= win_info
;
71 tui_highlight_win (win_info
);
76 /* Accessor for the term_height. */
78 tui_term_height (void)
84 /* Mutator for the term height. */
86 tui_set_term_height_to (int h
)
92 /* Accessor for the term_width. */
100 /* Mutator for the term_width. */
102 tui_set_term_width_to (int w
)
108 /* Answer the next window in the list, cycling back to the top if
110 struct tui_win_info
*
111 tui_next_win (struct tui_win_info
*cur_win
)
113 auto iter
= std::find (tui_windows
.begin (), tui_windows
.end (), cur_win
);
114 gdb_assert (iter
!= tui_windows
.end ());
117 if (iter
== tui_windows
.end ())
118 return tui_windows
[0];
123 /* Answer the prev window in the list, cycling back to the bottom if
125 struct tui_win_info
*
126 tui_prev_win (struct tui_win_info
*cur_win
)
128 auto iter
= std::find (tui_windows
.begin (), tui_windows
.end (), cur_win
);
129 gdb_assert (iter
!= tui_windows
.end ());
131 if (iter
== tui_windows
.begin ())
132 return tui_windows
.back ();
139 tui_win_info::rerender ()
141 check_and_display_highlight_if_needed ();