mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
rename some view structs
This commit is contained in:
parent
b2386b2992
commit
83e2a285dd
4 changed files with 17 additions and 19 deletions
|
|
@ -35,8 +35,8 @@ impl Content for ArrangerTui {
|
|||
),
|
||||
Split::right(
|
||||
self.splits[1],
|
||||
PhrasesView(self),
|
||||
PhraseView2::from(self),
|
||||
PhraseListView(self),
|
||||
PhraseView::from(self),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct PhraseView2<'a> {
|
||||
pub struct PhraseView<'a> {
|
||||
pub(crate) focused: bool,
|
||||
pub(crate) entered: bool,
|
||||
pub(crate) phrase: &'a Option<Arc<RwLock<Phrase>>>,
|
||||
|
|
@ -13,7 +13,7 @@ pub struct PhraseView2<'a> {
|
|||
pub(crate) now: &'a Arc<Pulse>,
|
||||
}
|
||||
|
||||
impl<'a, T: HasEditor> From<&'a T> for PhraseView2<'a> {
|
||||
impl<'a, T: HasEditor> From<&'a T> for PhraseView<'a> {
|
||||
fn from (state: &'a T) -> Self {
|
||||
Self {
|
||||
focused: state.editor_focused(),
|
||||
|
|
@ -30,7 +30,7 @@ impl<'a, T: HasEditor> From<&'a T> for PhraseView2<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Content for PhraseView2<'a> {
|
||||
impl<'a> Content for PhraseView<'a> {
|
||||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
let Self {
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ use crate::*;
|
|||
impl Widget for PhrasesModel {
|
||||
type Engine = Tui;
|
||||
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
PhrasesView(self).layout(to)
|
||||
PhraseListView(self).layout(to)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
PhrasesView(self).render(to)
|
||||
PhraseListView(self).render(to)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PhrasesView<'a, T: PhrasesViewState>(pub &'a T);
|
||||
pub struct PhraseListView<'a, T: PhraseListViewState>(pub &'a T);
|
||||
|
||||
// TODO: Display phrases always in order of appearance
|
||||
impl<'a, T: PhrasesViewState> Content for PhrasesView<'a, T> {
|
||||
impl<'a, T: PhraseListViewState> Content for PhraseListView<'a, T> {
|
||||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
let focused = self.0.phrases_focused();
|
||||
|
|
@ -72,7 +72,7 @@ impl<'a, T: PhrasesViewState> Content for PhrasesView<'a, T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait PhrasesViewState: Send + Sync {
|
||||
pub trait PhraseListViewState: Send + Sync {
|
||||
fn phrases_focused (&self) -> bool;
|
||||
fn phrases_entered (&self) -> bool;
|
||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>>;
|
||||
|
|
@ -82,7 +82,7 @@ pub trait PhrasesViewState: Send + Sync {
|
|||
|
||||
macro_rules! impl_phrases_view_state {
|
||||
($Struct:ident $(:: $field:ident)* [$self1:ident: $focus:expr] [$self2:ident: $enter:expr]) => {
|
||||
impl PhrasesViewState for $Struct {
|
||||
impl PhraseListViewState for $Struct {
|
||||
fn phrases_focused (&$self1) -> bool {
|
||||
$focus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ use crate::*;
|
|||
impl Content for SequencerTui {
|
||||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
SequencerStatusBar::with(self, lay!(
|
||||
col!(
|
||||
TransportView::from(self),
|
||||
Split::right(20,
|
||||
widget(&PhrasesView(self)),
|
||||
widget(&PhraseView2::from(self)),
|
||||
).min_y(20)
|
||||
),
|
||||
SequencerStatusBar::with(self, col!(
|
||||
TransportView::from(self),
|
||||
Split::right(20,
|
||||
PhraseListView(self),
|
||||
PhraseView::from(self),
|
||||
).min_y(20)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue