void mod_ui::draw_layering_ui_lines(WINDOW *win)
{
    // make window border
    wborder(win, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
            LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
    // make appropriate lines
    mvwhline(win, 3, 1, 0, FULL_SCREEN_WIDTH - 2);
    mvwhline(win, FULL_SCREEN_HEIGHT - 7, 1, 0, FULL_SCREEN_WIDTH - 2);
    mvwhline(win, 5, 1, 0, (FULL_SCREEN_WIDTH / 2) - 4);
    mvwhline(win, 5, (FULL_SCREEN_WIDTH / 2) + 2, 0, (FULL_SCREEN_WIDTH / 2) - 3);

    mvwvline(win, 3, (FULL_SCREEN_WIDTH / 2) - 4, 0, FULL_SCREEN_HEIGHT - 10);
    mvwvline(win, 3, (FULL_SCREEN_WIDTH / 2) + 2, 0, FULL_SCREEN_HEIGHT - 10);
    // Add in connective characters
    mvwaddch(win, 3, 0, LINE_XXXO);
    mvwaddch(win, 5, 0, LINE_XXXO);
    mvwaddch(win, FULL_SCREEN_HEIGHT - 7, 0, LINE_XXXO);
    mvwaddch(win, 5, (FULL_SCREEN_WIDTH / 2) + 2, LINE_XXXO);

    mvwaddch(win, 3, FULL_SCREEN_WIDTH - 1, LINE_XOXX);
    mvwaddch(win, 5, FULL_SCREEN_WIDTH - 1, LINE_XOXX);
    mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH - 1, LINE_XOXX);
    mvwaddch(win, 5, (FULL_SCREEN_WIDTH / 2) - 4, LINE_XOXX);

    mvwaddch(win, 3, FULL_SCREEN_WIDTH / 2 - 4, LINE_OXXX);
    mvwaddch(win, 3, FULL_SCREEN_WIDTH / 2 + 2, LINE_OXXX);

    mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH / 2 - 4, LINE_XXOX);
    mvwaddch(win, FULL_SCREEN_HEIGHT - 7, FULL_SCREEN_WIDTH / 2 + 2, LINE_XXOX);
}
Example #2
0
Vector2i get_menu_cdef_pos(void)
{
	return (Vector2i) {
		.y = get_menu_tile_pos(min(stgs.colors->n, MENU_TILES_PER_COL)).y + MENU_TILE_SIZE + MENU_TILE_VSEP + 1,
		.x = rules_pos.x - MENU_TILE_SIZE - MENU_TILE_HSEP + 1
	};
}

