void NSLog(string sFormatString) { canLog = false; if (!logHasBeenInitiated) {//if log not init for (int i=0;i<15;i++){//init log #if fillWithNumbers//debug screenText[i] = ""; #else screenText[i] = ""+i; #endif } logHasBeenInitiated=true;//set log to initiated } if (isShowingLog) {//if showing log eraseDisplay();//clear display drawLog();//draw the log } string screenTextTemp[15];//make string array for temp for (int i=0;i<15;i++) {//put text in it screenTextTemp[i] = screenText[i]; } string text;//make text string StringFormat(text, sFormatString);//format it screenText[0] = text;//set it to first index for (int i=0;i<14;i++) {//restore temp array to main array screenText[i+1] = screenTextTemp[i]; } if (isShowingLog) {//if the log is showing top = 7;//reset to normal height drawLog();//draw the log } canLog = true; }
void Display::updateScreen() { clearScreen(); drawHeader(); drawWorkOrders(); drawLog(); }
//*************************************************************************** void Kwave::ScaleWidget::paintEvent(QPaintEvent *) { bool inverse = false; int h = height(); int w = width(); QPainter p; p.begin(this); p.save(); p.setPen(palette().light().color()); p.drawLine(0, 0, w, 0); if (h > w) { p.setWindow(-w, 0, w, h); p.rotate(-90); h = width(); w = height(); inverse = true; } (m_logmode) ? drawLog(p, w, h, inverse) : drawLinear(p, w, h, inverse); p.restore(); p.end(); }
void shNCursesInterface::pageLog () { if (Flags.mFadeLog) { int x, y; getyx (mWin[kLog], y, x); wattrset (mWin[kLog], ColorMap[kBlue]); for (int i = 0; i < mLogRow; i++) { int offs = (HISTORY_ROWS + mHistoryIdx - (mLogRow-i)) % HISTORY_ROWS; mvwaddstr (mWin[kLog], i, 0, &mLogHistory[offs*80]); } wattrset (mWin[kLog], A_NORMAL); wmove (mWin[kLog], y, x); mLogSCount = 0; } else { werase (mWin[kLog]); wmove (mWin[kLog], 0, 0); mLogRow = 0; mLogSCount = 0; } drawLog (); }
void shNCursesInterface::drawScreen () { Level->draw (); drawSideWin (); wnoutrefresh (mWin[kMain]); drawLog (); /* calls doupdate() for us */ }
void show_log(){ //set to draw log on update isShowingLog=true; //clear the display eraseDisplay(); //set log to show mose recent entry top = 7; drawLog(); }
//SCROLLING void scroll_down(){ //If there is atleast one log line at the top so we don't scroll all text off the screen if(top<14){ //scroll down //Technically top line is higher index top++; } drawLog(); }
void scroll_up(){ //if we have an entry associated with the top line on the screen //technically if the top is associated with an index of more than 7 so that we can associate it with line 7 or lower if(top>7){ //scroll up //Technically top line is lower index so a more recent log item is at top of screen top--; } drawLog(); }
int shNCursesInterface::getStr (char *buf, int len, const char *prompt, const char *dflt /* = NULL */ ) /* Default suggestion. */ { /* can't use wgetnstr b/c it won't pass us ^C */ char msg[80]; int pos = 0; int savehistidx = mHistoryIdx; snprintf (msg, 80, "%s ", prompt); msg[79] = 0; p (msg); buf[0] = 0; if (dflt) { strncpy (buf, dflt, len); buf[len-1] = 0; waddstr (mWin[kLog], buf); pos = strlen (buf); } while (1) { drawLog (); int c = getChar (); if (isprint (c)) { if (pos >= len - 1) { continue; } buf[pos++] = c; waddch (mWin[kLog], c); } else if ('\n' == c or '\r' == c) { break; } else if (KEY_BACKSPACE == c and pos) { pos--; /* Warning: Do not compress those three addch calls into one addstr ("\x8 \x8") call. NCurses on Unix handles this well but PDCurses on Windows just chokes. */ waddch (mWin[kLog], '\x8'); waddch (mWin[kLog], ' '); waddch (mWin[kLog], '\x8'); } else if (27 == c) { /* Escape. */ pos = 0; break; }/* else { debug.log ("getstr: unhandled char %d", c); }*/ } buf[pos] = 0; snprintf (msg, 80, "%s %s", prompt, buf); msg[79] = 0; strcpy (&mLogHistory[savehistidx*80], msg); return pos; }
void shNCursesInterface::refreshScreen () { wnoutrefresh (mWin[kMain]); drawLog (); }