63 lines
1.2 KiB
Rust
63 lines
1.2 KiB
Rust
use super::CyclicEnum;
|
|
|
|
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
|
pub enum OptionsFocus {
|
|
#[default]
|
|
ColorScheme,
|
|
HueRotation,
|
|
RefreshRate,
|
|
RuntimeHighlight,
|
|
ShowScope,
|
|
ShowSpectrum,
|
|
ShowCompletion,
|
|
LinkEnabled,
|
|
StartStopSync,
|
|
Quantum,
|
|
MidiOutput0,
|
|
MidiOutput1,
|
|
MidiOutput2,
|
|
MidiOutput3,
|
|
MidiInput0,
|
|
MidiInput1,
|
|
MidiInput2,
|
|
MidiInput3,
|
|
}
|
|
|
|
impl CyclicEnum for OptionsFocus {
|
|
const VARIANTS: &'static [Self] = &[
|
|
Self::ColorScheme,
|
|
Self::HueRotation,
|
|
Self::RefreshRate,
|
|
Self::RuntimeHighlight,
|
|
Self::ShowScope,
|
|
Self::ShowSpectrum,
|
|
Self::ShowCompletion,
|
|
Self::LinkEnabled,
|
|
Self::StartStopSync,
|
|
Self::Quantum,
|
|
Self::MidiOutput0,
|
|
Self::MidiOutput1,
|
|
Self::MidiOutput2,
|
|
Self::MidiOutput3,
|
|
Self::MidiInput0,
|
|
Self::MidiInput1,
|
|
Self::MidiInput2,
|
|
Self::MidiInput3,
|
|
];
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct OptionsState {
|
|
pub focus: OptionsFocus,
|
|
}
|
|
|
|
impl OptionsState {
|
|
pub fn next_focus(&mut self) {
|
|
self.focus = self.focus.next();
|
|
}
|
|
|
|
pub fn prev_focus(&mut self) {
|
|
self.focus = self.focus.prev();
|
|
}
|
|
}
|