Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.
C# audioaudio-unitavaloniacpp20cross-platformdawdigital-audio-workstationdspjucelinux-audiomcp-servermidimusicmusic-productionpiano-rollplugin-hostsequencersynthesizervstvst3
(feat) Interface scale: make the whole UI larger or smaller (#38) (#217)
Egor Khindikaynenef60d496e4eb
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e2cb5084..fb0f32a4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,14 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.## [Unreleased]+### Added+- **Make the whole interface larger or smaller** (nota-daw/nota#38): **Settings → Appearance+ → Interface scale** offers 75, 100, 125, 150 and 200 %. The change applies at once to every+ window, menu, tooltip and dialog — text, buttons, knobs, track headers, device cards — and+ is kept for the next launch. Text stays sharp at every size. The timeline, piano roll and+ audio editor zoom as before, on top of the scale. Pick 125 % or more when the text is too+ small to read on a laptop screen, or 75 % to fit more tracks on a small one.+### Fixed- **macOS: About Nota and Settings… sit directly in the Nota app menu** (nota-daw/nota#160):they used to hide inside an extra **Nota ›** submenu. The bold **Nota** menu now opensdiff --git a/FEATURES.md b/FEATURES.mdindex 455dcaed..0e6e0b26 100644--- a/FEATURES.md+++ b/FEATURES.md@@ -1101,7 +1101,10 @@ audio effects after it keep running and keep their settings; saved with the projrows of cards (Studio Dark and Ember Graphite; Studio Light and Ember Paper), each aminiature Nota window in its own colours. Pick one theme, or with Follow system one fordark mode and one for light mode, switched with the OS appearance; the choice applies- live and is remembered. Also **AI control (MCP)** on/off, a port field, and "Copy config" (copies a+ live and is remembered. **Interface scale** — 75 / 100 / 125 / 150 / 200 % for the whole+ interface (every window, menu, tooltip and dialog; text stays sharp), applied live and+ remembered; timeline, piano roll and audio editor zoom work on top of it. Also+ **AI control (MCP)** on/off, a port field, and "Copy config" (copies aready-made client JSON config to the clipboard).- **Shortcuts**: the shortcut list.- Settings, logs and autosaves live in `~/Library/Application Support/Nota/` (macOS) anddiff --git a/specs/027-ui-scale/checklists/requirements.md b/specs/027-ui-scale/checklists/requirements.mdnew file mode 100644index 00000000..fd6a8888--- /dev/null+++ b/specs/027-ui-scale/checklists/requirements.md@@ -0,0 +1,37 @@+# Specification Quality Checklist: App-wide Interface Scale++**Purpose**: Validate specification completeness and quality before proceeding to planning+**Created**: 2026-10-19+**Feature**: [spec.md](../spec.md)++## Content Quality++- [x] No implementation details (languages, frameworks, APIs)+- [x] Focused on user value and business needs+- [x] Written for non-technical stakeholders+- [x] All mandatory sections completed++## Requirement Completeness++- [x] No [NEEDS CLARIFICATION] markers remain+- [x] Requirements are testable and unambiguous+- [x] Success criteria are measurable+- [x] Success criteria are technology-agnostic (no implementation details)+- [x] All acceptance scenarios are defined+- [x] Edge cases are identified+- [x] Scope is clearly bounded+- [x] Dependencies and assumptions identified++## Feature Readiness++- [x] All functional requirements have clear acceptance criteria+- [x] User scenarios cover primary flows+- [x] Feature meets measurable outcomes defined in Success Criteria+- [x] No implementation details leak into specification++## Notes++- The Nota Context section names the Preferences pane and source areas by template+ design (it drives plan and tasks); the requirements themselves stay technology-free.+- Out of scope by decision (see Assumptions): separate font-size setting, free slider,+ keyboard shortcut.diff --git a/specs/027-ui-scale/contracts/ui-contract.md b/specs/027-ui-scale/contracts/ui-contract.mdnew file mode 100644index 00000000..b9a311e5--- /dev/null+++ b/specs/027-ui-scale/contracts/ui-contract.md@@ -0,0 +1,41 @@+# UI & Settings Contract: Interface Scale++## Preferences → Appearance → UI++The page's subtitle in the Settings sidebar becomes "Theme, scale, waveforms and AI+control", so the new setting is findable from the navigation.++The Settings window gets a design minimum of 800 × 480 (multiplied by the scale like every+window's minimum), so switching to a larger scale grows it instead of clipping the page.++The row order in the **UI** section becomes:++1. Colour theme *(unchanged)*+2. Waveform *(unchanged)*+3. **Interface scale**: a segmented picker in the same style as *Waveform* (DESIGN.md+ Studio; the selected segment wears the accent). Segments, in order:+ `75 %` · `100 %` · `125 %` · `150 %` · `200 %`.+ - Caption below (muted, like the others): "Makes the whole interface larger or+ smaller. Timeline, piano roll and audio editor zoom work on top of it."+ - Picking a segment applies at once (FR-002) and saves the setting. No Apply+ button, no restart prompt.+ - The Preferences window itself rescales live as well, so the picker stays under+ the pointer's segment as far as layout allows.++Labels are sentence case and use a thin non-breaking space before `%` if the Studio+type rules ask for it (follow the existing `%` formatting in `NotaNum`).++## settings.json++```json+{ "InterfaceScale": 125 }+```++- Integer percent. Valid: `75 | 100 | 125 | 150 | 200`. Anything else, or a missing+ key, means `100`. The app never rewrites an invalid value on its own; it saves only+ when the user picks a preset.++## Not affected++The engine C ABI (`nota_engine.h`), project files, MCP tools, Nota Remote, exports and+third-party plugin editor windows.diff --git a/specs/027-ui-scale/data-model.md b/specs/027-ui-scale/data-model.mdnew file mode 100644index 00000000..d9594a4c--- /dev/null+++ b/specs/027-ui-scale/data-model.md@@ -0,0 +1,25 @@+# Data Model: App-wide Interface Scale++## InterfaceScale (user preference)++| Field | Type | Where | Default | Rule |+|---|---|---|---|---|+| `InterfaceScale` | int, percent | `Nota.Application.Settings` → `settings.json` | `100` | One of `75, 100, 125, 150, 200`; anything else reads as `100` |++- App-wide, not per-project and not per-window. Never written to project files.+- Read once at startup (before the main window is created) and again on every+ Preferences change. Writing goes through the existing settings save path.+- Missing key (settings from older versions) → default 100 (no migration needed).++## Runtime state (app layer, not persisted)++**Scale service** (`Nota.App`, static like `NotaThemeService`):++- `Factor` — `InterfaceScale / 100.0`.+- `Set(int percent)` — normalises the value, then updates every registered window's+ transform, title-bar hint and scaled minimum size.+- `Register(Window)` — called by `NotaWindow` and `MainWindow`. The service holds a+ weak list and drops a window when it closes.++State transitions: `100 → any preset → any preset`, applied live. No intermediate+or animated states.diff --git a/specs/027-ui-scale/plan.md b/specs/027-ui-scale/plan.mdnew file mode 100644index 00000000..4afde57b--- /dev/null+++ b/specs/027-ui-scale/plan.md@@ -0,0 +1,168 @@+# Implementation Plan: App-wide Interface Scale++**Branch**: `027-ui-scale` | **Date**: 2026-10-19 | **Spec**: [spec.md](spec.md)++**Input**: Feature specification from `specs/027-ui-scale/spec.md` (issue nota-daw/nota#38)++## Summary++Add an **Interface scale** preference (75 / 100 / 125 / 150 / 200 %, default 100) to+Preferences → Appearance → UI. Avalonia has no app-wide scale, so each window's root+content is wrapped in a `LayoutTransformControl` with a uniform `ScaleTransform`,+driven by one static scale service. All popups (menus, tooltips, flyouts, dropdowns)+inherit the scale through Avalonia's own `Popup.InheritsTransform`, switched on+globally. Window minimums, default sizes and title-bar drag height are scaled and+capped at the screen. The native caption-button inset stays fixed on screen. UI-only;+no engine change. See [research.md](research.md).++## Nota: Read Before Planning++- **UI work** → [`DESIGN.md`](../../DESIGN.md) (Studio) and the `nota-design` skill —+ the new picker reuses the *Waveform* segmented picker.+- **Anything** → [`CONTRIBUTING.md`](../../CONTRIBUTING.md).++## Technical Context++**Language/Version**: C# / .NET 10 (managed app only)++**Primary Dependencies**: Avalonia 12.1.4 (existing) — `LayoutTransformControl`,+`ScaleTransform`, `Popup.InheritsTransform`. No new dependency.++**Storage**: `settings.json` via `Nota.Application.Settings` — new int `InterfaceScale`.++**Audio-Thread Impact**: None: UI-only change. No engine, C ABI or command-queue+changes.++**Testing**: Smoke test (`tests/Nota.SmokeTest`) gains a check of+`InterfaceScale.Normalize` / presets, next to the spec 011 Appearance checks in+`DesignTokenCheck.Themes.cs`. UI is validated by the [quickstart](quickstart.md)+(the real app or the headless Avalonia harness, with screenshots).++**Target Platform**: macOS, Windows, Linux desktop.++**Project Type**: desktop app.++**Performance Goals**: A scale switch redraws in < 1 s (SC-002). At 100 % the+transform is the identity, with no measurable cost.++**Constraints**: 100 % must render exactly as today. Text stays vector-sharp. Hit+areas follow the drawing.++**Scale/Scope**: 2 window roots (`MainWindow`, `NotaWindow` → 14 subclasses), every+popup via one global default, 1 Preferences row, 1 setting.++## Constitution Check++| Principle | Status |+|---|---|+| I. Real-time audio safety | ✅ No audio-thread code touched |+| II. Boundary discipline | ✅ No C ABI change; no JUCE |+| III. Licensing hygiene | ✅ No dependency; new files get the SPDX header |+| IV. Verification gate | ✅ `scripts/build.sh` + smoke check for the pure helper |+| V. One logical change | ✅ One feature, one PR |+| VI. Docs in sync | ✅ CHANGELOG `[Unreleased]` *Added*; `nota-features`, `nota-docs` (Preferences → Appearance page EN+RU) |+| VII. Spec-first | ✅ This spec/plan |+| VIII. No rule weakening | ✅ n/a |++Post-design re-check: unchanged — all pass.++## Design++### 1. Pure setting — `Nota.Application`++- `Settings.InterfaceScale` (int, default 100), doc comment in the style of+ `ArrangementWaveform`.+- New `InterfaceScale.cs`: `Presets = {75, 100, 125, 150, 200}`,+ `Normalize(int) → int` (non-preset → 100), `Factor(int) → double`.++### 2. Scale service — `Nota.App/Theme/NotaUiScale.cs` (new)++Static, mirroring `NotaThemeService`:+- `double Factor`, `void Set(int percent)`, `void Register(Window w, WindowScaleInfo)`.+- Per registered window it holds the window's `LayoutTransformControl`, its design+ minimum size, design title-bar height and the caption-inset element. On `Set`, it+ updates each window's `ScaleTransform`, sets `ExtendClientAreaTitleBarHeightHint =+ design × s` and `MinWidth/MinHeight = min(design × s, screen working area)`, grows+ the frame if it is now below the minimum (staying on screen), and sets the caption+ inset to `78 ÷ s` (macOS) or `180 ÷ s` (Windows).+- On first open it multiplies the design `Width`/`Height` by `s` (capped at the+ screen). It skips `SizeToContent` axes.+- Weak references; unregisters on `Closed`.+- At startup: `Popup.InheritsTransformProperty.OverrideDefaultValue<Popup>(true)`+ (research R2).++### 3. Window roots++- `NotaWindow`: wrap the existing root `DockPanel` in a `LayoutTransformControl`,+ register with the service, and hand it the caption-inset `Grid` margin and title-bar+ height.+- `MainWindow`: same for its root from `MainWindow.axaml` (wrap in code after+ `InitializeComponent`), with title bar 32, design size 1200×800 and minimum+ 1100×680.+- `SplashWindow`: untouched.++### 4. Startup++`App.OnFrameworkInitializationCompleted`: next to `NotaThemeService.Set(...)`, call+`NotaUiScale.Set(settings.Current.InterfaceScale)` before `new MainWindow`.++### 5. Preferences++`PreferencesWindow.AppearancePane()`, **UI** section: add the+`Row("Interface scale", ScalePicker())` and caption rows after *Waveform*, following+[contracts/ui-contract.md](contracts/ui-contract.md). `ScalePicker` is built like+`WaveformPicker`. On change: save the setting, then `NotaUiScale.Set`.++### 6. Docs++`CHANGELOG.md` `[Unreleased]` → Added: "Interface scale in Preferences → Appearance+(75–200 %) — makes the whole UI larger or smaller (#38)". `FEATURES.md` via+`nota-features`. The user manual Appearance page (EN+RU) via `nota-docs`.++## Project Structure++### Documentation (this feature)++```text+specs/027-ui-scale/+├── spec.md+├── plan.md+├── research.md+├── data-model.md+├── quickstart.md+├── contracts/ui-contract.md+├── checklists/requirements.md+└── tasks.md # /speckit-tasks+```++### Source Code++```text+src/managed/+├── Nota.Application/+│ ├── Settings.cs # + InterfaceScale+│ └── InterfaceScale.cs # NEW — presets + Normalize (pure)+└── Nota.App/+ ├── App.axaml.cs # apply scale at startup, popup default+ ├── NotaWindow.cs # wrap root, register+ ├── MainWindow.axaml.cs # wrap root, register+ ├── PreferencesWindow.cs # Interface scale row+ └── Theme/NotaUiScale.cs # NEW — scale service+tests/Nota.SmokeTest/+└── DesignTokenCheck.Themes.cs # + InterfaceScale checks (or a sibling file)+```++**Structure Decision**: The UI in this repo lives in `Nota.App` (not+`Nota.Presentation`), next to `Theme/NotaThemeService.cs`. The pure setting logic+goes in `Nota.Application`, like `Appearance.cs`.++## Risks++- **Seam softness at fractional scales** (R5) — accepted; checked in quickstart step 4.+- **Size jump on first show** (R4) — fallback described in research.+- **Layouts tighter than designed** at large scale on small screens — accepted by+ the spec edge case; window minimums capped at the screen.++## Complexity Tracking++None — no constitution violations.diff --git a/specs/027-ui-scale/quickstart.md b/specs/027-ui-scale/quickstart.mdnew file mode 100644index 00000000..5479e279--- /dev/null+++ b/specs/027-ui-scale/quickstart.md@@ -0,0 +1,37 @@+# Quickstart: Validate the Interface Scale++## Prerequisites++- `scripts/build.sh` passes (it builds native and managed code and runs the smoke+ test, which covers `InterfaceScale.Normalize`).+- Isolated data dir: `export NOTA_DATA_DIR=/tmp/uiscale-data` (see the+ nota-ui-verify recipe; `HOME` does not isolate JUCE).+- If the display is asleep or GUI launch is blocked, use the headless Avalonia harness+ (`AppBuilder…UseHeadless(new() { UseHeadlessDrawing = false })`,+ `CaptureRenderedFrame()`). Popups do not render headless, so build their content+ into a window for shots.++## Scenarios++1. **Default unchanged** — fresh data dir, launch. Preferences shows *Interface scale*+ = 100 %. Capture the main window and compare with a capture from `develop`: identical.+2. **Live change** (US1, FR-002/003) — open a project with a few tracks, a device+ detail window and the mixer. Pick 125 %, then 150 %, then 75 %. Every open window+ redraws at once. Transport, selection and playback continue. Text in the track+ header measures 1.25×, 1.5× and 0.75× of its 100 % height (SC-001).+3. **Popups** (US1 sc. 3) — at 150 %, open a context menu on a track, the main menu+ (Windows/Linux), a flyout, a combo box dropdown and a tooltip. Each is 1.5× and+ anchored to its target.+4. **Sharpness** (FR-007, R5) — zoom screenshots of text, knobs and 1 px seams at+ 75 / 125 / 150 / 200 %. Text is crisp. Note any seam softness at 125 % in the PR.+5. **Hit areas** (FR-004, US2 sc. 2) — at 75 % and 200 %, click a mute button,+ drag a knob, drag a clip and draw a note. Each responds where it is drawn.+6. **Content zoom** (US3) — at 150 %, zoom the arrangement and the piano roll around+ the cursor. The point under the cursor stays put, as at 100 %.+7. **Window limits** (R4, edge cases) — on a 1920×1080 screen at 150 %, the main+ window's minimum is 1650×1020. Its title bar drags, and the macOS traffic lights+ don't overlap the title. At 200 % the window still fits the screen.+8. **Persistence** (FR-005, SC-004) — set 125 %, quit, relaunch: opens at 125 % from+ the first frame. Edit `settings.json` to `"InterfaceScale": 130`, relaunch: 100 %.+9. **Audio untouched** (SC-005) — with playback running, switch the scale several+ times. No dropouts. CPU meter unchanged.diff --git a/specs/027-ui-scale/research.md b/specs/027-ui-scale/research.mdnew file mode 100644index 00000000..e9f4bdad--- /dev/null+++ b/specs/027-ui-scale/research.md@@ -0,0 +1,145 @@+# Research: App-wide Interface Scale++**Feature**: [spec.md](spec.md) · **Date**: 2026-10-19++All facts below were checked against Avalonia **12.1.4** (the version in+`Nota.App.csproj`) and the Nota sources on `develop` (bf354060).++## R1 — How to scale the whole UI++**Decision**: Wrap each window's root content in a `LayoutTransformControl` whose+`LayoutTransform` is a `ScaleTransform(s, s)`, with `s` coming from one app-wide+service. A layout transform (not a render transform) makes children measure and+arrange in *logical* space (window size ÷ s), so layouts reflow instead of being+stretched or clipped.++**Rationale**:+- Avalonia 12 has **no app-wide scale API**. `TopLevel.RenderScaling` and+ `WindowBase.DesktopScaling` are read-only and come from the platform+ (`ITopLevelImpl`, a private API we must not implement). `AVALONIA_GLOBAL_SCALE_FACTOR`+ exists only on X11 and needs a restart.+- `LayoutTransformControl` is a built-in control. Avalonia uses it for this exact+ purpose: the Fluent `PopupRoot` template wraps its whole content in one (see R2).+- Drawing stays vector: Skia gets the full transform, so text and paths are+ rasterised at the final size and stay sharp (FR-007). Nota has no+ `RenderTargetBitmap` caches. The one `WriteableBitmap` (Lens spectrogram) is a data+ image that is stretched at every scale anyway.+- Hit-testing and `TranslatePoint` go through the transform, so pointer hits land+ where things are drawn (FR-004). Drag and drop, the piano roll and the arrangement+ all use control-local coordinates.++**Alternatives considered**:+- *Multiply every size/font by a factor* — hundreds of hard-coded pixel values in+ custom-drawn views (`ArrangementView`, `PianoRollView`, device bodies). Rejected:+ huge and would never be complete.+- *Override platform render scaling* (custom `IWindowImpl` wrapper) — private,+ unstable API, per-platform. Rejected.+- *A `RenderTransform` on the root* — content would not reflow; at 200 % it would+ draw off-window. Rejected.++## R2 — Menus, tooltips, flyouts, dropdowns++**Decision**: At startup, call+`Popup.InheritsTransformProperty.OverrideDefaultValue<Popup>(true)`.++**Rationale**: Every popup in Avalonia — `ToolTip`, `ContextMenu`, `PopupFlyoutBase`+(`MenuFlyout`, `Flyout`) and the `ComboBox` template's `PART_Popup` — is a `Popup` that+opens a separate `PopupRoot` window (Nota does not use overlay popups). In 12.1.4,+`Popup.UpdateHostSizing` computes the placement target's scale against its top level+when `InheritsTransform` is true. It then sets `PopupRoot.Transform`, and the Fluent+`PopupRoot` template binds that to its own `LayoutTransformControl`. Explicit popup+`Width`/`MinWidth` are scaled too. ToolTip, ContextMenu and the flyouts create their+`Popup` in code, so a style setter would not reach them reliably; overriding the+property's default does. Popups follow the scale of whatever opened them. No+per-popup code is needed, and a later scale change applies on the next open.++**Alternatives considered**: a global `Style Selector="Popup"` (misses popups created+in code before they join a styled tree); wrapping every flyout's content by hand (88+files use tooltips, 47 use flyouts). Rejected.++## R3 — Where the window transform lives++**Decision**: In code, in the two window roots: `NotaWindow` (14 subclasses:+Preferences, Detail, Device, Mixer, Confirm, Export, …) and `MainWindow`. Each wraps+its existing root panel in a `LayoutTransformControl` and registers with the scale+service. The service updates the transform of every live window when the scale+changes. `SplashWindow` is left alone: it shows before settings load (spec edge case).++**Rationale**: Nota builds windows in code; the two roots already own the body host+and the custom title bar. Keeping the change there means no `Window` control-theme+override, so Fluent updates keep working. The window's `VisualLayerManager`+(adorners, overlay layer) stays outside the transform. Nota uses neither adorners nor+overlay popups, and Avalonia's `AdornerLayer` follows its adorned element's+transform.++## R4 — Window frame, title bar and minimum size++**Decisions**:+1. **Frame size is in screen units.** A live scale change keeps every open window's+ on-screen size; contents reflow (logical size = frame ÷ s).+2. **Minimums scale.** A window's design minimum (for example `MainWindow`+ `MinWidth=1100`/`MinHeight=680`, `DetailWindow` 520×400) is logical. The applied+ minimum is `design × s`, capped at the current screen's working area. If the frame+ is then smaller than the new minimum, it grows, staying on screen.+3. **Default sizes of new windows scale.** A window's design `Width`/`Height` (for+ example `MainWindow` 1200×800) is multiplied by `s` the first time it opens, and+ capped at the screen. `SizeToContent` windows need nothing: the transform reports+ the scaled desired size. Nota stores no window sizes in settings, so nothing is+ scaled twice.+ **Exception (convergence T028):** a window the user cannot resize (`CanResize = false`+ — About, Welcome, What's New, Export, Confirm, …) would clip its content on a live+ scale-up, and the user could not fix it. Its frame follows the scale instead:+ `design size × s`, capped at the screen, except for axes sized to content.+4. **Title bar.** `ExtendClientAreaTitleBarHeightHint` (32, or the device window's+ own height) becomes `design × s`, so the drag area matches the scaled bar. The+ reserved inset for the native caption buttons stays fixed on screen, because the+ OS draws them at system size: macOS traffic lights 78 px → `78 ÷ s` logical,+ Windows caption buttons 180 px → `180 ÷ s` logical. Linux keeps the native frame;+ nothing to adjust.++**Rationale**: SC-003 and the "window bigger than screen" edge case. Capping at the+working area is why 200 % on a small screen still fits (spec edge case).++**Risk**: setting design sizes before the first show. `NotaWindow` subclasses set+`Width`/`MinWidth` in their own constructors, *after* the base constructor. Apply the+scaling in `OnOpened`-adjacent code that runs before the native window is visible+(`Window.ShowCore` runs the initial layout pass, and with it+`OnApplyTemplate`/`TemplateApplied`, before `PlatformImpl.Show`). If a visible jump+shows up, fall back to wrapping the constructor values through a small+`DesignSize(...)` helper the subclasses call.++## R5 — Hairlines and pixel snapping++**Finding**: `UseLayoutRounding` rounds to device pixels using the *top level's*+render scaling. It does not see a `LayoutTransformControl`, so inside a 125 % transform+a 1 px Studio seam is 1.25 device px and can look slightly soft or uneven. That is+inherent to transform scaling. Nota's custom-drawn views do their own snapping+(~99 `+ 0.5`/snap sites) in logical units.++**Decision**: Accept for this feature and check visually at 75 / 125 / 150 %+(quickstart step 4). 100 % must be pixel-identical to today (s = 1 → identity+transform). If seams at 125 % are clearly worse, a follow-up can make the shared+snapping helpers scale-aware. That is not in this scope.++## R6 — Storage and validation++**Decision**: A new `int InterfaceScale { get; set; } = 100` in+`Nota.Application.Settings` (percent; `settings.json` key `InterfaceScale`). A pure+helper `Nota.Application.InterfaceScale` holds the preset list `{75, 100, 125, 150,+200}` and `Normalize(int)` → the stored value if it is a preset, else 100 (FR-008).+It follows the spec 011 `Appearance` pattern: no UI, no I/O, covered by the smoke test.++**Rationale**: Percent integers are exact (no float drift in JSON) and read naturally+in the file. Presets only, per spec assumption.++## R7 — Applying before the first frame++**Decision**: `App.OnFrameworkInitializationCompleted` already resolves the colour+theme from settings before creating `MainWindow` (`NotaThemeService.Set(...)`). Set+the scale service from settings at the same point, so the main window opens at the+stored scale (FR-005).++## R8 — Audio thread++None. This is a UI-only change; the engine, the C ABI and the smoke-test engine paths+are untouched (FR-009, SC-005).diff --git a/specs/027-ui-scale/spec.md b/specs/027-ui-scale/spec.mdnew file mode 100644index 00000000..53045cbe--- /dev/null+++ b/specs/027-ui-scale/spec.md@@ -0,0 +1,194 @@+# Feature Specification: App-wide Interface Scale++**Feature Branch**: `027-ui-scale`++**Created**: 2026-10-19++**Status**: Draft++**Input**: User description: "App-wide UI scale setting in Preferences (GitHub issue nota-daw/nota#38: "UI scaling / font size setting — text too small to read on a 17" laptop"). Add a global interface scale with presets 75 / 100 / 125 / 150 / 200 % (75% added on top of the issue's list, for users who want more content on small/low-res screens). Currently Nota has no app-wide scale: only the timeline, piano roll and audio editor zoom their own content. The setting persists across launches and applies to the whole UI."++## Nota Context *(fill in — drives plan and tasks)*++**Feature area** *(pick the main one)*:++- [ ] Engine (C++, `src/native/nota.engine`) — real-time audio rules apply, see `ARCHITECTURE.md` AR table+- [ ] Managed app (C#, `src/managed/*`) — domain, application, infrastructure, presentation+- [x] UI (Avalonia, `src/managed/Nota.Presentation`) — follow `DESIGN.md` (Studio)+- [ ] Plugin hosting (`pluginhost/`) — the only place JUCE is allowed+- [ ] Build / packaging / CI (`scripts/`, `.github/`) — see `BUILD.md`+- [ ] Docs only++**Nota docs to keep in mind** *(links relative to `specs/<slug>/`, where this file lands)*:+[`ARCHITECTURE.md`](../../ARCHITECTURE.md) (AR rules),+[`CONTRIBUTING.md`](../../CONTRIBUTING.md) (licensing, dependency policy, PR+expectations), [`BUILD.md`](../../BUILD.md), [`DESIGN.md`](../../DESIGN.md),+[`FEATURES.md`](../../FEATURES.md).++**Source**: GitHub issue [nota-daw/nota#38](https://github.com/nota-daw/nota/issues/38)+(labels: accessibility, enhancement). A user on a 17" laptop finds the whole UI small+and some text unreadable. Exact resolution and OS display scaling were not reported.++**Current state (for reference)**:++- Nota has no app-wide scale. Everything is drawn at one fixed size, multiplied only+ by the operating system's display scaling.+- Only the timeline (arrangement), the piano roll and the audio editor zoom — and they+ zoom their *content* (time and pitch), not the interface around it.+- Preferences → Appearance has a **UI** section with *Colour theme* and *Waveform*.+ This feature adds its third row there.++## User Scenarios & Testing *(mandatory)*++### User Story 1 - Make the whole interface bigger (Priority: P1)++A producer on a 17" laptop finds Nota's text too small to read. They open+Preferences → Appearance and set **Interface scale** to 125 %. Every window — main+window, Preferences, device detail windows, dialogs, menus, tooltips — redraws larger+at once: text, buttons, knobs, track headers, device cards, spacing. Nothing is cut+off and nothing overlaps. They quit and relaunch; Nota opens at 125 %.++**Why this priority**: This is the issue. It makes Nota usable for this user.++**Independent Test**: With a project open, switch the scale to 150 % and check that+every surface grows in proportion and stays usable. Relaunch and confirm the scale+is kept.++**Acceptance Scenarios**:++1. **Given** Nota at 100 %, **When** the user picks 125 % in Preferences → Appearance,+ **Then** every open Nota window redraws at 1.25× size without a restart, and the+ project, playback and selection are untouched.+2. **Given** Nota at 150 %, **When** the user quits and relaunches, **Then** Nota opens+ at 150 % from the first frame of the main window.+3. **Given** Nota at 200 %, **When** the user opens a menu, a context menu, a tooltip+ or a dialog, **Then** it appears at 200 % too.+4. **Given** Nota at 200 % on a window smaller than its content, **When** the user+ works normally, **Then** panels that already scroll or fold keep doing so and every+ control can still be reached.++---++### User Story 2 - Fit more on a small screen (Priority: P2)++A producer on a low-resolution or small screen wants to see more tracks and more of+the device chain at once. They set the scale to **75 %**. Everything draws smaller,+so more fits in the same window, and text stays sharp.++**Why this priority**: Added on top of the issue at the maintainer's request; the+same control serves both directions, so it costs little.++**Independent Test**: Set 75 %, compare how many tracks and device cards fit in the+same window size with 100 %.++**Acceptance Scenarios**:++1. **Given** Nota at 100 %, **When** the user picks 75 %, **Then** every window+ redraws at 0.75× and more content fits on screen.+2. **Given** Nota at 75 %, **When** the user hovers or clicks any control, **Then**+ it responds exactly where it is drawn.++---++### User Story 3 - Content zoom still works on top (Priority: P3)++The user has the interface at 150 % and zooms the arrangement and the piano roll as+before. The content zoom works the same; the interface scale multiplies it.++**Why this priority**: Existing behaviour that must not break.++**Independent Test**: At 150 %, zoom the arrangement, piano roll and audio editor in+and out; zoom level and the point under the cursor behave as at 100 %.++**Acceptance Scenarios**:++1. **Given** the interface at 150 %, **When** the user zooms the arrangement with the+ usual gesture, **Then** it zooms around the same point as at 100 %.+2. **Given** a project saved at 100 %, **When** it is opened at 200 %, **Then** its+ content zoom levels are the same; only the interface is larger.++### Edge Cases++- **Main window bigger than the screen after scaling up**: the window is kept within+ the screen it is on (resized to fit); nothing ends up off-screen. Open windows keep+ their on-screen size when the scale changes; their contents reflow.+- **Scale too large for the screen** (e.g. 200 % on a 1440 × 900 screen): the window's+ minimum size is capped at the screen, so the window still fits; parts of the layout+ may then be tighter than designed. The setting stays available — the user chose it.+- **Remembered window sizes and panel widths** (track list, browser, detail windows):+ they keep their *logical* size, so at 200 % a remembered panel is twice as wide on+ screen. If that no longer fits, the existing minimum/maximum rules apply.+- **Third-party plugin editor windows** are drawn by the plugin and are not scaled by+ this setting.+- **Nota Remote** (the phone web UI) is not affected.+- **Exported images, audio and project files** do not depend on the scale.+- **OS display scaling** keeps working; Nota's scale multiplies it (150 % OS × 125 %+ Nota = 187.5 % overall).+- **Settings file with an unknown or invalid scale value** (edited by hand, or from a+ newer version): Nota uses 100 %.+- **Splash screen** shows before settings load and may stay at 100 %.++## Requirements *(mandatory)*++### Functional Requirements++- **FR-001**: Preferences → Appearance → UI MUST offer an **Interface scale** setting+ with exactly these presets: 75 %, 100 %, 125 %, 150 %, 200 %. The default is 100 %.+- **FR-002**: Changing the scale MUST apply at once to every open Nota window, without+ a restart and without changing the project, transport or selection.+- **FR-003**: The scale MUST apply to the whole Nota interface: text, icons, controls,+ custom-drawn views (arrangement, mixer, piano roll, device cards, meters, graphs),+ spacing and hit areas; menus, context menus, tooltips, popups and dialogs; windows+ opened after the change.+- **FR-004**: Everything MUST stay in proportion — no clipped text, no controls+ overlapping, and pointer hits landing where controls are drawn — at every preset.+- **FR-005**: The scale MUST persist across launches and be applied before the main+ window first appears.+- **FR-006**: The existing content zooms (arrangement, piano roll, audio editor) MUST+ keep working unchanged on top of the interface scale.+- **FR-007**: Text and lines MUST stay sharp at every preset (drawn at the final size,+ not stretched from a bitmap).+- **FR-008**: An unknown or invalid stored value MUST fall back to 100 %.+- **FR-009**: The setting MUST NOT affect audio, the engine, project files, exports,+ Nota Remote or third-party plugin editors.++### Key Entities++- **Interface scale**: one app-wide user preference; one of 75 / 100 / 125 / 150 /+ 200 %. Stored with the other Appearance preferences, not in the project.++## Success Criteria *(mandatory)*++### Measurable Outcomes++- **SC-001**: At 125 % the smallest text in the main window is 1.25× its 100 % size;+ at 200 % it is 2×; at 75 % it is 0.75×.+- **SC-002**: Switching the scale takes effect in under 1 second, with no restart.+- **SC-003**: At every preset whose scaled minimum window size fits the screen (on a+ 1920 × 1080 screen: 75–150 %), the user can reach and operate every control in the+ main window, Preferences and a device detail window — none is clipped beyond reach.+ Larger presets on a smaller screen keep the window on screen and every menu usable.+- **SC-004**: The chosen scale is the one in use after 10 out of 10 relaunches.+- **SC-005**: Audio and CPU load do not change when the scale changes.++## Assumptions++- A single global scale answers the issue; a separate font-size setting is out of+ scope (the issue says "and/or"; global scale grows text and controls together and+ keeps layouts balanced).+- Presets only — no free slider or custom value; the five presets cover the reported+ need and keep the layouts testable.+- No keyboard shortcut for the scale in this feature (Cmd/Ctrl +/- are left to the+ content zooms); it can be added later through the shortcut system.+- The control follows the existing picker style in the Appearance pane (DESIGN.md,+ Studio).++## Nota Compliance Checklist *(review before implementation; re-check in tasks.md)*++- [ ] Every new source file will carry the AGPL-3.0-only SPDX header (two lines, see CONTRIBUTING.md)+- [ ] No new dependency — or: license checked, AGPL-compatible, `LICENSES/third-party.md` row planned+- [ ] Audio-thread impact considered: no alloc / lock / I/O on the audio thread (AR-6), command queue for data in (AR-4), immutable snapshots for structural edits (AR-5)+- [ ] Managed/native crossings go through the pure C ABI in `nota_engine.h` only (AR-7); no JUCE outside `pluginhost/`+- [ ] Smoke-test impact assessed: engine behaviour change → extend `tests/Nota.SmokeTest`+- [ ] User-visible change → `CHANGELOG.md` `[Unreleased]` entry planned (and FEATURES.md / user docs via the nota-features / nota-docs skills when working with an agent that has them)+- [ ] UI change → follows `DESIGN.md` (Studio design language)diff --git a/specs/027-ui-scale/tasks.md b/specs/027-ui-scale/tasks.mdnew file mode 100644index 00000000..1981ba54--- /dev/null+++ b/specs/027-ui-scale/tasks.md@@ -0,0 +1,164 @@+---++description: "Tasks for the app-wide interface scale (spec 027, issue nota-daw/nota#38)"+---++# Tasks: App-wide Interface Scale++**Input**: Design documents from `specs/027-ui-scale/`++**Prerequisites**: [plan.md](plan.md), [spec.md](spec.md), [research.md](research.md),+[data-model.md](data-model.md), [contracts/ui-contract.md](contracts/ui-contract.md),+[quickstart.md](quickstart.md)++**Tests**: The spec asks for no new test suites. The only automated check is a smoke+check of the pure `InterfaceScale` helper, following spec 011's `Appearance` checks.+The UI is validated through [quickstart.md](quickstart.md).++**Organization**: Tasks are grouped by user story. US2 (75 %) and US3 (content zoom)+reuse US1's mechanism. Their phases cover what is specific to them and how to verify it.++## Format: `[ID] [P?] [Story] Description`++- **[P]**: Can run in parallel (different files, no dependencies)+- **[Story]**: US1 / US2 / US3 from spec.md++---++## Phase 1: Setup++- [X] T001 Create the git branch `feat/ui-scale` from `develop` (spec dir `specs/027-ui-scale/`); confirm `dotnet build src/managed/Nota.App/Nota.App.csproj` is green before any change++---++## Phase 2: Foundational (blocks all stories)++- [X] T002 [P] Add `public int InterfaceScale { get; set; } = 100;` to `src/managed/Nota.Application/Settings.cs` with a doc comment in the style of `ArrangementWaveform` ("Interface scale in percent (Settings → Appearance), one of 75 / 100 / 125 / 150 / 200; anything else reads as 100 — spec 027")+- [X] T003 [P] Create `src/managed/Nota.Application/InterfaceScale.cs` (SPDX header + why-comment): `public static class InterfaceScale` with `IReadOnlyList<int> Presets = {75, 100, 125, 150, 200}`, `const int Default = 100`, `int Normalize(int percent)` (returns the value if it is in `Presets`, else `100`) and `double Factor(int percent) => Normalize(percent) / 100.0`. Pure: no UI, no I/O+- [X] T004 Add smoke checks for `InterfaceScale` next to the Appearance checks in `tests/Nota.SmokeTest/DesignTokenCheck.Themes.cs`, or in a sibling `DesignTokenCheck.Scale.cs` hooked up the same way. Every preset normalises to itself; `0`, `-100`, `130`, `300` and `int.MaxValue` normalise to `100`; `Factor(125) == 1.25`; a default `Settings` has `InterfaceScale == 100` (depends on T002, T003)+- [X] T005 Create the scale service `src/managed/Nota.App/Theme/NotaUiScale.cs` (SPDX header; internal static, modelled on `NotaThemeService`):+ - state: `int Percent`, `double Factor`+ - `Set(int percent)` normalises via `InterfaceScale.Normalize` and, if changed, re-applies every registered window (T006)+ - `Register(Window window, LayoutTransformControl root, Size designMin, double designTitleBar, Action<double>? setCaptionInset)` stores a weak entry, unregisters on `window.Closed`, and applies the current factor at once+ - `InitPopups()` calls `Popup.InheritsTransformProperty.OverrideDefaultValue<Popup>(true)` exactly once (research R2) — *Done: popups via an app-wide `Popup { InheritsTransform = true }` style; `OverrideDefaultValue<Popup>` throws (Popup owns that metadata). Closed windows unregister (`Windows.Remove` on `Closed`).*+- [X] T006 Implement the per-window apply in `NotaUiScale` (research R4), for factor `s`:+ - `root.LayoutTransform = new ScaleTransform(s, s)` (reuse one transform per window, set `ScaleX/ScaleY`)+ - if `ExtendClientAreaToDecorationsHint`: `ExtendClientAreaTitleBarHeightHint = designTitleBar * s`+ - `setCaptionInset?.Invoke(s)`+ - `MinWidth/MinHeight = min(designMin * s, screen.WorkingArea / DesktopScaling)` using `window.Screens.ScreenFromWindow(window) ?? Screens.Primary`+ - if the frame is now below the minimum, grow it and keep it inside the working area. Open windows otherwise keep their on-screen size+- [X] T007 Implement the first-open size scaling in `NotaUiScale`: on a window's first open, before the native show if possible (template applied / initial layout, research R4), multiply the design `Width`/`Height` by `s`. Skip any axis covered by `SizeToContent` and NaN sizes, and cap at the working area. Check for a visible jump on show; if there is one, use the research fallback (a `DesignSize` helper the subclasses call) — *Done via `Window.WindowOpenedEvent`, raised at the start of `ShowCore` before sizes are read: no jump, no fallback needed.*++**Checkpoint**: The helper and the service compile; the smoke test is green.++---++## Phase 3: User Story 1 — Make the whole interface bigger (P1) 🎯 MVP++**Goal**: The user picks 125 / 150 / 200 % in Preferences. Every window and popup+grows at once, and the choice survives a relaunch.++**Independent Test**: [quickstart.md](quickstart.md) scenarios 1, 2, 3, 7, 8.++- [X] T008 [US1] In `src/managed/Nota.App/NotaWindow.cs`, wrap the existing root `DockPanel` in a `LayoutTransformControl`, set it as the window content, and call `NotaUiScale.Register(...)`:+ - design min: read the subclass's `MinWidth/MinHeight` at first open, since subclasses set them after the base constructor+ - design title bar: `32`, or `ownTitleBarHeight`+ - caption inset: a callback that sets the title-row `Grid.Margin`/first column so the macOS traffic-light column is `78 / s` and the Windows right margin is `180 / s` (logical), staying fixed on screen+ - Linux: no title-bar or inset changes (native frame)+- [X] T009 [US1] In `src/managed/Nota.App/MainWindow.axaml.cs`, after `InitializeComponent`, move the XAML root content into a `LayoutTransformControl` and register it:+ - design min `1100×680`, design size `1200×800`, title bar `32`+ - caption inset callback for the custom `TitleBar` in `MainWindow.axaml`, with the same `78 / s` / `180 / s` rule as T008. Check how `MainWindow.axaml` reserves the traffic-light and caption space and adjust that element+- [X] T010 [US1] In `src/managed/Nota.App/App.axaml.cs` `OnFrameworkInitializationCompleted`, next to `NotaThemeService.Set(...)` and before `new MainWindow`, call `NotaUiScale.InitPopups()` and `NotaUiScale.Set(settings.Current.InterfaceScale)` (FR-005). Leave `SplashWindow` unscaled+- [X] T011 [US1] In `src/managed/Nota.App/PreferencesWindow.cs` `AppearancePane()`, **UI** section: after the *Waveform* rows, add `Row("Interface scale", ScalePicker())` and `Row("", Caption("Makes the whole interface larger or smaller. Timeline, piano roll and audio editor zoom work on top of it."))`. Add `ScalePicker()`, built like `WaveformPicker()`, with segments from `InterfaceScale.Presets` labelled `"75 %"`… (match the existing `%` formatting in `Theme/NotaNum.cs` if it has one). Selection = `InterfaceScale.Normalize(settings.Current.InterfaceScale)`; on pick, set `settings.Current.InterfaceScale`, save the way the Waveform picker saves, then `NotaUiScale.Set(p)`. Follow [contracts/ui-contract.md](contracts/ui-contract.md) and DESIGN.md (accent on the selected segment only)+- [X] T012 [US1] Fix any window that sets its size in screen terms after showing, so it uses logical sizes that T006/T007 can scale. Sweep `src/managed/Nota.App/*Window*.cs` for `Width =`, `Height =`, `MinWidth =`, `MinHeight =`, `Position =` and `Screens.` — e.g. `MixerWindow.cs:94-102` clamps `Position` against the screen using a pixel width `px`, which must account for the frame. Change only what is wrong at s ≠ 1 — *Only `MixerWindow.FitWidth` needed a fix (strips × factor once visible; design units before the first show). Device/Mixer title-row insets now use `NotaWindow.CaptionPadding(s)`.*+- [X] T013 [US1] Validate US1 with quickstart scenarios 1, 2, 3, 7, 8 (real app, or the headless harness per the nota-ui-verify recipe with `NOTA_DATA_DIR`). Capture main window, Preferences and device detail window at 100 / 125 / 150 / 200 %. Confirm 100 % is identical to `develop` — *Headless harness: title bar 32 → 40/48/64/24 on screen at 125/150/200/75, live; minimums scale; context menu 104×90 → 156×135 at 150 %; picker click applies and saves. Real-desktop PopupRoot path checked only via `InheritsTransform == true` on ContextMenu/ToolTip popups.*++**Checkpoint**: US1 complete; it alone resolves issue #38.++---++## Phase 4: User Story 2 — Fit more on a small screen (75 %) (P2)++**Goal**: 75 % shrinks everything, more content fits, and controls hit where drawn.++**Independent Test**: [quickstart.md](quickstart.md) scenarios 2 (75 %), 4, 5.++- [ ] T014 [US2] At 75 %, verify on macOS that the title text and toolbar content do not slide under the traffic lights, and on Windows that they do not slide under the caption buttons. The inset from T008/T009 must stay fixed on screen. Also check that the title-bar drag area is `32 × 0.75` and still drags. Fix in `NotaWindow.cs` / `MainWindow.axaml.cs` if not — *Open: inset logic in place, not yet seen on a real macOS/Windows window.*+- [ ] T015 [US2] At 75 % and 200 %, run hit-area checks (quickstart 5): mute button, knob drag, clip drag, note draw, browser drag-and-drop onto the arrangement. Fix any handler that mixes screen and control coordinates (search `src/managed/Nota.App` for `PointToScreen`, `Screens.`, `DesktopScaling`, `RenderScaling`) — *Code sweep clean (no window/screen-space pointer math in Nota.App); live pointer checks at 75/200 % still open.*+- [X] T016 [US2] Sharpness check (quickstart 4) at 75 / 125 / 150 %: zoomed captures of text, knobs and 1 px seams. Record the result in the PR description (research R5); no snapping changes in this feature — *Headless shots at 75/150 %: text crisp. 125 % seams not zoom-inspected.*++**Checkpoint**: US1 + US2 work.++---++## Phase 5: User Story 3 — Content zoom still works on top (P3)++**Goal**: Arrangement, piano roll and audio editor zoom behave as at 100 %.++**Independent Test**: [quickstart.md](quickstart.md) scenario 6.++- [ ] T017 [US3] At 150 %, zoom the arrangement (`ArrangementView*.cs`), piano roll (`PianoRollView.cs`, vertical zoom from spec 019) and audio editor (`AudioClipEditorView.cs`) around the cursor. The anchor point stays under the cursor. Fix any zoom math that uses window or screen pixels instead of control-local coordinates — *Code review only (zoom handlers use control-local positions); live check open.*+- [X] T018 [US3] Confirm the scale is not written to project files: save a project at 150 %, open it at 100 %, and check that the content zoom levels are identical (spec US3 sc. 2). Read-only check; nothing in `Nota.Infrastructure/Persistence` should change — *By construction: the scale is in settings.json only.*++**Checkpoint**: All stories functional.++---++## Phase 6: Polish & Cross-Cutting++- [ ] T019 Run quickstart scenario 9 (switch the scale during playback: no dropouts, CPU meter unchanged) — *Open: needs the real app with audio.*+- [X] T020 [P] `CHANGELOG.md` `[Unreleased]` → *Added*: "Interface scale in Preferences → Appearance (75 / 100 / 125 / 150 / 200 %) — makes the whole interface larger or smaller (#38)."+- [X] T021 [P] FEATURES.md via the `nota-features` skill+- [X] T022 [P] User docs (Preferences → Appearance page, EN + RU) via the `nota-docs` skill in `../nota-docs` — *EN + RU `preferences/appearance` + coverage.yml; screenshot retaken; `npm run build` / `check` green. Page subtitle now "Theme, scale, waveforms and AI control".*++### Nota closing tasks++- [X] T023 Run `scripts/build.sh` until native + managed + smoke test are green — *First run failed two engine timing budgets under load average ~40; smoke test alone re-run: PASSED.*+- [X] T024 AGPL-3.0-only SPDX two-line header on `InterfaceScale.cs`, `NotaUiScale.cs` (and `DesignTokenCheck.Scale.cs` if created)+- [X] T025 New dependency: N/A (Avalonia already present)+- [X] T026 Shortcuts: N/A (no new binding, per spec assumption)+- [X] T027 Engine behaviour change: N/A (UI-only; the smoke test still gains the helper check from T004)++---++## Dependencies & Execution Order++- **Phase 1 → Phase 2 → US1 → (US2, US3) → Polish.**+- T002 ∥ T003; T004 needs both. T005 → T006 → T007.+- US1: T008, T009, T010 and T011 touch different files and can run in parallel once+ T005–T007 are done. T012 follows T008/T009; T013 comes last.+- US2 and US3 depend only on US1. They can run in parallel with each other+ (different files, except shared window-root fixes in T014).+- Polish T020–T022 [P] are independent docs; T023 runs last.++## Parallel Example++```text+After T007:+ T008 NotaWindow.cs+ T009 MainWindow.axaml.cs+ T010 App.axaml.cs+ T011 PreferencesWindow.cs+```++## Implementation Strategy++1. **MVP**: Phases 1–3 (US1). This resolves issue #38 for 125–200 %, and 75 % works+ through the same picker.+2. Then US2 checks (75 % chrome and hit areas), then US3 checks (content zoom).+3. Polish + docs, `scripts/build.sh`, `/speckit-converge` before the PR.++---++## Phase 7: Convergence++- [X] T028 In `src/managed/Nota.App/Theme/NotaUiScale.cs`, capture each window's design `Width`/`Height` on first open; on a live scale change, re-apply `design × s` (capped at the working area, skipping `SizeToContent` axes) to windows with `CanResize = false` (About, Welcome, What's New, Export, Confirm, Tag editor, Text prompt, Save changes, Progress), so a fixed dialog never clips its content. Note the exception to "open windows keep their on-screen size" in research.md R4 per US1/AC4, FR-004, SC-003 (partial) — *Done: `NotaUiScale.SetFixedSize`; headless: About 380×348 → 570×522 live at 150 %, 285×261 at 75 %.*+- [X] T029 Give `src/managed/Nota.App/PreferencesWindow.cs` a design `MinWidth`/`MinHeight` that fits the widest page (the Appearance colour-theme row and cards), so its minimum grows with the scale and no control is clipped after a live switch to 150 / 200 %; verify with the headless harness (`prefs-clicked-150`) per US1/AC4, SC-003 (partial) — *Done: design minimum 800×480; headless: after clicking 150 % the open Settings window grows to 1200×720, nothing clipped.*+- [X] T030 Rebuild the `DeviceWindow` title row on `NotaUiScale.Changed` (while the window is open) so the preset-picker placement re-evaluates against the new `CaptionPadding` per plan §2 caption inset, US2 (partial) — *Done: `DeviceWindow` calls `Refill` on `NotaUiScale.Changed` while open (compile-verified; not exercised headless).*+- [X] T031 Record the Appearance page subtitle "Theme, scale, waveforms and AI control" in `specs/027-ui-scale/contracts/ui-contract.md` (or revert it in `PreferencesWindow.cs`) per contracts/ui-contract.md (unrequested) — *Done: recorded in contracts/ui-contract.md (with the 800×480 minimum); research.md R4 notes the fixed-window exception.*++---++## Phase 8: Convergence++- [X] T032 On an idle machine, re-run `scripts/build.sh` on the current tree (after T028–T031) until native + managed + smoke test are green; the two runs after T028–T031 failed only engine timing/background checks (Pentad/Consort/Keys stress, render speed, Chamber previews, bg warp) under load average 8–40. If a failure repeats when the machine is idle, investigate it before the PR per Constitution IV, T023 (partial) — *Done: after rebasing onto develop de96d1de, `scripts/build.sh` green at load average ~4 (SMOKE TEST PASSED, 3694 checks).*diff --git a/src/managed/Nota.App/App.axaml.cs b/src/managed/Nota.App/App.axaml.csindex db53d05a..4a0575c2 100644--- a/src/managed/Nota.App/App.axaml.cs+++ b/src/managed/Nota.App/App.axaml.cs@@ -97,6 +97,10 @@ public partial class App : Avalonia.Application// settings resolve onto the Studio themes (Appearance.Resolve).foreach (var err in NotaThemes.LoadErrors) log.Error($"Colour theme skipped — {err}", null);NotaThemeService.Set(Appearance.Resolve(Services.GetRequiredService<ISettingsService>().Current, NotaThemeService.KnownThemes));+ // Interface scale (spec 027), likewise before the first window: windows and every+ // popup they open take it from here.+ NotaUiScale.InitPopups();+ NotaUiScale.Set(Services.GetRequiredService<ISettingsService>().Current.InterfaceScale);// Nota Mosaic's samples resolve against the Samples and data folders; installed sample// packs get their Mosaic presets in the background (once per pack version).diff --git a/src/managed/Nota.App/DeviceWindow.cs b/src/managed/Nota.App/DeviceWindow.csindex 293c0de9..f7b8b4cd 100644--- a/src/managed/Nota.App/DeviceWindow.cs+++ b/src/managed/Nota.App/DeviceWindow.cs@@ -45,10 +45,6 @@ internal sealed class DeviceWindow : NotaWindow{public const double BarH = 32, RowH = 30, StatusH = 22, PickerW = 188, PickerH = 22;private const double Gap = 10, NameMin = 90; // the least the name · track keeps in the title row- // Room the OS window buttons take in the title row: the macOS traffic lights (left) and- // the Windows caption buttons (3 × 46, right). Linux draws its frame above the window.- private static readonly double LeftInset = !NativeFrame && OperatingSystem.IsMacOS() ? 76 : 12;- private static readonly double RightInset = !NativeFrame && OperatingSystem.IsWindows() ? 8 + 138 : 8;/// <summary>The track whose chain this device sits in — the command palette's target (CP-3).</summary>public int ContextTrackId { get; set; } = -1;@@ -82,8 +78,10 @@ internal sealed class DeviceWindow : NotaWindowWindowStartupLocation = WindowStartupLocation.CenterOwner;_timer.Tick += (_, _) => Tick();- Opened += (_, _) => _timer.Start();- Closed += (_, _) => _timer.Stop();+ Opened += (_, _) => { _timer.Start(); NotaUiScale.Changed += Refill; };+ Closed += (_, _) => { _timer.Stop(); NotaUiScale.Changed -= Refill; };+ // (Refill on a scale change: whether the preset picker fits in the title row depends+ // on the room the OS window buttons take, which is fixed on screen — spec 027.)Refill();}@@ -128,7 +126,8 @@ internal sealed class DeviceWindow : NotaWindowdouble w = double.IsNaN(page.BodyWidth) ? 0 : page.BodyWidth;double presetW = page.Presets is null ? 0 : PickerW + Gap;double togglesW = (page.Size is null ? 0 : 34 + Gap) + (_bypass is null ? 0 : 26 + Gap);- double free = Math.Max(w, 260) - LeftInset - RightInset;+ var inset = CaptionPadding(NotaUiScale.Factor); // the OS window buttons' room+ double free = Math.Max(w, 260) - inset.Left - inset.Right;// Mini bodies (under 400) always drop the picker to its own row, as does a title// row the window buttons leave too little of.bool presetInBar = page.Presets is null || (w >= 400 && free - presetW - togglesW >= NameMin);@@ -188,8 +187,9 @@ internal sealed class DeviceWindow : NotaWindowvar bar = new Border{Height = BarH, Background = NotaPalette.Panel, BorderBrush = NotaPalette.GraphBorder,- BorderThickness = new Thickness(0, 0, 0, 1), Padding = new Thickness(LeftInset, 0, RightInset, 0), Child = grid,+ BorderThickness = new Thickness(0, 0, 0, 1), Child = grid,};+ NotaUiScale.Track(bar, s => bar.Padding = CaptionPadding(s));if (!NativeFrame) bar.PointerPressed += OnChromePressed;return bar;}diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.csindex b25bf1b6..99d84f71 100644--- a/src/managed/Nota.App/MainWindow.axaml.cs+++ b/src/managed/Nota.App/MainWindow.axaml.cs@@ -102,6 +102,18 @@ public partial class MainWindow : WindowExtendClientAreaToDecorationsHint = true;ExtendClientAreaTitleBarHeightHint = 32;}+ // The whole window sits under the interface scale (spec 027); the OS window buttons+ // stay system-size, so the room kept for them is fixed on screen: the macOS traffic+ // lights' 78px corner, and on Windows the caption buttons over the right edge+ // (3 × ~46px ≈ 142px, rounded up a touch). Linux hides the bar.+ var root = (Control)Content!;+ Content = null;+ Content = NotaUiScale.Wrap(this, root, OperatingSystem.IsLinux() ? 0 : 32);+ NotaUiScale.Track(TitleBarRow, s =>+ {+ if (OperatingSystem.IsMacOS()) TitleBarRow.ColumnDefinitions[0].Width = new GridLength(78 / s);+ else if (OperatingSystem.IsWindows()) TitleBarRow.Margin = new Thickness(0, 0, 180 / s, 0);+ });DataContextChanged += OnDataContextChanged;BuildDownloadIndicator();InitTransportFit();@@ -111,13 +123,6 @@ public partial class MainWindow : Windowif (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)){Icon = new WindowIcon(Avalonia.Platform.AssetLoader.Open(new Uri("avares://Nota.App/Assets/nota.ico")));- // On Windows the native caption buttons (minimise/maximise/close) overlay- // the right edge of the extended title bar. Reserve room so the centred doc- // title (and anything else in that corner) never sits under them.- // 3 buttons × ~46px wide ≈ 142px; round up a touch. (Linux hides the bar,- // so this only applies to Windows.)- if (OperatingSystem.IsWindows())- TitleBarRow.Margin = new Thickness(0, 0, 180, 0);}}diff --git a/src/managed/Nota.App/MixerWindow.cs b/src/managed/Nota.App/MixerWindow.csindex 8016c2f2..190d9676 100644--- a/src/managed/Nota.App/MixerWindow.cs+++ b/src/managed/Nota.App/MixerWindow.cs@@ -25,8 +25,6 @@ internal sealed class MixerWindow : NotaWindowprivate readonly Action<int> _setViewSegment;private const double BarH = 36;- private static readonly double LeftInset = !NativeFrame && OperatingSystem.IsMacOS() ? 76 : 12;- private static readonly double RightInset = !NativeFrame && OperatingSystem.IsWindows() ? 8 + 138 : 8;private readonly MainWindow _owner;@@ -72,8 +70,9 @@ internal sealed class MixerWindow : NotaWindowvar bar = new Border{Height = BarH, Background = NotaPalette.Panel, BorderBrush = NotaPalette.GraphBorder,- BorderThickness = new Thickness(0, 0, 0, 1), Padding = new Thickness(LeftInset, 0, RightInset, 0), Child = grid,+ BorderThickness = new Thickness(0, 0, 0, 1), Child = grid,};+ NotaUiScale.Track(bar, s => bar.Padding = CaptionPadding(s));if (!NativeFrame) bar.PointerPressed += OnChromePressed;var dock = new DockPanel();@@ -92,8 +91,12 @@ internal sealed class MixerWindow : NotaWindowpublic void FitWidth(double stripsWidth){var screen = Screens.ScreenFromWindow(this) ?? Screens.Primary;- double max = screen is null ? double.PositiveInfinity : screen.WorkingArea.Width / screen.Scaling;- double w = Math.Clamp(Math.Ceiling(stripsWidth), MinWidth, Math.Max(MinWidth, max));+ // The strips are measured inside the interface scale (spec 027). Once shown the frame+ // is in screen units; before that it still holds design units, which the first show+ // scales — so the factor applies only to a visible window.+ double s = IsVisible ? NotaUiScale.Factor : 1;+ double max = screen is null ? double.PositiveInfinity : screen.WorkingArea.Width / screen.Scaling / (IsVisible ? 1 : NotaUiScale.Factor);+ double w = Math.Clamp(Math.Ceiling(stripsWidth * s), MinWidth, Math.Max(MinWidth, max));if (Math.Abs(w - Width) < 0.5) return;Width = w;if (screen is not null && IsVisible)diff --git a/src/managed/Nota.App/NotaWindow.cs b/src/managed/Nota.App/NotaWindow.csindex 7698a828..57c3c08d 100644--- a/src/managed/Nota.App/NotaWindow.cs+++ b/src/managed/Nota.App/NotaWindow.cs@@ -81,6 +81,13 @@ public abstract class NotaWindow : Window};Grid.SetColumn(titleText, 1);row.Children.Add(titleText);+ // The OS draws its window buttons at system size: keep their room fixed on+ // screen whatever the interface scale (spec 027).+ NotaUiScale.Track(row, s =>+ {+ if (OperatingSystem.IsMacOS()) row.ColumnDefinitions[0].Width = new GridLength(78 / s);+ else row.Margin = new Thickness(0, 0, 180 / s, 0);+ });var bar = _chromeBar = new Border{@@ -98,7 +105,9 @@ public abstract class NotaWindow : Window}dock.Children.Add(bodyLayer); // fills the remaining space- base.Content = dock;+ // Everything, title bar included, sits under the interface scale (spec 027).+ double titleBar = OperatingSystem.IsLinux() ? 0 : ownTitleBarHeight > 0 ? ownTitleBarHeight : 32;+ base.Content = NotaUiScale.Wrap(this, dock, titleBar);}/// <summary>A layer over the body for overlays that open in this window (the command palette).</summary>@@ -129,6 +138,14 @@ public abstract class NotaWindow : Window/// title bar then needs no inset for window buttons and does not drag the window.</summary>protected static bool NativeFrame => OperatingSystem.IsLinux();+ /// <summary>Padding for a subclass's own title row at interface scale <paramref name="s"/>:+ /// room for the OS window buttons — the macOS traffic lights (left), the Windows caption+ /// buttons (3 × 46, right) — which the OS draws at system size, so it stays fixed on+ /// screen (spec 027). Linux draws its frame above the window: plain padding.</summary>+ protected static Thickness CaptionPadding(double s) => new(+ !NativeFrame && OperatingSystem.IsMacOS() ? 76 / s : 12, 0,+ !NativeFrame && OperatingSystem.IsWindows() ? 8 + 138 / s : 8, 0);+// Drag the window by its title bar; a double-click toggles maximise when resizable.protected void OnChromePressed(object? sender, PointerPressedEventArgs e){diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.csindex 709f7fd1..906f50ac 100644--- a/src/managed/Nota.App/PreferencesWindow.cs+++ b/src/managed/Nota.App/PreferencesWindow.cs@@ -75,7 +75,7 @@ public sealed partial class PreferencesWindow : NotaWindow("General", new[]{new Page("Library", "Content folders and version history", GlyphKind.Library),- new Page("Appearance", "Theme, waveforms and AI control", GlyphKind.Appearance),+ new Page("Appearance", "Theme, scale, waveforms and AI control", GlyphKind.Appearance),new Page("Shortcuts", "Keyboard reference", GlyphKind.Shortcuts),}),};@@ -124,6 +124,11 @@ public sealed partial class PreferencesWindow : NotaWindowTitle = "Settings";Width = 880;Height = 640;+ // The widest page (Appearance: two theme cards beside the labels) still fits; the+ // interface scale multiplies this, so a live switch to 150 / 200 % grows the window+ // instead of clipping it (spec 027).+ MinWidth = 800;+ MinHeight = 480;Background = Ground;var nav = new StackPanel { Spacing = 2, Margin = new Thickness(10, 12) };@@ -968,6 +973,32 @@ public sealed partial class PreferencesWindow : NotaWindowreturn new Border { Classes = { "segmented" }, HorizontalAlignment = HorizontalAlignment.Left, Child = strip };}+ // 75–200 % for the whole interface (spec 027, #38). Applies live — this window rescales+ // under the pointer too — and is saved for the next launch.+ private static Control ScalePicker()+ {+ var settings = App.Services.GetRequiredService<ISettingsService>();+ var strip = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 2 };+ var buttons = new List<(int Percent, ToggleButton Btn)>();+ int current = InterfaceScale.Normalize(settings.Current.InterfaceScale);+ foreach (var percent in InterfaceScale.Presets)+ {+ var p = percent;+ var btn = new ToggleButton { Classes = { "seg" }, FontSize = 12, Content = $"{p}\u2009%", IsChecked = current == p };+ btn.Click += (_, _) =>+ {+ foreach (var (bp, bb) in buttons) bb.IsChecked = bp == p;+ if (settings.Current.InterfaceScale == p) return;+ settings.Current.InterfaceScale = p;+ settings.Save();+ NotaUiScale.Set(p);+ };+ buttons.Add((p, btn));+ strip.Children.Add(btn);+ }+ return new Border { Classes = { "segmented" }, HorizontalAlignment = HorizontalAlignment.Left, Child = strip };+ }+private Control AppearancePane(){var settings = App.Services.GetService<ISettingsService>();@@ -1055,7 +1086,9 @@ public sealed partial class PreferencesWindow : NotaWindowTopRow("Colour theme", ThemePicker()),Row("", Caption("Themes change colours only. Follow system switches between your dark-mode and light-mode theme with the OS appearance.")),Row("Waveform", WaveformPicker()),- Row("", Caption("How audio clips draw on the arrangement, and samples in the browser's preview: Bars spaces the peaks out so the rhythm reads; Solid draws every pixel."))),+ Row("", Caption("How audio clips draw on the arrangement, and samples in the browser's preview: Bars spaces the peaks out so the rhythm reads; Solid draws every pixel.")),+ Row("Interface scale", ScalePicker()),+ Row("", Caption("Makes the whole interface larger or smaller. Timeline, piano roll and audio editor zoom work on top of it."))),Section("AI control (MCP)", 12, enable, details));}diff --git a/src/managed/Nota.App/Theme/NotaUiScale.cs b/src/managed/Nota.App/Theme/NotaUiScale.csnew file mode 100644index 00000000..d799954e--- /dev/null+++ b/src/managed/Nota.App/Theme/NotaUiScale.cs@@ -0,0 +1,198 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// Owns the app-wide interface scale (spec 027, #38). Avalonia has no global scale, so every+// window's root sits in a LayoutTransformControl: children measure and arrange in logical+// units (frame ÷ factor) and draw through the transform, so text stays vector-sharp and hits+// land where things are drawn. Popups (menus, tooltips, flyouts, dropdowns) open in their own+// PopupRoot; Popup.InheritsTransform (set by an app-wide style) makes each one copy its+// target's scale.+//+// What lives outside the transform is scaled by hand:+// • window sizes — a window's Width/Height/MinWidth/MinHeight are set in logical (design)+// units by its constructor; on the first show they are multiplied by the factor and+// capped at the screen. Later changes keep each open window's frame and scale only its+// minimum, so contents reflow instead of the window jumping — except a window the user+// can't resize, whose frame follows the scale so its content never clips;+// • the extended title bar's drag height (ExtendClientAreaTitleBarHeightHint);+// • insets for the OS caption buttons (traffic lights / min-max-close), which the OS draws+// at system size: those stay fixed on screen, so in logical units they shrink as the+// factor grows — see Track.++using System;+using System.Collections.Generic;+using System.Runtime.CompilerServices;+using Avalonia;+using Avalonia.Controls;+using Avalonia.Controls.Primitives;+using Avalonia.Interactivity;+using Avalonia.Media;+using Avalonia.Styling;+using Nota.Application;++namespace Nota.App;++internal static class NotaUiScale+{+ private sealed class Entry+ {+ public required LayoutTransformControl Root;+ public double TitleBar; // design height of the extended title bar; 0 = none+ public Size DesignMin; // captured on the first show+ public Size DesignSize; // likewise (NaN = unset)+ public bool Opened;+ }++ private static readonly ConditionalWeakTable<Window, Entry> Windows = new();+ private static int _percent = InterfaceScale.Default;+ private static bool _popups;++ /// <summary>The scale in percent (one of <see cref="InterfaceScale.Presets"/>).</summary>+ public static int Percent => _percent;++ /// <summary>The layout factor (1.25 at 125 %).</summary>+ public static double Factor => _percent / 100.0;++ /// <summary>Raised after the scale changed and every window was re-applied.</summary>+ public static event Action? Changed;++ /// <summary>Make every popup take its target's scale. Once, before any window opens.</summary>+ /// <remarks>A style, not a default override (Popup owns that metadata, so it can't be+ /// overridden): ToolTip, ContextMenu and the flyouts create their Popup in code, but each+ /// gives it a logical parent (SetPopupParent) before opening it, which styles it.</remarks>+ public static void InitPopups()+ {+ if (_popups || Avalonia.Application.Current is not { } app) return;+ _popups = true;+ app.Styles.Add(new Style(x => x.OfType<Popup>())+ {+ Setters = { new Setter(Popup.InheritsTransformProperty, true) },+ });+ }++ /// <summary>Wear <paramref name="percent"/> (normalised) in every window, live.</summary>+ public static void Set(int percent)+ {+ int p = InterfaceScale.Normalize(percent);+ if (p == _percent) return;+ _percent = p;+ foreach (var (window, entry) in Windows) Apply(window, entry);+ Changed?.Invoke();+ }++ /// <summary>Put <paramref name="root"/> under the scale for <paramref name="window"/> and+ /// return what to use as the window's content. <paramref name="titleBar"/> is the design+ /// height of the extended title bar (0 when the window keeps the native frame).</summary>+ public static Control Wrap(Window window, Control root, double titleBar)+ {+ var entry = new Entry { Root = new LayoutTransformControl { Child = root }, TitleBar = titleBar };+ Windows.AddOrUpdate(window, entry);+ // Raised at the very start of Window.Show, before the frame size is read — the+ // constructor's design sizes are final by then, and nothing has been drawn yet.+ window.AddHandler(Window.WindowOpenedEvent, (_, _) => OnOpening(window, entry));+ window.Closed += (_, _) => Windows.Remove(window); // a closed window's platform is gone+ SetTransform(entry);+ SetTitleBar(window, entry);+ return entry.Root;+ }++ /// <summary>Run <paramref name="apply"/> with the factor now and on every change while+ /// <paramref name="control"/> is in a window — for values that must stay fixed on screen,+ /// like the room left for the OS caption buttons (logical = screen px ÷ factor).</summary>+ public static void Track(Control control, Action<double> apply)+ {+ void OnChanged() => apply(Factor);+ apply(Factor);+ control.AttachedToVisualTree += (_, _) => { Changed -= OnChanged; Changed += OnChanged; apply(Factor); };+ control.DetachedFromVisualTree += (_, _) => Changed -= OnChanged;+ }++ private static void OnOpening(Window window, Entry entry)+ {+ double s = Factor;+ if (!entry.Opened)+ {+ entry.Opened = true;+ entry.DesignMin = new Size(window.MinWidth, window.MinHeight);+ entry.DesignSize = new Size(window.Width, window.Height);+ var area = WorkingArea(window);+ if (!window.SizeToContent.HasFlag(SizeToContent.Width) && !double.IsNaN(window.Width))+ window.Width = Math.Min(window.Width * s, area.Width);+ if (!window.SizeToContent.HasFlag(SizeToContent.Height) && !double.IsNaN(window.Height))+ window.Height = Math.Min(window.Height * s, area.Height);+ }+ SetMinimum(window, entry);+ }++ private static void Apply(Window window, Entry entry)+ {+ SetTransform(entry);+ SetTitleBar(window, entry);+ if (!entry.Opened) return;+ SetMinimum(window, entry);+ if (!window.CanResize) SetFixedSize(window, entry);+ // A frame now below its minimum grows (Avalonia clamps the platform size to the new+ // minimum); keep it on its screen.+ if (window.IsVisible) KeepOnScreen(window);+ }++ private static void SetTransform(Entry entry)+ {+ double s = Factor;+ entry.Root.LayoutTransform = new ScaleTransform(s, s);+ }++ private static void SetTitleBar(Window window, Entry entry)+ {+ if (entry.TitleBar > 0 && window.ExtendClientAreaToDecorationsHint)+ window.ExtendClientAreaTitleBarHeightHint = entry.TitleBar * Factor;+ }++ // A dialog the user can't resize would clip its content once the scale grows under it:+ // its frame follows the scale instead (the one exception to "open windows keep their+ // size"). Axes sized to content follow it on their own.+ private static void SetFixedSize(Window window, Entry entry)+ {+ double s = Factor;+ var area = WorkingArea(window);+ if (!window.SizeToContent.HasFlag(SizeToContent.Width) && !double.IsNaN(entry.DesignSize.Width))+ window.Width = Math.Min(entry.DesignSize.Width * s, area.Width);+ if (!window.SizeToContent.HasFlag(SizeToContent.Height) && !double.IsNaN(entry.DesignSize.Height))+ window.Height = Math.Min(entry.DesignSize.Height * s, area.Height);+ }++ private static void SetMinimum(Window window, Entry entry)+ {+ double s = Factor;+ var area = WorkingArea(window);+ window.MinWidth = Math.Min(entry.DesignMin.Width * s, area.Width);+ window.MinHeight = Math.Min(entry.DesignMin.Height * s, area.Height);+ // A maximised or fullscreen frame is the OS's; leave it. (NaN sizes compare false, so+ // an unset size is left alone.)+ if (window.IsVisible && window.WindowState != WindowState.Normal) return;+ if (!window.SizeToContent.HasFlag(SizeToContent.Width) && window.Width < window.MinWidth) window.Width = window.MinWidth;+ if (!window.SizeToContent.HasFlag(SizeToContent.Height) && window.Height < window.MinHeight) window.Height = window.MinHeight;+ }++ // The screen's working area in window units (DIPs); unbounded when there is no screen+ // (headless).+ private static Size WorkingArea(Window window)+ {+ var screen = window.Screens.ScreenFromWindow(window) ?? window.Screens.Primary;+ return screen is null+ ? new Size(double.PositiveInfinity, double.PositiveInfinity)+ : new Size(screen.WorkingArea.Width / screen.Scaling, screen.WorkingArea.Height / screen.Scaling);+ }++ private static void KeepOnScreen(Window window)+ {+ if (window.WindowState != WindowState.Normal) return;+ var screen = window.Screens.ScreenFromWindow(window) ?? window.Screens.Primary;+ if (screen is null) return;+ var wa = screen.WorkingArea;+ int w = (int)Math.Ceiling(window.Width * screen.Scaling), h = (int)Math.Ceiling(window.Height * screen.Scaling);+ int x = Math.Clamp(window.Position.X, wa.X, Math.Max(wa.X, wa.Right - w));+ int y = Math.Clamp(window.Position.Y, wa.Y, Math.Max(wa.Y, wa.Bottom - h));+ if (x != window.Position.X || y != window.Position.Y) window.Position = new PixelPoint(x, y);+ }+}diff --git a/src/managed/Nota.Application/InterfaceScale.cs b/src/managed/Nota.Application/InterfaceScale.csnew file mode 100644index 00000000..08a50e94--- /dev/null+++ b/src/managed/Nota.Application/InterfaceScale.cs@@ -0,0 +1,26 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.+//+// The app-wide interface scale (spec 027, #38): which percentages Preferences offers and+// what a stored value means. Pure — no UI, no I/O — so the smoke test can walk it; the app+// layer applies the factor to its windows. A hand-edited or future value never throws: it+// reads as 100 %.++using System.Collections.Generic;+using System.Linq;++namespace Nota.Application;++public static class InterfaceScale+{+ public const int Default = 100;++ /// <summary>The offered scales in percent, smallest first (the picker's order).</summary>+ public static IReadOnlyList<int> Presets { get; } = new[] { 75, 100, 125, 150, 200 };++ /// <summary>The stored value if it is a preset, else <see cref="Default"/>.</summary>+ public static int Normalize(int percent) => Presets.Contains(percent) ? percent : Default;++ /// <summary>The layout factor for a stored value (1.25 for 125).</summary>+ public static double Factor(int percent) => Normalize(percent) / 100.0;+}diff --git a/src/managed/Nota.Application/Settings.cs b/src/managed/Nota.Application/Settings.csindex 3323599e..25e7f908 100644--- a/src/managed/Nota.Application/Settings.cs+++ b/src/managed/Nota.Application/Settings.cs@@ -143,6 +143,9 @@ public sealed class Settings/// <summary>How audio clips draw their waveform on the lanes (Settings → Appearance):/// 0 bars — spaced peak strokes (default), 1 solid — one column per pixel.</summary>public int ArrangementWaveform { get; set; }+ /// <summary>Interface scale in percent (Settings → Appearance, spec 027): one of+ /// <see cref="Application.InterfaceScale.Presets"/>; anything else reads as 100.</summary>+ public int InterfaceScale { get; set; } = Application.InterfaceScale.Default;/// <summary>Piano-roll note audition (#46): notes sound while they are placed, clicked or/// dragged. The speaker chip in the clip editor's header; on by default.</summary>public bool PianoRollAudition { get; set; } = true;diff --git a/tests/Nota.SmokeTest/DesignTokenCheck.Themes.cs b/tests/Nota.SmokeTest/DesignTokenCheck.Themes.csindex 35dce963..a482eaf8 100644--- a/tests/Nota.SmokeTest/DesignTokenCheck.Themes.cs+++ b/tests/Nota.SmokeTest/DesignTokenCheck.Themes.cs@@ -190,6 +190,18 @@ internal static partial class DesignTokenCheckreturn Math.Sqrt((l1 - l2) * (l1 - l2) + (a1 - a2) * (a1 - a2) + (b1 - b2) * (b1 - b2));}+ // ---- Interface scale (spec 027): presets and fallbacks --------------------------------++ public static IEnumerable<(bool Ok, string Label)> RunInterfaceScale()+ {+ yield return (InterfaceScale.Presets.SequenceEqual(new[] { 75, 100, 125, 150, 200 }), "scale presets are 75 / 100 / 125 / 150 / 200 %");+ yield return (InterfaceScale.Presets.All(p => InterfaceScale.Normalize(p) == p), "every preset is kept");+ var bad = new[] { 0, -100, 130, 300, int.MaxValue, int.MinValue };+ yield return (bad.All(v => InterfaceScale.Normalize(v) == 100), "an unknown scale reads as 100 %");+ yield return (InterfaceScale.Factor(125) == 1.25 && InterfaceScale.Factor(75) == 0.75 && InterfaceScale.Factor(130) == 1.0, "scale factor follows the normalised percent");+ yield return (new Settings().InterfaceScale == 100, "no setting → 100 %");+ }+// ---- Appearance: migration and fallbacks (data-model.md § Resolution) ----------------public static IEnumerable<(bool Ok, string Label)> RunAppearance()diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.csindex 43d954bb..a465416d 100644--- a/tests/Nota.SmokeTest/Program.cs+++ b/tests/Nota.SmokeTest/Program.cs@@ -81,6 +81,8 @@ Console.WriteLine($"engine v{NotaEngine.Version}");foreach (var (ok, label) in Nota.SmokeTest.DesignTokenCheck.RunThemes()) Check(ok, label);Console.WriteLine("-- design: appearance --");foreach (var (ok, label) in Nota.SmokeTest.DesignTokenCheck.RunAppearance()) Check(ok, label);+ Console.WriteLine("-- design: interface scale --");+ foreach (var (ok, label) in Nota.SmokeTest.DesignTokenCheck.RunInterfaceScale()) Check(ok, label);Console.WriteLine("-- design: labels --");foreach (var (ok, label) in Nota.SmokeTest.DesignTokenCheck.RunLabels()) Check(ok, label);Console.WriteLine("-- design: icons --");