int RestoreScreen() { if (SavedScreen) { ConPutBox(0, 0, SavedX, SavedY, SavedScreen); ConSetCursorPos(SaveCursorPosX, SaveCursorPosY); } return 1; }
void ExKey::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); MoveCh(B, ' ', 0x17, W); ConPutBox(0, H - 1, W, 1, B); }
void ExComplete::RepaintStatus() { TDrawBuffer B; int W, H; // Currently use this fixed colors - maybe there are some better defines?? #define COM_NORM 0x17 #define COM_ORIG 0x1C #define COM_HIGH 0x1E #define COM_MARK 0x2E #define COM_ERR 0x1C ConQuerySize(&W, &H); MoveCh(B, ' ', COM_NORM, W); if ((WordsLast > 0) && (WordBegin != NULL) && (Words != NULL) && ((Words[WordPos]) != NULL)) { const char *sc = STRCOMPLETE; int p = sizeof(STRCOMPLETE) - 1; if (W < 35) { // if the width is quite small sc += p - 1; // jump to last character p = 1; } MoveStr(B, 0, W, sc, COM_NORM, W); // int cur = p; MoveStr(B, p, W, WordBegin, COM_ORIG, W); p += strlen(WordBegin); int l = strlen(Words[WordPos]); if (WordFixed > 0) { MoveStr(B, p, W, Words[WordPos], COM_MARK, W); p += WordFixed; l -= WordFixed; } MoveStr(B, p, W, Words[WordPos] + WordFixed, (WordFixedCount == 1) ? COM_ORIG : COM_HIGH, W); p += l; char s[100]; sprintf(s, "] (T:%d/%d S:%d)", WordPos + 1, WordsLast, (int)WordFixedCount); MoveStr(B, p, W, s, COM_NORM, W); // ConSetCursorPos(cur + WordFixed, H - 1); } else MoveStr(B, 0, W, STRNOCOMPLETE, COM_ERR, W); ConPutBox(0, H - 1, W, 1, B); ConShowCursor(); }
void ExISearch::RepaintStatus() { TDrawBuffer B; char s[MAXISEARCH + 1]; const char *p; int W, H; ConQuerySize(&W, &H); switch (state) { case INoMatch: p = " No Match. "; break; case INoPrev: p = " No Prev Match. "; break; case INoNext: p = " No Next Match. "; break; case IOk: default: p = ""; break; } sprintf(s, "ISearch [%s]%s", ISearchStr, p); MoveCh(B, ' ', 0x17, W); MoveStr(B, 0, W, s, 0x17, W); ConPutBox(0, H - 1, W, 1, B); ConSetCursorPos(strlen(s) - 1, H - 1); ConShowCursor(); }
void ExASCII::RepaintStatus() { TDrawBuffer B; int W, H; ConQuerySize(&W, &H); if (Pos > 255) Pos = 255; if (Pos < 0) Pos = 0; if (LPos + W < Pos) LPos = Pos - W + 1; if (LPos > 255 - W) LPos = 255 - W + 1; if (LPos > Pos) LPos = Pos; if (LPos < 0) LPos = 0; for (int i = 0; i < W; i++) MoveCh(B + i, char(i + LPos), hcAsciiChars, 1); ConSetCursorPos(Pos - LPos, H - 1); ConShowCursor(); ConPutBox(0, H - 1, W, 1, B); }
int GViewPeer::DrawScrollBar() { TDrawBuffer B; int NRows, NCols, I; int W, H; char fore = ConGetDrawChar(DCH_HFORE); char back = ConGetDrawChar(DCH_HBACK); ConQuerySize(&W, &H); if (ShowVScroll) { MoveCh(B, ConGetDrawChar(DCH_AUP), hcScrollBar_Arrows, 1); ConPutBox(W, 0, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ADOWN), hcScrollBar_Arrows, 1); ConPutBox(W, H - 1, 1, 1, B); NRows = H - 2; if (sbVtotal <= NRows) { SbVBegin = 0; SbVEnd = NRows - 1; } else { SbVBegin = NRows * sbVstart / sbVtotal; SbVEnd = SbVBegin + NRows * sbVamount / sbVtotal; } for (I = 0; I < NRows; I++) { if (I >= SbVBegin && I <= SbVEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(W, I + 1, 1, 1, B); } } if (ShowHScroll) { MoveCh(B, ConGetDrawChar(DCH_ALEFT), hcScrollBar_Arrows, 1); ConPutBox(0, H, 1, 1, B); MoveCh(B, ConGetDrawChar(DCH_ARIGHT), hcScrollBar_Arrows, 1); ConPutBox(W - 1, H, 1, 1, B); NCols = W - 2; if (sbHtotal <= NCols) { SbHBegin = 0; SbHEnd = NCols - 1; } else { SbHBegin = NCols * sbHstart / sbHtotal; SbHEnd = SbHBegin + NCols * sbHamount / sbHtotal; } // could be made faster for (I = 0; I < NCols; I++) { if (I >= SbHBegin && I <= SbHEnd) MoveCh(B, fore, hcScrollBar_Fore, 1); else MoveCh(B, back, hcScrollBar_Back, 1); ConPutBox(I + 1, H, 1, 1, B); } } if (ShowVScroll && ShowHScroll) { MoveCh(B, ' ', hcScrollBar_Arrows, 1); ConPutBox(W, H, 1, 1, B); } return 0; }