public void Link(Wrappers.Edge link) { if (!d_links.Contains(link)) { d_links.Add(link); } }
public AttachEdge(Wrappers.Edge link, Wrappers.Node from, Wrappers.Node to) : base(link.Parent, link) { d_from = from; d_to = to; d_prevFrom = link.Input; d_prevTo = link.Output; d_link = link; }
public ModifyEdgeActionEquation(Wrappers.Edge link, string target, string equation) : base(link.Parent, link) { d_edge = link; d_target = target; d_equation = equation; d_previousEquation = link.GetAction(target).Equation.AsString; }
public Edge(Wrappers.Edge link, Actions actions) { d_link = link; d_actions = actions; Build(); Sensitive = (d_link != null); Connect(); }
public WrapperNode(Widget widget, Wrappers.Wrapper wrapper, GLib.Object obj) { d_widget = widget; d_wrapper = wrapper; d_object = obj; d_icon = WrapperIcon(); d_inconsistent = new List <WrapperNode>(); if (d_wrapper != null) { Wrappers.Node grp = wrapper as Wrappers.Node; if (grp != null) { grp.ChildAdded += OnChildAdded; grp.ChildRemoved += OnChildRemoved; foreach (Wrappers.Wrapper wr in grp.Children) { OnChildAdded(grp, wr); } } Wrappers.Edge link = wrapper as Wrappers.Edge; if (link != null) { d_wrapper.WrappedObject.AddNotification("from", OnLinkChanged); d_wrapper.WrappedObject.AddNotification("to", OnLinkChanged); } d_wrapper.WrappedObject.AddNotification("id", OnIdChanged); d_wrapper.VariableAdded += OnVariableAdded; d_wrapper.VariableRemoved += OnVariableRemoved; foreach (Cdn.Variable prop in d_wrapper.WrappedObject.Variables) { OnVariableAdded(wrapper, prop); } } if (d_object != null) { if (d_object is Cdn.Variable) { d_object.AddNotification("name", OnIdChanged); } else if (d_object is Cdn.EdgeAction) { d_object.AddNotification("target", OnIdChanged); } } }
public Object(Wrappers.Node parent, Wrappers.Wrapper wrapped) { d_parent = parent; d_wrapped = wrapped; d_templates = new List <Wrappers.Wrapper>(); Wrappers.Edge link = wrapped as Wrappers.Edge; if (link != null) { d_from = link.Input; d_to = link.Output; } }
protected void DoAdd() { Wrappers.Edge link = d_wrapped as Wrappers.Edge; if (link != null) { link.Attach(d_from, d_to); } foreach (Wrappers.Wrapper templ in d_templates) { d_wrapped.ApplyTemplate(templ); } d_parent.Add(d_wrapped); }
private bool FilterFunc(Node node) { WrapperNode wp = (WrapperNode)node; if (!String.IsNullOrEmpty(d_searchText) && !wp.FilterName.ToLowerInvariant().Contains(d_searchText)) { if (d_selected == null) { return(false); } else if (wp.Wrapper != null && !d_selected.ContainsKey(wp.Wrapper.WrappedObject)) { return(false); } else if (wp.Variable != null && !d_selected.ContainsKey(wp.Variable)) { return(false); } else if (wp.Action != null && !d_selected.ContainsKey(wp.Action)) { return(false); } } Wrappers.Edge link = wp.Wrapper as Wrappers.Edge; if (link != null && (link.Input != null || link.Output != null)) { return(false); } bool ret = true; if (d_filterStorage != null) { d_filterStorage(wp, ref ret); } return(ret); }
protected void DoRemove() { Wrappers.Wrapper[] appliedto = d_wrapped.TemplateAppliesTo; if (appliedto.Length != 0) { if (appliedto.Length > 5) { throw new Exception(String.Format("The template is still in use by {0} objects", appliedto.Length)); } else { string names = String.Join(", ", Array.ConvertAll <Wrappers.Wrapper, string>(appliedto, a => a.FullId)); throw new Exception(String.Format("The template is still in use by `{0}'", names)); } } Wrappers.Edge link = d_wrapped as Wrappers.Edge; if (link != null && link.Output != null) { // Do this so that link offsets are recalculated correctly. This is a bit of a hack // really, and might be solved differently in the distant future, the year 2000 link.Output.Unlink(link); } d_templates = new List <Wrappers.Wrapper>(d_wrapped.AppliedTemplates); d_parent.Remove(d_wrapped); d_wrapped.Removed(); for (int i = d_templates.Count - 1; i >= 0; --i) { d_wrapped.UnapplyTemplate(d_templates[i]); } }
public ModifyEdgeActionTarget(Wrappers.Edge link, string oldTarget, string newTarget) : base(link.Parent, link) { d_edge = link; d_oldTarget = oldTarget; d_newTarget = newTarget; }
public bool SameObjects(Wrappers.Edge other) { return(other.d_input == d_input && other.d_output == d_output); }
public AddEdgeAction(Wrappers.Edge link, string target, string expression) : base(link, target, expression) { }
private void Build() { foreach (Gtk.Widget w in Children) { w.Destroy(); } d_properties = null; d_function = null; d_piecewise = null; Object obj = new Object(d_wrapper, d_actions, d_network); obj.Show(); obj.Error += delegate(object source, Exception exception) { Error(source, exception); }; obj.TemplateActivated += delegate(object source, Wrappers.Wrapper template) { TemplateActivated(source, template); }; Gtk.HBox top = new Gtk.HBox(false, 6); top.Show(); top.PackStart(obj, true, true, 0); if (!(d_wrapper is Wrappers.Function)) { d_properties = new Variables(d_wrapper, d_actions); d_properties.Show(); d_properties.Error += delegate(object source, Exception exception) { Error(source, exception); }; } else if (d_wrapper is Wrappers.FunctionPolynomial) { d_piecewise = new PiecewisePolynomial(d_wrapper as Wrappers.FunctionPolynomial, d_actions); d_piecewise.Show(); top.PackEnd(d_piecewise.PeriodWidget, false, false, 0); } else { d_function = new Function(d_wrapper as Wrappers.Function, d_actions); d_function.Show(); d_function.Error += delegate(object source, Exception exception) { Error(source, exception); }; } PackStart(top, false, false, 0); Wrappers.Edge link = d_wrapper as Wrappers.Edge; Wrappers.Node node = d_wrapper as Wrappers.Node; if (node != null && node.HasSelfEdge) { link = node.SelfEdge; } if (link != null) { Gtk.HPaned paned = new Gtk.HPaned(); paned.Show(); paned.Pack1(d_properties, true, true); Edge actions = new Edge(link, d_actions); actions.Show(); paned.Pack2(actions, true, true); PackStart(paned, true, true, 0); } else if (d_properties != null) { PackStart(d_properties, true, true, 0); } else if (d_function != null) { PackStart(d_function, true, true, 0); } else if (d_piecewise != null) { PackStart(d_piecewise, true, true, 0); } }
public EdgeAction(Wrappers.Edge link, string target, string expression) : base(link.Parent, link) { d_edge = link; d_target = target; d_expression = expression; }
public void Unlink(Wrappers.Edge link) { d_links.Remove(link); }
public RemoveEdgeAction(Wrappers.Edge link, Cdn.EdgeAction action) : base(link, action.Target, action.Equation.AsString) { }