Vixen
02b45cc4
csharp
public sealed class KeyBindingsView

The panel doc 20's A5 asks for: every command, its chord, and where the chord came from.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

KeyMap has had conflict detection, per-command overrides, a defaults-versus-overrides split and reset since it was written, and no way to reach any of it. Doc 11 flags that and doc 20 spells out the panel: a grid of command / category / binding / source, a filter box, a "press a key" capture, conflict reporting inline, per-row and global reset, and import and export of a keymap file.

⚠ The preset dropdown is the point and the grid is the consolation. Doc 20's own note is that "presets matter more than they look" — a Unity user and an Unreal user disagree about most of the bar and both are certain — so the one control that turns a week of friction into a choice is the Presets picker, and it is first on the strip for that reason.

⚠ Capture is a mode with a visible end, not a modal. While it is on, every key the panel sees is a candidate binding — including Escape, which is what cancels it, and which is therefore the one chord this panel will not let you bind. The alternative is a dialog, and a dialog that swallows keystrokes to record them cannot be driven by the automation harness or screenshotted, which is DialogService's own argument turned round.

⚠ Import and export are events rather than file calls. This assembly has no INativeDialogs and is deliberately not allowed one — the shell is a UiDocument and nothing else — so the panel says what the user asked for and the application, which has the picker, answers. The same arrangement Activated uses and for the same reason.

Fields and properties (14)

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public UiElement Toolbar

    The strip along the top.

  • public SearchBox Search

    The filter box.

  • public Select Presets

    Which keymap preset is in force.

  • public Button Record

    The button that puts the panel into capture mode.

  • public Button Import

    The button that asks for a keymap file to be read in.

  • public Button Export
  • public DataGrid Grid

    The grid.

  • public UiElement Status

    The line under it that reports a conflict, or says what capture is waiting for.

  • public bool IsCapturing

    Whether the next chord pressed is a binding rather than a shortcut.

  • public string? Selected

    Which command the grid has selected, or .

  • public string? Conflict

    Which command holds the chord the user just tried to take, if the bind was refused.

  • public KeyChord Pending

    The chord that was refused, so pressing it again can mean "take it".

Events (2)

  • public Action<KeyBindingsView>? ImportRequested

    Raised when the user asks to read a keymap in from a file.

  • public Action<KeyBindingsView>? ExportRequested

    Raised when they ask to write one out.

Methods (7)

  • public void Show(CommandRegistry registry, KeyMap map)

    Points the panel at a registry and the map that binds it.

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnRemoved()

    Called once, as the element leaves the document.

  • public void Rebuild()

    Rebuilds the row list from the registry, honouring the filter.

  • public void Refresh()

    Reads every cell again without rebuilding the list.

  • public void Capture(bool on)

    Turns capture mode on or off.

  • public BindResult Rebind(KeyChord chord, bool replace = false)

    Gives the selected command a chord.

Used by (4)

  • EditorApplicationVixen.Editor.App
  • EditorShellVixen.Editor.Ui
  • KeyBindingsPanelTestsVixen.Editor.App.Tests
  • MilestoneE3TestsVixen.Editor.App.Tests