static void draw_edge(void)
{
	Simulation *sim = stgs.linked_sim;
	size_t h = MENU_WINDOW_WIDTH, v = MENU_WINDOW_HEIGHT;

	if (sim && is_grid_sparse(sim->grid)) {
		wattrset(menuw, GET_PAIR_FOR(MENU_EDGE_COLOR_S));
		mvwaddstr(menuw, sparse_msg_pos.y, sparse_msg_pos.x, sparse_msg);
	} else {
		wattrset(menuw, GET_PAIR_FOR(MENU_EDGE_COLOR));
		mvwhline(menuw, sparse_msg_pos.y, sparse_msg_pos.x, ' ', strlen(sparse_msg));
	}

	mvwhline(menuw, 0,   0,   ACS_BLOCK, h);
	mvwvline(menuw, 0,   0,   ACS_BLOCK, v);
	mvwhline(menuw, v-1, 0,   ACS_BLOCK, h);
	mvwvline(menuw, 0,   h-1, ACS_BLOCK, v);
}
void drawRF24Pad(){
  
   wclear(rf24Pad);
   mvwprintw(rf24Pad,1,0,"Address: 0%o\n",mesh.mesh_address);
   wprintw(rf24Pad,"nodeID: %d\n",mesh.getNodeID());
   wprintw(rf24Pad,"En Mesh: %s\n", gw.meshEnabled() ? "True" : "False");
   int dr = radio.getDataRate();
   wprintw(rf24Pad,"Data-Rate: %s\n", dr == 0 ? "1MBPS" : dr == 1 ? "2MBPS" : dr == 2 ? "250KBPS" : "ERROR" ); 
   int pa = radio.getPALevel();
   wprintw(rf24Pad,"PA Level: %s\n", pa == 0 ? "MIN" : pa == 1 ? "LOW" : pa == 2 ? "HIGH" : pa == 3 ? "MAX" : "ERROR" );
   wprintw(rf24Pad,"IF Type: %s\n", gw.config_TUN == 1 ? "TUN" : "TAP" );
   wprintw(rf24Pad,"IF Drops: %u\n", gw.ifDropped() );
   #if defined (ENABLE_NETWORK_STATS)
     uint32_t ok,fail;
	 network.failures(&fail,&ok);
     wprintw(rf24Pad,"TX Packets: %u\n", ok );
	 wprintw(rf24Pad,"TX Drops: %u\n", fail );
   #endif
   
   if(padSelection == 1){
	 wattron(rf24Pad,COLOR_PAIR(1));
	   mvwhline(rf24Pad,rf24Scroll,0,ACS_HLINE, maxY);
	   wattroff(rf24Pad,COLOR_PAIR(1));
	   mvwprintw(rf24Pad,rf24Scroll,3," RF24Network Info: ");
	}else{
	   wattroff(rf24Pad,COLOR_PAIR(1));
	   mvwhline(rf24Pad,rf24Scroll,0,ACS_HLINE, maxY);
	   mvwprintw(rf24Pad,rf24Scroll,3," RF24Network Info: ");
	   
	}

}
Example #4
0
int show_teacher_info(char *database, int choice) {
	int c;
	teacher xteacher;
	xteacher = get_teacher(database,choice);
	refresh();
	noecho();
	curs_set(0);
	WINDOW *win;
	int y,x;
	start_color();
	getmaxyx(stdscr,y,x);
	win = newwin(0, 0, 0, 0);
	init_pair(1, COLOR_RED, COLOR_BLACK);
	box(win, 0, 0);
	print_in_middle(win, y/4 + 1, 0, x, "Info", COLOR_PAIR(1));
	mvwhline(win, y/4, x/4, ACS_HLINE, x/2);
	mvwhline(win, y/4 + 2, x/4, ACS_HLINE, x/2);
	mvwhline(win, y/2, x/4, ACS_HLINE, x/2);
	mvwvline(win, y/4 + 1, x/4 , ACS_VLINE, y/4 - 1);
	mvwaddch(win, y/4, x/4 , ACS_ULCORNER);
	mvwaddch(win, y/2, x/4 , ACS_LLCORNER);
	mvwaddch(win, y/4, 3*x/4 , ACS_URCORNER);
	mvwaddch(win, y/2, 3*x/4 , ACS_LRCORNER);
	mvwvline(win, y/4 + 1, 3*x/4, ACS_VLINE, y/4 - 1);
	mvwaddch(win, y/4 + 2, 3*x/4 , ACS_RTEE);
	mvwaddch(win, y/4 + 2, x/4 , ACS_LTEE);
	wrefresh(win);
	mvwaddch(win, y - 3, 0, ACS_LTEE);
	mvwhline(win, y - 3, 1, ACS_HLINE, x - 2);
	mvwaddch(win, y - 3, x - 1, ACS_RTEE);
	move(y/4 + 3,x/3 + 2);
	printw("Name - %s",xteacher.name);
	move(y/4 + 5,x/3 + 2);
	printw("Max Weekly Hours - %d",xteacher.week_time);
	mvwprintw(win,y - 2, 2,"A:Add Allocation\tB:Back\tQ:Quit");
	refresh();
	while((c = wgetch(win))){
		switch(c) {
			case KEY_DOWN:
			case KEY_UP:
				return 0;
			case 'B':
			case 'b':
				curs_set(1);
				return 1;
			case 'Q':
			case 'q':
				curs_set(1);
				return INT_MIN;
			case 'A':
			case 'a':
				return 2;
			default:
				break;
		}
		wrefresh(win);
	}
	curs_set(1);
	return 0;
}
Example #5
0
static void draw_color_tile(Vector2i top_left, color_t c)
{
	chtype pair;
	bool is_def = c == stgs.colors->def;
	int y = top_left.y, x = top_left.x, s = MENU_TILE_SIZE;

	/* Draw tile */
	wattrset(menuw, pair = GET_PAIR_FOR(c));
	if (is_def) {
		wattron(menuw, A_REVERSE);
	}
	draw_square(menuw, top_left, s);

	/* Draw direction arrow */
	if (!is_def) {
		wattron(menuw, A_REVERSE);
		mvwaddch(menuw, y+s/2, x+s/2, turn2arrow(stgs.colors->turn[c]));
	}

	/* Draw frame */
	wattrset(menuw, is_def ? pair : fg_pair);
	mvwhline(menuw, y,     x,     ACS_BLOCK, s);
	mvwvline(menuw, y,     x,     ACS_BLOCK, s);
	mvwhline(menuw, y+s-1, x,     ACS_BLOCK, s);
	mvwvline(menuw, y,     x+s-1, ACS_BLOCK, s);
}
Example #6
0
static void
gnt_entry_draw(GntWidget *widget)
{
	GntEntry *entry = GNT_ENTRY(widget);
	int stop;
	gboolean focus;
	int curpos;

	if ((focus = gnt_widget_has_focus(widget)))
		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TEXT_NORMAL));
	else
		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));

	if (entry->masked)
	{
		mvwhline(widget->window, 0, 0, gnt_ascii_only() ? '*' : ACS_BULLET,
				g_utf8_pointer_to_offset(entry->scroll, entry->end));
	}
	else
		mvwprintw(widget->window, 0, 0, "%s", C_(entry->scroll));

	stop = gnt_util_onscreen_width(entry->scroll, entry->end);
	if (stop < widget->priv.width)
		mvwhline(widget->window, 0, stop, ENTRY_CHAR, widget->priv.width - stop);

	curpos = gnt_util_onscreen_width(entry->scroll, entry->cursor);
	if (focus)
		mvwchgat(widget->window, 0, curpos, 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
	wmove(widget->window, 0, curpos);

	GNTDEBUG;
}
Example #7
0
void nc_scr_frame_draw(struct nc_scr *scr)
{
	int ltitle_len, rtitle_len;

	DBGS("ltitle '%s'\n", scr->frame.ltitle);
	DBGS("rtitle '%s'\n", scr->frame.rtitle);
	DBGS("help '%s'\n", scr->frame.help);
	DBGS("status '%s'\n", scr->frame.status);

	ltitle_len = strlen(scr->frame.ltitle);
	rtitle_len = scr->frame.rtitle ? strlen(scr->frame.rtitle) : 0;

	/* if both ltitle and rtitle don't fit, trim rtitle */
	if (ltitle_len + rtitle_len + nc_scr_pos_lrtitle_space > COLS - 2)
		rtitle_len = COLS - 2 - ltitle_len - nc_scr_pos_lrtitle_space;

	mvwaddstr(scr->main_ncw, nc_scr_pos_title, 1, scr->frame.ltitle);
	mvwaddnstr(scr->main_ncw, nc_scr_pos_title, COLS - rtitle_len - 1,
			scr->frame.rtitle, rtitle_len);
	mvwhline(scr->main_ncw, nc_scr_pos_title_sep, 1, ACS_HLINE, COLS - 2);

	mvwhline(scr->main_ncw, LINES - nc_scr_pos_help_sep, 1, ACS_HLINE,
		COLS - 2);
	mvwaddstr(scr->main_ncw, LINES - nc_scr_pos_help, 1, scr->frame.help);
	nc_scr_status_draw(scr);
}
Example #8
0
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
void                    CDrawer::DrawRows          () const
{

    int y_coord     = FIRST_ROW;
    int sheet_width = ( m_list->m_Psize.m_cellWidth + CELL_BORDER ) *
                        m_list->m_Vsize.m_columns.m_columnsMax + 
                      ( m_list->m_Psize.m_maxLines.length() + CELL_BORDER );
    
    for ( register int i = 0; i < m_list->m_Vsize.m_rows.m_rowsMax + WASTED_ROWS; i++ )
    {
        if (i > ROWS_WITHOUT_NUMBER)
        {   
            const std::string& name = m_list->m_Vsize.m_rows.m_row[i-2]->ShowMyName();
            int y             = y_coord - 1;
            int x             = ( ( m_list->m_Psize.m_maxLines.length() - 
                                   name.length() ) / 2 ) + SHEET_BORDER;
            
            mvwprintw(stdscr, y, x, "%s", name.c_str());
        }
        
       if (m_cursor->Move(y_coord, SHEET_BORDER) == true)
       { 
           if (i == 0 || i == 1)
               mvwhline( stdscr, m_cursor->GetY(), m_cursor->GetX(), 
                         ACS_HLINE, sheet_width - 1 );
           else
               mvwhline( stdscr, m_cursor->GetY(), m_cursor->GetX(),
                         ACS_HLINE, sheet_width );
           
           y_coord += ROW_HEIGHT;
       }
    }
}
Example #9
0
void DrawBox(WINDOW* win, int height, int width, int starty, int startx, bool isFirst, bool isLast)
{
	mvwhline(win, starty, startx + 1, ACS_HLINE, width  );
	mvwhline(win, starty + height - 1, startx + 1, ACS_HLINE, width );
	mvwvline(win, starty + 1, startx, ACS_VLINE, height - 2 );
	//mvwvline(win, starty + 1 , width + startx, ACS_VLINE, height - 2 );
	zlog_info(c, "Drawing box (h=%3d, w=%3d, starty=%3d, startx=%3d, f=%d, l=%d",
		  height,
		  width,
		  starty,
		  startx,
		  isFirst,
		  isLast);

	wmove(win, starty + 1, startx + 2);  wprintw(win, "%d,%d,%d", startx, starty, (starty % 3));


	if (isFirst) {
		wmove(win, starty, startx); waddch(win, ACS_ULCORNER);
		wmove(win, starty + height - 1, startx); waddch(win, ACS_LLCORNER);
	}
	if (!isLast) {
		wmove(win, starty, startx + width); waddch(win, ACS_TTEE);
		wmove(win, starty + height - 1, startx + width); waddch(win, ACS_BTEE);
	}else{
		wmove(win, starty, startx + width); waddch(win, ACS_URCORNER);
		wmove(win, starty + height - 1, startx + width); waddch(win, ACS_LRCORNER);
		mvwvline(win, starty + 1, width + startx, ACS_VLINE, height - 2 );

	}


}
Example #10
0
/*
 * This draws a box with attributes and lets the user define
 * each element of the box.
 */
