diff --git a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs index 752b625e..acd27c98 100644 --- a/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs +++ b/File_Format_Library/FileFormats/Layout/CAFE/BFLYT.cs @@ -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(); + } + [DisplayName("Magnify X"), CategoryAttribute("Parts")] public float MagnifyX { get; set; } @@ -1597,14 +1611,25 @@ namespace LayoutBXLYT.Cafe [DisplayName("Properties"), CategoryAttribute("Parts")] public List 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(); diff --git a/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.Designer.cs b/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.Designer.cs index ca3f4287..7991125d 100644 --- a/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.Designer.cs +++ b/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.Designer.cs @@ -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; diff --git a/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.cs b/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.cs index 60b77d0d..0298bd83 100644 --- a/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.cs +++ b/File_Format_Library/GUI/BFLYT/Editor/Part/PartPaneEditor.cs @@ -27,5 +27,10 @@ namespace LayoutBXLYT stTextBox1.Bind(pane, "LayoutFileName"); } + + private void stTextBox1_TextChanged(object sender, EventArgs e) + { + ParentEditor.PropertyChanged?.Invoke(sender, e); + } } } diff --git a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs index 4dad967c..d874ecaa 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutEditor.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutEditor.cs @@ -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; diff --git a/File_Format_Library/GUI/BFLYT/LayoutViewer.cs b/File_Format_Library/GUI/BFLYT/LayoutViewer.cs index 2b6a23df..5dabb008 100644 --- a/File_Format_Library/GUI/BFLYT/LayoutViewer.cs +++ b/File_Format_Library/GUI/BFLYT/LayoutViewer.cs @@ -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);