OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [tui/] [tui-wingeneral.c] - Diff between revs 157 and 223

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
/* General window behavior.
/* General window behavior.
 
 
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
 
 
   Contributed by Hewlett-Packard Company.
   Contributed by Hewlett-Packard Company.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#include "defs.h"
#include "defs.h"
#include "tui/tui.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
#include "tui/tui-data.h"
#include "tui/tui-wingeneral.h"
#include "tui/tui-wingeneral.h"
#include "tui/tui-win.h"
#include "tui/tui-win.h"
 
 
#include "gdb_curses.h"
#include "gdb_curses.h"
 
 
/***********************
/***********************
** PUBLIC FUNCTIONS
** PUBLIC FUNCTIONS
***********************/
***********************/
 
 
/* Refresh the window.  */
/* Refresh the window.  */
void
void
tui_refresh_win (struct tui_gen_win_info *win_info)
tui_refresh_win (struct tui_gen_win_info *win_info)
{
{
  if (win_info->type == DATA_WIN && win_info->content_size > 0)
  if (win_info->type == DATA_WIN && win_info->content_size > 0)
    {
    {
      int i;
      int i;
 
 
      for (i = 0; (i < win_info->content_size); i++)
      for (i = 0; (i < win_info->content_size); i++)
        {
        {
          struct tui_gen_win_info *data_item_win_ptr;
          struct tui_gen_win_info *data_item_win_ptr;
 
 
          data_item_win_ptr = &((tui_win_content)
          data_item_win_ptr = &((tui_win_content)
                                win_info->content)[i]->which_element.data_window;
                                win_info->content)[i]->which_element.data_window;
          if (data_item_win_ptr != NULL
          if (data_item_win_ptr != NULL
              && data_item_win_ptr->handle != (WINDOW *) NULL)
              && data_item_win_ptr->handle != (WINDOW *) NULL)
            wrefresh (data_item_win_ptr->handle);
            wrefresh (data_item_win_ptr->handle);
        }
        }
    }
    }
  else if (win_info->type == CMD_WIN)
  else if (win_info->type == CMD_WIN)
    {
    {
      /* Do nothing.  */
      /* Do nothing.  */
    }
    }
  else
  else
    {
    {
      if (win_info->handle != (WINDOW *) NULL)
      if (win_info->handle != (WINDOW *) NULL)
        wrefresh (win_info->handle);
        wrefresh (win_info->handle);
    }
    }
 
 
  return;
  return;
}
}
 
 
 
 
/* Function to delete the curses window, checking for NULL.  */
/* Function to delete the curses window, checking for NULL.  */
void
void
tui_delete_win (WINDOW *window)
tui_delete_win (WINDOW *window)
{
{
  if (window != (WINDOW *) NULL)
  if (window != (WINDOW *) NULL)
    delwin (window);
    delwin (window);
 
 
  return;
  return;
}
}
 
 
 
 
/* Draw a border arround the window.  */
/* Draw a border arround the window.  */
void
void
box_win (struct tui_gen_win_info *win_info,
box_win (struct tui_gen_win_info *win_info,
         int highlight_flag)
         int highlight_flag)
{
{
  if (win_info && win_info->handle)
  if (win_info && win_info->handle)
    {
    {
      WINDOW *win;
      WINDOW *win;
      int attrs;
      int attrs;
 
 
      win = win_info->handle;
      win = win_info->handle;
      if (highlight_flag == HILITE)
      if (highlight_flag == HILITE)
        attrs = tui_active_border_attrs;
        attrs = tui_active_border_attrs;
      else
      else
        attrs = tui_border_attrs;
        attrs = tui_border_attrs;
 
 
      wattron (win, attrs);
      wattron (win, attrs);
#ifdef HAVE_WBORDER
#ifdef HAVE_WBORDER
      wborder (win, tui_border_vline, tui_border_vline,
      wborder (win, tui_border_vline, tui_border_vline,
               tui_border_hline, tui_border_hline,
               tui_border_hline, tui_border_hline,
               tui_border_ulcorner, tui_border_urcorner,
               tui_border_ulcorner, tui_border_urcorner,
               tui_border_llcorner, tui_border_lrcorner);
               tui_border_llcorner, tui_border_lrcorner);
#else
#else
      box (win, tui_border_vline, tui_border_hline);
      box (win, tui_border_vline, tui_border_hline);
#endif
#endif
      if (win_info->title)
      if (win_info->title)
        mvwaddstr (win, 0, 3, win_info->title);
        mvwaddstr (win, 0, 3, win_info->title);
      wattroff (win, attrs);
      wattroff (win, attrs);
    }
    }
}
}
 
 
 
 
void
void
tui_unhighlight_win (struct tui_win_info *win_info)
tui_unhighlight_win (struct tui_win_info *win_info)
{
{
  if (win_info != NULL
  if (win_info != NULL
      && win_info->generic.handle != (WINDOW *) NULL)
      && win_info->generic.handle != (WINDOW *) NULL)
    {
    {
      box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
      box_win ((struct tui_gen_win_info *) win_info, NO_HILITE);
      wrefresh (win_info->generic.handle);
      wrefresh (win_info->generic.handle);
      tui_set_win_highlight (win_info, 0);
      tui_set_win_highlight (win_info, 0);
    }
    }
}
}
 
 
 
 
void
void
tui_highlight_win (struct tui_win_info *win_info)
tui_highlight_win (struct tui_win_info *win_info)
{
{
  if (win_info != NULL
  if (win_info != NULL
      && win_info->can_highlight
      && win_info->can_highlight
      && win_info->generic.handle != (WINDOW *) NULL)
      && win_info->generic.handle != (WINDOW *) NULL)
    {
    {
      box_win ((struct tui_gen_win_info *) win_info, HILITE);
      box_win ((struct tui_gen_win_info *) win_info, HILITE);
      wrefresh (win_info->generic.handle);
      wrefresh (win_info->generic.handle);
      tui_set_win_highlight (win_info, 1);
      tui_set_win_highlight (win_info, 1);
    }
    }
}
}
 
 
void
void
tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
{
{
  if (win_info != NULL && win_info->generic.type != CMD_WIN)
  if (win_info != NULL && win_info->generic.type != CMD_WIN)
    {
    {
      if (win_info->is_highlighted)
      if (win_info->is_highlighted)
        tui_highlight_win (win_info);
        tui_highlight_win (win_info);
      else
      else
        tui_unhighlight_win (win_info);
        tui_unhighlight_win (win_info);
 
 
    }
    }
  return;
  return;
}
}
 
 
 
 
void
void
tui_make_window (struct tui_gen_win_info *win_info, int box_it)
tui_make_window (struct tui_gen_win_info *win_info, int box_it)
{
{
  WINDOW *handle;
  WINDOW *handle;
 
 
  handle = newwin (win_info->height,
  handle = newwin (win_info->height,
                   win_info->width,
                   win_info->width,
                   win_info->origin.y,
                   win_info->origin.y,
                   win_info->origin.x);
                   win_info->origin.x);
  win_info->handle = handle;
  win_info->handle = handle;
  if (handle != (WINDOW *) NULL)
  if (handle != (WINDOW *) NULL)
    {
    {
      if (box_it == BOX_WINDOW)
      if (box_it == BOX_WINDOW)
        box_win (win_info, NO_HILITE);
        box_win (win_info, NO_HILITE);
      win_info->is_visible = TRUE;
      win_info->is_visible = TRUE;
      scrollok (handle, TRUE);
      scrollok (handle, TRUE);
    }
    }
}
}
 
 
 
 
/* We can't really make windows visible, or invisible.  So we have to
/* We can't really make windows visible, or invisible.  So we have to
   delete the entire window when making it visible, and create it
   delete the entire window when making it visible, and create it
   again when making it visible.  */
   again when making it visible.  */
