mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
refactor control and sequencer rendering
This commit is contained in:
parent
20b7267225
commit
14d9116c7c
10 changed files with 370 additions and 405 deletions
30
src/model.rs
30
src/model.rs
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue