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

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

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

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

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

示例1: status_bar_clear

voidstatus_bar_clear(void){    if (message != NULL) {        free(message);        message = NULL;    }        int i;    for (i = 0; i < 9; i++) {        is_active[i] = FALSE;        is_new[i] = FALSE;    }    wclear(status_bar);    int rows, cols;    getmaxyx(stdscr, rows, cols);    wattron(status_bar, COLOR_PAIR(4));    mvwprintw(status_bar, 0, cols - 29, _active);    wattroff(status_bar, COLOR_PAIR(4));    dirty = TRUE;}
开发者ID:cbrp,项目名称:profanity,代码行数:24,


示例2: do_replace_highlight

/* Highlight the current word being replaced or spell checked.  We * expect word to have tabs and control characters expanded. */void do_replace_highlight(bool highlight, const char *word){	size_t y = xplustabs(), word_len = strlenpt(word);	y = get_page_start(y) + COLS - y;	/* Now y is the number of columns that we can display on this	 * line. */	assert(y > 0);	if (word_len > y) {		y--;	}	reset_cursor();	wnoutrefresh(edit);	if (highlight) {		wattron(edit, highlight_attribute);	}	/* This is so we can show zero-length matches. */	if (word_len == 0) {		waddch(edit, ' ');	} else {		waddnstr(edit, word, actual_x(word, y));	}	if (word_len > y) {		waddch(edit, '$');	}	if (highlight) {		wattroff(edit, highlight_attribute);	}}
开发者ID:pgengler,项目名称:pinot,代码行数:38,


示例3: print_game_info

void		print_game_info(t_all *all){  unsigned int	i;  unsigned int	j;  i = -1;  mvwprintw(all->game.board, 1, 1, "Hight Score %d", all->game.h_score);  mvwprintw(all->game.board, 2, 1, "Score %d", all->game.score);  wrefresh(all->game.board);  wborder(all->game.tetris, '|', '|', '-', '-', '-', '-', '-', '-');  wrefresh(all->game.tetris);  while (++i < all->param.rows)    {      j = -1;      while (++j != all->param.cols)	{	      wattron(all->game.tetris, COLOR_PAIR(all->param.map[i][j]));	      mvwprintw(all->game.tetris, i + 1, j + 1, (all->param.map[i][j]							 == '0') ? " " : " ");	      wattroff(all->game.tetris, COLOR_PAIR(all->param.map[i][j]));	}    }  wrefresh(all->game.tetris);}
开发者ID:mairesb,项目名称:my_epi_work,代码行数:24,


示例4: show_progress_bar

/** Show the progress bar window. */static void show_progress_bar(void){  int nLength = 0;  int nIndex = 0;  int nStart = strlen(f_szProgress);  int nColorID = 0;  if (0 == (f_uiTestsRun + f_uiTestsSkipped)) {    nLength = f_nWidth - f_nLeft - nStart - 6;    nColorID = PROGRESS_BACKGROUND_COLOR;  }  else {    nLength = (f_nWidth - f_nLeft - nStart - 6) * ((double)(f_uiTestsRun + f_uiTestsSkipped) / f_uiTotalTests);    nColorID = (!f_uiTestsSkipped && f_uiTestsRun == f_uiTestsRunSuccessful)            ? PROGRESS_SUCCESS_COLOR            : PROGRESS_FAILURE_COLOR;  }  wattron(application_windows.pProgressWin, A_BOLD | COLOR_PAIR(nColorID));  for (nIndex = 0; nIndex < nLength; nIndex++) {    mvwprintw(application_windows.pProgressWin, 0, nStart + nIndex, " ");  }  wattroff(application_windows.pProgressWin, COLOR_PAIR(nColorID));}
开发者ID:RajasekharBhumi,项目名称:L4Re,代码行数:25,


示例5: status_line

void status_line(char *fmt, ...){	char *line = NULL;        va_list ap;	wattron(w_line2, A_REVERSE);	wmove(w_line2, 0, 0);        va_start(ap, fmt);	vasprintf(&line, fmt, ap);        myprint(w_line2, line);	free(line);        va_end(ap);	wattroff(w_line2, A_REVERSE);	wnoutrefresh(w_line2);	if (win_resize)		recreate_terminal();}
开发者ID:LgJianzhao,项目名称:httping,代码行数:24,


示例6: imprimir_centrao

voidimprimir_centrao (WINDOW * win, int starty, int startx, int width,		  char *string, chtype color){  int length, x, y;  float temp;  if (win == NULL)    win = stdscr;  getyx (win, y, x);  if (startx != 0)    x = startx;  if (starty != 0)    y = starty;  if (width == 0)    width = 80;  length = strlen (string);  temp = (width - length) / 2;  x = startx + (int) temp;  wattron (win, color);  mvwprintw (win, y, x, "%s", string);  wattroff (win, color);  refresh ();}
开发者ID:canicue,项目名称:Seminario,代码行数:24,


示例7: lui_print_colored_chatbox

/*  chatbox:print_colored(s, {  bold = true,  foreground = 3,  ...  })  Stack:  2nd the string to display  3rd argument is a table who can contain all the attributes above  TODO: Optimisation ?*/int		lui_print_colored_chatbox(lua_State *L){  CHATBOX	*c = check_chatbox(L, 1);  const char	*s = luaL_checkstring(L, 2); /* string to display */  attr_t	attr;  short		pair;  t_style	style;  /* save current state */  wattr_get(c->pad, &attr, &pair, NULL);  get_style(L, 3, style);  wattron(c->pad, style.on);  wattroff(c->pad, style.off);  /* put the string */  c->scroll = 0;  waddstr(c->pad, s);  /* restore old attr */  wattr_set(c->pad, attr, pair, NULL);  return 0;}
开发者ID:Sarcasm,项目名称:luasoul,代码行数:37,


示例8: vl_int_draw_list

void vl_int_draw_list(WINDOW *win, 	unsigned int width, dl_list *sel_entry, dl_list *start_entry,	dl_list *stop_entry){	vl_entry *ent;	int line;	int tmp_attr;	int utf8_len;	short std_color_pair;	attr_t std_attr;	wattr_get(win, &std_attr, &std_color_pair, NULL);	line = 0;	do{		ent = (vl_entry *)start_entry->data;		if( ent->attributes)			tmp_attr = wattrset(win, ent->attributes);		if(start_entry == sel_entry )			wattron(win,A_STANDOUT);				mvwaddstr(win, line, 0, ent->str);		utf8_len = utf8_strlen(ent->str);		mvwhline(win, line, utf8_len, ' ', width - utf8_len);		if( ent->attributes)			tmp_attr = wattrset(win, std_attr);		if(start_entry == sel_entry )			wattroff(win,A_STANDOUT);		line ++;		start_entry = start_entry->next;	}while( start_entry != NULL && start_entry != stop_entry->next );}
开发者ID:yzzyx,项目名称:mimic,代码行数:36,


示例9: movexy

void movexy(WINDOW *game_window, struct ghost_char_2 *my_ghost_char,struct pacman_char *my_pacman_char,struct Item_Struct *my_item_struct, int des_x, int des_y){	my_ghost_char->ghost_col+=des_x;	my_ghost_char->ghost_row+=des_y;	mvwaddch(game_window, my_item_struct->y_pos, my_item_struct->x_pos, my_item_struct->value);				my_item_struct->x_pos = my_ghost_char->ghost_col;	my_item_struct->y_pos = my_ghost_char->ghost_row;	int characters = (int)mvwinch(game_window, my_item_struct->y_pos, my_item_struct->x_pos);	if(my_item_struct->x_pos == my_pacman_char->pac_row && my_item_struct->y_pos == my_pacman_char->pac_col){		my_item_struct->value = ' ';	}else{		my_item_struct->value = characters;	}	wattron(game_window,COLOR_PAIR(5));	mvwaddch(game_window, my_ghost_char->ghost_row, my_ghost_char->ghost_col, ACS_CKBOARD);	wattroff(game_window,COLOR_PAIR(5));	wrefresh(game_window);	wrefresh(game_window);}
开发者ID:anthony1810,项目名称:pacman2,代码行数:24,


示例10: main

int main(void){    initscr();    curs_set(0);    noecho();    use_default_colors();    start_color();    init_pair(1, COLOR_GREEN, COLOR_BLACK);    init_pair(2, COLOR_GREEN, COLOR_RED);    init_pair(3, COLOR_BLACK, COLOR_WHITE);    wattron(stdscr, COLOR_PAIR(1));    wprintw(stdscr, "GREEN ON BLACK/n");    wattroff(stdscr, COLOR_PAIR(1));    wattron(stdscr, COLOR_PAIR(1) | A_BOLD);    wprintw(stdscr, "BOLD GREEN ON BLACK/n");    wattroff(stdscr, COLOR_PAIR(1) | A_BOLD);    wattron(stdscr, COLOR_PAIR(2));    wprintw(stdscr, "GREEN ON RED/n");    wattroff(stdscr, COLOR_PAIR(2));    wattron(stdscr, COLOR_PAIR(2) | A_BOLD);    wprintw(stdscr, "BOLD GREEN ON RED/n");    wattroff(stdscr, COLOR_PAIR(2) | A_BOLD);    wattron(stdscr, COLOR_PAIR(3));    wprintw(stdscr, "BLACK ON WHITE/n");    wattroff(stdscr, COLOR_PAIR(2));    wattron(stdscr, COLOR_PAIR(3) | A_BOLD);    wprintw(stdscr, "BOLD BLACK ON WHITE/n");    wattroff(stdscr, COLOR_PAIR(2) | A_BOLD);    refresh();    getch();    endwin();    return 0;}
开发者ID:boothj5,项目名称:ncurses_bold,代码行数:42,


示例11: do_dictionary_prompt

//.........这里部分代码省略.........	    blank_bottombars();	    /* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */	    if (all) {		shortstr[1] = allstr[0];		wmove(bottomwin, 1, width);		onekey(shortstr, _("All"), width);	    }            for(i = 0; i < count && i < 5; i++){                sprintf(but, "%d", i + 1);                if(i == 0) wmove(bottomwin, 1, 0);                else wmove(bottomwin, 1, i * width);                if(p){                    onekey(but, p->word, width);                    p = p->next;                }                j++;            }	    wmove(bottomwin, 1, i * width);	    onekey("^C", _("Cancel"), width);	}	if (interface_color_pair[TITLE_BAR].bright)	    wattron(bottomwin, A_BOLD);	wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);	blank_statusbar();	mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));	wattroff(bottomwin, A_BOLD);	wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);	/* Refresh edit window and statusbar before getting input. */	wnoutrefresh(edit);	wnoutrefresh(bottomwin);	currmenu = MYESNO;	kbinput = get_kbinput(bottomwin);#ifndef NANO_TINY	if (kbinput == KEY_WINCH)	    continue;#endif        /*49 is 1, 50 is 2 and so on*/	func = func_from_key(&kbinput);	if (func == do_cancel){	    ok = 0;            return ok;        }          if(kbinput == 's'){            if(i == 5) {                continue;            }        }        if(kbinput <= '0' || kbinput > '0' + count) return -1;                if(kbinput > '0' && kbinput <= '0' + count){            p = l.head;            i = kbinput - '0' - 1;
开发者ID:ris21,项目名称:yoda,代码行数:67,


示例12: do_yesno_prompt

/* Ask a simple Yes/No (and optionally All) question, specified in msg, * on the statusbar.  Return 1 for Yes, 0 for No, 2 for All (if all is * TRUE when passed in), and -1 for Cancel. */int do_yesno_prompt(bool all, const char *msg){    int ok = -2, width = 16;    const char *yesstr;		/* String of Yes characters accepted. */    const char *nostr;		/* Same for No. */    const char *allstr;		/* And All, surprise! */    int oldmenu = currmenu;    assert(msg != NULL);    /* yesstr, nostr, and allstr are strings of any length.  Each string     * consists of all single-byte characters accepted as valid     * characters for that value.  The first value will be the one     * displayed in the shortcuts. */    /* TRANSLATORS: For the next three strings, if possible, specify     * the single-byte shortcuts for both your language and English.     * For example, in French: "OoYy" for "Oui". */    yesstr = _("Yy");    nostr = _("Nn");    allstr = _("Aa");    do {	int kbinput;	functionptrtype func;#ifndef DISABLE_MOUSE	int mouse_x, mouse_y;#endif	if (!ISSET(NO_HELP)) {	    char shortstr[3];		/* Temporary string for (translated) " Y", " N" and " A". */	    if (COLS < 32)		width = COLS / 2;	    /* Clear the shortcut list from the bottom of the screen. */	    blank_bottombars();	    /* Now show the ones for "Yes", "No", "Cancel" and maybe "All". */	    sprintf(shortstr, " %c", yesstr[0]);	    wmove(bottomwin, 1, 0);	    onekey(shortstr, _("Yes"), width);	    if (all) {		shortstr[1] = allstr[0];		wmove(bottomwin, 1, width);		onekey(shortstr, _("All"), width);	    }	    shortstr[1] = nostr[0];	    wmove(bottomwin, 2, 0);	    onekey(shortstr, _("No"), width);	    wmove(bottomwin, 2, width);	    onekey("^C", _("Cancel"), width);	}	if (interface_color_pair[TITLE_BAR].bright)	    wattron(bottomwin, A_BOLD);	wattron(bottomwin, interface_color_pair[TITLE_BAR].pairnum);	blank_statusbar();	mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));	wattroff(bottomwin, A_BOLD);	wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);	/* Refresh edit window and statusbar before getting input. */	wnoutrefresh(edit);	wnoutrefresh(bottomwin);	currmenu = MYESNO;	kbinput = get_kbinput(bottomwin);#ifndef NANO_TINY	if (kbinput == KEY_WINCH)	    continue;#endif	func = func_from_key(&kbinput);	if (func == do_cancel)	    ok = -1;#ifndef DISABLE_MOUSE	else if (kbinput == KEY_MOUSE) {		/* We can click on the Yes/No/All shortcut list to		 * select an answer. */		if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&			wmouse_trafo(bottomwin, &mouse_y, &mouse_x,			FALSE) && mouse_x < (width * 2) &&			mouse_y > 0) {		    int x = mouse_x / width;			/* Calculate the x-coordinate relative to the			 * two columns of the Yes/No/All shortcuts in			 * bottomwin. */		    int y = mouse_y - 1;			/* Calculate the y-coordinate relative to the//.........这里部分代码省略.........
开发者ID:ris21,项目名称:yoda,代码行数:101,


示例13: update_status_win

/* Updates the status bar */static void update_status_win(void){    int pos;    char filename[FSUTIL_PATH_MAX];    int attr;    if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1)        return;    /* Update the tty status bar */    if (tty_win_on) {        wattron(tty_status_win, attr);        for (pos = 0; pos < WIDTH; pos++)            mvwprintw(tty_status_win, 0, pos, " ");        mvwprintw(tty_status_win, 0, 0, (char *) tgdb_tty_name(tgdb));        wattroff(tty_status_win, attr);    }    /* Print white background */    wattron(status_win, attr);    for (pos = 0; pos < WIDTH; pos++)        mvwprintw(status_win, 0, pos, " ");    if (tty_win_on)        wattron(tty_status_win, attr);    /* Show the user which window is focused */    if (focus == GDB)        mvwprintw(status_win, 0, WIDTH - 1, "*");    else if (focus == TTY && tty_win_on)        mvwprintw(tty_status_win, 0, WIDTH - 1, "*");    else if (focus == CGDB || focus == CGDB_STATUS_BAR)        mvwprintw(status_win, 0, WIDTH - 1, " ");    wattroff(status_win, attr);    if (tty_win_on)        wattroff(tty_status_win, attr);    /* Print the regex that the user is looking for Forward */    if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX            && regex_direction_cur) {        if_display_message("/", WIDTH - 1, "%s", ibuf_get(regex_cur));        curs_set(1);    }    /* Regex backwards */    else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX) {        if_display_message("?", WIDTH - 1, "%s", ibuf_get(regex_cur));        curs_set(1);    }    /* A colon command typed at the status bar */    else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) {        char *command = ibuf_get(cur_sbc);        if (!command)            command = "";        if_display_message(":", WIDTH - 1, "%s", command);        curs_set(1);    }    /* Default: Current Filename */    else {        /* Print filename */        if (src_win != NULL && source_current_file(src_win, filename) != NULL)            if_display_message("", WIDTH - 1, "%s", filename);    }    wrefresh(status_win);}
开发者ID:albertoCaroM,项目名称:cgdb,代码行数:66,


