Tighten terminal surface layout
This commit is contained in:
parent
8fec56dcb1
commit
5737928fa6
4 changed files with 17 additions and 14 deletions
|
|
@ -318,7 +318,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
.Slider("Bloom Intensity", () => settings.BloomIntensity, value => settings = (settings with { BloomIntensity = Math.Clamp(value, GraphicsSettings.MinBloomIntensity, GraphicsSettings.MaxBloomIntensity) }).Normalized(), GraphicsSettings.MinBloomIntensity, GraphicsSettings.MaxBloomIntensity, "0.###", "Strength of pre-tonemap bloom energy.", () => activeDebugTab == 0)
|
||||
.Slider("Bloom Veil", () => settings.BloomVeilIntensity, value => settings = (settings with { BloomVeilIntensity = Math.Clamp(value, GraphicsSettings.MinBloomVeilIntensity, GraphicsSettings.MaxBloomVeilIntensity) }).Normalized(), GraphicsSettings.MinBloomVeilIntensity, GraphicsSettings.MaxBloomVeilIntensity, "0.###", "Low-frequency veil from bright HDR energy.", () => activeDebugTab == 0)
|
||||
.Section("Terminal", () => activeDebugTab == 1)
|
||||
.TextBox("Session", TerminalDisplay, UpdateTerminalInputFromDisplay, lines: 8, acceptsReturn: false, submit: ExecuteTerminalInput, monospace: true, alignBottom: true, tooltip: "Terminal log with live command prompt.", isVisible: () => activeDebugTab == 1)
|
||||
.TextBox("", TerminalDisplay, UpdateTerminalInputFromDisplay, lines: 8, acceptsReturn: false, submit: ExecuteTerminalInput, monospace: true, alignBottom: true, tooltip: "Terminal log with live command prompt.", isVisible: () => activeDebugTab == 1)
|
||||
.Section("Synth Playground", () => activeDebugTab == 2)
|
||||
.Options("Preset", () => synthPlaygroundPreset, SelectSynthPreset, SynthPresetOptions, "Loads a built-in synth patch.", () => activeDebugTab == 2)
|
||||
.Readout("Compile", () => $"{synthPlaygroundStatus.State}: {synthPlaygroundStatus.Message}", "Faust compile status.", () => activeDebugTab == 2)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ internal sealed class DirectWriteOverlay : IDisposable
|
|||
trackActiveBrush = renderTarget.CreateSolidColorBrush(new Color4(0.45f, 0.38f, 0.34f, 1.0f));
|
||||
titleFormat = CreateTextFormat("Montserrat", 18.0f, FontWeight.Thin);
|
||||
smallFormat = CreateTextFormat("Ubuntu Sans", 11.0f, FontWeight.Regular);
|
||||
monospaceFormat = CreateTextFormat("Ubuntu Sans Mono", 11.0f, FontWeight.Regular);
|
||||
monospaceFormat = CreateTextFormat("Ubuntu Sans Mono", 11.0f, FontWeight.Regular, ParagraphAlignment.Near);
|
||||
}
|
||||
|
||||
public void Render(AquariumFrame frame, int renderDebugMode, DebugUi? debugUi, IReadOnlyList<DebugUi> clientUiPanels)
|
||||
|
|
@ -184,7 +184,7 @@ internal sealed class DirectWriteOverlay : IDisposable
|
|||
direct2DFactory.Dispose();
|
||||
}
|
||||
|
||||
private IDWriteTextFormat CreateTextFormat(string familyName, float size, FontWeight weight)
|
||||
private IDWriteTextFormat CreateTextFormat(string familyName, float size, FontWeight weight, ParagraphAlignment paragraphAlignment = ParagraphAlignment.Center)
|
||||
{
|
||||
var format = directWriteFactory.CreateTextFormat(
|
||||
familyName,
|
||||
|
|
@ -195,7 +195,7 @@ internal sealed class DirectWriteOverlay : IDisposable
|
|||
size,
|
||||
"en-us");
|
||||
format.WordWrapping = WordWrapping.NoWrap;
|
||||
format.ParagraphAlignment = ParagraphAlignment.Center;
|
||||
format.ParagraphAlignment = paragraphAlignment;
|
||||
return format;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -937,7 +937,7 @@ internal sealed class DebugUi
|
|||
private const float TextLineHeight = 18.0f;
|
||||
private const float VerticalPadding = 9.0f;
|
||||
|
||||
public override float LayoutHeight => LabelHeight + VerticalPadding * 2.0f + Math.Max(1, lines) * TextLineHeight;
|
||||
public override float LayoutHeight => LabelLineHeight + VerticalPadding * 2.0f + Math.Max(1, lines) * TextLineHeight;
|
||||
|
||||
public override bool UseMonospace => monospace;
|
||||
|
||||
|
|
@ -1002,9 +1002,13 @@ internal sealed class DebugUi
|
|||
ID2D1SolidColorBrush trackHoverBrush,
|
||||
ID2D1SolidColorBrush trackActiveBrush)
|
||||
{
|
||||
var labelBounds = RectFromEdges(Bounds.Left + 8.0f, Bounds.Top, Bounds.Right - 8.0f, Bounds.Top + LabelHeight);
|
||||
var box = RectFromEdges(Bounds.Left, Bounds.Top + LabelHeight, Bounds.Right, Bounds.Bottom);
|
||||
target.DrawText(Label.ToUpperInvariant(), format, labelBounds, accentBrush, DrawTextOptions.Clip);
|
||||
if (HasLabel)
|
||||
{
|
||||
var labelBounds = RectFromEdges(Bounds.Left + 8.0f, Bounds.Top, Bounds.Right - 8.0f, Bounds.Top + LabelHeight);
|
||||
target.DrawText(Label.ToUpperInvariant(), format, labelBounds, accentBrush, DrawTextOptions.Clip);
|
||||
}
|
||||
|
||||
var box = RectFromEdges(Bounds.Left, Bounds.Top + LabelLineHeight, Bounds.Right, Bounds.Bottom);
|
||||
var focused = IsFocused || IsActive;
|
||||
target.FillRectangle(box, IsActive ? activeRowBrush : IsHovered ? hoverRowBrush : rowBrush);
|
||||
target.DrawRectangle(box, focused ? accentBrush : outlineBrush, focused ? 1.5f : 1.0f);
|
||||
|
|
@ -1016,12 +1020,6 @@ internal sealed class DebugUi
|
|||
primaryBrush,
|
||||
DrawTextOptions.Clip);
|
||||
|
||||
if (focused)
|
||||
{
|
||||
var caretX = box.Right - 12.0f;
|
||||
var caretBottom = box.Bottom - 8.0f;
|
||||
target.DrawLine(new Vector2(caretX, caretBottom - TextLineHeight + 2.0f), new Vector2(caretX, caretBottom), accentBrush, 1.25f);
|
||||
}
|
||||
}
|
||||
|
||||
private string DisplayText()
|
||||
|
|
@ -1047,6 +1045,10 @@ internal sealed class DebugUi
|
|||
return RectFromEdges(box.Left + 8.0f, top, box.Right - 8.0f, bottom);
|
||||
}
|
||||
|
||||
private bool HasLabel => !string.IsNullOrWhiteSpace(Label);
|
||||
|
||||
private float LabelLineHeight => HasLabel ? LabelHeight : 0.0f;
|
||||
|
||||
private static bool IsEmptyPrompt(string value)
|
||||
{
|
||||
var normalized = value.Replace("\r\n", "\n", StringComparison.Ordinal).Replace('\r', '\n');
|
||||
|
|
|
|||
Loading…
Reference in a new issue