int showdiskspace()
{
	int dfkey;
	
	while(1)	{
		DrawDFUI();
		dfkey = getch();
		switch(dfkey)
			{
				case KEY_F(2):
				List_DF = 0;
				break;
				case KEY_F(10):
				return 0;
				break;
				case KEY_DOWN:
					wscrl(FSPAD, 3);
					prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
				break;
				case KEY_UP:
					wscrl(FSPAD, -3);
					prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
				break;
				
			}
	}	
	
	return 0;
	
}
void DrawDFUI()
{
	DrawFSDefaultScreen("Showing Disk Spaces");
		attron(A_BOLD);
		mvaddstr(3, 4, "Device");
		
		mvaddstr(3, 18, "Mount Directory");
		
		mvaddstr(3, 43, "1K Blocks	Used  Available");
		attroff(A_BOLD);
		refresh();
		
		if(List_DF < 1) {
				wclear(FSPAD);
				counter_FS=15;
				wmove(FSPAD, 15,2);
				process_df_disks();
				prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
				List_DF = 1;
			}
		else 	{
				prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
			}
				
	
}
Exemple #3
0
int main(void)
{
    WINDOW *pad_ptr;
    int x, y;
    int pad_lines;
    int pad_cols;
    char disp_char;

    initscr();
    pad_lines = LINES + 50;
    pad_cols = COLS + 50;
    pad_ptr = newpad(pad_lines, pad_cols);
    disp_char = 'a';

    for (x = 0; x < pad_lines; ++x) {
        for (y = 0; y < pad_cols; ++y) {
            mvwaddch(pad_ptr, x, y, disp_char);
            if (disp_char == 'z') {
                disp_char = 'a';
            } else {
                disp_char++;
            }
            
        }
    }

    prefresh(pad_ptr, 5, 7, 2, 2, 9, 9);
    sleep(1);
    prefresh(pad_ptr, LINES + 5, COLS + 7, 5, 5, 21, 19);
    sleep(1);
    delwin(pad_ptr);
    endwin();

    return 0;
}
Exemple #4
0
int main(void)
{
	WINDOW *p;
	
	initscr();

	p = newpad(50,100);		 /* create a new pad */
	if( p == NULL )
	{
		endwin();
		puts("Unable to create new pad");
		return(1);
	}

	waddstr(p,"This is pad data");
	addstr("New pad created\n");
	prefresh(p,0,0,12,0,13,40);
	printw("Pad y data is %d.\n",p->_pad._pad_y);
	printw("Pad x data is %d.\n",p->_pad._pad_x);
	printw("Pad top data is %d.\n",p->_pad._pad_top);
	printw("Pad left data is %d.\n",p->_pad._pad_left);
	printw("Pad bottom data is %d.\n",p->_pad._pad_bottom);
	printw("Pad right data is %d.\n",p->_pad._pad_right);
	refresh();
	prefresh(p,0,0,12,0,13,40);
	getch();
	
	endwin();
	return 0;
}
Exemple #5
0
int main(void)
{
   WINDOW *pad_ptr;
  int x, y, pad_lines, pad_cols;
   char disp_char;
   
   initscr();
   pad_lines = LINES + 50;
   pad_cols = COLS + 50;
   pad_ptr = newpad(pad_lines, pad_cols);
   disp_char = 'a'; 
  
    
   for(x = 0; x < pad_lines; x++)   
       for(y = 0; y < pad_cols; y++) { 
           /* move ch and put ch at given postition */
           mvwaddch(pad_ptr, x, y, disp_char);
           if(disp_char == 'z') disp_char = 'a';
           else disp_char++;
       }
       
   prefresh(pad_ptr, 5, 7, 2, 2, 9, 9);
   sleep(1);
   prefresh(pad_ptr, LINES + 5, COLS + 7, 5, 5, 21, 19);
   sleep(1);
     
   delwin(pad_ptr);
   
   endwin();
   
   exit(EXIT_SUCCESS);
}
int mntlistmain()
{
	
	int FS_KEY;

	while(1)
	{
		drawlistfs();
		
		FS_KEY = getch();
		switch(FS_KEY)
		{	
			case KEY_F(2):
			ListFS = 0;
			break;
			case KEY_F(10):
			return 0;
			case KEY_DOWN:
				wscrl(FSPAD, 3);
				prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
			break;
			case KEY_UP:
				wscrl(FSPAD, -3);
				prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
			break;
			
		}
	}
return 0;
}
Exemple #7
0
void refresh_show_pad (void)

{
	int left,top,right,bottom,i;

	if (show_pad_info.disable_output)
		return;

	if (show_pad_info.max_line < show_pad_info.display_lines-1) {
		for (i=show_pad_info.max_line+1;i<show_pad_info.display_lines;i++) {
			wmove (show_pad,i,0);wprintw (show_pad,"\n");
		}
	}
	left=0;right=show_pad_info.display_cols-1;
	top=TITLE_WIN_LINES+SHOW_WIN_LINES+1;bottom=top+show_pad_info.display_lines-1;

	if (show_pad_info.line > show_pad_info.max_line-show_pad_info.display_lines+1)
		show_pad_info.line=show_pad_info.max_line-show_pad_info.display_lines+1;

	if (show_pad_info.line < 0)
		show_pad_info.line=0;

#ifdef OLD_NCURSES
	prefresh (show_pad,show_pad_info.line,show_pad_info.col,top,left,show_pad_info.display_lines-1,show_pad_info.display_cols-1);
#else
	prefresh (show_pad,show_pad_info.line,show_pad_info.col,top,left,top+show_pad_info.display_lines-1,left+show_pad_info.display_cols-1);
#endif
}
Exemple #8
0
void Scrollpad::refresh()
{
	assert(m_real_height >= m_height);
	size_t max_beginning = m_real_height - m_height;
	m_beginning = std::min(m_beginning, max_beginning);
	prefresh(m_window, m_beginning, 0, m_start_y, m_start_x, m_start_y+m_height-1, m_start_x+m_width-1);
}
Exemple #9
0
void loadAndAddText(WINDOW **pad, int *textrows, char *filename) {
    FILE *f = fopen(filename, "r");
    char buf[1000];
    int line;

    if (f) {
        line = 0;
        while(fgets(buf, 1000, f)) {
            line++;
        }

        *textrows = line;
        delwin(*pad);
        *pad = newpad(*textrows, 1000);

        rewind(f);
        line = 0;
        while(fgets(buf, 1000, f)) {
            mvwaddstr(*pad, line, 0, buf);
            line++;
        }
    }

    scrollok(*pad, TRUE);   // enable scrolling
    prefresh(*pad, 0, 0, 1, 1, MAIN_HEIGHT-2, MAIN_WIDTH-2);
    wmove(*pad, 0, 0);      // reset cursor to upper-left corner
}
Exemple #10
0
void						update_var(WINDOW *win, char *var, size_t off,
									   size_t var_len, unsigned *hl, int color)
{
	size_t					li;
	size_t					co;
	size_t					start;
	size_t					l_line;

	li = off / 16;
	co = off % 16;
	start = off;
	if (hl)
		add_hl(hl, off, var_len);
	off = 0;
	while (off < var_len)
	{
		/*l_line = (var_len - off + start) / 16 ? 16 : (var_len - off + start % 16); */
		l_line = 1;
		co = (off + start) % 16;
		li = (off + start) / 16;
		axdump_dword(win, var + off, li, co, l_line, color);
		off += l_line;
	}
	prefresh(win, 0, 0, WIN_BORDER_LEN, WIN_BORDER_LEN,
			 WIN_STACK_LI, WIN_STACK_CO);
}
Exemple #11
0
static void refresh_map_window()
{
    int mapwinx, mapwiny, maph, mapw, mapwinw, mapwinh, mapx, mapy;
    WINDOW *map_window = curses_get_nhwin(MAP_WIN);
    boolean border = curses_window_has_border(MAP_WIN);
    
    curses_get_window_xy(MAP_WIN, &mapwinx, &mapwiny);
    curses_get_window_size(MAP_WIN, &mapwinh, &mapwinw);
    maph = ROWNO;
    mapw = COLNO;
    mapx = u.ux - (mapwinw / 2);
    if ((mapx + mapwinw) > mapw)
    {
        mapx = mapw - mapwinw;
    }
    if (mapx < 0)
    {
        mapx = 0;
    }
    mapy = u.uy - (mapwinh / 2);
    if ((mapy + mapwinh) > maph)
    {
        mapy = maph - mapwinh;
    }
    if (mapy < 0)
    {
        mapy = 0;
    }
    prefresh(map_window, mapy, mapx, mapwiny, mapwinx, mapwiny + mapwinh - 1, 
     mapwinx + mapwinw - 1);
}
Exemple #12
0
Fichier : stack.c Projet : k6s/yaod
void		clean_stack_step(WINDOW **wins, unsigned *hl, void *stack_frame)
{
	touchwin(wins[WIN_STACK]);
	prefresh(wins[WIN_OSTACK], 0, 0, WIN_BORDER_LEN, WIN_BORDER_LEN,
			 WIN_STACK_LI, WIN_STACK_CO);
	wrefresh(wins[WIN_STACK]);
	usleep(100000);
	un_hl(wins[WIN_STACK], (unsigned *)hl, stack_frame);
	touchwin(wins[WIN_STACK]);
	prefresh(wins[WIN_OSTACK], 0, 0, WIN_BORDER_LEN, WIN_BORDER_LEN,
			 WIN_STACK_LI, WIN_STACK_CO);
	wrefresh(wins[WIN_STACK]);
	memset(hl, 0, sizeof(*hl) * MAX_STACK_FRAME * 2);
	wmove(wins[WIN_MAIN], 1, 3);
	wprintw(wins[WIN_MAIN], "%-50s", " ");
	wrefresh(wins[WIN_MAIN]);
}
Exemple #13
0
void updateTextPad(WINDOW *pad, int pad_minrow) {
    int prev_pad_minrow = -1;

    if (pad_minrow != prev_pad_minrow) {
        prefresh(pad, pad_minrow, 0, 1, 1, MAIN_HEIGHT-2, MAIN_WIDTH-2);
        prev_pad_minrow = pad_minrow;
    }
}
Exemple #14
0
	int main(int argc, char *argv[])
	{
		int i, j;
		int w, h;
		WINDOW *pad;

		//³õʼ»¯
		initscr();

		//»ñµÃÆÁÄ»³ß´ç
		getmaxyx(stdscr, h,  w);

		//»­±³¾°
		for(i=0; i<h; i++)
		for(j=0; j<w; j++){
			mvaddch(i, j, ACS_CKBOARD);
		}
		refresh();

		//½¨Á¢´°¿Ú
		pad = newpad(80, 128);
		for(i=0; i<80; i++){
			char line[128];
			sprintf(line, "This line in pad is numbered %d\n", i);
			mvwprintw(pad, i, 0, line);
		}


		//Ë¢ÐÂÆÁÄ»
		refresh();
		prefresh(pad, 0, 1, 5, 10, 20, 45);
		
		for(i=0; i<50; i++){
			prefresh(pad, i+1, 1, 5, 10, 20, 45);
			usleep(30000);
		}

		//µÈ´ý°´¼ü
		getch();

		//½áÊø
		delwin(pad);
		endwin();

		return 0;
	}