示例14: prompt_onDraw

static void prompt_onDraw(ToxWindow *self, Tox *m){    int x2, y2;    getmaxyx(self->window, y2, x2);    ChatContext *ctx = self->chatwin;    line_info_print(self);    wclear(ctx->linewin);    curs_set(1);    if (ctx->len > 0)        mvwprintw(ctx->linewin, 1, 0, "%ls", &ctx->line[ctx->start]);    StatusBar *statusbar = self->stb;    mvwhline(statusbar->topline, 1, 0, ACS_HLINE, x2);    wmove(statusbar->topline, 0, 0);    if (statusbar->is_online) {        int colour = WHITE;        const uint8_t *status_text = "Unknown";        switch (statusbar->status) {            case TOX_USERSTATUS_NONE:                status_text = "Online";                colour = GREEN;                break;            case TOX_USERSTATUS_AWAY:                status_text = "Away";                colour = YELLOW;                break;            case TOX_USERSTATUS_BUSY:                status_text = "Busy";                colour = RED;                break;            case TOX_USERSTATUS_INVALID:                status_text = "ERROR";                colour = MAGENTA;                break;        }        wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);        wprintw(statusbar->topline, " [%s]", status_text);        wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);        wattron(statusbar->topline, A_BOLD);        wprintw(statusbar->topline, " %s", statusbar->nick);        wattroff(statusbar->topline, A_BOLD);    } else {        wprintw(statusbar->topline, "[Offline]");        wattron(statusbar->topline, A_BOLD);        wprintw(statusbar->topline, " %s ", statusbar->nick);        wattroff(statusbar->topline, A_BOLD);    }    if (statusbar->statusmsg[0])        wprintw(statusbar->topline, " - %s", statusbar->statusmsg);    mvwhline(self->window, y2 - CHATBOX_HEIGHT, 0, ACS_HLINE, x2);    int y, x;    getyx(self->window, y, x);    int new_x = ctx->start ? x2 - 1 : ctx->pos;    wmove(self->window, y + 1, new_x);    if (self->help->active) {        wrefresh(self->window);        help_onDraw(self);    }}
开发者ID:h4ck3rm1k3,项目名称:toxic,代码行数:74,


示例15: sel_dest

int sel_dest(void){	int c, r;	char h, l;	unsigned int k_ch;		c = (curchar / 16);	r = (curchar % 16);	for(;;)	{		curchar = r + (c*16);				display(curchar);				h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT);		l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT);		wattron(set_win,A_UNDERLINE);		mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l);		wattroff(set_win,A_UNDERLINE);				wmove(set_win,(r+1),((c*2)+1));		wrefresh(set_win);		k_ch = wgetch(set_win);				switch(k_ch)		{			case K_LEFT:			case KEY_LEFT:				if(c > 0)				{					normal_uset(r,c);					c--;				}				break;			case K_DOWN:			case KEY_DOWN:				if(r < 15)				{					normal_uset(r,c);					r++;				}				break;			case K_UP:			case KEY_UP:				if(r > 0)				{					normal_uset(r,c);					r--;				}				break;			case K_RIGHT:			case KEY_RIGHT:				if(c < 15)				{					normal_uset(r,c);					c++;				}				break;							case '/r':			case '/n':				normal_uset(r,c);				return(r + (c*16));			case 0x0c:				wrefresh(curscr);				break;						default:				normal_uset(r,c);							return(-1);		}	}}
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:79,


示例16: inputBox

