mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
fix grid alignments
This commit is contained in:
parent
fadaaa1620
commit
385297c59f
2 changed files with 26 additions and 20 deletions
|
|
@ -5,4 +5,4 @@
|
||||||
(@e editor show :pool-clip)
|
(@e editor show :pool-clip)
|
||||||
(@ctrl-a scene add)
|
(@ctrl-a scene add)
|
||||||
(@ctrl-t track add)
|
(@ctrl-t track add)
|
||||||
(@tab pool toggle)
|
(@tab compact)
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,12 @@ edn_view!(TuiOut: |self: App| self.size.of(EdnView::from_source(self, self.edn.a
|
||||||
":tracks" => self.row(self.w(), 3, self.track_header(), self.track_cells()).boxed(),
|
":tracks" => self.row(self.w(), 3, self.track_header(), self.track_cells()).boxed(),
|
||||||
":inputs" => self.row(self.w(), 3, self.input_header(), self.input_cells()).boxed(),
|
":inputs" => self.row(self.w(), 3, self.input_header(), self.input_cells()).boxed(),
|
||||||
":outputs" => self.row(self.w(), 3, self.output_header(), self.output_cells()).boxed(),
|
":outputs" => self.row(self.w(), 3, self.output_header(), self.output_cells()).boxed(),
|
||||||
":scenes" => Rugged(Style::default()).enclose(self.row(self.w(), self.size.h().saturating_sub(12) as u16,
|
":scenes" => Outer(Style::default().fg(TuiTheme::g(0))).enclose_bg(self.row(
|
||||||
Rugged(Style::default()).enclose(self.scene_header()), self.scene_cells(self.is_editing()))).boxed() }});
|
self.w(),
|
||||||
|
self.size.h().saturating_sub(12) as u16,
|
||||||
|
self.scene_header(),
|
||||||
|
self.scene_cells(self.is_editing())
|
||||||
|
)).boxed() }});
|
||||||
impl App {
|
impl App {
|
||||||
pub fn clock (
|
pub fn clock (
|
||||||
jack: &Arc<RwLock<JackConnection>>,
|
jack: &Arc<RwLock<JackConnection>>,
|
||||||
|
|
@ -202,7 +206,7 @@ impl App {
|
||||||
arranger.tracks_add(tracks, track_width, &[], &[]);
|
arranger.tracks_add(tracks, track_width, &[], &[]);
|
||||||
Ok(arranger)
|
Ok(arranger)
|
||||||
}
|
}
|
||||||
fn compact (&self) -> bool { false }
|
fn compact (&self) -> bool { self.compact }
|
||||||
fn is_editing (&self) -> bool { self.editing.load(Relaxed) }
|
fn is_editing (&self) -> bool { self.editing.load(Relaxed) }
|
||||||
fn editor (&self) -> impl Content<TuiOut> + '_ { &self.editor }
|
fn editor (&self) -> impl Content<TuiOut> + '_ { &self.editor }
|
||||||
fn w (&self) -> u16 { self.tracks_sizes(self.is_editing(), self.editor_w()).last().map(|x|x.3 as u16).unwrap_or(0) }
|
fn w (&self) -> u16 { self.tracks_sizes(self.is_editing(), self.editor_w()).last().map(|x|x.3 as u16).unwrap_or(0) }
|
||||||
|
|
@ -217,7 +221,7 @@ impl App {
|
||||||
&'a self, w: u16, h: u16, a: impl Content<TuiOut> + 'a, b: impl Content<TuiOut> + 'a
|
&'a self, w: u16, h: u16, a: impl Content<TuiOut> + 'a, b: impl Content<TuiOut> + 'a
|
||||||
) -> impl Content<TuiOut> + 'a {
|
) -> impl Content<TuiOut> + 'a {
|
||||||
Fixed::y(h, Bsp::e(
|
Fixed::y(h, Bsp::e(
|
||||||
Fixed::xy(self.sidebar_w() as u16, h, a),
|
Fixed::x(self.sidebar_w() as u16, a),
|
||||||
Fill::x(Align::c(Fixed::xy(w, h, b)))
|
Fill::x(Align::c(Fixed::xy(w, h, b)))
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -316,12 +320,12 @@ impl App {
|
||||||
let scenes = ||self.scenes_sizes(self.is_editing(), 2, 15);
|
let scenes = ||self.scenes_sizes(self.is_editing(), 2, 15);
|
||||||
let selected_track = self.selected().track();
|
let selected_track = self.selected().track();
|
||||||
let selected_scene = self.selected().scene();
|
let selected_scene = self.selected().scene();
|
||||||
(move||Fill::y(Align::c(Map::new(tracks, move|(_, track, x1, x2), t| {
|
(move||Align::c(Map::new(tracks, move|(_, track, x1, x2), t| {
|
||||||
let w = (x2 - x1) as u16;
|
let w = (x2 - x1) as u16;
|
||||||
let color: ItemPalette = track.color.dark.into();
|
let color: ItemPalette = track.color.dark.into();
|
||||||
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
||||||
let cells = Map::new(scenes, move|(_, scene, y1, y2), s| {
|
let cells = Map::new(scenes, move|(_, scene, y1, y2), s| {
|
||||||
let h = (y2 - y1) as u16;
|
let h = (1 + y2 - y1) as u16;
|
||||||
let color = scene.color;
|
let color = scene.color;
|
||||||
let (name, fg, bg) = if let Some(c) = &scene.clips[t] {
|
let (name, fg, bg) = if let Some(c) = &scene.clips[t] {
|
||||||
let c = c.read().unwrap();
|
let c = c.read().unwrap();
|
||||||
|
|
@ -346,15 +350,11 @@ impl App {
|
||||||
));
|
));
|
||||||
let cell = Either::new(active, editor, cell);
|
let cell = Either::new(active, editor, cell);
|
||||||
*last_color.write().unwrap() = bg.into();
|
*last_color.write().unwrap() = bg.into();
|
||||||
map_south(
|
map_south(y1 as u16, h, Push::y(1, Fixed::y(h, cell)))
|
||||||
y1 as u16,
|
|
||||||
h + 1,
|
|
||||||
Fill::x(Fixed::y(h + 1, cell))
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
let column = Fixed::x(w, Align::y(Rugged(Style::default()).enclose(cells))).boxed();
|
map_east(x1 as u16, w,
|
||||||
Fixed::x(w, map_east(x1 as u16, w, column))
|
Outer(Style::default().fg(TuiTheme::g(0))).enclose(cells)).boxed()
|
||||||
}))).boxed()).into()
|
})).boxed()).into()
|
||||||
}
|
}
|
||||||
fn activate (&mut self) -> Usually<()> {
|
fn activate (&mut self) -> Usually<()> {
|
||||||
let selected = self.selected().clone();
|
let selected = self.selected().clone();
|
||||||
|
|
@ -426,12 +426,17 @@ handle!(TuiIn: |self: App, input|Ok({
|
||||||
Zoom(Option<usize>),
|
Zoom(Option<usize>),
|
||||||
}
|
}
|
||||||
edn_command!(AppCommand: |state: App| {
|
edn_command!(AppCommand: |state: App| {
|
||||||
("stop-all" [] Self::StopAll)
|
("compact" [] Self::Compact(None))
|
||||||
("compact" [c: bool] Self::Compact(c))
|
("compact" [c: bool] Self::Compact(c))
|
||||||
|
|
||||||
("color" [c: Color] Self::Color(c.map(ItemPalette::from).unwrap_or_default()))
|
("color" [c: Color] Self::Color(c.map(ItemPalette::from).unwrap_or_default()))
|
||||||
|
|
||||||
("undo" [d: usize] Self::History(-(d.unwrap_or(0)as isize)))
|
("undo" [d: usize] Self::History(-(d.unwrap_or(0)as isize)))
|
||||||
("redo" [d: usize] Self::History(d.unwrap_or(0) as isize))
|
("redo" [d: usize] Self::History(d.unwrap_or(0) as isize))
|
||||||
|
|
||||||
("zoom" [z: usize] Self::Zoom(z))
|
("zoom" [z: usize] Self::Zoom(z))
|
||||||
|
|
||||||
|
("stop-all" [] Self::StopAll)
|
||||||
("enqueue" [c: Arc<RwLock<MidiClip>>] Self::Enqueue(c))
|
("enqueue" [c: Arc<RwLock<MidiClip>>] Self::Enqueue(c))
|
||||||
("select" [t: usize, s: usize] match (t.expect("no track"), s.expect("no scene")) {
|
("select" [t: usize, s: usize] match (t.expect("no track"), s.expect("no scene")) {
|
||||||
(0, 0) => Self::Select(Selection::Mix),
|
(0, 0) => Self::Select(Selection::Mix),
|
||||||
|
|
@ -844,8 +849,8 @@ pub trait HasScenes: HasSelection + HasEditor + Send + Sync {
|
||||||
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
||||||
let selected = self.selected().scene();
|
let selected = self.selected().scene();
|
||||||
let iter = ||self.scenes_sizes(self.is_editing(), 2, 15);
|
let iter = ||self.scenes_sizes(self.is_editing(), 2, 15);
|
||||||
Fill::y(Align::c(Map::new(iter, move|(_, scene, y1, y2), i| {
|
Map::new(iter, move|(_, scene, y1, y2), i| {
|
||||||
let h = (y2 - y1) as u16;
|
let h = (1 + y2 - y1) as u16;
|
||||||
let name = format!("🭬{}", &scene.name);
|
let name = format!("🭬{}", &scene.name);
|
||||||
let color = scene.color;
|
let color = scene.color;
|
||||||
let active = selected == Some(i);
|
let active = selected == Some(i);
|
||||||
|
|
@ -860,8 +865,9 @@ pub trait HasScenes: HasSelection + HasEditor + Send + Sync {
|
||||||
Color::Rgb(0, 0, 0)
|
Color::Rgb(0, 0, 0)
|
||||||
);
|
);
|
||||||
*last_color.write().unwrap() = color;
|
*last_color.write().unwrap() = color;
|
||||||
map_south(y1 as u16, h + 1, Fixed::y(h + 1, cell))
|
map_south(y1 as u16, h, Push::y(1, Fixed::y(h,
|
||||||
}))).boxed()
|
Outer(Style::default().fg(TuiTheme::g(0))).enclose(cell))))
|
||||||
|
}).boxed()
|
||||||
}).into()
|
}).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue