예제 #1
0
 public void unselect(RTForm f)
 {
     if (f == null) return;
     if (!forms.Contains(f)) return;
     forms.Remove(f);
     f.selected = false;
 }
예제 #2
0
 public void select(RTForm f)
 {
     if (f == null) return;
     if (forms.Contains(f)) return;
     forms.Add(f);
     f.selected = true;
 }
예제 #3
0
        public void getPosAndDir(ref Vector pos, ref Vector dir, ref VectorRect r, ref int _rank)
        {
            RTForm owr = element;

            if (owr == null)
            {
                pos  = Vector.Zero;
                dir  = Vector.Zero;
                r    = VectorRect.Empty;
                rank = 0;
                return;
            }
            pos = owr.owner.fromScreen(Vector.V(owr.Location) + Vector.V(Location) + getAnchor());
            switch (_orientation)
            {
            case RTOrientation.East: dir = Vector.V(1, 0); break;

            case RTOrientation.North: dir = Vector.V(0, -1); break;

            case RTOrientation.West: dir = Vector.V(-1, 0); break;

            case RTOrientation.South: dir = Vector.V(0, 1); break;
            }
            if (rank < 0)
            {
                calcRank();
            }
            _rank = rank; //  owr.GetIOs().IndexOf(this);
            r     = new VectorRect(owr.owner.fromScreen(Vector.V(owr.Location)), owr.owner.fromScreen(Vector.V(owr.Location) + Vector.V(owr.Size)));
        }
예제 #4
0
 public void temporaryMove(RTForm rootmover, Vector delta)
 {
     foreach (RTForm r in forms)
     {
         if (r != rootmover)
             r.temporaryMove(delta);
     }
 }
예제 #5
0
 public void finalizeMove(RTForm rootmover, Vector delta)
 {
     foreach (RTForm r in forms)
     {
         if (r != rootmover)
             r.finalizeMove(delta);
     }
 }
예제 #6
0
 public void initateMove(RTForm rootmover)
 {
     foreach (RTForm r in forms)
     {
         if (r != rootmover)
             r.initiateMove();
     }
 }
예제 #7
0
 public void selectMe(RTForm f)
 {
     if (f == null)
     {
         return;
     }
     selection.select(f);
 }
예제 #8
0
 public void DeleteElement(RTForm r)
 {
     r.Disconnect();
     r.WorkDisconnect();
     elements.Remove(r);
     Controls.Remove(r);
     r.Dispose();
     Invalidate();
 }
예제 #9
0
        public Vector getPos()
        {
            RTForm owr = element;

            if (owr == null)
            {
                return(Vector.V(0, 0));
            }
            return(owr.owner.fromScreen(Vector.V(owr.Location) + Vector.V(Location) + getAnchor()));
        }
예제 #10
0
 private void CallElementDisconnect(RTForm e)
 {
     try
     {
         e.WorkDisconnect();
     }
     catch (Exception ex)
     {
         logText("Exception occured when dispatching Disconnect to Element: " + ex.Message);
     }
 }
예제 #11
0
 public void addElement(RTForm rt)
 {
     this.Controls.Add(rt);
     elements.Add(rt);
     rt.storePosData();
     rt.center = center;
     rt.updateFromRoot();
     selection.unselect();
     rt.BringToFront();
     selection.select(rt);
 }
예제 #12
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (dragMode == DragMode.drawLine)
            {
                RTForm el   = element;
                Vector from = getPos();
                Vector to   = el.owner.fromScreen(Vector.V(el.Location) + Vector.V(Location) + Vector.V(e.Location));
                element.owner.showTemporaryConnection(from, to);
            }
            else
            {
                forwardOnMouseMove(e);
            }
        }
예제 #13
0
 public void Shutdown()
 {
     LockWorker();
     while (elements.Count > 0)
     {
         RTForm rf = elements[0];
         rf.Disconnect();
         rf.WorkDisconnect();
         elements.Remove(rf);
         Controls.Remove(rf);
         rf.Dispose();
     }
     UnLockWorker();
     Invalidate();
     stopWorkThread = true;
 }
예제 #14
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            if (dragMode == DragMode.drawLine)
            {
                _highlighted = false;
                Invalidate();

                dragMode = DragMode.Idle;
                RTForm el = element;
                el.owner.hideTemporaryConnection();
                Vector to   = el.owner.fromScreen(Vector.V(el.Location) + Vector.V(Location) + Vector.V(e.Location));
                RTIO   ioto = el.owner.findIO(to);
                if (ioto != null)
                {
                    el.owner.createConnection(this, ioto);
                }
            }
            else
            {
                forwardOnMouseUp(e);
            }
        }
예제 #15
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            Rectangle r = getRectangle();

            if (r.Contains(e.Location))
            {
                Parent.BringToFront();

                // Draw a new Connection
                RTForm em = element;
                if ((em != null) && (em.owner != null))
                {
                    _highlighted = true;
                    Invalidate();

                    dragMode = DragMode.drawLine;
                }
            }
            else
            {
                forwardOnMouseDown(e);
            }
        }
