mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
wip: layout split
This commit is contained in:
parent
c72f7c6f4b
commit
214061a419
3 changed files with 159 additions and 41 deletions
97
src/view.rs
97
src/view.rs
|
|
@ -6,9 +6,11 @@ pub mod sequencer;
|
|||
pub mod transport;
|
||||
pub mod plugin;
|
||||
pub mod border;
|
||||
pub mod split;
|
||||
|
||||
pub use self::border::*;
|
||||
pub use self::layout::*;
|
||||
pub use self::split::*;
|
||||
pub use self::transport::TransportView;
|
||||
pub use self::arranger::*;
|
||||
pub use self::chain::ChainView;
|
||||
|
|
@ -17,49 +19,62 @@ pub use self::sequencer::SequencerView;
|
|||
use crate::{render, App, AppSection, core::*};
|
||||
|
||||
render!(App |self, buf, area| {
|
||||
let Rect { x, y, width, height } = area;
|
||||
let transport = TransportView::new(self).render(buf, area)?;
|
||||
let y = y + transport.height;
|
||||
let arranger = Rect { x, y, width, height };
|
||||
let arranger = ArrangerView::new(&self, !self.arranger_mode).render(buf, arranger)?;
|
||||
let style_entered = if self.entered {
|
||||
Style::default().green()
|
||||
} else {
|
||||
Style::default().green().dim()
|
||||
};
|
||||
if self.section == AppSection::Arranger {
|
||||
QuarterV(style_entered).draw(buf, arranger)
|
||||
}
|
||||
let y = y + arranger.height;
|
||||
if self.track_cursor > 0 {
|
||||
let chain = Rect { x, y: y + height - height / 3 - 1, width, height: height / 3 };
|
||||
let chain = ChainView::new(&self, false).render(buf, chain)?;
|
||||
if self.section == AppSection::Chain {
|
||||
QuarterV(style_entered).draw(buf, Rect { width, ..chain })
|
||||
}
|
||||
let phrase = Rect { x, y, width, height: height - height / 3 };
|
||||
let phrase = SequencerView::new(&self).render(buf, phrase)?;
|
||||
if self.section == AppSection::Sequencer {
|
||||
QuarterV(style_entered).draw(buf, phrase)
|
||||
}
|
||||
} else {
|
||||
let area = Rect { x, y, width, height };
|
||||
let mut x = area.x;
|
||||
for track in self.tracks.iter() {
|
||||
track.name.blit(buf, x + 1, area.y, Some(Style::default().white().bold()));
|
||||
let chain = Rect { x, y: area.y + 1, width: width, height: height - y - 1 };
|
||||
x = x + ChainView {
|
||||
focused: self.section == AppSection::Chain,
|
||||
track: Some(track),
|
||||
vertical: true,
|
||||
}
|
||||
.render(buf, chain)?
|
||||
.width
|
||||
.max(track.name.len() as u16);
|
||||
}
|
||||
};
|
||||
Split::down([
|
||||
&TransportView::new(self),
|
||||
&Split::down([
|
||||
&ArrangerView::new(&self, !self.arranger_mode),
|
||||
&Split::down([
|
||||
&SequencerView::new(&self),
|
||||
&ChainView::new(&self, false)
|
||||
])
|
||||
])
|
||||
]).render(buf, area)?;
|
||||
if let Some(ref modal) = self.modal {
|
||||
modal.render(buf, area)?;
|
||||
}
|
||||
Ok(area)
|
||||
|
||||
//let transport = transport.render(buf, area)?;
|
||||
//let y = y + transport.height;
|
||||
|
||||
//let arranger = arranger.render(buf, Rect { x, y, width, height })?;
|
||||
//let style_entered = if self.entered {
|
||||
//Style::default().green()
|
||||
//} else {
|
||||
//Style::default().green().dim()
|
||||
//};
|
||||
//if self.section == AppSection::Arranger {
|
||||
//QuarterV(style_entered).draw(buf, arranger)
|
||||
//}
|
||||
//let y = y + arranger.height;
|
||||
//if self.track_cursor > 0 {
|
||||
//let chain = ChainView::new(&self, false);
|
||||
//let phrase = SequencerView::new(&self);
|
||||
|
||||
//let chain = chain.render(buf, chain_area)?;
|
||||
//if self.section == AppSection::Chain {
|
||||
//QuarterV(style_entered).draw(buf, Rect { width, ..chain })
|
||||
//}
|
||||
//let phrase = phrase.render(buf, Rect {
|
||||
//x, y, width, height: height - height / 3
|
||||
//})?;
|
||||
//if self.section == AppSection::Sequencer {
|
||||
//QuarterV(style_entered).draw(buf, phrase)
|
||||
//}
|
||||
//} else {
|
||||
//let area = Rect { x, y, width, height };
|
||||
//let mut x = area.x;
|
||||
//for track in self.tracks.iter() {
|
||||
//let chain = ChainView {
|
||||
//focused: self.section == AppSection::Chain,
|
||||
//track: Some(track),
|
||||
//vertical: true,
|
||||
//};
|
||||
//track.name.blit(buf, x + 1, area.y, Some(Style::default().white().bold()));
|
||||
//let chain = chain.render(buf, Rect {
|
||||
//x, y: area.y + 1, width: width, height: height - y - 1
|
||||
//})?;
|
||||
//x = x + chain.width.max(track.name.len() as u16);
|
||||
//}
|
||||
//};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue