您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ touchwin函数代码示例

51自学网 2021-06-03 08:55:56
  C++
这篇教程C++ touchwin函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中touchwin函数的典型用法代码示例。如果您正苦于以下问题:C++ touchwin函数的具体用法?C++ touchwin怎么用?C++ touchwin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了touchwin函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: menu_pre

voidmenu_pre(void){	touchwin(ruler_win);	ui_refresh_win(ruler_win);}
开发者ID:acklinr,项目名称:vifm,代码行数:6,


示例2: handle_loopback

//.........这里部分代码省略.........		if( (rwfd = tty_open(string, &sv_tios )) < 0 ) {			test_cases++;			goto user_input;		}		tcflush(rwfd, TCIOFLUSH);                if ((i = test_send (test_data, TBUFSIZ, rwfd)) != 0)                {                        mvwprintw (lbwin, r++, 2,                        "***** Loop Back Test Failure=%d, Sending %d Bytes", i, TBUFSIZ);                        wrefresh (lbwin);                        tty_close (rwfd, &sv_tios);                        test_cases++;			goto user_input;                }                mvwprintw (lbwin, r++, 2, "Loop Back: %d Bytes Sent.", TBUFSIZ);                wrefresh (lbwin);                mvwprintw (lbwin, r++, 2, "Loop Back: Receiving %d Bytes.", TBUFSIZ);                wrefresh (lbwin);                if ((i = test_recv (read_data, TBUFSIZ, 5, rwfd)) != TBUFSIZ)                {                        mvwprintw (lbwin, r++, 2,                                "***** Loop Back Failure=%d Receiving %d bytes.", i, TBUFSIZ);                        wrefresh (lbwin);                        tty_close (rwfd, &sv_tios);                        test_cases++;			goto user_input;                }                /* Reset termios as before and close channel */                tty_close (rwfd, &sv_tios);                mvwprintw (lbwin, r++, 2, "Loop Back: Verifying %d bytes.", TBUFSIZ);                wrefresh (lbwin);                if (memcmp (test_data, read_data, TBUFSIZ))                {                        mvwprintw (lbwin, r++, 2,                                "***** Loop Back Failure Verifying %d Bytes.", TBUFSIZ);                        mvwprintw (lbwin, r++, 2, "***** Data Incorrectly Transferred.");                        wrefresh (lbwin);                        test_cases++;			goto user_input;                }                else                {                        mvwprintw (lbwin, r++, 2, "Loop Back: Test Passed.");                        wrefresh (lbwin);                        test_cases++;                        test_passes++;                }user_input:		option = getch();		/*		 * If the user hasn't selected anything, loop.		 * Otherwise, break.		 */		switch (option)		{		case EOF:			break;		case '':			refresh_screen ();			option = EOF;			break;#ifdef KEY_PRINT		case KEY_PRINT:#endif		case '':			screen_save (LBWin, logfile);			touchwin (lbwin);			wrefresh (lbwin);			update_panels ();			doupdate ();			option = EOF;			break;		default:			break;		}						   /* End Case */	}							   /* End While */	hide_panel (GetPan(LBWin));	update_panels ();	doupdate ();	return;}
开发者ID:wfp5p,项目名称:dgrp-utils,代码行数:101,


示例3: domenu

void domenu(menu *mp){    int y, x, nitems, barlen, mheight, mw, old = -1, cur = 0, cur0;    bool stop = FALSE;    WINDOW *wmenu;    curs_set(0);    getmenupos(&y, &x);    menudim(mp, &nitems, &barlen);    mheight = nitems + 2;    mw = barlen + 2;    wmenu = newwin(mheight, mw, y, x);    colorbox(wmenu, SUBMENUCOLOR, 1);    repaintmenu(wmenu, mp);    key = ERR;    while (!stop && !quit)    {        if (cur != old)        {            if (old != -1)                mvwaddstr(wmenu, old + 1, 1,                           prepad(padstr(mp[old].name, barlen - 1), 1));            setcolor(wmenu, SUBMENUREVCOLOR);            mvwaddstr(wmenu, cur + 1, 1,                      prepad(padstr(mp[cur].name, barlen - 1), 1));            setcolor(wmenu, SUBMENUCOLOR);            statusmsg(mp[cur].desc);            old = cur;            wrefresh(wmenu);        }        switch (key = ((key != ERR) ? key : waitforkey()))        {        case '/n':          /* menu item selected */            touchwin(wbody);            wrefresh(wbody);            setmenupos(y + 1, x + 1);            rmerror();            key = ERR;            curs_set(1);            (mp[cur].func)();   /* perform function */            curs_set(0);            repaintmenu(wmenu, mp);            old = -1;            break;        case KEY_UP:            cur = (cur + nitems - 1) % nitems;            key = ERR;            break;        case KEY_DOWN:            cur = (cur + 1) % nitems;            key = ERR;            break;        case KEY_ESC:        case KEY_LEFT:        case KEY_RIGHT:            if (key == KEY_ESC)                key = ERR;  /* return to prev submenu */            stop = TRUE;            break;        default:            cur0 = cur;            do            {                cur = (cur + 1) % nitems;            } while ((cur != cur0) &&                     (hotkey(mp[cur].name) != toupper((int)key)));            key = (hotkey(mp[cur].name) == toupper((int)key)) ? '/n' : ERR;        }    }    rmerror();    delwin(wmenu);    touchwin(wbody);    wrefresh(wbody);}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:93,


示例4: _nc_Touchpan

void_nc_Touchpan(const PANEL *pan){  dPanel("Touchpan",pan);  touchwin(pan->win);}
开发者ID:vocho,项目名称:openqnx,代码行数:6,


示例5: tasklist_window

//.........这里部分代码省略.........        ncurses_end(-1);    }    /* set curses settings */    set_curses_mode(NCURSES_MODE_STD);    /* print task list */    check_screen_size();    cfg.fieldlengths.description = COLS - cfg.fieldlengths.project - 1 -                                   cfg.fieldlengths.date;    task_count();    print_header();    tasklist_print_task_list();    /* main loop */    while (1) {        /* set variables for determining actions */        done    = false;        redraw  = false;        reload  = false;        /* check for an empty task list */        if (head == NULL) {            if (strcmp(active_filter, "") == 0) {                tnc_fprintf(logfp, LOG_ERROR,                            "it appears that your task list is empty. %s does not yet support empty task lists.",                            PROGNAME);                ncurses_end(-1);            }            active_filter = strdup("");            reload = true;        }        /* get the screen size */        rows = LINES;        cols = COLS;        /* check for a screen thats too small */        check_screen_size();        /* check for size changes */        check_resize();        /* apply staged window updates */        doupdate();        /* get a character */        c = wgetch(statusbar);        /* handle the character */        handle_keypress(c, MODE_TASKLIST);        /* exit */        if (done) {            break;        }        /* reload task list */        if (reload) {            cur = get_task_by_position(selline);            if (cur) {                uuid = strdup(cur->uuid);            }            wipe_tasklist();            reload_tasks();            task_count();            redraw = true;            if (cfg.follow_task) {                set_position_by_uuid(uuid);            }            check_free(uuid);            uuid = NULL;            tasklist_check_curs_pos();        }        /* redraw all windows */        if (redraw) {            cfg.fieldlengths.project = max_project_length();            cfg.fieldlengths.description = cols - cfg.fieldlengths.project - 1 -                                           cfg.fieldlengths.date;            print_header();            tasklist_print_task_list();            tasklist_check_curs_pos();            touchwin(tasklist);            touchwin(header);            touchwin(statusbar);            wnoutrefresh(tasklist);            wnoutrefresh(header);            wnoutrefresh(statusbar);            doupdate();        }        statusbar_timeout();    }} /* }}} */
开发者ID:escribano,项目名称:tasknc,代码行数:101,


