public void AddSelection(Primitive prim)
        {
            prim.SetSelected(true);
            selectedShapes.Add(prim);

            MainWindow.window.selectionWidth.Text = GetSelectionWidth();
            MainWindow.window.selectionHeight.Text = GetSelectionHeight();
            MainWindow.window.selectionRotation.Text = GetSelectionRotation();
            MainWindow.window.selectionX.Text = GetSelectionX();
            MainWindow.window.selectionY.Text = GetSelectionY();

            MainWindow.window.selectionX.IsEnabled = true;
            MainWindow.window.selectionY.IsEnabled = true;
            MainWindow.window.selectionWidth.IsEnabled = true;
            MainWindow.window.selectionHeight.IsEnabled = true;
            MainWindow.window.selectionRotation.IsEnabled = true;
            MainWindow.window.lockAspectCheckbox.IsEnabled = true;
        }
        public ResizeTool(Level pointer, Primitive shape, Point startPoint, bool fromCreate, bool isTop, bool isBot, bool isLeft, bool isRight)
            : base(pointer)
        {
            this.prim = shape;
            this.fromCreate = fromCreate;
            this.startPoint = startPoint;
            this.isTop = isTop;
            this.isBot = isBot;
            this.isLeft = isLeft;
            this.isRight = isRight;

            leftX = prim.x;
            rightX = prim.x + prim.w;
            topY = prim.y;
            botY = prim.y + prim.h;

            origW = shape.w;
            origH = shape.h;
        }
 public void AddPrimitive(Primitive prim)
 {
     if (primitives.Count != 0)
     {
         var lastPrim = primitives.Last<Primitive>();
         if (lastPrim != null)
         {
             prim.z = lastPrim.z + 1;
         }
     }
     primitives.Add(prim);
 }
 public void MovePrimToFront(Primitive prim)
 {
     var lastPrim = primitives.Last<Primitive>();
     ZIndexCommand zIndexCommand = new ZIndexCommand(primitives, prim, prim.z, lastPrim.z + 1);
     commands.Add(zIndexCommand);
     zIndexCommand.Do();
 }
 public void MovePrimToBack(Primitive prim)
 {
     var firstPrim = primitives.First<Primitive>();
     ZIndexCommand zIndexCommand = new ZIndexCommand(primitives, prim, prim.z, firstPrim.z - 1);
     commands.Add(zIndexCommand);
     zIndexCommand.Do();
 }
        public void MovePrimForward(Primitive prim)
        {
            Primitive nextPrim;
            int nextPrimIndex = primitives.IndexOf(prim) + 1;
            if(nextPrimIndex < 0 || nextPrimIndex >= primitives.Count) { return; }
            nextPrim = primitives[nextPrimIndex];

            ZIndexCommand zIndexCommand = new ZIndexCommand(primitives, prim, prim.z, nextPrim.z, nextPrim, nextPrim.z, prim.z);
            commands.Add(zIndexCommand);
            zIndexCommand.Do();
        }
        public void MovePrimBackward(Primitive prim)
        {
            Primitive prevPrim;
            int prevPrimIndex = primitives.IndexOf(prim) - 1;
            if (prevPrimIndex < 0 || prevPrimIndex >= primitives.Count) { return; }
            prevPrim = primitives[prevPrimIndex];

            ZIndexCommand zIndexCommand = new ZIndexCommand(primitives, prevPrim, prevPrim.z, prim.z, prim, prim.z, prevPrim.z);
            commands.Add(zIndexCommand);
            zIndexCommand.Do();
        }