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-wingeneral.h"
27 #include "tui/tui-winsource.h"
28 #include "gdb_curses.h"
31 struct tui_win_info
*tui_win_list
[MAX_MAJOR_WINDOWS
];
33 static int term_height
, term_width
;
34 static struct tui_win_info
*win_with_focus
= NULL
;
36 static bool win_resized
= false;
38 /* Answer a whether the terminal window has been resized or not. */
46 /* Set a whether the terminal window has been resized or not. */
48 tui_set_win_resized_to (bool resized
)
50 win_resized
= resized
;
54 /* Answer the window with the logical focus. */
56 tui_win_with_focus (void)
58 return win_with_focus
;
62 /* Set the window that has the logical focus. */
64 tui_set_win_with_focus (struct tui_win_info
*win_info
)
66 win_with_focus
= win_info
;
70 /* Accessor for the term_height. */
72 tui_term_height (void)
78 /* Mutator for the term height. */
80 tui_set_term_height_to (int h
)
86 /* Accessor for the term_width. */
94 /* Mutator for the term_width. */
96 tui_set_term_width_to (int w
)
102 /* Answer the next window in the list, cycling back to the top if
104 struct tui_win_info
*
105 tui_next_win (struct tui_win_info
*cur_win
)
107 auto iter
= std::find (tui_windows
.begin (), tui_windows
.end (), cur_win
);
108 gdb_assert (iter
!= tui_windows
.end ());
111 if (iter
== tui_windows
.end ())
112 return tui_windows
[0];
117 /* Answer the prev window in the list, cycling back to the bottom if
119 struct tui_win_info
*
120 tui_prev_win (struct tui_win_info
*cur_win
)
122 auto iter
= std::find (tui_windows
.begin (), tui_windows
.end (), cur_win
);
123 gdb_assert (iter
!= tui_windows
.end ());
125 if (iter
== tui_windows
.begin ())
126 return tui_windows
.back ();
132 /* See tui-data.h. */
135 tui_delete_invisible_windows ()
137 for (int win_type
= SRC_WIN
; (win_type
< MAX_MAJOR_WINDOWS
); win_type
++)
139 if (tui_win_list
[win_type
] != NULL
140 && !tui_win_list
[win_type
]->is_visible ())
142 /* This should always be made visible before a call to this
144 gdb_assert (win_type
!= CMD_WIN
);
146 if (win_with_focus
== tui_win_list
[win_type
])
147 win_with_focus
= nullptr;
149 delete tui_win_list
[win_type
];
150 tui_win_list
[win_type
] = NULL
;
155 tui_win_info::tui_win_info (enum tui_win_type type
)
156 : tui_gen_win_info (type
)
161 tui_win_info::rerender ()
163 check_and_display_highlight_if_needed ();
This page took 0.034537 seconds and 4 git commands to generate.