BFLYT Editor: Add option to add part panes.

This commit is contained in:
KillzXGaming 2019-11-06 21:01:29 -05:00
parent 92e535948e
commit 73c800f0c9
5 changed files with 55 additions and 2 deletions

View file

@ -1588,6 +1588,20 @@ namespace LayoutBXLYT.Cafe
}
public PRT1(Header header, string name) : base() {
LoadDefaults();
Name = name;
layoutFile = header;
MagnifyX = 1;
MagnifyY = 1;
LayoutFileName = "";
Properties = new List<PartProperty>();
}
[DisplayName("Magnify X"), CategoryAttribute("Parts")]
public float MagnifyX { get; set; }
@ -1597,14 +1611,25 @@ namespace LayoutBXLYT.Cafe
[DisplayName("Properties"), CategoryAttribute("Parts")]
public List<PartProperty> Properties { get; set; }
private string layoutFilename;
[DisplayName("External Layout File"), CategoryAttribute("Parts")]
public string LayoutFileName { get; set; }
public string LayoutFileName
{
get { return layoutFilename; }
set
{
layoutFilename = value;
ExternalLayout = null;
hasSearchedParts = false;
}
}
private BFLYT ExternalLayout;
public BasePane GetExternalPane()
{
if (hasSearchedParts) return null;
if (hasSearchedParts || LayoutFileName == string.Empty) return null;
if (ExternalLayout == null)
ExternalLayout = SearchExternalFile();

View file

@ -50,6 +50,7 @@
this.stTextBox1.Name = "stTextBox1";
this.stTextBox1.Size = new System.Drawing.Size(186, 20);
this.stTextBox1.TabIndex = 1;
this.stTextBox1.TextChanged += new System.EventHandler(this.stTextBox1_TextChanged);
//
// listViewCustom1
//
@ -57,6 +58,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.HideSelection = false;
this.listViewCustom1.Location = new System.Drawing.Point(3, 85);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;

View file

@ -27,5 +27,10 @@ namespace LayoutBXLYT
stTextBox1.Bind(pane, "LayoutFileName");
}
private void stTextBox1_TextChanged(object sender, EventArgs e)
{
ParentEditor.PropertyChanged?.Invoke(sender, e);
}
}
}

View file

@ -1103,6 +1103,21 @@ namespace LayoutBXLYT
ActiveLayout.AddPane(pane, pane.Parent);
}
public BasePane AddNewPartPane()
{
BasePane pane = null;
if (ActiveLayout is BFLYT.Header)
pane = new BFLYT.PRT1((BFLYT.Header)ActiveLayout, RenamePane("N_part"));
if (pane != null)
{
pane.NodeWrapper = LayoutHierarchy.CreatePaneWrapper(pane);
ActiveLayout.AddPane(pane, ActiveLayout.RootPane);
}
return pane;
}
public BasePane AddNewNullPane()
{
BasePane pane = null;

View file

@ -828,6 +828,7 @@ namespace LayoutBXLYT
var createPanes = new STToolStripItem("Create Pane");
createPanes.DropDownItems.Add(new STToolStripItem("Null Pane", CreateNullPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Picture Pane", CreatePicturePaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Part Pane", CreatePartPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Text Box Pane", CreateTextPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Window Pane", CreateWindowPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Boundry Pane", CreateBoundryPaneAction));
@ -857,6 +858,11 @@ namespace LayoutBXLYT
Console.WriteLine("SelectedPanes " + SelectedPanes.Count);
}
private void CreatePartPaneAction(object sender, EventArgs e) {
var pane = ParentEditor.AddNewPartPane();
SetupNewPane(pane, pickOriginMouse);
}
private void CreateNullPaneAction(object sender, EventArgs e) {
var pane = ParentEditor.AddNewNullPane();
SetupNewPane(pane, pickOriginMouse);