static void
static void
make_visible (struct tui_gen_win_info *win_info, int visible)
make_visible (struct tui_gen_win_info *win_info, int visible)
{
{
  /* Don't tear down/recreate command window.  */
  /* Don't tear down/recreate command window.  */
  if (win_info->type == CMD_WIN)
  if (win_info->type == CMD_WIN)
    return;
    return;
 
 
  if (visible)
  if (visible)
    {
    {
      if (!win_info->is_visible)
      if (!win_info->is_visible)
        {
        {
          tui_make_window (win_info,
          tui_make_window (win_info,
                           (win_info->type != CMD_WIN
                           (win_info->type != CMD_WIN
                            && !tui_win_is_auxillary (win_info->type)));
                            && !tui_win_is_auxillary (win_info->type)));
          win_info->is_visible = TRUE;
          win_info->is_visible = TRUE;
        }
        }
    }
    }
  else if (!visible
  else if (!visible
           && win_info->is_visible
           && win_info->is_visible
           && win_info->handle != (WINDOW *) NULL)
           && win_info->handle != (WINDOW *) NULL)
    {
    {
      win_info->is_visible = FALSE;
      win_info->is_visible = FALSE;
      tui_delete_win (win_info->handle);
      tui_delete_win (win_info->handle);
      win_info->handle = (WINDOW *) NULL;
      win_info->handle = (WINDOW *) NULL;
    }
    }
 
 
  return;
  return;
}
}
 
 
void
void
tui_make_visible (struct tui_gen_win_info *win_info)
tui_make_visible (struct tui_gen_win_info *win_info)
{
{
  make_visible (win_info, 1);
  make_visible (win_info, 1);
}
}
 
 
void
void
tui_make_invisible (struct tui_gen_win_info *win_info)
tui_make_invisible (struct tui_gen_win_info *win_info)
{
{
  make_visible (win_info, 0);
  make_visible (win_info, 0);
}
}
 
 
 
 
/* Makes all windows invisible (except the command and locator
/* Makes all windows invisible (except the command and locator
   windows).  */
   windows).  */
