예제 #1
0
        public ModifyVariable(Wrappers.Wrapper wrapped, Cdn.Variable property, Cdn.VariableFlags flags) : base(wrapped, property)
        {
            d_expression = null;

            d_flags         = flags;
            d_previousFlags = property.Flags;
        }
예제 #2
0
파일: Pathbar.cs 프로젝트: codyn-net/studio
        private void HandleChildRemoved(Wrappers.Node source, Wrappers.Wrapper child)
        {
            Wrappers.Node grp = child as Wrappers.Node;

            if (grp == null)
            {
                return;
            }

            if (d_pathWidgets.ContainsKey(grp))
            {
                int start = d_pathGroups.IndexOf(grp);

                for (int i = start; i < d_pathGroups.Count; ++i)
                {
                    d_pathGroups[i].ChildRemoved -= HandleChildRemoved;
                    d_pathWidgets.Remove(d_pathGroups[i]);

                    if (d_pathGroups[i] == d_active)
                    {
                        d_active = null;
                    }
                }

                d_pathGroups.RemoveRange(start, d_pathGroups.Count - start);

                Widget[] children = Children;

                for (int i = start * 2 - 1; i < children.Length; ++i)
                {
                    children[i].Destroy();
                }
            }
        }
예제 #3
0
        public Variable(Wrappers.Network network, Widgets.Window parent, Wrappers.Wrapper obj)
        {
            d_object = obj;

            DestroyWithParent = true;
            TransientFor      = parent;
            HasSeparator      = false;

            if (obj is Wrappers.Edge)
            {
                SetDefaultSize(600, 300);
            }
            else
            {
                SetDefaultSize(400, 300);
            }

            d_view             = new Widgets.Editors.Wrapper(d_object, parent.Actions, network);
            d_view.BorderWidth = 6;

            VBox.PackStart(d_view, true, true, 0);

            d_object.VariableChanged += delegate(Wrappers.Wrapper source, Cdn.Variable name) {
                UpdateTitle();
            };

            VBox.ShowAll();

            AddButton(Gtk.Stock.Close, ResponseType.Close);
            UpdateTitle();
        }
예제 #4
0
파일: Edge.cs 프로젝트: codyn-net/studio
        public Edge(Cdn.Edge obj, Wrappers.Wrapper from, Wrappers.Wrapper to) : base(obj)
        {
            Renderer = new Renderers.Edge(this);

            if (obj != null && from != null)
            {
                obj.Input = from;
            }

            UpdateFrom();

            if (obj != null && to != null)
            {
                obj.Output = to;
            }

            UpdateTo();

            obj.AddNotification("output", OnToChanged);
            obj.AddNotification("input", OnFromChanged);

            obj.ActionAdded   += HandleActionAdded;
            obj.ActionRemoved += HandleActionRemoved;

            CalculateAnchors();
        }
예제 #5
0
        public Variable(Wrappers.Wrapper wrapped, string name, string expression, Cdn.VariableFlags flags)
        {
            d_wrapped = wrapped;

            d_name       = name;
            d_expression = expression;
            d_flags      = flags;
        }
예제 #6
0
        public Wrapper(Wrappers.Wrapper wrapper, Actions actions, Wrappers.Network network) : base(false, 6)
        {
            d_wrapper = wrapper;
            d_actions = actions;
            d_network = network;

            Build();
        }
예제 #7
0
파일: Box.cs 프로젝트: codyn-net/studio
        public Box(Wrappers.Wrapper obj) : base(obj)
        {
            d_object     = obj;
            d_hoverColor = new double[] { 0.3, 0.6, 0.3, 0.6 };
            d_linkColor  = new double[] { 0.9, 0.9, 0.1, 1.0 };
            d_radius     = 0.3;

            MakePatterns();
        }
예제 #8
0
        public MoveObject(Wrappers.Wrapper wrapped, int dx, int dy) : base(null, wrapped)
        {
            d_dx = dx;
            d_dy = dy;

            // The merged group stuff is to support merging with a group whos first action
            // is also a move. This is kind of an ugly hack to make applying a dangling
            // link using DND more usable
            d_mergedGroup = null;
        }
