Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
587bb93494 |
No files matched your search
@@ -28,6 +28,12 @@ numeric core and does not move; the heading is the full version — corrected 20
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **Settings ▸ Window ▸ Hide scroll bars.** No scroll bar is drawn anywhere in the app while it is on, and everything
|
||||
still scrolls with the mouse wheel, the keyboard and touch. Off by default; it applies at once, to the open windows
|
||||
too, and off brings every bar back.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **The import list was unreadable in the dark theme.** File ▸ Import library (and Games ▸ Refresh) drew every row white
|
||||
|
||||
@@ -415,6 +415,7 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
|
||||
| `ui.minimize_to_tray` | bool | `0` | | UI (PR-8) |
|
||||
| `ui.hide_anticheat_hooking` | bool | `1` | | UI (beta.8, 2026-09-25): the game page of an entry the guard found anti-cheat in shows the finding in place of its Hooking card (`08_UI` §Game detail) |
|
||||
| `ui.fps_decimals` | bool | `0` | | UI (beta.8, 2026-09-25): every FPS figure with two decimals ("62.40") instead of a whole number |
|
||||
| `ui.hide_scrollbars` | bool | `0` | | UI (beta.14, 2026-10-05): no scroll bar drawn anywhere; every scroller still scrolls with the wheel, the keyboard and touch (`App.Services.ScrollBarHiding`, `08_UI` §Settings) |
|
||||
| `ui.library_view` | choice `grid`\|`list` | `grid` | | UI (beta.11, 2026-10-03): the Games library as a grid of cards that fills the width, or as a list; written by the page's own switch, no Settings row (`08_UI` §Games) |
|
||||
| `capture.background` | bool | `1` | | ~~Agent~~ nobody *(corrected 2026-10-04: no Agent code ever read it, so the watcher recorded every tracked game whatever it said; beta.12 removed its switch from Settings and reserved the key — `SettingsRegistry.CaptureBackground`)* |
|
||||
| `hooking.kill_switch` | bool | `0` | | Agent (FR-2.4, since P2 PR-F) |
|
||||
|
||||
@@ -552,6 +552,16 @@ Tail view of `ui-*.log` / `agent-*.log` (toggle), level filter, search (`ui:Auto
|
||||
> `PagesLoadTests`.
|
||||
|
||||
### Settings
|
||||
> **beta.14 (owner request 2026-10-05: "an option to hide the scroll bars but still scroll").** The Window section has
|
||||
> **Hide scroll bars** (`ui.hide_scrollbars`, off by default). A bar's visibility is bound inside its scroller's template,
|
||||
> which no style reaches, so `Services.ScrollBarHiding` sets the scrollers themselves: one class handler on
|
||||
> `ScrollViewer`'s Loaded (registered at start beside `DialogKeyboard`) reaches every scroller the App shows, those inside a
|
||||
> DataGrid, a TextBox, a rendered document and a dialog included. While on, an axis that is `Auto` or `Visible` becomes
|
||||
> `Hidden` — WPF's "no bar, still scrolls": wheel, keyboard and touch — and its own value is kept on it; a `Disabled` axis is
|
||||
> never touched (it lays its content out at the viewport's width). The toggle applies to the open windows at once, and off
|
||||
> puts every kept value back. Tests: `ScrollBarHidingTests` (on hides every bar and the wheel still scrolls; off restores
|
||||
> each; a scroller that loads later follows), `SettingsViewModelTests.HidingScrollBars…`.
|
||||
|
||||
> **beta.11 (owner request 2026-10-03: "remove the Settings rows that have no button or similar").** Every row has a control
|
||||
> now: the *Games with hooking on* card shows only while a game has hooking on (its empty sentence is gone); the *Elevation*
|
||||
> card is gone and its state is the third line of *Run the agent as administrator* (its explanation a tooltip on it); the
|
||||
|
||||
@@ -251,6 +251,10 @@ On startup and on `ApplicationThemeManager.Changed`: for every live plot set fig
|
||||
- [ ] **ScottPlot 5 zooms on every wheel and never marks it handled.** Without `Charts/ChartWheel` a wheel over a chart
|
||||
zoomed it and scrolled the page at once; a plain wheel is the page's, Ctrl+wheel the chart's, for every plot that
|
||||
`ChartTheme.Attach` registers.
|
||||
- [ ] **A scroll bar's visibility is bound inside its scroller's template** (`ComputedVerticalScrollBarVisibility`), so a style
|
||||
on `ScrollBar` or `ui:DynamicScrollBar` cannot hide it. Set the scroller's own `ScrollBarVisibility` to `Hidden` — no
|
||||
bar, and the wheel, the keyboard and touch still scroll (`ui:PassiveScrollViewer` treats only `Disabled` as "cannot
|
||||
scroll") — as `Services.ScrollBarHiding` does for `ui.hide_scrollbars` (beta.14).
|
||||
- [ ] **No dialog in 4.3.0 closes on Esc.** Neither `ContentDialog.cs` nor `MessageBox.cs` at the 4.3.0 tag handles a
|
||||
key (read 2026-09-15), and `ContentDialog.CloseButtonText` DEFAULTS to "Close" — an empty string is how a dialog
|
||||
says it has no Close button. `MessageBox.Close()` is `[Obsolete("Use Close with MessageBoxResult instead")]` while no
|
||||
|
||||
@@ -78,6 +78,8 @@ public partial class App : System.Windows.Application
|
||||
HookCrashHandlers();
|
||||
// 08_UI §Accessibility (P4 PR-8): Esc closes the open ContentDialog or MessageBox, before any window exists.
|
||||
DialogKeyboard.Register();
|
||||
// beta.14: ui.hide_scrollbars reaches every scroller as it loads, those in a control's template too.
|
||||
ScrollBarHiding.Register();
|
||||
_run = DiagReport.Requested(e.Args) ? DiagAsync() : RunAsync();
|
||||
}
|
||||
|
||||
@@ -102,6 +104,7 @@ public partial class App : System.Windows.Application
|
||||
var registered = new RegisteredSettings(store);
|
||||
LoggingLevel.SetDebug(await registered.GetBooleanAsync(SettingsRegistry.LogDebug).ConfigureAwait(true));
|
||||
FpsDecimals.Two = await registered.GetBooleanAsync(SettingsRegistry.UiFpsDecimals).ConfigureAwait(true);
|
||||
ScrollBarHiding.Apply(await registered.GetBooleanAsync(SettingsRegistry.UiHideScrollBars).ConfigureAwait(true));
|
||||
var closePolicy = new WindowClosePolicy { MinimizeToTray = await registered.GetBooleanAsync(SettingsRegistry.UiMinimizeToTray).ConfigureAwait(true) };
|
||||
|
||||
_host = BuildHost(_db, appearance, registered, closePolicy);
|
||||
|
||||
@@ -311,6 +311,17 @@
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{x:Static res:Strings.Settings_FpsDecimals_Label}" IsChecked="{Binding ViewModel.FpsTwoDecimals, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
<!-- beta.14 (owner request 2026-10-05): no scroll bars drawn; the wheel, the keyboard and touch still scroll. -->
|
||||
<ui:CardControl Margin="0,8,0,0" Icon="{ui:SymbolIcon ArrowSortDownLines24}">
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
<ui:TextBlock FontTypography="BodyStrong" Text="{x:Static res:Strings.Settings_HideScrollBars_Label}" />
|
||||
<ui:TextBlock MaxWidth="520" HorizontalAlignment="Left" Appearance="Secondary" TextWrapping="Wrap"
|
||||
Text="{x:Static res:Strings.Settings_HideScrollBars_Body}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{x:Static res:Strings.Settings_HideScrollBars_Label}" IsChecked="{Binding ViewModel.HideScrollBars, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<!--
|
||||
Updates, logging, legal. The Privacy card — the `privacy.online_metadata` toggle — is not shown
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FrameLedger.App.Services;
|
||||
|
||||
/// <summary>
|
||||
/// <c>ui.hide_scrollbars</c> (beta.14, owner request 2026-10-05): the App draws no scroll bars, and every scroller still
|
||||
/// scrolls — with the wheel, the keyboard and touch. A bar's visibility is bound in its scroller's template, so no style can
|
||||
/// reach it; this sets the scroller's own <see cref="ScrollBarVisibility"/> instead. One class handler on
|
||||
/// <see cref="ScrollViewer"/>'s <c>Loaded</c>, registered at start beside <see cref="DialogKeyboard"/>, sees every scroller the
|
||||
/// App shows, those inside a control's template too (a DataGrid's, a TextBox's, a rendered document's, a dialog's). While
|
||||
/// on, an axis whose bar is <see cref="ScrollBarVisibility.Auto"/> or <see cref="ScrollBarVisibility.Visible"/> becomes
|
||||
/// <see cref="ScrollBarVisibility.Hidden"/> — WPF's "no bar, still scrolls" — and its own value is remembered on it;
|
||||
/// <see cref="ScrollBarVisibility.Disabled"/> is never touched, because a disabled axis lays its content out at the viewport's
|
||||
/// size and wraps text. Off puts every remembered value back, on screen at once and on the next load for the rest.
|
||||
/// </summary>
|
||||
public static class ScrollBarHiding
|
||||
{
|
||||
private static readonly DependencyProperty _ownVerticalProperty =
|
||||
DependencyProperty.RegisterAttached("OwnVertical", typeof(ScrollBarVisibility?), typeof(ScrollBarHiding), new PropertyMetadata(null));
|
||||
|
||||
private static readonly DependencyProperty _ownHorizontalProperty =
|
||||
DependencyProperty.RegisterAttached("OwnHorizontal", typeof(ScrollBarVisibility?), typeof(ScrollBarHiding), new PropertyMetadata(null));
|
||||
|
||||
private static volatile bool _hidden;
|
||||
private static int _registered;
|
||||
|
||||
/// <summary>Whether the bars are hidden right now.</summary>
|
||||
public static bool Hidden => _hidden;
|
||||
|
||||
/// <summary>Registers the class handler, once per process.</summary>
|
||||
public static void Register()
|
||||
{
|
||||
if (Interlocked.Exchange(ref _registered, 1) == 0)
|
||||
{
|
||||
EventManager.RegisterClassHandler(typeof(ScrollViewer), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnLoaded), handledEventsToo: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the preference and applies it to every scroller of every open window — at once on the App's own thread, where
|
||||
/// Settings changes it; from any other thread the windows are visited when that thread's dispatcher next runs.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD001:Avoid legacy thread switching APIs", Justification = "a WPF application has no JoinableTaskFactory; the windows belong to the dispatcher's thread, and posting to it never blocks (UiThread does the same)")]
|
||||
public static void Apply(bool hidden)
|
||||
{
|
||||
_hidden = hidden;
|
||||
if (System.Windows.Application.Current is not { } app)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (app.Dispatcher.CheckAccess())
|
||||
{
|
||||
ApplyToWindows(app);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = app.Dispatcher.InvokeAsync(() => ApplyToWindows(app));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyToWindows(System.Windows.Application app)
|
||||
{
|
||||
foreach (Window window in app.Windows)
|
||||
{
|
||||
ApplyUnder(window);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Applies the current preference to every scroller under <paramref name="root"/>: an open window, or a test's tree.</summary>
|
||||
public static void ApplyUnder(DependencyObject root)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(root);
|
||||
if (root is ScrollViewer viewer)
|
||||
{
|
||||
Set(viewer);
|
||||
}
|
||||
|
||||
int count = VisualTreeHelper.GetChildrenCount(root);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ApplyUnder(VisualTreeHelper.GetChild(root, i));
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ScrollViewer viewer)
|
||||
{
|
||||
Set(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Set(ScrollViewer viewer)
|
||||
{
|
||||
Axis(viewer, ScrollViewer.VerticalScrollBarVisibilityProperty, _ownVerticalProperty);
|
||||
Axis(viewer, ScrollViewer.HorizontalScrollBarVisibilityProperty, _ownHorizontalProperty);
|
||||
}
|
||||
|
||||
private static void Axis(ScrollViewer viewer, DependencyProperty axis, DependencyProperty own)
|
||||
{
|
||||
var remembered = (ScrollBarVisibility?)viewer.GetValue(own);
|
||||
if (_hidden)
|
||||
{
|
||||
if (remembered is null && viewer.GetValue(axis) is ScrollBarVisibility current and (ScrollBarVisibility.Auto or ScrollBarVisibility.Visible))
|
||||
{
|
||||
viewer.SetValue(own, current);
|
||||
viewer.SetCurrentValue(axis, ScrollBarVisibility.Hidden);
|
||||
}
|
||||
}
|
||||
else if (remembered is { } value)
|
||||
{
|
||||
viewer.ClearValue(own);
|
||||
viewer.SetCurrentValue(axis, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+6
@@ -769,6 +769,8 @@ public static class Strings
|
||||
nameof(Settings_Header),
|
||||
nameof(Settings_HideAntiCheatHooking_Body),
|
||||
nameof(Settings_HideAntiCheatHooking_Label),
|
||||
nameof(Settings_HideScrollBars_Body),
|
||||
nameof(Settings_HideScrollBars_Label),
|
||||
nameof(Settings_HookedGames_Label),
|
||||
nameof(Settings_HookedGames_Revoke),
|
||||
nameof(Settings_Interval_Body),
|
||||
@@ -2463,6 +2465,10 @@ public static class Strings
|
||||
|
||||
public static string Settings_HideAntiCheatHooking_Label => ResourceManager.GetString(nameof(Settings_HideAntiCheatHooking_Label), Culture) ?? nameof(Settings_HideAntiCheatHooking_Label);
|
||||
|
||||
public static string Settings_HideScrollBars_Body => ResourceManager.GetString(nameof(Settings_HideScrollBars_Body), Culture) ?? nameof(Settings_HideScrollBars_Body);
|
||||
|
||||
public static string Settings_HideScrollBars_Label => ResourceManager.GetString(nameof(Settings_HideScrollBars_Label), Culture) ?? nameof(Settings_HideScrollBars_Label);
|
||||
|
||||
public static string Settings_HookedGames_Label => ResourceManager.GetString(nameof(Settings_HookedGames_Label), Culture) ?? nameof(Settings_HookedGames_Label);
|
||||
|
||||
public static string Settings_HookedGames_Revoke => ResourceManager.GetString(nameof(Settings_HookedGames_Revoke), Culture) ?? nameof(Settings_HookedGames_Revoke);
|
||||
|
||||
@@ -3841,4 +3841,12 @@
|
||||
<value>FrameLedger に対するあなたのライセンスです。参考として表示しています。プログラムを実行するために同意する必要はありません(GPLv3 第 9 条)。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>スクロール バーを非表示にする</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>アプリ内のどこにもスクロール バーを表示しません。マウス ホイール、キーボード、タッチでのスクロールは引き続き使えます。</value>
|
||||
<comment>review</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2891,4 +2891,10 @@ The documents below are the full terms; this summary does not replace them.</val
|
||||
<data name="FirstRun_Doc_InformationNote" xml:space="preserve">
|
||||
<value>Your licence to FrameLedger, shown for information: you do not need to accept it to run the program (GPLv3 section 9).</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>Hide scroll bars</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>No scroll bars are drawn anywhere in the app. Everything still scrolls with the mouse wheel, the keyboard and touch.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2886,4 +2886,10 @@ Các văn bản bên dưới là điều khoản đầy đủ; bản tóm tắt
|
||||
<data name="FirstRun_Doc_InformationNote" xml:space="preserve">
|
||||
<value>Giấy phép của bạn đối với FrameLedger, hiển thị để bạn biết: bạn không cần chấp nhận nó để chạy chương trình (GPLv3 mục 9).</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Label" xml:space="preserve">
|
||||
<value>Ẩn thanh cuộn</value>
|
||||
</data>
|
||||
<data name="Settings_HideScrollBars_Body" xml:space="preserve">
|
||||
<value>Không vẽ thanh cuộn ở bất kỳ đâu trong ứng dụng. Mọi thứ vẫn cuộn được bằng con lăn chuột, bàn phím và cảm ứng.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -105,6 +105,10 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _fpsTwoDecimals;
|
||||
|
||||
/// <summary><c>ui.hide_scrollbars</c> (beta.14): no scroll bars drawn; every scroller still scrolls.</summary>
|
||||
[ObservableProperty]
|
||||
private bool _hideScrollBars;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _onlineMetadata;
|
||||
|
||||
@@ -385,6 +389,18 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
Persist(SettingsRegistry.UiFpsDecimals, value);
|
||||
}
|
||||
|
||||
partial void OnHideScrollBarsChanged(bool value)
|
||||
{
|
||||
if (_loading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// On screen at once — this page's own bars included — and on every scroller that loads from now on.
|
||||
ScrollBarHiding.Apply(value);
|
||||
Persist(SettingsRegistry.UiHideScrollBars, value);
|
||||
}
|
||||
|
||||
partial void OnMinimizeToTrayChanged(bool value)
|
||||
{
|
||||
if (!_loading)
|
||||
@@ -497,6 +513,7 @@ public sealed partial class SettingsViewModel : ObservableObject
|
||||
UserModeExceptions = await _settings.GetBooleanAsync(SettingsRegistry.HookingUserModeExceptions).ConfigureAwait(true);
|
||||
RunElevated = await _settings.GetBooleanAsync(SettingsRegistry.CaptureRunElevated).ConfigureAwait(true);
|
||||
FpsTwoDecimals = await _settings.GetBooleanAsync(SettingsRegistry.UiFpsDecimals).ConfigureAwait(true);
|
||||
HideScrollBars = await _settings.GetBooleanAsync(SettingsRegistry.UiHideScrollBars).ConfigureAwait(true);
|
||||
OnlineMetadata = await _settings.GetBooleanAsync(SettingsRegistry.PrivacyOnlineMetadata).ConfigureAwait(true);
|
||||
UpdateChannel = await _settings.GetAsync(SettingsRegistry.UpdateChannel).ConfigureAwait(true);
|
||||
AutoCheckUpdates = await _settings.GetBooleanAsync(SettingsRegistry.UpdateAutoCheck).ConfigureAwait(true);
|
||||
|
||||
@@ -66,6 +66,17 @@ public static class SettingsRegistry
|
||||
Default = "0",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether the App draws no scroll bars (beta.14, owner request 2026-10-05): every scroller still scrolls with the wheel,
|
||||
/// the keyboard and touch, it only stops showing its bar. Off by default — the bars are what every page showed until then.
|
||||
/// </summary>
|
||||
public static readonly SettingDefinition UiHideScrollBars = new()
|
||||
{
|
||||
Key = "ui.hide_scrollbars",
|
||||
Kind = SettingKind.Boolean,
|
||||
Default = "0",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// How the Games library is shown (beta.11, owner request 2026-10-03): a grid of cards that fills the width, or a list.
|
||||
/// The page's own switch writes it; Settings has no row for it.
|
||||
@@ -199,7 +210,7 @@ public static class SettingsRegistry
|
||||
/// <summary>Every definition, in the order <c>06_DATA_MODEL</c> lists them.</summary>
|
||||
public static IReadOnlyList<SettingDefinition> All { get; } =
|
||||
[
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiLibraryView,
|
||||
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiHideScrollBars, UiLibraryView,
|
||||
CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, RetentionRawSessionsPerGame,
|
||||
UpdateChannel, UpdateAutoCheck, PrivacyOnlineMetadata, LogDebug,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using FluentAssertions;
|
||||
using FrameLedger.App.Services;
|
||||
|
||||
namespace FrameLedger.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// <c>ui.hide_scrollbars</c> (beta.14, owner request 2026-10-05: "an option to hide the scroll bars but still scroll"). Each
|
||||
/// check builds the scrollers the App shows — a plain one, a DataGrid's, a multi-line TextBox's, a rendered document's, and
|
||||
/// one whose axis is Disabled — and turns the option on and off within one job on the STA thread. The option is process-wide
|
||||
/// state, so the class runs with the other classes that write such state, one at a time.
|
||||
/// </summary>
|
||||
[Collection(StringsCultureCollection.Name)]
|
||||
public sealed class ScrollBarHidingTests
|
||||
{
|
||||
/// <summary>Every kind of scroller the App has, each with more content than its height, laid out in a column.</summary>
|
||||
private static (StackPanel Root, ScrollViewer Plain, ScrollViewer Disabled) Scrollers()
|
||||
{
|
||||
var plain = new ScrollViewer { Height = 120, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Content = new Border { Height = 600 } };
|
||||
var disabled = new ScrollViewer { Height = 120, VerticalScrollBarVisibility = ScrollBarVisibility.Disabled, Content = new TextBlock { Text = "wraps" } };
|
||||
var grid = new DataGrid { Height = 120, ItemsSource = Enumerable.Range(1, 50).Select(static i => new { Row = i }).ToList() };
|
||||
var text = new TextBox
|
||||
{
|
||||
Height = 120,
|
||||
AcceptsReturn = true,
|
||||
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
|
||||
Text = string.Join(Environment.NewLine, Enumerable.Range(1, 60).Select(static i => "line " + i.ToString(System.Globalization.CultureInfo.InvariantCulture))),
|
||||
};
|
||||
var document = new FlowDocumentScrollViewer { Height = 120, Document = new FlowDocument(new Paragraph(new Run(string.Join(" ", Enumerable.Repeat("word", 600))))) };
|
||||
var root = new StackPanel { Width = 600, Children = { plain, disabled, grid, text, document } };
|
||||
Visuals.Layout(root, 600, 900);
|
||||
return (root, plain, disabled);
|
||||
}
|
||||
|
||||
private static List<ScrollViewer> All(DependencyObject root) => [.. Visuals.FindAll<ScrollViewer>(root)];
|
||||
|
||||
[Fact]
|
||||
public async Task OnHidesEveryBarAndTheWheelStillScrolls()
|
||||
{
|
||||
(int Viewers, List<string> Shown, ScrollBarVisibility DisabledAxis, double Offset) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(StackPanel root, ScrollViewer plain, ScrollViewer disabled) = Scrollers();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
root.UpdateLayout();
|
||||
List<ScrollViewer> viewers = All(root);
|
||||
List<string> shown = [.. viewers.Where(static v => v.ComputedVerticalScrollBarVisibility == Visibility.Visible || v.ComputedHorizontalScrollBarVisibility == Visibility.Visible)
|
||||
.Select(static v => (v.TemplatedParent ?? v).GetType().Name)];
|
||||
|
||||
var wheel = new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, -120) { RoutedEvent = UIElement.MouseWheelEvent };
|
||||
((UIElement)plain.Content).RaiseEvent(wheel);
|
||||
root.UpdateLayout();
|
||||
return (viewers.Count, shown, disabled.VerticalScrollBarVisibility, plain.VerticalOffset);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.Viewers.Should().BeGreaterThanOrEqualTo(5, "the plain scroller, the disabled one and those inside the grid, the box and the document");
|
||||
result.Shown.Should().BeEmpty("no scroller draws a bar while the option is on");
|
||||
result.DisabledAxis.Should().Be(ScrollBarVisibility.Disabled, "a disabled axis lays its content out at the viewport's size, and is left alone");
|
||||
result.Offset.Should().BeGreaterThan(0, "a hidden bar is still a scroller: the wheel moves it");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OffRestoresWhatEachViewerHad()
|
||||
{
|
||||
(List<ScrollBarVisibility> Before, List<ScrollBarVisibility> Hidden, List<ScrollBarVisibility> After) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
(StackPanel root, _, _) = Scrollers();
|
||||
List<ScrollBarVisibility> Read() => [.. All(root).Select(static v => v.VerticalScrollBarVisibility)];
|
||||
List<ScrollBarVisibility> before = Read();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
List<ScrollBarVisibility> hidden = Read();
|
||||
ScrollBarHiding.Apply(false);
|
||||
ScrollBarHiding.ApplyUnder(root);
|
||||
return (before, hidden, Read());
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.Hidden.Should().NotEqual(result.Before, "the option changed something");
|
||||
result.After.Should().Equal(result.Before, "off puts back every scroller's own setting");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AScrollerThatLoadsWhileOnIsHiddenAndOneThatLoadsAfterOffIsLeftAlone()
|
||||
{
|
||||
(ScrollBarVisibility WhileOn, ScrollBarVisibility FirstAfterOff, ScrollBarVisibility LoadedAfterOff) result = await PagesLoadTests.OnStaAsync(() =>
|
||||
{
|
||||
ScrollBarHiding.Register();
|
||||
try
|
||||
{
|
||||
ScrollBarHiding.Apply(true);
|
||||
var first = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Auto };
|
||||
first.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, first));
|
||||
ScrollBarVisibility whileOn = first.VerticalScrollBarVisibility;
|
||||
|
||||
ScrollBarHiding.Apply(false);
|
||||
first.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, first));
|
||||
var second = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Visible };
|
||||
second.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent, second));
|
||||
return (whileOn, first.VerticalScrollBarVisibility, second.VerticalScrollBarVisibility);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
});
|
||||
|
||||
result.WhileOn.Should().Be(ScrollBarVisibility.Hidden, "the class handler reaches a scroller as it loads");
|
||||
result.FirstAfterOff.Should().Be(ScrollBarVisibility.Auto, "and gives it back its own setting on its next load after off");
|
||||
result.LoadedAfterOff.Should().Be(ScrollBarVisibility.Visible, "a scroller the option never touched keeps what it has");
|
||||
}
|
||||
}
|
||||
@@ -419,6 +419,28 @@ public sealed class SettingsViewModelTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HidingScrollBarsIsOffByDefaultAndItsToggleIsPersistedAndAppliedAtOnce()
|
||||
{
|
||||
// beta.14 (owner request 2026-10-05): ui.hide_scrollbars, default 0; the scrollers on screen follow it at once.
|
||||
await using ScratchLedger s = await ScratchLedger.OpenAsync();
|
||||
Harness h = await OpenAsync(s);
|
||||
h.Vm.HideScrollBars.Should().BeFalse();
|
||||
try
|
||||
{
|
||||
h.Vm.HideScrollBars = true;
|
||||
Task pending = h.Vm.Pending;
|
||||
await pending;
|
||||
|
||||
(await h.Settings.GetBooleanAsync(SettingsRegistry.UiHideScrollBars, Ct)).Should().BeTrue();
|
||||
ScrollBarHiding.Hidden.Should().BeTrue();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ScrollBarHiding.Apply(false);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ARevokeTheAgentCannotTakeStaysInTheListAndSaysWhy()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace FrameLedger.App.Tests;
|
||||
/// first gate run on xUnit.net v3 4.0.1 (2026-09-21) read "Settings" where it had just written <c>vi</c>. The race was
|
||||
/// always there; the new scheduler found it. An implicit collection: no fixture, so no definition class is needed.
|
||||
/// Since beta.8 it also holds the classes that write <c>FpsDecimals.Two</c> or read FPS text the setting changes — the
|
||||
/// same kind of process-wide formatting state.
|
||||
/// same kind of process-wide formatting state — and since beta.14 <see cref="ScrollBarHidingTests"/>, whose option is a
|
||||
/// process-wide flag that <c>SettingsViewModelTests</c> writes too.
|
||||
/// </summary>
|
||||
internal static class StringsCultureCollection
|
||||
{
|
||||
|
||||
@@ -24,6 +24,18 @@ public sealed class SettingsRegistryTests
|
||||
}
|
||||
|
||||
/// <summary>D33: the exception option is off unless the user turns it on — and exactly "1" is on.</summary>
|
||||
[Fact]
|
||||
public void HidingScrollBarsIsOffByDefaultAndTheAgentNeverReadsIt()
|
||||
{
|
||||
// beta.14: ui.hide_scrollbars is the App's alone; the bars are what every page showed until then.
|
||||
SettingDefinition d = SettingsRegistry.UiHideScrollBars;
|
||||
d.Key.Should().Be("ui.hide_scrollbars");
|
||||
d.Kind.Should().Be(SettingKind.Boolean);
|
||||
d.Default.Should().Be("0");
|
||||
d.AgentReads.Should().BeFalse();
|
||||
SettingsRegistry.Find("ui.hide_scrollbars").Should().BeSameAs(d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheUserModeExceptionOptionIsOffByDefault()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user