/* * StatusLine - display a line in the status window */ static void StatusLine( int line, char *str, int format ) { int len, width, blanks, i, j; type_style *style; len = strlen( str ); width = WindowAuxInfo( status_window_id, WIND_INFO_TEXT_COLS ); style = &statusw_info.text_style; switch( format ) { case FMT_RIGHT: blanks = 0; if( width > len ) { blanks = width - len; } break; case FMT_CENTRE: blanks = 0; if( width > len ) { blanks = (width - len) / 2; } break; default: DisplayLineInWindow( status_window_id, line, str ); return; } i = 1; while( i <= blanks ) { SetCharInWindowWithColor( status_window_id, line, i, ' ', style ); i++; } j = 0; while( j < len && i <= width ) { SetCharInWindowWithColor( status_window_id, line, i, str[j], style ); j += 1; i += 1; } while( i <= width ) { SetCharInWindowWithColor( status_window_id, line, i, ' ', style ); i++; } } /* StatusLine */
/* * displayGenericLines - display all lines in a window */ static vi_rc displayGenericLines( file *f, linenum pagetop, int leftcol, linenum hilite, type_style *style, hilst *hilist, char **vals, int valoff ) { int i, j, k, text_lines; linenum cl = pagetop; fcb *cfcb, *tfcb; line *cline; hilst *ptr; type_style *text, *hot_key; window_info *info; type_style base; char tmp[MAX_STR]; // bool disabled; vi_rc rc; /* * get pointer to first line on page, and window info */ rc = GimmeLinePtr( pagetop, f, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } base.foreground = WindowAuxInfo( cWin, WIND_INFO_TEXT_COLOR ); base.background = WindowAuxInfo( cWin, WIND_INFO_BACKGROUND_COLOR ); base.font = WindowAuxInfo( cWin, WIND_INFO_TEXT_FONT ); text_lines = WindowAuxInfo( cWin, WIND_INFO_TEXT_LINES ); /* * mark all fcb's as being not in display */ for( tfcb = f->fcbs.head; tfcb != NULL; tfcb = tfcb->next ) { tfcb->on_display = FALSE; } cfcb->on_display = TRUE; /* * run through each line in the window */ ptr = hilist; if( ptr != NULL ) { ptr += pagetop - 1; } for( j = 1; j <= text_lines; j++ ) { if( cline != NULL ) { if( isMenu ) { if( InvokeMenuHook( CurrentMenuNumber, cl ) == -1 ) { // disabled = TRUE; if( cl == hilite ) { info = &activegreyedmenu_info; } else { info = &greyedmenu_info; } } else { // disabled = FALSE; if( cl == hilite ) { info = &activemenu_info; } else { info = &menuw_info; } } text = &info->text; hot_key = &info->hilight; } else { text = &base; if( cl == hilite ) { text = style; } hot_key = text; } /* * now, display what we can of the line on the window */ if( cline->len == 0 ) { DisplayCrossLineInWindow( cWin, j ); goto evil_goto; } else if( cline->len > leftcol ) { if( vals != NULL ) { i = cline->len - leftcol; strncpy( tmp, &(cline->data[leftcol]), EditVars.WindMaxWidth + 5 ); for( k = i; k < valoff; k++ ) { tmp[k] = ' '; } tmp[k] = 0; strcat( tmp, vals[j + pagetop - 2] ); DisplayLineInWindowWithColor( cWin, j, tmp, text, 0 ); } else { DisplayLineInWindowWithColor( cWin, j, cline->data, text, leftcol ); } } else { DisplayLineInWindowWithColor( cWin, j, SingleBlank, text, 0 ); } if( ptr != NULL ) { SetCharInWindowWithColor( cWin, j, 1 + ptr->_offs, ptr->_char, hot_key ); } evil_goto: if( ptr != NULL ) { ptr += 1; } rc = GimmeNextLinePtr( f, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { if( rc == ERR_NO_MORE_LINES ) { continue; } return( rc ); } cl++; cfcb->on_display = TRUE; } else { DisplayLineInWindow( cWin, j, "~" ); } } return( ERR_NO_ERR ); } /* displayGenericLines */