feat(chat): a header that says which channel you are in
Small caps with wide tracking, not a smaller size. The mockup asks for one pixel below body text, and one pixel would have cost a whole additional font handle at full glyph range -- tab names are free user input and can be CJK. Tracking reads the same in every palette and costs nothing, which is the same argument that settled the section headings in the settings window. Only the world and the clock use the meta face. Its glyph range is ASCII plus a middle dot, so anything that gets translated has to stay on the body face. Two things it will not do. It drops the tab name where one is already on screen: a pop-out with its title bar on carries the name in the title, and the top-tab strip carries it too. Repeating it one line below is the exact defect that got an earlier header row removed, and the comment left behind at that removal is what made this rule. And it disappears entirely below a minimum message-area height -- the window minimum is 260px, already shared with the honorific header, the input row and the status bar, and all of it scales together. A header that leaves two readable lines is worse than no header. Both decisions are arithmetic and sit in ChannelHeaderLayout with tests. The gallery gets an entry despite the header needing a tab and the font handles, because that window exists precisely because pieces once shipped without a call site.
This commit is contained in:
@@ -23,6 +23,8 @@ internal sealed class WidgetGalleryWindow : Window
|
||||
private readonly WidgetPalette _palette;
|
||||
|
||||
private int _badgeCount = 3;
|
||||
private Tab? _headerSample;
|
||||
private int _headerMode;
|
||||
private bool _rowActive = true;
|
||||
private bool _toggleA = true;
|
||||
private bool _toggleB;
|
||||
@@ -54,6 +56,40 @@ internal sealed class WidgetGalleryWindow : Window
|
||||
DrawPillSection(c);
|
||||
DrawIconButtonSection(c);
|
||||
DrawDividerSection(c);
|
||||
DrawChannelHeaderSection(c);
|
||||
}
|
||||
|
||||
// Unlike every other entry here the header is not a stateless primitive -- it
|
||||
// needs a tab and the font handles. It is in the gallery anyway: this window
|
||||
// exists because three style-engine pieces once shipped with no call site at
|
||||
// all, and a header nobody can look at outside a live chat is exactly how
|
||||
// that happens again.
|
||||
private void DrawChannelHeaderSection(ThemeColors c)
|
||||
{
|
||||
ImGui.TextUnformatted("ChannelHeader");
|
||||
|
||||
var fonts = _plugin.FontManager;
|
||||
if (fonts is null || !fonts.FontsReady)
|
||||
{
|
||||
ImGui.TextDisabled("fonts not ready");
|
||||
return;
|
||||
}
|
||||
|
||||
_headerSample ??= new Tab { Name = "General", Icon = "comment" };
|
||||
|
||||
ImGui.RadioButton("full##hdr", ref _headerMode, 0);
|
||||
ImGui.SameLine();
|
||||
ImGui.RadioButton("detail only##hdr", ref _headerMode, 1);
|
||||
|
||||
ImGui.SliderFloat("sender weight##hdr", ref FontManager.SenderWeight, 1.0f, 1.6f, "%.2f");
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("apply##hdr-weight"))
|
||||
fonts.RebuildDelegateFonts();
|
||||
|
||||
var mode = _headerMode == 0 ? ChannelHeaderMode.Full : ChannelHeaderMode.DetailOnly;
|
||||
ChannelHeader.Draw(_headerSample, mode, fonts, "Ravana · 14:32");
|
||||
|
||||
ImGui.Spacing();
|
||||
}
|
||||
|
||||
private void DrawRowSection(ThemeColors c)
|
||||
|
||||
Reference in New Issue
Block a user