da3aaa681ee4aa1ac3004a3566834e20e5459d7e
1 /* General window behavior.
3 Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
6 Contributed by Hewlett-Packard Company.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
27 #include "tui/tui-data.h"
28 #include "tui/tui-wingeneral.h"
29 #include "tui/tui-win.h"
39 /***********************
41 ***********************/
43 /* Refresh the window. */
45 tui_refresh_win (struct tui_gen_win_info
* winInfo
)
47 if (winInfo
->type
== DATA_WIN
&& winInfo
->contentSize
> 0)
51 for (i
= 0; (i
< winInfo
->contentSize
); i
++)
53 struct tui_gen_win_info
* dataItemWinPtr
;
55 dataItemWinPtr
= &((tui_win_content
)
56 winInfo
->content
)[i
]->whichElement
.dataWindow
;
57 if (m_genWinPtrNotNull (dataItemWinPtr
) &&
58 dataItemWinPtr
->handle
!= (WINDOW
*) NULL
)
59 wrefresh (dataItemWinPtr
->handle
);
62 else if (winInfo
->type
== CMD_WIN
)
68 if (winInfo
->handle
!= (WINDOW
*) NULL
)
69 wrefresh (winInfo
->handle
);
76 /* Function to delete the curses window, checking for NULL. */
78 tui_delete_win (WINDOW
* window
)
80 if (window
!= (WINDOW
*) NULL
)
87 /* Draw a border arround the window. */
89 boxWin (struct tui_gen_win_info
* winInfo
, int highlightFlag
)
91 if (winInfo
&& winInfo
->handle
)
96 win
= winInfo
->handle
;
97 if (highlightFlag
== HILITE
)
98 attrs
= tui_active_border_attrs
;
100 attrs
= tui_border_attrs
;
102 wattron (win
, attrs
);
103 wborder (win
, tui_border_vline
, tui_border_vline
,
104 tui_border_hline
, tui_border_hline
,
105 tui_border_ulcorner
, tui_border_urcorner
,
106 tui_border_llcorner
, tui_border_lrcorner
);
108 mvwaddstr (win
, 0, 3, winInfo
->title
);
109 wattroff (win
, attrs
);
115 tui_unhighlight_win (struct tui_win_info
* winInfo
)
117 if (m_winPtrNotNull (winInfo
) && winInfo
->generic
.handle
!= (WINDOW
*) NULL
)
119 boxWin ((struct tui_gen_win_info
*) winInfo
, NO_HILITE
);
120 wrefresh (winInfo
->generic
.handle
);
121 m_setWinHighlightOff (winInfo
);
127 tui_highlight_win (struct tui_win_info
* winInfo
)
129 if (m_winPtrNotNull (winInfo
) &&
130 winInfo
->canHighlight
&& winInfo
->generic
.handle
!= (WINDOW
*) NULL
)
132 boxWin ((struct tui_gen_win_info
*) winInfo
, HILITE
);
133 wrefresh (winInfo
->generic
.handle
);
134 m_setWinHighlightOn (winInfo
);
139 tui_check_and_display_highlight_if_needed (struct tui_win_info
* winInfo
)
141 if (m_winPtrNotNull (winInfo
) && winInfo
->generic
.type
!= CMD_WIN
)
143 if (winInfo
->isHighlighted
)
144 tui_highlight_win (winInfo
);
146 tui_unhighlight_win (winInfo
);
154 tui_make_window (struct tui_gen_win_info
* winInfo
, int boxIt
)
158 handle
= newwin (winInfo
->height
,
162 winInfo
->handle
= handle
;
163 if (handle
!= (WINDOW
*) NULL
)
165 if (boxIt
== BOX_WINDOW
)
166 boxWin (winInfo
, NO_HILITE
);
167 winInfo
->isVisible
= TRUE
;
168 scrollok (handle
, TRUE
);
173 /* We can't really make windows visible, or invisible. So we have to
174 delete the entire window when making it visible, and create it
175 again when making it visible. */
177 make_visible (struct tui_gen_win_info
*win_info
, int visible
)
179 /* Don't tear down/recreate command window */
180 if (win_info
->type
== CMD_WIN
)
185 if (!win_info
->isVisible
)
187 tui_make_window (win_info
,
188 (win_info
->type
!= CMD_WIN
189 && !m_winIsAuxillary (win_info
->type
)));
190 win_info
->isVisible
= TRUE
;
194 win_info
->isVisible
&& win_info
->handle
!= (WINDOW
*) NULL
)
196 win_info
->isVisible
= FALSE
;
197 tui_delete_win (win_info
->handle
);
198 win_info
->handle
= (WINDOW
*) NULL
;
205 tui_make_visible (struct tui_gen_win_info
*win_info
)
207 make_visible (win_info
, 1);
211 tui_make_invisible (struct tui_gen_win_info
*win_info
)
213 make_visible (win_info
, 0);
217 /* Makes all windows invisible (except the command and locator windows). */
219 make_all_visible (int visible
)
223 for (i
= 0; i
< MAX_MAJOR_WINDOWS
; i
++)
225 if (m_winPtrNotNull (winList
[i
]) &&
226 ((winList
[i
])->generic
.type
) != CMD_WIN
)
228 if (m_winIsSourceType ((winList
[i
])->generic
.type
))
229 make_visible ((winList
[i
])->detail
.sourceInfo
.executionInfo
,
231 make_visible ((struct tui_gen_win_info
*) winList
[i
], visible
);
239 tui_make_all_visible (void)
241 make_all_visible (1);
245 tui_make_all_invisible (void)
247 make_all_visible (0);
250 /* Function to refresh all the windows currently displayed. */
253 tui_refresh_all (struct tui_win_info
* * list
)
256 struct tui_gen_win_info
* locator
= tui_locator_win_info_ptr ();
258 for (type
= SRC_WIN
; (type
< MAX_MAJOR_WINDOWS
); type
++)
260 if (list
[type
] && list
[type
]->generic
.isVisible
)
262 if (type
== SRC_WIN
|| type
== DISASSEM_WIN
)
264 touchwin (list
[type
]->detail
.sourceInfo
.executionInfo
->handle
);
265 tui_refresh_win (list
[type
]->detail
.sourceInfo
.executionInfo
);
267 touchwin (list
[type
]->generic
.handle
);
268 tui_refresh_win (&list
[type
]->generic
);
271 if (locator
->isVisible
)
273 touchwin (locator
->handle
);
274 tui_refresh_win (locator
);
281 /*********************************
282 ** Local Static Functions
283 *********************************/
This page took 0.039321 seconds and 4 git commands to generate.