static void
static void
make_all_visible (int visible)
make_all_visible (int visible)
{
{
  int i;
  int i;
 
 
  for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
  for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
    {
    {
      if (tui_win_list[i] != NULL
      if (tui_win_list[i] != NULL
          && ((tui_win_list[i])->generic.type) != CMD_WIN)
          && ((tui_win_list[i])->generic.type) != CMD_WIN)
        {
        {
          if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
          if (tui_win_is_source_type ((tui_win_list[i])->generic.type))
            make_visible ((tui_win_list[i])->detail.source_info.execution_info,
            make_visible ((tui_win_list[i])->detail.source_info.execution_info,
                          visible);
                          visible);
          make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible);
          make_visible ((struct tui_gen_win_info *) tui_win_list[i], visible);
        }
        }
    }
    }
 
 
  return;
  return;
}
}
 
 
void
void
tui_make_all_visible (void)
tui_make_all_visible (void)
{
{
  make_all_visible (1);
  make_all_visible (1);
}
}
 
 
void
void
tui_make_all_invisible (void)
tui_make_all_invisible (void)
{
{
  make_all_visible (0);
  make_all_visible (0);
}
}
 
 
/* Function to refresh all the windows currently displayed.  */
/* Function to refresh all the windows currently displayed.  */
 
 
void
void
tui_refresh_all (struct tui_win_info **list)
tui_refresh_all (struct tui_win_info **list)
{
{
  enum tui_win_type type;
  enum tui_win_type type;
  struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
  struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
 
 
  for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
  for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
    {
    {
      if (list[type] && list[type]->generic.is_visible)
      if (list[type] && list[type]->generic.is_visible)
        {
        {
          if (type == SRC_WIN || type == DISASSEM_WIN)
          if (type == SRC_WIN || type == DISASSEM_WIN)
            {
            {
              touchwin (list[type]->detail.source_info.execution_info->handle);
              touchwin (list[type]->detail.source_info.execution_info->handle);
              tui_refresh_win (list[type]->detail.source_info.execution_info);
              tui_refresh_win (list[type]->detail.source_info.execution_info);
            }
            }
          touchwin (list[type]->generic.handle);
          touchwin (list[type]->generic.handle);
          tui_refresh_win (&list[type]->generic);
          tui_refresh_win (&list[type]->generic);
        }
        }
    }
    }
  if (locator->is_visible)
  if (locator->is_visible)
    {
    {
      touchwin (locator->handle);
      touchwin (locator->handle);
      tui_refresh_win (locator);
      tui_refresh_win (locator);
    }
    }
}
}
 
 
 
 
/*********************************
/*********************************
** Local Static Functions
** Local Static Functions
*********************************/
*********************************/
 
 

powered by: WebSVN 2.1.0

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