OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [tui/] [tuiGeneralWin.c] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* General window behavior.
2
 
3
   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
4
   Inc.
5
 
6
   Contributed by Hewlett-Packard Company.
7
 
8
   This file is part of GDB.
9
 
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.
14
 
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.
19
 
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.  */
24
 
25
/* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
26
   "defs.h" should be included first.  Unfortunatly some systems
27
   (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
28
   and they clash with "bfd.h"'s definiton of true/false.  The correct
29
   fix is to remove true/false from "bfd.h", however, until that
30
   happens, hack around it by including "config.h" and <curses.h>
31
   first.  */
32
 
33
#include "config.h"
34
#ifdef HAVE_NCURSES_H       
35
#include <ncurses.h>
36
#else
37
#ifdef HAVE_CURSES_H
38
#include <curses.h>
39
#endif
40
#endif
41
 
42
#include "defs.h"
43
#include "tui.h"
44
#include "tuiData.h"
45
#include "tuiGeneralWin.h"
46
#include "tuiWin.h"
47
 
48
/***********************
49
** PUBLIC FUNCTIONS
50
***********************/
51
/*
52
   ** tuiRefreshWin()
53
   **        Refresh the window
54
 */
55
void
56
tuiRefreshWin (TuiGenWinInfoPtr winInfo)
57
{
58
  if (winInfo->type == DATA_WIN && winInfo->contentSize > 0)
59
    {
60
      int i;
61
 
62
      for (i = 0; (i < winInfo->contentSize); i++)
63
        {
64
          TuiGenWinInfoPtr dataItemWinPtr;
65
 
66
          dataItemWinPtr = &((TuiWinContent)
67
                             winInfo->content)[i]->whichElement.dataWindow;
68
          if (m_genWinPtrNotNull (dataItemWinPtr) &&
69
              dataItemWinPtr->handle != (WINDOW *) NULL)
70
            wrefresh (dataItemWinPtr->handle);
71
        }
72
    }
73
  else if (winInfo->type == CMD_WIN)
74
    {
75
      /* Do nothing */
76
    }
77
  else
78
    {
79
      if (winInfo->handle != (WINDOW *) NULL)
80
        wrefresh (winInfo->handle);
81
    }
82
 
83
  return;
84
}                               /* tuiRefreshWin */
85
 
86
 
87
/*
88
   ** tuiDelwin()
89
   **        Function to delete the curses window, checking for null
90
 */
91
void
92
tuiDelwin (WINDOW * window)
93
{
94
  if (window != (WINDOW *) NULL)
95
    delwin (window);
96
 
97
  return;
98
}                               /* tuiDelwin */
99
 
100
 
101
/* Draw a border arround the window.  */
102
void
103
boxWin (TuiGenWinInfoPtr winInfo, int highlightFlag)
104
{
105
  if (winInfo && winInfo->handle)
106
    {
107
      WINDOW *win;
108
      int attrs;
109
 
110
      win = winInfo->handle;
111
      if (highlightFlag == HILITE)
112
        attrs = tui_active_border_attrs;
113
      else
114
        attrs = tui_border_attrs;
115
 
116
      wattron (win, attrs);
117
      wborder (win, tui_border_vline, tui_border_vline,
118
               tui_border_hline, tui_border_hline,
119
               tui_border_ulcorner, tui_border_urcorner,
120
               tui_border_llcorner, tui_border_lrcorner);
121
      if (winInfo->title)
122
        mvwaddstr (win, 0, 3, winInfo->title);
123
      wattroff (win, attrs);
124
    }
125
}
126
 
127
 
128
/*
129
   ** unhighlightWin().
130
 */
131
void
132
unhighlightWin (TuiWinInfoPtr winInfo)
133
{
134
  if (m_winPtrNotNull (winInfo) && winInfo->generic.handle != (WINDOW *) NULL)
135
    {
136
      boxWin ((TuiGenWinInfoPtr) winInfo, NO_HILITE);
137
      wrefresh (winInfo->generic.handle);
138
      m_setWinHighlightOff (winInfo);
139
    }
140
}                               /* unhighlightWin */
141
 
142
 
143
/*
144
   ** highlightWin().
145
 */
146
void
147
highlightWin (TuiWinInfoPtr winInfo)
148
{
149
  if (m_winPtrNotNull (winInfo) &&
150
      winInfo->canHighlight && winInfo->generic.handle != (WINDOW *) NULL)
151
    {
152
      boxWin ((TuiGenWinInfoPtr) winInfo, HILITE);
153
      wrefresh (winInfo->generic.handle);
154
      m_setWinHighlightOn (winInfo);
155
    }
156
}                               /* highlightWin */
157
 
