using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fsxm.LispEdit;
using System.Windows.Forms;

[assembly: PluginClassAttribute(typeof(Plugin_Test.PluginTest))]

namespace Plugin_Test
{
    public class PluginTest : Plugin
    {
        public override void Start()
        {
            ////插入文字
            //AddMenuItem("插入文字",
            //    () =>
            //    {
            //        var edit = ActivateEdit;
            //        if (edit == null) return;
            //        edit.InsertText("插入文字");
            //    });

            //全部折叠
            var item = AddMenuItem("全部折叠", null);
            item.Click += item_Click;
            item.ShortcutKeys = Keys.F7;

            //全部展开
            var item2 = AddMenuItem("全部展开", null);
            item2.Click += item2_Click;
            item2.ShortcutKeys = Keys.F8;

            //生成对话框
            //AddMenuItem("对话框",
            //    () =>
            //    {
            //        Form frm = new Form();
            //        frm.Show(EditApp);
            //    });
        }

        void item_Click(object sender, EventArgs e)
        {
            var edit = ActivateEdit;
            if (edit == null) return;

            edit.CollapseAllFoldingBlocks();
        }

        void item2_Click(object sender, EventArgs e)
        {
            var edit = ActivateEdit;
            if (edit == null) return;

            edit.ExpandAllFoldingBlocks();
        }
    }
}
