Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

42.9 KB
Raw Blame
<!-- SPDX-License-Identifier: AGPL-3.0-only -->
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:app="clr-namespace:Nota.App"
        xmlns:vm="clr-namespace:Nota.Presentation;assembly=Nota.Presentation"
        mc:Ignorable="d" d:DesignWidth="960" d:DesignHeight="600"
        x:Class="Nota.App.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        Width="1200" Height="800" MinWidth="1100" MinHeight="680"
        Background="{DynamicResource Brush.BgApp}"
        Icon="/Assets/logo.png"
        WindowState="Maximized"
        Title="Nota">
  <Window.Resources>
    <app:ToolbarSideToAlignmentConverter x:Key="ToolbarSideToAlignment"/>
  </Window.Resources>
  <NativeMenu.Menu>
    <NativeMenu>
      <NativeMenuItem Header="{app:T 'common.file'}">
        <NativeMenuItem.Menu>
          <NativeMenu>
            <NativeMenuItem Header="{app:T 'main.new'}" app:Commands.Id="file.new"/>
            <NativeMenuItem Header="{app:T 'main.open'}" app:Commands.Id="file.open"/>
            <NativeMenuItem Header="{app:T 'main.save'}" app:Commands.Id="file.save"/>
            <NativeMenuItem Header="{app:T 'main.save_as'}" app:Commands.Id="file.saveAs"/>
            <NativeMenuItem Header="{app:T 'main.save_version_with_note'}" app:Commands.Id="file.saveVersion"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.import_audio'}" app:Commands.Id="file.import"/>
            <NativeMenuItem Header="{app:T 'main.export_audio'}" app:Commands.Id="file.export"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.settings'}" app:Commands.Id="prefs.open"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.exit'}" app:Commands.Id="file.exit"/>
          </NativeMenu>
        </NativeMenuItem.Menu>
      </NativeMenuItem>
      <NativeMenuItem Header="{app:T 'common.edit'}">
        <NativeMenuItem.Menu>
          <NativeMenu>
            <NativeMenuItem Header="{app:T 'common.undo'}" app:Commands.Id="edit.undo"/>
            <NativeMenuItem Header="{app:T 'main.redo'}" app:Commands.Id="edit.redo"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.duplicate_clip'}" app:Commands.Id="edit.duplicate"/>
            <NativeMenuItem Header="{app:T 'main.insert_scene'}" app:Commands.Id="session.insertScene"/>
            <NativeMenuItem Header="{app:T 'main.split_at_playhead'}" app:Commands.Id="edit.split"/>
            <NativeMenuItem Header="{app:T 'common.consolidate'}" app:Commands.Id="edit.consolidate"/>
            <NativeMenuItem Header="{app:T 'common.duplicate_time'}" app:Commands.Id="edit.duplicateTime"/>
            <NativeMenuItem Header="{app:T 'common.insert_silence'}" app:Commands.Id="edit.insertSilence"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.lock_envelopes'}" app:Commands.Id="edit.lockEnvelopes" ToggleType="CheckBox"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'common.cut'}" app:Commands.Id="edit.cut"/>
            <NativeMenuItem Header="{app:T 'common.copy'}" app:Commands.Id="edit.copy"/>
            <NativeMenuItem Header="{app:T 'common.paste'}" app:Commands.Id="edit.paste"/>
            <NativeMenuItem Header="{app:T 'common.paste_bounced_audio'}" app:Commands.Id="edit.pasteBounced"/>
            <NativeMenuItem Header="{app:T 'main.copy_clips_to_session_arrangement'}" app:Commands.Id="edit.copyToOtherView"/>
            <NativeMenuItem Header="{app:T 'common.delete'}" app:Commands.Id="edit.delete"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'common.grid'}">
              <NativeMenuItem.Menu>
                <NativeMenu>
                  <NativeMenuItem Header="{app:T 'main.narrow_grid'}" app:Commands.Id="grid.narrower"/>
                  <NativeMenuItem Header="{app:T 'main.widen_grid'}" app:Commands.Id="grid.wider"/>
                  <NativeMenuItem Header="{app:T 'main.triplet_grid'}" app:Commands.Id="grid.triplets"/>
                  <NativeMenuItem Header="{app:T 'main.snap_to_grid'}" app:Commands.Id="grid.snap"/>
                  <NativeMenuItem Header="{app:T 'main.adaptive_grid'}" app:Commands.Id="grid.adaptive"/>
                </NativeMenu>
              </NativeMenuItem.Menu>
            </NativeMenuItem>
          </NativeMenu>
        </NativeMenuItem.Menu>
      </NativeMenuItem>
      <NativeMenuItem Header="{app:T 'main.view'}">
        <NativeMenuItem.Menu>
          <NativeMenu>
            <NativeMenuItem Header="{app:T 'main.command_palette'}" app:Commands.Id="view.palette"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'common.mixer'}" app:Commands.Id="view.mixer"/>
            <NativeMenuItem Header="{app:T 'main.mixer_in_its_own_window'}" app:Commands.Id="view.mixerFloat" ToggleType="CheckBox"/>
            <NativeMenuItem Header="{app:T 'main.connect_phone'}" app:Commands.Id="view.connectPhone"/>
            <NativeMenuItem Header="{app:T 'main.articulation_maps'}" app:Commands.Id="view.articulationMaps"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.toggle_browser'}" app:Commands.Id="view.toggleBrowser"/>
            <NativeMenuItem Header="{app:T 'main.toggle_detail_panel'}" app:Commands.Id="view.toggleDetail"/>
            <NativeMenuItem Header="{app:T 'main.clip_editor_fills_the_window'}" app:Commands.Id="view.maximizeDetail" ToggleType="CheckBox"/>
            <NativeMenuItem Header="{app:T 'main.toggle_overview'}" app:Commands.Id="view.toggleOverview"/>
            <NativeMenuItem Header="{app:T 'main.toggle_sections'}" app:Commands.Id="view.toggleSections"/>
            <NativeMenuItem Header="{app:T 'main.toggle_full_screen'}" app:Commands.Id="view.fullscreen"/>
            <NativeMenuItem Header="{app:T 'main.show_menu_bar'}" app:Commands.Id="view.menuBar" ToggleType="CheckBox"/>
            <NativeMenuItemSeparator/>
            <!-- Header text is matched from code to keep this checkmark in step with the
                 transport bar's Follow button — see MainWindow.SetFollowPlayhead. -->
            <NativeMenuItem Header="{app:T 'main.follow_playhead'}" app:Commands.Id="view.follow" ToggleType="CheckBox"/>
            <NativeMenuItem Header="{app:T 'main.show_playhead'}" app:Commands.Id="view.showPlayhead"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'main.clip_names'}" app:Commands.Id="view.clipNames"/>
            <NativeMenuItem Header="{app:T 'main.track_headers_on_the_right'}" app:Commands.Id="view.headersRight" ToggleType="CheckBox"/>
          </NativeMenu>
        </NativeMenuItem.Menu>
      </NativeMenuItem>
      <NativeMenuItem Header="{app:T 'common.transport'}">
        <NativeMenuItem.Menu>
          <NativeMenu>
            <NativeMenuItem Header="{app:T 'common.play_stop'}" app:Commands.Id="transport.playStop"/>
            <NativeMenuItem Header="{app:T 'main.play_pause'}" app:Commands.Id="transport.playPause"/>
            <NativeMenuItem Header="{app:T 'common.record'}" app:Commands.Id="transport.record"/>
            <NativeMenuItem Header="{app:T 'commands.discard_and_retry_take'}" app:Commands.Id="transport.retryTake"/>
            <NativeMenuItem Header="{app:T 'main.auto_arm_selected_track'}" app:Commands.Id="transport.armOnSelect" ToggleType="CheckBox"/>
            <NativeMenuItem Header="{app:T 'common.loop'}" app:Commands.Id="transport.loop"/>
            <NativeMenuItem Header="{app:T 'main.loop_record_overdub_replace'}" app:Commands.Id="transport.loopRecordMode"/>
            <NativeMenuItem Header="{app:T 'common.metronome'}" app:Commands.Id="transport.metronome"/>
          </NativeMenu>
        </NativeMenuItem.Menu>
      </NativeMenuItem>
      <NativeMenuItem Header="{app:T 'main.help'}">
        <NativeMenuItem.Menu>
          <NativeMenu>
            <NativeMenuItem Header="{app:T 'common.documentation'}" app:Commands.Id="help.docs"/>
            <NativeMenuItem Header="{app:T 'common.whats_new'}" app:Commands.Id="help.whatsNew"/>
            <NativeMenuItem Header="{app:T 'common.check_for_updates'}" app:Commands.Id="help.checkUpdates"/>
            <NativeMenuItemSeparator/>
            <NativeMenuItem Header="{app:T 'common.about_nota'}" app:Commands.Id="help.about"/>
          </NativeMenu>
        </NativeMenuItem.Menu>
      </NativeMenuItem>
    </NativeMenu>
  </NativeMenu.Menu>

  <Panel>
  <DockPanel Background="{DynamicResource Brush.Seam}">
    <!-- Header (32) on the ground, a seam under it — custom frameless: macOS traffic lights
         sit in the left inset; the project's name is the title, centred on the window. Draggable.
         (Transport sits right under it, at the top of the window.) -->
    <Border x:Name="TitleBar" DockPanel.Dock="Top" Height="32"
            Background="{DynamicResource Brush.BgApp}"
            BorderBrush="{DynamicResource Brush.BorderDefault}" BorderThickness="0,0,0,1"
            PointerPressed="OnTitleBarPressed">
      <Grid x:Name="TitleBarRow" ColumnDefinitions="78,*,Auto" Margin="0,0,12,0">
        <TextBlock x:Name="DocTitleText" Grid.Column="0" Grid.ColumnSpan="3" Text="Nota" Classes="Heading"
                   HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False"/>
        <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
        </StackPanel>
      </Grid>
    </Border>

    <!-- In-window menu bar for Windows/Linux (empty on macOS: menus go to the system bar):
         a menubar-style row — the ground, with a seam under it. Hidden by default there: the
         Menu key at the start of the transport bar gives the same menu, and View ▸ Show menu
         bar / Settings → Appearance bring the row back (#518, MainWindow.MenuButton.cs). -->
    <Border x:Name="MenuBarRow" DockPanel.Dock="Top" Background="{DynamicResource Brush.BgApp}">
      <NativeMenuBar x:Name="MenuBarHost"/>
    </Border>

    <!-- Transport (44) under the header, above the work area — a flat docked row on the
         panel tone with a seam under it. Stop / play / record, position and loop share one
         30px recessed group inside it, so playback reads as one object rather than a row of
         keys. Reads left to right as: which view · what plays · the numbers you set ·
         the switches you flip · then, pinned right, what the machine is doing, and ⋯ last.
         The view switch leads the row. When the window is too narrow the row sheds its
         least-needed parts first — see MainWindow.TransportFit.cs for the order — and the ⋯
         menu lists whatever it shed (MainWindow.TransportOverflow.cs, #520). -->
    <Border x:Name="TransportBar" DockPanel.Dock="Top" Classes="transport" Height="{StaticResource Control.TransportBar}">
      <Grid x:Name="TransportGrid" ColumnDefinitions="Auto,Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto">

        <!-- The view group: three 28px icon cells in a 2px well (corner 9). The project's name
             is the window title, centred in the header above. On Windows / Linux, with the menu
             row hidden, the Menu key leads it: one cell of the same kind holding the whole
             application menu (#518). -->
        <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="10" Margin="2,0,0,0" VerticalAlignment="Center">
          <Border x:Name="MenuKeyWell" Classes="segmented view" VerticalAlignment="Center" IsVisible="False">
            <ToggleButton x:Name="MenuBtn" Classes="seg view" Click="OnMenuKeyClick"
                          ToolTip.Tip="{app:T 'main.menu'}" AutomationProperties.Name="{app:T 'main.menu'}">
              <app:Glyph Kind="Menu" Size="16"/>
            </ToggleButton>
          </Border>
          <Border Classes="segmented view" VerticalAlignment="Center">
            <StackPanel Orientation="Horizontal">
              <!-- The views as icon keys (spec 012): the tooltip and the accessible name carry
                   the view name. View → Arrangement / Session / Modular do the same. -->
              <ToggleButton x:Name="ArrangeBtn" Classes="seg view" IsChecked="True" Click="OnShowArrangement"
                            ToolTip.Tip="{app:T 'main.arrangement'}" AutomationProperties.Name="{app:T 'main.arrangement'}">
                <app:Glyph Kind="Arrangement" Size="16"/>
              </ToggleButton>
              <ToggleButton x:Name="SessionBtn" Classes="seg view" Click="OnShowSession"
                            ToolTip.Tip="{app:T 'main.session'}" AutomationProperties.Name="{app:T 'main.session'}">
                <app:Glyph Kind="Session" Size="16"/>
              </ToggleButton>
              <ToggleButton x:Name="ModularBtn" Classes="seg view" Click="OnShowModular"
                            ToolTip.Tip="{app:T 'common.modular'}" AutomationProperties.Name="{app:T 'common.modular'}">
                <app:Glyph Kind="Modular" Size="16"/>
              </ToggleButton>
            </StackPanel>
          </Border>
        </StackPanel>

        <!-- Transport and timing: the transport keys in their well, then the position, the
             loop and loop-record mode as plain values and small pills — no box. -->
        <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10" Margin="12,0,0,0" VerticalAlignment="Center">
          <Border Classes="console">
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
              <!-- Shapes built from geometry: stop a square, play a filled triangle, record a
                   filled disc. No glyph font. -->
              <Button x:Name="StopBtn" Classes="tp-icon" ToolTip.Tip="{app:T 'main.stop_return'}" Command="{Binding Transport.StopCommand}">
                <app:Glyph x:Name="StopGlyph" Kind="Stop" Width="9" Height="9"/>
              </Button>
              <Button x:Name="PlayBtn" Classes="tp-play" ToolTip.Tip="{app:T 'main.play_space'}"
                      Classes.playing="{Binding Transport.IsPlaying}" Command="{Binding Transport.PlayCommand}">
                <app:Glyph x:Name="PlayGlyph" Kind="Play" Width="10" Height="12" Margin="2,0,0,0"/>
              </Button>
              <ToggleButton x:Name="RecordBtn" Classes="tp-icon rec" ToolTip.Tip="{app:T 'main.record_r'}"
                            IsChecked="{Binding Transport.RecordOn}">
                <app:Glyph x:Name="RecordGlyph" Kind="Record" Width="10" Height="10"/>
              </ToggleButton>
            </StackPanel>
          </Border>

          <!-- Position — click to flip bars.beats ↔ minutes:seconds; the unit beside says which -->
          <Border Classes="readout" Cursor="Hand" PointerPressed="OnTogglePositionDisplay"
                  ToolTip.Tip="{app:T 'main.switch_between_bars_and_time'}">
            <StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
              <TextBlock Classes="Readout" Text="{Binding Transport.PositionText}"
                         MinWidth="62" VerticalAlignment="Center"/>
              <TextBlock Classes="CellLabel" Text="{Binding Transport.PositionUnitText}" VerticalAlignment="Center"/>
            </StackPanel>
          </Border>

          <Border x:Name="LoopSep" Classes="tb-sep"/>

          <!-- Loop on/off as an icon key with the range beside it; on is the soft
               tint, the glyph takes the orange ink through ToggleButton:checked -->
          <ToggleButton x:Name="LoopCell" Classes="tp-icon" IsChecked="{Binding Transport.LoopOn}"
                        Width="NaN" Padding="6,0,8,0"
                        ToolTip.Tip="{app:T 'main.loop_the_range_set_on'}" AutomationProperties.Name="{app:T 'common.loop'}">
            <!-- The loop range is written beside the glyph, so the numbers read at a glance -->
            <StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
              <app:Glyph Kind="Loop" Size="16" VerticalAlignment="Center"/>
              <TextBlock Classes="Value" MinWidth="44" VerticalAlignment="Center"
                         Text="{Binding Transport.LoopRangeText}"
                         Foreground="{Binding $parent[ToggleButton].Foreground}"/>
            </StackPanel>
          </ToggleButton>
          <!-- Loop record mode as an icon key: Overdub stacks the passes (two layers, at rest);
               Replace keeps the latest (one layer and a turn arrow, picked: the soft tint) -->
          <ToggleButton x:Name="LoopRecordCell" Classes="tp-icon" IsChecked="{Binding Transport.LoopRecordReplace}"
                        AutomationProperties.Name="{app:T 'main.loop_record_overdub_replace'}"
                        ToolTip.Tip="{app:T 'main.loop_recording_overdub_adds_every'}">
            <Panel>
              <app:Glyph Kind="Overdub" Size="16" IsVisible="{Binding !Transport.LoopRecordReplace}"/>
              <app:Glyph Kind="Replace" Size="16" IsVisible="{Binding Transport.LoopRecordReplace}"/>
            </Panel>
          </ToggleButton>
        </StackPanel>

        <!-- Tempo, tap, signature and key: plain 17px values with the unit in ink 3 -->
        <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="10" VerticalAlignment="Center" Margin="10,0,0,0">
          <Border Classes="tb-sep"/>
          <!-- Tempo (drag ↕ or double-click to type) -->
          <Border Classes="readout" ToolTip.Tip="{app:T 'main.set_the_tempo_drag_or'}">
            <StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
              <Panel x:Name="BpmHost" Width="60" Height="22" VerticalAlignment="Center"/>
              <TextBlock Classes="CellLabel" Text="BPM" VerticalAlignment="Center"/>
            </StackPanel>
          </Border>
          <!-- Tap tempo: fires on press (a release lags the beat). The dots count the beats
               of the current series, orange as each one lands; they clear when it times out. -->
          <Button x:Name="TapChip" Classes="pill" ClickMode="Press" Click="OnTapTempo"
                  ToolTip.Tip="{app:T 'main.tap_the_beat_to_set'}">
            <StackPanel Orientation="Horizontal" Spacing="6">
              <StackPanel x:Name="TapDots" Orientation="Horizontal" Spacing="3"
                          HorizontalAlignment="Center" VerticalAlignment="Center">
                <Ellipse Width="4" Height="4" Fill="{DynamicResource Brush.BorderStrong}"/>
                <Ellipse Width="4" Height="4" Fill="{DynamicResource Brush.BorderStrong}"/>
                <Ellipse Width="4" Height="4" Fill="{DynamicResource Brush.BorderStrong}"/>
                <Ellipse Width="4" Height="4" Fill="{DynamicResource Brush.BorderStrong}"/>
              </StackPanel>
              <TextBlock Text="{app:T 'main.tap'}" VerticalAlignment="Center"/>
            </StackPanel>
          </Button>
          <!-- Time signature (drag ↕ each field) -->
          <Border x:Name="TimeSigCell" Classes="readout" ToolTip.Tip="{app:T 'main.set_the_time_signature_drag'}">
            <StackPanel Orientation="Horizontal" Spacing="1" Height="22" VerticalAlignment="Center">
              <Panel x:Name="TimeSigNumHost" Width="20"/>
              <TextBlock Text="/" FontSize="16" FontWeight="Medium" VerticalAlignment="Center"
                         Foreground="{DynamicResource Brush.TextTertiary}"/>
              <Panel x:Name="TimeSigDenHost" Width="20"/>
            </StackPanel>
          </Border>
          <!-- Project key: loops dropped in can be transposed to it -->
          <Button x:Name="KeyChip" Classes="cell" Click="OnPickProjectKey" ToolTip.Tip="{app:T 'main.set_the_project_key_samples'}">
            <StackPanel Orientation="Horizontal" Spacing="5">
              <TextBlock x:Name="KeyLabel" Classes="Readout" Text="—"
                         MinWidth="24" TextAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource Brush.TextTertiary}"/>
              <TextBlock Classes="CellLabel" Text="{app:T 'main.key'}" VerticalAlignment="Center"/>
            </StackPanel>
          </Button>
          <Border x:Name="GridSep" Classes="tb-sep"/>
          <!-- Clip snap grid (SnapChip.cs): the step in effect, live with the zoom in Auto;
               click for the grid menu. SnapChip sizes the value to its widest label. -->
          <Button x:Name="SnapChip" Classes="cell">
            <StackPanel Orientation="Horizontal" Spacing="5">
              <TextBlock x:Name="SnapLabel" Classes="Readout" Text="1/4"
                         MinWidth="36" TextAlignment="Center" VerticalAlignment="Center"/>
              <TextBlock x:Name="SnapCaption" Classes="CellLabel" Text="{app:T 'common.grid'}" VerticalAlignment="Center"/>
            </StackPanel>
          </Button>
        </StackPanel>

        <!-- Tools. Each draws the thing it does, so the row carries no prose: a metronome, a
             playhead flag, a magnet, a breakpoint envelope, faders. On is the soft tint
             (picked); none sets Foreground, so the glyph takes the orange ink through
             ToggleButton:checked. -->
        <StackPanel Grid.Column="3" Orientation="Horizontal" Spacing="2" VerticalAlignment="Center" Margin="10,0,0,0">
          <Border Classes="tb-sep" Margin="0,0,8,0"/>
          <!-- Metronome: body, pendulum rod, weight -->
          <ToggleButton x:Name="MetronomeBtn" Classes="tp-icon" IsChecked="{Binding Transport.MetronomeOn}"
                        ContextRequested="OnMetronomeContext"
                        ToolTip.Tip="{app:T 'main.turn_the_metronome_on_or'}">
            <app:Glyph Kind="Metronome" Size="16"/>
          </ToggleButton>
          <!-- Follow playhead: keep the arrangement scrolling with the cursor. Mirrored by
               View ▸ Follow playhead, which shares one code path. -->
          <ToggleButton x:Name="FollowBtn" Classes="tp-icon" Click="OnToggleFollow"
                        ToolTip.Tip="{app:T 'main.scroll_the_arrangement_to_keep'}">
            <app:Glyph Kind="Follow" Size="16"/>
          </ToggleButton>
          <!-- Snapping on/off, independent of which grid the Grid value shows. Off is the
               same as holding Alt, but latched. -->
          <ToggleButton x:Name="SnapToggle" Classes="tp-icon" IsChecked="True" Click="OnToggleSnapEnabled"
                        ToolTip.Tip="{app:T 'main.snap_clips_to_the_grid'}">
            <app:Glyph Kind="Snap" Size="16"/>
          </ToggleButton>
          <!-- Automation: a breakpoint envelope — the ramp and handles the lanes draw -->
          <ToggleButton x:Name="AutomationToggle" Classes="tp-icon" Click="OnToggleAutomation">
            <app:Glyph Kind="Automation" Size="16"/>
          </ToggleButton>
          <!-- Mixer: three channel faders. Runs view.mixer like View ▸ Mixer and ⌘⇧M, and reads
               as on while the Mixer is shown, docked or in its own window (#516). -->
          <ToggleButton x:Name="MixerToggle" Classes="tp-icon" Click="OnToggleMixerButton">
            <app:Glyph Kind="Mixer" Size="16"/>
          </ToggleButton>
          <!-- Shown only while a hand-moved control has taken a lane over from
               playback (M9-C); one click hands every overridden lane back. -->
          <Button x:Name="ReenableAutoBtn" Classes="chip" Content="{app:T 'main.re_enable'}" Margin="6,0,0,0"
                  IsVisible="False" Click="OnReenableAutomation"
                  ToolTip.Tip="{app:T 'main.hand_overridden_controls_back_to'}"/>
        </StackPanel>

        <!-- Add track: one menu instead of three chips -->
        <!-- <Button Grid.Column="5" Classes="chip" Margin="12,0,0,0" ToolTip.Tip="Add a track"> -->
        <!--   <StackPanel Orientation="Horizontal" Spacing="7" VerticalAlignment="Center"> -->
        <!--     <TextBlock Text="+ Track" VerticalAlignment="Center"/> -->
        <!--     <app:Glyph Kind="CaretDown" Size="9" Foreground="{DynamicResource Brush.TextTertiary}"/> -->
        <!--   </StackPanel> -->
        <!--   <Button.Flyout> -->
        <!--     <MenuFlyout Placement="BottomEdgeAlignedLeft"> -->
        <!--       <MenuItem Header="Instrument" Click="OnAddInstrumentClicked"/> -->
        <!--       <MenuItem Header="Audio" Click="OnAddAudioClicked"/> -->
        <!--       <MenuItem Header="Return" Click="OnAddReturnClicked"/> -->
        <!--     </MenuFlyout> -->
        <!--   </Button.Flyout> -->
        <!-- </Button> -->

        <!-- MIDI learn + an input-activity dot, so a silent controller is diagnosable;
             Remote (Nota Remote) beside it: off / the number of phones, a dot that flashes on
             each touch from a phone. Click opens Connect Phone. -->
        <StackPanel x:Name="RemotePanel" Grid.Column="6" Orientation="Horizontal" Spacing="6" Margin="8,0,0,0">
          <ToggleButton x:Name="MidiLearnBtn" Classes="chip"
                        Click="OnToggleMidiLearn"
                        ToolTip.Tip="{app:T 'main.map_a_controller_click_a'}">
            <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
              <TextBlock Text="MIDI" VerticalAlignment="Center"
                         Foreground="{Binding $parent[ToggleButton].Foreground}"/>
              <Ellipse x:Name="MidiDot" Width="5" Height="5" VerticalAlignment="Center"
                       Fill="{DynamicResource Brush.BorderStrong}"/>
            </StackPanel>
          </ToggleButton>
          <Button x:Name="RemoteBtn" Classes="chip" Click="OnRemoteClick"
                  ToolTip.Tip="{app:T 'main.play_and_control_nota_from'}">
            <StackPanel Orientation="Horizontal" Spacing="7" VerticalAlignment="Center">
              <Border x:Name="RemoteGlyph" Width="8" Height="12" CornerRadius="{StaticResource Radius.Fine}" BorderThickness="1.5"
                      BorderBrush="{Binding $parent[Button].Foreground}" VerticalAlignment="Center"/>
              <TextBlock x:Name="RemoteLabel" Text="{app:T 'main.remote'}" VerticalAlignment="Center"
                         Foreground="{Binding $parent[Button].Foreground}"/>
              <TextBlock x:Name="RemoteCount" Classes="Mono" Text="{app:T 'main.off_remote'}" FontSize="9" VerticalAlignment="Center"
                         Foreground="{Binding $parent[Button].Foreground}"/>
              <Ellipse x:Name="RemoteDot" Width="5" Height="5" VerticalAlignment="Center"
                       Fill="{DynamicResource Brush.BorderStrong}"/>
            </StackPanel>
          </Button>
        </StackPanel>

        <Border x:Name="CpuSep" Grid.Column="7" Width="1" Height="18" Margin="10,0"
                Background="{DynamicResource Brush.Rule}"/>

        <!-- DSP load (audio-callback time ÷ buffer); the tooltip adds process CPU (MainWindow.SetUpCpuTip) -->
        <StackPanel x:Name="CpuMeter" Grid.Column="8" Spacing="3" VerticalAlignment="Center" Background="Transparent">
          <Border x:Name="CpuBar" Width="52" Height="4" Background="{DynamicResource Brush.BgSunken}"
                  CornerRadius="{StaticResource Radius.Field}" ClipToBounds="True">
            <Border x:Name="CpuFill" Width="0" HorizontalAlignment="Left" CornerRadius="{StaticResource Radius.Field}"
                    Background="{DynamicResource Brush.Success}"/>
          </Border>
          <TextBlock x:Name="CpuText" Classes="Mono CellLabel" Text="DSP 0%" FontWeight="Normal"/>
        </StackPanel>

        <!-- Master: a flat bar with its dB value inside, the meter under it -->
        <StackPanel x:Name="MasterWell" Grid.Column="9" Orientation="Horizontal" Spacing="8" Margin="10,0,0,0" VerticalAlignment="Center">
          <TextBlock Classes="CellLabel" Text="{app:T 'common.master'}" VerticalAlignment="Center"/>
          <StackPanel Spacing="2" VerticalAlignment="Center">
            <Panel x:Name="MasterVolHost" Width="120" Height="16"/>
            <Panel x:Name="MasterMeterHost" Width="120" Height="8"/>
          </StackPanel>
        </StackPanel>

        <!-- More (#520): what the bar had no room for, as a menu, then a few quick settings
             (MainWindow.TransportOverflow.cs). Never shed. The dot says something is in it. -->
        <Button x:Name="OverflowBtn" Grid.Column="10" Classes="tp-icon" Margin="8,0,0,0" VerticalAlignment="Center"
                Click="OnOverflowClick"
                ToolTip.Tip="{app:T 'main.more'}" AutomationProperties.Name="{app:T 'main.more'}">
          <Panel>
            <app:Glyph Kind="More" Size="16"/>
            <Ellipse x:Name="OverflowDot" Width="5" Height="5" IsVisible="False"
                     HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-3,-4,0"
                     Fill="{DynamicResource Brush.Accent}"/>
          </Panel>
        </Button>
      </Grid>
    </Border>

    <!-- Status line (22): caption text on the deep tone, a seam above it. -->
    <Border x:Name="StatusBar" DockPanel.Dock="Bottom" Background="{DynamicResource Brush.SurfaceDeep}"
            BorderBrush="{DynamicResource Brush.Seam}" BorderThickness="0,1,0,0"
            Height="22" Padding="16,0">
      <Grid ColumnDefinitions="*,Auto,Auto,Auto,Auto,Auto,Auto">
        <TextBlock Classes="Caption" VerticalAlignment="Center" Text="{Binding StatusText}"/>
        <!-- Settings → Downloads job (MainWindow.Downloads.cs): it keeps running after Settings closes. -->
        <Panel x:Name="DownloadHost" Grid.Column="1" VerticalAlignment="Center"/>
        <!-- Background-operation strip: label + thin bar, shown only while a background op runs. -->
        <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8"
                    VerticalAlignment="Center" Margin="0,0,14,0"
                    IsVisible="{Binding BackgroundBusy}">
          <TextBlock Classes="Caption" VerticalAlignment="Center" Text="{Binding BackgroundLabel}"/>
          <ProgressBar Width="120" Height="4" VerticalAlignment="Center"
                       Minimum="0" Maximum="100"
                       Value="{Binding BackgroundProgress}"
                       IsIndeterminate="{Binding BackgroundIndeterminate}"
                       Foreground="{DynamicResource Brush.Accent}"
                       Background="{DynamicResource Brush.BgSunken}"/>
        </StackPanel>
        <!-- A newer Nota release: available / downloading / ready to install (MainWindow.Updates.cs). -->
        <Panel x:Name="UpdateHost" Grid.Column="3" VerticalAlignment="Center"/>
        <!-- Audio dropouts since the device started, in red and hidden at 0; a click resets it (#271). -->
        <Button x:Name="DropoutButton" Grid.Column="4" Classes="ghost" IsVisible="{Binding HasDropouts}"
                VerticalAlignment="Center" Margin="0" Padding="6,1" MinHeight="0" Cursor="Hand"
                ToolTip.Tip="{app:T 'main.audio_dropouts_since_the_device'}">
          <TextBlock Classes="Caption Mono alert" Text="{Binding DropoutText}"/>
        </Button>
        <!-- Sample rate · buffer size: opens the buffer menu (MainWindow.AudioFormat.cs, #373). -->
        <Button x:Name="AudioFormatButton" Grid.Column="5" Classes="ghost"
                VerticalAlignment="Center" Margin="0" Padding="6,1" MinHeight="0" Cursor="Hand"
                ToolTip.Tip="{app:T 'main.sample_rate_and_buffer_size'}">
          <TextBlock Classes="Caption Mono" Text="{Binding EngineInfo}"/>
        </Button>
        <!-- The installed version: opens its release notes (What's New), never an update (#127). -->
        <Button x:Name="VersionButton" Grid.Column="6" Classes="ghost"
                VerticalAlignment="Center" Margin="0,0,-6,0" Padding="6,1" MinHeight="0"
                Cursor="Hand" ToolTip.Tip="{app:T 'main.view_release_notes'}">
          <TextBlock x:Name="VersionText" Classes="Caption Mono"/>
        </Button>
      </Grid>
    </Border>


    <!-- Main area (fills) over a resizable bottom Detail panel, split by a
         draggable horizontal GridSplitter. -->
    <Grid x:Name="BodyGrid" Background="{DynamicResource Brush.Seam}">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" MinHeight="120"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="0"/>
      </Grid.RowDefinitions>

      <!-- Left browser + main area (fills). Both are docked panels that meet on a 1px seam
           (the grid's seam-coloured ground showing through a 1px margin). The splitter takes
           no space of its own — it is a transparent 6px grab strip laid over the seam
           (negative margins; MinWidth=0 overrides the theme's 6px floor). -->
      <Grid x:Name="BrowserGrid" Grid.Row="0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="344" MinWidth="160" MaxWidth="480"/>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <app:BrowserView x:Name="Browser" Grid.Column="0" Margin="0,0,1,0"/>
        <GridSplitter x:Name="BrowserSplitter" Grid.Column="1" Width="6" MinWidth="0" Margin="-4,0,-2,0"
                      Background="Transparent" ResizeDirection="Columns"/>
        <Panel x:Name="MainContent" Grid.Column="2">
          <app:ArrangementView x:Name="Timeline"/>
        </Panel>
      </Grid>

      <!-- Docked Mixer (specs/054): its own bottom panel, directly under the main view and
           above the Detail panel; either, both or neither can be shown. Rows are built by
           LayoutBottomPanels (MainWindow.Detail.cs) — the Grid.Row values here are placeholders.
           The single MixerView is moved between MixerHost and the Mixer window. -->
      <GridSplitter x:Name="MixerSplitter"
                    Grid.Row="1"
                    Height="6" MinHeight="0" Margin="0,-3,0,-3"
                    IsVisible="False"
                    HorizontalAlignment="Stretch" ResizeDirection="Rows"
                    Background="Transparent"/>
      <Border x:Name="MixerPanel" Grid.Row="2" Margin="0,1,0,0" IsVisible="False" ClipToBounds="True"
              Background="{DynamicResource Brush.BgApp}" BorderThickness="0"
              CornerRadius="{StaticResource Radius.Docked}">
        <DockPanel>
          <!-- Panel toolbar (32, seam under it): caption · Strips | Stereo map · | · pop out · close -->
          <Border DockPanel.Dock="Top" Height="32" Background="{DynamicResource Brush.Panel}"
                  BorderBrush="{DynamicResource Brush.Seam}" BorderThickness="0,0,0,1">
          <Grid Margin="12,0,6,0" ColumnDefinitions="Auto,Auto,*,Auto,Auto,Auto">
            <TextBlock Text="{app:T 'common.mixer'}" Classes="Title" VerticalAlignment="Center"/>
            <Border Grid.Column="1" Classes="segmented" Margin="14,0,0,0" VerticalAlignment="Center">
              <StackPanel Orientation="Horizontal" Spacing="1">
                <ToggleButton x:Name="MixerStripsBtn" Classes="seg" Content="{app:T 'main.strips'}" Click="OnMixerStrips"/>
                <ToggleButton x:Name="MixerMapBtn" Classes="seg" Content="{app:T 'common.stereo_map'}" Click="OnMixerMap"/>
              </StackPanel>
            </Border>
            <Border Grid.Column="3" Width="1" Height="16" Margin="10,0,6,0" VerticalAlignment="Center"
                    Background="{DynamicResource Brush.Rule}"/>
            <Button x:Name="MixerPopOut" Grid.Column="4" Classes="ghost" Height="22" Padding="6,0"
                    Foreground="{DynamicResource Brush.TextTertiary}" Click="OnMixerPopOut"
                    ToolTip.Tip="{app:T 'main.open_the_mixer_in_a'}">
              <app:Glyph Kind="PopOut"/>
            </Button>
            <Button Grid.Column="5" Classes="ghost" Height="22" Margin="2,0,0,0" Padding="6,0"
                    Foreground="{DynamicResource Brush.TextTertiary}" Click="OnCloseMixer" ToolTip.Tip="{app:T 'main.hide_the_mixer'}">
              <app:Glyph Kind="Close"/>
            </Button>
          </Grid>
          </Border>
          <ContentControl x:Name="MixerHost"/>
        </DockPanel>
      </Border>

      <!-- Drag handle to resize the Detail panel (only shown when it is open). Like the
           browser splitter it is a 6px strip laid over the seam instead of adding height. -->
      <GridSplitter x:Name="DetailSplitter"
                    Grid.Row="3"
                    Height="6" MinHeight="0" Margin="0,-3,0,-3"
                    IsVisible="False"
                    HorizontalAlignment="Stretch" ResizeDirection="Rows"
                    Background="Transparent"/>
      <!-- With the Mixer docked above it, a GridSplitter here would trade height between the
           two panels; this edge resizes the Detail panel alone (MainWindow.Detail.cs). -->
      <Border x:Name="DetailEdge" Grid.Row="3" Height="6" Margin="0,-3,0,-3" IsVisible="False"
              Background="Transparent" Cursor="SizeNorthSouth"/>

      <!-- Detail panel: Devices chain / Pattern / Clip (piano roll) for the selected track.
           Docked under the canvas (or the docked Mixer) on a seam, like the browser beside it. -->
      <Border x:Name="DetailPanel" Grid.Row="4" Margin="0,1,0,0" IsVisible="False" ClipToBounds="True"
              Background="{DynamicResource Brush.SurfaceDeep}" BorderThickness="0"
              CornerRadius="{StaticResource Radius.Docked}">
        <DockPanel>
          <!-- Panel toolbar (32, seam under it): mode tabs · track chip (routing/PDC) ·
               Freeze · | · fill the window (clip tabs) · pop out · close -->
          <Border DockPanel.Dock="Top" Height="32" Background="{DynamicResource Brush.SurfaceDeep}"
                  BorderBrush="{DynamicResource Brush.Seam}" BorderThickness="0,0,0,1">
          <Grid Margin="8,0,6,0" ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto,Auto">
            <Border Classes="segmented" VerticalAlignment="Center">
              <StackPanel Orientation="Horizontal" Spacing="1">
                <ToggleButton x:Name="DetailDevicesBtn" Classes="seg" Content="{app:T 'main.devices'}" Click="OnDetailDevices"/>
                <ToggleButton x:Name="DetailPatternBtn" Classes="seg" Content="{app:T 'common.pattern'}" IsEnabled="False" IsVisible="False"
                              ToolTip.Tip="{app:T 'main.step_the_selected_midi_clip'}"
                              Click="OnDetailPattern"/>
                <ToggleButton x:Name="DetailClipBtn" Classes="seg" Content="{app:T 'common.clip'}" IsEnabled="False"
                              ToolTip.Tip="{app:T 'main.select_a_clip_to_edit'}" Click="OnDetailClip"/>
              </StackPanel>
            </Border>
            <ContentControl x:Name="DetailChipHost" Grid.Column="1" Margin="14,0,0,0" VerticalAlignment="Center"/>
            <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="4" VerticalAlignment="Center">
              <Button x:Name="FreezeBtn" Height="22" Padding="9,0" VerticalAlignment="Center"
                      Click="OnFreezeClick"
                      ToolTip.Tip="{app:T 'main.freeze_the_track_to_audio'}">
                <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
                  <app:Glyph x:Name="FreezeIcon" Kind="Freeze" Foreground="{DynamicResource Brush.TextSecondary}"/>
                  <TextBlock x:Name="FreezeLabel" Text="{app:T 'common.freeze'}" FontSize="11" VerticalAlignment="Center"
                             Foreground="{DynamicResource Brush.TextSecondary}"/>
                </StackPanel>
              </Button>
              <Button x:Name="LiveFreezeBtn" Height="22" Padding="9,0" VerticalAlignment="Center"
                      IsVisible="False" Click="OnLiveFreezeClick"
                      ToolTip.Tip="{app:T 'main.bounce_to_a_linked_audio'}">
                <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
                  <app:Glyph Kind="ChainLink" Size="14" Foreground="{DynamicResource Brush.TextSecondary}"/>
                  <TextBlock Text="{app:T 'main.live_freeze'}" FontSize="11" VerticalAlignment="Center"
                             Foreground="{DynamicResource Brush.TextSecondary}"/>
                </StackPanel>
              </Button>
              <Button x:Name="EditBtn" Height="22" Padding="9,0" VerticalAlignment="Center"
                      IsVisible="False" Click="OnEditClick"
                      ToolTip.Tip="{app:T 'main.wake_the_frozen_source_to'}">
                <StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
                  <app:Glyph x:Name="EditGlyph" Kind="Edit" Foreground="{DynamicResource Brush.AccentBright}"/>
                  <TextBlock Text="{app:T 'common.edit'}" FontSize="11" VerticalAlignment="Center" Foreground="{DynamicResource Brush.AccentBright}"/>
                </StackPanel>
              </Button>
              <Button x:Name="DoneBtn" Height="22" Padding="9,0" VerticalAlignment="Center"
                      IsVisible="False" Click="OnDoneClick"
                      ToolTip.Tip="{app:T 'main.re_freeze_the_source_and'}">
                <StackPanel Orientation="Horizontal" Spacing="5" VerticalAlignment="Center">
                  <app:Glyph x:Name="DoneGlyph" Kind="Check" Foreground="{DynamicResource Brush.AccentBright}"/>
                  <TextBlock Text="{app:T 'main.done'}" FontSize="11" VerticalAlignment="Center" Foreground="{DynamicResource Brush.AccentBright}"/>
                </StackPanel>
              </Button>
              <Button x:Name="DiscardBtn" Classes="ghost" Height="22" Padding="6,0" VerticalAlignment="Center"
                      IsVisible="False" Click="OnDiscardClick"
                      ToolTip.Tip="{app:T 'main.leave_edit_mode_without_re'}">
                <app:Glyph x:Name="DiscardGlyph" Kind="Cross" Foreground="{DynamicResource Brush.TextTertiary}"/>
              </Button>
            </StackPanel>
            <Border Grid.Column="3" Width="1" Height="16" Margin="10,0,6,0" VerticalAlignment="Center"
                    Background="{DynamicResource Brush.Rule}"/>
            <Button x:Name="DetailMaximizeBtn" Grid.Column="4" Classes="ghost" Height="22" Margin="0,0,2,0" Padding="6,0"
                    Foreground="{DynamicResource Brush.TextTertiary}" Click="OnDetailMaximize" IsVisible="False"
                    ToolTip.Tip="{app:T 'main.fill_the_window_with_the'}">
              <app:Glyph x:Name="DetailMaximizeGlyph" Kind="Expand"/>
            </Button>
            <Button x:Name="DetailPopOut" Grid.Column="5" Classes="ghost" Height="22" Padding="6,0"
                    Foreground="{DynamicResource Brush.TextTertiary}" Click="OnToggleDetailWindow"
                    ToolTip.Tip="{app:T 'main.open_devices_and_clip_in'}">
              <app:Glyph x:Name="PopOutGlyph" Kind="PopOut"/>
            </Button>
            <Button Grid.Column="6" Classes="ghost" Height="22" Margin="2,0,0,0" Padding="6,0"
                    Foreground="{DynamicResource Brush.TextTertiary}" Click="OnCloseDetail" ToolTip.Tip="{app:T 'common.close'}">
              <app:Glyph x:Name="CloseDetailGlyph" Kind="Close"/>
            </Button>
          </Grid>
          </Border>
          <ContentControl x:Name="DetailBody"/>
        </DockPanel>
      </Border>
    </Grid>
  </DockPanel>
    <!-- MIDI-learn glass: highlights mappable controls + captures the learn click. -->
    <app:MidiLearnOverlay x:Name="LearnOverlay" IsHitTestVisible="False"/>
    <!-- Command palette + its toast (MainWindow.Palette.cs); empty until ⌘⇧P. -->
    <Panel x:Name="PaletteLayer"/>
  </Panel>
</Window>