void attrbox (WINDOW *win,
	      chtype tlc,
	      chtype trc,
	      chtype blc,
	      chtype brc,
	      chtype horz,
	      chtype vert,
	      chtype attr)
{
   /* *INDENT-EQLS* */
   int x1       = 0;
   int y1       = 0;
   int y2       = getmaxy (win) - 1;
   int x2       = getmaxx (win) - 1;
   int count    = 0;

   /* Draw horizontal lines. */
   if (horz != 0)
   {
      mvwhline (win, y1, 0, horz | attr, getmaxx (win));
      mvwhline (win, y2, 0, horz | attr, getmaxx (win));
      count++;
   }

   /* Draw vertical lines. */
   if (vert != 0)
   {
      mvwvline (win, 0, x1, vert | attr, getmaxy (win));
      mvwvline (win, 0, x2, vert | attr, getmaxy (win));
      count++;
   }

   /* Draw in the corners. */
   if (tlc != 0)
   {
      mvwaddch (win, y1, x1, tlc | attr);
      count++;
   }
   if (trc != 0)
   {
      mvwaddch (win, y1, x2, trc | attr);
      count++;
   }
   if (blc != 0)
   {
      mvwaddch (win, y2, x1, blc | attr);
      count++;
   }
   if (brc != 0)
   {
      mvwaddch (win, y2, x2, brc | attr);
      count++;
   }
   if (count != 0)
   {
      wrefresh (win);
   }
}
Example #11
0
void drawend() 
{
    mvwhline(game.brdwin, (BRD_HEIGHT/2)-1, 1, ' ' | COLOR_PAIR(WHITE), BRD_WIDTH);
    mvwhline(game.brdwin, (BRD_HEIGHT/2)+0, 1, ' ' | COLOR_PAIR(WHITE), BRD_WIDTH);
    wattrset(game.brdwin, A_BOLD | COLOR_PAIR(BLACK));
    mvwprintw(game.brdwin, (BRD_HEIGHT/2)-1, (BRD_WIDTH/2)-2, " GAME ");
    mvwprintw(game.brdwin, (BRD_HEIGHT/2)+0, (BRD_WIDTH/2)-2, " OVER ");
    wattrset(game.brdwin, A_NORMAL);
}
Example #12
0
File: ui.c Project: ab/pwman
int
ui_draw_bottom()
{
	werase(bottom);
	mvwhline(bottom, 0, 0, ACS_HLINE, COLS);
	mvwhline(bottom, 2, 0, ACS_HLINE, COLS);

	wrefresh(bottom);
}
Example #13
0
void print_pad(WINDOW *pad, int v)
{
	mvwprintw(pad, 1, 1, "%3d", v);
	v/=2;
	wattron(pad, A_REVERSE);
	mvwhline(pad, 1, 5, ' ', v);
	wattroff(pad, A_REVERSE);
	mvwhline(pad, 1, v+5, ' ', 50-v);
	wrefresh(pad);
}
Example #14
0
void		Window::printBox(int x, int y, int w, int h) const {
	mvwaddch(window_white, y, x, ACS_PLUS);
	mvwaddch(window_white, y, x + w, ACS_PLUS);
	mvwaddch(window_white, y + h, x, ACS_PLUS);
	mvwaddch(window_white, y + h, x + w, ACS_PLUS);
	mvwhline(window_white, y, x + 1, ACS_HLINE, w - 1);
	mvwhline(window_white, y + h, x + 1, ACS_HLINE, w - 1);
	mvwvline(window_white, y + 1, x, '|', h - 1);
	mvwvline(window_white, y + 1, x + w, '|', h - 1);
}
Example #15
0
void		Plazza::printEcrased()
{
  wattron(_footer, COLOR_PAIR(3));
  mvwprintw(_footer, 10, 0, "|");
  mvwprintw(_footer, 11, 0, "+");
  mvwhline(_footer, 11, 1, '-', _parentX);
  mvwhline(_footer, 11, _parentX - 1, '-', _parentX);
  wattron(_footer, COLOR_PAIR(4));
  mvwprintw(_footer, 9, 2, "What do you want buddy ?");
  wattroff(_footer, COLOR_PAIR(4));
  wrefresh(_footer);
  wattroff(_footer, COLOR_PAIR(3));
}
Example #16
0
int win_ini(int *fil, int *col, char creq, unsigned int inv)
{
  int p_fil,p_col;
  chtype wc;

  if (hi_ha_win) return(-1);       /* error si ja s'havia creat la finestra */
  if (initscr() == NULL) return(-2);    /* error en iniciar les curses */
  if ((*fil > LINES) || (*col > COLS))    /* error en les mides */
  { endwin();
    return(-3);
  }
  if (*fil == 0) *fil = LINES;	/* cas de mida maxima */
  if (*col == 0) *col = COLS;
  p_fil = (LINES - *fil)/ 2;		/* posicio de la finestra centrada */
  p_col = (COLS - *col) / 2;
                              /* canviar interrupcio de final de proces */
  oldsig = signal(SIGINT,win_fi);
	                     /* configuracio preliminar de les curses */
  cbreak();			/* rep tecles sense buffering */
  noecho();			/* no fa echo de les tecles llegides */
  nonl();			/* el newline \n no es tradueix a CR i LF */
  intrflush(stdscr,FALSE);	/* ^C no s'esborra del buffer d'entrada */
  keypad(stdscr,TRUE);		/* s'activa el teclat numeric i mov. cursor */

  win = newwin(*fil, *col, p_fil, p_col);

  if (win == NULL)            /* error en la creacio de la finestra */
  { endwin();
    return(-4);
  }
  hi_ha_win = TRUE;

  leaveok(win,TRUE);	/* dibuixar en pantalla no modificara el cursor */
  curs_set(0);		/* fixa el cursor com a invisible */
  nodelay(win,TRUE);
  refresh();		/* refresca la pantalla (inicialment l'esborra) */

  ufil = *fil;			/* memoritza numero files */
  ucol = *col;			/* memoritza numero columnes */
  wc = creq;			/* dibuixa el requadre */
  if (inv) wc |= A_REVERSE;
  mvwhline(win,0,0,wc,ucol);		/* fila superior */
  mvwhline(win,ufil-2,0,wc,ucol);	/* fila inferior */
  mvwvline(win,1,0,wc,ufil-2);		/* columna dreta */
  mvwvline(win,1,ucol-1,wc,ufil-2);	/* columna esquerra */
  wrefresh(win);		/* redibuixa el contingut de la finestra */
  return(0);			/* retorna OK */
}
Example #17
0
void drawStatsArea() {
    wclear(stats);
    wbkgd(stats,COLOR_PAIR(0) | A_DIM);
    //wattrset(stats,COLOR_PAIR(1));
    box(stats,ACS_VLINE,ACS_HLINE);
    wattrset(stats,A_BOLD);
    mvwprintw(stats, 1, 1, player.player_name);
    wattrset(stats,A_NORMAL);

    mvwprintw(stats, 2, 1, "%s", races[player.race].race_name);
    mvwprintw(stats, 3, 1, "Gold: %i", player.gold);
    mvwprintw(stats, 4, 1, "Level: %i", player.level);
    mvwprintw(stats, 5, 1, "HP: %i", player.hp);
    mvwprintw(stats, 6, 1, "XP: %i", player.xp);
    mvwprintw(stats, 7, 1, "STR: %i", player.str);
    mvwprintw(stats, 8, 1, "DEF: %i", player.def);
    mvwprintw(stats, 9, 1, "AGI: %i", player.agi);
    //mvwprintw(stats,10,1,"X: %i",player.x);
    //mvwprintw(stats,11,1,"Y: %i",player.y);
    //mvwprintw(stats,12,1,"TopX: %i",mapTopX);
    //mvwprintw(stats,13,1,"TopY: %i",mapTopY);

    mvwhline(stats,16,1,ACS_HLINE,18);
    mvwprintw(stats, 17, 1, "Slain: %i",player.slain);
    mvwprintw(stats, 18, 1, "XP Needed: %i", 100 - player.xp_earned);
    wrefresh(stats);
}
Example #18
0
/*
 * Paint the info line for the PC style SLK emulation.
 *
 */