Exemple #15
0
void mesgWnd(int sockfd)
{
  WINDOW *wnd, *pad;
  int max_y, max_x, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol;

  initscr();
  noecho();
  nocbreak();
  start_color();
  use_default_colors();
  init_pair(1, COLOR_WHITE, COLOR_BLUE);
  init_pair(2, COLOR_BLACK, COLOR_WHITE);
  getmaxyx(stdscr, max_y, max_x);

  wnd = newwin(0, 0, max_y, max_x - WNDWIDTH);
  pad = newpad(max_y, WNDWIDTH);

  wbkgd(wnd, COLOR_PAIR(1));
  wbkgd(pad, COLOR_PAIR(2));

  pminrow = pmincol = 0;
  sminrow = 0;
  smincol = max_x;
  smaxrow = max_y;
  smaxcol = max_x + WNDWIDTH;

  wprintw(wnd, "mainwindow> ");
  wrefresh(wnd);
  prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);

  for(;;)
    {
      char buf[BUFSIZ], *p;
      recvdata(sockfd, buf, BUFSIZ);
      if(strcmp(buf, "exit") == 0) break;
      wprintw(pad, "%s\n", buf);
      wrefresh(wnd);
      prefresh(pad, pminrow, pmincol, sminrow, smincol - WNDWIDTH - 1, smaxrow, smaxcol - WNDWIDTH - 1);
      sleep(3);
      prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
    }
  endwin();
  delwin(wnd);
  delwin(pad);
}
Exemple #16
0
void
scdk::SCPad::refresh() {
	if(_hidden)
		return;
		
	//setBG(_fgColor,_bgColor,_bgChar);
	prefresh(_win, 0, 0, _left, _top, _height, _width);
	//wrefresh(_bwin);
}
Exemple #17
0
int main (const int argc, const char * const * argv)
{
	if (argc < 2)
	{
		Gtfo (__LINE__, "読み取るパッドが渡されませんでした。");
	}

	initscr ();
	keypad (stdscr, TRUE);
	noecho ();
	start_color ();
	curs_set (0);

	int nMaxY, nMaxX;
	getmaxyx (stdscr, nMaxY, nMaxX);
	nMaxY--;
	nMaxX--;

	FILE * file = fopen (argv[1], "r");
	if (file == NULL)
	{
		Gtfo (__LINE__, "%sを読み取れませんでした。", argv[1]);
	}

	// Load window and store dimensions.
	WINDOW * pad = getwin (file);
	int nPadH, nPadW;
	getmaxyx (pad, nPadH, nPadW);
	int nPadBegY, nPadBegX;
	getbegyx (pad, nPadBegY, nPadBegX);
	nPadH -= nPadBegY;
	nPadW -= nPadBegX;

	bool bEnd = false;
	unsigned uPosY = 0;
	while (!bEnd)
	{
		int n = getch ();
		switch (n)
		{
			case 'j':
				if (! (uPosY + 1 + nMaxY >= nPadH))
					uPosY++;
				break;
			case 'k':
				if (uPosY)
					uPosY--;
				break;
			case 'q':
				bEnd = true;
				break;
		}
		prefresh (pad, uPosY, 0, 0, 0, nMaxY, nMaxX);
	}

	endwin ();
}
 void Display()
 {
   
   touchwin(_pad);
   prefresh( _pad,
             _start_line, _start_col,
             _screen_ymin+1, _screen_xmin+1,
             _screen_ymax-1, _screen_xmax-1);
 }
Exemple #19
0
static void pad_refresh(struct config_screen *screen)
{
	int y, x, rows, cols;

	getmaxyx(screen->scr.sub_ncw, rows, cols);
	getbegyx(screen->scr.sub_ncw, y, x);

	prefresh(screen->pad, screen->scroll_y, 0, y, x, rows, cols);
}
Exemple #20
0
/* results pad handler */
static void results_pad_handler(int padrows, int start_y, int start_x, int end_y, int end_x) {

    int c;
    int toprow=0, bottomrow = end_y - start_y;

    /* turn on hardware insert delete */
    idlok(sub_window,TRUE);

    while((c=wgetch(sub_window))) {
        switch (c) {
        case 'k':
        case KEY_DOWN:
            if(bottomrow < padrows-1) {
                prefresh(sub_window,++toprow,0,start_y,start_x,end_y,end_x);
                bottomrow++;
            }
            else
                beep();
            break;
        case 'j':
        case KEY_UP:
            if(toprow > 0) {
                prefresh(sub_window,--toprow,0,start_y,start_x,end_y,end_x);
                bottomrow--;
            }
            else
                beep();
            break;
        case 's':
            save_results_table();
            calcwindowbg();
            prefresh(sub_window,toprow,0,start_y,start_x,end_y,end_x);
            break;
        case 27:	/* ESC */
        case 'q':
            idlok(sub_window,FALSE);
            return;
            break;
        default:
            break;
        }
    }
    return;
}
Exemple #21
0
int main(int argc, char *argv[])
{
        WINDOW *p, *s1, *s2, *s3;
        FILE *f;
        int ch;

        initscr();
        refresh();

        /* create a new pad */
        p = newpad(200, WIDE + 1);
        if( p == NULL )
                bomb("Unable to create new pad\n");

        /* create three subpads */
        s1 = subpad(p, TALL, WIDE + 1, 0, 0);
        if( s1 == NULL )
                bomb("Unable to create subpad 1\n");
        s2 = subpad(p, TALL, WIDE + 1, TALL, 0);
        if( s2 == NULL )
                bomb("Unable to create subpad 2\n");
        s3 = subpad(p, TALL, WIDE + 1, 2 * TALL, 0);
        if( s3 == NULL )
                bomb("Unable to create subpad 3\n");

        /* open the file */
        f = fopen(FILENAME, "r");
        if( f == NULL )
                bomb("Unable to open the file\n");

        /* display the file's contents on the pad */
        while( (ch =  fgetc(f)) != EOF)
                waddch(p, ch);
        fclose(f);

        /* display the pad's contents on the screen */
        prefresh(s1, 0, 0, 0, 0, TALL - 1, WIDE);
        prefresh(s2, 0, 0, 0, WIDE + SPACER, TALL - 1, WIDE * 2 + SPACER);
        prefresh(s3, 0, 0, 0, WIDE * 2 + SPACER * 2, TALL - 1, WIDE * 3 + SPACER * 2);
        wgetch(p);

        endwin();
        return 0;
}
Exemple #22
0
int pecho_wchar(WINDOW *pad, const cchar_t *wch)
{
    PDC_LOG(("pecho_wchar() - called\n"));

    if (!wch || (waddch(pad, *wch) == ERR))
        return ERR;

    return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, 
                    save_smincol, save_smaxrow, save_smaxcol);
}
Exemple #23
0
static int	refresh_chatbox(CHATBOX *c)
{
  return prefresh(c->pad,		     /* pad		*/
  		  c->histsize - c->scroll,   /* pad line	*/
  		  0,			     /* pad column	*/
  		  c->begin_y,		     /* screen line	*/
  		  c->begin_x,		     /* screen column	*/
  		  c->begin_y + c->height -1, /* screen max line	*/
  		  c->begin_x + c->width -1); /* screen max column */
}
Exemple #24
0
static void pad_refresh(struct boot_editor *boot_editor)
{
	int y, x, rows, cols;

	getmaxyx(boot_editor->scr.sub_ncw, rows, cols);
	getbegyx(boot_editor->scr.sub_ncw, y, x);

	prefresh(boot_editor->pad, boot_editor->scroll_y, 0,
			y, x, rows, cols);
}
Exemple #25
0
int pechochar(WINDOW *pad, chtype ch)
{
    PDC_LOG(("pechochar() - called\n"));

    if (waddch(pad, ch) == ERR)
        return ERR;

    return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, 
                    save_smincol, save_smaxrow, save_smaxcol);
}
/*
 * pechochar --
 *	Echo character and attributes on "pad" and refresh "pad" at
 *	its previous position on the screen.
 */
