/* * JUNK.C * */ #include #include #include #include "junk.h" #include "load.h" #include "rerror.h" #include "id.h" /****************************************************************************/ void BLKTabbedOut(HDC hdc, int x, int y, RECT *lprc, LPCSTR lp, int n, int rt); /****************************************************************************/ void PaintBlank(HDC hdc, PAINTSTRUCT *ps) { RECT lrc,rrc; // Do the big background rectangle. lrc.left = 0; lrc.right = all.cxClient; lrc.top = 0; lrc.bottom = all.cyClient; SetBkColor(hdc, all.Col[ALL_BACK]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &lrc, 0, 0, 0); //Draw those cute lines in the center. rrc.left = all.cxBar - 2; rrc.right = rrc.left + 1; rrc.top = 0; rrc.bottom = all.cyClient; SetBkColor(hdc, all.Col[ALL_BARHL]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); if (all.Col[ALL_BACK] != all.Col[ALL_BARFC]) { rrc.left = all.cxBar - 1; rrc.right = all.cxBar + 2; SetBkColor(hdc, all.Col[ALL_BARFC]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } rrc.left = all.cxBar + 2; rrc.right = rrc.left + 1; SetBkColor(hdc, all.Col[ALL_BARSH]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } /****************************************************************************/ void PaintEverything(HDC hdc, PAINTSTRUCT *ps) { LINELISTSTRUCT _huge* hp; int i; int nFirstPaintLine, nLastPaintLine; RECT lrc, rrc; WORD cxOurBar; WORD flags; if (all.lpFileData[all.iFile].bits & FD_SINGLE) cxOurBar = all.cxClient; else cxOurBar = all.cxBar; hp = (LINELISTSTRUCT _huge*) all.lpFileData[all.iFile].hpLines; // Do the big background rectangle. lrc.left = 0; lrc.right = all.cxClient; lrc.top = 0; lrc.bottom = all.cyClient; SetBkColor(hdc, all.Col[ALL_BACK]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &lrc, 0, 0, 0); // Set up rects and do columns side by side. lrc.left = all.tm.tmAveCharWidth; lrc.right = cxOurBar - 3 - lrc.left; rrc.left = cxOurBar + 3 + lrc.left; rrc.right = all.cxClient - lrc.left; if (rrc.right < rrc.left) rrc.right = rrc.left; if (lrc.left > lrc.right) lrc.left = lrc.right; nFirstPaintLine = max(0, ps->rcPaint.top / all.yHeight); nLastPaintLine = min(ps->rcPaint.bottom / all.yHeight, all.lpFileData[all.iFile].nTLines); for(i=nFirstPaintLine; i <= nLastPaintLine; i++) { flags = hp[all.lpFileData[all.iFile].nVScrollPos + i].flags; lrc.top = all.yBorder + i * all.yHeight; lrc.bottom = lrc.top + all.yHeight; if (flags & LLS_D) { SetBkColor(hdc, all.Col[ALL_DEL]); SetTextColor(hdc, all.Col[ALL_TEXTD]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &lrc, 0, 0, 0); } else if (flags & LLS_CL) { SetBkColor(hdc, all.Col[ALL_CHG]); SetTextColor(hdc, all.Col[ALL_TEXTC]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &lrc, 0, 0, 0); } else { SetBkColor(hdc, all.Col[ALL_BACK]); SetTextColor(hdc, all.Col[ALL_TEXT]); } // NOTE: we cannot do opaque lines when no text is specified because // we moved that down to the tabbedout routines. if (hp[all.lpFileData[all.iFile].nVScrollPos + i].lpl) { BLKTabbedOut(hdc, lrc.left, all.yBorder + i * all.yHeight, &lrc, hp[all.lpFileData[all.iFile].nVScrollPos + i].lpl, hp[all.lpFileData[all.iFile].nVScrollPos + i].nlchars, 0); } // Now do the second rectangle. if (~all.lpFileData[all.iFile].bits & FD_SINGLE) { rrc.top = all.yBorder + i * all.yHeight; rrc.bottom = rrc.top + all.yHeight; if (flags & LLS_A) { SetBkColor(hdc, all.Col[ALL_ADD]); SetTextColor(hdc, all.Col[ALL_TEXTA]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } else if (flags & LLS_CR) { SetBkColor(hdc, all.Col[ALL_CHG]); SetTextColor(hdc, all.Col[ALL_TEXTC]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } else { SetBkColor(hdc, all.Col[ALL_BACK]); SetTextColor(hdc, all.Col[ALL_TEXT]); } // NOTE: we cannot do opaque lines when no text is specified because // we moved that down to the tabbedout routines. if (hp[all.lpFileData[all.iFile].nVScrollPos + i].lpr) { BLKTabbedOut(hdc, rrc.left, all.yBorder + i * all.yHeight, &rrc, hp[all.lpFileData[all.iFile].nVScrollPos + i].lpr, hp[all.lpFileData[all.iFile].nVScrollPos + i].nrchars, 1); } } } if (~all.lpFileData[all.iFile].bits & FD_SINGLE) { // Draw those cute lines in the center. rrc.left = cxOurBar - 2; rrc.right = rrc.left + 1; rrc.top = 0; rrc.bottom = all.cyClient; SetBkColor(hdc, all.Col[ALL_BARHL]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); if (all.Col[ALL_BACK] != all.Col[ALL_BARFC]) { rrc.left = cxOurBar - 1; rrc.right = cxOurBar + 2; SetBkColor(hdc, all.Col[ALL_BARFC]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } rrc.left = cxOurBar + 2; rrc.right = rrc.left + 1; SetBkColor(hdc, all.Col[ALL_BARSH]); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rrc, 0, 0, 0); } // EXTRA: This is no longer used! // // lrc.left = all.tm.tmAveCharWidth; // lrc.right = cxOurBar - 3 - lrc.left; // for (i=0; i