Пример #1
0
        public BasicControlPoint(NodeHostControl Host)
        {
            InitializeComponent();

            this.DragEnter += new DragEventHandler(BasicControlPoint_DragEnter);
            this.DragOver  += new DragEventHandler(BasicControlPoint_DragOver);
            this.DragDrop  += new DragEventHandler(BasicControlPoint_DragDrop);


            this.GiveFeedback += new GiveFeedbackEventHandler(BasicControlPoint_GiveFeedback);
            this.MouseMove    += new MouseEventHandler(BasicControlPoint_MouseMove);
            this.MouseUp      += new MouseEventHandler(BasicControlPoint_MouseUp);
            this.MouseEnter   += new EventHandler(BasicControlPoint_MouseEnter);
            this.MouseLeave   += new EventHandler(BasicControlPoint_MouseLeave);
            this.MouseClick   += new MouseEventHandler(BasicControlPoint_MouseClick);

            this.AllowDrop = true;

            this.BackColor = Color.Blue;

            mHost = Host;

            //this.b

            this.Size = new Size(16, 16);
        }
Пример #2
0
        public void RecalculateGroup(bool clear)
        {
            if (clear)
            {
                ClearData();
            }

            mbLoading = true;

            int parent = mHost.GetGroupParent(this.mInnerGroupID);

            mOuterGroup = mHost.GetHostByGroupID(parent);

            Setup(mOuterGroup, mInnerGroup, mTriggerNamespace);

            mbLoading = false;
        }
Пример #3
0
        protected void UpdateParent()
        {
            //bad...
            Control         chain = Parent;
            NodeHostControl host  = null;

            while (chain != null && (host == null) && (mUIUpdateRoot == null))
            {
                if (chain is NodeHostControl)
                {
                    NodeHostControl nh = (NodeHostControl)chain;
                    mHost = (TriggerHostArea)nh.Owner;
                }
                else if (chain is ITriggerUIUpdateRoot)
                {
                    mUIUpdateRoot = (ITriggerUIUpdateRoot)chain;
                }
                chain = chain.Parent;
            }
        }
