LunarPresentation/Commands/Indent.cs
(开头部分) 17KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Windows;
using System.Windows.Controls;
namespace SHomeWorkshop.LunarPresentation.Commands
{
public partial class Command
{
public static void Indent()
{
if (Globals.selectedEditor == null) return;
if (Globals.selectedEditor.SelectedExpression == null) return;
if (Globals.selectedEditor.SelectedExpression.Indent >= 6)
{
//这个消息框很烦人!!
//MessageBox.Show("已到最大缩进级别!", Globals.appName,
// MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
LunarPresentation.Expressions.Expression curEx
= Globals.selectedEditor.SelectedExpression;
if (curEx is Expressions.SubPanel)
{
return;//子面板不支持缩进。
}
if (curEx is Expressions.BaseText && curEx.Indent < 6)
{
Expressions.BaseText curBt = curEx as Expressions.BaseText;
if (curBt.IsCollapsed)
{
MessageBox.Show("折叠的标题文本块不能更改缩进级别。此外“剪切、粘贴、删除、平移、拖动”等操作亦被禁止。",
Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
}
if (curEx.Parent is StackPanel)
{
StackPanel spanel = curEx.Parent as StackPanel;
if (spanel.Orientation == Orientation.Vertical)
{
if (curEx.Align == Expressions.Expression.Alignment.RightOrBottom)
{
return;//右对齐时,Indent或Outdent均无效。
}
ModifingItem mi = new ModifingItem();
Action action = new Action(curEx.ExID, -1, curEx.GetType().Name, "Indent",
curEx.Indent.ToString(), (curEx.Indent + 1).ToString());
curEx.Indent += 1;
//如果缩进到上一个折叠的标题文本块的“下级”,则应展开上一个折叠的标题文本块。
Expressions.Expression preVisibleEx = null;
int curIndex = curEx.ParentPanel.BasePanel.Children.IndexOf(curEx);
for (int i = curIndex - 1; i >= 0; i--)
{
Expressions.Expression iEx = curEx.ParentPanel.BasePanel.Children[i] as Expressions.Expression;
后面还有 334 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。