private void addSpriteButton_Click(object sender, EventArgs e)
        {
            var modification = new AddSprite(sprites, selectedSprites[0]);

            ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
            undoHistory.Add(modification);
        }
        private void UpdateSpriteName()
        {
            var modification = new RenameSprite(selectedSprites[0], spriteNameBox.Text);

            ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
            undoHistory.Add(modification);
            sprites.ResetBindings();
        }
 private void moveUpButton_Click(object sender, EventArgs e)
 {
     if (spriteList.SelectedIndex > 0)
     {
         var modification = new MoveSpriteListEntry(sprites, spriteList.SelectedIndex, -1);
         ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
         undoHistory.Add(modification);
         int newPosition = spriteList.SelectedIndex - 1;
         spriteList.SelectedIndices.Clear();
         spriteList.SelectedIndex = newPosition;
     }
 }
        private void originYPosBox_ValueChanged(object sender, EventArgs e)
        {
            if (loadingSprite)
            {
                return;
            }
            var modification = new ModifyOrigin(selectedSprites, y: (int)originYPosBox.Value);

            ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
            undoHistory.Add(modification);
            spriteSheetViewer.Refresh();
        }
        private void originPresetBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((OriginPreset)originPresetBox.SelectedIndex == OriginPreset.None)
            {
                return;
            }
            var modification = new ApplyOriginPreset(selectedSprites,
                                                     (OriginPreset)originPresetBox.SelectedIndex);

            ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
            undoHistory.Add(modification);
            spriteSheetViewer.Refresh();
        }
        private void spriteHeightBox_ValueChanged(object sender, EventArgs e)
        {
            if (loadingSprite)
            {
                return;
            }
            var modification = new ModifyBounds(selectedSprites, height: (int)spriteHeightBox.Value);

            ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
            undoHistory.Add(modification);
            UpdateHighlightMask();
            spriteSheetViewer.Refresh();
        }
 private void spriteSheetViewer_MouseUp(object sender, MouseEventArgs e)
 {
     if (movingWithMouse)
     {
         movingWithMouse = false;
         var totalDragX = selectedSprites[0].Bounds.X - preDragBounds[0].X;
         var totalDragY = selectedSprites[0].Bounds.Y - preDragBounds[0].Y;
         if (totalDragX != 0 || totalDragY != 0)
         {
             var modification = new MoveBounds(selectedSprites, totalDragX, totalDragY, preDragBounds);
             modification.Undo();
             ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
             undoHistory.Add(modification);
         }
     }
 }
        private void removeSpriteButton_Click(object sender, EventArgs e)
        {
            int indexToRemove = spriteList.SelectedIndex;

            if (indexToRemove == sprites.Count - 1)
            {
                spriteList.SelectedIndices.Clear();
                spriteList.SelectedIndex = indexToRemove - 1;
            }

            if (indexToRemove > -1 && indexToRemove < sprites.Count)
            {
                var modification = new RemoveSprite(sprites, indexToRemove);
                ModHelper.DoModificationWithSelectionTracking(modification, spriteList);
                undoHistory.Add(modification);
            }
        }
示例#9
0
 private void DoModification(IModification mod)
 {
     ModHelper.DoModificationWithSelectionTracking(mod, animationBox, frameListBox, frameSpriteListBox);
     undoHistory.Add(mod);
 }