use super::*;
pub type OpInputPort = TextBox<OpInputPortClass>;
pub type OpInputs = HStack<OpInputPort, OpInputsClass>;
pub type OpBody = TextBox<OpBodyClass>;
pub type OpComment = TextBox<OpCommentClass>;
pub type OpOutputPort = TextBox<OpOutputPortClass>;
pub type OpOutputs = HStack<OpOutputPort, OpOutputsClass>;
pub type InputOp =
V4<OpBody, Optional<OpComment>, Optional<Box<dyn DynamicElement>>, OpOutputs, InputOpClass>;
pub type Op = V5<
OpInputs,
OpBody,
Optional<OpComment>,
Optional<Box<dyn DynamicElement>>,
OpOutputs,
OpClass,
>;
pub type EffectOp =
V4<OpInputs, OpBody, Optional<OpComment>, Optional<Box<dyn DynamicElement>>, EffectOpClass>;
pub type Dummy = Empty<DummyClass>;
pub type GroupInputPort = Empty<GroupInputPortClass>;
pub type GroupInputs = HStack<GroupInputPort, GroupInputsClass>;
pub type GroupOutputPort = Empty<GroupOutputPortClass>;
pub type GroupOutputs = HStack<GroupOutputPort, GroupOutputsClass>;
pub type GroupTitle = TextBox<GroupTitleClass>;
pub struct Group(pub V4<GroupTitle, GroupInputs, GroupContent, GroupOutputs, GroupClass>);
impl SceneElement for Group {
fn get_size(&self) -> zhc_utils::graphics::Size {
self.0.get_size()
}
fn get_frame(&self) -> zhc_utils::graphics::Frame {
self.0.get_frame()
}
fn get_variable_cell(&self) -> VariableCell {
self.0.get_variable_cell()
}
}
impl SceneSolver for Group {
fn solve_size(&mut self) {
self.0.solve_size();
}
fn solve_frame(&mut self, available: zhc_utils::graphics::Frame) {
self.0.solve_frame(available);
}
}
impl crate::visualization::svg::Renderable for Group {
fn render(&self) -> Vec<crate::visualization::svg::SvgElement> {
self.0.render()
}
}
pub type NodeContent = D7<InputOp, Op, EffectOp, Dummy, Group, GroupInputPort, GroupOutputPort>;
pub use D7::E1 as NodeInputOpVar;
pub use D7::E2 as NodeOpVar;
pub use D7::E3 as NodeEffectOpVar;
pub use D7::E4 as NodeDummyVar;
pub use D7::E5 as NodeGroupVar;
pub use D7::E6 as NodeGroupInputPortVar;
pub use D7::E7 as NodeGroupOutputPortVar;
pub struct Node {
pub id: crate::OpId,
pub content: NodeContent,
}
impl SceneElement for Node {
fn get_size(&self) -> zhc_utils::graphics::Size {
self.content.get_size()
}
fn get_frame(&self) -> zhc_utils::graphics::Frame {
self.content.get_frame()
}
fn get_variable_cell(&self) -> VariableCell {
self.content.get_variable_cell()
}
}
impl SceneSolver for Node {
fn solve_size(&mut self) {
self.content.solve_size();
}
fn solve_frame(&mut self, available: zhc_utils::graphics::Frame) {
self.content.solve_frame(available);
}
}
impl crate::visualization::svg::Renderable for Node {
fn render(&self) -> Vec<crate::visualization::svg::SvgElement> {
vec![crate::visualization::svg::SvgElement::Group {
elements: self.content.render(),
transform: None,
id: Some(format!("node-{}", self.id.0)),
class: Some("node".into()),
}]
}
}
pub type Layer = HStack<Node, LayerClass>;
pub type LayerSeparator = Spacer<LayerSpacerClass>;
pub type LayerMember = D2<Layer, LayerSeparator>;
pub use D2::E1 as LayerMemberLayer;
pub use D2::E2 as LayerMemberSeparator;
pub type Layers = VStack<LayerMember, LayersClass>;
pub type GroupContent = Layers;
pub type Curves = Inert<Bag<Curve>>;
pub type Scene = Z2<Layers, Curves>;