int
pechochar(WINDOW *pad, const chtype ch)
{
	int retval;

	retval = waddch(pad, ch);
	if (retval == OK)
		 retval = prefresh(pad, pad->pbegy, pad->pbegx,
		    pad->sbegy, pad->sbegx, pad->smaxy, pad->smaxx);
	return retval;
}
Exemple #27
0
void pad::draw_to_screen(rect const& dest, int const sx, int const sy) const
{
    prefresh(
        _window,
        sy,
        sx,
        dest.y,
        dest.x,
        dest.height + dest.y - 1,
        dest.width + dest.x - 1
    );
}
Exemple #28
0
int main()
{
		WINDOW *pad_ptr;
		int x,y;
		int pad_lines;
		int pad_cols;
		char disp_char;

		initscr();

		pad_lines = LINES + 50;
		pad_cols = COLS + 50;

		pad_ptr = newpad(pad_lines,pad_cols);

		disp_char = 'a';
		for(x = 0;x < pad_lines;x++)
				for(y = 0;y < pad_cols;y++){
						mvwaddch(pad_ptr,x,y,disp_char);
						if(disp_char == 'z')
								disp_char = 'a';
						else
								disp_char++;
				}

		/* We can now draw different areas of the pad on the screen at
		 * different locations befor quitting*/

		prefresh(pad_ptr,5,7,2,2,9,9);
		sleep(1);

		prefresh(pad_ptr,LINES + 5, COLS + 7,5,5,21,19);
		sleep(1);

		delwin(pad_ptr);

		endwin();
		exit(EXIT_SUCCESS);
}
Exemple #29
0
int main(int argc, const char *argv[])
{
  WINDOW *pad_ptr;
  int x, y;
  int pad_lines;
  int pad_cols;
  char disp_char;

  initscr();

  pad_lines = LINES + 50;
  pad_cols = COLS + 50;

  pad_ptr = newpad(pad_lines, pad_cols);

  disp_char = 'a';
  for (x = 0; x < pad_lines; x++) {
    for (y = 0; y < pad_cols; y++) {
      mvwaddch(pad_ptr, x, y,disp_char);
      if (disp_char == 'z')
        disp_char = 'a';
      else
        disp_char++;
    }
  }

  prefresh(pad_ptr, 5, 7, 2, 2, 9, 9);
  sleep(1);

  prefresh(pad_ptr, LINES + 5, COLS + 7, 5, 5, 21, 19);
  sleep(1);

  delwin(pad_ptr);

  endwin();
  return 0;
}
int DrawFSDefaultScreen(char *title)
{
	char SCROLLOPT[] = "Up: Scroll Up		Down: Scroll Down";
	char FSUIOPTS1[] = "F1=Help		F2=Refresh		F10=Quit";
	
	/* Clears Screen, Gets vales of X, Y, Enable Keypad
	 * disable echo, draws a box on stdscr, adds a title to screen */
	 
	clear();
	getmaxyx(stdscr, y,x);
	keypad(stdscr, TRUE);
	noecho();
	box(stdscr, ACS_VLINE, ACS_HLINE);
	mvaddstr(1, x/6, title);
	mvaddstr(y-4, 2, SCROLLOPT);
	mvaddstr(y-2, 2, FSUIOPTS1);
	
	
	/* Make Windows, SPARE Window is Windows that has a border
	 * to prevent overwriting on the borders*/
	 
	SPARE = newwin(15, 76, 4, 2);
	box(SPARE, ACS_VLINE, ACS_HLINE);
	
	/*  Creates a PAD (Window that is larger than screen sizes better 
	 *  for scrolling */
	 
	 if(PADCREATED <1) {
		 /* Pad 30 lines x 68 column */
		 FSPAD = newpad(30, 74);
			if(FSPAD == NULL) {
				MsgBoxError("Unable to create Filesystem PAD");
				return(1);
			 };
			 scrollok(FSPAD, TRUE);
			 PADCREATED = 1;
		 }
	 /* else
			{
				prefresh(FSPAD, 15, 1, 4, 3, 14, 39);
			} */
	
	
	refresh();
	wrefresh(SPARE);
	prefresh(FSPAD, 15, 1, 5, 3, 14, 74);
	
	return 0;
}