mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: mainconfig and buildmode now using fancy display that reduces text to fit
This commit is contained in:
parent
b4924d9d57
commit
e6fba49f17
1 changed files with 21 additions and 0 deletions
|
|
@ -465,6 +465,25 @@ CursorInfoCtrl::CursorInfoCtrl()
|
|||
IgnoreMouse();
|
||||
}
|
||||
|
||||
struct FitTextDisplay : Display {
|
||||
void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const override {
|
||||
Font font = StdFont();
|
||||
int x = r.left;
|
||||
WString txt = (~q).ToWString();
|
||||
Size tsz;
|
||||
for(;;) {
|
||||
tsz = GetTextSize(txt, font);
|
||||
int fh = font.GetHeight();
|
||||
if(tsz.cx <= r.GetWidth() || fh < 10)
|
||||
break;
|
||||
font.Height(font.GetHeight() - 1);
|
||||
}
|
||||
w.DrawRect(r, paper);
|
||||
w.DrawText(r.left, r.top + (tsz.cy < 4 * r.GetHeight() / 3 ? (r.Height() - tsz.cy) / 2 : 0), // allow negative tt if only slightly bigger
|
||||
txt, font, ink);
|
||||
}
|
||||
};
|
||||
|
||||
Ide::Ide()
|
||||
{
|
||||
DiffDlg::WhenHighlight = callback(HighlightLine);
|
||||
|
|
@ -575,12 +594,14 @@ Ide::Ide()
|
|||
mainconfiglist <<= THISBACK(OnMainConfigList);
|
||||
mainconfiglist.NoDropFocus();
|
||||
mainconfiglist.NoWantFocus();
|
||||
mainconfiglist.ValueDisplay(Single<FitTextDisplay>());
|
||||
|
||||
buildmode.WhenClick = THISBACK(SetupOutputMode);
|
||||
buildmode.NoWantFocus();
|
||||
buildmode.Tip("Output mode");
|
||||
buildmode.AddButton().Tip("Build method").Left() <<= THISBACK(DropMethodList);
|
||||
buildmode.AddButton().Tip("Build mode") <<= THISBACK(DropModeList);
|
||||
buildmode.SetDisplay(Single<FitTextDisplay>());
|
||||
methodlist.Normal();
|
||||
methodlist.WhenSelect = THISBACK(SelectMethod);
|
||||
modelist.Normal();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue