Esempio n. 1
0
void clearall() 
{
    wclear(stdscr);
    show_panel(game.holdpan);
    show_panel(game.brdpan);
    show_panel(game.sidepan);
}
Esempio n. 2
0
void tx_unhide_listbox(struct scroll_list *list)
{
    show_panel(list->panel);
    show_panel(list->panel);
    update_panels();
    doupdate();
}
Esempio n. 3
0
void
menupan_show(MENUPAN *menupan)
{
    assert(menupan);

    show_panel(menupan->win);
    show_panel(menupan->sub);
}
Esempio n. 4
0
static void
canned_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd)
{
    int which = cmd[1] - '0';

    saywhat(cmd);
    switch (*cmd) {
    case 'h':
	hide_panel(px[which]);
	break;
    case 's':
	show_panel(px[which]);
	break;
    case 't':
	top_panel(px[which]);
	break;
    case 'b':
	bottom_panel(px[which]);
	break;
    case 'd':
	rmpanel(px[which]);
	break;
    }
    pflush();
    wgetch(stdscr);
}
Esempio n. 5
0
new_panel(WINDOW *win)
{
  PANEL *pan = (PANEL *) 0;

  T((T_CALLED("new_panel(%p)"), win));

  if (!win)
    returnPanel(pan);

  if (!_nc_stdscr_pseudo_panel)
    (void)root_panel();
  assert(_nc_stdscr_pseudo_panel);

  if (!(win->_flags & _ISPAD) && (pan = (PANEL *) malloc(sizeof(PANEL))))
    {
      pan->win = win;
      pan->above = (PANEL *) 0;
      pan->below = (PANEL *) 0;
#ifdef TRACE
      if (!new_id)
	new_id = strdup("new");
      pan->user = new_id;
#else
      pan->user = (char *)0;
#endif
      (void)show_panel(pan);
    }
  returnPanel(pan);
}
Esempio n. 6
0
static void show_n_panels (PANEL **panels,int n) {
  int i;
  for (i=0;i<n;i++) {
    show_panel (panels[i]);
  }

  return;
}
Esempio n. 7
0
static void do_genwin_panel_show(QSP_ARG_DECL  const char *s)
{
	Panel_Obj *po;

	po=get_panel_obj(s);
	if( po != NULL ) show_panel(po);
	return;
}
Esempio n. 8
0
File: motif.c Progetto: E-LLP/QuIP
static void navp_genwin_show(QSP_ARG_DECL  const char *s)
{
	Nav_Panel *np_p;

	np_p=GET_NAV_PANEL(s);
	if( np_p != NO_NAV_PANEL ) show_panel(QSP_ARG  NAVP_PANEL(np_p));
	return;
}
Esempio n. 9
0
void init_windows()
{
  win_inventory = newwin(25, 29, 0, 0);
  win_map       = newwin(25, 90, 0, 30);
  win_input     = newwin(3, 120, 25, 0);
  win_status    = newwin(7, 120, 28, 0);

  pan_inventory = new_panel(win_inventory);
  pan_map       = new_panel(win_map);
  pan_input     = new_panel(win_input);
  pan_status    = new_panel(win_status);

  // input panel needs to be at the top of the stack initially!
  show_panel(pan_input);

  box(win_inventory,  0, 0);
  box(win_map,        0, 0);
  box(win_input,      0, 0);
  box(win_status,     0, 0);

  // make getch() non-blocking
  nodelay(win_map, true);

  // store the height and width of the displayable win_map
  map_y_size = 25;
  map_x_size = 90;

  // store the height and width of the displayable win_input
  input_y_size = 3;
  input_x_size = 120;

  // initialize input window
  Input = (void *)malloc(360);
  for (int i=0;i<360;i++) {
    Input[i] = ' ';
  }

  // starting x-coord and y-coord
  // temporary, not sticking around
  x = 1 + map_x_size / 2;
  y = 1 + map_y_size / 2;

  // set up signal handling for quitting
  memset(&action, 0, sizeof(struct sigaction));
  action.sa_handler = handle_end_signal;
  sigaction(SIGINT, &action, NULL);
  sigaction(SIGQUIT, &action, NULL);
  sigaction(SIGTERM, &action, NULL);

  // set the game mode
  GameMode = MODE_NORMAL;

  // I'm still running!
  should_quit = FALSE;

  // while initializing the game, I currently need to refresh the screen
  needs_refresh = TRUE;
}
Esempio n. 10
0
void show_split(ui_t *ui) {
  chat_tab = (COLS/2)-7;
  log_tab = COLS-6;
  render_tab_bar(ACTIVE_CHAT);

  hide_panel(ALERT);
  reset_borders(ui);
  wresize(ui->screen, LINES - 6, COLS/2 - 1);
  box(ui->screen, 0, 0);
  show_panel(CHAT);
  wresize(ui->log, LINES - 6, COLS/2);
  mvwin(ui->log, 1, COLS/2);
  box(ui->log, 0, 0);
  show_panel(LOG);
  update_panels();
  doupdate();
  show_prompt(ui, NULL);
}
Esempio n. 11
0
/**
 * map_control -- draw a cursor on the screen and accept control from FSM
 * @ch: the input word from the FSM
 */