158
 
159
/*
160
   ** checkAndDisplayHighlightIfNecessay
161
 */
162
void
163
checkAndDisplayHighlightIfNeeded (TuiWinInfoPtr winInfo)
164
{
165
  if (m_winPtrNotNull (winInfo) && winInfo->generic.type != CMD_WIN)
166
    {
167
      if (winInfo->isHighlighted)
168
        highlightWin (winInfo);
169
      else
170
        unhighlightWin (winInfo);
171
 
172
    }
173
  return;
174
}                               /* checkAndDisplayHighlightIfNeeded */
175
 
176
 
177
/*
178
   ** makeWindow().
179
 */
180
void
181
makeWindow (TuiGenWinInfoPtr winInfo, int boxIt)
182
{
183
  WINDOW *handle;
184
 
185
  handle = newwin (winInfo->height,
186
                   winInfo->width,
187
                   winInfo->origin.y,
188
                   winInfo->origin.x);
189
  winInfo->handle = handle;
190
  if (handle != (WINDOW *) NULL)
191
    {
192
      if (boxIt == BOX_WINDOW)
193
        boxWin (winInfo, NO_HILITE);
194
      winInfo->isVisible = TRUE;
195
      scrollok (handle, TRUE);
196
    }
197
}
198
 
199
 
200
/*
201
   ** makeVisible().
202
   **        We can't really make windows visible, or invisible.  So we
203
   **        have to delete the entire window when making it visible,
204
   **        and create it again when making it visible.
205
 */
206
void
207
makeVisible (TuiGenWinInfoPtr winInfo, int visible)
208
{
209
  /* Don't tear down/recreate command window */
210
  if (winInfo->type == CMD_WIN)
211
    return;
212
 
213
  if (visible)
214
    {
215
      if (!winInfo->isVisible)
216
        {
217
          makeWindow (
218
                       winInfo,
219
           (winInfo->type != CMD_WIN && !m_winIsAuxillary (winInfo->type)));
220
          winInfo->isVisible = TRUE;
221
        }
222
    }
223
  else if (!visible &&
224
           winInfo->isVisible && winInfo->handle != (WINDOW *) NULL)
225
    {
226
      winInfo->isVisible = FALSE;
227
      tuiDelwin (winInfo->handle);
228
      winInfo->handle = (WINDOW *) NULL;
229
    }
230
 
231
  return;
232
}                               /* makeVisible */
233
 
234
 
235
/*
236
   ** makeAllVisible().
237
   **        Makes all windows invisible (except the command and locator windows)
238
 */
239
void
240
makeAllVisible (int visible)
241
{
242
  int i;
243
 
244
  for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
245
    {
246
      if (m_winPtrNotNull (winList[i]) &&
247
          ((winList[i])->generic.type) != CMD_WIN)
248
        {
249
          if (m_winIsSourceType ((winList[i])->generic.type))
250
            makeVisible ((winList[i])->detail.sourceInfo.executionInfo,
251
                         visible);
252
          makeVisible ((TuiGenWinInfoPtr) winList[i], visible);
253
        }
254
    }
255
 
256
  return;
257
}                               /* makeAllVisible */
258
 
259
/*
260
   ** refreshAll().
261
   **        Function to refresh all the windows currently displayed
262
 */
263
void
264
refreshAll (TuiWinInfoPtr * list)
265
{
266
  TuiWinType type;
267
  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
268
 
269
  for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
270
    {
271
      if (list[type] && list[type]->generic.isVisible)
272
        {
273
          if (type == SRC_WIN || type == DISASSEM_WIN)
274
            {
275
              touchwin (list[type]->detail.sourceInfo.executionInfo->handle);
276
              tuiRefreshWin (list[type]->detail.sourceInfo.executionInfo);
277
            }
278
          touchwin (list[type]->generic.handle);
279
          tuiRefreshWin (&list[type]->generic);
280
        }
281
    }
282
  if (locator->isVisible)
283
    {
284
      touchwin (locator->handle);
285
      tuiRefreshWin (locator);
286
    }
287
 
288
  return;
289
}                               /* refreshAll */
290
 
291
 
292
/*********************************
293
** Local Static Functions
294
*********************************/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.