diff --git a/Demo/ShoeGazeBuilder/AppDelegate.swift b/Demo/ShoeGazeBuilder/AppDelegate.swift index c6fe550..6261809 100644 --- a/Demo/ShoeGazeBuilder/AppDelegate.swift +++ b/Demo/ShoeGazeBuilder/AppDelegate.swift @@ -65,6 +65,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate { /// Record toggle item, retained so `validateMenuItem(_:)` can flip its title + enabled state. private var recordMenuItem: NSMenuItem? + /// The Help window, created lazily on first open and reused thereafter. + private var helpWindow: LyrebirdWindow? + /// Default file name offered by the archive Export panel. private static let defaultArchiveFileName: String = "ShoeGaze Library" @@ -300,6 +303,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate { key: "R" // ⇧⌘R ) + // Help menu — opens the in-app guide. + let helpMenuItem: NSMenuItem = NSMenuItem() + mainMenu.addItem(helpMenuItem) + let helpMenu: NSMenu = NSMenu(title: "Help") + helpMenuItem.submenu = helpMenu + addItem(to: helpMenu, title: "ShoeGaze Help", action: #selector(showHelpAction(_:)), key: "?") + NSApplication.shared.mainMenu = mainMenu } @@ -319,6 +329,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate { // MARK: - Menu actions + /// Opens (or re-opens) the Help window hosting the shared ``HelpView``. + @objc private func showHelpAction(_ sender: Any?) { + let helpWidth: CGFloat = 560 + let helpHeight: CGFloat = 720 + if helpWindow == nil { + helpWindow = LyrebirdWindow(title: "ShoeGaze Help", width: helpWidth, height: helpHeight) + } + helpWindow?.open { + HelpView() + } + } + @objc private func newRigAction(_ sender: Any?) { // Forward to the builder view, which owns the current-rig state and naming prompt. NotificationCenter.default.post(name: .shoeGazeNewRig, object: nil) diff --git a/Sources/LyrebirdShoeGazeUI/HelpView.swift b/Sources/LyrebirdShoeGazeUI/HelpView.swift new file mode 100644 index 0000000..0c17815 --- /dev/null +++ b/Sources/LyrebirdShoeGazeUI/HelpView.swift @@ -0,0 +1,139 @@ +// HelpView.swift +// Lyrebird +// +// Copyright (c) 2026 Joshua Parmenter / realizedsound +// SPDX-License-Identifier: MIT + +import SwiftUI + +/// The in-app user guide, shared by both platforms — presented from the macOS **Help** menu (in a +/// window) and an iOS **?** button (in a sheet). +/// +/// A sectioned `List` of topics: setup, the engine, input, boards & rigs, saving, iCloud, and MIDI. +/// Text + SF Symbols only for now; each topic leaves room for a bundled screenshot to be dropped in +/// later (see the commented slot in ``topicSection(icon:title:intro:steps:)``). +public struct HelpView: View { + + // MARK: - Constants + + private static let windowMinWidth: CGFloat = 520 + private static let windowMinHeight: CGFloat = 620 + private static let bulletSpacing: CGFloat = 6 + + // MARK: - Init + + /// Creates the help view. + public init() {} + + @Environment(\.dismiss) private var dismiss + + // MARK: - Body + + public var body: some View { + NavigationStack { + List { + topicSection( + icon: "power", + title: "Setup & Starting the Engine", + intro: "ShoeGaze runs your guitar — or a built-in test phrase — through a chain " + + "of pedals. Configure the audio, then press Start.", + steps: [ + "Set the sample Rate and the input/output channel counts in the top-right controls.", + "Press Start to run the engine; press again to Stop. Most controls stay live while running.", + "Bypass Rig compares your sound with and without the whole pedalboard.", + ] + ) + topicSection( + icon: "waveform", + title: "Choosing an Input", + intro: "Pick what feeds the board.", + steps: [ + "Input ▸ Test Loop plays a built-in phrase, so you can hear the rig with no guitar connected.", + "Input ▸ In 0 (Live Input on iOS) uses your audio interface or mic. iOS asks for " + + "microphone access the first time you enable it.", + ] + ) + topicSection( + icon: "square.stack.3d.up", + title: "Boards & Rigs", + intro: "A rig is a set of boards; a board is a chain of pedals.", + steps: [ + "Drag a pedal from the palette onto the chain to add it; drop it onto a pedal to " + + "insert before it; tap a palette pedal to append.", + "Add boards with +. Solo / Blend / All choose which boards you hear; XFade sets the " + + "crossfade time; each board has S (solo) and B (bypass).", + "The Rigs sidebar lists saved rigs, with New, Save, Save As, Duplicate, Rename, " + + "Delete, and Erase All.", + ] + ) + topicSection( + icon: "square.and.arrow.down", + title: "Saving & Autosave", + intro: "Your work is kept two ways.", + steps: [ + "Save writes the current rig to the highlighted library entry; Save As creates a new one.", + "The working session autosaves continuously, so it returns on relaunch even without an " + + "explicit Save. The sidebar highlights the rig the session came from.", + ] + ) + topicSection( + icon: "icloud", + title: "iCloud Documents", + intro: "Keep your rig library in sync across devices.", + steps: [ + "With iCloud Drive on, saved rigs sync across your devices. The cloud icon in the Rigs " + + "header shows the status.", + "A slashed cloud means local-only. Sign in to iCloud and turn on iCloud Drive in " + + "Settings, then reopen ShoeGaze.", + ] + ) + topicSection( + icon: "pianokeys", + title: "MIDI Control", + intro: "Map a MIDI foot controller (e.g. a Behringer FCB1010) for hands-free control.", + steps: [ + "The keys icon in the top bar lights green when a device is connected. Tap it to open MIDI Mapping.", + "Switches (Program Change): footswitches toggle Rig Bypass, All Boards, and each board's " + + "Solo / Audible / Bypass or a pedal's bypass. Tap Learn, then press the footswitch. " + + "One switch can drive several actions at once — a scene.", + "Expression (Control Change): an expression pedal sweeps any pedal knob or slider, or a " + + "board's Level. Tap Learn, then move the pedal. Invert reverses the sweep — map one " + + "CC to two controls and invert one for a crossfade.", + ] + ) + } + .navigationTitle("ShoeGaze Help") + .toolbar { + ToolbarItem(placement: .confirmationAction) { + Button("Done") { dismiss() } + } + } + } + .frame(minWidth: HelpView.windowMinWidth, minHeight: HelpView.windowMinHeight) + } + + // MARK: - Topic section + + private func topicSection( + icon: String, + title: String, + intro: String, + steps: [String] + ) -> some View { + Section { + Text(intro) + .font(.subheadline) + ForEach(steps, id: \.self) { step in + HStack(alignment: .firstTextBaseline, spacing: HelpView.bulletSpacing) { + Text("•") + Text(step) + } + .font(.callout) + } + // Screenshot slot: Image("help-\(icon)", bundle: .module).resizable().scaledToFit() + // once captures are added to a Resources.xcassets on this target. + } header: { + Label(title, systemImage: icon) + } + } +} diff --git a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift index a11b6bb..3123a17 100644 --- a/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift +++ b/Sources/LyrebirdShoeGazeUI/ShoeGazeBuilderView.swift @@ -153,6 +153,9 @@ public struct ShoeGazeBuilderView: View { /// MIDI mapping sheet presentation flag. @State private var showMIDISheet: Bool = false + /// Help sheet presentation flag (iOS button; macOS uses the Help menu). + @State private var showHelpSheet: Bool = false + #if !os(macOS) /// iOS recording-folder picker presentation flag. (macOS uses the Record menu.) @State private var showRecordingFolderImporter: Bool = false @@ -305,6 +308,9 @@ public struct ShoeGazeBuilderView: View { MIDIMappingSheet(controller: midi, shoeGaze: shoeGaze) } } + .sheet(isPresented: $showHelpSheet) { + HelpView() + } .overlay(alignment: .top) { midiLearnBanner } } @@ -548,6 +554,7 @@ public struct ShoeGazeBuilderView: View { if let midi: MIDIController = midi { MIDIIndicatorView(controller: midi) { showMIDISheet = true } } + helpButton rigBypassButton EngineConfigView( shoeGaze: shoeGaze, @@ -557,6 +564,19 @@ public struct ShoeGazeBuilderView: View { } } + /// Opens the in-app help. Shown on both platforms; macOS also has a Help menu item. + private var helpButton: some View { + Button { + showHelpSheet = true + } label: { + Image(systemName: "questionmark.circle") + .font(.subheadline) + } + .buttonStyle(.bordered) + .tint(.gray) + .help("Open ShoeGaze Help") + } + /// Global rig bypass — routes every board to its dry input at once (pedals skipped). Lit when /// engaged. A live performance panic/compare control. private var rigBypassButton: some View {