refactor control and sequencer rendering

This commit is contained in:
🪞👃🪞 2024-07-07 23:28:07 +03:00
parent 20b7267225
commit 14d9116c7c
10 changed files with 370 additions and 405 deletions

View file

@ -44,7 +44,7 @@ pub struct App {
/// Optional modal dialog
pub modal: Option<Box<dyn Component>>,
/// Currently focused section
pub section: usize,
pub section: AppSection,
/// Whether the section is focused
pub entered: bool,
/// Current frame
@ -290,3 +290,31 @@ struct SelectionMut<'a> {
pub phrase_id: Option<usize>,
pub phrase: Option<&'a mut Phrase>,
}
#[derive(PartialEq, Clone, Copy)]
pub enum AppSection {
Grid,
Sequencer,
Chain,
}
impl Default for AppSection {
fn default () -> Self {
Self::Grid
}
}
impl AppSection {
pub fn prev (&mut self) {
*self = match self {
Self::Grid => Self::Chain,
Self::Sequencer => Self::Grid,
Self::Chain => Self::Sequencer,
}
}
pub fn next (&mut self) {
*self = match self {
Self::Grid => Self::Sequencer,
Self::Sequencer => Self::Chain,
Self::Chain => Self::Grid,
}
}
}