Пример #4
0
        public void Setup(NodeHostControl outerGroup, NodeHostControl innerGroup, TriggerNamespace triggerNamespace)
        {
            mbLoading = true;

            base.mHost = innerGroup;

            mOuterGroup       = outerGroup;
            mInnerGroup       = innerGroup;
            mInnerGroupID     = innerGroup.mGroupID;
            mTriggerNamespace = triggerNamespace;
            mOuterGroupID     = outerGroup.mGroupID;

            List <KeyValuePair <IControlPoint, IControlPoint> > alllinks = mHost.GetLinks();
            List <IControlPoint> virtualCPs = mHost.GetVirtualControlPoints(mInnerGroupID);


            if (mInnerGroupType == eInnerGroupType.Input)
            {
                mInLinks.Clear();

                //Pointing "in"
                foreach (KeyValuePair <IControlPoint, IControlPoint> pair in alllinks)
                {
                    int ki = pair.Key.GetLevel();
                    int vi = pair.Value.GetLevel();

                    if (ki == vi)
                    {
                        continue;
                    }

                    //bool b1 = !mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID);
                    //bool b2 = pair.Key.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID);
                    //bool b3 = pair.Value.GetLevel() != mInnerGroupID;
                    //if ((!mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID))
                    //&& (pair.Key.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID))
                    //&& (pair.Value.GetLevel() != mInnerGroupID))

                    bool b1 = ki != mInnerGroupID;
                    bool b2 = !mHost.IsChild(ki, mInnerGroupID);
                    bool b3 = mHost.IsChild(vi, mInnerGroupID) || (vi == mInnerGroupID);

                    if (b1 && b2 && b3)
                    {
                        IControlPoint proxy = GetExternalInputControlPoint(pair.Key);
                        proxy.ParentConnections.Add(pair);

                        IControlPoint foundPoint;
                        if (TryGetControlPointAtLevel(mInnerGroupID, virtualCPs, pair.Value, pair, out foundPoint))
                        {
                            mInLinks.Add(new KeyValuePair <IControlPoint, IControlPoint>(proxy, foundPoint));
                        }
                    }
                }


                #region omfg
                //foreach (Control c in mOuterGroup.Controls)
                //{
                //   if (c is InnerGroupControl)
                //      continue;


                //   IControlPointOwner cpOwner = c as IControlPointOwner;
                //   if (cpOwner != null)
                //   {
                //      foreach (IControlPoint cpoint in cpOwner.GetControlPoints())
                //      {
                //         foreach (IControlPoint target in cpoint.GetTargets())
                //         {
                //            ClientNodeControl targetControl = target.TagObject as ClientNodeControl;
                //            if (targetControl != null)
                //            {
                //               if ((targetControl.GetGroupID() == mInnerGroup.mGroupID)
                //               //|| (mHost.IsChild(mInnerGroup.mGroupID, targetControl.GetGroupID())))
                //               //|| (mHost.IsChild(mInnerGroup.mGroupID, targetControl.GetGroupID())))
                //               || (mHost.IsChild(targetControl.GetGroupID(), mInnerGroup.mGroupID)))
                //               {
                //                  IControlPoint proxy = GetExternalInputControlPoint(cpoint);
                //                  //proxy.ConnectControlPoint(target);
                //                  mInLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(proxy, target));

                //               }
                //            }
                //         }
                //      }
                //   }
                //}
                #endregion

                //bind the connections in the worklist.
                foreach (KeyValuePair <IControlPoint, IControlPoint> pair in mInLinks)
                {
                    pair.Key.ConnectControlPoint(pair.Value);
                }
            }
            else if (mInnerGroupType == eInnerGroupType.Output)
            {
                mOutLinks.Clear();

                //pointing "out"


                foreach (KeyValuePair <IControlPoint, IControlPoint> pair in alllinks)
                {
                    int ki = pair.Key.GetLevel();
                    int vi = pair.Value.GetLevel();

                    if (ki == vi)
                    {
                        continue;
                    }

                    //bool b1 = (mHost.IsChild(pair.Value.GetLevel(), pair.Key.GetLevel()));
                    //bool b1a = !(mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID));
                    //bool b2 = mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID);
                    //bool b3 = pair.Value.GetLevel() == mInnerGroupID;
                    //if (!(mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID))
                    //&& (pair.Value.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID)))

                    bool b1 = vi != mInnerGroupID;
                    bool b2 = !mHost.IsChild(vi, mInnerGroupID);
                    bool b3 = mHost.IsChild(ki, mInnerGroupID) || (ki == mInnerGroupID);

                    if (b1 && b2 && b3)
                    {
                        IControlPoint proxy = GetExternalOutputControlPoint(pair.Key, pair.Value);
                        proxy.ParentConnections.Add(pair);

                        IControlPoint foundPoint;
                        if (TryGetControlPointAtLevel(mInnerGroupID, virtualCPs, pair.Key, pair, out foundPoint))
                        {
                            mOutLinks.Add(new KeyValuePair <IControlPoint, IControlPoint>(foundPoint, proxy));
                        }
                    }
                }

                #region omfg
                //foreach (Control c in mInnerGroup.Controls)
                //{
                //   if (c is InnerGroupControl)
                //      continue;


                //   IControlPointOwner cpOwner = c as IControlPointOwner;
                //   if (cpOwner != null)
                //   {
                //      foreach (IControlPoint cpoint in cpOwner.GetControlPoints())
                //      {
                //         foreach (IControlPoint target in cpoint.GetTargets())
                //         {
                //            ClientNodeControl targetControl = target.TagObject as ClientNodeControl;
                //            if (targetControl != null)
                //            {
                //               if (targetControl.GetGroupID() == mOuterGroup.mGroupID)
                //               {
                //                  IControlPoint proxy = GetExternalOutputControlPoint(cpoint, target);
                //                  mOutLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(cpoint, proxy));
                //               }
                //               //if (targetControl.GetGroupID() != mInnerGroup.mGroupID)
                //               //{
                //               //   IControlPoint proxy = GetExternalOutputControlPoint(cpoint, target);
                //               //   worklist.Add(new KeyValuePair<IControlPoint, IControlPoint>(cpoint, proxy));
                //               //}
                //            }
                //         }
                //      }
                //   }
                //}
                #endregion
                //bind the connections in the worklist.
                foreach (KeyValuePair <IControlPoint, IControlPoint> pair in mOutLinks)
                {
                    pair.Key.ConnectControlPoint(pair.Value);
                }
            }

            //shared variables

            mbLoading = false;
        }
Пример #5
0
        public void Setup(NodeHostControl outerGroup, NodeHostControl innerGroup, TriggerNamespace triggerNamespace)
        {
            mbLoading = true;

            base.mHost = outerGroup;

            mOuterGroup       = outerGroup;
            mInnerGroup       = innerGroup;
            mInnerGroupID     = innerGroup.mGroupID;
            mTriggerNamespace = triggerNamespace;
            mOuterGroupID     = outerGroup.mGroupID;


            UpdateUIFromData();

            //Get proxy at level?
            // connect up later?


            List <KeyValuePair <IControlPoint, IControlPoint> > alllinks = mHost.GetLinks();
            List <IControlPoint> virtualCPs = mHost.GetVirtualControlPoints(outerGroup.mGroupID);

            mInLinks.Clear();
            //Pointing "in"

            foreach (KeyValuePair <IControlPoint, IControlPoint> pair in alllinks)
            {
                //ClientNodeControl outer = pair.Key.TagObject as ClientNodeControl;

                int ki = pair.Key.GetLevel();
                int vi = pair.Value.GetLevel();

                if (ki == vi)
                {
                    continue;
                }

                //bool b1 = (mHost.IsChild(pair.Value.GetLevel(), pair.Key.GetLevel()));
                //bool b1a = !(mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID));
                //bool b2 = mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID);
                //bool b3 = pair.Value.GetLevel() == mInnerGroupID;
                //if (!(mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID))
                //&& (pair.Value.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID)))


                bool b1 = ki != mInnerGroupID;
                bool b2 = !mHost.IsChild(ki, mInnerGroupID);
                bool b3 = mHost.IsChild(vi, mInnerGroupID) || (vi == mInnerGroupID);

                if (b1 && b2 && b3)
                {
                    IControlPoint proxy = GetInputControlPoint(pair.Key, pair.Value);

                    IControlPoint sender = pair.Key;

                    //find at this level.. that matches.?

                    //while (sender.ProxyTarget != null && sender.GetLevel() != this.mGroupID)
                    //{
                    //   sender = sender.ProxyTarget;

                    //}

                    proxy.ParentConnections.Add(pair);

                    //if (sender.GetLevel() != this.mGroupID)
                    //{
                    //   foreach (IControlPoint cp in virtualCPs)
                    //   {
                    //      if(cp.ParentConnections.Contains(pair))
                    //      {
                    //         sender = cp;
                    //      }
                    //   }
                    //}
                    //mInLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(sender, proxy));
                    IControlPoint foundPoint;
                    if (TryGetControlPointAtLevel(this.mGroupID, virtualCPs, pair.Key, pair, out foundPoint))
                    {
                        mInLinks.Add(new KeyValuePair <IControlPoint, IControlPoint>(foundPoint, proxy));
                    }
                }
            }
            #region omfg

            //foreach (Control c in mOuterGroup.Controls)  //????need to check others
            //{
            //   //if (c is GroupControl)
            //   //   continue;
            //   if (c is InnerGroupControl)
            //      continue;

            //   IControlPointOwner cpOwner = c as IControlPointOwner;
            //   if (cpOwner != null)
            //   {
            //      foreach (IControlPoint cpoint in cpOwner.GetControlPoints())
            //      {
            //         foreach (IControlPoint target in cpoint.GetTargets())
            //         {
            //            ClientNodeControl targetControl = target.TagObject as ClientNodeControl;
            //            if (targetControl != null)
            //            {

            //               if ((targetControl.GetGroupID() == mInnerGroup.mGroupID)
            //               || (mHost.IsChild(targetControl.GetGroupID(), mInnerGroup.mGroupID)))
            //               {
            //                  IControlPoint proxy = GetInputControlPoint(cpoint,target);


            //                  mInLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(cpoint, proxy));
            //               }
            //               //else if (targetControl.GetGroupID() != mOuterGroup.mGroupID)
            //               //{
            //               //   IControlPoint proxy = GetInputControlPoint(cpoint, target);
            //               //   worklist.Add(new KeyValuePair<IControlPoint, IControlPoint>(cpoint, proxy));
            //               //}

            //            }
            //         }
            //      }
            //   }
            //}
            #endregion

            //bind the connections in the worklist.
            foreach (KeyValuePair <IControlPoint, IControlPoint> pair in mInLinks)
            {
                pair.Key.ConnectControlPoint(pair.Value);
            }

            mOutLinks.Clear();

            foreach (KeyValuePair <IControlPoint, IControlPoint> pair in alllinks)
            {
                int ki = pair.Key.GetLevel();
                int vi = pair.Value.GetLevel();

                if (ki == vi)
                {
                    continue;
                }

                //bool b1 = !mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID);
                //bool b2 = pair.Key.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID);
                //bool b3 = pair.Value.GetLevel() != mInnerGroupID;
                //if ((!mHost.IsChild(pair.Value.GetLevel(), mInnerGroupID))
                //&& (pair.Key.GetLevel() == mInnerGroupID || mHost.IsChild(pair.Key.GetLevel(), mInnerGroupID))
                //&&  (pair.Value.GetLevel() != mInnerGroupID))

                bool b1 = vi != mInnerGroupID;
                bool b2 = !mHost.IsChild(vi, mInnerGroupID);
                bool b3 = mHost.IsChild(ki, mInnerGroupID) || (ki == mInnerGroupID);

                if (b1 && b2 && b3)
                {
                    IControlPoint proxy = GetOutputControlPoint(pair.Key);
                    proxy.ParentConnections.Add(pair);


                    //mOutLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(proxy, pair.Value));
                    IControlPoint foundPoint;
                    if (TryGetControlPointAtLevel(this.mGroupID, virtualCPs, pair.Value, pair, out foundPoint))
                    {
                        mOutLinks.Add(new KeyValuePair <IControlPoint, IControlPoint>(proxy, foundPoint));
                    }
                }
            }

            #region omfg2
            //pointing "out"
            //foreach (Control c in mInnerGroup.Controls)
            //{
            //   if (c is InnerGroupControl)
            //      continue;
            //   //if (c is GroupControl)
            //   //   continue;

            //   IControlPointOwner cpOwner = c as IControlPointOwner;
            //   if (cpOwner != null)
            //   {
            //      foreach (IControlPoint cpoint in cpOwner.GetControlPoints())
            //      {
            //         foreach (IControlPoint target in cpoint.GetTargets())
            //         {
            //            ClientNodeControl targetControl = target.TagObject as ClientNodeControl;
            //            if (targetControl != null)
            //            {
            //               //if (targetControl.GetGroupID() == mOuterGroup.mGroupID)
            //               //{
            //               //   IControlPoint proxy = GetOutputControlPoint(cpoint);
            //               //   //proxy.ConnectControlPoint(target);
            //               //   worklist.Add(new KeyValuePair<IControlPoint, IControlPoint>(proxy, target));
            //               //}

            //               if (targetControl is InnerGroupControl) //the innercontrol will handle this
            //               {
            //                  continue;
            //               }
            //               if (targetControl.GetGroupID() != mInnerGroup.mGroupID)
            //               {
            //                  IControlPoint proxy = GetOutputControlPoint(cpoint);
            //                  //proxy.ConnectControlPoint(target);
            //                  mOutLinks.Add(new KeyValuePair<IControlPoint, IControlPoint>(proxy, target));
            //               }
            //            }
            //         }
            //      }
            //   }
            //}
            #endregion

            //bind the connections in the worklist.
            foreach (KeyValuePair <IControlPoint, IControlPoint> pair in mOutLinks)
            {
                pair.Key.ConnectControlPoint(pair.Value);
            }

            mbLoading = false;

            //shared variables
        }
Пример #6
0
 public void BindToHost(NodeHostControl nodeHost, TriggerHostArea Host)
 {
     mHost        = nodeHost;
     mTriggerHost = Host;
 }
Пример #7
0
        public TriggerControl(NodeHostControl nodeHost, TriggerHostArea Host)// NodeHostControl
        {
            BindToHost(nodeHost, Host);

            InitUI();
        }
Пример #8
0
        public TemplateControl(NodeHostControl nodeHost, TriggerHostArea Host)
        {
            BindToHost(nodeHost, Host);

            InitUI();
        }