static void crsr_on(struct wdgt *w, int line) { DBG("ENABLING in %s on line %d", w->name, line); mvwinchnstr(CWND(w), line, 0, curs_buf, w->xsize+1); mvwchgat(CWND(w), line, 0, w->xsize+1, A_REVERSE, 0, 0); wattrset(CWND(w), A_NORMAL); }
int mvinchnstr(int y, int x, chtype *chstr, int n) { return mvwinchnstr(stdscr, y, x, chstr, n); }
// Muestra contenido de todas las celdas void show_content(WINDOW * win, int mxrow, int mxcol) { register struct ent ** p; int row, col; int q_row_hidden = 0; for (row = offscr_sc_rows; row < mxrow; row++) { if (row_hidden[row]) { q_row_hidden++; continue; } register int c = rescol; int nextcol; int fieldlen; col = offscr_sc_cols; for (p = ATBL(tbl, row, offscr_sc_cols); col <= mxcol; p += nextcol - col, col = nextcol, c += fieldlen) { nextcol = col + 1; fieldlen = fwidth[col]; if (col_hidden[col]) { c -= fieldlen; continue; } if ( (*p) == NULL) *p = lookat(row, col); // Clean format #ifdef USECOLORS if ((*p)->expr) { set_ucolor(win, &ucolors[EXPRESSION]); } else if ((*p)->label) { // string set_ucolor(win, &ucolors[STRG]); } else if ((*p)->flags & is_valid && ! (*p)->format) { // numeric value set_ucolor(win, &ucolors[NUMB]); } else if ((*p)->cellerror) { // cellerror set_ucolor(win, &ucolors[CELL_ERROR]); } else if ((*p)->format && (*p)->format[0] == 'd') { // date format set_ucolor(win, &ucolors[DATEF]); } else { set_ucolor(win, &ucolors[NORMAL]); } #endif // Cell color! if ((*p)->ucolor != NULL) { set_ucolor(win, (*p)->ucolor); } // Color selected cell if ((currow == row) && (curcol == col)) { #ifdef USECOLORS if (has_colors()) set_ucolor(win, &ucolors[CELL_SELECTION_SC]); #else wattron(win, A_REVERSE); #endif } // Color selected range int in_range = 0; // this is for coloring empty cells within a range srange * s = get_selected_range(); if (s != NULL && row >= s->tlrow && row <= s->brrow && col >= s->tlcol && col <= s->brcol ) { #ifdef USECOLORS set_ucolor(win, &ucolors[CELL_SELECTION_SC]); #else wattron(win, A_REVERSE); #endif in_range = 1; // local variable. this is for coloring empty cells within a range } /* Color empty cells inside a range */ if ( in_range && row >= ranges->tlrow && row <= ranges->brrow && col >= ranges->tlcol && col <= ranges->brcol ) { #ifdef USECOLORS set_ucolor(win, &ucolors[CELL_SELECTION_SC]); #else wattron(win, A_REVERSE); #endif } if ((*p)->cellerror == CELLERROR) { (void) mvprintw(row + RESROW + 1 - offscr_sc_rows, c, "%*.*s", fwidth[col], fwidth[col], "ERROR"); continue; } // si hay valor numerico if ( (*p)->flags & is_valid) { show_numeric_content_of_cell(win, p, col, row + 1 - offscr_sc_rows - q_row_hidden, c); // si hay solo valor de texto } else if ((*p) -> label) { show_text_content_of_cell(win, p, row, col, row + 1 - offscr_sc_rows - q_row_hidden, c); // repaint a blank cell, because of in range, or because we have a coloured empty cell! } else if (! ((*p)->flags & is_valid) && !(*p)->label ) { if ( (currow == row && curcol == col) || ( in_range && row >= ranges->tlrow && row <= ranges->brrow && col >= ranges->tlcol && col <= ranges->brcol ) ) { #ifdef USECOLORS if (has_colors()) set_ucolor(win, &ucolors[CELL_SELECTION_SC]); #else wattron(win, A_REVERSE); #endif } else if ((*p)->ucolor == NULL) { #ifdef USECOLORS set_ucolor(win, &ucolors[STRG]); // When a long string does not fit in column. #endif } char caracter; chtype cht[fieldlen]; int i; mvwinchnstr(win, row + 1 - offscr_sc_rows - q_row_hidden, c, cht, fieldlen); for (i = 0; i < fieldlen; i++) { caracter = cht[i] & A_CHARTEXT; #ifdef NETBSD if (! caracter) { caracter = ' '; // this is for NetBSD compatibility } #endif mvwprintw(win, row + 1 - offscr_sc_rows - q_row_hidden, c + i, "%c", caracter); } } // clean format #ifndef USECOLORS wattroff(win, A_REVERSE); #endif } } }
int mvinchnstr(int y, int x, chtype *s, int n) { return (mvwinchnstr(stdscr, y, x, s, n)); }