int map_control(int ch)
{
        bool dozoom = false;
        struct map_t *tmp;

        if (!nav_win)
                map_cursor_init();

        top_panel(nav_pan);

        switch (ch) 
        {
        case MODE_STARTED:
                map_controls_active = true;
                cursor->Show(cursor);
                show_panel(nav_pan);
                break;
                
        /* Scroll the map in a direction */
        case 'w': case 'a': case 's': case 'd':
        case 'W': case 'A': case 'S': case 'D':
                map_scroll(MAPBOOK->active, ch);
                break;

        /* Move the zoom frame in a direction */
        case 'h': case 'j': case 'k': case 'l':
        case 'H': case 'J': case 'K': case 'L':
                cursor->Move(cursor, ch);
                break;

        /* Select the current zoom frame */
        case '\n':
                dozoom = true;
                break;

        case KEY_ESC:
        case 'm':
                map_controls_active = false;
                show_dock();
                cursor->Hide(cursor);
                hide_panel(nav_pan);
                return MODE_RELEASE;
        }

        /* Adjust for changing y0 or x0 of the map pad */
        y_map = pos_y(cursor->pos) + pos_y(ACTIVE->pos);
        x_map = pos_x(cursor->pos) + pos_x(ACTIVE->pos);
        zoomlevel = MAPBOOK->page;

        print_map_control(y_map, x_map);
        draw_zoom_box(ACTIVE, y_map, x_map);

        if (dozoom)
                set_zoom(MAPBOOK, y_map, x_map);

        return MODE_PERSIST;
}
Esempio n. 12
0
void update_map_control(void)
{
        if (!map_controls_active)
                return;

        hide_dock();
        show_panel(nav_pan);
        top_panel(nav_pan);
}
Esempio n. 13
0
void rsend(const char *cmd) {
    FILE *fp;
    show_panel(1,cmd);
    fp=fopen(DEV_OUT,"w");
    fputs(cmd ,fp);
    fputs("\n",fp);
    fclose(fp);
    usleep(10000);
}
Esempio n. 14
0
static int lcp_show_panel(lua_State *L)
{
    PANEL *p = lcp_check(L, 1);

    if (lua_isnoneornil(L, 2) || lua_toboolean(L, 2))
        lua_pushboolean(L, B(show_panel(p)));
    else
        lua_pushboolean(L, B(hide_panel(p)));

    return 1;
}
Esempio n. 15
0
void store_position(int posnum) {
    char *buf=NULL;
    buf=(char *)calloc(1024,1);
    posdata[posnum]=rpos;
    posdata[posnum].saved=1;
    show_panel(2,itoa(posnum));
    
    sprintf(buf,"HE%d",posnum);
    rsend(buf);
    free(buf);
}
Esempio n. 16
0
/*
  window.["hidden"] = true/false
  hide or unhide the window.

  Stack:
  1: the instance table
  2: the accessed key
  3: the value to set
*/
int		lui_window_set_hidden(lua_State *L)
{
    PANEL		*p = check_window(L, 1);

    if (lua_toboolean(L, 3))	/* hidden = true -> hide the window */
        hide_panel(p);
    else			       /* hidden = false -> show the window */
        show_panel(p);
    update_panels();
    return 0;			/* TODO: send something ? */
}
Esempio n. 17
0
void CWidget::show()
{
	DEBUG_ui("CWidget::hide [" + _name + "]");
	show_panel(_panel);
	_visible = true;

	// Show subwidgets too
	if(_layout)
		_layout->show();

	_changed = true;
}
Esempio n. 18
0
/* This is used with the controller to insert a statistic. */
static void insert_tail(struct statistics_controller *c) {
    int i;

    for(i = 0; i < c->get_total_possible(c); ++i) {
	if(c->state[i].instance && !c->state[i].instance->visible) {
	    c->state[i].instance->visible = true;
	    show_panel(c->state[i].instance->panel);
	    top_panel(c->state[i].instance->panel);
	    c->total_active_statistics++;
	    return;
	}
    }
}
Esempio n. 19
0
void run_program() {
    int i,lastpos=0,total_positions=0,sent_positions=0;
    char *buf=NULL;
    buf=(char *)calloc(255,1);
    rsend("NW");
    for(i=1;i<=POS_SPACE;i++) { if(posdata[i].saved==1) total_positions++; }
    for(i=1;i<=POS_SPACE;i++) {
	if(posdata[i].saved==1) {
	sprintf(buf,"PS %d,%d,%d,%d,%d,%d,0",i 
					    ,posdata[i].base
					    ,posdata[i].shoulder
					    ,posdata[i].elbow
					    ,posdata[i].wrist+posdata[i].pitch
					    ,posdata[i].wrist-posdata[i].pitch);
	    show_panel(3,itoa((sent_positions++*100)/total_positions));
	    if((i==1) || (posdata[i-1].grip != posdata[i].grip) ) {
		if(posdata[i].grip) rsend("GF1"); 
		else rsend("GF0");
	    }
	    rsend(buf);
	}
    }
    sent_positions=0;
    for(i=1;i<=POS_SPACE;i++) {
	if(posdata[i].saved==1) {
	    lastpos = i > lastpos ? i : lastpos;
	    sprintf(buf,"%d MO %d",i,i);
	    show_panel(4,itoa((sent_positions++*100)/total_positions));
	    rsend(buf);
	}
    }
    sprintf(buf,"%d ED",i+1);
    rsend(buf);
    rpos=posdata[lastpos];
    rsend("RN 1");
    free(buf);
    show_panel(5,"");
}
Esempio n. 20
0
void show_alert(ui_t *ui, char *message) {
  int cols = COLS;
  int x = (COLS - strlen(message)) / 2;
  wattron(ui->alert, COLOR_PAIR(COL_LOGO) | A_BOLD);
  mvwprintw(ui->alert, 0, 0, "%*s", COLS," ");
  mvwprintw(ui->alert, 1, 0, "%*s", COLS," ");
  mvwprintw(ui->alert, 2, 0, "%*s", COLS," ");
  mvwprintw(ui->alert, 1, x, message);
  wattroff(ui->alert, COLOR_PAIR(COL_LOGO) | A_BOLD);
  show_panel(ALERT);
  top_panel(ALERT);
  update_panels();
  doupdate();
}
Esempio n. 21
0
int ztf_dialog_show(zt_dialog *dw) {
    if (!dw)  return -1;

    LOCK_CURSES;

    WINDOW *dwin = (WINDOW *)((BorderedWindow *)dw->fw_ptr)->content;
    
    wprintw(dwin, "%s\n", dw->text);

    show_panel(((BorderedWindow *)dw->fw_ptr)->content_panel);
//    wrefresh(((BorderedWindow *)lw->fw_ptr)->content);

    update_panels();
    doupdate();

    int dialog_ret = nc_dialog_driver(dw);

    int ret_val = 1;

    /* If we actually selected something, return the associated
       'user data', otherwise NULL to indicate 'cancel' */
    if (dialog_ret == 1) {
	ret_val = 1;
    } else {
	ret_val = 0;
    }

    /* hide panel, don't destroy menu items */
    hide_panel(((BorderedWindow *)dw->fw_ptr)->content_panel);
    show_panel(stdout_panel);
    show_panel(stderr_panel);
    update_panels();
    doupdate();

    UNLOCK_CURSES;
    return ret_val;
}
Esempio n. 22
0
static void show_all_panels (ctrls_show_t *ctrls, int showed_bands) {

  db_show_t *db;
  hz_show_t *hz;
  bw_show_t *bw;

  db = ctrls->db;
  hz = ctrls->hz;
  bw = ctrls->bw;

  show_panel (db->pan);
  show_n_panels (db->bar_p,showed_bands);
  show_n_panels (db->slider_p,showed_bands);

  show_panel (hz->pan);
  show_n_panels (hz->cell_p,showed_bands);

  show_panel (bw->pan);
  show_n_panels (bw->bar_p,showed_bands);
  show_n_panels (bw->slider_p,showed_bands);
  show_n_panels (bw->cell_p,showed_bands);

  return;
}
Esempio n. 23
0
void showPanel(struct panelw *panel, char *label)
{
    int startx, starty, x, y, h, w, len;

    getbegyx(panel->win, starty, startx);
    getmaxyx(panel->win, h, w);

    box(panel->win, 0, 0);

    snprintf(panel->title, 100, "%s", label);
    len = strlen(panel->title);
    x = ((w - len) / 2);
    y = 0;
    mvwprintw(panel->win, y, x, "%s", panel->title);
    show_panel(panel->panel);
    update_panels();
    refresh();
}
Esempio n. 24
0
/*
 *  Functions definitions
 */