static void
slk_paint_info(WINDOW *win)
{
  if (win && _nc_slk_format==4)
    {
      int i;

      mvwhline (win,0,0,0,getmaxx(win));
      wmove (win,0,0);

      for (i = 0; i < SP->_slk->maxlab; i++) {
	if (win && _nc_slk_format==4)
	  {
	    mvwaddch(win,0,SP->_slk->ent[i].x,'F');
	    if (i<9)
	      waddch(win,'1'+i);
	    else
	      {
		waddch(win,'1');
		waddch(win,'0' + (i-9));
	      }
	  }
      }
    }
}
Example #19
0
static void
draw_replay_info(struct nh_replay_info *rinfo)
{
    char buf[BUFSZ];

    sprintf(buf, "REPLAY action %d/%d", rinfo->actions, rinfo->max_actions);
    if (*rinfo->nextcmd)
        sprintf(buf + strlen(buf), "; next command: %s.", rinfo->nextcmd);

    if (ui_flags.draw_frame) {
        /* draw the replay state on top of the frame under the map */
        mvwhline(basewin, 2 + ui_flags.msgheight + ROWNO, 1, ACS_HLINE, COLNO);
        wattron(basewin, COLOR_PAIR(4) | A_BOLD);
        mvwaddstr(basewin, 2 + ui_flags.msgheight + ROWNO, 2, buf);
        wattroff(basewin, COLOR_PAIR(4) | A_BOLD);
    } else {
        /* try to draw under the status */
        int h = ui_flags.msgheight + ROWNO + (ui_flags.status3 ? 3 : 2);

        if (h < LINES) {
            wattron(basewin, COLOR_PAIR(4) | A_BOLD);
            mvwaddstr(basewin, h, 0, buf);
            wattroff(basewin, COLOR_PAIR(4) | A_BOLD);
            wclrtoeol(basewin);
        }       /* else: make do without replay info */
    }
    wnoutrefresh(basewin);
    /* refresh on basewin erases the windows on top of it ... */
    touchwin(msgwin);
    wnoutrefresh(msgwin);
    touchwin(mapwin);
    wnoutrefresh(mapwin);
}
Example #20
0
void Help(int *value)
{
  int c;
  int output = 0;
  // Create new window
  WINDOW *help_win;
  help_win = newwin(15, 50, 4, 4);
  keypad(help_win, TRUE);          // Enable keyboard input
  box(help_win, 0, 0);             // Put a box around the wimdow
  // Add title
  print_in_middle(help_win, 1, 0, 50, "HELP", COLOR_PAIR(1));
  mvwaddch(help_win, 2, 0, ACS_LTEE);
  mvwhline(help_win, 2, 1, ACS_HLINE, 48);
  mvwaddch(help_win, 2, 39, ACS_RTEE);
  // Add text
  mvwaddstr(help_win, 3, 2, "WE BOTH KNOW YOU DON'T NEED HELP! ");
  mvwaddstr(help_win, 4, 2, "JUST GO AND PLAY");
  mvwaddstr(help_win, 6, 2, "Press q to go back");
  wrefresh(help_win);              // Refres the window
  // Wait for correct user input
  while((c = wgetch(help_win)) != 'q'){}
  // Destroy the window
  endwin();
  //Write the output
  *value = output;
}
Example #21
0
void
dialog_progress_set_value(WINDOW *win, int perc)
{
    int height, width;

    getmaxyx(win, height, width);
    mvwhline(win, 4, 4, '-', width - 10);
    mvwaddch(win, 4, 3, '[');
    mvwaddch(win, 4, width - 7, ']');
    mvwprintw(win, 4, width - 5, "%d%%", perc);

    if (perc > 0 && perc <= 100)
        mvwhline(win, 4, 4, ACS_CKBOARD, (width - 10) * ((float)perc/100));

    wrefresh(win);
}
Example #22
0
/* render dashboard bars (graph) */
void
render_bars (WINDOW * win, GDashModule * module_data, int y, int *x, int idx,
             int w, int selected)
{
   GDashStyle *style = module_style;
   GModule module = module_data->module;
   char *bar;

   if (style[module].color_bars == -1)
      return;

   bar = get_bars (module_data->data[idx].hits, module_data->max_hits, *x);
   if (selected) {
      if (conf.color_scheme == MONOCHROME)
         init_pair (1, COLOR_BLACK, COLOR_WHITE);
      else
         init_pair (1, COLOR_BLACK, COLOR_GREEN);

      wattron (win, COLOR_PAIR (HIGHLIGHT));
      mvwhline (win, y, *x, ' ', w);
      mvwprintw (win, y, *x, "%s", bar);
      wattroff (win, COLOR_PAIR (HIGHLIGHT));
   } else {
      mvwprintw (win, y, *x, "%s", bar);
   }
   free (bar);
}
Example #23
0
static int SCW_HLineAt(lua_State *L){
	WINDOW **w = checkSelCWindow(L);
	int x = luaL_checkint(L, 2);
	int y = luaL_checkint(L, 3);
	int n = luaL_checkint(L, 4);
	char ch = '-';

	if(lua_gettop(L) > 4) switch( lua_type(L, 5 )){
	case LUA_TNUMBER:
		ch = lua_tointeger(L, 5 );
		break;
	case LUA_TSTRING:
		ch = *lua_tostring(L, 5 );
		break;
	default :
		lua_pushnil(L);
		lua_pushstring(L, "HlineAt() expects an integer or a string");
		return 2;
	}

	if(mvwhline( *w, y ,x, ch, n ) == ERR){
		lua_pushnil(L);
		lua_pushstring(L, "whline() returned an error");
		return 2;
	}

	return 0;	
}
Example #24
0
File: nmm.c Project: ryanakca/nmm
/*
 * Draw board for Three Man Morris
 */
