mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
grid -> arranger
This commit is contained in:
parent
d99a08bcf7
commit
f1f812d0fb
5 changed files with 131 additions and 191 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::core::*;
|
||||
use crate::model::*;
|
||||
use crate::view::*;
|
||||
pub struct SceneGridViewVertical<'a> {
|
||||
pub struct ArrangerViewVertical<'a> {
|
||||
pub buf: &'a mut Buffer,
|
||||
pub area: Rect,
|
||||
pub scenes: &'a[Scene],
|
||||
|
|
@ -10,7 +10,7 @@ pub struct SceneGridViewVertical<'a> {
|
|||
pub focused: bool,
|
||||
pub entered: bool,
|
||||
}
|
||||
impl<'a> SceneGridViewVertical<'a> {
|
||||
impl<'a> ArrangerViewVertical<'a> {
|
||||
pub fn size (&self) -> (u16, u16) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
@ -37,14 +37,12 @@ impl<'a> SceneGridViewVertical<'a> {
|
|||
} else {
|
||||
Color::Rgb(20, 45, 5)
|
||||
};
|
||||
let columns = self.track_names();
|
||||
let mut x2 = x;
|
||||
for (i, w) in self.track_widths().iter().enumerate() {
|
||||
let focus_column = i == self.cursor.0;
|
||||
if x2 >= x + width {
|
||||
break
|
||||
}
|
||||
//self.separator_v(x2, focus_column);
|
||||
if focus_column {
|
||||
fill_bg(
|
||||
&mut self.buf,
|
||||
|
|
@ -53,9 +51,9 @@ impl<'a> SceneGridViewVertical<'a> {
|
|||
);
|
||||
}
|
||||
x2 = x2 + w;
|
||||
//self.separator_v(x2, focus_column);
|
||||
}
|
||||
let (mut x2, y2) = (x, y);
|
||||
let columns = self.track_names();
|
||||
for (i, title) in columns.iter().enumerate() {
|
||||
let focus_column = i == self.cursor.0;
|
||||
if x2 >= x + width {
|
||||
|
|
@ -77,7 +75,16 @@ impl<'a> SceneGridViewVertical<'a> {
|
|||
self.clips(x2+1, y2+2, i - 1);
|
||||
};
|
||||
let style = Some(highlight(self.focused, focus_column).bold());
|
||||
title.blit(self.buf, x2+1, y2, style);
|
||||
if i > 0 {
|
||||
"⏺".blit(self.buf, x2, y2, Some(if self.tracks[i-1].recording {
|
||||
Style::default().red()
|
||||
} else if self.tracks[i-1].monitoring {
|
||||
Style::default().green()
|
||||
} else {
|
||||
Style::default().black()
|
||||
}));
|
||||
}
|
||||
title.blit(self.buf, x2+2, y2, style);
|
||||
x2 = x2 + w + 3;
|
||||
}
|
||||
fill_bg(
|
||||
|
|
@ -187,7 +194,7 @@ impl<'a> SceneGridViewVertical<'a> {
|
|||
|
||||
}
|
||||
|
||||
pub struct SceneGridViewHorizontal<'a> {
|
||||
pub struct ArrangerViewHorizontal<'a> {
|
||||
pub buf: &'a mut Buffer,
|
||||
pub area: Rect,
|
||||
pub scenes: &'a[Scene],
|
||||
|
|
@ -196,7 +203,7 @@ pub struct SceneGridViewHorizontal<'a> {
|
|||
pub focused: bool,
|
||||
pub entered: bool,
|
||||
}
|
||||
impl<'a> SceneGridViewHorizontal<'a> {
|
||||
impl<'a> ArrangerViewHorizontal<'a> {
|
||||
pub fn size (&self) -> (u16, u16) {
|
||||
let w = (4 + longest_track_name(&self.tracks) + self.scenes.len() as u16 * 10) as u16;
|
||||
let h = (2 + self.tracks.len()) as u16;
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
use crate::*;
|
||||
|
||||
//trait Focus<T> {
|
||||
//fn focused (&self) -> &T;
|
||||
//fn focused_mut (&mut self) -> &mut T;
|
||||
//fn focus (&mut self, value: T) -> &mut T;
|
||||
//fn focus_next (&mut self) -> &mut T;
|
||||
//fn focus_prev (&mut self) -> &mut T;
|
||||
//fn focus_enter (&mut self) -> &mut T;
|
||||
//fn focus_exit (&mut self) -> &mut T;
|
||||
//}
|
||||
|
||||
//enum AppSection {
|
||||
//Grid,
|
||||
//Sequence,
|
||||
//Chain,
|
||||
//}
|
||||
|
||||
//impl Focus<Self> for (AppSection, bool) {
|
||||
//fn focused (&self) -> &Self {
|
||||
//self
|
||||
//}
|
||||
//fn focused_mut (&mut self) -> &mut Self {
|
||||
//self
|
||||
//}
|
||||
//fn focus (&mut self, value: Self) -> &mut Self {
|
||||
//*self = value;
|
||||
//self
|
||||
//}
|
||||
//fn focus_prev (&mut self) -> &mut Self {
|
||||
//self.focus((match self.0 {
|
||||
//AppSection::Grid => AppSection::Chain,
|
||||
//AppSection::Sequence => AppSection::Grid,
|
||||
//AppSection::Chain => AppSection::Sequence,
|
||||
//}, self.1))
|
||||
//}
|
||||
//fn focus_next (&mut self) -> &mut Self {
|
||||
//self.focus((match self.0 {
|
||||
//AppSection::Grid => AppSection::Sequence,
|
||||
//AppSection::Sequence => AppSection::Chain,
|
||||
//AppSection::Chain => AppSection::Grid,
|
||||
//}, self.1))
|
||||
//}
|
||||
//}
|
||||
|
||||
/*
|
||||
|
||||
App(
|
||||
Column(
|
||||
Transport(
|
||||
Row(PLAY, REC, DUB, MON, BPM, SYNC, QUANT, _, TIME, BBT),
|
||||
RowOrColumn(
|
||||
Grid,
|
||||
|
||||
)
|
||||
|
||||
<App>
|
||||
<Transport />
|
||||
<Grid>
|
||||
<Chains>
|
||||
App
|
||||
\ (Transport)
|
||||
\ Grid
|
||||
\ Chains
|
||||
\ Sequencer + Chain
|
||||
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue