Feat: early mouse support
This commit is contained in:
@@ -46,6 +46,44 @@ impl CyclicEnum for OptionsFocus {
|
||||
];
|
||||
}
|
||||
|
||||
const FOCUS_LINES: &[(OptionsFocus, usize)] = &[
|
||||
(OptionsFocus::ColorScheme, 2),
|
||||
(OptionsFocus::HueRotation, 3),
|
||||
(OptionsFocus::RefreshRate, 4),
|
||||
(OptionsFocus::RuntimeHighlight, 5),
|
||||
(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),
|
||||
];
|
||||
|
||||
impl OptionsFocus {
|
||||
pub fn line_index(self) -> usize {
|
||||
FOCUS_LINES
|
||||
.iter()
|
||||
.find(|(f, _)| *f == self)
|
||||
.map(|(_, l)| *l)
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
pub fn at_line(line: usize) -> Option<OptionsFocus> {
|
||||
FOCUS_LINES
|
||||
.iter()
|
||||
.find(|(_, l)| *l == line)
|
||||
.map(|(f, _)| *f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct OptionsState {
|
||||
pub focus: OptionsFocus,
|
||||
|
||||
Reference in New Issue
Block a user