Exemplo n.º 1
0
        public object Clone()
        {
            Subsystem s = new Subsystem();

            s.Location = this.Location;

            s.Size = this.Size;

            // Change default size
            if (this.Parent != null && this.Parent is EditorSurface)
            {
                EditorSurface es = (EditorSurface)this.Parent;
                s.DefaultSize = new Size((int)(this.Width / es.Zoom), (int)(this.Height / es.Zoom));
            }
            else if (this.Parent == null)
            {
                s.DefaultSize = this.DefaultSize;
            }

            if (this.seSubsystemEditor != null)
            {
                s.seSubsystemEditor = (SubsystemEditor)this.seSubsystemEditor.Clone(s);
            }

            return(s);
        }
Exemplo n.º 2
0
        public object Clone()
        {
            DescriptionLabel dl = new DescriptionLabel();

            dl.Location  = this.Location;
            dl.Text      = this.Text;
            dl.TextColor = this.TextColor;
            dl.Size      = this.Size;

            // Change default size
            if (this.Parent != null && this.Parent is EditorSurface)
            {
                EditorSurface es = (EditorSurface)this.Parent;
                dl.DefaultSize = new Size((int)(this.Width / es.Zoom), (int)(this.Height / es.Zoom));
            }
            else if (this.Parent == null)
            {
                dl.DefaultSize = this.DefaultSize;
            }

            dl.BackColor = this.BackColor;
            dl.Font      = this.Font;

            return(dl);
        }
        private void SelectableAndMovableControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Moves Place in PetriNetEditor control
            if (this.Capture == true && this.bResizing != true && e.Button == MouseButtons.Left)
            {
                EditorSurface es = (EditorSurface)this.Parent;

                Point pt = this.PointToScreen(new Point(e.X, e.Y));
                pt    = es.PointToClient(pt);
                pt.X -= ptMouseDragOffset.X;
                pt.Y -= ptMouseDragOffset.Y;

                // If AutoScroll size is larger than editor control size
                if (es.AutoScroll == true)
                {
                    pt.X = Math.Max(es.AutoScrollPosition.X, pt.X);
                    pt.Y = Math.Max(es.AutoScrollPosition.Y, pt.Y);

                    pt.X = Math.Min(pt.X, es.AutoScrollMinSize.Width + es.AutoScrollPosition.X - this.Bounds.Width);
                    pt.Y = Math.Min(pt.Y, es.AutoScrollMinSize.Height + es.AutoScrollPosition.Y - this.Bounds.Height);
                }
                else
                {
                    pt.X = Math.Max(0, pt.X);
                    pt.Y = Math.Max(0, pt.Y);

                    pt.X = Math.Min(pt.X, es.Width - this.Bounds.Width);
                    pt.Y = Math.Min(pt.Y, es.Height - this.Bounds.Height);
                }

                foreach (object o in es.SelectedObjects)
                {
                    if (o is Control)
                    {
                        Control c = (Control)o;

                        if (c != this)
                        {
                            c.Location = new Point(c.Location.X + (pt.X - this.Location.X), c.Location.Y + (pt.Y - this.Location.Y));
                        }
                    }
                }

                this.Location = pt;

                // To slow down scrolling
                es.Refresh();
            }
        }
Exemplo n.º 4
0
        private void ConnectableControl_MouseDown(object sender, MouseEventArgs e)
        {
            EditorSurface es = (EditorSurface)this.Parent;

            // Sets Default cursor while drawing transition line
            if (e.Button == MouseButtons.Right)
            {
                this.Cursor = Cursors.Default;

                if (this.CanConnectFromThisPoint(new Point(e.X, e.Y)))
                {
                    es.bConnecting = true;
                }
            }
        }
Exemplo n.º 5
0
        private void ResizableControl_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.bAllowResizing == true)
            {
                if (this.szBeforeSizing != this.Size && this.bResizing == true)
                {
                    // Change default size
                    if (this.Parent != null && this.Parent is EditorSurface)
                    {
                        EditorSurface es = (EditorSurface)this.Parent;
                        this.DefaultSize = new Size((int)(this.Width / es.Zoom), (int)(this.Height / es.Zoom));
                    }

                    if (this.Resized != null)
                    {
                        this.Resized(this, new ResizedEventArgs(this.szBeforeSizing));
                    }
                }

                this.Capture   = false;
                this.bResizing = false;
            }
        }