- Master recording (MasterSink ring + writer thread) and the sample recorder - CoreMIDI in/out: sound module, clock send/follow, virtual "Sizzle" ports; platform-free parser/module/clock in core (midi_test) - Hardware keyboard and gamepads via GameController; rebindable keyboard, gamepad and MIDI CC actions; per-parameter MIDI learn - Colour themes (.szt), project bundles (.szgz), backup & restore; ZIP in core with zlib (zip_test against jar and unzip) - Persistent app settings; audio pauses in the background unless sound module Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87 lines
3.1 KiB
Swift
87 lines
3.1 KiB
Swift
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import SwiftUI
|
|
|
|
/// Sizzle's four tabs (Tracker, Mix, Toolbox, Setup) with a bottom bar in
|
|
/// portrait and a side rail in landscape, as the Android app's App.kt lays them out.
|
|
struct RootView: View {
|
|
@ObservedObject private var app: AppModel
|
|
/// The whole tree is rebuilt when the theme changes (Theme is read, not observed).
|
|
@ObservedObject private var settings = AppSettings.shared
|
|
init(model: AppModel? = nil) { app = model ?? AppModel.main }
|
|
@Environment(\.scenePhase) private var phase
|
|
@Environment(\.verticalSizeClass) private var vClass
|
|
|
|
var body: some View {
|
|
GeometryReader { geo in
|
|
let landscape = geo.size.width > geo.size.height
|
|
Group {
|
|
if landscape {
|
|
HStack(spacing: 0) { rail; Divider().background(Theme.grid); screen }
|
|
} else {
|
|
VStack(spacing: 0) { screen; Divider().background(Theme.grid); bar }
|
|
}
|
|
}
|
|
.background(Theme.background.ignoresSafeArea())
|
|
}
|
|
.environmentObject(app)
|
|
.id(settings.paletteName)
|
|
.preferredColorScheme(.dark)
|
|
.onChange(of: phase) { p in
|
|
switch p {
|
|
case .background: AppBoot.background()
|
|
case .active: AppBoot.foreground()
|
|
default: app.session.autosave()
|
|
}
|
|
}
|
|
}
|
|
|
|
@ViewBuilder private var screen: some View {
|
|
Group {
|
|
switch app.tab {
|
|
case .tracker: TrackerScreen()
|
|
case .mix: MixScreen()
|
|
case .toolbox: ToolboxScreen()
|
|
case .setup: SetupScreen()
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
}
|
|
|
|
private let tabs: [(AppModel.Tab, String, String)] = [
|
|
(.tracker, "Tracker", "square.grid.3x3"), (.mix, "Mix", "slider.vertical.3"),
|
|
(.toolbox, "Toolbox", "square.grid.2x2"), (.setup, "Setup", "gearshape"),
|
|
]
|
|
|
|
private var bar: some View {
|
|
HStack {
|
|
ForEach(tabs, id: \.0) { t in tabButton(t).frame(maxWidth: .infinity) }
|
|
}
|
|
.padding(.vertical, 6)
|
|
.background(Theme.surface)
|
|
}
|
|
|
|
private var rail: some View {
|
|
VStack(spacing: 18) {
|
|
ForEach(tabs, id: \.0) { t in tabButton(t) }
|
|
Spacer()
|
|
}
|
|
.padding(.top, 16).frame(width: 84)
|
|
.background(Theme.surface)
|
|
}
|
|
|
|
private func tabButton(_ t: (AppModel.Tab, String, String)) -> some View {
|
|
let on = app.tab == t.0
|
|
return VStack(spacing: 3) {
|
|
Image(systemName: t.2).font(.system(size: 18))
|
|
.frame(width: 56, height: 30)
|
|
.background(on ? Theme.accent : Color.clear, in: Capsule())
|
|
.foregroundColor(on ? Theme.background : Theme.dim)
|
|
Text(t.1).font(.system(size: 12, weight: on ? .bold : .regular)).foregroundColor(on ? Theme.accent : Theme.dim)
|
|
}
|
|
.contentShape(Rectangle())
|
|
.onTapGesture { app.tab = t.0 }
|
|
}
|
|
}
|