示例6: btn_dialog

/* get the message, and buttons. * each button must be a char* * return the selected button * * this dialog is used for 2 different things: * 1) show a text box, no buttons. * 2) show a dialog, with horizontal buttons */int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...){	va_list ap;	char *btn;	int btns_width = 0;	int msg_lines = 0;	int msg_width = 0;	int total_width;	int win_rows = 0;	WINDOW *win;	WINDOW *msg_win;	WINDOW *menu_win;	MENU *menu;	ITEM *btns[btn_num+1];	int i, x, y;	int res = -1;	va_start(ap, btn_num);	for (i = 0; i < btn_num; i++) {		btn = va_arg(ap, char *);		btns[i] = new_item(btn, "");		btns_width += strlen(btn)+1;	}	va_end(ap);	btns[btn_num] = NULL;	/* find the widest line of msg: */	msg_lines = get_line_no(msg);	for (i = 0; i < msg_lines; i++) {		const char *line = get_line(msg, i);		int len = get_line_length(line);		if (msg_width < len)			msg_width = len;	}	total_width = max(msg_width, btns_width);	/* place dialog in middle of screen */	y = (getmaxy(stdscr)-(msg_lines+4))/2;	x = (getmaxx(stdscr)-(total_width+4))/2;	/* create the windows */	if (btn_num > 0)		win_rows = msg_lines+4;	else		win_rows = msg_lines+2;	win = newwin(win_rows, total_width+4, y, x);	keypad(win, TRUE);	menu_win = derwin(win, 1, btns_width, win_rows-2,			1+(total_width+2-btns_width)/2);	menu = new_menu(btns);	msg_win = derwin(win, win_rows-2, msg_width, 1,			1+(total_width+2-msg_width)/2);	set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);	set_menu_back(menu, attributes[DIALOG_MENU_BACK]);	(void) wattrset(win, attributes[DIALOG_BOX]);	box(win, 0, 0);	/* print message */	(void) wattrset(msg_win, attributes[DIALOG_TEXT]);	fill_window(msg_win, msg);	set_menu_win(menu, win);	set_menu_sub(menu, menu_win);	set_menu_format(menu, 1, btn_num);	menu_opts_off(menu, O_SHOWDESC);	menu_opts_off(menu, O_SHOWMATCH);	menu_opts_on(menu, O_ONEVALUE);	menu_opts_on(menu, O_NONCYCLIC);	set_menu_mark(menu, "");	post_menu(menu);	touchwin(win);	refresh_all_windows(main_window);	while ((res = wgetch(win))) {		switch (res) {		case KEY_LEFT:			menu_driver(menu, REQ_LEFT_ITEM);			break;		case KEY_RIGHT:			menu_driver(menu, REQ_RIGHT_ITEM);			break;		case 10: /* ENTER */		case 27: /* ESCAPE */		case ' ':		case KEY_F(F_BACK):		case KEY_F(F_EXIT)://.........这里部分代码省略.........
开发者ID:AlexShiLucky,项目名称:linux,代码行数:101,


示例7: refresh_all_windows

/* refresh all windows in the correct order */void refresh_all_windows(WINDOW *main_window){	update_panels();	touchwin(main_window);	refresh();}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:7,


示例8: touchwin

void	Window::flush( void )	{	touchwin(main_window);	wrefresh(main_window);}
开发者ID:Elytum,项目名称:tmp,代码行数:4,


示例9: Term_xtra_gcu

/* * Handle a "special request" */static errr Term_xtra_gcu(int n, int v){   term_data *td = (term_data *)(Term->data);   /* Analyze the request */   switch (n)   {      /* Clear screen */      case TERM_XTRA_CLEAR:      touchwin(td->win);      (void)wclear(td->win);      return (0);      /* Make a noise */      case TERM_XTRA_NOISE:      (void)write(1, "/007", 1);      return (0);#ifdef USE_SOUND      /* Make a special sound */      case TERM_XTRA_SOUND:	 return (Term_xtra_gcu_sound(v));#endif      /* Flush the Curses buffer */      case TERM_XTRA_FRESH:      (void)wrefresh(td->win);      return (0);#ifdef USE_CURS_SET      /* Change the cursor visibility */      case TERM_XTRA_SHAPE:      curs_set(v);      return (0);#endif      /* Suspend/Resume curses */      case TERM_XTRA_ALIVE:      return (Term_xtra_gcu_alive(v));      /* Process events */      case TERM_XTRA_EVENT:      return (Term_xtra_gcu_event(v));      /* Flush events */      case TERM_XTRA_FLUSH:      while (!Term_xtra_gcu_event(FALSE));      return (0);      /* Delay */      case TERM_XTRA_DELAY:      usleep(1000 * v);      return (0);      /* React to events */      case TERM_XTRA_REACT:      Term_xtra_gcu_react();      return (0);   }   /* Unknown */   return (1);}
开发者ID:dplusplus,项目名称:hengband_njslyr,代码行数:70,


示例10: load_agent_list

/* render a list of agents if available */voidload_agent_list (WINDOW * main_win, char *addr){  GMenu *menu;  WINDOW *win;  char buf[256];  int c, quit = 1, i;  int y, x, list_h, list_w, menu_w, menu_h;  if (!conf.list_agents)    return;  getmaxyx (stdscr, y, x);  list_h = y / 2;       /* list window - height */  list_w = x - 4;       /* list window - width */  menu_h = list_h - AGENTS_MENU_Y - 1;  /* menu window - height */  menu_w = list_w - AGENTS_MENU_X - AGENTS_MENU_X;      /* menu window - width */  win = newwin (list_h, list_w, (y - list_h) / 2, (x - list_w) / 2);  keypad (win, TRUE);  wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');  /* create a new instance of GMenu and make it selectable */  menu = new_gmenu (win, menu_h, menu_w, AGENTS_MENU_Y, AGENTS_MENU_X);  if (set_host_agents (addr, load_host_agents_gmenu, menu) == 1)    goto out;  post_gmenu (menu);  snprintf (buf, sizeof buf, "User Agents for %s", addr);  draw_header (win, buf, " %s", 1, 1, list_w - 2, color_panel_header);  mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to close window");  wrefresh (win);  while (quit) {    c = wgetch (stdscr);    switch (c) {    case KEY_DOWN:      gmenu_driver (menu, REQ_DOWN);      break;    case KEY_UP:      gmenu_driver (menu, REQ_UP);      break;    case KEY_RESIZE:    case 'q':      quit = 0;      break;    }    wrefresh (win);  }  touchwin (main_win);  close_win (win);  wrefresh (main_win);out:  /* clean stuff up */  for (i = 0; i < menu->size; ++i)    free (menu->items[i].name);  if (menu->items)    free (menu->items);  free (menu);}
开发者ID:arceduardvincent,项目名称:goaccess,代码行数:65,


示例11: wrefresh

int wrefresh(reg WINDOW	* win ){	reg short	wy;	reg int		retval;	/*	 * make sure were in visual state	 */	if (_endwin) {		_puts(VS);		_puts(TI);		_endwin = FALSE;	}	/*	 * initialize loop parameters	 */	ly = curscr->_cury;	lx = curscr->_curx;	wy = 0;	_win = win;	curwin = (win == curscr);	if (win->_clear || curscr->_clear || curwin) {		if ((win->_flags & _FULLWIN) || curscr->_clear) {			_puts(CL);			ly = 0;			lx = 0;			if (!curwin) {				curscr->_clear = FALSE;				curscr->_cury = 0;				curscr->_curx = 0;				werase(curscr);			}			touchwin(win);		}		win->_clear = FALSE;	}	if (!CA) {		if (win->_curx != 0)			_putchar('/n');		if (!curwin)			werase(curscr);	}# ifdef DEBUG	fprintf(outf, "REFRESH(%0.2o): curwin = %d/n", win, curwin);	fprintf(outf, "REFRESH:/n/tfirstch/tlastch/n");# endif	for (wy = 0; wy < win->_maxy; wy++) {# ifdef DEBUG		fprintf(outf, "%d/t%d/t%d/n", wy, win->_firstch[wy],			win->_lastch[wy]);# endif		if (win->_firstch[wy] != _NOCHANGE)		  {			if (makech(win, wy) == ERR)				return ERR;			else {				if (win->_firstch[wy] >= win->_ch_off)					win->_firstch[wy] = win->_maxx +							    win->_ch_off;				if (win->_lastch[wy] < win->_maxx +						       win->_ch_off)					win->_lastch[wy] = win->_ch_off;				if (win->_lastch[wy] < win->_firstch[wy])					win->_firstch[wy] = _NOCHANGE;			}		      }		# ifdef DEBUG		fprintf(outf, "/t%d/t%d/n", win->_firstch[wy],			win->_lastch[wy]);# endif	}	if (win == curscr)		domvcur(ly, lx, win->_cury, win->_curx);	else {		if (win->_leave) {			curscr->_cury = ly;			curscr->_curx = lx;			ly -= win->_begy;			lx -= win->_begx;			if (ly >= 0 && ly < win->_maxy && lx >= 0 &&			    lx < win->_maxx) {				win->_cury = ly;				win->_curx = lx;			}			else				win->_cury = win->_curx = 0;		}		else {			domvcur(ly, lx, win->_cury + win->_begy,				win->_curx + win->_begx);			curscr->_cury = win->_cury + win->_begy;			curscr->_curx = win->_curx + win->_begx;		}	}	retval = OK;//.........这里部分代码省略.........
开发者ID:jamjr,项目名称:Helios-NG,代码行数:101,


示例12: load_help_popup

/* render help dialog */voidload_help_popup (WINDOW * main_win){  int c, quit = 1;  size_t i, n;  int y, x, h = HELP_WIN_HEIGHT, w = HELP_WIN_WIDTH;  int w2 = w - 2;  WINDOW *win;  GMenu *menu;  n = ARRAY_SIZE (help_main);  getmaxyx (stdscr, y, x);  win = newwin (h, w, (y - h) / 2, (x - w) / 2);  keypad (win, TRUE);  wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');  /* create a new instance of GMenu and make it selectable */  menu =    new_gmenu (win, HELP_MENU_HEIGHT, HELP_MENU_WIDTH, HELP_MENU_Y,               HELP_MENU_X);  menu->size = n;  /* add items to GMenu */  menu->items = (GItem *) xcalloc (n, sizeof (GItem));  for (i = 0; i < n; ++i) {    menu->items[i].name = alloc_string (help_main[i]);    menu->items[i].checked = 0;  }  post_gmenu (menu);  draw_header (win, "GoAccess Quick Help", " %s", 1, 1, w2, color_panel_header);  mvwprintw (win, 2, 2, "[UP/DOWN] to scroll - [q] to quit");  wrefresh (win);  while (quit) {    c = wgetch (stdscr);    switch (c) {    case KEY_DOWN:      gmenu_driver (menu, REQ_DOWN);      break;    case KEY_UP:      gmenu_driver (menu, REQ_UP);      break;    case KEY_RESIZE:    case 'q':      quit = 0;      break;    }    wrefresh (win);  }  /* clean stuff up */  for (i = 0; i < n; ++i)    free (menu->items[i].name);  free (menu->items);  free (menu);  touchwin (main_win);  close_win (win);  wrefresh (main_win);}
开发者ID:arceduardvincent,项目名称:goaccess,代码行数:62,


示例13: load_sort_win

//.........这里部分代码省略.........      }    } else if (SORT_BY_MAXTS == field) {      menu->items[i].name = alloc_string ("Max. Time Served");      if (sort->field == SORT_BY_MAXTS) {        menu->items[i].checked = 1;        menu->idx = i;      }    } else if (SORT_BY_PROT == field) {      menu->items[i].name = alloc_string ("Protocol");      if (sort->field == SORT_BY_PROT) {        menu->items[i].checked = 1;        menu->idx = i;      }    } else if (SORT_BY_MTHD == field) {      menu->items[i].name = alloc_string ("Method");      if (sort->field == SORT_BY_MTHD) {        menu->items[i].checked = 1;        menu->idx = i;      }    }  }  post_gmenu (menu);  draw_header (win, "Sort active module by", " %s", 1, 1, w2,               color_panel_header);  mvwprintw (win, 2, 2, "[ENTER] to select field - [TAB] sort");  if (sort->sort == SORT_ASC)    mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL);  else    mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL);  wrefresh (win);  while (quit) {    c = wgetch (stdscr);    switch (c) {    case KEY_DOWN:      gmenu_driver (menu, REQ_DOWN);      break;    case KEY_UP:      gmenu_driver (menu, REQ_UP);      break;    case 9:    /* TAB */      if (sort->sort == SORT_ASC) {        /* ascending */        sort->sort = SORT_DESC;        mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL);      } else {        /* descending */        sort->sort = SORT_ASC;        mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL);      }      break;    case 32:    case 0x0a:    case 0x0d:    case KEY_ENTER:      gmenu_driver (menu, REQ_SEL);      for (i = 0; i < n; ++i) {        if (menu->items[i].checked != 1)          continue;        if (strcmp ("Hits", menu->items[i].name) == 0)          sort->field = SORT_BY_HITS;        else if (strcmp ("Visitors", menu->items[i].name) == 0)          sort->field = SORT_BY_VISITORS;        else if (strcmp ("Data", menu->items[i].name) == 0)          sort->field = SORT_BY_DATA;        else if (strcmp ("Bandwidth", menu->items[i].name) == 0)          sort->field = SORT_BY_BW;        else if (strcmp ("Avg. Time Served", menu->items[i].name) == 0)          sort->field = SORT_BY_AVGTS;        else if (strcmp ("Cum. Time Served", menu->items[i].name) == 0)          sort->field = SORT_BY_CUMTS;        else if (strcmp ("Max. Time Served", menu->items[i].name) == 0)          sort->field = SORT_BY_MAXTS;        else if (strcmp ("Protocol", menu->items[i].name) == 0)          sort->field = SORT_BY_PROT;        else if (strcmp ("Method", menu->items[i].name) == 0)          sort->field = SORT_BY_MTHD;        quit = 0;        break;      }      break;    case KEY_RESIZE:    case 'q':      quit = 0;      break;    }    wrefresh (win);  }  /* clean stuff up */  for (i = 0; i < n; ++i)    free (menu->items[i].name);  free (menu->items);  free (menu);  touchwin (main_win);  close_win (win);  wrefresh (main_win);}
开发者ID:arceduardvincent,项目名称:goaccess,代码行数:101,


示例14: load_schemes_win

/* render schemes dialog */voidload_schemes_win (WINDOW * main_win){  GMenu *menu;  WINDOW *win;  int c, quit = 1;  size_t i, n;  int y, x, h = SCHEME_WIN_H, w = SCHEME_WIN_W;  int w2 = w - 2;  /* ###NOTE: 'Custom Scheme' needs to go at the end */  const char *choices[] = {    "Monochrome/Default",    "Green/Original",    "Custom Scheme"  };  n = ARRAY_SIZE (choices);  getmaxyx (stdscr, y, x);  win = newwin (h, w, (y - h) / 2, (x - w) / 2);  keypad (win, TRUE);  wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');  /* create a new instance of GMenu and make it selectable */  menu =    new_gmenu (win, SCHEME_MENU_H, SCHEME_MENU_W, SCHEME_MENU_Y, SCHEME_MENU_X);  /* remove custom color option if no custom scheme used */  menu->size = conf.color_idx == 0 ? n - 1 : n;  /* add items to GMenu */  menu->items = (GItem *) xcalloc (n, sizeof (GItem));  for (i = 0; i < n; ++i) {    menu->items[i].name = alloc_string (choices[i]);    menu->items[i].checked = 0;  }  post_gmenu (menu);  draw_header (win, "Scheme Configuration", " %s", 1, 1, w2,               color_panel_header);  mvwprintw (win, 2, 2, "[ENTER] to switch scheme");  wrefresh (win);  while (quit) {    c = wgetch (stdscr);    switch (c) {    case KEY_DOWN:      gmenu_driver (menu, REQ_DOWN);      break;    case KEY_UP:      gmenu_driver (menu, REQ_UP);      break;    case 32:    case 0x0a:    case 0x0d:    case KEY_ENTER:      gmenu_driver (menu, REQ_SEL);      for (i = 0; i < n; ++i) {        if (menu->items[i].checked != 1)          continue;        scheme_chosen (choices[i]);        break;      }      quit = 0;      break;    case KEY_RESIZE:    case 'q':      quit = 0;      break;    }    wrefresh (win);  }  /* clean stuff up */  for (i = 0; i < n; ++i)    free (menu->items[i].name);  free (menu->items);  free (menu);  touchwin (main_win);  close_win (win);  wrefresh (main_win);}
开发者ID:arceduardvincent,项目名称:goaccess,代码行数:83,


示例15: exec_cmd_noask

static voidexec_cmd_noask(const char *iactstr, const char *icmdstr, ...){	char *actstr, *cmdstr, *tokstr;	char **execstr, **runstr;	int status, i, fdi, num = 0;	char buf[BUFSIZ];	pid_t cpid;	va_list ap;	WINDOW *msubwin;	struct pollfd pfd;	va_start(ap, icmdstr);	if (vasprintf(&actstr, iactstr, ap) < 0) {		endwin();		err(EXIT_FAILURE, "asprintf");	}	va_end(ap);	va_start(ap, icmdstr);	if (vasprintf(&cmdstr, icmdstr, ap) < 0) {		endwin();		err(EXIT_FAILURE, "asprintf");	}	va_end(ap);	show_mainwin(1);	head_mainwin(actstr);	msubwin = create_lowersubwin(NULL, NULL);	cpid = forkpty(&fdi, NULL, NULL, NULL);	if (cpid == -1) {		endwin();		err(EXIT_FAILURE, "fork");	} else if (cpid == 0) {		endwin();		close(STDIN_FILENO);		close(STDERR_FILENO);		setvbuf(stdout, NULL, _IONBF, 0);		/* Convert command string to array */		for (tokstr = cmdstr; *tokstr != '/0'; tokstr++) {			if (*tokstr == ' ')				num++;		}		/* 1: We get one less when counting, 2: For NULL termination, 3: For 		 * command name */		execstr = calloc(num + 2, sizeof(char *));		runstr = execstr;		for (tokstr = strtok(cmdstr, " "); tokstr != NULL; tokstr = strtok(NULL, " ")) {			*runstr = tokstr;			runstr++;		}		execvp(cmdstr, execstr);	} else {		buf[sizeof(buf) - 1] = '/0';		wprintw(msubwin, "/n");		while (waitpid(cpid, &status, WNOHANG) != cpid) {			pfd.fd = fdi;			pfd.events = POLLIN;			i = poll(&pfd, 1, 100);			if (i > 0 && (i = read(fdi, buf, sizeof buf - 2)) > 0) {				buf[i] = '/0';				/* If we don't do so, there will be errors displaying stuff. */				for (tokstr = strstr(buf, "/r/n"); tokstr != NULL; tokstr = strstr(tokstr, "/r/n")) {					tokstr[0] = '/n';					tokstr[1] = '/r';				}				waddstr(msubwin, buf);				touchwin(mainwin);				wrefresh(msubwin);			}		}		if (!WIFEXITED(status))			ask_ok("Command `%s' failed with signal %d", cmdstr, WEXITSTATUS(status));		else			ask_ok(actstr);	}	delwin(msubwin);	free(cmdstr);	free(actstr);	return;}
开发者ID:nbyouri,项目名称:pkgui,代码行数:82,


示例16: slk_touch

int slk_touch(void){    PDC_LOG(("slk_touch() - called/n"));    return touchwin(SP->slk_winptr);}
开发者ID:allisterb,项目名称:Cursesdotnet,代码行数:6,


示例17: Touchpan

static void Touchpan(PANEL *pan){    dPanel("Touchpan", pan);    touchwin(pan->win);}
开发者ID:ryoon,项目名称:eCos,代码行数:5,


示例18: open_ncurses

/** * Ncurses Text User Interface * open_ncurses	    - open text window * close_ncurses    - close text window */int open_ncurses() {#ifdef HAVE_LIBNCURSESW	int debug = 1;	FILE *in = fopen( "/dev/stderr", "r" );	FILE *out = fopen( "/dev/stderr", "w" );	int terminal_x = 0;	int terminal_y = 0;	ptclscr = newterm(NULL, out, in);	refresh();	if (!ptclscr)		log_mesg(0, 1, 1, debug, "partclone ncurses initial error/n");	if (!set_term(ptclscr))		log_mesg(0, 1, 1, debug, "partclone ncurses set term error/n");	ptclscr_win = newwin(LINES, COLS, 0, 0);	// check terminal width and height	getmaxyx(ptclscr_win, terminal_y, terminal_x);	// set window position	int log_line = 12;	int log_row = 60;	int log_y_pos = (terminal_y-24)/2+2;	int log_x_pos = (terminal_x-log_row)/2;	int gap = 0;	int p_line = 8;	int p_row = log_row;	int p_y_pos = log_y_pos+log_line+gap;	int p_x_pos = log_x_pos;	int size_ok = 1;	if (terminal_y < (log_line+gap+p_line+3))		size_ok = 0;	if (terminal_x < (log_row+2))		size_ok = 0;	if (size_ok == 0) {		log_mesg(0, 0, 0, debug, "Terminal width(%i) or height(%i) too small/n", terminal_x, terminal_y);		return 0;	}	/// check color pair	if (!has_colors()) {		log_mesg(0, 0, 0, debug, "Terminal color error/n");		return 0;	}	if (start_color() != OK){		log_mesg(0, 0, 0, debug, "Terminal can't start color mode/n");		return 0;	}	/// define color	init_pair(1, COLOR_WHITE, COLOR_BLUE); ///stdscr	init_pair(2, COLOR_RED, COLOR_WHITE); ///sub window	init_pair(3, COLOR_BLUE, COLOR_WHITE); ///sub window	/// write background color	bkgd(COLOR_PAIR(1));	wbkgd(ptclscr_win,COLOR_PAIR(2));	touchwin(ptclscr_win);	refresh();	/// init main box	attrset(COLOR_PAIR(2));	box_win = subwin(ptclscr_win, (log_line+gap+p_line+2), log_row+2, log_y_pos-1, log_x_pos-1);	box(box_win, ACS_VLINE, ACS_HLINE);	wrefresh(box_win);	wbkgd(box_win, COLOR_PAIR(2));	mvprintw((log_y_pos-1), ((terminal_x-9)/2), " Partclone ");	attroff(COLOR_PAIR(2));	attrset(COLOR_PAIR(3));	/// init log window	log_win = subwin(ptclscr_win, log_line, log_row, log_y_pos, log_x_pos);	wbkgd(log_win, COLOR_PAIR(3));	touchwin(log_win);	refresh();	// init progress window	p_win = subwin(ptclscr_win, p_line, p_row, p_y_pos, p_x_pos);	wbkgd(p_win, COLOR_PAIR(3));	touchwin(p_win);	refresh();	// init progress window	bar_win = subwin(ptclscr_win, 1, p_row-10, p_y_pos+4, p_x_pos);	wbkgd(bar_win, COLOR_PAIR(1));	touchwin(bar_win);	refresh();	// init total block progress window//.........这里部分代码省略.........
开发者ID:kenhys,项目名称:partclone,代码行数:101,


示例19: dialog_inputbox

int dialog_inputbox(WINDOW *main_window,		const char *title, const char *prompt,		const char *init, char **resultp, int *result_len){	int prompt_lines = 0;	int prompt_width = 0;	WINDOW *win;	WINDOW *prompt_win;	WINDOW *form_win;	PANEL *panel;	int i, x, y, lines, columns, win_lines, win_cols;	int res = -1;	int cursor_position = strlen(init);	int cursor_form_win;	char *result = *resultp;	getmaxyx(stdscr, lines, columns);	if (strlen(init)+1 > *result_len) {		*result_len = strlen(init)+1;		*resultp = result = xrealloc(result, *result_len);	}	/* find the widest line of msg: */	prompt_lines = get_line_no(prompt);	for (i = 0; i < prompt_lines; i++) {		const char *line = get_line(prompt, i);		int len = get_line_length(line);		prompt_width = max(prompt_width, len);	}	if (title)		prompt_width = max(prompt_width, strlen(title));	win_lines = min(prompt_lines+6, lines-2);	win_cols = min(prompt_width+7, columns-2);	prompt_lines = max(win_lines-6, 0);	prompt_width = max(win_cols-7, 0);	/* place dialog in middle of screen */	y = (lines-win_lines)/2;	x = (columns-win_cols)/2;	strncpy(result, init, *result_len);	/* create the windows */	win = newwin(win_lines, win_cols, y, x);	prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);	form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);	keypad(form_win, TRUE);	(void) wattrset(form_win, attributes[INPUT_FIELD]);	(void) wattrset(win, attributes[INPUT_BOX]);	box(win, 0, 0);	(void) wattrset(win, attributes[INPUT_HEADING]);	if (title)		mvwprintw(win, 0, 3, "%s", title);	/* print message */	(void) wattrset(prompt_win, attributes[INPUT_TEXT]);	fill_window(prompt_win, prompt);	mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");	cursor_form_win = min(cursor_position, prompt_width-1);	mvwprintw(form_win, 0, 0, "%s",		  result + cursor_position-cursor_form_win);	/* create panels */	panel = new_panel(win);	/* show the cursor */	curs_set(1);	touchwin(win);	refresh_all_windows(main_window);	while ((res = wgetch(form_win))) {		int len = strlen(result);		switch (res) {		case 10: /* ENTER */		case 27: /* ESCAPE */		case KEY_F(F_HELP):		case KEY_F(F_EXIT):		case KEY_F(F_BACK):			break;		case 127:		case KEY_BACKSPACE:			if (cursor_position > 0) {				memmove(&result[cursor_position-1],						&result[cursor_position],						len-cursor_position+1);				cursor_position--;				cursor_form_win--;				len--;			}			break;		case KEY_DC:			if (cursor_position >= 0 && cursor_position < len) {				memmove(&result[cursor_position],						&result[cursor_position+1],//.........这里部分代码省略.........
开发者ID:AlexShiLucky,项目名称:linux,代码行数:101,


示例20: deletefile

//.........这里部分代码省略.........	    {	      case 0: /* порожденный процесс*/		close(2);		open("/dev/null",O_WRONLY);		for(i=1;i<NSIG;i++) signal(i, SIG_DFL);		execlp("rm", "rm", "-rf", name, NULL);		exit(-1); /* ошибка вызова - будет проверен код*/	      break;	      case -1: /* не создается процесс */		ask(&win3,1,0); /* сообщение об ошибке*/	      break;	      default: /* процесс - родитель */		while(wait(&wait_stat)!=pid);		if(wait_stat)		  { /* была ошибка стирания*/		    if(say_error){		      win14.txts[1].x=(-1);		      win14.txts[1].txt=str;		      switch(ask(&win14,2,HOR))			{			  default:			  case 2: /* OK */			  break;			  case 3: /* Silently - не спрашивать (в nc этого нет)*/			    say_error=0;			  break;			  case 4: /* Cancel (в nc этого нет)*/			    del_file=0;			    stop=1;			  break;			}		    }		  }else{ /* каталог нормально стерт */		    item->attrs ^= MARKED;		    panels[cpanel].selected--;		    panels[cpanel].size_sel-=item->size;		    outpanel=cpanel;		    refr_panel();		  }	      break;	    }	}else{ /* файл или что-то специальное */	  soob(&win9);	  if(unlink(name))	    { /* ошибка удаления файла */	      if(say_error){		win13.txts[1].x=(-1);		win13.txts[1].txt=str;		switch(ask(&win13,2,HOR))		  {		    default:		    case 2: /* OK */		    break;		    case 3: /* Silently - не спрашивать (в nc этого нет)*/		      say_error=0;		    break;		    case 4: /* Cancel (в nc этого нет)*/		      del_file=0;		      stop=1;		    break;		  }	      }	    }else{ /* файл нормально стерт */	      item->attrs ^= MARKED;	      panels[cpanel].selected--;	      panels[cpanel].size_sel-=item->size;	      outpanel=cpanel;	      refr_panel();	    }	}    } /* if(del_file) */  } /* if ... selected ... else */delsoob();for(outpanel=0;outpanel<NPANELS;outpanel++){    if(deleted)      { /* что-то удалялось */	nfile=panels[outpanel].curfile;	nfirst=panels[outpanel].firstfile;	if(chdir(panels[outpanel].full_dir)) beep();	read_to_panel();	if(nfile<panels[outpanel].nfiles) {	  panels[outpanel].firstfile=nfirst;	  panels[outpanel].curfile=nfile;	  refr_panel();	}      }else{#ifdef FREEBSD	if(panels[outpanel].on>0) refr_panel();#else	if(panels[outpanel].on>0) touchwin(panels[outpanel].win);#endif      }    if(panels[outpanel].on>0) wrefresh(panels[outpanel].win);}}
开发者ID:kotohvost,项目名称:conix,代码行数:101,


示例21: wdg_dialog_redraw

/*  * called to redraw a window */static int wdg_dialog_redraw(struct wdg_object *wo){   WDG_WO_EXT(struct wdg_dialog, ww);   size_t c, l, x, y;   size_t lines, cols;      WDG_DEBUG_MSG("wdg_dialog_redraw");    /* calculate the dimension and position */   wdg_dialog_get_size(wo, &lines, &cols);   /* center on the screen, but not outside the edges */   if (cols + 4 >= current_screen.cols)      wo->x1 = 0;   else      wo->x1 = (current_screen.cols - (cols + 4)) / 2;      wo->y1 = (current_screen.lines - (lines + 4)) / 2;   wo->x2 = -wo->x1;   wo->y2 = -wo->y1;      /* get the cohorditates as usual */   c = wdg_get_ncols(wo);   l = wdg_get_nlines(wo);   x = wdg_get_begin_x(wo);   y = wdg_get_begin_y(wo);      /* deal with rouding */   if (l != lines + 4) l = lines + 4;   if (c != cols + 4) c = cols + 4;    /* the window already exist */   if (ww->win) {      /* erase the border */      wbkgd(ww->win, COLOR_PAIR(wo->screen_color));      werase(ww->win);      touchwin(ww->win);      wnoutrefresh(ww->win);            /* resize the window and draw the new border */      mvwin(ww->win, y, x);      wresize(ww->win, l, c);      wdg_dialog_border(wo);      wdg_dialog_buttons(wo);            /* resize the actual window and touch it */      mvwin(ww->sub, y + 2, x + 2);      wresize(ww->sub, l - 4, c - 4);      /* set the window color */      wbkgdset(ww->sub, COLOR_PAIR(wo->window_color));   /* the first time we have to allocate the window */   } else {      /* create the outher window */      if ((ww->win = newwin(l, c, y, x)) == NULL)         return -WDG_EFATAL;      /* draw the borders */      wdg_dialog_border(wo);      wdg_dialog_buttons(wo);      /* create the inner (actual) window */      if ((ww->sub = newwin(l - 4, c - 4, y + 2, x + 2)) == NULL)         return -WDG_EFATAL;            /* set the window color */      wbkgdset(ww->sub, COLOR_PAIR(wo->window_color));      werase(ww->sub);      redrawwin(ww->sub);   }     /* print the message text */   wmove(ww->sub, 0, 0);   wprintw(ww->sub, ww->text);      /* refresh the window */   redrawwin(ww->sub);   redrawwin(ww->win);   wnoutrefresh(ww->win);   wnoutrefresh(ww->sub);      wo->flags |= WDG_OBJ_VISIBLE;   return WDG_ESUCCESS;}
开发者ID:LocutusOfBorg,项目名称:Ettercap-NG,代码行数:90,


示例22: wdg_input_redraw

/*  * called to redraw the menu */static int wdg_input_redraw(struct wdg_object *wo){   WDG_WO_EXT(struct wdg_input_handle, ww);   size_t c, l, x, y;      WDG_DEBUG_MSG("wdg_input_redraw");      /* center the window on the screen */   wo->x1 = (current_screen.cols - (ww->x + 2)) / 2;   wo->y1 = (current_screen.lines - (ww->y + 2)) / 2;   wo->x2 = -wo->x1;   wo->y2 = -wo->y1;      c = wdg_get_ncols(wo);   l = wdg_get_nlines(wo);   x = wdg_get_begin_x(wo);   y = wdg_get_begin_y(wo);      /* deal with rouding */   if (l != ww->y + 2) l = ww->y + 2;   if (c != ww->x + 2) c = ww->x + 2;    /* the window already exist */   if (ww->win) {      /* erase the border */      wbkgd(ww->win, COLOR_PAIR(wo->screen_color));      werase(ww->win);      /* destroy the internal form */      wdg_input_form_destroy(wo);            touchwin(ww->win);      wnoutrefresh(ww->win);      /* set the form color */      wbkgd(ww->win, COLOR_PAIR(wo->window_color));           /* resize the window */      mvwin(ww->win, y, x);      wresize(ww->win, l, c);            /* redraw the window */      wdg_input_borders(wo);            /* create the internal form */      wdg_input_form_create(wo);            touchwin(ww->win);   /* the first time we have to allocate the window */   } else {      /* create the menu window (fixed dimensions) */      if ((ww->win = newwin(l, c, y, x)) == NULL)         return -WDG_E_FATAL;      /* set the window color */      wbkgd(ww->win, COLOR_PAIR(wo->window_color));      redrawwin(ww->win);            /* draw the titles */      wdg_input_borders(wo);      /* create the internal form */      wdg_input_form_create(wo);      /* no scrolling for menu */      scrollok(ww->win, FALSE);   }      /* refresh the window */   touchwin(ww->win);   wnoutrefresh(ww->win);      touchwin(ww->fwin);   wnoutrefresh(ww->fwin);   wo->flags |= WDG_OBJ_VISIBLE;   return WDG_E_SUCCESS;}
开发者ID:AntonioCollarino,项目名称:ettercap,代码行数:84,


示例23: test_inserts

static voidtest_inserts(int level){    static bool first = TRUE;    int ch;    int limit;    int row = 1;    int col;    int row2, col2;    int length;    wchar_t buffer[BUFSIZ];    WINDOW *look = 0;    WINDOW *work = 0;    WINDOW *show = 0;    int margin = (2 * MY_TABSIZE) - 1;    Options option = (Options) ((int) (m_opt ? oMove : oDefault)				| (int) ((w_opt || (level > 0))					 ? oWindow : oDefault));    if (first) {	static char cmd[80];	setlocale(LC_ALL, "");	putenv(strcpy(cmd, "TABSIZE=8"));	initscr();	(void) cbreak();	/* take input chars one at a time, no wait for /n */	(void) noecho();	/* don't echo input */	keypad(stdscr, TRUE);	/*	 * Show the characters inserted in color, to distinguish from those that	 * are shifted.	 */	if (has_colors()) {	    start_color();	    init_pair(1, COLOR_WHITE, COLOR_BLUE);	}    }    limit = LINES - 5;    if (level > 0) {	look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1);	work = newwin(limit - 2, COLS - (2 * level), 1, level);	show = newwin(4, COLS, limit + 1, 0);	box(look, 0, 0);	wnoutrefresh(look);	limit -= 2;    } else {	work = stdscr;	show = derwin(stdscr, 4, COLS, limit + 1, 0);    }    keypad(work, TRUE);    for (col = margin + 1; col < COLS; col += MY_TABSIZE)	MvWVLine(work, row, col, '.', limit - 2);    MvWVLine(work, row, margin, ACS_VLINE, limit - 2);    MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2);    limit /= 2;    (void) mvwaddstr(work, 1, 2, "String");    (void) mvwaddstr(work, limit + 1, 2, "Chars");    wnoutrefresh(work);    buffer[length = 0] = '/0';    legend(show, level, option, buffer, length);    wnoutrefresh(show);    doupdate();    if (has_colors()) {	wbkgdset(work, (chtype) (COLOR_PAIR(1) | ' '));    }    while ((ch = read_linedata(work)) != ERR && !isQUIT(ch)) {	wmove(work, row, margin + 1);	switch (ch) {	case key_RECUR:	    test_inserts(level + 1);	    if (look)		touchwin(look);	    touchwin(work);	    touchwin(show);	    if (look)		wnoutrefresh(look);	    wnoutrefresh(work);	    wnoutrefresh(show);	    doupdate();	    break;	case key_NEWLINE:	    if (row < limit) {		++row;		/* put the whole string in, all at once */		col2 = margin + 1;		switch (option) {//.........这里部分代码省略.........
开发者ID:chitranshi,项目名称:ncurses,代码行数:101,


示例24: test_opaque

//.........这里部分代码省略.........    for (;;) {	if (in_status) {	    to_keyword(stswin, active);	    ch = wgetch(stswin);	    show_opaque(stswin, txtwin, TRUE, active);	    if (Quit(ch))		break;	    switch (ch) {	    case '/t':		in_status = FALSE;		break;	    case KEY_DOWN:	    case 'j':		if (active < (int) SIZEOF(bool_funcs) - 1)		    active++;		else		    beep();		break;	    case KEY_UP:	    case 'k':		if (active > 0)		    active--;		else		    beep();		break;	    case ' ':		bool_funcs[active].func(txtwin,					!bool_funcs[active].func(txtwin, -1));		break;	    default:		beep();		break;	    }	    show_opaque(stswin, txtwin, FALSE, in_status ? active : -1);	} else {	    ch = mvwgetch(txtwin, txt_y, txt_x);	    show_opaque(stswin, txtwin, TRUE, -1);	    if (Quit(ch))		break;	    switch (ch) {	    case '/t':		in_status = TRUE;		break;	    case KEY_DOWN:	    case 'j':		if (txt_y < getmaxy(txtwin) - 1)		    txt_y++;		else		    beep();		break;	    case KEY_UP:	    case 'k':		if (txt_y > base_y)		    txt_y--;		else		    beep();		break;	    case KEY_LEFT:	    case 'h':		if (txt_x > 0)		    txt_x--;		else		    beep();		break;	    case KEY_RIGHT:	    case 'l':		if (txt_x < getmaxx(txtwin) - 1)		    txt_x++;		else		    beep();		break;	    case 'w':		test_opaque(level + 1, argv, stswin);		if (txtbox != 0) {		    touchwin(txtbox);		    wnoutrefresh(txtbox);		} else {		    touchwin(txtwin);		    wnoutrefresh(txtwin);		}		break;	    default:		beep();		napms(100);		break;	    }	    show_opaque(stswin, txtwin, FALSE, -1);	}    }    if (level > 1) {	delwin(txtwin);	delwin(txtbox);    }    return TRUE;}
开发者ID:SayCV,项目名称:rtems-addon-packages,代码行数:101,


示例25: subwin

static WINDOW *create_subwindow(int height, int width, int y_pos, int x_pos){	WINDOW *win = subwin(scr, height, width, y_pos, x_pos);	touchwin(scr);	return win;}
开发者ID:nvf-crucio,项目名称:PROX,代码行数:6,


示例26: mainmenu

static void mainmenu(menu *mp){    int nitems, barlen, old = -1, cur = 0, c, cur0;    menudim(mp, &nitems, &barlen);    repaintmainmenu(barlen, mp);    while (!quit)    {        if (cur != old)        {            if (old != -1)            {                mvwaddstr(wmain, 0, old * barlen,                           prepad(padstr(mp[old].name, barlen - 1), 1));                statusmsg(mp[cur].desc);            }            else                mainhelp();            setcolor(wmain, MAINMENUREVCOLOR);            mvwaddstr(wmain, 0, cur * barlen,                       prepad(padstr(mp[cur].name, barlen - 1), 1));            setcolor(wmain, MAINMENUCOLOR);            old = cur;            wrefresh(wmain);        }        switch (c = (key != ERR ? key : waitforkey()))        {        case KEY_DOWN:        case '/n':              /* menu item selected */            touchwin(wbody);            wrefresh(wbody);            rmerror();            setmenupos(th + mh, cur * barlen);            curs_set(1);            (mp[cur].func)();   /* perform function */            curs_set(0);            switch (key)            {            case KEY_LEFT:                cur = (cur + nitems - 1) % nitems;                key = '/n';                break;            case KEY_RIGHT:                cur = (cur + 1) % nitems;                key = '/n';                break;            default:                key = ERR;            }            repaintmainmenu(barlen, mp);            old = -1;            break;        case KEY_LEFT:            cur = (cur + nitems - 1) % nitems;            break;        case KEY_RIGHT:            cur = (cur + 1) % nitems;            break;        case KEY_ESC:            mainhelp();            break;        default:            cur0 = cur;            do            {                cur = (cur + 1) % nitems;            } while ((cur != cur0) && (hotkey(mp[cur].name) != toupper(c)));            if (hotkey(mp[cur].name) == toupper(c))                key = '/n';        }    }    rmerror();    touchwin(wbody);    wrefresh(wbody);}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:94,


示例27: dir_partition

//.........这里部分代码省略.........  aff_copy(window);#else  dir_data.display=NULL;#endif  log_info("/n");  switch(res)  {    case DIR_PART_ENOSYS:      screen_buffer_reset();#ifdef HAVE_NCURSES      aff_copy(window);      wmove(window,4,0);      aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk,partition);#endif      log_partition(disk,partition);      screen_buffer_add("Support for this filesystem hasn't been enable during compilation./n");      screen_buffer_to_log();      if(*current_cmd==NULL)      {#ifdef HAVE_NCURSES	screen_buffer_display(window,"",NULL);#endif      }      break;    case DIR_PART_EIO:      screen_buffer_reset();#ifdef HAVE_NCURSES      aff_copy(window);      wmove(window,4,0);      aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk,partition);#endif      log_partition(disk,partition);      screen_buffer_add("Can't open filesystem. Filesystem seems damaged./n");      screen_buffer_to_log();      if(*current_cmd==NULL)      {#ifdef HAVE_NCURSES	screen_buffer_display(window,"",NULL);#endif      }      break;    case DIR_PART_OK:      {	int recursive=0;	if(*current_cmd!=NULL)	{	  int do_continue;	  do	  {	    do_continue=0;	    while(*current_cmd[0]==',')	      (*current_cmd)++;	    if(strncmp(*current_cmd,"recursive",9)==0)	    {	      (*current_cmd)+=9;	      recursive=1;	      do_continue=1;	    }	    else if(strncmp(*current_cmd,"fullpathname",12)==0)	    {	      (*current_cmd)+=12;	      dir_data.param|=FLAG_LIST_PATHNAME;	      do_continue=1;	    }	  } while(do_continue==1);	}	if(recursive>0)	  dir_whole_partition_log(disk,partition,&dir_data,dir_data.current_inode);	else	{#ifdef HAVE_NCURSES	  dir_partition_aff(disk, partition, &dir_data, dir_data.current_inode, current_cmd);#else	  {	    file_info_t dir_list = {	      .list = TD_LIST_HEAD_INIT(dir_list.list),	      .name = NULL	    };	    dir_data.get_dir(disk, partition, &dir_data, dir_data.current_inode, &dir_list);	    dir_aff_log(&dir_data, &dir_list);	    delete_list_file(&dir_list);	  }#endif	}	dir_data.close(&dir_data);      }      break;  }#ifdef HAVE_NCURSES  delwin(window);  (void) clearok(stdscr, TRUE);#ifdef HAVE_TOUCHWIN  touchwin(stdscr);#endif  wrefresh(stdscr);#endif  fflush(stderr);  free(dir_data.local_dir);  return res;}
开发者ID:AndychenCL,项目名称:TestDisk,代码行数:101,


示例28: PDC_LOG

WINDOW *getwin(FILE *filep){    WINDOW *win;    char marker[4];    int i, nlines, ncols;    PDC_LOG(("getwin() - called/n"));    if ( !(win = malloc(sizeof(WINDOW))) )        return (WINDOW *)NULL;    /* check for the marker, and load the WINDOW struct */    if (!filep || !fread(marker, 4, 1, filep) || strncmp(marker, "PDC", 3)        || marker[3] != DUMPVER || !fread(win, sizeof(WINDOW), 1, filep))    {        free(win);        return (WINDOW *)NULL;    }    nlines = win->_maxy;    ncols = win->_maxx;    /* allocate the line pointer array */    if ( !(win->_y = malloc(nlines * sizeof(chtype *))) )    {        free(win);        return (WINDOW *)NULL;    }    /* allocate the minchng and maxchng arrays */    if ( !(win->_firstch = malloc(nlines * sizeof(int))) )    {        free(win->_y);        free(win);        return (WINDOW *)NULL;    }    if ( !(win->_lastch = malloc(nlines * sizeof(int))) )    {        free(win->_firstch);        free(win->_y);        free(win);        return (WINDOW *)NULL;    }    /* allocate the lines */    if ( !(win = PDC_makelines(win)) )        return (WINDOW *)NULL;    /* read them */    for (i = 0; i < nlines; i++)    {        if (!fread(win->_y[i], ncols * sizeof(chtype), 1, filep))        {            delwin(win);            return (WINDOW *)NULL;        }    }    touchwin(win);    return win;}
开发者ID:hulu1528,项目名称:PDCurses,代码行数:68,


示例29: wbkgd

//------------------------------------------------------------------------------int wbkgd( WINDOW* win, chtype ch ){	__QCS_FCONTEXT( "wbkgd" );    int x, y;    chtype oldcolr, oldch, newcolr, newch, colr, attr;    chtype oldattr = 0, newattr = 0;    chtype *winptr;    if( !win )	{        return ERR;	}    if( win->_bkgd == ch )	{        return 0;	}    oldcolr = win->_bkgd & A_COLOR;    if( oldcolr )	{        oldattr = (win->_bkgd & A_ATTRIBUTES) ^ oldcolr;	}    oldch = win->_bkgd & A_CHARTEXT;    wbkgdset( win, ch );    newcolr = win->_bkgd & A_COLOR;    if( newcolr )	{        newattr = (win->_bkgd & A_ATTRIBUTES) ^ newcolr;	}    newch = win->_bkgd & A_CHARTEXT;    // what follows is what seems to occur in the System V implementation of this routine    for( y = 0; y < win->_maxy; y++ )    {        for( x = 0; x < win->_maxx; x++ )        {            winptr = win->_y[ y ] + x;            ch = *winptr;            // determine the colors and attributes of the character read from the window            colr = ch & A_COLOR;            attr = ch & ( A_ATTRIBUTES ^ A_COLOR );            // if the color is the same as the old background color, then make it the new background color, otherwise leave it             if( colr == oldcolr )			{                colr = newcolr;			}            // remove any attributes (non color) from the character that were part of the old background, then combine the remaining ones with the new background             attr ^= oldattr;            attr |= newattr;            // change character if it is there because it was the old background character            ch &= A_CHARTEXT;            if( ch == oldch )			{                ch = newch;			}            ch |= ( attr | colr );            *winptr = ch;        }    }    touchwin( win );    PDC_sync( win );    return 0;}
开发者ID:chenbk85,项目名称:QOR,代码行数:83,



注:本文中的touchwin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tp函数代码示例
C++ toucheventselector函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。