Ejemplo n.º 1
0
 public void Link(Wrappers.Edge link)
 {
     if (!d_links.Contains(link))
     {
         d_links.Add(link);
     }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        public Edge(Wrappers.Edge link, Actions actions)
        {
            d_link    = link;
            d_actions = actions;

            Build();

            Sensitive = (d_link != null);
            Connect();
        }
Ejemplo n.º 5
0
            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);
                    }
                }
            }
Ejemplo n.º 6
0
        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;
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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]);
            }
        }
Ejemplo n.º 10
0
 public ModifyEdgeActionTarget(Wrappers.Edge link, string oldTarget, string newTarget) : base(link.Parent, link)
 {
     d_edge      = link;
     d_oldTarget = oldTarget;
     d_newTarget = newTarget;
 }
Ejemplo n.º 11
0
 public bool SameObjects(Wrappers.Edge other)
 {
     return(other.d_input == d_input && other.d_output == d_output);
 }
Ejemplo n.º 12
0
 public AddEdgeAction(Wrappers.Edge link, string target, string expression) : base(link, target, expression)
 {
 }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
 public EdgeAction(Wrappers.Edge link, string target, string expression) : base(link.Parent, link)
 {
     d_edge       = link;
     d_target     = target;
     d_expression = expression;
 }
Ejemplo n.º 15
0
 public void Unlink(Wrappers.Edge link)
 {
     d_links.Remove(link);
 }
Ejemplo n.º 16
0
 public RemoveEdgeAction(Wrappers.Edge link, Cdn.EdgeAction action) : base(link, action.Target, action.Equation.AsString)
 {
 }