BFLYT : Allow groups to have their pane list edited.

This commit is contained in:
KillzXGaming 2020-12-12 12:20:50 -05:00
parent b8ad3d9734
commit f7e982dd6d
6 changed files with 76 additions and 33 deletions

View file

@ -288,8 +288,8 @@ namespace LayoutBXLYT.Cafe
BasePane currentPane = null;
BasePane parentPane = null;
BasePane currentGroupPane = null;
BasePane parentGroupPane = null;
GroupPane currentGroupPane = null;
GroupPane parentGroupPane = null;
reader.SeekBegin(HeaderSize);
for (int i = 0; i < sectionCount; i++)
@ -439,6 +439,15 @@ namespace LayoutBXLYT.Cafe
}
}
private void SetPane(GroupPane pane, GroupPane parentPane)
{
if (parentPane != null)
{
parentPane.Childern.Add(pane);
pane.Parent = parentPane;
}
}
private void SetPane(BasePane pane, BasePane parentPane)
{
if (parentPane != null)
@ -549,7 +558,7 @@ namespace LayoutBXLYT.Cafe
}
}
private void WriteGroupPanes(FileWriter writer, BasePane pane, LayoutHeader header, ref int sectionCount)
private void WriteGroupPanes(FileWriter writer, GroupPane pane, LayoutHeader header, ref int sectionCount)
{
WriteSection(writer, pane.Signature, pane, () => pane.Write(writer, header));
sectionCount++;
@ -561,7 +570,7 @@ namespace LayoutBXLYT.Cafe
//Write start of children section
WriteSection(writer, "grs1", null);
foreach (var child in pane.Childern)
foreach (GroupPane child in pane.Childern)
WriteGroupPanes(writer, child, header, ref sectionCount);
//Write pae1 of children section

View file

@ -350,8 +350,8 @@ namespace LayoutBXLYT
BasePane currentPane = null;
BasePane parentPane = null;
BasePane currentGroupPane = null;
BasePane parentGroupPane = null;
GroupPane currentGroupPane = null;
GroupPane parentGroupPane = null;
reader.SeekBegin(HeaderSize);
for (int i = 0; i < sectionCount; i++)
@ -468,6 +468,15 @@ namespace LayoutBXLYT
}
}
private void SetPane(GroupPane pane, GroupPane parentPane)
{
if (parentPane != null)
{
parentPane.Childern.Add(pane);
pane.Parent = parentPane;
}
}
private void SetPane(BasePane pane, BasePane parentPane)
{
if (parentPane != null)
@ -566,7 +575,7 @@ namespace LayoutBXLYT
}
}
private void WriteGroupPanes(FileWriter writer, BasePane pane, LayoutHeader header, ref int sectionCount)
private void WriteGroupPanes(FileWriter writer, GroupPane pane, LayoutHeader header, ref int sectionCount)
{
WriteSection(writer, pane.Signature, pane, () => pane.Write(writer, header));
sectionCount++;

View file

@ -2254,7 +2254,7 @@ namespace LayoutBXLYT
public BasePane RootPane { get; set; }
[Browsable(false)]
public BasePane RootGroup { get; set; }
public GroupPane RootGroup { get; set; }
[Browsable(false)]
public virtual Dictionary<string, STGenericTexture> GetTextures { get; }
@ -2814,27 +2814,28 @@ namespace LayoutBXLYT
}
}
public class GroupPane : BasePane
public class GroupPane : SectionCommon
{
public override string Signature { get; } = "grp1";
public string Name { get; set; }
[Editor(@"System.Windows.Forms.Design.StringCollectionEditor," +
"System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(System.Drawing.Design.UITypeEditor))]
public List<string> Panes { get; set; } = new List<string>();
private bool displayInEditor = true;
internal override bool DisplayInEditor
{
get { return displayInEditor; }
set
{
displayInEditor = value;
for (int i = 0; i < Panes.Count; i++)
{
var pane = SearchPane(Panes[i]);
if (pane != null)
pane.DisplayInEditor = value;
}
}
}
[Browsable(false)]
public List<GroupPane> Childern = new List<GroupPane>();
[Browsable(false)]
public bool HasChildern => Childern.Count > 0;
[Browsable(false)]
public BxlytHeader LayoutFile;
[Browsable(false)]
public GroupPane Parent { get; set; }
public GroupPane() : base()
{

View file

@ -351,8 +351,8 @@ namespace LayoutBXLYT
BasePane currentPane = null;
BasePane parentPane = null;
BasePane currentGroupPane = null;
BasePane parentGroupPane = null;
GroupPane currentGroupPane = null;
GroupPane parentGroupPane = null;
reader.SeekBegin(HeaderSize);
for (int i = 0; i < sectionCount; i++)
@ -461,6 +461,15 @@ namespace LayoutBXLYT
}
}
private void SetPane(GroupPane pane, GroupPane parentPane)
{
if (parentPane != null)
{
parentPane.Childern.Add(pane);
pane.Parent = parentPane;
}
}
private void SetPane(BasePane pane, BasePane parentPane)
{
if (parentPane != null)
@ -545,7 +554,7 @@ namespace LayoutBXLYT
}
}
private void WriteGroupPanes(FileWriter writer, BasePane pane, LayoutHeader header, ref int sectionCount)
private void WriteGroupPanes(FileWriter writer, GroupPane pane, LayoutHeader header, ref int sectionCount)
{
WriteSection(writer, pane.Signature, pane, () => pane.Write(writer, header));
sectionCount++;

View file

@ -72,7 +72,7 @@ namespace LayoutBXLYT
LoadMaterials(bxlyt.Materials);
treeView1.Nodes.Add(new AnimatedPaneFolder(ParentEditor, "Animated Pane List") { Tag = bxlyt });
LoadPane(bxlyt.RootGroup);
LoadGroup(bxlyt.RootGroup);
LoadPane(bxlyt.RootPane);
treeView1.EndUpdate();
@ -237,7 +237,7 @@ namespace LayoutBXLYT
private void CreateQuickAccess(BxlytHeader bxlyt)
{
var panes = new List<BasePane>();
var groupPanes = new List<BasePane>();
var groupPanes = new List<GroupPane>();
GetPanes(bxlyt.RootPane,ref panes);
GetGroupPanes(bxlyt.RootGroup,ref groupPanes);
@ -288,7 +288,8 @@ namespace LayoutBXLYT
for (int i = 0; i < groupPanes.Count; i++)
{
var paneNode = CreatePaneWrapper(groupPanes[i]);
var paneNode = new TreeNode() { Text = groupPanes[i].Name };
paneNode.Tag = groupPanes[i];
groupFolder.Nodes.Add(paneNode);
}
}
@ -300,11 +301,11 @@ namespace LayoutBXLYT
GetPanes(childPane,ref panes);
}
private void GetGroupPanes(BasePane pane, ref List<BasePane> panes)
private void GetGroupPanes(GroupPane pane, ref List<GroupPane> panes)
{
panes.Add(pane);
foreach (var childPane in pane.Childern)
GetPanes(childPane,ref panes);
foreach (GroupPane childPane in pane.Childern)
GetGroupPanes(childPane, ref panes);
}
public static PaneTreeWrapper CreatePaneWrapper(BasePane pane)
@ -327,6 +328,19 @@ namespace LayoutBXLYT
return paneNode;
}
private void LoadGroup(GroupPane pane, TreeNode parent = null)
{
var paneNode = new TreeNode() { Text = pane.Name, Tag = pane };
if (parent == null)
treeView1.Nodes.Add(paneNode);
else
parent.Nodes.Add(paneNode);
foreach (var childPane in pane.Childern)
LoadGroup(childPane, paneNode);
}
private void LoadPane(BasePane pane, TreeNode parent = null)
{
var paneNode = CreatePaneWrapper(pane);

View file

@ -32,6 +32,7 @@ after_build:
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Toolbox.exe"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Lib"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\KclMaterialPresets"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\Hashes"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\x64"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\x86"
- 7z a "Toolbox-Latest.zip" "%APPVEYOR_BUILD_FOLDER%\Toolbox\bin\Release\ZstdNet.dll"