This commit is contained in:
2026-01-26 00:24:17 +01:00
parent 016d050678
commit 87fd59549d
12 changed files with 862 additions and 614 deletions

45
src/state/options.rs Normal file
View File

@@ -0,0 +1,45 @@
#[derive(Clone, Copy, PartialEq, Eq, Default)]
pub enum OptionsFocus {
#[default]
RefreshRate,
RuntimeHighlight,
ShowScope,
ShowSpectrum,
ShowCompletion,
LinkEnabled,
StartStopSync,
Quantum,
}
#[derive(Default)]
pub struct OptionsState {
pub focus: OptionsFocus,
}
impl OptionsState {
pub fn next_focus(&mut self) {
self.focus = match self.focus {
OptionsFocus::RefreshRate => OptionsFocus::RuntimeHighlight,
OptionsFocus::RuntimeHighlight => OptionsFocus::ShowScope,
OptionsFocus::ShowScope => OptionsFocus::ShowSpectrum,
OptionsFocus::ShowSpectrum => OptionsFocus::ShowCompletion,
OptionsFocus::ShowCompletion => OptionsFocus::LinkEnabled,
OptionsFocus::LinkEnabled => OptionsFocus::StartStopSync,
OptionsFocus::StartStopSync => OptionsFocus::Quantum,
OptionsFocus::Quantum => OptionsFocus::RefreshRate,
};
}
pub fn prev_focus(&mut self) {
self.focus = match self.focus {
OptionsFocus::RefreshRate => OptionsFocus::Quantum,
OptionsFocus::RuntimeHighlight => OptionsFocus::RefreshRate,
OptionsFocus::ShowScope => OptionsFocus::RuntimeHighlight,
OptionsFocus::ShowSpectrum => OptionsFocus::ShowScope,
OptionsFocus::ShowCompletion => OptionsFocus::ShowSpectrum,
OptionsFocus::LinkEnabled => OptionsFocus::ShowCompletion,
OptionsFocus::StartStopSync => OptionsFocus::LinkEnabled,
OptionsFocus::Quantum => OptionsFocus::StartStopSync,
};
}
}