//Creates an input box that allows the user to enter a string and returns it:std::string inputBox(){    //Initialises the colour pairs:    init_pair(4, COLOR_WHITE, COLOUR);    init_pair(5, COLOR_WHITE, COLOR_RED);    //Resize the input box:    inputbox.width = screenX / 2;    inputbox.height = screenY / 4;    inputbox.x = ((screenX / 2) - (inputbox.width / 2));    inputbox.y = ((screenY / 2) - (inputbox.height / 2));    inputbox.window = newwin(inputbox.height, inputbox.width, inputbox.y, inputbox.x);    //Set the background:    wbkgd(inputbox.window, COLOR_PAIR(4));    //The start position of the text entry box:    unsigned int boxX = 2;    unsigned int boxY = 2;    unsigned int boxWidth = inputbox.width - 4;    //The position of the buttons:    unsigned int button1X = (inputbox.width / 4) - 2;    unsigned int button2X = ((inputbox.width / 4) * 3) - 3;    unsigned int buttonY = inputbox.height - 2;    int input = 0, selection = 0;    std::string inputStr = "";    //The loop is indefinite, and ends when the user    //presses '<OK>' or '<CANCEL>':    while(1)    {        //Colours the text entry box red:        mvwchgat(inputbox.window, boxX, boxY, boxWidth, A_NORMAL, 5, NULL);        //Prints the text the user has entered:        wattron(inputbox.window, COLOR_PAIR(5));        mvwprintw(inputbox.window, boxY, boxX, "%s", inputStr.c_str());        wattroff(inputbox.window, COLOR_PAIR(5));        //Checks and highlights what area is currently selected:        switch(selection)        {        //The text box:        case 0:            curs_set(1);            mvwprintw(inputbox.window, buttonY, button1X, "%s", "<OK>");            mvwprintw(inputbox.window, buttonY, button2X, "%s", "<CANCEL>");            wmove(inputbox.window, boxY, (boxX + inputStr.size()));            break;        //The '<OK>' button:        case 1:            curs_set(0);            wattron(inputbox.window, COLOR_PAIR(5));            mvwprintw(inputbox.window, buttonY, button1X, "%s", "<OK>");            wattroff(inputbox.window, COLOR_PAIR(5));            mvwprintw(inputbox.window, buttonY, button2X, "%s", "<CANCEL>");            break;        //The '<CANCEL>' button:        case 2:            curs_set(0);            wattron(inputbox.window, COLOR_PAIR(5));            mvwprintw(inputbox.window, buttonY, button2X, "%s", "<CANCEL>");            wattroff(inputbox.window, COLOR_PAIR(5));            mvwprintw(inputbox.window, buttonY, button1X, "%s", "<OK>");            break;        }        //Refreshes the inputbox:        wrefresh(inputbox.window);        //Gets the input to check for the Tab key:        input = getch();        //If the input is tab, change the selection:        if(char(input) == '/t')        {            switch(selection)            {            case 0:                selection = 1;                break;            case 1:                selection = 2;                break;            case 2:                selection = 0;                break;            default:                selection = 0;            }        }        //If the input is Enter, close the box and        //return a value based on the selection:        else if(char(input) == '/n')        {//.........这里部分代码省略.........
开发者ID:kirbyUK,项目名称:trilobite,代码行数:101,


示例17: friendlist_onDraw

