Esempio n. 1
0
        void HandleWindowSelectionChanged(object sender, WindowEventArgs args)
        {
            var window = args.Window;

            if (window == null)
            {
                return;                 // Might happen during node list creation
            }
            switch (window.WindowType)
            {
            case WindowType.Patch:
            case WindowType.Module:
                ActivePatchNode = window.Node;
                //the hosts window may be null if the plugin is created hidden on startup
                if (FPluginHost.Window != null)
                {
                    FPluginHost.Window.Caption = FActivePatchNode.NodeInfo.Systemname;
                }

                //only redraw if in local scope
                if (!FNodeFilter.ScopeIsGlobal)
                {
                    UpdateView();
                }
                break;
            }

            FNodeView.SetActiveWindow(window);
        }
Esempio n. 2
0
        public TodoHdeEnumVariable(INode2 node, TodoEngine engine, string varname)
        {
            this.node = node;
            //this.var = var;

            this.valuepin = this.node.FindPin("Input Enum");

            enumname = this.valuepin.SubType.Split(",".ToCharArray())[1].Trim();

            int ecnt = EnumManager.GetEnumEntryCount(enumname);

            for (int i = 0; i < ecnt; i++)
            {
                string eval = EnumManager.GetEnumEntryString(enumname, i);
                string vn   = varname + "-" + eval;

                TodoVariable var = engine.GetVariableByName(vn);
                if (var == null)
                {
                    var          = new TodoVariable(vn);
                    var.Category = "Global";
                    engine.RegisterVariable(var, false);
                }

                var.ValueChanged += var_ValueChanged;
                vars.Add(var);
            }
            //this.valuepin.
            //this.valuepin.Type

            //var.ValueChanged += var_ValueChanged;
            //var.VariableUpdated += var_VariableUpdated;
        }
Esempio n. 3
0
 void FAttachedNode_Parent_Removed(IViewableCollection <INode2> collection, INode2 item)
 {
     if (item == AttachedNode)
     {
         AttachedNode = null;
     }
 }
Esempio n. 4
0
 private Pin(INode2 node, IPin internalCOMInterf, ProxyNodeInfoFactory nodeInfoFactory)
 {
     FParentNode            = node;
     FInternalCOMInterf     = internalCOMInterf;
     FNodeInfoFactory       = nodeInfoFactory;
     FInternalCOMInterf.Tag = this;
 }
Esempio n. 5
0
        private string PinNameFromNode(INode2 node)
        {
            string pinName = "";

            if (node.NodeInfo.Systemname == "IOBox (Value Advanced)")
            {
                pinName = "Y Input Value";
            }
            else if (node.NodeInfo.Systemname == "IOBox (String)")
            {
                pinName = "Input String";
            }
            else if (node.NodeInfo.Systemname == "IOBox (Color)")
            {
                pinName = "Color Input";
            }
            else if (node.NodeInfo.Systemname == "IOBox (Enumerations)")
            {
                pinName = "Input Enum";
            }
            else if (node.NodeInfo.Systemname == "IOBox (Node)")
            {
                pinName = "Input Node";
            }

            return(pinName);
        }
Esempio n. 6
0
        private void NodeRemovedCB(INode2 node)
        {
            var pinName = PinNameFromNode(node);
            var pin     = node.FindPin(pinName);

            FExposedPins.Remove(node.GetNodePath(false) + "/" + pinName);
        }
Esempio n. 7
0
        private void ExposeIOBox(INode2 node)
        {
            var target = new RemoteValue(node, FPrefixes);

            if (!FTargets.ContainsKey(target.RuntimeNodePath))
            {
                if (FPrefixes.Count == 0 ||
                    (FPrefixes.Count > 0 && FPrefixes.Contains(target.Node.Parent.NodeInfo.Filename)))
                {
                    FTargets.Add(target.RuntimeNodePath, target);
                }
            }
            else if (FTargets.ContainsKey(target.RuntimeNodePath))
            {
                if (FPrefixes.Count == 0 ||
                    (FPrefixes.Count > 0 && FPrefixes.Contains(target.Node.Parent.NodeInfo.Filename)))
                {
                    FTargets[target.RuntimeNodePath].State = RemoteValueState.Add;
                }

                target.Kill();
            }
            else
            {
                target.Kill();
            }
        }
Esempio n. 8
0
        public SRNodeView(NodeView parentNodeView, INode2 node, NodeFilter filter, int depth)
            : base(parentNodeView, node, filter, depth, false)
        {
            FChannelPin          = FNode.FindPin(ChannelPinName);
            FChannelPin.Changed += HandleChannelPinChanged;

            FSRChannel = FChannelPin[0];
        }
 public void GlobalSetup()
 {
     _count         = 0;
     _unlocked      = new Node <int, int>(PostTriggerAction);
     _lock          = new LockNode <int, int>(PostTriggerAction);
     _monitor       = new MonitorNode <int, int>(PostTriggerAction);
     _semaphoreSlim = new SemaphoreSlimNode <int, int>(PostTriggerAction);
     _spinLock      = new SpinLockNode <int, int>(PostTriggerAction);
 }
