2019-08-29 21:45:32 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using FirstPlugin;
|
|
|
|
|
using Toolbox.Library.Forms;
|
|
|
|
|
|
2019-08-29 22:33:23 +02:00
|
|
|
|
namespace LayoutBXLYT
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
|
|
|
|
public partial class LayoutHierarchy : UserControl
|
|
|
|
|
{
|
|
|
|
|
public LayoutHierarchy()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
treeView1.BackColor = FormThemes.BaseTheme.FormBackColor;
|
|
|
|
|
treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
|
|
|
|
|
|
|
|
|
|
var imgList = new ImageList();
|
2019-08-29 22:33:23 +02:00
|
|
|
|
imgList.Images.Add("AlignmentPane", FirstPlugin.Properties.Resources.AlignmentPane);
|
|
|
|
|
imgList.Images.Add("WindowPane", FirstPlugin.Properties.Resources.WindowPane);
|
|
|
|
|
imgList.Images.Add("ScissorPane", FirstPlugin.Properties.Resources.ScissorPane);
|
|
|
|
|
imgList.Images.Add("BoundryPane", FirstPlugin.Properties.Resources.BoundryPane);
|
|
|
|
|
imgList.Images.Add("NullPane", FirstPlugin.Properties.Resources.NullPane);
|
|
|
|
|
imgList.Images.Add("PicturePane", FirstPlugin.Properties.Resources.PicturePane);
|
2019-08-29 21:45:32 +02:00
|
|
|
|
imgList.ImageSize = new Size(22,22);
|
|
|
|
|
treeView1.ImageList = imgList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool isLoaded = false;
|
|
|
|
|
private EventHandler OnProperySelected;
|
2019-08-29 23:17:24 +02:00
|
|
|
|
public void LoadLayout(BxlytHeader bflyt, EventHandler onPropertySelected)
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
|
|
|
|
isLoaded = false;
|
|
|
|
|
OnProperySelected = onPropertySelected;
|
|
|
|
|
|
2019-08-29 23:17:24 +02:00
|
|
|
|
treeView1.Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
LoadPane(bflyt.RootGroup);
|
|
|
|
|
LoadPane(bflyt.RootPane);
|
2019-08-29 21:45:32 +02:00
|
|
|
|
|
|
|
|
|
isLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-29 22:33:23 +02:00
|
|
|
|
private void LoadPane(BasePane pane, TreeNode parent = null)
|
2019-08-29 21:45:32 +02:00
|
|
|
|
{
|
|
|
|
|
PaneTreeWrapper paneNode = new PaneTreeWrapper();
|
|
|
|
|
paneNode.Checked = true;
|
|
|
|
|
paneNode.Text = pane.Name;
|
|
|
|
|
paneNode.Tag = pane;
|
|
|
|
|
|
|
|
|
|
string imageKey = "";
|
|
|
|
|
if (pane is BFLYT.WND1) imageKey = "WindowPane";
|
|
|
|
|
else if (pane is BFLYT.PIC1) imageKey = "PicturePane";
|
|
|
|
|
else if (pane is BFLYT.BND1) imageKey = "BoundryPane";
|
|
|
|
|
else imageKey = "NullPane";
|
|
|
|
|
|
|
|
|
|
paneNode.ImageKey = imageKey;
|
|
|
|
|
paneNode.SelectedImageKey = imageKey;
|
|
|
|
|
|
|
|
|
|
if (parent == null)
|
|
|
|
|
treeView1.Nodes.Add(paneNode);
|
|
|
|
|
else
|
|
|
|
|
parent.Nodes.Add(paneNode);
|
|
|
|
|
|
|
|
|
|
foreach (var childPane in pane.Childern)
|
|
|
|
|
LoadPane(childPane, paneNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (isLoaded)
|
|
|
|
|
OnProperySelected.Invoke("Select", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (isLoaded)
|
|
|
|
|
OnProperySelected.Invoke("Checked", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|