modify pool width; wip: status bars

This commit is contained in:
🪞👃🪞 2024-10-18 23:25:01 +03:00
parent 4994e218f7
commit 0699b9d105
5 changed files with 104 additions and 40 deletions

View file

@ -3,17 +3,23 @@ use crate::*;
/// Root level object for standalone `tek_arranger`
pub struct Arranger<E: Engine> {
/// Which view is focused
pub focus_cursor: (usize, usize),
pub focus_cursor: (usize, usize),
/// Controls the JACK transport.
pub transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
pub transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
/// Contains all the sequencers.
pub arrangement: Arrangement<E>,
pub arrangement: Arrangement<E>,
/// Pool of all phrases in the arrangement
pub phrases: Arc<RwLock<PhrasePool<E>>>,
pub phrases: Arc<RwLock<PhrasePool<E>>>,
/// Phrase editor view
pub editor: PhraseEditor<E>,
pub editor: PhraseEditor<E>,
/// This allows the sequencer view to be moved or hidden.
pub show_sequencer: Option<tek_core::Direction>,
pub show_sequencer: Option<tek_core::Direction>,
/// Status bar
pub status: ArrangerStatusBar,
/// Height of arrangement
pub arrangement_split: u16,
/// Width of phrase pool
pub phrases_split: u16,
}
/// Sections in the arranger app that may be focused
#[derive(Copy, Clone, PartialEq, Eq)]
@ -27,6 +33,13 @@ pub enum ArrangerFocus {
/// The phrase editor (sequencer) is focused
PhraseEditor,
}
/// Status bar for arranger ap
pub enum ArrangerStatusBar {
Transport,
Arrangement,
PhrasePool,
PhraseEditor,
}
/// Represents the tracks and scenes of the composition.
pub struct Arrangement<E: Engine> {
/// Name of arranger
@ -91,14 +104,30 @@ pub enum ArrangementViewMode {
Vertical(usize),
}
/// Arrangement, rendered vertically (session/grid mode).
pub struct VerticalArranger<'a, E: Engine>(
pub &'a Arrangement<E>, pub usize
);
pub struct VerticalArranger<'a, E: Engine>(pub &'a Arrangement<E>, pub usize);
/// Arrangement, rendered horizontally (arrangement/track mode).
pub struct HorizontalArranger<'a, E: Engine>(
pub &'a Arrangement<E>
);
pub struct HorizontalArranger<'a, E: Engine>(pub &'a Arrangement<E>);
/// General methods for arranger
impl<E: Engine> Arranger<E> {
pub fn new (
transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
arrangement: Arrangement<E>,
phrases: Arc<RwLock<PhrasePool<E>>>,
) -> Self {
let mut app = Self {
focus_cursor: (0, 1),
show_sequencer: Some(tek_core::Direction::Down),
editor: PhraseEditor::new(),
status: ArrangerStatusBar::Transport,
transport,
arrangement,
phrases,
phrases_split: 20,
arrangement_split: 20,
};
app.update_focus();
app
}
/// Toggle global play/pause
pub fn toggle_play (&mut self) -> Perhaps<bool> {
match self.transport {