diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 8091b1ee..a1e5aef8 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs b/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs index 1f3ed5a4..434a96f8 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs @@ -14,7 +14,7 @@ using Syroot.NintenTools.NSW.Bntx.GFX; namespace FirstPlugin { - public class NUTEXB : STGenericTexture, IEditor, IFileFormat + public class NUTEXB : STGenericTexture, IFileFormat { public override TEX_FORMAT[] SupportedFormats { @@ -139,8 +139,22 @@ namespace FirstPlugin return types.ToArray(); } } - public ImageEditorForm OpenForm() + + public override void OnClick(TreeView treeview) { + UpdateEditor(); + } + + private void UpdateEditor() + { + ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase)); + if (editor == null) + { + editor = new ImageEditorBase(); + editor.Dock = DockStyle.Fill; + LibraryGUI.Instance.LoadEditor(editor); + } + Properties prop = new Properties(); prop.Width = Width; prop.Height = Height; @@ -150,16 +164,9 @@ namespace FirstPlugin prop.ImageSize = (uint)ImageData.Length; prop.Format = NutFormat; - ImageEditorForm form = new ImageEditorForm(); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; - form.editorBase.AddFileContextEvent("Save", Save); - form.editorBase.AddFileContextEvent("Use Size Restrictions", UseSizeRestrictions, true); - form.editorBase.AddFileContextEvent("Replace", Replace); - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); - - return form; + editor.Text = Text; + editor.LoadProperties(prop); + editor.LoadImage(this); } private void UseSizeRestrictions(object sender, EventArgs args) @@ -224,25 +231,6 @@ namespace FirstPlugin public uint ImageSize { get; set; } } - public void UpdateEditor() - { - var imgEditor = LibraryGUI.Instance.GetActiveForm(); - if (imgEditor is ImageEditorForm) - { - Properties prop = new Properties(); - prop.Width = Width; - prop.Height = Height; - prop.Depth = Depth; - prop.MipCount = MipCount; - prop.ArrayCount = ArrayCount; - prop.ImageSize = (uint)ImageData.Length; - prop.Format = NutFormat; - - ((ImageEditorForm)imgEditor).Text = Text; - ((ImageEditorForm)imgEditor).editorBase.LoadProperties(prop); - ((ImageEditorForm)imgEditor).editorBase.LoadImage(this); - } - } class MenuExt : IFileMenuExtension { public STToolStripItem[] NewFileMenuExtensions => null; diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index f59f31b1..3d8580af 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll index 57e46e64..7f221021 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll differ diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb index 416fc03f..961857c1 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache index ac660a68..a0b13e8f 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache differ diff --git a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs index b6016b94..b748c17c 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs @@ -30,11 +30,11 @@ { this.components = new System.ComponentModel.Container(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); + this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom(); this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel(); this.searchLbl = new Switch_Toolbox.Library.Forms.STLabel(); this.searchImgPB = new System.Windows.Forms.PictureBox(); this.stTextBox1 = new Switch_Toolbox.Library.Forms.STTextBox(); - this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom(); this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -42,6 +42,7 @@ this.sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.splitter1 = new System.Windows.Forms.Splitter(); + this.importToActiveWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contentContainer.SuspendLayout(); this.stPanel1.SuspendLayout(); this.stPanel3.SuspendLayout(); @@ -71,6 +72,26 @@ this.stPanel1.TabIndex = 11; this.stPanel1.Resize += new System.EventHandler(this.stPanel1_Resize); // + // treeViewCustom1 + // + this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.treeViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.treeViewCustom1.CheckBoxes = true; + this.treeViewCustom1.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll; + this.treeViewCustom1.ImageIndex = 0; + this.treeViewCustom1.Location = new System.Drawing.Point(1, 53); + this.treeViewCustom1.Name = "treeViewCustom1"; + this.treeViewCustom1.SelectedImageIndex = 0; + this.treeViewCustom1.Size = new System.Drawing.Size(311, 458); + this.treeViewCustom1.TabIndex = 0; + this.treeViewCustom1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterCheck); + this.treeViewCustom1.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeViewCustom1_DrawNode); + this.treeViewCustom1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterSelect); + this.treeViewCustom1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.selectItem); + this.treeViewCustom1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeViewCustom1_DoubleClick); + // // stPanel3 // this.stPanel3.Controls.Add(this.searchLbl); @@ -117,31 +138,12 @@ this.stTextBox1.TextChanged += new System.EventHandler(this.stTextBox1_TextChanged); this.stTextBox1.Leave += new System.EventHandler(this.stTextBox1_Leave); // - // treeViewCustom1 - // - this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.treeViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.treeViewCustom1.CheckBoxes = true; - this.treeViewCustom1.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll; - this.treeViewCustom1.ImageIndex = 0; - this.treeViewCustom1.Location = new System.Drawing.Point(1, 53); - this.treeViewCustom1.Name = "treeViewCustom1"; - this.treeViewCustom1.SelectedImageIndex = 0; - this.treeViewCustom1.Size = new System.Drawing.Size(311, 458); - this.treeViewCustom1.TabIndex = 0; - this.treeViewCustom1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterCheck); - this.treeViewCustom1.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeViewCustom1_DrawNode); - this.treeViewCustom1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterSelect); - this.treeViewCustom1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.selectItem); - this.treeViewCustom1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeViewCustom1_DoubleClick); - // // stContextMenuStrip1 // this.stContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, - this.viewToolStripMenuItem}); + this.viewToolStripMenuItem, + this.importToActiveWindowToolStripMenuItem}); this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0); this.stContextMenuStrip1.Name = "stContextMenuStrip1"; this.stContextMenuStrip1.Size = new System.Drawing.Size(314, 24); @@ -196,6 +198,14 @@ this.splitter1.LocationChanged += new System.EventHandler(this.splitter1_LocationChanged); this.splitter1.Resize += new System.EventHandler(this.splitter1_Resize); // + // importToActiveWindowToolStripMenuItem + // + this.importToActiveWindowToolStripMenuItem.Checked = true; + this.importToActiveWindowToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.importToActiveWindowToolStripMenuItem.Name = "importToActiveWindowToolStripMenuItem"; + this.importToActiveWindowToolStripMenuItem.Size = new System.Drawing.Size(152, 20); + this.importToActiveWindowToolStripMenuItem.Text = "Import to Active Window"; + // // ObjectEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -231,5 +241,6 @@ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem sortToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem importToActiveWindowToolStripMenuItem; } } \ No newline at end of file