예제 #16
0
        public ProcessingNet(SystemPanel _owner, BinaryReader src)
        {
            owner        = _owner;
            connectedIOs = new List <RTIO>();
            connections  = new List <ProcessingConnection>();

            _isNamed = src.ReadBoolean();
            if (_isNamed)
            {
                _name = src.ReadString();
            }
            else
            {
                _name = owner.createUniqueNetName();
            }

            netType = ProcessingNetType.Unknown;

            init();

            int cios = src.ReadInt32();

            if (cios < 0)
            {
                throw new Exception("Bad Input File: File corrupt in Net Read");
            }
            for (int i = 0; i < cios; i++)
            {
                String elementID = src.ReadString();
                int    elementIO = src.ReadInt32();
                RTForm pe        = owner.findElement(elementID);
                if (pe == null)
                {
                    throw new Exception("Bad Input File: Linked Element not found");
                }
                List <RTIO> rio = pe.GetIOs();
                if ((elementIO < 0) || (elementIO >= rio.Count))
                {
                    throw new Exception("Bad Input File: Linked Element has not enough IOs");
                }
                rio[elementIO].connectedTo = this;
                connectedIOs.Add(rio[elementIO]);
            }
            int cns = src.ReadInt32();

            if (cns < 0)
            {
                throw new Exception("Bad Input File: File corrupt in Net Read");
            }
            for (int i = 0; i < cns; i++)
            {
                int a = src.ReadInt32();
                int b = src.ReadInt32();
                if ((a < 0) || (b < 0) || (a >= connectedIOs.Count) || (a >= connectedIOs.Count))
                {
                    throw new Exception("Bad Input File: File corrupt in Net Read");
                }
                connections.Add(new ProcessingConnection(a, b));
            }

            CheckValidity();
        }
예제 #17
0
 public bool selected(RTForm r)
 {
     if (r == null) return false;
     return forms.Contains(r);
 }
예제 #18
0
 public void initiateMove(RTForm rootmover)
 {
     selection.initateMove(rootmover);
 }
예제 #19
0
 public void temporaryMove(RTForm rootmover, Vector delta)
 {
     selection.temporaryMove(rootmover, delta);
 }
예제 #20
0
 public void finalizeMove(RTForm rootmover, Vector delta)
 {
     selection.finalizeMove(rootmover, delta);
 }
예제 #21
0
 public void CallElementWorkDisconnect(RTForm e)
 {
     this.Invoke(CallElementDisconnectInWorkThread, e);
 }
예제 #22
0
        public void readFile(BinaryReader src)
        {
            string magic = "AudioProcBinary";
            string magicRead;

            magicRead = src.ReadString();
            if (!magicRead.Equals(magic))
            {
                throw new Exception("Bad File Format: Header does not match");
            }
            int version = src.ReadInt32();

            if (version != 2)
            {
                throw new Exception("Bad File Format: File Version higher than this one --> Cannot Read");
            }

            sampleRate          = src.ReadInt32();
            sourceBufferSize    = src.ReadInt32();
            sinkBufferSize      = src.ReadInt32();
            startSourceMinFill  = src.ReadInt32();
            startSinkMinFill    = src.ReadInt32();
            overrunCounterStart = src.ReadInt32();
            startInSleepFill    = src.ReadInt32();
            startOutSleepFill   = src.ReadInt32();

            // Clear up
            while (nets.Count > 0)
            {
                nets[0].Disconnect();
                nets.RemoveAt(0);
            }
            netCounter = 0;
            while (elements.Count > 0)
            {
                elements[0].Disconnect();
                elements.RemoveAt(0);
            }

            int emts = src.ReadInt32();

            if (emts < 0)
            {
                throw new Exception("Bad File Format: File Corrupt in head read");
            }
            string previousclass = "undefined";
            UInt32 frametest     = 0;

            for (int i = 0; i < emts; i++)
            {
                frametest = src.ReadUInt32();
                if (frametest != 0xDEADBEEF)
                {
                    throw new Exception(String.Format("Bad File Format: Liley problem in code of Class {0}", previousclass));
                }
                string          classname = src.ReadString();
                Type            t         = Type.GetType(classname);
                ConstructorInfo ci        = t.GetConstructor(new Type[] { this.GetType(), src.GetType() });
                RTForm          ne        = (RTForm)ci.Invoke(new object[] { this, src });
                this.Controls.Add(ne);
                ne.calcIORanks();
                elements.Add(ne);
                Vector cr = ne.center;
                ne.storePosData();
                Vector loc = cr - ne.dim / 2;
                ne.Location = toScreen(loc).Point;
                ne.center   = cr;
                ne.updateFromRoot();
                ne.BringToFront();
                ne.updateShrinkState();
                previousclass = classname;
            }
            frametest = src.ReadUInt32();
            if (frametest != 0xDEADBEEF)
            {
                throw new Exception(String.Format("Bad File Format: Liley problem in code of Class {0}", previousclass));
            }
            int nts = src.ReadInt32();

            if (nts < 0)
            {
                throw new Exception("Bad File Format: File Corrupt in head read");
            }
            for (int i = 0; i < nts; i++)
            {
                nets.Add(new ProcessingNet(this, src));
            }
        }