WINDOW *
create_3board(const game *g)
{
  WINDOW *local_win;
  int r = 0;
  char c = 'a';

  local_win = newwin(13 + legendsep, 21 + legendsep, brdrow, brdcol);

  /* Draw the legend */
  for (r = 0; r < 3; r++) {
    mvwprintw(local_win, 6*r, 0, "%d", 3-r);
  }
  c = 'a';
  for (r = 0; r < 21; r += 9) {
    mvwaddch(local_win, 14, legendsep + r, c++);
  }
  /* Draw the board lines */
  for (r = 0; r < 3; r++) {
    mvwhline(local_win, 6*r, legendsep, '-', 18);
    mvwvline(local_win, 1, legendsep + 9*r, '|', 11);
  }

  update_3board(local_win, g);
  return local_win;
}
Example #25
0
/* render dashboard usecs */
void
render_usecs (WINDOW * win, GDashModule * module_data, int y, int *x,
              int idx, int w, int selected)
{
   GDashStyle *style = module_style;
   GModule module = module_data->module;

   if (module_data->module == HOSTS && module_data->data[idx].is_subitem)
      goto inc;
   if (style[module].color_usecs == -1)
      return;

   if (selected) {
      if (conf.color_scheme == MONOCHROME)
         init_pair (1, COLOR_BLACK, COLOR_WHITE);
      else
         init_pair (1, COLOR_BLACK, COLOR_GREEN);

      wattron (win, COLOR_PAIR (HIGHLIGHT));
      mvwhline (win, y, *x, ' ', w);
      mvwprintw (win, y, *x, "%9s", module_data->data[idx].serve_time);
      wattroff (win, COLOR_PAIR (HIGHLIGHT));
   } else {
      wattron (win, A_BOLD | COLOR_PAIR (style[module].color_usecs));
      mvwprintw (win, y, *x, "%9s", module_data->data[idx].serve_time);
      wattroff (win, A_BOLD | COLOR_PAIR (style[module].color_usecs));
   }
 inc:
   *x += DASH_SRV_TM_LEN + DASH_SPACE;
}
Example #26
0
/* render dashboard hits */
void
render_hits (WINDOW * win, GDashModule * module_data, int y, int *x, int idx,
             int w, int selected)
{
   GDashStyle *style = module_style;
   GModule module = module_data->module;

   if (module_data->module == HOSTS && module_data->data[idx].is_subitem)
      goto inc;

   if (selected) {
      if (conf.color_scheme == MONOCHROME)
         init_pair (1, COLOR_BLACK, COLOR_WHITE);
      else
         init_pair (1, COLOR_BLACK, COLOR_GREEN);

      wattron (win, COLOR_PAIR (HIGHLIGHT));
      mvwhline (win, y, 0, ' ', w);
      mvwprintw (win, y, *x, "%d", module_data->data[idx].hits);
      wattroff (win, COLOR_PAIR (HIGHLIGHT));
   } else {
      wattron (win, COLOR_PAIR (style[module].color_hits));
      mvwprintw (win, y, *x, "%d", module_data->data[idx].hits);
      wattroff (win, COLOR_PAIR (style[module].color_hits));
   }
 inc:
   *x += module_data->hits_len + DASH_SPACE;
}
Example #27
0
static void ui_window_draw_status(UiWin *w) {
	UiCursesWin *win = (UiCursesWin*)w;
	if (!win->winstatus)
		return;
	UiCurses *uic = win->ui;
	Vis *vis = uic->vis;
	bool focused = uic->selwin == win;
	const char *filename = vis_file_name(win->file);
	const char *status = vis_mode_status(vis);
	wattrset(win->winstatus, focused ? A_REVERSE|A_BOLD : A_REVERSE);
	mvwhline(win->winstatus, 0, 0, ' ', win->width);
	mvwprintw(win->winstatus, 0, 0, "%s %s %s %s",
	          focused && status ? status : "",
	          filename ? filename : "[No Name]",
	          text_modified(vis_file_text(win->file)) ? "[+]" : "",
	          vis_macro_recording(vis) ? "recording": "");

	char buf[4*32] = "", *msg = buf;
	int cursor_count = view_cursors_count(win->view);
	if (cursor_count > 1) {
		Cursor *c = view_cursors_primary_get(win->view);
		int cursor_number = view_cursors_number(c) + 1;
		msg += sprintf(msg, "[%d/%d] ", cursor_number, cursor_count);
	}

	if (!(win->options & UI_OPTION_LARGE_FILE)) {
		CursorPos pos = view_cursor_getpos(win->view);
		msg += sprintf(msg, "%zd, %zd", pos.line, pos.col);
	}

	if (buf[0])
		mvwaddstr(win->winstatus, 0, win->width - (msg - buf) - 1, buf);
}
Example #28
0
void draw_menu(WINDOW *win, MENU *menu){

	int i;

	int MENU_WIDTH = 20;
	int SCREEN_WIDTH = 100;

	clear();

	/* Print a border around the main window and print a title */
	box(win, 0, 0);

	print_in_middle(win, 1, 0, MENU_WIDTH, "Game mode", COLOR_PAIR(0));
	mvwaddch(win, 2, 0, ACS_LTEE);
	mvwhline(win, 2, 1, ACS_HLINE, MENU_WIDTH);
	mvwaddch(win, 2, MENU_WIDTH + 1, ACS_RTEE);
	mvprintw(3, (SCREEN_WIDTH/2) - (36/2), "textris - An ASCII based Tetris game");

	//decorative shapes
	for(i =0; i<7; i++){
		shape s;
		s.rotation = 0;
		s.type = i;
		s.x = 0;
		s.y = 0;
		draw_shape(s, (i*10) + (SCREEN_WIDTH/2) - ((10*7)/2), 15);
	}
	wrefresh(win);
	refresh();
}
Example #29
0
/*
 * This draws a line on the given window. (odd angle lines not working yet)
 */
