1 /* TUI data manipulation routines.
3 Copyright (C) 1998-2019 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;
38 tui_win_is_auxiliary (enum tui_win_type win_type
)
40 return (win_type
> MAX_MAJOR_WINDOWS
);
43 /* Answer a whether the terminal window has been resized or not. */
51 /* Set a whether the terminal window has been resized or not. */
53 tui_set_win_resized_to (bool resized
)
55 win_resized
= resized
;
59 /* Answer the window with the logical focus. */
61 tui_win_with_focus (void)
63 return win_with_focus
;
67 /* Set the window that has the logical focus. */
69 tui_set_win_with_focus (struct tui_win_info
*win_info
)
71 win_with_focus
= win_info
;
75 /* Accessor for the term_height. */
77 tui_term_height (void)
83 /* Mutator for the term height. */
85 tui_set_term_height_to (int h
)
91 /* Accessor for the term_width. */
99 /* Mutator for the term_width. */
101 tui_set_term_width_to (int w
)
107 /* Answer the next window in the list, cycling back to the top if
109 struct tui_win_info
*
110 tui_next_win (struct tui_win_info
*cur_win
)
112 int type
= cur_win
->type
;
113 struct tui_win_info
*next_win
= NULL
;
115 if (cur_win
->type
== CMD_WIN
)
118 type
= cur_win
->type
+ 1;
119 while (type
!= cur_win
->type
&& (next_win
== NULL
))
121 if (tui_win_list
[type
]
122 && tui_win_list
[type
]->is_visible ())
123 next_win
= tui_win_list
[type
];
137 /* Answer the prev window in the list, cycling back to the bottom if
139 struct tui_win_info
*
140 tui_prev_win (struct tui_win_info
*cur_win
)
142 int type
= cur_win
->type
;
143 struct tui_win_info
*prev
= NULL
;
145 if (cur_win
->type
== SRC_WIN
)
148 type
= cur_win
->type
- 1;
149 while (type
!= cur_win
->type
&& (prev
== NULL
))
151 if (tui_win_list
[type
]
152 && tui_win_list
[type
]->is_visible ())
153 prev
= tui_win_list
[type
];
167 /* Answer the window represented by name. */
168 struct tui_win_info
*
169 tui_partial_win_by_name (const char *name
)
173 for (tui_win_info
*item
: all_tui_windows ())
175 const char *cur_name
= item
->name ();
177 if (strlen (name
) <= strlen (cur_name
)
178 && startswith (cur_name
, name
))
186 /* See tui-data.h. */
189 tui_delete_invisible_windows ()
191 for (int win_type
= SRC_WIN
; (win_type
< MAX_MAJOR_WINDOWS
); win_type
++)
193 if (tui_win_list
[win_type
] != NULL
194 && !tui_win_list
[win_type
]->is_visible ())
196 /* This should always be made visible before a call to this
198 gdb_assert (win_type
!= CMD_WIN
);
200 if (win_with_focus
== tui_win_list
[win_type
])
201 win_with_focus
= nullptr;
203 delete tui_win_list
[win_type
];
204 tui_win_list
[win_type
] = NULL
;
209 tui_win_info::tui_win_info (enum tui_win_type type
)
210 : tui_gen_win_info (type
)
214 tui_gen_win_info::~tui_gen_win_info ()
216 tui_delete_win (handle
);
220 tui_win_info::rerender ()
222 check_and_display_highlight_if_needed ();
This page took 0.034827 seconds and 5 git commands to generate.