refactor: jack proto-lib

This commit is contained in:
🪞👃🪞 2024-07-04 15:32:41 +03:00
parent 4aadc712b8
commit fe6ffea5df
12 changed files with 467 additions and 441 deletions

View file

@ -4,9 +4,11 @@ use crate::{core::*,model::*,view::*};
pub enum SequencerMode { Tiny, Compact, Horizontal, Vertical, }
pub struct SequencerView<'a> {
pub focused: bool,
pub phrase: Option<&'a Phrase>,
pub ppq: usize,
pub focused: bool,
/// Displayed phrase
pub phrase: Option<&'a Phrase>,
/// Resolution of MIDI sequence
pub ppq: usize,
/// Range of notes to display
pub note_start: usize,
/// Position of cursor within note range
@ -17,9 +19,8 @@ pub struct SequencerView<'a> {
pub time_start: usize,
/// Position of cursor within time range
pub time_cursor: usize,
/// Current time
pub now: usize
pub now: usize
}
impl<'a> Render for SequencerView<'a> {
@ -97,6 +98,10 @@ mod horizontal {
}
}
pub const KEYS_VERTICAL: [&'static str; 6] = [
"", "", "", "", "", "",
];
pub fn keys (buf: &mut Buffer, area: Rect, note0: usize, _notes: &[bool])
-> Usually<Rect>
{
@ -187,6 +192,7 @@ mod horizontal {
}
}
//pub fn footer (
//buf: &mut Buffer,
//area: Rect,
@ -293,6 +299,27 @@ mod horizontal {
//buf.set_string(x, y, c, Style::default());
//}
//pub const KEY_WHITE: Style = Style {
//fg: Some(Color::Gray),
//bg: None,
//underline_color: None,
//add_modifier: ::ratatui::style::Modifier::empty(),
//sub_modifier: ::ratatui::style::Modifier::empty(),
//};
//pub const KEY_BLACK: Style = Style {
//fg: Some(Color::Black),
//bg: None,
//underline_color: None,
//add_modifier: ::ratatui::style::Modifier::empty(),
//sub_modifier: ::ratatui::style::Modifier::empty(),
//};
//pub const KEY_STYLE: [Style;12] = [
//KEY_WHITE, KEY_BLACK, KEY_WHITE, KEY_BLACK, KEY_WHITE,
//KEY_WHITE, KEY_BLACK, KEY_WHITE, KEY_BLACK, KEY_WHITE, KEY_BLACK, KEY_WHITE,
//];
//pub fn keys (s: &Sequencer, buf: &mut Buffer, area: Rect, beat: usize) {
//let ppq = s.timebase.ppq() as usize;
//let Rect { x, y, .. } = area;