mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
wip: focus refactor, e40
This commit is contained in:
parent
94a16b9dbc
commit
364769a2e0
10 changed files with 198 additions and 279 deletions
|
|
@ -9,16 +9,16 @@ pub struct PhraseView<'a, T: PhraseViewState>(pub &'a T);
|
|||
pub trait TransportViewState: ClockApi + Send + Sync {
|
||||
fn transport_selected (&self) -> TransportFocus;
|
||||
fn transport_focused (&self) -> bool;
|
||||
fn bpm_value (&self) -> f64 {
|
||||
fn transport_bpm_value (&self) -> f64 {
|
||||
self.bpm().get()
|
||||
}
|
||||
fn sync_value (&self) -> f64 {
|
||||
fn transport_sync_value (&self) -> f64 {
|
||||
self.sync().get()
|
||||
}
|
||||
fn format_beat (&self) -> String {
|
||||
fn transport_format_beat (&self) -> String {
|
||||
self.current().format_beat()
|
||||
}
|
||||
fn format_msu (&self) -> String {
|
||||
fn transport_format_msu (&self) -> String {
|
||||
self.current().usec.format_msu()
|
||||
}
|
||||
}
|
||||
|
|
@ -55,13 +55,13 @@ pub trait PhrasesViewState: Send + Sync {
|
|||
fn phrase_mode (&self) -> &Option<PhrasesMode>;
|
||||
}
|
||||
macro_rules! impl_phrases_view_state {
|
||||
($Struct:ident $(:: $field:ident)*) => {
|
||||
($Struct:ident $(:: $field:ident)* [$self:ident: $focus:expr] [self: $enter:expr]) => {
|
||||
impl PhrasesViewState for $Struct {
|
||||
fn phrases_focused (&self) -> bool {
|
||||
todo!()
|
||||
fn phrases_focused (&$self) -> bool {
|
||||
$focus
|
||||
}
|
||||
fn phrases_entered (&self) -> bool {
|
||||
todo!()
|
||||
fn phrases_entered (&$self) -> bool {
|
||||
$enter
|
||||
}
|
||||
fn phrases (&self) -> Vec<Arc<RwLock<Phrase>>> {
|
||||
todo!()
|
||||
|
|
@ -75,9 +75,13 @@ macro_rules! impl_phrases_view_state {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl_phrases_view_state!(PhrasesModel);
|
||||
impl_phrases_view_state!(SequencerTui::phrases);
|
||||
impl_phrases_view_state!(ArrangerTui::phrases);
|
||||
impl_phrases_view_state!(PhrasesModel [self: false] [self: false]);
|
||||
impl_phrases_view_state!(SequencerTui::phrases
|
||||
[self: self.focused() == FocusState::Focused(SequencerFocus::Phrases)]
|
||||
[self: self.focused() == FocusState::Entered(SequencerFocus::Phrases)]);
|
||||
impl_phrases_view_state!(ArrangerTui::phrases
|
||||
[self: self.focused() == FocusState::Focused(ArrangerFocus::Phrases)]
|
||||
[self: self.focused() == FocusState::Entered(SequencerFocus::Phrases)]);
|
||||
|
||||
pub trait PhraseViewState: Send + Sync {
|
||||
fn phrase_editing (&self) -> &Option<Arc<RwLock<Phrase>>>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue