Example #1
0
        public void updateFromRoot()
        {
            SystemPanel p = owner;

            if (p == null)
            {
                return;
            }
            RectangleF rf;

            if (_shrinked)
            {
                Vector dimS = Vector.V(_shrinkSize.Width, _shrinkSize.Height);
                rf = p.toScreenRF(center - dimS / 2, dimS);
            }
            else
            {
                rf = p.toScreenRF(center - dim / 2, dim);
            }
            Point loc = new Point((int)Math.Floor(rf.Left + 0.5), (int)Math.Floor(rf.Top + 0.5));

            scale    = p.scale;
            Width    = (int)Math.Floor(rf.Width + 0.5);
            Height   = (int)Math.Floor(rf.Height + 0.5);
            Location = loc;
            foreach (Control c in Controls)
            {
                if ((c.GetType()).IsSubclassOf(typeof(RTControl)))
                {
                    RTControl cc = (RTControl)c;
                    cc.rescaleFromRoot(scale);
                }
            }
            Invalidate();
        }
Example #2
0
 public RTForm(SystemPanel _owner, BinaryReader src) : this()
 {
     // name = src.ReadString();
     uniqueID  = src.ReadString();
     center    = new Vector(src);
     _active   = src.ReadBoolean();
     _shrinked = src.ReadBoolean();
 }
Example #3
0
        public ProcessingNet(SystemPanel _owner)
        {
            owner        = _owner;
            connectedIOs = new List <RTIO>();
            connections  = new List <ProcessingConnection>();

            _isNamed = false;
            _name    = owner.createUniqueNetName();
            netType  = ProcessingNetType.Unknown;

            init();
        }
Example #4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            BringToFront();
            if ((Parent != null) && (e.Button == MouseButtons.Left))
            {
                if (!_selected)
                {
                    owner.unselectAll();
                    owner.selectMe(this);
                }
                else
                {
                    // Was part of the selection
                    // owner.unselectNets();
                }

                Rectangle deleteButton = getDeleteButton();
                Rectangle shrinkButton = getShrinkButton();
                Rectangle activeButton = getActiveButton();

                if (deleteButton.Contains(e.Location))
                {
                    dragMode       = DragMode.DeleteBtn;
                    onDeleteButton = true;
                    Invalidate();
                }
                else if (_canShrink && shrinkButton.Contains(e.Location))
                {
                    dragMode       = DragMode.ShrinkBtn;
                    onShrinkButton = true;
                    Invalidate();
                }
                else if (_hasActiveSwitch && activeButton.Contains(e.Location))
                {
                    dragMode       = DragMode.ActiveBtn;
                    onActiveButton = true;
                    Invalidate();
                }
                else
                {
                    dragPa    = (SystemPanel)Parent;
                    dragStart = dragPa.fromScreen(Vector.V(e.X + Location.X, e.Y + Location.Y));
                    prevPos   = center;
                    dragMode  = DragMode.Moving;
                    dragPa.initiateMove(this);
                }
            }
        }
Example #5
0
        public void selectOnContained(VectorRect vr, APSelection sel)
        {
            VectorRect  rf;
            SystemPanel p = owner;

            if (p == null)
            {
                return;
            }
            if (_shrinked)
            {
                Vector dimS = Vector.V(_shrinkSize.Width, _shrinkSize.Height);
                rf = VectorRect.FromCenterSize(center, dimS);
            }
            else
            {
                rf = VectorRect.FromCenterSize(center, dim);
            }
            if (vr.inside(rf))
            {
                sel.select(this);
            }
        }
Example #6
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();
        }
Example #7
0
 public void initiateMove()
 {
     dragPa  = (SystemPanel)Parent;
     prevPos = center;
 }
Example #8
0
 public RTForm(SystemPanel _owner) : this()
 {
 }