void DropGrid::Paint0(Draw &w, int lm, int rm, int x, int y, int cx, int cy, const Value &val, dword style, Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe) { real_size.Clear(); w.DrawRect(x, y, cx, cy, bg); int nx = x + lm; int ny = y + tm; int ncx = cx - lm - rm; if(IsType< Vector<String> >(val)) { const Vector<String> &v = ValueTo< Vector<String> >(val); const char * SPACE = " "; int tcx = 0; int scx = GetTextSize(SPACE, fnt).cx; int cnt = v.GetCount(); Size isz = GridImg::Dots2().GetSize(); for(int i = 0; i < cnt; i++) { bool iscol = (i + 1) & 1; if(!display_columns && iscol) continue; fnt.Bold(iscol); Size tsz = GetTextSize(v[i], fnt); DrawText(w, nx, x + lm + tcx, ny, tcx + tsz.cx > ncx - isz.cx ? ncx - tcx: tsz.cx + isz.cx, cy, GD::VCENTER, WString(v[i]), fnt, fg, bg, found, fs, fe, false); tcx += tsz.cx + scx; } } else DrawText(w, nx, nx, ny, ncx, cy, GD::VCENTER, GetStdConvertedValue(val), fnt, fg, bg, found, fs, fe, false); }
void SystemDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx) { Std(font); font.Bold(); while(n > 30000) { DrawTextOp(x, y, angle, text, font, ink, 30000, dx); if(dx) for(int i = 0; i < 30000; i++) x += *dx++; else x += GetTextSize(text, font, 30000).cx; n -= 30000; text += 30000; } GuiLock __; COLORREF cr = GetColor(ink); if(cr != lastTextColor) { LLOG("Setting text color: " << ink); ::SetTextColor(handle, lastTextColor = cr); } HGDIOBJ orgfont = ::SelectObject(handle, GetWin32Font(font, angle)); int ascent = font.Info().GetAscent(); if(angle) { double sina, cosa; Draw::SinCos(angle, sina, cosa); Size offset; ::ExtTextOutW(handle, x + fround(ascent * sina), y + fround(ascent * cosa), 0, NULL, (const WCHAR *)text, n, dx); } else ::ExtTextOutW(handle, x, y + ascent, 0, NULL, (const WCHAR *)text, n, dx); ::SelectObject(handle, orgfont); }
void WorkspaceWork::ScanWorkspace() { Workspace wspc; if(main.GetCount()) wspc.Scan(main); actualpackage.Clear(); actualfileindex = -1; filelist.Clear(); package.Clear(); Vector<String> pks; speed.Clear(); for(int i = 0; i < wspc.package.GetCount(); i++) { pks.Add(wspc.package.GetKey(i)); speed.Add(wspc.GetPackage(i).optimize_speed); } if(sort && wspc.GetCount()) { PackageOrder po; po.mainpath = PackagePath(pks[0]); IndexSort(pks.Begin() + 1, pks.End(), speed.Begin() + 1, po); } for(int i = 0; i < wspc.package.GetCount(); i++) { String pk = pks[i]; Font fnt = ListFont(); if(i == 0) fnt.Bold(); PackageInfo pi = GetPackageInfo(pk); if(pi.bold) fnt.Bold(); if(pi.italic) fnt.Italic(); package.Add(pk, Null, fnt, Nvl(pi.ink, SColorText()), false, 0, Null, SColorMark); } if(!organizer) { if(main.GetCount()) package.Add(prjaux, IdeImg::PrjAux(), ListFont(), Magenta); package.Add(ideaux, IdeImg::IdeAux(), ListFont(), Magenta); package.Add(tempaux, IdeImg::TempAux(), ListFont(), Magenta); if(main.GetCount()) package.Add(METAPACKAGE, IdeImg::Meta(), ListFont(), Red); } package.SetCursor(0); SyncErrorPackages(); }
void StyleManager::GetFont(Font& font) { if(!IsNull(face)) font.Face(~face); if(!IsNull(height)) font.Height(RichEdit::PtToDot(~height)); font.Bold(bold); font.Italic(italic); font.Underline(underline); font.Strikeout(strikeout); }
void PaintText(Draw& w, int& x, int y, const CppItemInfo& m, const Vector<ItemTextPart>& n, int starti, int count, bool focuscursor, Color _ink) { for(int i = starti; i < count; i++) { const ItemTextPart& p = n[i]; Font f = BrowserFont(); Color ink = SColorText; switch(p.type) { case ITEM_PNAME: f.Bold(); case ITEM_NUMBER: ink = Red; break; case ITEM_TNAME: ink = Green; case ITEM_NAME: f.Bold(); break; case ITEM_UPP: ink = Cyan; break; case ITEM_CPP_TYPE: case ITEM_CPP: ink = LtBlue; break; case ITEM_SIGN: ink = Magenta; break; } if(m.overed) f.Italic(); Size fsz = GetTextSize(~m.natural + p.pos, f, p.len); w.DrawText(x, y, ~m.natural + p.pos, f, focuscursor ? _ink : ink, p.len); x += fsz.cx; } }