diff --git a/crates/tek_core/src/space.rs b/crates/tek_core/src/space.rs index cf8de063..faf612b4 100644 --- a/crates/tek_core/src/space.rs +++ b/crates/tek_core/src/space.rs @@ -495,9 +495,9 @@ impl> Widget for Inset { } fn render (&self, to: &mut E::Output) -> Usually<()> { match *self { - Self::X(x, ref inner) => Plus::X(x, inner as &dyn Widget), - Self::Y(y, ref inner) => Plus::Y(y, inner as &dyn Widget), - Self::XY(x, y, ref inner) => Plus::XY(x, y, inner as &dyn Widget), + Self::X(x, ref inner) => Push::X(x, inner as &dyn Widget), + Self::Y(y, ref inner) => Push::Y(y, inner as &dyn Widget), + Self::XY(x, y, ref inner) => Push::XY(x, y, inner as &dyn Widget), }.render(to) } } @@ -513,15 +513,15 @@ impl> Widget for Outset { } fn render (&self, to: &mut E::Output) -> Usually<()> { match *self { - Self::X(x, ref inner) => Plus::X(x, inner as &dyn Widget), - Self::Y(y, ref inner) => Plus::Y(y, inner as &dyn Widget), - Self::XY(x, y, ref inner) => Plus::XY(x, y, inner as &dyn Widget), + Self::X(x, ref inner) => Push::X(x, inner as &dyn Widget), + Self::Y(y, ref inner) => Push::Y(y, inner as &dyn Widget), + Self::XY(x, y, ref inner) => Push::XY(x, y, inner as &dyn Widget), }.render(to) } } /// Move origin point of drawing area -pub enum Plus { +pub enum Push { /// Move origin to the right X(N, T), /// Move origin downwards @@ -530,7 +530,7 @@ pub enum Plus { XY(N, N, T), } -impl Plus { +impl Push { fn inner (&self) -> &T { match self { Self::X(_, i) => i, Self::Y(_, i) => i, Self::XY(_, _, i) => i, } } @@ -542,7 +542,7 @@ impl Plus { } } -impl> Widget for Plus { +impl> Widget for Push { type Engine = E; fn layout (&self, to: E::Size) -> Perhaps { self.inner().layout(to) @@ -559,7 +559,7 @@ impl> Widget for Plus { } /// Move origin point of drawing area -pub enum Minus { +pub enum Pull { /// Move origin to the right X(N, T), /// Move origin downwards @@ -568,7 +568,7 @@ pub enum Minus { XY(N, N, T), } -impl Minus { +impl Pull { fn inner (&self) -> &T { match self { Self::X(_, i) => i, Self::Y(_, i) => i, Self::XY(_, _, i) => i, } } @@ -580,7 +580,7 @@ impl Minus { } } -impl> Widget for Minus { +impl> Widget for Pull { type Engine = E; fn layout (&self, to: E::Size) -> Perhaps { self.inner().layout(to) @@ -610,7 +610,7 @@ where if h >= to.h() { return Ok(()) } - let size = Plus::Y(h, component as &dyn Widget) + let size = Push::Y(h, component as &dyn Widget) .layout(to)?; if let Some([width, height]) = size.map(|size|size.wh()) { h = h + height.into(); @@ -626,7 +626,7 @@ where if w >= to.w() { return Ok(()) } - let size = Plus::X(w, component as &dyn Widget) + let size = Push::X(w, component as &dyn Widget) .layout(to)?; if let Some([width, height]) = size.map(|size|size.wh()) { w = w + width.into(); @@ -652,10 +652,10 @@ where return Ok(()) } // FIXME -> ??? - let size = Plus::Y(h, component as &dyn Widget) + let size = Push::Y(h, component as &dyn Widget) .layout(area.wh().into())?; if let Some([width, height]) = size.map(|size|size.wh()) { - Plus::Y(h, component as &dyn Widget).render(to)?; + Push::Y(h, component as &dyn Widget).render(to)?; h = h + height; if width > w { w = width @@ -669,10 +669,10 @@ where if w >= area.w() { return Ok(()) } - let size = Plus::X(w, component as &dyn Widget) + let size = Push::X(w, component as &dyn Widget) .layout(area.wh().into())?; if let Some([width, height]) = size.map(|size|size.wh()) { - Plus::X(w, component as &dyn Widget).render(to)?; + Push::X(w, component as &dyn Widget).render(to)?; w = width + w; h = h.max(height) }; diff --git a/crates/tek_core/src/test.rs b/crates/tek_core/src/test.rs index 79180784..857e8fc5 100644 --- a/crates/tek_core/src/test.rs +++ b/crates/tek_core/src/test.rs @@ -47,7 +47,7 @@ fn test_plus_minus () -> Usually<()> { let engine = TestEngine(area, vec![vec![' ';10];10]); let test = TestArea(4, 4); assert_eq!(test.layout(area)?, Some([0, 0, 4, 4])); - assert_eq!(Plus::X(1, test).layout(area)?, Some([1, 0, 4, 4])); + assert_eq!(Push::X(1, test).layout(area)?, Some([1, 0, 4, 4])); Ok(()) } @@ -107,9 +107,9 @@ fn test_outset_align () -> Usually<()> { //fn test_offset () -> Usually<()> { //let area: [u16;4] = [50, 50, 100, 100]; //let test = TestArea(3, 3); - //assert_eq!(Plus::X(1, test).layout(area)?, Some([51, 50, 3, 3])); - //assert_eq!(Plus::Y(1, test).layout(area)?, Some([50, 51, 3, 3])); - //assert_eq!(Plus::XY(1, 1, test).layout(area)?, Some([51, 51, 3, 3])); + //assert_eq!(Push::X(1, test).layout(area)?, Some([51, 50, 3, 3])); + //assert_eq!(Push::Y(1, test).layout(area)?, Some([50, 51, 3, 3])); + //assert_eq!(Push::XY(1, 1, test).layout(area)?, Some([51, 51, 3, 3])); //Ok(()) //} diff --git a/crates/tek_sequencer/src/sequencer.rs b/crates/tek_sequencer/src/sequencer.rs index 35170944..0ca414fd 100644 --- a/crates/tek_sequencer/src/sequencer.rs +++ b/crates/tek_sequencer/src/sequencer.rs @@ -504,7 +504,7 @@ impl<'a, 'b> Content for ArrangerViewVertical<'a, 'b, Tui> { add(&RowSeparators(rows))?; add(&CursorFocus(state.focused, state.selected, offset, cols, rows))?; add(&Split::down(|add|{ - add(&Plus::X(offset, Split::right(move |add|{ + add(&Push::X(offset, Split::right(move |add|{ for (track, (w, _)) in tracks.iter().zip(*cols) { add(&Min::XY(*w as u16, 2, Layers::new(|add|{ add(&Background(COLOR_BG1))?; @@ -530,7 +530,7 @@ impl<'a, 'b> Content for ArrangerViewVertical<'a, 'b, Tui> { scene.clips.get(track), ) { if let Some(phrase) = track.phrases.get(*clip) { - add(&Plus::X(1, format!( + add(&Push::X(1, format!( "{clip:02} {}", phrase.read().unwrap().name.read().unwrap() ).as_str()))?; @@ -2246,7 +2246,7 @@ impl Content for TransportPlayPauseButton { type Engine = Tui; fn content (&self) -> impl Widget { Layers::new(|add|{ - add(&Plus::X(1, Min::XY(11, 2, Styled(match self.value { + add(&Push::X(1, Min::XY(11, 2, Styled(match self.value { Some(TransportState::Stopped) => Some(GRAY_DIM.bold()), Some(TransportState::Starting) => Some(GRAY_NOT_DIM_BOLD), Some(TransportState::Rolling) => Some(WHITE_NOT_DIM_BOLD),