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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [tui/] [tui-wingeneral.c] - Blame information for rev 486

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

Line No. Rev Author Line
1 24 jeremybenn
/* General window behavior.
2
 
3
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
4
   Free Software Foundation, 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 3 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, see <http://www.gnu.org/licenses/>.  */
22
 
23
#include "defs.h"
24
#include "tui/tui.h"
25
#include "tui/tui-data.h"
26
#include "tui/tui-wingeneral.h"
27
#include "tui/tui-win.h"
28
 
29
#include "gdb_curses.h"
30
 
31
/***********************
32
** PUBLIC FUNCTIONS
33
***********************/
34
 
35
/* Refresh the window.  */
36
void
37
tui_refresh_win (struct tui_gen_win_info *win_info)
38
{
39
  if (win_info->type == DATA_WIN && win_info->content_size > 0)
40
    {
41
      int i;
42
 
43
      for (i = 0; (i < win_info->content_size); i++)
44
        {
45
          struct tui_gen_win_info *data_item_win_ptr;
46
 
47
          data_item_win_ptr = &((tui_win_content)
48
                                win_info->content)[i]->which_element.data_window;
49
          if (data_item_win_ptr != NULL
50
              && data_item_win_ptr->handle != (WINDOW *) NULL)
51
            wrefresh (data_item_win_ptr->handle);
52
        }
53
    }
54
  else if (win_info->type == CMD_WIN)
55
    {
56
      /* Do nothing.  */
57
    }
58
  else
59
    {
60
      if (win_info->handle != (WINDOW *) NULL)
61
        wrefresh (win_info->handle);
62
    }
63
 
64
  return;
65
}
66
 
67
 
68
/* Function to delete the curses window, checking for NULL.  */
69
void
70
tui_delete_win (WINDOW *window)
71
{
72
  if (window != (WINDOW *) NULL)
73
    delwin (window);
74
 
75
  return;
76
}
77
 
78
 
79
/* Draw a border arround the window.  */
80
void
81
box_win (struct tui_gen_win_info *win_info,
82
         int highlight_flag)
83
{
84
  if (win_info && win_info->handle)
85
    {
86
      WINDOW *win;
87
      int attrs;
88
 
89
      win = win_info->handle;
90
      if (highlight_flag == HILITE)
91
        attrs = tui_active_border_attrs;
92
      else
93
        attrs = tui_border_attrs;
94
 
95
      wattron (win, attrs);
96
#ifdef HAVE_WBORDER
97
      wborder (win, tui_border_vline, tui_border_vline,
98
               tui_border_hline, tui_border_hline,
99
               tui_border_ulcorner, tui_border_urcorner,
100
               tui_border_llcorner, tui_border_lrcorner);
101
#else
102
      box (win, tui_border_vline, tui_border_hline);
103
#endif
104
      if (win_info->title)
105
        mvwaddstr (win, 0, 3, win_info->title);
106
      wattroff (win, attrs);
107
    }
108
}
109
 
110
 
111
void
112
tui_unhighlight_win (struct tui_win_info *win_info)
113
{
114
  if (win_info != NULL
115
      && win_info->generic.handle != (WINDOW *) NULL)
116
    {
117
      box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
118
      wrefresh (win_info->generic.handle);
119
      tui_set_win_highlight (win_info, 0);
120
    }
121
}
122
 
123
 
124
void
125
tui_highlight_win (struct tui_win_info *win_info)
126
{
127
  if (win_info != NULL
128
      && win_info->can_highlight
129
      && win_info->generic.handle != (WINDOW *) NULL)
130
    {
131
      box_win ((struct tui_gen_win_info *) win_info, HILITE);
132
      wrefresh (win_info->generic.handle);
133
      tui_set_win_highlight (win_info, 1);
134
    }
135
}
136
 
137
void
138
tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
139
{
140
  if (win_info != NULL && win_info->generic.type != CMD_WIN)
141
    {
142
      if (win_info->is_highlighted)
143
        tui_highlight_win (win_info);
144
      else
145
        tui_unhighlight_win (win_info);
146
 
147
    }
148
  return;
149
}
150
 
151
 
152
void
153
tui_make_window (struct tui_gen_win_info *win_info, int box_it)
154
{
155
  WINDOW *handle;
156
 
157
  handle = newwin (win_info->height,
158
                   win_info->width,
159
                   win_info->origin.y,
160
                   win_info->origin.x);
161
  win_info->handle = handle;
162
  if (handle != (WINDOW *) NULL)
163
    {
164
      if (box_it == BOX_WINDOW)
165
        box_win (win_info, NO_HILITE);
166
      win_info->is_visible = TRUE;
167
      scrollok (handle, TRUE);
168
    }
169
}
170
 
171
 
172
/* We can't really make windows visible, or invisible.  So we have to
173
   delete the entire window when making it visible, and create it
174
   again when making it visible.  */
175
static void
176
make_visible (struct tui_gen_win_info *win_info, int visible)
177
{
178
  /* Don't tear down/recreate command window.  */
179
  if (win_info->type == CMD_WIN)
180
    return;
181
 
182
  if (visible)
183
    {
184
      if (!win_info->is_visible)
185
        {
186
          tui_make_window (win_info,
187
                           (win_info->type != CMD_WIN
188
                            && !tui_win_is_auxillary (win_info->type)));
189
          win_info->is_visible = TRUE;
190
        }
191
    }
192
  else if (!visible
193
           && win_info->is_visible
194
           && win_info->handle != (WINDOW *) NULL)
195
    {
196
      win_info->is_visible = FALSE;
197
      tui_delete_win (win_info->handle);
198
      win_info->handle = (WINDOW *) NULL;
199
    }
200
 
201
  return;
202
}
203
 
204
void
205
tui_make_visible (struct tui_gen_win_info *win_info)
206
{
207
  make_visible (win_info, 1);
208
}
209
 
210
void
211
tui_make_invisible (struct tui_gen_win_info *win_info)
212
{
213
  make_visible (win_info, 0);
214
}
215
 
216
 
217
/* Makes all windows invisible (except the command and locator
218
   windows).  */
219
static void
220
make_all_visible (int visible)
221
{
222
  int i;
223
 
224
  for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
225
    {
226
      if (tui_win_list[i] != NULL
227
          && ((tui_win_list[i])->generic.type) != CMD_WIN)
228
        {
229
          if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
230
            make_visible ((tui_win_list[i])->detail.source_info.execution_info,
231
                          visible);
232
          make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible);
233
        }
234
    }
235
 
236
  return;
237
}
238
 
239
void
240
tui_make_all_visible (void)
241
{
242
  make_all_visible (1);
243
}
244
 
245
void
246
tui_make_all_invisible (void)
247
{
248
  make_all_visible (0);
249
}
250
 
251
/* Function to refresh all the windows currently displayed.  */
252
 
253
void
254
tui_refresh_all (struct tui_win_info **list)
255
{
256
  enum tui_win_type type;
257
  struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
258
 
259
  for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
260
    {
261
      if (list[type] && list[type]->generic.is_visible)
262
        {
263
          if (type == SRC_WIN || type == DISASSEM_WIN)
264
            {
265
              touchwin (list[type]->detail.source_info.execution_info->handle);
266
              tui_refresh_win (list[type]->detail.source_info.execution_info);
267
            }
268
          touchwin (list[type]->generic.handle);
269
          tui_refresh_win (&list[type]->generic);
270
        }
271
    }
272
  if (locator->is_visible)
273
    {
274
      touchwin (locator->handle);
275
      tui_refresh_win (locator);
276
    }
277
}
278
 
279
 
280
/*********************************
281
** Local Static Functions
282
*********************************/

powered by: WebSVN 2.1.0

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