Feat: lots of things, preparing for live gig

This commit is contained in:
2026-02-15 11:23:11 +01:00
parent cfaadd9d33
commit 160546d64d
59 changed files with 1414 additions and 96 deletions

View File

@@ -83,6 +83,7 @@ pub struct AudioConfig {
pub refresh_rate: RefreshRate,
pub show_scope: bool,
pub show_spectrum: bool,
pub show_preview: bool,
pub layout: MainLayout,
}
@@ -101,6 +102,7 @@ impl Default for AudioConfig {
refresh_rate: RefreshRate::default(),
show_scope: true,
show_spectrum: true,
show_preview: true,
layout: MainLayout::default(),
}
}

View File

@@ -27,6 +27,7 @@ pub mod patterns_nav;
pub mod playback;
pub mod project;
pub mod sample_browser;
pub mod undo;
pub mod ui;
pub use audio::{AudioSettings, DeviceKind, EngineSection, MainLayout, Metrics, SettingKind};

View File

@@ -64,6 +64,7 @@ pub enum Modal {
input: String,
},
SetTempo(String),
JumpToStep(String),
AddSamplePath(Box<FileBrowserState>),
Editor,
Preview,

View File

@@ -10,6 +10,7 @@ pub enum OptionsFocus {
ShowScope,
ShowSpectrum,
ShowCompletion,
ShowPreview,
LinkEnabled,
StartStopSync,
Quantum,
@@ -32,6 +33,7 @@ impl CyclicEnum for OptionsFocus {
Self::ShowScope,
Self::ShowSpectrum,
Self::ShowCompletion,
Self::ShowPreview,
Self::LinkEnabled,
Self::StartStopSync,
Self::Quantum,
@@ -54,17 +56,18 @@ const FOCUS_LINES: &[(OptionsFocus, usize)] = &[
(OptionsFocus::ShowScope, 6),
(OptionsFocus::ShowSpectrum, 7),
(OptionsFocus::ShowCompletion, 8),
(OptionsFocus::LinkEnabled, 12),
(OptionsFocus::StartStopSync, 13),
(OptionsFocus::Quantum, 14),
(OptionsFocus::MidiOutput0, 24),
(OptionsFocus::MidiOutput1, 25),
(OptionsFocus::MidiOutput2, 26),
(OptionsFocus::MidiOutput3, 27),
(OptionsFocus::MidiInput0, 31),
(OptionsFocus::MidiInput1, 32),
(OptionsFocus::MidiInput2, 33),
(OptionsFocus::MidiInput3, 34),
(OptionsFocus::ShowPreview, 9),
(OptionsFocus::LinkEnabled, 13),
(OptionsFocus::StartStopSync, 14),
(OptionsFocus::Quantum, 15),
(OptionsFocus::MidiOutput0, 25),
(OptionsFocus::MidiOutput1, 26),
(OptionsFocus::MidiOutput2, 27),
(OptionsFocus::MidiOutput3, 28),
(OptionsFocus::MidiInput0, 32),
(OptionsFocus::MidiInput1, 33),
(OptionsFocus::MidiInput2, 34),
(OptionsFocus::MidiInput3, 35),
];
impl OptionsFocus {

53
src/state/undo.rs Normal file
View File

@@ -0,0 +1,53 @@
use crate::model::{Bank, Pattern};
const MAX_UNDO: usize = 100;
pub enum UndoScope {
Pattern {
bank: usize,
pattern: usize,
data: Pattern,
},
Bank {
bank: usize,
data: Bank,
},
}
pub struct UndoEntry {
pub scope: UndoScope,
pub cursor: (usize, usize, usize),
}
#[derive(Default)]
pub struct UndoHistory {
pub(crate) undo_stack: Vec<UndoEntry>,
redo_stack: Vec<UndoEntry>,
}
impl UndoHistory {
pub fn push(&mut self, entry: UndoEntry) {
self.redo_stack.clear();
if self.undo_stack.len() >= MAX_UNDO {
self.undo_stack.remove(0);
}
self.undo_stack.push(entry);
}
pub fn pop_undo(&mut self) -> Option<UndoEntry> {
self.undo_stack.pop()
}
pub fn push_redo(&mut self, entry: UndoEntry) {
self.redo_stack.push(entry);
}
pub fn pop_redo(&mut self) -> Option<UndoEntry> {
self.redo_stack.pop()
}
pub fn clear(&mut self) {
self.undo_stack.clear();
self.redo_stack.clear();
}
}