Exemple #1
0
        public void HandleRightClick()
        {
            mMenu.Items.Clear();

            SelectedState state = SelectedState.Self;

            // If a frame is not null, then the chain will always be not null,
            // so check the frame first
            if (state.SelectedFrame != null)
            {
                AddReorderOptions();

                mMenu.Items.Add("-");


                mMenu.Items.Add("Copy", null, CopyClick);
                mMenu.Items.Add("Paste", null, PasteClick);
                mMenu.Items.Add("View Texture in Explorer", null, ViewTextureInExplorer);

                mMenu.Items.Add("Delete AnimationFrame", null, DeleteAnimationFrameClick);
            }
            else if (state.SelectedChain != null)
            {
                AddReorderOptions();

                mMenu.Items.Add("-");


                mMenu.Items.Add("Adjust All Frame Time", null, AdjustFrameTimeClick);
                mMenu.Items.Add("Adjust Offsets", null, AdjustOffsetsClick);
                mMenu.Items.Add("Flip Horizontally", null, FlipAnimationChainHorizontally);
                mMenu.Items.Add("Flip Vertically", null, FlipAnimationChainVertically);

                mMenu.Items.Add("-");
                mMenu.Items.Add("Add AnimationChain", null, AddChainClick);
                mMenu.Items.Add("Add Frame", null, AddFrameClick);
                mMenu.Items.Add("-");

                CreateDuplicateToolStripItems();

                mMenu.Items.Add("Copy", null, CopyClick);
                mMenu.Items.Add("Paste", null, PasteClick);
                mMenu.Items.Add("-");
                mMenu.Items.Add("Delete AnimationChain", null, DeleteAnimationChainClick);
            }
            else
            {
                mMenu.Items.Add("Add AnimationChain", null, AddChainClick);
                mMenu.Items.Add("-");
                mMenu.Items.Add("Paste", null, PasteClick);
            }

            if (mMenu.Items.Count != 0)
            {
                mMenu.Items.Add("-");
            }

            mMenu.Items.Add("Sort Animations Alphabetically", null, SortAnimationsAlphabetically);
        }
Exemple #2
0
        public void HandleRightClick()
        {
            mMenu.Items.Clear();

            SelectedState state = SelectedState.Self;

            // If a frame is not null, then the chain will always be not null,
            // so check the frame first
            if (state.SelectedFrame != null)
            {
                mMenu.Items.Add("Copy", null, CopyClick);
                mMenu.Items.Add("Paste", null, PasteClick);
                mMenu.Items.Add("View Texture in Explorer", null, ViewTextureInExplorer);

                mMenu.Items.Add("Delete AnimationFrame", null, DeleteAnimationFrameClick);
            }
            else if (state.SelectedChain != null)
            {
                var mMoveToTop = new ToolStripMenuItem("^^ Move To Top");
                mMoveToTop.ShortcutKeyDisplayString = "Alt+Shift+Up";
                mMoveToTop.Click += new System.EventHandler(MoveToTopClick);
                mMenu.Items.Add(mMoveToTop);

                var mMoveUp = new ToolStripMenuItem("^ Move Up");
                mMoveUp.ShortcutKeyDisplayString = "Alt+Up";
                mMoveUp.Click += new System.EventHandler(MoveUpClick);
                mMenu.Items.Add(mMoveUp);

                var mMoveDown = new ToolStripMenuItem("v Move Down");
                mMoveDown.ShortcutKeyDisplayString = "Alt+Down";
                mMoveDown.Click += new System.EventHandler(MoveDownClick);
                mMenu.Items.Add(mMoveDown);

                var mMoveToBottom = new ToolStripMenuItem("vv Move To Bottom");
                mMoveToBottom.ShortcutKeyDisplayString = "Alt+Shift+Down";
                mMoveToBottom.Click += new System.EventHandler(MoveToBottomClick);
                mMenu.Items.Add(mMoveToBottom);


                mMenu.Items.Add("-");


                mMenu.Items.Add("Adjust All Frame Time", null, AdjustFrameTimeClick);
                mMenu.Items.Add("Adjust Offsets", null, AdjustOffsetsClick);
                mMenu.Items.Add("Flip Horizontally", null, FlipAnimationChainHorizontally);
                mMenu.Items.Add("Flip Vertically", null, FlipAnimationChainVertically);

                mMenu.Items.Add("-");
                mMenu.Items.Add("Add AnimationChain", null, AddChainClick);
                mMenu.Items.Add("Add Frame", null, AddFrameClick);
                mMenu.Items.Add("-");

                CreateDuplicateToolStripItems();

                mMenu.Items.Add("Copy", null, CopyClick);
                mMenu.Items.Add("Paste", null, PasteClick);
                mMenu.Items.Add("-");
                mMenu.Items.Add("Delete AnimationChain", null, DeleteAnimationChainClick);
            }
            else
            {
                mMenu.Items.Add("Add AnimationChain", null, AddChainClick);
                mMenu.Items.Add("-");
                mMenu.Items.Add("Paste", null, PasteClick);
            }

            if (mMenu.Items.Count != 0)
            {
                mMenu.Items.Add("-");
            }

            mMenu.Items.Add("Sort Animations Alphabetically", null, SortAnimationsAlphabetically);
        }