static void friendlist_onDraw(ToxWindow *self, Tox *m){    curs_set(0);    werase(self->window);    int x2, y2;    getmaxyx(self->window, y2, x2);    bool fix_statuses = x2 != self->x;    /* true if window x axis has changed */    wattron(self->window, COLOR_PAIR(CYAN));    wprintw(self->window, " Open a chat window with the");    wattron(self->window, A_BOLD);    wprintw(self->window, " Enter ");    wattroff(self->window, A_BOLD);    wprintw(self->window, "key. Delete a friend with the");    wattron(self->window, A_BOLD);    wprintw(self->window, " Delete ");    wattroff(self->window, A_BOLD);    wprintw(self->window, "key./n/n");    wattroff(self->window, COLOR_PAIR(CYAN));    wattron(self->window, A_BOLD);    wprintw(self->window, " Online: %d/%d /n/n", tox_get_num_online_friends(m), num_friends);    wattroff(self->window, A_BOLD);    if ((y2 - FLIST_OFST) <= 0)    /* don't allow division by zero */        return;    /* Determine which portion of friendlist to draw based on current position */    int page = num_selected / (y2 - FLIST_OFST);    int start = (y2 - FLIST_OFST) * page;    int end = y2 - FLIST_OFST + start;    int i;    for (i = start; i < num_friends && i < end; ++i) {        int f = friendlist_index[i];        bool f_selected = false;        if (friends[f].active) {            if (i == num_selected) {                wattron(self->window, A_BOLD);                wprintw(self->window, " > ");                wattroff(self->window, A_BOLD);                f_selected = true;            } else {                wprintw(self->window, "   ");            }                        if (friends[f].online) {                TOX_USERSTATUS status = friends[f].status;                int colour = WHITE;                switch (status) {                case TOX_USERSTATUS_NONE:                    colour = GREEN;                    break;                case TOX_USERSTATUS_AWAY:                    colour = YELLOW;                    break;                case TOX_USERSTATUS_BUSY:                    colour = RED;                    break;                }                wprintw(self->window, "[");                wattron(self->window, COLOR_PAIR(colour) | A_BOLD);                wprintw(self->window, "O");                wattroff(self->window, COLOR_PAIR(colour) | A_BOLD);                wprintw(self->window, "]");                if (f_selected)                    wattron(self->window, A_BOLD);                wprintw(self->window, "%s", friends[f].name);                if (f_selected)                    wattroff(self->window, A_BOLD);                /* Reset friends[f].statusmsg on window resize */                if (fix_statuses) {                    uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'/0'};                    tox_get_status_message(m, friends[f].num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH);                    snprintf(friends[f].statusmsg, sizeof(friends[f].statusmsg), "%s", statusmsg);                    friends[f].statusmsg_len = tox_get_status_message_size(m, f);                }                /* Truncate note if it doesn't fit on one line */                uint16_t maxlen = x2 - getcurx(self->window) - 4;                if (friends[f].statusmsg_len > maxlen) {                    friends[f].statusmsg[maxlen-3] = '/0';                    strcat(friends[f].statusmsg, "...");                    friends[f].statusmsg[maxlen] = '/0';                    friends[f].statusmsg_len = maxlen;                }                wprintw(self->window, " (%s)/n", friends[f].statusmsg);            } else {                wprintw(self->window, "[");                wattron(self->window, A_BOLD);//.........这里部分代码省略.........
开发者ID:Jman012,项目名称:toxic,代码行数:101,


示例18: show_hex

static voidshow_hex(void){  size_t histart = absoff, histop = histart + cursan->len;  size_t a = offset;  size_t r;  int hi = 0;  if (cursan == top)    histart = histop = 0;  wmove(whex, 1, 1);  for (r = 0; r < rows; ++r)    {      size_t start = a;      size_t c;      if (start < data_size)	wprintw(whex, "%08X", start);      else	wprintw(whex, "        ");      for (c = 0; c < columns; ++a, ++c)	{	  if (hi && histop <= a)	    {	      wattroff(whex, COLOR_PAIR(HIGHLIGHT));	      hi = 0;	    }	  if (c % 4 == 0)	    wprintw(whex, " ");	  wprintw(whex, " ");	  if (a == offset + cursor)	    wattron(whex, A_REVERSE);	  if (! hi && histart <= a && a < histop)	    {	      wattron(whex, COLOR_PAIR(HIGHLIGHT));	      hi = 1;	    }	  if (a < data_size)	    wprintw(whex, "%02X", data[a]);	  else	    wprintw(whex, "  ");	  if (a == offset + cursor)	    wattroff(whex, A_REVERSE);	}      if (hi)	{	  wattroff(whex, COLOR_PAIR(HIGHLIGHT));	  hi = 0;	}      wprintw(whex, "  ");      a = start;      for (c = 0; c < columns; ++a, ++c)	{	  if (hi && histop <= a)	    {	      wattroff(whex, COLOR_PAIR(HIGHLIGHT));	      hi = 0;	    }	  if (a == offset + cursor)	    wattron(whex, A_REVERSE);	  if (! hi && histart <= a && a < histop)	    {	      wattron(whex, COLOR_PAIR(HIGHLIGHT));	      hi = 1;	    }	  if (data_size < start)	    wprintw(whex, " ");	  else if (a < data_size)	    wprintw(whex, "%c", isprint(data[a]) ? data[a] : unprintable);	  else	    wprintw(whex, "%c", nodata);	  if (a == offset + cursor)	    wattroff(whex, A_REVERSE);	}      if (hi)	{	  wattroff(whex, COLOR_PAIR(HIGHLIGHT));	  hi = 0;	}      wmove(whex, r + 2, 1);    }  curs_set(0);  wrefresh(whex);}
开发者ID:d5h,项目名称:gah,代码行数:97,


示例19: wattroff

cursesxx::Format::~Format() {    wattroff( this->win, this->bitmask );}
开发者ID:lycantrophe,项目名称:Curses--,代码行数:3,


示例20: display_general

//.........这里部分代码省略.........  size_t n, i, j, max_field = 0, max_value = 0, mod_val, y;  typedef struct Field_  {    const char *field;    char *value;                /* char due to log, bw, log_file */    int color;  } Field;  Field fields[] = {    {T_REQUESTS, NULL, COL_CYAN},    {T_UNIQUE_VIS, NULL, COL_CYAN},    {T_REFERRER, NULL, COL_CYAN},    {T_LOG, NULL, COL_CYAN},    {T_F_REQUESTS, NULL, COL_CYAN},    {T_UNIQUE_FIL, NULL, COL_CYAN},    {T_UNIQUE404, NULL, COL_CYAN},    {T_BW, NULL, COL_CYAN},    {T_GEN_TIME, NULL, COL_CYAN},    {T_EXCLUDE_IP, NULL, COL_CYAN},    {T_STATIC_FIL, NULL, COL_CYAN},    {T_LOG_PATH, NULL, COL_YELLOW}  };  werase (win);  draw_header (win, T_HEAD, " %s", 0, 0, getmaxx (stdscr), 1, 0);  if (!logger->piping && ifile != NULL) {    size = filesize_str (file_size (ifile));    log_file = alloc_string (ifile);  } else {    size = alloc_string ("N/A");    log_file = alloc_string ("STDIN");  }  bw = filesize_str ((float) logger->resp_size);  /* *INDENT-OFF* */  failed       = int_to_str (logger->invalid);  not_found    = int_to_str (get_ht_size (ht_not_found_requests));  process      = int_to_str (logger->process);  ref          = int_to_str (get_ht_size (ht_referrers));  req          = int_to_str (get_ht_size(ht_requests));  static_files = int_to_str (get_ht_size(ht_requests_static));  now          = int_to_str (((long long) end_proc - start_proc));  visitors     = int_to_str (get_ht_size(ht_unique_visitors));  exclude_ip    = int_to_str (logger->exclude_ip);  fields[0].value = process;  fields[1].value = visitors;  fields[2].value = ref;  fields[3].value = size;  fields[4].value = failed;  fields[5].value = req;  fields[6].value = not_found;  fields[7].value = bw;  fields[8].value = now;  fields[9].value = exclude_ip;  fields[10].value = static_files;  fields[11].value = log_file;  n = ARRAY_SIZE (fields);  /* *INDENT-ON* */  for (i = 0, y = 2; i < n; i++) {    mod_val = i % 4;    if (i > 0 && mod_val == 0) {      max_field = 0;      max_value = 0;      x_field = 2;      x_value = 2;      y++;    }    x_field += max_field;    mvwprintw (win, y, x_field, "%s", fields[i].field);    max_field = 0;    for (j = 0; j < n; j++) {      size_t len = strlen (fields[j].field);      if (j % 4 == mod_val && len > max_field)        max_field = len;    }    max_value = 0;    for (j = 0; j < n; j++) {      size_t len = strlen (fields[j].value);      if (j % 4 == mod_val && len > max_value)        max_value = len;    }    x_value = max_field + x_field + 1;    max_field += max_value + 2;    wattron (win, A_BOLD | COLOR_PAIR (fields[i].color));    mvwprintw (win, y, x_value, "%s", fields[i].value);    wattroff (win, A_BOLD | COLOR_PAIR (fields[i].color));  }  for (i = 0; i < n; i++) {    free (fields[i].value);  }}
开发者ID:nwaldispuehl,项目名称:goaccess,代码行数:101,


示例21: while

static list_part_t *ask_structure_ncurses(disk_t *disk_car,list_part_t *list_part, const int verbose, char **current_cmd){  int offset=0;  int pos_num=0;  list_part_t *pos=list_part;  int rewrite=1;  int old_LINES=LINES;  while(1)  {    int i;    int command;    list_part_t *parts;    int structure_status;    if(old_LINES!=LINES)    {      rewrite=1;      old_LINES=LINES;    }    if(rewrite)    {      aff_copy(stdscr);      wmove(stdscr,4,0);      wprintw(stdscr,"%s",disk_car->description(disk_car));      mvwaddstr(stdscr,5,0,msg_PART_HEADER);      rewrite=0;    }    structure_status=disk_car->arch->test_structure(list_part);    for(i=0,parts=list_part;	parts!=NULL && i<offset+INTER_STRUCTURE;	i++, parts=parts->next)    {      if(i<offset)	continue;      wmove(stdscr,6+i-offset,0);      wclrtoeol(stdscr);	/* before addstr for BSD compatibility */      if(parts==pos)	wattrset(stdscr, A_REVERSE);      if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(2));      if(parts==pos)	waddstr(stdscr, ">");      else	waddstr(stdscr, " ");      aff_part(stdscr, AFF_PART_STATUS, disk_car, parts->part);      if(structure_status==0 && parts->part->status!=STATUS_DELETED && has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      if(parts==pos)      {	char buffer_part_size[100];	wattroff(stdscr, A_REVERSE);	wmove(stdscr,LINES-1,0);	wclrtoeol(stdscr);	/* before addstr for BSD compatibility */	if(parts->part->info[0]!='/0')	{	  wprintw(stdscr,"%s, ",parts->part->info);	}	size_to_unit(parts->part->part_size, buffer_part_size);	wprintw(stdscr,"%s", buffer_part_size);      }    }    if(structure_status==0)    {      if(list_part!=NULL)	mvwaddstr(stdscr,LINES-6,0,msg_STRUCT_OK);    }    else    {      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(1));      mvwaddstr(stdscr,LINES-6,0,msg_STRUCT_BAD);      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));    }    if(list_part!=NULL && disk_car->arch->msg_part_type!=NULL)    {      mvwaddstr(stdscr,LINES-6,16,"Use ");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Up");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr,"/");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Down");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr," Arrow keys to select partition.");      mvwaddstr(stdscr,LINES-5,0,"Use ");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Left");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));      waddstr(stdscr,"/");      if(has_colors())	wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(0));      waddstr(stdscr,"Right");      if(has_colors())	wbkgdset(stdscr,' ' | COLOR_PAIR(0));//.........这里部分代码省略.........
开发者ID:dennyfeng,项目名称:testdisk,代码行数:101,


示例22: line_info_print

void line_info_print(ToxWindow *self){    ChatContext *ctx = self->chatwin;    if (ctx == NULL)        return;    struct history *hst = ctx->hst;    /* Only allow one new item to be added to chat window per call to this function */    line_info_check_queue(self);    WINDOW *win = ctx->history;    wclear(win);    int y2, x2;    getmaxyx(self->window, y2, x2);    if (x2 <= SIDEBAR_WIDTH)        return;    if (self->is_groupchat)        wmove(win, 0, 0);    else        wmove(win, 2, 0);    struct line_info *line = hst->line_start->next;    int numlines = 0;    while (line && numlines++ <= y2) {        uint8_t type = line->type;        switch (type) {            case OUT_MSG:            case IN_MSG:                wattron(win, COLOR_PAIR(BLUE));                wprintw(win, "%s", line->timestamp);                wattroff(win, COLOR_PAIR(BLUE));                int nameclr = GREEN;                if (line->colour)                    nameclr = line->colour;                else if (type == IN_MSG)                    nameclr = CYAN;                wattron(win, COLOR_PAIR(nameclr));                wprintw(win, "%s: ", line->name1);                wattroff(win, COLOR_PAIR(nameclr));                if (line->msg[0] == '>')                    wattron(win, COLOR_PAIR(GREEN));                wprintw(win, "%s/n", line->msg);                if (line->msg[0] == '>')                    wattroff(win, COLOR_PAIR(GREEN));                break;            case ACTION:                wattron(win, COLOR_PAIR(BLUE));                wprintw(win, "%s", line->timestamp);                wattroff(win, COLOR_PAIR(BLUE));                wattron(win, COLOR_PAIR(YELLOW));                wprintw(win, "* %s %s/n", line->name1, line->msg);                wattroff(win, COLOR_PAIR(YELLOW));                break;            case SYS_MSG:                if (line->timestamp[0]) {                    wattron(win, COLOR_PAIR(BLUE));                    wprintw(win, "%s", line->timestamp);                    wattroff(win, COLOR_PAIR(BLUE));                }                if (line->bold)                    wattron(win, A_BOLD);                if (line->colour)                    wattron(win, COLOR_PAIR(line->colour));                wprintw(win, "%s/n", line->msg);                if (line->bold)                    wattroff(win, A_BOLD);                if (line->colour)                    wattroff(win, COLOR_PAIR(line->colour));                break;            case PROMPT:                wattron(win, COLOR_PAIR(GREEN));                wprintw(win, "$ ");                wattroff(win, COLOR_PAIR(GREEN));                if (line->msg[0])                    wprintw(win, "%s", line->msg);//.........这里部分代码省略.........
开发者ID:fars,项目名称:toxic,代码行数:101,


示例23: testdisk_disk_selection_ncurses

static int testdisk_disk_selection_ncurses(int verbose,int dump_ind, const list_disk_t *list_disk, const int saveheader, char **current_cmd){  int command='Q';  unsigned int menu=0;  int offset=0;  int pos_num=0;  int use_sudo=0;  const list_disk_t *element_disk;  const list_disk_t *current_disk;  static struct MenuItem menuMain[]=  {    { 'P', "Previous", ""},    { 'N', "Next", "" },    { 'O', "Proceed", ""},    { 'S', "Sudo", "Use the sudo command to restart as root"},    { 'Q', "Quit", "Quit program"},    {  0,  NULL, NULL}  };  if(list_disk==NULL)  {    log_critical("No disk found/n");    return intrf_no_disk_ncurses("TestDisk");  }  current_disk=list_disk;  /* ncurses interface */  while(1)  {    const char *options;    int i;#ifdef HAVE_NCURSES    aff_copy(stdscr);    wmove(stdscr,4,0);    wprintw(stdscr,"  TestDisk is free software, and");    wmove(stdscr,5,0);    wprintw(stdscr,"comes with ABSOLUTELY NO WARRANTY.");    wmove(stdscr,7,0);    wprintw(stdscr,"Select a media (use Arrow keys, then press Enter):");#endif    for(i=0,element_disk=list_disk;	element_disk!=NULL && i<offset+NBR_DISK_MAX;	i++, element_disk=element_disk->next)    {      if(i<offset)	continue;      wmove(stdscr,8+i-offset,0);      if(element_disk!=current_disk)	wprintw(stdscr," %s/n",element_disk->disk->description_short(element_disk->disk));      else      {	wattrset(stdscr, A_REVERSE);	wprintw(stdscr,">%s/n",element_disk->disk->description_short(element_disk->disk));	wattroff(stdscr, A_REVERSE);      }    }    {      int line=INTER_NOTE_Y;      mvwaddstr(stdscr,line++,0,"Note: ");#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)#else#ifdef HAVE_GETEUID      if(geteuid()!=0)      {        if(has_colors())          wbkgdset(stdscr,' ' | A_BOLD | COLOR_PAIR(1));        waddstr(stdscr,"Some disks won't appear unless you are root user.");        if(has_colors())          wbkgdset(stdscr,' ' | COLOR_PAIR(0));        wmove(stdscr,line++,0);#ifdef SUDO_BIN	use_sudo=1;#endif      }#endif#endif      waddstr(stdscr,"Disk capacity must be correctly detected for a successful recovery.");      wmove(stdscr,line++,0);      wprintw(stdscr,"If a disk listed above has incorrect size, check HD jumper settings, BIOS");      wmove(stdscr,line,0);      wprintw(stdscr,"detection, and install the latest OS patches and disk drivers.");     }    if(use_sudo > 0)    {      if(i<=NBR_DISK_MAX && element_disk==NULL)	options="OSQ";      else	options="PNOSQ";    }    else    {      if(i<=NBR_DISK_MAX && element_disk==NULL)	options="OQ";      else	options="PNOQ";    }    command = wmenuSelect_ext(stdscr, INTER_NOTE_Y-1, INTER_DISK_Y, INTER_DISK_X, menuMain, 8,	options, MENU_HORIZ | MENU_BUTTON | MENU_ACCEPT_OTHERS, &menu,NULL);    switch(command)    {      case 'p':      case 'P'://.........这里部分代码省略.........
开发者ID:Tom9X,项目名称:TestDisk,代码行数:101,


示例24: newGame

void newGame() {    int i;    int key;    int accepted;    player.x = 2;    player.y = 2;    player.level = 1;    player.race = 0;    player.is_dead = FALSE;    player.avatar = "@";    player.slain = 0;    player.xp = 0;    player.xp_earned = 0;    player.attack_bonus = 1;    player.armor = 5;    wclear(win);    if (has_colors()) {		init_pair(2, COLOR_WHITE, COLOR_BLUE);		wbkgd(win, COLOR_PAIR(2) | A_BOLD);	} else        wbkgd(win, A_BOLD);    wclear(win);	box(win, ACS_VLINE, ACS_HLINE);	refresh();    echo();	mvwaddstr(win, 2, 2, "Character Name (8 letter max): ");	wgetnstr(win, player.player_name, 8);    wrefresh(win);    noecho();    mvwaddstr(win,3,2,"Race: ");    for (i = 0; i < MAX_RACES; i++) {        mvwprintw(win,4+i,4,"[%i] - %s",i+1,races[i].race_name);    }    player.race = wgetch(win);    while (player.race < 49 || player.race > 51) {        player.race = wgetch(win);    }    /*        Convert the ASCII character number to an index        by shifting down 49 (makes 1 = 0, 2 = 1, etc.)    */    player.race -= 49;    // Set up basic player data    player.hp = (int)(races[player.race].start_hp + (player.level / 2));    // Do the stat rolls now.  If the player doesn't like the    // rolls with modifiers applied, they can do them over again    accepted = 0;    while (accepted == 0) {        player.str = statRoll(races[player.race].max_str);        player.def = statRoll(races[player.race].max_def);        player.agi = statRoll(races[player.race].max_agi);        wclear(win);        box(win, ACS_VLINE, ACS_HLINE);        mvwprintw(win,2,2,"%s - %s", player.player_name,races[player.race].race_name);        mvwprintw(win,4,15,"STR: %i",player.str);        mvwprintw(win,5,15,"DEF: %i",player.def);        mvwprintw(win,6,15,"AGI: %i",player.agi);        wattrset(win,A_REVERSE);        mvwprintw(win,10,15,"Enter/Space: Roll Again/tA - Accept Character");        wattroff(win,A_REVERSE);        flushinp();        wrefresh(win);        noecho();        keypad(win, TRUE);        raw();        key = wgetch(win);        switch(key) {            case 10:            case 13:            case ' ':            case KEY_ENTER:                accepted = 0;                break;            case 'a':            case 'A':                accepted = 1;                break;        }    }    clearPlay();    mvwprintw(win,4,15,"Generating Dungeon...");    wrefresh(win);    buildMap();//.........这里部分代码省略.........
开发者ID:Bencepapa,项目名称:CymonsGames,代码行数:101,


示例25: print_menu

void print_menu(WINDOW *menu_win, int highlight, int nphighlight){	int x, y, i=0,z=0,start;	char name[200];	x = 0;	y = 2;	for(i=0;i<n_choices;i++)	{			start_color();		init_pair(1,COLOR_CYAN, COLOR_BLACK);		for (z=0;z<strlen(choices[i]);z++)		{			if (choices[i][z]=='/')				start =z+1;		}		for(z=0;z<200;z++)		{			while(choices[i][z]!='/0')			{				name[z]=choices[i][start++];				z++;			}			name[z]='/0';		}		if(i == curr_song)  /* High light the present choice */		{				if(highlight != i+1)			{				wattron(menu_win, A_BOLD | COLOR_PAIR(1));				mvwprintw(menu_win, y, 0, "> %s",name);				wattroff(menu_win, A_BOLD | COLOR_PAIR(1));			}			else			{				wattron(menu_win, A_BOLD | A_REVERSE | COLOR_PAIR(1));				mvwprintw(menu_win, y, 0, "> %s",name);				wattroff(menu_win, A_BOLD | A_REVERSE | COLOR_PAIR(1));			}		}		else if (highlight == i+1)		{			wattron(menu_win, A_REVERSE);			mvwprintw(menu_win, y, 0, "  %s", name);			wattroff(menu_win, A_REVERSE);		}		else				mvwprintw(menu_win, y, 0, "  %s", name);		++y;	}	y+=6;	for(i = 0; i < npn_choices; ++i)	{			if (i>0)		{			x += strlen(npchoices[i-1])+2;		}		if(nphighlight == i + 1) /* High light the present choice */		{				wattron(menu_win, A_REVERSE);			mvwprintw(menu_win,y,x, "%s", npchoices[i]);			wattroff(menu_win, A_REVERSE);		}		else			mvwprintw(menu_win,y,x, "%s", npchoices[i]);}wrefresh(menu_win);}
开发者ID:guptaayush3210,项目名称:Music_Player,代码行数:70,


示例26: filedlg_display

int filedlg_display(struct filedlg *fd){    char fmt[5];    int width, height;    int lwidth;    int file;    int i;    int attr;    static char *label = "Select a file or press q to cancel.";    curs_set(0);    /* Check that a file is loaded */    if (fd == NULL || fd->buf == NULL || fd->buf->files == NULL) {        wrefresh(fd->win);        return 0;    }    /* Initialize variables */    getmaxyx(fd->win, height, width);    /* The status bar and display line      * Fake the display function to think the height is 2 lines less */    height -= 2;    /* Set starting line number (center source file if it's small enough) */    if (fd->buf->length < height)        file = (fd->buf->length - height) / 2;    else {        file = fd->buf->sel_line - height / 2;        if (file > fd->buf->length - height)            file = fd->buf->length - height;        else if (file < 0)            file = 0;    }    /* Print 'height' lines of the file, starting at 'file' */    lwidth = (int) log10(fd->buf->length) + 1;    sprintf(fmt, "%%%dd", lwidth);    print_in_middle(fd->win, 0, width, label);    wmove(fd->win, 0, 0);    for (i = 1; i < height + 1; i++, file++) {        wmove(fd->win, i, 0);        if (has_colors()) {            /* Outside of filename, just finish drawing the vertical file */            if (file < 0 || file >= fd->buf->length) {                int j;                for (j = 1; j < lwidth; j++)                    waddch(fd->win, ' ');                waddch(fd->win, '~');                wattron(fd->win, A_BOLD);                waddch(fd->win, VERT_LINE);                wattroff(fd->win, A_BOLD);                for (j = 2 + lwidth; j < width; j++)                    waddch(fd->win, ' ');            }            /* Mark the current file with an arrow */            else if (file == fd->buf->sel_line) {                wattron(fd->win, A_BOLD);                wprintw(fd->win, fmt, file + 1);                wattroff(fd->win, A_BOLD);                if (hl_groups_get_attr(hl_groups_instance, HLG_ARROW,                                &attr) == -1)                    return -1;                wattron(fd->win, attr);                waddch(fd->win, '-');                waddch(fd->win, '>');                wattroff(fd->win, attr);                if (fd->buf->cur_line != NULL)                    hl_wprintw(fd->win, fd->buf->cur_line, width - lwidth - 2,                            fd->buf->sel_col);                else                    hl_wprintw(fd->win, fd->buf->files[file],                            width - lwidth - 2, fd->buf->sel_col);            }            /* Ordinary file */            else {                wprintw(fd->win, fmt, file + 1);                wattron(fd->win, A_BOLD);                waddch(fd->win, VERT_LINE);                wattroff(fd->win, A_BOLD);                waddch(fd->win, ' ');                /* No special file information */                if (file == fd->buf->sel_line && fd->buf->cur_line != NULL)                    hl_wprintw(fd->win, fd->buf->cur_line, width - lwidth - 2,                            fd->buf->sel_col);                else                    hl_wprintw(fd->win, fd->buf->files[file],                            width - lwidth - 2, fd->buf->sel_col);            }        } else {            wprintw(fd->win, "%s/n", fd->buf->files[file]);        }    }    /* Add the 2 lines back in so the status bar can be drawn *///.........这里部分代码省略.........
开发者ID:ArnaudValensi,项目名称:cgdb,代码行数:101,


示例27: call_raw_print_msg

intcall_raw_print_msg(PANEL *panel, sip_msg_t *msg){    call_raw_info_t *info;    int payload_lines, i, column, height, width;    // Message ngrep style Header    char header[256];    char payload[2048];    int color = 0;    // Get panel information    if (!(info = call_raw_info(panel)))        return -1;    // Get the pad window    WINDOW *pad = info->pad;    // Get current pad dimensions    getmaxyx(pad, height, width);    // Get message payload    strcpy(payload, msg_get_payload(msg));    // Check how many lines we well need to draw this message    payload_lines = 0;    column = 0;    for (i = 0; i < strlen(payload); i++) {        if (column == width || payload[i] == '/n') {            payload_lines++;            column = 0;            continue;        }        column++;    }    // Check if we have enough space in our huge pad to store this message    if (info->padline + payload_lines > height) {        // Create a new pad with more lines!        pad = newpad(height + 500, COLS);        // And copy all previous information        overwrite(info->pad, pad);        // Delete previous pad        delwin(info->pad);        // And store the new pad        info->pad = pad;    }    // Color the message {    if (setting_has_value(SETTING_COLORMODE, "request")) {        // Determine arrow color        if (msg_is_request(msg)) {            color = CP_RED_ON_DEF;        } else {            color = CP_GREEN_ON_DEF;        }    } else if (info->group && setting_has_value(SETTING_COLORMODE, "callid")) {        // Color by call-id        color = call_group_color(info->group, msg->call);    } else if (setting_has_value(SETTING_COLORMODE, "cseq")) {        // Color by CSeq within the same call        color = msg->cseq % 7 + 1;    }    // Turn on the message color    wattron(pad, COLOR_PAIR(color));    // Print msg header    wattron(pad, A_BOLD);    mvwprintw(pad, info->padline++, 0, "%s", sip_get_msg_header(msg, header));    wattroff(pad, A_BOLD);    // Print msg payload    info->padline += draw_message_pos(pad, msg, info->padline);    // Extra line between messages    info->padline++;    // Set this as the last printed message    info->last = msg;    return 0;}
开发者ID:jungle-boogie,项目名称:sngrep,代码行数:81,


示例28: selectc

int selectc(){	int c, r;	int ret;	char h, l;	unsigned int k_ch;		c = (curchar / 16);	r = (curchar % 16);	for(;;)	{		dis_cmd("   Select Character");				sel_mode();		curchar = r + (c*16);		display(curchar);		h = ((mvwinch(set_win,(r+1),((c*2)+1))) & A_CHARTEXT);		l = ((mvwinch(set_win,(r+1),((c*2)+2))) & A_CHARTEXT);		wattron(set_win,A_REVERSE);		mvwprintw(set_win,(r+1),((c*2)+1),"%c%c",h,l);		wattroff(set_win,A_REVERSE);				wmove(set_win,(r+1),((c*2)+1));		wrefresh(set_win);				k_ch = wgetch(set_win);				switch(k_ch)		{			case K_LEFT:			case KEY_LEFT:				if(c > 0)				{					normal_set(r,c);					c--;				}				break;			case K_DOWN:			case KEY_DOWN:				if(r < 15)				{					normal_set(r,c);					r++;				}				break;			case K_UP:			case KEY_UP:				if(r > 0)				{					normal_set(r,c);					r--;				}				break;			case K_RIGHT:			case KEY_RIGHT:				if(c < 15)				{					normal_set(r,c);					c++;				}				break;			case 'e':			case 'E':							edit_mode();				dis_cmd("   Edit Character");				display(curchar);				ret = edit();				if(ret == 1)					save_ch();				break;			case 'g':			case 'G':				dis_cmd("   Exchange: select Destination, then press RETURN or any other Key to ABORT");				sr = r;				sc = c;				scurchar = curchar;				if((curchar = sel_dest()) == -1)				{ /* failsafe */					r = sr;					c = sc;					curchar = scurchar;				}				else				{ /* valid return */					normal_set(r,c);					c = (curchar / 16);					r = (curchar % 16);					xchg_ch(scurchar,curchar);				}				break;			case 'm'://.........这里部分代码省略.........
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:101,


示例29: pfind_sectors_per_cluster

static int pfind_sectors_per_cluster(disk_t *disk, partition_t *partition, const int verbose, unsigned int *sectors_per_cluster, uint64_t *offset_org, alloc_data_t *list_search_space){  uint64_t offset=0;  unsigned int nbr_subdir=0;  sector_cluster_t sector_cluster[10];  alloc_data_t *current_search_space;  unsigned char *buffer_start=(unsigned char *)MALLOC(READ_SIZE);  unsigned char *buffer=buffer_start;  current_search_space=td_list_entry(list_search_space->list.next, alloc_data_t, list);  if(current_search_space!=list_search_space)    offset=current_search_space->start;  if(verbose>0)    info_list_search_space(list_search_space, current_search_space, disk->sector_size, 0, verbose);#ifdef HAVE_NCURSES  wmove(stdscr,22,0);  wattrset(stdscr, A_REVERSE);  waddstr(stdscr,"  Stop  ");  wattroff(stdscr, A_REVERSE);#endif  disk->pread(disk, buffer_start, READ_SIZE, offset);  while(current_search_space!=list_search_space && nbr_subdir<10)  {    const uint64_t old_offset=offset;#ifdef HAVE_NCURSES    if((offset&(1024*disk->sector_size-1))==0)    {      wmove(stdscr,9,0);      wclrtoeol(stdscr);      wprintw(stdscr,"Search subdirectory %10lu/%lu %u",(unsigned long)(offset/disk->sector_size),(unsigned long)(partition->part_size/disk->sector_size),nbr_subdir);      wrefresh(stdscr);    }#endif    if(memcmp(buffer,         ".          ", 8+3)==0 &&	memcmp(&buffer[0x20], "..         ", 8+3)==0)    {      const unsigned long int cluster=(buffer[0*0x20+0x15]<<24) + (buffer[0*0x20+0x14]<<16) +	(buffer[0*0x20+0x1B]<<8) + buffer[0*0x20+0x1A];      log_info("sector %lu, cluster %lu/n",	  (unsigned long)(offset/disk->sector_size), cluster);      sector_cluster[nbr_subdir].cluster=cluster;      sector_cluster[nbr_subdir].sector=offset/disk->sector_size;      log_flush();      nbr_subdir++;    }    get_next_sector(list_search_space, &current_search_space, &offset, 512);    buffer+=512;    if( old_offset+512!=offset ||        buffer+512>buffer_start+READ_SIZE)    {      buffer=buffer_start;      if(verbose>1)      {        log_verbose("Reading sector %10llu/%llu/n",	    (unsigned long long)((offset-partition->part_offset)/disk->sector_size),	    (unsigned long long)((partition->part_size-1)/disk->sector_size));      }      if(disk->pread(disk, buffer_start, READ_SIZE, offset) != READ_SIZE)      {      }    }  } /* end while(current_search_space!=list_search_space) */  free(buffer_start);  return find_sectors_per_cluster_aux(sector_cluster,nbr_subdir,sectors_per_cluster,offset_org,verbose,partition->part_size/disk->sector_size, UP_UNK);}
开发者ID:foreverlikeyou9999,项目名称:TestDisk,代码行数:64,



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


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