LunarPresentation/Commands/MoveToNext.cs

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using SHomeWorkshop.LunarPresentation.Expressions;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void MoveToNext()
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            LunarPresentation.Expressions.Expression curEx
                = Globals.selectedEditor.SelectedExpression;

            if (curEx is Expressions.SubPanel)
            {
                MessageBox.Show("子面板不支持“前后平移”操作!", Globals.appName,
                    MessageBoxButton.OK, MessageBoxImage.Warning);
                return;//子面板不支持Copy。
            }

            if (curEx is Expressions.BaseText)
            {
                Expressions.BaseText bt = curEx as Expressions.BaseText;
                if (bt.IsHeaderText && bt.Indent <= 3 && bt.IsCollapsed)
                {
                    Command.MoveCollapsedHeaderTextToNext(bt);
                    return;
                }
            }

            Command.MoveNormalExToNext(curEx);

            // 刷新父面板中所有可能存在的树型线。
            if (curEx.ParentPanel != null && curEx.ParentPanel.Direction == Orientation.Vertical)
            {
                curEx.ParentPanel.RefreshTreeLinesOfHeaderText();
            }
        }

        private static void MoveNormalExToNext(Expressions.Expression curEx)
        {
            if (curEx == null || curEx.ParentPanel == null) return;

            int nextVisibleExIndex = -1;
            int curIndex = curEx.ParentPanel.BasePanel.Children.IndexOf(curEx);
            Expressions.Expression nextVisibleEx = null;
            for (int i = curIndex + 1; i < curEx.ParentPanel.BasePanel.Children.Count; i++)
            {
                Expressions.Expression ex = curEx.ParentPanel.BasePanel.Children[i] as Expressions.Expression;
                if (ex.Visibility == Visibility.Visible)
                {
                    nextVisibleEx = ex;
                    nextVisibleExIndex = i;
                    break;
                }
            }
后面还有 279 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。