예제 #9
0
        public Variables(Wrappers.Wrapper wrapper, Actions actions)
        {
            d_wrapper = wrapper;
            d_actions = actions;
            d_blockInterfaceRemove = false;

            WidgetFlags |= WidgetFlags.NoWindow;

            Build();
        }
예제 #10
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);
                    }
                }
            }
예제 #11
0
파일: Object.cs 프로젝트: codyn-net/studio
        public Object(Wrappers.Wrapper obj, Actions actions, Wrappers.Network network) : base(false, 6)
        {
            d_actions = actions;
            d_object  = obj;
            d_network = network;

            Build();

            Sensitive = (d_object != null);
            Connect();
        }
예제 #12
0
        public Node(Wrappers.Wrapper obj) : base(obj)
        {
            d_node   = obj as Wrappers.Node;
            d_colors = new double[5][];

            d_colors[0] = new double[] { 26 / 125.0, 80 / 125.0, 130 / 125.0 };
            d_colors[1] = new double[] { 80 / 125.0, 26 / 125.0, 130 / 125.0 };
            d_colors[2] = new double[] { 26 / 125.0, 130 / 125.0, 80 / 125.0 };
            d_colors[3] = new double[] { 130 / 125.0, 80 / 125.0, 26 / 125.0 };
            d_colors[4] = new double[] { 80.0 / 125.0, 130.0 / 125.0, 26.0 / 125.0 };
        }
예제 #13
0
            private void OnVariableRemoved(Wrappers.Wrapper wrapper, Cdn.Variable property)
            {
                foreach (WrapperNode node in AllChildren)
                {
                    if (node.d_object == property)
                    {
                        Remove(node);

                        break;
                    }
                }
            }
예제 #14
0
            private void OnChildRemoved(Wrappers.Node grp, Wrappers.Wrapper child)
            {
                foreach (WrapperNode node in AllChildren)
                {
                    if (node.Wrapper == child)
                    {
                        Remove(node);

                        break;
                    }
                }
            }
예제 #15
0
파일: Object.cs 프로젝트: codyn-net/studio
        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;
            }
        }
예제 #16
0
        private void DoVariableAdded(Wrappers.Wrapper obj, Cdn.Variable prop)
        {
            Node node = new Node(prop);

            d_treeview.NodeStore.Remove(d_dummy);
            d_treeview.NodeStore.Add(node);
            d_treeview.NodeStore.Add(d_dummy);

            if (d_selectProperty)
            {
                d_treeview.Selection.UnselectAll();
                d_treeview.Selection.SelectPath(node.Path);

                d_treeview.SetCursor(node.Path, d_treeview.GetColumn(0), true);
            }
        }
예제 #17
0
파일: Edge.cs 프로젝트: codyn-net/studio
        private void RecalculateLinkOffsets(Wrappers.Wrapper o1, Wrappers.Wrapper o2)
        {
            if (o1 == null || o2 == null)
            {
                return;
            }

            // See how many links there are between o1 and o2
            List <Wrappers.Edge> d1 = new List <Wrappers.Edge>();

            // From o1 to o2
            foreach (Wrappers.Edge l in o2.Links)
            {
                if (l.Input == o1)
                {
                    d1.Add(l);
                }
            }

            List <Wrappers.Edge> d2 = new List <Wrappers.Edge>();

            // From o2 to o1
            foreach (Wrappers.Edge l in o1.Links)
            {
                if (l.Input == o2)
                {
                    d2.Add(l);
                }
            }

            int baseOffset = (d1.Count == 0 || d2.Count == 0) ? 0 : 1;

            for (int i = 0; i < d1.Count; ++i)
            {
                d1[i].Offset = i + baseOffset;
            }

            for (int i = 0; i < d2.Count; ++i)
            {
                d2[i].Offset = i + baseOffset;
            }
        }
예제 #18
0
파일: Import.cs 프로젝트: codyn-net/studio
        private void MergeAnnotations(Wrappers.Wrapper original, Wrappers.Wrapper imported)
        {
            imported.Allocation = original.Allocation.Copy();

            Wrappers.Node grp = original as Wrappers.Node;
            Wrappers.Node imp = imported as Wrappers.Node;

            if (grp != null)
            {
                foreach (Wrappers.Wrapper wrapper in grp.Children)
                {
                    Wrappers.Wrapper other = imp.GetChild(wrapper.Id);

                    if (other != null)
                    {
                        MergeAnnotations(wrapper, other);
                    }
                }
            }
        }
예제 #19
0
            override public void Dispose()
            {
                base.Dispose();

                if (d_wrapper != null)
                {
                    d_wrapper.WrappedObject.RemoveNotification("from", OnLinkChanged);
                    d_wrapper.WrappedObject.RemoveNotification("to", OnLinkChanged);
                    d_wrapper.WrappedObject.RemoveNotification("id", OnIdChanged);

                    Wrappers.Node grp = d_wrapper as Wrappers.Node;

                    if (grp != null)
                    {
                        grp.ChildAdded   -= OnChildAdded;
                        grp.ChildRemoved -= OnChildRemoved;
                    }

                    d_wrapper.VariableAdded   -= OnVariableAdded;
                    d_wrapper.VariableRemoved -= OnVariableRemoved;
                }

                if (d_object != null)
                {
                    if (d_object is Cdn.Variable)
                    {
                        d_object.RemoveNotification("name", OnIdChanged);
                    }
                    else if (d_object is Cdn.EdgeAction)
                    {
                        d_object.RemoveNotification("target", OnIdChanged);
                    }

                    d_object = null;
                }

                d_wrapper = null;
            }
예제 #20
0
        private void DoRemoveProperty()
        {
            List <Undo.IAction> actions = new List <Undo.IAction>();

            foreach (TreePath path in d_treeview.Selection.GetSelectedRows())
            {
                Node node = d_treeview.NodeStore.FindPath(path);

                if (node == d_dummy)
                {
                    continue;
                }

                Wrappers.Wrapper temp = d_wrapper.GetVariableTemplate(node.Variable, false);

                if (temp != null)
                {
                    Cdn.Variable tempProp = temp.Variable(node.Variable.Name);

                    actions.Add(new Undo.ModifyVariable(d_wrapper, node.Variable, tempProp.Expression.AsString));
                    actions.Add(new Undo.ModifyVariable(d_wrapper, node.Variable, tempProp.Flags));
                }
                else
                {
                    actions.Add(new Undo.RemoveVariable(d_wrapper, node.Variable));
                }
            }

            try
            {
                d_actions.Do(new Undo.Group(actions));
            }
            catch (GLib.GException err)
            {
                // Display could not remove, or something
                Error(this, err);
            }
        }
예제 #21
0
 public abstract DTO.CMState ProcessMessage(Wrappers.Wrapper wrapper);
예제 #22
0
 public UnapplyTemplate(Wrappers.Wrapper obj, Wrappers.Wrapper template) : base(obj, template)
 {
 }
예제 #23
0
 public ModifyObjectId(Wrappers.Wrapper wrapped, string id) : base(wrapped.Parent, wrapped)
 {
     d_id     = id;
     d_prevId = wrapped.Id;
 }
예제 #24
0
 public RemoveObject(Wrappers.Node parent, Wrappers.Wrapper wrapped) : base(parent, wrapped)
 {
 }
예제 #25
0
 public RemoveObject(Wrappers.Wrapper wrapped) : this(wrapped.Parent, wrapped)
 {
 }
예제 #26
0
 public RemoveVariable(Wrappers.Wrapper wrapped, Cdn.Variable property) : base(wrapped, property)
 {
 }
예제 #27
0
파일: Edge.cs 프로젝트: codyn-net/studio
 public Edge(Wrappers.Wrapper obj) : base(obj)
 {
 }
예제 #28
0
 public ModifyVariable(Wrappers.Wrapper wrapped, Cdn.Variable property, string expression) : base(wrapped, property)
 {
     d_expression         = expression == null ? "" : expression;
     d_previousExpression = property.Expression.AsString;
 }
예제 #29
0
 public AddObject(Wrappers.Node parent, Wrappers.Wrapper wrapped) : base(parent, wrapped)
 {
 }
예제 #30
0
파일: Import.cs 프로젝트: codyn-net/studio
 public bool ImportsObject(Wrappers.Wrapper obj)
 {
     return(WrappedObject.ImportsObject(obj));
 }