copy() public method

public copy ( ) : Selection
return Selection
Esempio n. 1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                bSelection = false;
                Invalidate();
                return;
            }
            else if (e.Button == MouseButtons.Left)
            {
                if (bSelection)
                {
                    if (e.Clicks == 2)
                    {
                        executeMove();
                        Invalidate();
                    }
                    else
                    {
                        if (selection.getPoint(e.X / 16, e.Y / 16 + logicalRow))
                        {
                            bDraggingTiles = true;
                            srcSelection   = selection.copy();
                        }
                        else
                        {
                            bSelection = false;
                        }
                    }
                }

                if (!bDraggingTiles)
                {
                    bSelectingRect = true;
                }

                mx1 = mx = e.X;
                my1 = my = e.Y;
                clip(ref mx1, ref my1);
                clip(ref mx, ref my);
                mtx   = (mx + 8) / 16;
                mty   = (my + 8) / 16 + logicalRow;
                bmtx0 = mx / 16;
                bmty0 = my / 16 + logicalRow;

                xDrag = 0;
                yDrag = 0;

                slideTimer.Enabled = true;
                Capture            = true;
                Invalidate();
            }
        }
Esempio n. 2
0
        public void paste()
        {
            if (!WindowsClipboard.IsImage)
            {
                return;
            }

            if (!bSelection)
            {
                return;
            }

            pr2.IRenderImage img = WindowsClipboard.getImage();

            int tx = img.Width / 16;
            int ty = img.Height / 16;

            Selection s = originalSelection;

            this.selection = originalSelection.copy();

            if (tx != s.width)
            {
                return;
            }
            if (ty != s.height)
            {
                return;
            }

            Operations.OperationManager om = Global.opManager;
            om.beginGroup("VSP Manager: Paste Tiledata");

            Ops.SetTiledataGroup stdg = new Ops.SetTiledataGroup(Global.ActiveVsp);

            int y0 = s.y;
            int x0 = s.x;

            int[] arrImg = img.GetArray();
            for (int y = 0; y < s.height; y++)
            {
                for (int x = 0; x < s.width; x++)
                {
                    int t = (s.y + y) * TilesWide + s.x + x;
                    stdg.addRecord(t, Global.Misc.sliceIntArrayImage(arrImg, img.Width, x * 16, y * 16, 16, 16));
                }
            }

            om.add(stdg);
            om.endGroupExec();


            img.Dispose();
            Invalidate();
        }