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"
30 struct tui_win_info
*tui_win_list
[MAX_MAJOR_WINDOWS
];
32 static int term_height
, term_width
;
33 static struct tui_win_info
*win_with_focus
= NULL
;
35 static bool win_resized
= false;
37 /* Answer a whether the terminal window has been resized or not. */
45 /* Set a whether the terminal window has been resized or not. */
47 tui_set_win_resized_to (bool resized
)
49 win_resized
= resized
;
53 /* Answer the window with the logical focus. */
55 tui_win_with_focus (void)
57 return win_with_focus
;
61 /* Set the window that has the logical focus. */
63 tui_set_win_with_focus (struct tui_win_info
*win_info
)
65 win_with_focus
= win_info
;
69 /* Accessor for the term_height. */
71 tui_term_height (void)
77 /* Mutator for the term height. */
79 tui_set_term_height_to (int h
)
85 /* Accessor for the term_width. */
93 /* Mutator for the term_width. */
95 tui_set_term_width_to (int w
)
101 /* Answer the next window in the list, cycling back to the top if
103 struct tui_win_info
*
104 tui_next_win (struct tui_win_info
*cur_win
)
106 int type
= cur_win
->type
;
107 struct tui_win_info
*next_win
= NULL
;
109 if (cur_win
->type
== CMD_WIN
)
112 type
= cur_win
->type
+ 1;
113 while (type
!= cur_win
->type
&& (next_win
== NULL
))
115 if (tui_win_list
[type
]
116 && tui_win_list
[type
]->is_visible ())
117 next_win
= tui_win_list
[type
];
131 /* Answer the prev window in the list, cycling back to the bottom if
133 struct tui_win_info
*
134 tui_prev_win (struct tui_win_info
*cur_win
)
136 int type
= cur_win
->type
;
137 struct tui_win_info
*prev
= NULL
;
139 if (cur_win
->type
== SRC_WIN
)
142 type
= cur_win
->type
- 1;
143 while (type
!= cur_win
->type
&& (prev
== NULL
))
145 if (tui_win_list
[type
]
146 && tui_win_list
[type
]->is_visible ())
147 prev
= tui_win_list
[type
];
161 /* See tui-data.h. */
164 tui_delete_invisible_windows ()
166 for (int win_type
= SRC_WIN
; (win_type
< MAX_MAJOR_WINDOWS
); win_type
++)
168 if (tui_win_list
[win_type
] != NULL
169 && !tui_win_list
[win_type
]->is_visible ())
171 /* This should always be made visible before a call to this
173 gdb_assert (win_type
!= CMD_WIN
);
175 if (win_with_focus
== tui_win_list
[win_type
])
176 win_with_focus
= nullptr;
178 delete tui_win_list
[win_type
];
179 tui_win_list
[win_type
] = NULL
;
184 tui_win_info::tui_win_info (enum tui_win_type type
)
185 : tui_gen_win_info (type
)
190 tui_win_info::rerender ()
192 check_and_display_highlight_if_needed ();
This page took 0.033639 seconds and 4 git commands to generate.