Esempio n. 10
0
        public static IPin2 FindPin(this INode2 node, string name)
        {
            var query =
                from pin in node.Pins
                where pin.Name == name || pin.NameByParent(node) == name
                select pin;

            return(query.FirstOrDefault());
        }
Esempio n. 11
0
        void HandleNodeRemoved(IViewableCollection <INode2> collection, INode2 node)
        {
            var nodeView = FChildNodes.FirstOrDefault((n) => n.FNode == node);

            if (nodeView != null)
            {
                RemoveNodeView(nodeView);
            }
        }
Esempio n. 12
0
        private void UnExposeIOBox(INode2 node)
        {
            var address = node.GetNodePath(false);

            if (FTargets.ContainsKey(address))
            {
                FTargets[address].State = RemoteValueState.Remove;
            }
        }
Esempio n. 13
0
 private void OpenParentAndSelectNode(INode2 node)
 {
     if (node != FHDEHost.RootNode)
     {
         FHDEHost.ShowEditor(node.Parent);
         FHDEHost.SelectNodes(new INode2[1] {
             node
         });
     }
 }
Esempio n. 14
0
        public LoadedProjectsSolutionViewProvider(ISolution solution, INode2 rootNode, ModelMapper mapper)
//			: base(solution, mapper)
        {
            FRootNode       = rootNode;
            FLoadedProjects = new EditableList <IProject>();
            FSynchronizer   = FLoadedProjects.SyncWith(solution.Projects, p => p, p => {}, IsProjectInUse);
            Childs          = new SortedViewableList <IProject, string>(FLoadedProjects, project => project.Name);

            node_Added(null, FRootNode);
        }
Esempio n. 15
0
        static internal Pin Create(INode2 node, IPin internalCOMInterf, ProxyNodeInfoFactory nodeInfoFactory)
        {
            var pin = internalCOMInterf.Tag as Pin;

            if (pin == null)
            {
                pin = new Pin(node, internalCOMInterf, nodeInfoFactory);
            }
            return(pin);
        }
Esempio n. 16
0
        private void NodeRemovedCB(INode2 node)
        {
            var pinName = PinNameFromNode(node);
            var pin     = node.FindPin(pinName);

            FExposedPins.Remove(node.GetNodePath(false) + "/" + pinName);
            if (pin != null)
            {
                pin.Changed -= PinChanged;
            }
        }
Esempio n. 17
0
 public DX11Node FindNode(INode2 hdenode)
 {
     foreach (DX11Node n in this.Nodes)
     {
         if (n.HdeNode == hdenode.InternalCOMInterf)
         {
             return(n);
         }
     }
     return(null);
 }
Esempio n. 18
0
 public DX11Node FindNode(INode2 hdenode)
 {
     foreach (DX11Node n in this.nodes)
     {
         if (n.HdeNode == hdenode.InternalCOMInterf)
         {
             return n;
         }
     }
     return null;
 }
Esempio n. 19
0
        public KontrolleurNode(IHDEHost host)
        {
            FHDEHost = host;
            FHDEHost.ExposedNodeService.NodeAdded   += NodeAddedCB;
            FHDEHost.ExposedNodeService.NodeRemoved += NodeRemovedCB;

            FRoot = host.RootNode;

            FTimer.Enabled   = true;
            FTimer.AutoReset = false;
            FTimer.Elapsed  += new ElapsedEventHandler(FTimer_Elapsed);
        }
Esempio n. 20
0
        public void OpenEditor(INode2 node)
        {
            var nodeInfo = node.NodeInfo;

            switch (nodeInfo.Type)
            {
            case NodeType.Unknown:
            case NodeType.Dynamic:
            case NodeType.Effect:
                // Try to locate exact file based on nodeinfo and navigate to its definition.
                var filename = nodeInfo.Filename;
                var line     = -1;

                // Do we have a project file?
                var project = FSolution.FindProject(filename) as CSProject;
                if (project != null)
                {
                    if (!project.IsLoaded)
                    {
                        project.Load();
                    }

                    // Find the document where this nodeinfo is defined.
                    var doc = FindDefiningDocument(project, nodeInfo);
                    if (doc != null)
                    {
                        filename = doc.Location.LocalPath;
                        line     = FindDefiningLine(doc, nodeInfo);
                    }
                }
                else
                {
                    // Do not try to open the file if there's no editor
                    // registered for this file extension.
                    var fileExtension = Path.GetExtension(filename);

                    var editorFindQuery =
                        from editorExport in FNodeInfoExports
                        let editorInfo = editorExport.Metadata
                                         where editorInfo.FileExtensions.Contains(fileExtension)
                                         select editorExport.Metadata;

                    if (!editorFindQuery.Any())
                    {
                        return;
                    }
                }

                Open(filename, line, 0, node);
                break;
            }
        }
