Exemple #1
0
/* We can't really make windows visible, or invisible.  So we have to
   delete the entire window when making it visible, and create it
   again when making it visible.  */
static void
make_visible (struct tui_gen_win_info *win_info, int visible)
{
  /* Don't tear down/recreate command window */
  if (win_info->type == CMD_WIN)
    return;

  if (visible)
    {
      if (!win_info->is_visible)
	{
	  tui_make_window (win_info,
			   (win_info->type != CMD_WIN
			    && !tui_win_is_auxillary (win_info->type)));
	  win_info->is_visible = TRUE;
	}
    }
  else if (!visible &&
	   win_info->is_visible && win_info->handle != (WINDOW *) NULL)
    {
      win_info->is_visible = FALSE;
      tui_delete_win (win_info->handle);
      win_info->handle = (WINDOW *) NULL;
    }

  return;
}
Exemple #2
0
/* init_and_make_win().
 */
static void *
init_and_make_win (void *opaque_win_info, 
		   enum tui_win_type win_type,
		   int height, int width, 
		   int origin_x, int origin_y,
		   int box_it)
{
  struct tui_gen_win_info *generic;

  if (opaque_win_info == NULL)
    {
      if (tui_win_is_auxillary (win_type))
	opaque_win_info = (void *) tui_alloc_generic_win_info ();
      else
	opaque_win_info = (void *) tui_alloc_win_info (win_type);
    }
  if (tui_win_is_auxillary (win_type))
    generic = (struct tui_gen_win_info *) opaque_win_info;
  else
    generic = &((struct tui_win_info *) opaque_win_info)->generic;

  if (opaque_win_info != NULL)
    {
      init_gen_win_info (generic, win_type, height, width, origin_x, origin_y);
      if (!tui_win_is_auxillary (win_type))
	{
	  if (generic->type == CMD_WIN)
	    ((struct tui_win_info *) opaque_win_info)->can_highlight = FALSE;
	  else
	    ((struct tui_win_info *) opaque_win_info)->can_highlight = TRUE;
	}
      tui_make_window (generic, box_it);
    }
  return opaque_win_info;
}
/* Function to display the registers in the content from
   'start_element_no' until the end of the register content or the end
   of the display height.  No checking for displaying past the end of
   the registers is done here.  */
void
tui_display_registers_from (int start_element_no)
{
    struct tui_data_info *display_info = &TUI_DATA_WIN->detail.data_display_info;

    if (display_info->regs_content != (tui_win_content) NULL
            && display_info->regs_content_count > 0)
    {
        int i = start_element_no;
        int j, item_win_width, cur_y;

        int max_len = 0;
        for (i = 0; i < display_info->regs_content_count; i++)
        {
            struct tui_data_element *data;
            struct tui_gen_win_info *data_item_win;
            char *p;
            int len;

            data_item_win
                = &display_info->regs_content[i]->which_element.data_window;
            data = &((struct tui_win_element *)
                     data_item_win->content[0])->which_element.data;
            len = 0;
            p = data->content;
            if (p != 0)
                while (*p)
                {
                    if (*p++ == '\t')
                        len = 8 * ((len / 8) + 1);
                    else
                        len++;
                }

            if (len > max_len)
                max_len = len;
        }
        item_win_width = max_len + 1;
        i = start_element_no;

        display_info->regs_column_count =
            (TUI_DATA_WIN->generic.width - 2) / item_win_width;
        if (display_info->regs_column_count == 0)
            display_info->regs_column_count = 1;
        item_win_width =
            (TUI_DATA_WIN->generic.width - 2) / display_info->regs_column_count;

        /* Now create each data "sub" window, and write the display into
        it.  */
        cur_y = 1;
        while (i < display_info->regs_content_count
                && cur_y <= TUI_DATA_WIN->generic.viewport_height)
        {
            for (j = 0;
                    j < display_info->regs_column_count
                    && i < display_info->regs_content_count;
                    j++)
            {
                struct tui_gen_win_info *data_item_win;
                struct tui_data_element *data_element_ptr;

                /* Create the window if necessary.  */
                data_item_win = &display_info->regs_content[i]
                                ->which_element.data_window;
                data_element_ptr = &((struct tui_win_element *)
                                     data_item_win->content[0])->which_element.data;
                if (data_item_win->handle != (WINDOW*) NULL
                        && (data_item_win->height != 1
                            || data_item_win->width != item_win_width
                            || data_item_win->origin.x != (item_win_width * j) + 1
                            || data_item_win->origin.y != cur_y))
                {
                    tui_delete_win (data_item_win->handle);
                    data_item_win->handle = 0;
                }

                if (data_item_win->handle == (WINDOW *) NULL)
                {
                    data_item_win->height = 1;
                    data_item_win->width = item_win_width;
                    data_item_win->origin.x = (item_win_width * j) + 1;
                    data_item_win->origin.y = cur_y;
                    tui_make_window (data_item_win, DONT_BOX_WINDOW);
                    scrollok (data_item_win->handle, FALSE);
                }
                touchwin (data_item_win->handle);

                /* Get the printable representation of the register
                       and display it.  */
                tui_display_register (data_element_ptr, data_item_win);
                i++;		/* Next register.  */
            }
            cur_y++;		/* Next row.  */
        }
    }
}