diff --git a/src/graphmanager/graphview.css b/src/graphmanager/graphview.css index 7618ebb..2345900 100644 --- a/src/graphmanager/graphview.css +++ b/src/graphmanager/graphview.css @@ -14,6 +14,10 @@ button.node-selected { background: rgb(170, 255, 170); } +button.node-light { + border-style: dashed; +} + button.port { color: rgb(0, 0, 255); border-width: 2px; @@ -44,4 +48,4 @@ button.port-always { graphview { background: #d0d2d4; -} +} \ No newline at end of file diff --git a/src/graphmanager/graphview.rs b/src/graphmanager/graphview.rs index f1ba774..c7828a0 100644 --- a/src/graphmanager/graphview.rs +++ b/src/graphmanager/graphview.rs @@ -837,7 +837,8 @@ impl GraphView { .attr("id", &node.id().to_string()) .attr("type", &node.node_type().unwrap().to_string()) .attr("pos_x", &node.position().0.to_string()) - .attr("pos_y", &node.position().1.to_string()), + .attr("pos_y", &node.position().1.to_string()) + .attr("light", &node.light().to_string()), )?; for port in node.ports().values() { writer.write( @@ -938,6 +939,10 @@ impl GraphView { let pos_y: &String = attrs .get::(&String::from("pos_y")) .unwrap_or(&default_value); + let default_value = String::from("false"); + let light: &String = attrs + .get::(&String::from("light")) + .unwrap_or(&default_value); let node = self.create_node_with_id( id.parse::().unwrap(), name, @@ -947,6 +952,7 @@ impl GraphView { pos_x.parse::().unwrap(), pos_y.parse::().unwrap(), ); + node.set_light(light.parse::().unwrap()); current_node = Some(node); } "Property" => { diff --git a/src/graphmanager/node.rs b/src/graphmanager/node.rs index 67c8566..2c9a93d 100644 --- a/src/graphmanager/node.rs +++ b/src/graphmanager/node.rs @@ -62,6 +62,7 @@ mod imp { // Properties are different from GObject properties pub(super) properties: RefCell>, pub(super) selected: Cell, + pub(super) light: Cell, pub(super) position: Cell<(f32, f32)>, } @@ -108,6 +109,7 @@ mod imp { num_ports_out: Cell::new(0), properties: RefCell::new(HashMap::new()), selected: Cell::new(false), + light: Cell::new(false), position: Cell::new((0.0, 0.0)), } } @@ -276,6 +278,21 @@ impl Node { imp::Node::from_instance(self).position.get() } + pub fn set_light(&self, light: bool) { + let self_ = imp::Node::from_instance(self); + self_.light.set(light); + if light { + self.add_css_class("node-light"); + } else { + self.remove_css_class("node-light"); + } + } + + pub fn light(&self) -> bool { + let self_ = imp::Node::from_instance(self); + self_.light.get() + } + //Private fn set_name(&self, name: &str) {