Esempio n. 21
0
        public INode2 ParentNodeByPatch(INode2 patch)
        {
            var node = FInternalCOMInterf.GetParentNodeByPatch(patch.InternalCOMInterf);

            if (node != null)
            {
                return(Node.Create(node, FNodeInfoFactory));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 22
0
        private void ProcessNode(INode2 node)
        {
            string varname = node.LabelPin.Spread.Replace("|", "");

            //Only register variable if name not blank
            if (varname != "")
            {
                if (this.engine != null)
                {
                    TodoHdeVariable hdevar = new TodoHdeVariable(node, this.engine, varname);
                    this.nodes[node.InternalCOMInterf] = hdevar;
                }
            }
        }
Esempio n. 23
0
        public DX11Node(INode2 hdeNode, IPluginHost hoster)
        {
            this.InputPins  = new List <DX11InputPin>();
            this.OutputPins = new List <DX11OutputPin>();

            this.HdeNode2 = hdeNode;
            this.HdeNode  = hdeNode.InternalCOMInterf;
            this.Name     = hdeNode.NodeInfo.Systemname;
            this.Hoster   = hoster;

            IInternalPluginHost iip = (IInternalPluginHost)this.Hoster;

            this.Interfaces = new DX11NodeInterfaces(iip);
        }
Esempio n. 24
0
        public IONodeView(NodeView parentNodeView, INode2 node, NodeFilter filter, int depth)
            : base(parentNodeView, node, filter, depth, false)
        {
            FNode.LabelPin.Changed += HandleLabelPinChanged;
            FLabel   = FNode.LabelPin[0];
            FComment = string.Empty;

            if (FNode.NodeInfo.Category == "String")
            {
                FCommentPin          = FNode.FindPin("Input String");
                FCommentPin.Changed += HandleCommentPinChanged;
                FComment             = FCommentPin[0] ?? string.Empty;
            }
        }
Esempio n. 25
0
        private NodeView CreateNodeView(INode2 node)
        {
            NodeView nodeView = null;

            var nodeInfo = node.NodeInfo;

            switch (nodeInfo.Name)
            {
            case "IOBox":
                nodeView = new IONodeView(this, node, FFilter, FDepth + 1);
                break;

            case "S":
                nodeView = new SNodeView(this, node, FFilter, FDepth + 1);
                break;

            case "R":
                nodeView = new RNodeView(this, node, FFilter, FDepth + 1);
                break;

            default:
                if (FOpenModules)
                {
                    nodeView = new NodeView(this, node, FFilter, FDepth + 1, true);
                }
                else
                {
                    switch (nodeInfo.Type)
                    {
                    case NodeType.Module:
                        nodeView = new ModuleNodeView(this, node, FFilter, FDepth + 1);
                        break;

                    default:
                        nodeView = new NodeView(this, node, FFilter, FDepth + 1, false);
                        break;
                    }
                }

                break;
            }

            if (FLastActiveWindow != null)
            {
                nodeView.SetActiveWindow(FLastActiveWindow);
            }

            return(nodeView);
        }
Esempio n. 26
0
        protected override bool ProcessRemovedNode(INode2 node)
        {
            DX11Node vn = this.graph.FindNode(node);

            if (vn != null)
            {
                foreach (IPin2 pin in node.Pins)
                {
                    this.ProcessRemovedPin(pin);
                }
                this.graph.Nodes.Remove(vn);
                return(true);
            }
            return(false);
        }
Esempio n. 27
0
        public void ShowEditor(INode2 node)
        {
            // TODO: Kind of a hack
            switch (node.NodeInfo.Type)
            {
            case NodeType.Dynamic:
            case NodeType.Effect:
                EditorFactory.OpenEditor(node.InternalCOMInterf);
                break;

            default:
                FVVVVHost.ShowEditor(node.InternalCOMInterf);
                break;
            }
        }
Esempio n. 28
0
        private void SelectNode(INode2 node)
        {
            if (FSelectedNodeView != null)
            {
                FSelectedNodeView.Selected = false;
            }

            var flatNodeViewTree = FNodeView.AsDepthFirstEnumerable((nv) => nv.Children);
            FSelectedNodeView = flatNodeViewTree.FirstOrDefault((nv) => nv.Node == node);

            if (FSelectedNodeView != null)
            {
                FSelectedNodeView.Selected = true;
            }
        }
Esempio n. 29
0
        void HandleActivePatchParentRemoved(IViewableCollection collection, object item)
        {
            var childNode = item as INode2;

            //if active patch is being deleted detach view
            if (childNode == ActivePatchNode)
            {
                ActivePatchNode = childNode.Parent;

                if (!FNodeFilter.ScopeIsGlobal)
                {
                    UpdateView();
                }
            }
        }
Esempio n. 30
0
        public TodoHdeEnumVariable(INode2 node, TodoEngine engine, IHDEHost hde)
        {
            this.node = node;
            this.hde  = hde;
            //this.var = var;

            this.valuepin = this.node.FindPin("Input Enum");

            string enumname = this.valuepin.SubType.Split("|".ToCharArray())[1];
            //this.valuepin.
            //this.valuepin.Type

            //var.ValueChanged += var_ValueChanged;
            //var.VariableUpdated += var_VariableUpdated;
        }
Esempio n. 31
0
        public TodoHdeVariable(INode2 node, TodoEngine engine, string varname)
        {
            this.node = node;

            this.valuepin = this.node.FindPin("Y Input Value");
            if (this.valuepin.SliceCount == 1)
            {
                TodoVariable var = engine.GetVariableByName(varname);
                if (var == null)
                {
                    var          = new TodoVariable(varname);
                    var.Category = "Global";
                    engine.RegisterVariable(var, false);
                }

                var.ValueChanged    += var_ValueChanged;
                var.VariableUpdated += var_VariableUpdated;

                this.vars.Add(var);
            }
            else if (this.valuepin.SliceCount > 1)
            {
                for (int i = 0; i < this.valuepin.SliceCount; i++)
                {
                    string vn = varname + "-" + i.ToString();

                    TodoVariable var = engine.GetVariableByName(vn);
                    if (var == null)
                    {
                        var          = new TodoVariable(vn);
                        var.Category = "Global";
                        engine.RegisterVariable(var, false);
                    }

                    var.ValueChanged    += var_ValueChanged;
                    var.VariableUpdated += var_VariableUpdated;

                    this.vars.Add(var);
                }
            }

            this.minpin = this.node.FindPin("Minimum");
            this.maxpin = this.node.FindPin("Maximum");

            this.minpin.Changed += minpin_Changed;
            this.maxpin.Changed += maxpin_Changed;
        }
Esempio n. 32
0
        private void AddNode(INode2 node)
        {
            //Add listener for patches, since they can have children
            if (node.HasPatch)
            {
                node.Added += OnNodeAdded;
                node.Removed += OnNodeRemoved;

                //Recursively add children
                foreach (INode2 child in node)
                {
                    this.AddNode(child);
                }
            }

            if (this.ProcessAddedNode(node))
            {
                node.Pins.Added += this.Pins_Added;
                node.Pins.Removed += this.Pins_Removed;
            }
        }
        protected override bool ProcessAddedNode(INode2 node)
        {
            if (this.AddNodeToGraph(node))
            {
                viNode vn = new viNode();
                vn.HdeNode = node.InternalCOMInterf;
                vn.Hoster = (IPluginHost)node.InternalCOMInterf;

                this.graph.Nodes.Add(vn);
                this.hostnodes.Add(vn.Hoster, vn);

                foreach (IPin2 p in node.Pins)
                {
                    this.ProcessAddedPin(p);
                }

                this.ProcessPendingLinks();

                return true;
            }
            return false;
        }
Esempio n. 34
0
        private void RemoveNode(INode2 node)
        {
            //Remove listeners if patch
            if (node.HasPatch)
            {
                node.Added -= OnNodeAdded;
                node.Removed -= OnNodeRemoved;

                //Remove all children
                foreach (INode2 child in node)
                {
                    this.RemoveNode(child);
                }
            }

            this.ProcessRemovedNode(node);
        }
Esempio n. 35
0
 private void OnNodeRemoved(IViewableCollection<INode2> collection, INode2 item)
 {
     this.RemoveNode(item);
 }
Esempio n. 36
0
 private void OnNodeAdded(IViewableCollection<INode2> collection, INode2 item)
 {
     this.AddNode(item);
 }
Esempio n. 37
0
 protected abstract bool ProcessRemovedNode(INode2 node);
Esempio n. 38
0
 protected abstract bool ProcessAddedNode(INode2 node);
Esempio n. 39
0
 void RootNode_Removed(Core.IViewableCollection<INode2> collection, INode2 item)
 {
     this.devicemanager.Dispose();
 }
        protected override bool ProcessRemovedNode(INode2 node)
        {
            viNode vn = this.graph.FindNode(node);

            if (vn != null)
            {
                foreach (IPin2 pin in node.Pins)
                {
                    this.ProcessRemovedPin(pin);
                }

                this.hostnodes.Remove(vn.Hoster);
                this.graph.Nodes.Remove(vn);
                return true;
            }
            return false;
        }
 protected abstract bool AddNodeToGraph(INode2 node);