void send_xy(out_t *info){
    int xy[2];
    char buff[BUFF_S];
    char tmp[5];
    char *lin_col[2];
    char *end;
    int (*attr_ch)(WINDOW*, int);

    lin_col[0] = "Digite a linha [0-99]: ";
    lin_col[1] = "Digite a coluna [0-99]: ";

    flushinp();
    show_panel(info->panel);

    for( int i = 0; i < 2; i++ ){
        attr_ch = wattroff;

        do{
            attr_ch(info->win, COLOR_PAIR(1));

            memset(tmp, 0, 5);

            wclear(info->win);
            box(info->win, 0, 0);

            mvwaddstr(info->win, 1, 1, lin_col[i]);
            wgetnstr(info->win, tmp, 5);
            xy[i] = strtol(tmp, &end, 10);

            attr_ch = wattron;
        }while( tmp == end || *end != 0 || xy[i] < 0 || xy[i] > 99 );
    }

    sprintf(buff, "%d*%d", xy[0], xy[1]);
    send(info->socket, buff, strlen(buff), 0);
    memset(buff, 0, BUFF_S);

    hide_panel(info->panel);
    update_panels();

    return;
}
Esempio n. 25
0
//------------------------------------------------------------------------------
PANEL* new_panel( WINDOW* win )
{
	__QCS_FCONTEXT( "new_panel" );
    PANEL* pan = (PANEL*)( malloc( sizeof(PANEL) ) );

    if( !_stdscr_pseudo_panel.win )
    {
        _stdscr_pseudo_panel.win = stdscr;
        _stdscr_pseudo_panel.wstarty = 0;
        _stdscr_pseudo_panel.wstartx = 0;
        _stdscr_pseudo_panel.wendy = LINES;
        _stdscr_pseudo_panel.wendx = COLS;
        _stdscr_pseudo_panel.user = "******";
        _stdscr_pseudo_panel.obscure = (PANELOBS *)0;
    }

    if( pan )
    {
        int maxy, maxx;

        pan->win = win;
        pan->above = (PANEL*)0;
        pan->below = (PANEL*)0;
        getbegyx( win, pan->wstarty, pan->wstartx );
        getmaxyx( win, maxy, maxx );
        pan->wendy = pan->wstarty + maxy;
        pan->wendx = pan->wstartx + maxx;
#ifdef PANEL_DEBUG
        pan->user = "******";
#else
        pan->user = (char*)0;
#endif
        pan->obscure = (PANELOBS*)0;
        show_panel( pan );
    }

    return pan;
}
Esempio n. 26
0
void recall_position(int posnum) {
    char *buf=NULL;
    int t_base,
        t_shoulder,
	t_elbow,
	t_pitch,
	t_wrist;
    buf=(char *)calloc(1024,1);
    
    rsend( posdata[posnum].grip==0 ? "GO":"GC" ); 
    t_base    =posdata[posnum].base    -rpos.base;
    t_shoulder=posdata[posnum].shoulder-rpos.shoulder;
    t_elbow   =posdata[posnum].elbow   -rpos.elbow;
    t_pitch   =posdata[posnum].pitch   -rpos.pitch;
    t_wrist   =posdata[posnum].wrist   -rpos.wrist;
    
    rpos=posdata[posnum];

    sprintf(buf,"MI%d,%d,%d,%d,%d,0",t_base,t_shoulder,t_elbow,t_wrist+t_pitch,t_wrist-t_pitch);
    rsend(buf);
    free(buf);
    show_panel(8,itoa(posnum));
}
Esempio n. 27
0
top_panel(PANEL * pan)
{
  T((T_CALLED("top_panel(%p)"), pan));
  returnCode(show_panel(pan));
}
Esempio n. 28
0
int main()
{	WINDOW *my_wins[3];
	PANEL  *my_panels[3];
	PANEL_DATA panel_datas[3];
	PANEL_DATA *temp;
	int ch;

	/* Initialize curses */
	initscr();
	start_color();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);

	/* Initialize all the colors */
	init_pair(1, COLOR_RED, COLOR_BLACK);
	init_pair(2, COLOR_GREEN, COLOR_BLACK);
	init_pair(3, COLOR_BLUE, COLOR_BLACK);
	init_pair(4, COLOR_CYAN, COLOR_BLACK);

	init_wins(my_wins, 3);
	
	/* Attach a panel to each window */ 	/* Order is bottom up */
	my_panels[0] = new_panel(my_wins[0]); 	/* Push 0, order: stdscr-0 */
	my_panels[1] = new_panel(my_wins[1]); 	/* Push 1, order: stdscr-0-1 */
	my_panels[2] = new_panel(my_wins[2]); 	/* Push 2, order: stdscr-0-1-2 */

	/* Initialize panel datas saying that nothing is hidden */
	panel_datas[0].hide = FALSE;
	panel_datas[1].hide = FALSE;
	panel_datas[2].hide = FALSE;

	set_panel_userptr(my_panels[0], &panel_datas[0]);
	set_panel_userptr(my_panels[1], &panel_datas[1]);
	set_panel_userptr(my_panels[2], &panel_datas[2]);

	/* Update the stacking order. 2nd panel will be on top */
	update_panels();

	/* Show it on the screen */
	attron(COLOR_PAIR(4));
	mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window)  'b'(Second Window)  'c'(Third Window)");
	mvprintw(LINES - 2, 0, "q to Exit");

	attroff(COLOR_PAIR(4));
	doupdate();

	while((ch = getch()) != 'q')
	{	switch(ch)
		{	case 'a':			
				temp = (PANEL_DATA *)panel_userptr(my_panels[0]);
				if(temp->hide == FALSE)
				{	hide_panel(my_panels[0]);
					temp->hide = TRUE;
				}
				else
				{	show_panel(my_panels[0]);
					temp->hide = FALSE;
				}
				break;
			case 'b':
				temp = (PANEL_DATA *)panel_userptr(my_panels[1]);
				if(temp->hide == FALSE)
				{	hide_panel(my_panels[1]);
					temp->hide = TRUE;
				}
				else
				{	show_panel(my_panels[1]);
					temp->hide = FALSE;
				}
				break;
			case 'c':
				temp = (PANEL_DATA *)panel_userptr(my_panels[2]);
				if(temp->hide == FALSE)
				{	hide_panel(my_panels[2]);
					temp->hide = TRUE;
				}
				else
				{	show_panel(my_panels[2]);
					temp->hide = FALSE;
				}
				break;
		}
		update_panels();
		doupdate();
	}
	endwin();
	return 0;
}
Esempio n. 29
0
int read_window_open(const char *folder, struct mail_info *mail, int window)
{
	int w, h;
	char buf[256];

	getmaxyx(stdscr, h, w);
	h -= 2;

	if (!read_wnd)
	{
		read_wnd = newwin(h, w, 0, 0);
		read_panel = new_panel(read_wnd);
		show_panel(read_panel);
	} else
	{
		show_panel(read_panel);
		update_panels();
		doupdate();
	}

	gui_add_resize_listener(&resize_listener, read_window_resize, NULL);
	resize_listener_added = 1;

	if (read_current_mail)
	{
		mail_complete_free(read_current_mail);
	}

	getcwd(buf, sizeof(buf));
	chdir(folder);

	if ((read_current_mail = mail_complete_create_from_file(NULL, mail->filename)))
	{
		struct mail_complete *initial;
		mail_read_contents(NULL,read_current_mail);
		if ((initial = mail_find_initial(read_current_mail)))
		{
			char buf[380];
			utf8 *from_phrase = mail_info_get_from_phrase(read_current_mail->info);
			utf8 *from_addr = mail_info_get_from_addr(read_current_mail->info);
			if (from_phrase)
			{
				sm_snprintf(buf, sizeof(buf), "%s: %s <%s>", _("From"), from_phrase, from_addr);
			} else
			{
				sm_snprintf(buf, sizeof(buf), "%s: %s", _("From"), from_addr);
			}
			gadgets_init_simple_text_label(&from_label, buf);

			sm_snprintf(buf, sizeof(buf), "%s: %s", _("Date"), sm_get_date_str(read_current_mail->info->seconds));
			gadgets_init_simple_text_label(&date_label, buf);

			sm_snprintf(buf, sizeof(buf), "%s: %s", _("Subject"), read_current_mail->info->subject);
			gadgets_init_simple_text_label(&subject_label, buf);

			mail_decode(initial);

			gadgets_init_group(&read_group);
			gadgets_init_text_view(&text_view, initial->decoded_data);

			gadgets_add(&read_group, &from_label.tl.g);
			gadgets_add(&read_group, &date_label.tl.g);
			gadgets_add(&read_group, &subject_label.tl.g);
			gadgets_add(&read_group, &text_view.tl.tl.g);

			read_window_layout();

			gadgets_display(read_wnd, &read_group.g);
		}
	} else
	{
		SM_DEBUGF(20, ("Unable to create mail \"%s\"\n", mail->filename));
	}

	chdir(buf);

	gui_add_key_listener(&close_listener, 'c', "Close", read_window_close_current);
	refresh();

	wrefresh(read_wnd);

	return 1;
}
Esempio n. 30
0
void 
print_channel(struct deviceinfo *unit)
{
	int i = 0, option = EOF, scr_opt = 0;

	int rc;
	fd_set rfds;
	struct timeval tv;
	int max_fd;

	struct digi_node node;
	struct digi_chan chan;
	int port = 0;
	char ttyname[100];


	int d_invokes_capture = 1;   /* 0 if 'D' should invoke "exam_panel" */
	                             /* 1 if 'D' should invoke "scope_panel" */


	WINDOW *chanwin = GetWin(ChanWin);

	/* 
	 * scr_opt is just used to determine which field to 
	 * highlight.
	 */

	show_panel (GetPan(ChanWin));
	update_panels ();
	doupdate ();

	DPAOpenDevice(unit);

	while ((option != 'Q') && (option != 'q') && (option != ESC))
	{

		/* Get port info for current port */
		DPAGetNode(unit, &node);
		DPAGetChannel(unit, &chan, port);

		if (DPAGetPortName(unit, &node, &chan, port, ttyname) == NULL) {
			ttyname[0] = '\0';
		}

		max_fd = 0;
		FD_ZERO(&rfds);
		FD_SET(0, &rfds);

		mvwprintw (chanwin, 1, 2, "Device Description: %-54.54s", node.nd_ps_desc);

		mvwprintw (chanwin, 5, 35, "Name: %-10.10s", ttyname);

		wattrset (chanwin, make_attr (A_BOLD, WHITE, BLACK));

		mvwprintw (chanwin, 5, 56, "Status: %-10.10s",
		           chan.ch_open ? "Open" : "Closed");
		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));

		if (scr_opt == 1)
		{
			wattrset (chanwin, make_attr (A_REVERSE | A_STANDOUT, WHITE, BLACK));
			mvwprintw (chanwin, 3, 5, "Unit IP Address: %-15.15s", unit->host);
			wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
			mvwprintw (chanwin, 5, 8, "Port Number : %-2d", port + 1);
		}
		else if (scr_opt == 2)
		{
			wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
			mvwprintw (chanwin, 3, 5, "Unit IP Address: %-15.15s", unit->host);
			wattrset (chanwin, make_attr (A_REVERSE | A_STANDOUT, WHITE, BLACK));
			mvwprintw (chanwin, 5, 8, "Port Number : %-2d", port + 1);
			wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		}
		else
		{
			mvwprintw (chanwin, 3, 5, "Unit IP Address: %-15.15s", unit->host);
			mvwprintw (chanwin, 5, 8, "Port Number : %-2d", port + 1);
		}

		if (!vanilla) wattrset (chanwin, make_attr (A_ALTCHARSET, GREEN, BLACK));
		else wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));

		for (i = 0; i < 62; i++)
			mvwaddch (chanwin, 6, 8 + i, mapchar(ACS_HLINE));
		mvwaddch (chanwin, 6, 7, mapchar(ACS_ULCORNER));
		mvwaddch (chanwin, 6, 70, mapchar(ACS_URCORNER));
		mvwaddch (chanwin, 7, 7, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 7, 70, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 8, 7, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 8, 70, mapchar(ACS_VLINE));

		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		mvwprintw (chanwin, 12, 24, "Signal Active = ");
		wattrset (chanwin, make_attr (A_STANDOUT, WHITE, GREEN));
		waddstr (chanwin, "X");

		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		mvwaddstr (chanwin, 12, 46, "Inactive =");
		wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));
		mvwaddstr (chanwin, 12, 57, "_");
		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));

		mvwaddstr (chanwin, 8, 13,
				   "Tx:             RTS  CTS  DSR  DCD  DTR  RI  OFC  IFC");
		mvwaddstr (chanwin, 9, 13,
				   "Rx:                                                  ");

		if (!vanilla)
			wattrset (chanwin, make_attr (A_ALTCHARSET, GREEN, BLACK));
		else
			wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));

		mvwaddch (chanwin, 9, 7, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 9, 70, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 10, 7, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 10, 70, mapchar(ACS_VLINE));
		mvwaddch (chanwin, 11, 7, mapchar(ACS_LLCORNER));
		mvwaddch (chanwin, 11, 70, mapchar(ACS_LRCORNER));

		for (i = 0; i < 62; i++)
			mvwaddch (chanwin, 11, 8 + i, mapchar(ACS_HLINE));

		wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));

		mvwprintw (chanwin, 8, 17, "%-10d", chan.ch_txcount);
		mvwprintw (chanwin, 9, 17, "%-10d", chan.ch_rxcount);

		{
			int msigs=6;
			int   mbits[] = { MS_RTS, MS_CTS, MS_DSR, MS_DCD, MS_DTR, MS_RI };
			char *mhstr[] = { "X",    "X",    "X",    "X",    "X",    "X"   };
			char *mlstr[] = { "_",    "_",    "_",    "_",    "_",    "_"   };
			int   mpos[]  = { 30,     35,     40,     45,     50,     55    };
			int sig=0;

			for(sig = 0; sig < msigs; sig++)
			{
				if (chan.ch_s_mstat & mbits[sig])
				{
					wattrset (chanwin, make_attr (A_STANDOUT, WHITE, GREEN));
					mvwprintw (chanwin, 9, mpos[sig], mhstr[sig]);
				}
				else
				{
					wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));
					mvwprintw (chanwin, 9, mpos[sig], mlstr[sig]);
				}
			}
		}
		{
			int events=2;
			int   ebits[] = { EV_OPALL, EV_IPALL };
			char *ehstr[] = { "X",      "X"      };
			char *elstr[] = { "_",      "_"      };
			int   epos[]  = { 59,       64       };
			int ev=0;

			for(ev=0; ev<events; ev++)
			{
				if (chan.ch_s_estat & ebits[ev])
				{
					wattrset (chanwin, make_attr (A_STANDOUT, WHITE, GREEN));
					mvwprintw (chanwin, 9, epos[ev], ehstr[ev]);
				}
				else
				{
					wattrset (chanwin, make_attr (A_NORMAL, GREEN, BLACK));
					mvwprintw (chanwin, 9, epos[ev], elstr[ev]);
				}
			}
		}

		wattrset (chanwin, make_attr (A_BOLD, WHITE, BLACK));
		mvwaddstr (chanwin, 14, 1, "  Input Modes ");
		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		wprintw (chanwin, "                                                           ");
		wmove (chanwin, 14, 15);

		if (chan.ch_s_iflag & IF_IGNBRK)
			wprintw (chanwin, ":IGNBRK");
		if (chan.ch_s_iflag & IF_BRKINT)
			wprintw (chanwin, ":BRKINT");
		if (chan.ch_s_iflag & IF_IGNPAR)
			wprintw (chanwin, ":IGNPAR");
		if (chan.ch_s_iflag & IF_PARMRK)
			wprintw (chanwin, ":PARMRK");
		if (chan.ch_s_iflag & IF_INPCK)
			wprintw (chanwin, ":INPCK");
		if (chan.ch_s_iflag & IF_ISTRIP)
			wprintw (chanwin, ":ISTRIP");
		if (chan.ch_s_iflag & IF_IXON)
			wprintw (chanwin, ":IXON");
		if (chan.ch_s_iflag & IF_IXANY)
			wprintw (chanwin, ":IXANY");
		if (chan.ch_s_iflag & IF_IXOFF)
			wprintw (chanwin, ":IXOFF");
		if (chan.ch_s_xflag & XF_XIXON)
			wprintw (chanwin, ":IXONA");
		if (chan.ch_s_xflag & XF_XTOSS)
			wprintw (chanwin, ":ITOSS");
		if (chan.ch_s_iflag & IF_DOSMODE)
			wprintw (chanwin, ":DOSMODE");

		wprintw (chanwin, ":");
		wattrset (chanwin, make_attr (A_BOLD, WHITE, BLACK));
		mvwprintw (chanwin, 15, 1, " Output Modes ");
		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		wprintw (chanwin, "                                                           ");
		wmove (chanwin, 15, 15);

		if (chan.ch_s_xflag & XF_XCASE)
			wprintw (chanwin, ":XCASE");
		if (chan.ch_s_oflag & OF_OLCUC)
			wprintw (chanwin, ":OLCUC");
		if (chan.ch_s_oflag & OF_ONLCR)
			wprintw (chanwin, ":ONLCR");
		if (chan.ch_s_oflag & OF_OCRNL)
			wprintw (chanwin, ":OCRNL");
		if (chan.ch_s_oflag & OF_ONOCR)
			wprintw (chanwin, ":ONOCR");
		if (chan.ch_s_oflag & OF_ONLRET)
			wprintw (chanwin, ":ONLRET");

		/* TODO -- tab expansion / TABDLY interpretation */

		wprintw (chanwin, ":");
		wattrset (chanwin, make_attr (A_BOLD, WHITE, BLACK));
		mvwprintw (chanwin, 16, 1, "Control Modes ");
		wattrset (chanwin, make_attr (A_NORMAL, WHITE, BLACK));
		/*
		 * clear the field, then write the new one
		 */
		wprintw (chanwin, "                                                              ");
		wmove (chanwin, 16, 15);

		if (chan.ch_open) {
/* Jira RP-77: In early stages of a port open, ch_open is set before ch_s_brate
 * is initialized, which, undetected, causes an arithmetic exception here.
 */
                	if (chan.ch_s_brate)
                		wprintw (chanwin, ":%d Baud", PDIVIDEND / chan.ch_s_brate);
			else
                		wprintw (chanwin, ":?? Baud");

			switch (chan.ch_s_cflag & CF_CSIZE)
			{
			case CF_CS5:
				wprintw (chanwin, ":5 Char Bits");
				break;
			case CF_CS6:
				wprintw (chanwin, ":6 Char Bits");
				break;
			case CF_CS7:
				wprintw (chanwin, ":7 Char Bits");
				break;
			case CF_CS8:
				wprintw (chanwin, ":8 Char Bits");
				break;
			default:
				wprintw (chanwin, ":No Char Bits");
				break;
			}

			if (chan.ch_s_cflag & CF_CSTOPB)
				wprintw (chanwin, ":2 Stop Bits");
			else
				wprintw (chanwin, ":1 Stop Bits");

			if (chan.ch_s_cflag & CF_PARENB)
			{
				if (chan.ch_s_xflag & XF_XPAR)
				{
					if (chan.ch_s_cflag & CF_PARODD)
						wprintw (chanwin, ":Parity Odd");
					else
						wprintw (chanwin, ":Parity Even");
				}
				else
				{
					if (chan.ch_s_cflag & CF_PARODD)
						wprintw (chanwin, ":Parity Space");
					else
						wprintw (chanwin, ":Parity Mark");
				}
			}
			else
			{
				wprintw (chanwin, ":No Parity");
			}
		}
		else {
                	wprintw (chanwin, ":");
		}

		wattrset (GetWin(MainWin), make_attr (A_NORMAL, WHITE, BLUE));

		commandline (clbuf, helpstr, "ESC=Quit", lrudstr,
		             "T=LoopBack", "D=DataMonitor", "^P=Print", NULL);
		mvwprintw (GetWin(MainWin), KEY_LINE, 0, clbuf);

		wattroff (GetWin(MainWin), make_attr (A_NORMAL, WHITE, BLUE));
		wrefresh (GetWin(MainWin));
		wrefresh (chanwin);

		change_term (0, TIMEOUT);

		option = EOF;

		tv.tv_sec = 0;  tv.tv_usec = 500000;
		rc = select( max_fd + 1, &rfds, NULL, NULL, &tv );

		if (rc < 0)
		{
			fprintf (stderr, "FATAL ERROR: select failure.\n");
			EndCurses (-13);
			/* FIXME: This code will not be executed as 
			   EndCurses() calls exit(). */
			exit (-2);
		}
		else if (rc > 0)
		{
			if (FD_ISSET(0, &rfds))
			{
				option = getch();
			}

		}
		else
		{
			scr_opt = 0;
		}

		/*
		 * If the user hasn't selected anything keep doing the 
		 * original screen. 
		 */

		switch (option)
		{
		case EOF:
			break;

		case '':
			scr_opt = 0;
			refresh_screen ();
			break;

#ifdef KEY_LEFT
		case KEY_LEFT:
#endif
		case 'H':
		case 'h':

			port--;
			if (port < 0)
				port = unit->nports - 1;

			scr_opt = 2;
			break;

#ifdef KEY_RIGHT
		case KEY_RIGHT:
#endif
		case 'L':
		case 'l':

			port++;
			if (port >= (int) unit->nports)
				port = 0;

			scr_opt = 2;
			break;

#ifdef KEY_UP
		case KEY_UP:
#endif
		case 'K':
		case 'k':
			{
				int curr_unit = unit->unit_number;
				do {
					curr_unit--;
					if (curr_unit < 0)
						curr_unit = num_devices - 1;
				}
				while (device_info[curr_unit].status != UP);

				unit = &device_info[curr_unit];

				if (port >= (int) unit->nports)
					port = unit->nports - 1;
			}

			scr_opt = 1;
			break;

#ifdef KEY_DOWN
		case KEY_DOWN:
#endif
		case 'J':
		case 'j':
			{
				int curr_unit = unit->unit_number;
				do {
					if (curr_unit < num_devices - 1)
						curr_unit++;
					else
						curr_unit = 0;
				}
				while (device_info[curr_unit].status != UP);

				unit = &device_info[curr_unit];

				if (port >= (int) unit->nports)
					port = unit->nports - 1;

			}

			scr_opt = 1;
			break;

		case 'q':
		case 'Q':
		case ESC:
			hide_panel (GetPan(ChanWin));
			erase_win (ChanWin);
			update_panels ();
			doupdate ();
			scr_opt = 0;
			break;

		case 'T':
		case 't':
			scr_opt = 0;

			hide_panel (GetPan(ChanWin));
			update_panels ();
			doupdate ();

			handle_loopback(unit, &node, &chan, port);

			change_term (0, TIMEOUT);

			show_panel (GetPan(ChanWin));
			update_panels ();
			doupdate ();
			wrefresh (chanwin);
			break;

		case 'D':
		case 'd':
			scr_opt = 0;

			{
				int invoke_one = 1;

				while (invoke_one)
				{
					if (d_invokes_capture)
					{
						invoke_one = handle_scope (unit, &node,  &chan, port);
					}
					else
					{
						invoke_one = handle_exam (unit, &node, port);
					}

					if (invoke_one)
						d_invokes_capture = 1 - d_invokes_capture;
				}
			}

			touchwin (chanwin);
			wrefresh (chanwin);
			update_panels ();
			doupdate ();
			break;


#ifdef KEY_PRINT
		case KEY_PRINT:
#endif
		case '':
			scr_opt = 0;

			screen_save (ChanWin, logfile);
			touchwin (chanwin);
			wrefresh (chanwin);
			update_panels ();
			doupdate ();
			break;

		case KEY_F (1):		   /*  Help info  */
		case '?':
			scr_opt = 0;
			info_screen (dpa_info2, dpa_info2_len, NULL);
			update_panels ();
			doupdate ();
			break;

		default:
			scr_opt = 0;
			mvwprintw (chanwin, 16, 60, "Invalid key");
			wrefresh (chanwin);
			sleep (1);
			mvwprintw (chanwin, 16, 60, "           ");
			wrefresh (chanwin);
			break;
		}						   /* End Case */
	}							   /* End While */
}