void drawLine (WINDOW *window, int startx, int starty, int endx, int endy, chtype line)
{
   /* *INDENT-EQLS* */
   int xdiff    = endx - startx;
   int ydiff    = endy - starty;
   int x        = 0;
   int y        = 0;

   /* Determine if we are drawing a horizontal or vertical line. */
   if (ydiff == 0)
   {
      if (xdiff > 0)
	 mvwhline (window, starty, startx, line, xdiff);
   }
   else if (xdiff == 0)
   {
      if (ydiff > 0)
	 mvwvline (window, starty, startx, line, ydiff);
   }
   else
   {
      /* We need to determine the angle of the line. */
      /* *INDENT-EQLS* */
      int height        = xdiff;
      int width         = ydiff;
      int xratio        = (height > width ? 1 : (width / height));
      int yratio        = (width > height ? (width / height) : 1);
      int xadj          = 0;
      int yadj          = 0;

      /* Set the vars. */
      x = startx;
      y = starty;
      while (x != endx && y != endy)
      {
	 /* Add the char to the window. */
	 mvwaddch (window, y, x, line);

	 /* Make the x and y adjustments. */
	 if (xadj != xratio)
	 {
	    x = (xdiff < 0 ? x - 1 : x + 1);
	    xadj++;
	 }
	 else
	 {
	    xadj = 0;
	 }
	 if (yadj != yratio)
	 {
	    y = (ydiff < 0 ? y - 1 : y + 1);
	    yadj++;
	 }
	 else
	 {
	    yadj = 0;
	 }
      }
   }
}
Example #30
0
        void select( int entnum, uimenu *menu ) override {
            const int starty = 3;
            const int startx = menu->w_width - menu->pad_right;
            const std::string padding( menu->pad_right, ' ' );
            for( int y = 2; y < menu->w_height - 1; y++ ) {
                mvwprintw( menu->window, y, startx - 1, padding );
            }
            item tmp( standard_itype_ids[entnum], calendar::turn );
            mvwhline( menu->window, 1, startx, ' ', menu->pad_right - 1 );
            const std::string header = string_format( "#%d: %s%s%s", entnum,
                                       standard_itype_ids[entnum]->get_id().c_str(),
                                       ( incontainer ? _( " (contained)" ) : "" ),
                                       ( has_flag ? _( " (flagged)" ) : "" ) );
            mvwprintz( menu->window, 1, startx + ( menu->pad_right - 1 - header.size() ) / 2, c_cyan,
                       header );

            fold_and_print( menu->window, starty, startx, menu->pad_right - 1, c_light_gray, tmp.info( true ) );

            mvwprintz( menu->window, menu->w_height - 3, startx, c_green, msg );
            msg.erase();

            input_context ctxt( "UIMENU" );
            mvwprintw( menu->window, menu->w_height - 2, startx,
                       _( "[%s] find, [f] container, [F] flag, [%s] quit" ),
                       ctxt.get_desc( "FILTER" ).c_str(), ctxt.get_desc( "QUIT" ).c_str() );
        }