/* * invert_label - highlight the label of the given menu item. */ void invert_label(int state, MENUITEM *m) { unsigned i, j; int col_offset, savettrow, savettcol; char *lp; get_cursor(&savettrow, &savettcol); /* * Leave the command name bold */ col_offset = (state || !(lp=strchr(m->label, ' '))) ? 0 : (lp - m->label); movecursor((int)m->tl.r, (int)m->tl.c + col_offset); flip_inv(state); for(i = m->tl.r; i <= m->br.r; i++) for(j = m->tl.c + col_offset; j <= m->br.c; j++) if(i == m->lbl.r && j == m->lbl.c + col_offset && m->label){ lp = m->label + col_offset; /* show label?? */ while(*lp && j++ < m->br.c) putc(*lp++, stdout); continue; } else putc(' ', stdout); if(state) flip_inv(FALSE); movecursor(savettrow, savettcol); }
void reset_attr_state(void) { /* * If we have to turn some attributes off, do that first since that * may turn off other attributes as a side effect. */ if(boldstate == FALSE && pboldstate != boldstate) flip_bold(boldstate); if(ulstate == FALSE && pulstate != ulstate) flip_ul(ulstate); if(invstate == FALSE){ if(pico_get_rev_color()){ if(rev_color_state != invstate) flip_rev_color(invstate); } else{ if(pinvstate != invstate) flip_inv(invstate); } } /* * Now turn everything on that needs turning on. */ if(boldstate == TRUE && pboldstate != boldstate) flip_bold(boldstate); if(ulstate == TRUE && pulstate != ulstate) flip_ul(ulstate); if(invstate == TRUE){ if(pico_get_rev_color()){ if(rev_color_state != invstate) flip_rev_color(invstate); } else{ if(pinvstate != invstate) flip_inv(invstate); } } if(color_blasted_by_attrs){ (void)pico_set_colorp(color_blasted_by_attrs, PSC_NONE); free_color_pair(&color_blasted_by_attrs); } }