Exemple #3
0
        private void CreateDuplicateToolStripItems()
        {
            SelectedState state = SelectedState.Self;

            var toolStripMenuItem = new ToolStripMenuItem("Duplicate...");

            var currentChainName = state.SelectedChain.Name;


            toolStripMenuItem.DropDownItems.Add("Original", null, (not, used) => HandleDuplicateOriginalClicked(false, false, null));

            string horizontallyText  = "Flipped Horizontally";
            string newHorizontalName = null;

            var hasLeft  = currentChainName?.ToLowerInvariant().Contains("left") == true;
            var hasRight = currentChainName?.ToLowerInvariant().Contains("right") == true;

            if (hasLeft)
            {
                newHorizontalName = currentChainName
                                    .Replace("Left", "Right")
                                    .Replace("left", "right")
                                    .Replace("LEFT", "RIGHT");
            }
            else if (hasRight)
            {
                newHorizontalName = currentChainName
                                    .Replace("Right", "Left")
                                    .Replace("right", "left")
                                    .Replace("RIGHT", "LEFT");
            }
            // Do a comparison against the original name in case the value hasn't been replaced due to caps
            if (newHorizontalName == currentChainName)
            {
                newHorizontalName = null;
            }

            if (newHorizontalName != null)
            {
                horizontallyText += $" as {newHorizontalName}";
            }
            toolStripMenuItem.DropDownItems.Add(horizontallyText, null, (not, used) => HandleDuplicateOriginalClicked(true, false, newHorizontalName));


            string verticallyText  = "Flipped Vertically";
            string newVerticalName = null;

            var hasUp   = currentChainName?.ToLowerInvariant().Contains("up") == true;
            var hasDown = currentChainName?.ToLowerInvariant().Contains("down") == true;

            if (hasUp)
            {
                newVerticalName = currentChainName
                                  .Replace("Up", "Down")
                                  .Replace("up", "down")
                                  .Replace("UP", "DOWN");
            }
            else if (hasDown)
            {
                newVerticalName = currentChainName
                                  .Replace("Down", "Up")
                                  .Replace("down", "up")
                                  .Replace("DOWN", "UP");
            }
            // Do a coparison against the original name in case the value hasn't been replaced due to caps
            if (newVerticalName == currentChainName)
            {
                newVerticalName = null;
            }

            if (newVerticalName != null)
            {
                verticallyText += $" as {newVerticalName}";
            }

            toolStripMenuItem.DropDownItems.Add(verticallyText, null, (not, used) => HandleDuplicateOriginalClicked(false, true, newVerticalName));

            mMenu.Items.Add(toolStripMenuItem);
        }