diff --git a/src/view.rs b/src/view.rs index b82ae15f..6e50f454 100644 --- a/src/view.rs +++ b/src/view.rs @@ -44,9 +44,6 @@ pub trait View: private::Sealed + 'static { /// Lays out subviews and return the size of the view. fn layout(&self, id: ViewId, sz: LocalSize, cx: &mut Context, vger: &mut Vger) -> LocalSize; - /// Prints a description of the view for debugging. - fn print(&self, id: ViewId, cx: &mut Context); - /// Processes an event. fn process(&self, _event: &Event, _id: ViewId, _cx: &mut Context, _vger: &mut Vger) {} diff --git a/src/views/anim.rs b/src/views/anim.rs index 482faf29..4c986919 100644 --- a/src/views/anim.rs +++ b/src/views/anim.rs @@ -20,10 +20,6 @@ where V: View, F: Fn(&mut Context, f32) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - self.child.print(id.child(&0), cx); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { if let Event::Anim = event { (self.func)(cx, 1.0 / 60.0) // XXX: assume 60fps for now. diff --git a/src/views/anyview.rs b/src/views/anyview.rs index 58f3d8d8..ea2aeeef 100644 --- a/src/views/anyview.rs +++ b/src/views/anyview.rs @@ -23,12 +23,6 @@ impl View for AnyView { self.child.tid() } - fn print(&self, id: ViewId, cx: &mut Context) { - println!("AnyView {{"); - (self.child).print(id.child(&self.id()), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&self.id()), cx, vger); } diff --git a/src/views/background.rs b/src/views/background.rs index 5a1b439a..7fd48f5d 100644 --- a/src/views/background.rs +++ b/src/views/background.rs @@ -11,13 +11,6 @@ where V: View, BG: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Background {{"); - (self.child).print(id.child(&0), cx); - (self.background).print(id.child(&1), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } diff --git a/src/views/canvas.rs b/src/views/canvas.rs index 95d38e74..4c27afab 100644 --- a/src/views/canvas.rs +++ b/src/views/canvas.rs @@ -9,10 +9,6 @@ impl View for Canvas where F: Fn(&mut Context, LocalRect, &mut Vger) + 'static, { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("canvas"); - } - fn draw(&self, id: ViewId, cx: &mut Context, vger: &mut Vger) { let rect = cx.layout.entry(id).or_default().rect; diff --git a/src/views/command.rs b/src/views/command.rs index f82a70ad..e9075f83 100644 --- a/src/views/command.rs +++ b/src/views/command.rs @@ -27,12 +27,6 @@ where V: View, F: Fn(&mut Context) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Command {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { if let Event::Command(name) = &event { if *name == self.name { @@ -253,12 +247,6 @@ where V: View, C: CommandTuple + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Command {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { if let Event::Command(name) = &event { self.cmds.foreach_cmd(&mut |cmd| { diff --git a/src/views/cond.rs b/src/views/cond.rs index 48887f90..4a7def33 100644 --- a/src/views/cond.rs +++ b/src/views/cond.rs @@ -12,14 +12,6 @@ where V0: View, V1: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - if self.cond { - self.if_true.print(id.child(&0), cx) - } else { - self.if_false.print(id.child(&1), cx) - } - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { if self.cond { self.if_true.process(event, id.child(&0), cx, vger) diff --git a/src/views/drag.rs b/src/views/drag.rs index 9e324b10..64bf10ec 100644 --- a/src/views/drag.rs +++ b/src/views/drag.rs @@ -28,12 +28,6 @@ where V: View, F: Fn(&mut Context, LocalOffset, GestureState, Option) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Drag {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, vid: ViewId, cx: &mut Context, vger: &mut Vger) { match &event { Event::TouchBegin { id, position } => { diff --git a/src/views/emptyview.rs b/src/views/emptyview.rs index c8ee480e..80e97c23 100644 --- a/src/views/emptyview.rs +++ b/src/views/emptyview.rs @@ -3,9 +3,6 @@ use crate::*; pub struct EmptyView {} impl View for EmptyView { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("EmptyView"); - } fn draw(&self, _id: ViewId, _cx: &mut Context, _vger: &mut Vger) {} fn layout( &self, diff --git a/src/views/env.rs b/src/views/env.rs index 478b0153..dcf5dc18 100644 --- a/src/views/env.rs +++ b/src/views/env.rs @@ -12,10 +12,6 @@ where S: Clone + Default + 'static, F: Fn(S, &mut Context) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - (self.func)(cx.init_env(&S::default), cx).print(id.child(&0), cx); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { (self.func)(cx.init_env(&S::default), cx).process(event, id.child(&0), cx, vger); } @@ -106,13 +102,6 @@ where V: View, E: Clone + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - let old = cx.set_env(&self.env_val); - (self.child).print(id.child(&0), cx); - println!(".env()"); - old.and_then(|s| cx.set_env(&s)); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { let old = cx.set_env(&self.env_val); self.child.process(event, id.child(&0), cx, vger); diff --git a/src/views/flex.rs b/src/views/flex.rs index 4c041429..13e1ba96 100644 --- a/src/views/flex.rs +++ b/src/views/flex.rs @@ -9,12 +9,6 @@ impl View for Flex where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Flex {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } diff --git a/src/views/focus.rs b/src/views/focus.rs index 77097ff4..01456153 100644 --- a/src/views/focus.rs +++ b/src/views/focus.rs @@ -10,12 +10,6 @@ where V: View, F: Fn(bool) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("focus("); - (self.func)(Some(id) == cx.focused_id).print(id.child(&0), cx); - println!(")"); - } - fn process(&self, event: &Event, vid: ViewId, cx: &mut Context, vger: &mut Vger) { match &event { Event::TouchBegin { id: _, position } => { diff --git a/src/views/geom.rs b/src/views/geom.rs index f135fc94..b0c8629c 100644 --- a/src/views/geom.rs +++ b/src/views/geom.rs @@ -11,12 +11,6 @@ where V: View, F: Fn(&mut Context, LocalSize) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Geom {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } diff --git a/src/views/key.rs b/src/views/key.rs index 565cbe1b..7127f15e 100644 --- a/src/views/key.rs +++ b/src/views/key.rs @@ -21,12 +21,6 @@ where V: View, F: Fn(&mut Context, Key) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Key {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, _vid: ViewId, cx: &mut Context, _vger: &mut Vger) { if let Event::Key(key) = &event { (self.func)(cx, key.clone()) diff --git a/src/views/list.rs b/src/views/list.rs index 460c6bb2..c2aab437 100644 --- a/src/views/list.rs +++ b/src/views/list.rs @@ -12,14 +12,6 @@ where V: View, F: Fn(&ID) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("List {{"); - for child in &self.ids { - ((self.func)(child)).print(id.child(child), cx); - } - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { for child in &self.ids { let child_id = id.child(child); diff --git a/src/views/map.rs b/src/views/map.rs index c8417e72..57275d08 100644 --- a/src/views/map.rs +++ b/src/views/map.rs @@ -13,11 +13,6 @@ where SF: Fn(S1, &mut Context) + 'static, F: Fn(State, &mut Context) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - cx.set_state(id, self.value.clone()); - (self.func)(State::new(id), cx).print(id.child(&0), cx); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { cx.set_state(id, self.value.clone()); let s = State::new(id); diff --git a/src/views/modview.rs b/src/views/modview.rs index bafcdfed..b47a7e4a 100644 --- a/src/views/modview.rs +++ b/src/views/modview.rs @@ -11,10 +11,6 @@ where S: Clone + Default + 'static, F: Fn(S, &mut Context) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - (self.func)(self.value.clone(), cx).print(id.child(&0), cx); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { (self.func)(self.value.clone(), cx).process(event, id.child(&0), cx, vger); } diff --git a/src/views/offset.rs b/src/views/offset.rs index 1063d57d..cd06fb4f 100644 --- a/src/views/offset.rs +++ b/src/views/offset.rs @@ -10,12 +10,6 @@ impl View for Offset where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Offset {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child .process(&event.offset(-self.offset), id.child(&0), cx, vger); diff --git a/src/views/padding.rs b/src/views/padding.rs index a7d61e88..d42d02fe 100644 --- a/src/views/padding.rs +++ b/src/views/padding.rs @@ -10,12 +10,6 @@ impl View for Padding where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Padding {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { let off = LocalOffset::new(self.padding, self.padding); self.child diff --git a/src/views/role.rs b/src/views/role.rs index 1974bd06..aeb6e06d 100644 --- a/src/views/role.rs +++ b/src/views/role.rs @@ -20,11 +20,6 @@ impl View for RoleView where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - (self.child).print(id.child(&0), cx); - println!(".role()"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } diff --git a/src/views/shapes.rs b/src/views/shapes.rs index 501f9daf..9c43f08c 100644 --- a/src/views/shapes.rs +++ b/src/views/shapes.rs @@ -20,10 +20,6 @@ impl Circle { } impl View for Circle { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("circle"); - } - fn draw(&self, id: ViewId, cx: &mut Context, vger: &mut Vger) { let (center, radius) = self.geom(id, cx); @@ -97,9 +93,6 @@ impl Rectangle { } impl View for Rectangle { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("rectangle"); - } fn draw(&self, id: ViewId, cx: &mut Context, vger: &mut Vger) { let rect = self.geom(id, cx); diff --git a/src/views/size.rs b/src/views/size.rs index 5db94655..6a437380 100644 --- a/src/views/size.rs +++ b/src/views/size.rs @@ -10,12 +10,6 @@ impl View for Size where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Size {{"); - self.child.print(id.child(&0), cx); - println!("}}"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } diff --git a/src/views/spacer.rs b/src/views/spacer.rs index 401268b2..f9ca167a 100644 --- a/src/views/spacer.rs +++ b/src/views/spacer.rs @@ -3,9 +3,6 @@ use crate::*; pub struct Spacer {} impl View for Spacer { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("Spacer"); - } fn draw(&self, _id: ViewId, _cx: &mut Context, _vger: &mut Vger) {} fn layout( &self, diff --git a/src/views/stack.rs b/src/views/stack.rs index c08f5296..346a5a8f 100644 --- a/src/views/stack.rs +++ b/src/views/stack.rs @@ -54,15 +54,6 @@ struct Stack { } impl View for Stack { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Stack {{"); - let mut c = 0; - self.children.foreach_view(&mut |child| { - (*child).print(id.child(&c), cx); - c += 1; - }); - println!("}}"); - } fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.children.process(event, id, cx, vger); diff --git a/src/views/state.rs b/src/views/state.rs index 6653f79f..9ee606be 100644 --- a/src/views/state.rs +++ b/src/views/state.rs @@ -49,11 +49,6 @@ where D: Fn() -> S + 'static, F: Fn(State, &mut Context) -> V + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - cx.init_state(id, &self.default); - (self.func)(State::new(id), cx).print(id.child(&0), cx); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { cx.init_state(id, &self.default); (self.func)(State::new(id), cx).process(event, id.child(&0), cx, vger); diff --git a/src/views/tap.rs b/src/views/tap.rs index 117b1e95..863c778e 100644 --- a/src/views/tap.rs +++ b/src/views/tap.rs @@ -21,11 +21,6 @@ where V: View, F: Fn(&mut Context) + 'static, { - fn print(&self, id: ViewId, cx: &mut Context) { - println!("Tap {{"); - (self.child).print(id.child(&0), cx); - println!("}}"); - } fn process(&self, event: &Event, vid: ViewId, cx: &mut Context, vger: &mut Vger) { match &event { diff --git a/src/views/text.rs b/src/views/text.rs index c5a9409d..94ec7d21 100644 --- a/src/views/text.rs +++ b/src/views/text.rs @@ -15,9 +15,7 @@ impl Text { } impl View for Text { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("Text({:?})", self.text); - } + fn draw(&self, _id: ViewId, _cx: &mut Context, vger: &mut Vger) { let origin = vger.text_bounds(self.text.as_str(), self.size, None).origin; @@ -83,9 +81,6 @@ impl View for V where V: std::fmt::Display + std::fmt::Debug + 'static, { - fn print(&self, _id: ViewId, _cx: &mut Context) { - println!("Text({:?})", self); - } fn process(&self, _event: &Event, _id: ViewId, _cx: &mut Context, _vger: &mut Vger) {} fn draw(&self, _id: ViewId, _cx: &mut Context, vger: &mut Vger) { let txt = &format!("{}", self); diff --git a/src/views/window.rs b/src/views/window.rs index 778122ef..dac3cd2a 100644 --- a/src/views/window.rs +++ b/src/views/window.rs @@ -22,11 +22,6 @@ impl View for TitleView where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - (self.child).print(id.child(&0), cx); - println!(".window_title()"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); } @@ -94,11 +89,6 @@ impl View for FullscreenView where V: View, { - fn print(&self, id: ViewId, cx: &mut Context) { - (self.child).print(id.child(&0), cx); - println!(".fullscreen()"); - } - fn process(&self, event: &Event, id: ViewId, cx: &mut Context, vger: &mut Vger) { self.child.process(event, id.child(&0), cx, vger); }