diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index ae83e81b..2724d511 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 0b4a7dc2..8e1650a9 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm index f020eb04..d3b77bc9 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index dc6b5d13..62f209cf 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/FileFormats/Archives/SARC.cs b/Switch_FileFormatsMain/FileFormats/Archives/SARC.cs index 8e34e79c..0b861054 100644 --- a/Switch_FileFormatsMain/FileFormats/Archives/SARC.cs +++ b/Switch_FileFormatsMain/FileFormats/Archives/SARC.cs @@ -393,12 +393,21 @@ namespace FirstPlugin private void OpenFormDialog(IFileFormat fileFormat) { - STForm form = GetEditorForm(fileFormat); + UserControl form = GetEditorForm(fileFormat); + form.Text = (((IFileFormat)fileFormat).FileName); + var parentForm = LibraryGUI.Instance.GetActiveForm(); - form.Text = (((IFileFormat)fileFormat).FileName); - form.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat); - form.Show(parentForm); + GenericEditorForm editorForm = new GenericEditorForm(true, form); + editorForm.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat); + if (editorForm.ShowDialog() == DialogResult.OK) + { + if (fileFormat.CanSave) + { + Data = fileFormat.Save(); + UpdateHexView(); + } + } } private void FormClosing(object sender, EventArgs args, IFileFormat fileFormat) @@ -413,7 +422,7 @@ namespace FirstPlugin } } - private STForm GetEditorForm(IFileFormat fileFormat) + private UserControl GetEditorForm(IFileFormat fileFormat) { Type objectType = fileFormat.GetType(); foreach (var inter in objectType.GetInterfaces()) @@ -421,7 +430,7 @@ namespace FirstPlugin if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>)) { System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm"); - return (STForm)method.Invoke(fileFormat, new object[0]); + return (UserControl)method.Invoke(fileFormat, new object[0]); } } return null; diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BCSTM.cs b/Switch_FileFormatsMain/FileFormats/Audio/BCSTM.cs index d22dfe05..fa99cc29 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BCSTM.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BCSTM.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BCSTM : VGAdudioFile, IEditor, IFileFormat + public class BCSTM : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BCWAV.cs b/Switch_FileFormatsMain/FileFormats/Audio/BCWAV.cs index e47bf1fb..3943736c 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BCWAV.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BCWAV.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BCWAV : VGAdudioFile, IEditor, IFileFormat + public class BCWAV : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BFSTM.cs b/Switch_FileFormatsMain/FileFormats/Audio/BFSTM.cs index b1e053db..d6883b3a 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BFSTM.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BFSTM.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BFSTM : VGAdudioFile, IEditor, IFileFormat + public class BFSTM : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,12 +40,12 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { if (audioData == null) throw new Exception("Audio data is null!"); - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BFWAV.cs b/Switch_FileFormatsMain/FileFormats/Audio/BFWAV.cs index 7c95accb..39e7bf55 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BFWAV.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BFWAV.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BFWAV : VGAdudioFile, IEditor, IFileFormat + public class BFWAV : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BRSTM.cs b/Switch_FileFormatsMain/FileFormats/Audio/BRSTM.cs index 099084f5..03cfb090 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BRSTM.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BRSTM.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BRSTM : VGAdudioFile, IEditor, IFileFormat + public class BRSTM : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/BRWAV.cs b/Switch_FileFormatsMain/FileFormats/Audio/BRWAV.cs index e2291baf..b93879bb 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/BRWAV.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/BRWAV.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class BRWAV : VGAdudioFile, IEditor, IFileFormat + public class BRWAV : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/HPS.cs b/Switch_FileFormatsMain/FileFormats/Audio/HPS.cs index 7a158796..3980bfd3 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/HPS.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/HPS.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class HPS : VGAdudioFile, IEditor, IFileFormat + public class HPS : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/IDSP.cs b/Switch_FileFormatsMain/FileFormats/Audio/IDSP.cs index bf0971a4..ce0bd103 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/IDSP.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/IDSP.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class IDSP : VGAdudioFile, IEditor, IFileFormat + public class IDSP : VGAdudioFile, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -40,9 +40,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/MP3.cs b/Switch_FileFormatsMain/FileFormats/Audio/MP3.cs index 09c68e92..b02056ab 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/MP3.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/MP3.cs @@ -14,7 +14,7 @@ using CSCore.Codecs; namespace FirstPlugin { - public class MP3 : IEditor, IFileFormat + public class MP3 : IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -48,9 +48,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(waveSource, this, false, mp3Struct); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/Ogg.cs b/Switch_FileFormatsMain/FileFormats/Audio/Ogg.cs index 17201d08..41820eb8 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/Ogg.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/Ogg.cs @@ -14,7 +14,7 @@ using CSCore.Codecs; namespace FirstPlugin { - public class OGG : IEditor, IFileFormat + public class OGG : IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -48,9 +48,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(waveSource, this); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/WAV.cs b/Switch_FileFormatsMain/FileFormats/Audio/WAV.cs index e220a0fa..5ec24563 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/WAV.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/WAV.cs @@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare; namespace FirstPlugin { - public class WAV : IEditor, IFileFormat + public class WAV : IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Audio; @@ -46,9 +46,9 @@ namespace FirstPlugin } } - public AudioPlayer OpenForm() + public AudioPlayerPanel OpenForm() { - AudioPlayer form = new AudioPlayer(); + AudioPlayerPanel form = new AudioPlayerPanel(); form.Text = FileName; form.Dock = DockStyle.Fill; form.LoadFile(audioData, this); diff --git a/Switch_FileFormatsMain/FileFormats/Texture/BCLIM.cs b/Switch_FileFormatsMain/FileFormats/Texture/BCLIM.cs index 80e874bd..53331bf2 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/BCLIM.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/BCLIM.cs @@ -12,7 +12,7 @@ using Bfres.Structs; namespace FirstPlugin { - public class BCLIM : STGenericTexture, IEditor, IFileFormat + public class BCLIM : STGenericTexture, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Image; @@ -92,8 +92,8 @@ namespace FirstPlugin } } - ImageEditorForm form; - public ImageEditorForm OpenForm() + ImageEditorBase form; + public ImageEditorBase OpenForm() { bool IsDialog = IFileInfo != null && IFileInfo.InArchive; @@ -106,13 +106,13 @@ namespace FirstPlugin prop.ImageSize = (uint)ImageData.Length; prop.Format = Format; - form = new ImageEditorForm(IsDialog); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; - form.editorBase.AddFileContextEvent("Save", Save); - form.editorBase.AddFileContextEvent("Replace", Replace); - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); + form = new ImageEditorBase(); + form.Text = Text; + form.Dock = DockStyle.Fill; + form.AddFileContextEvent("Save", Save); + form.AddFileContextEvent("Replace", Replace); + form.LoadProperties(prop); + form.LoadImage(this); return form; } @@ -130,8 +130,8 @@ namespace FirstPlugin prop.ImageSize = (uint)ImageData.Length; prop.Format = Format; - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); + form.LoadProperties(prop); + form.LoadImage(this); } } diff --git a/Switch_FileFormatsMain/FileFormats/Texture/BFLIM.cs b/Switch_FileFormatsMain/FileFormats/Texture/BFLIM.cs index 9cd6f5a2..579eb74d 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/BFLIM.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/BFLIM.cs @@ -12,7 +12,7 @@ using Bfres.Structs; namespace FirstPlugin { - public class BFLIM : STGenericTexture, IEditor, IFileFormat + public class BFLIM : STGenericTexture, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Image; @@ -99,8 +99,8 @@ namespace FirstPlugin } } - ImageEditorForm form; - public ImageEditorForm OpenForm() + ImageEditorBase form; + public ImageEditorBase OpenForm() { bool IsDialog = IFileInfo != null && IFileInfo.InArchive; @@ -115,13 +115,13 @@ namespace FirstPlugin prop.TileMode = image.TileMode; prop.Swizzle = image.Swizzle; - form = new ImageEditorForm(IsDialog); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; - form.editorBase.AddFileContextEvent("Save", Save); - form.editorBase.AddFileContextEvent("Replace", Replace); - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); + form = new ImageEditorBase(); + form.Text = Text; + form.Dock = DockStyle.Fill; + form.AddFileContextEvent("Save", Save); + form.AddFileContextEvent("Replace", Replace); + form.LoadProperties(prop); + form.LoadImage(this); return form; } @@ -141,8 +141,8 @@ namespace FirstPlugin prop.TileMode = image.TileMode; prop.Swizzle = image.Swizzle; - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); + form.LoadProperties(prop); + form.LoadImage(this); } } @@ -192,7 +192,8 @@ namespace FirstPlugin bflim.Height = bflim.image.Height; bflim.ImageData = ftex.texture.Data; - LibraryGUI.Instance.CreateMdiWindow(bflim.OpenForm()); + var form = new GenericEditorForm(false, bflim.OpenForm()); + LibraryGUI.Instance.CreateMdiWindow(form); bflim.UpdateForm(); } diff --git a/Switch_FileFormatsMain/FileFormats/Texture/TEX3DS.cs b/Switch_FileFormatsMain/FileFormats/Texture/TEX3DS.cs index 485a63ab..0976bc0c 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/TEX3DS.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/TEX3DS.cs @@ -11,7 +11,7 @@ using Switch_Toolbox.Library.IO; namespace FirstPlugin { - public class TEX3DS : STGenericTexture, IEditor, IFileFormat + public class TEX3DS : STGenericTexture, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Image; @@ -62,7 +62,7 @@ namespace FirstPlugin public byte[] ImageData; - public ImageEditorForm OpenForm() + public ImageEditorBase OpenForm() { bool IsDialog = IFileInfo != null && IFileInfo.InArchive; @@ -75,13 +75,13 @@ namespace FirstPlugin prop.ImageSize = (uint)ImageData.Length; prop.Format = Format; - ImageEditorForm form = new ImageEditorForm(IsDialog); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; + ImageEditorBase form = new ImageEditorBase(); + form.Text = Text; + form.Dock = DockStyle.Fill; // form.editorBase.AddFileContextEvent("Save", Save); // form.editorBase.AddFileContextEvent("Replace", Replace); - form.editorBase.LoadProperties(prop); - form.editorBase.LoadImage(this); + form.LoadProperties(prop); + form.LoadImage(this); return form; } diff --git a/Switch_FileFormatsMain/GUI/AAMP/AampEditor.Designer.cs b/Switch_FileFormatsMain/GUI/AAMP/AampEditor.Designer.cs index cb9fecc5..be28c346 100644 --- a/Switch_FileFormatsMain/GUI/AAMP/AampEditor.Designer.cs +++ b/Switch_FileFormatsMain/GUI/AAMP/AampEditor.Designer.cs @@ -37,8 +37,6 @@ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.stButton1 = new Switch_Toolbox.Library.Forms.STButton(); - this.stButton2 = new Switch_Toolbox.Library.Forms.STButton(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.addItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -46,7 +44,6 @@ this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STContextMenuStrip(this.components); - this.contentContainer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -55,23 +52,13 @@ this.stContextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // - // contentContainer - // - this.contentContainer.Controls.Add(this.stPanel1); - this.contentContainer.Controls.Add(this.stButton2); - this.contentContainer.Controls.Add(this.stButton1); - this.contentContainer.Paint += new System.Windows.Forms.PaintEventHandler(this.contentContainer_Paint); - this.contentContainer.Controls.SetChildIndex(this.stButton1, 0); - this.contentContainer.Controls.SetChildIndex(this.stButton2, 0); - this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0); - // // treeView1 // this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; this.treeView1.Location = new System.Drawing.Point(0, 0); this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(179, 334); + this.treeView1.Size = new System.Drawing.Size(183, 398); this.treeView1.TabIndex = 0; this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); // @@ -104,7 +91,7 @@ this.listViewCustom1.Location = new System.Drawing.Point(0, 0); this.listViewCustom1.Name = "listViewCustom1"; this.listViewCustom1.OwnerDraw = true; - this.listViewCustom1.Size = new System.Drawing.Size(354, 334); + this.listViewCustom1.Size = new System.Drawing.Size(362, 398); this.listViewCustom1.TabIndex = 0; this.listViewCustom1.UseCompatibleStateImageBehavior = false; this.listViewCustom1.View = System.Windows.Forms.View.Details; @@ -123,33 +110,7 @@ // columnHeader3 // this.columnHeader3.Text = "Data"; - this.columnHeader3.Width = 136; - // - // stButton1 - // - this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.stButton1.Location = new System.Drawing.Point(462, 367); - this.stButton1.Name = "stButton1"; - this.stButton1.Size = new System.Drawing.Size(75, 23); - this.stButton1.TabIndex = 12; - this.stButton1.Text = "Cancel"; - this.stButton1.UseVisualStyleBackColor = false; - this.stButton1.Click += new System.EventHandler(this.stButton1_Click); - // - // stButton2 - // - this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.stButton2.DialogResult = System.Windows.Forms.DialogResult.OK; - this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.stButton2.Location = new System.Drawing.Point(366, 367); - this.stButton2.Name = "stButton2"; - this.stButton2.Size = new System.Drawing.Size(75, 23); - this.stButton2.TabIndex = 13; - this.stButton2.Text = "Save"; - this.stButton2.UseVisualStyleBackColor = false; - this.stButton2.Click += new System.EventHandler(this.stButton2_Click); + this.columnHeader3.Width = 155; // // splitContainer1 // @@ -164,19 +125,17 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.listViewCustom1); - this.splitContainer1.Size = new System.Drawing.Size(537, 334); - this.splitContainer1.SplitterDistance = 179; + this.splitContainer1.Size = new System.Drawing.Size(549, 398); + this.splitContainer1.SplitterDistance = 183; this.splitContainer1.TabIndex = 14; // // stPanel1 // - this.stPanel1.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.stPanel1.Controls.Add(this.splitContainer1); - this.stPanel1.Location = new System.Drawing.Point(3, 27); + this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stPanel1.Location = new System.Drawing.Point(0, 0); this.stPanel1.Name = "stPanel1"; - this.stPanel1.Size = new System.Drawing.Size(537, 334); + this.stPanel1.Size = new System.Drawing.Size(549, 398); this.stPanel1.TabIndex = 15; // // addItemToolStripMenuItem @@ -222,11 +181,9 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(549, 398); + this.Controls.Add(this.stPanel1); this.Name = "AampEditorBase"; - this.Text = "AampEditor"; - this.Controls.SetChildIndex(this.contentContainer, 0); - this.contentContainer.ResumeLayout(false); + this.Size = new System.Drawing.Size(549, 398); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); @@ -244,8 +201,6 @@ private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private Switch_Toolbox.Library.Forms.STButton stButton2; - private Switch_Toolbox.Library.Forms.STButton stButton1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.ColumnHeader columnHeader3; diff --git a/Switch_FileFormatsMain/GUI/AAMP/AampEditor.cs b/Switch_FileFormatsMain/GUI/AAMP/AampEditor.cs index 64a16a2b..5b87492a 100644 --- a/Switch_FileFormatsMain/GUI/AAMP/AampEditor.cs +++ b/Switch_FileFormatsMain/GUI/AAMP/AampEditor.cs @@ -17,7 +17,7 @@ using ByamlExt; namespace FirstPlugin.Forms { - public partial class AampEditorBase : STForm, IFIleEditor + public partial class AampEditorBase : STUserControl, IFIleEditor { public AAMP AampFile; @@ -44,13 +44,6 @@ namespace FirstPlugin.Forms Text = $"{AampFile.FileName} Type [{AampFile.aampFileV2.EffectType}]"; } - if (!IsSaveDialog) - { - stButton1.Visible = false; - stButton2.Visible = false; - stPanel1.Dock = DockStyle.Fill; - } - STContextMenuStrip contextMenuStrip1 = new STContextMenuStrip(); contextMenuStrip1.Items.Add(new ToolStripMenuItem("Save", null, saveAsToolStripMenuItem_Click, Keys.Control | Keys.I)); contextMenuStrip1.Items.Add(new ToolStripSeparator()); @@ -205,17 +198,5 @@ namespace FirstPlugin.Forms { } - - private void stButton2_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - Close(); - } - - private void stButton1_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - Close(); - } } } diff --git a/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.Designer.cs b/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.Designer.cs index dee25bb0..5f2a72c6 100644 --- a/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.Designer.cs +++ b/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.Designer.cs @@ -45,8 +45,6 @@ this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.stButton1 = new Switch_Toolbox.Library.Forms.STButton(); - this.stButton2 = new Switch_Toolbox.Library.Forms.STButton(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STContextMenuStrip(this.components); @@ -54,7 +52,6 @@ this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contentContainer.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -63,16 +60,7 @@ this.stPanel1.SuspendLayout(); this.stContextMenuStrip1.SuspendLayout(); this.SuspendLayout(); - // - // contentContainer - // - this.contentContainer.Controls.Add(this.stPanel1); - this.contentContainer.Controls.Add(this.stButton2); - this.contentContainer.Controls.Add(this.stButton1); - this.contentContainer.Paint += new System.Windows.Forms.PaintEventHandler(this.contentContainer_Paint); - this.contentContainer.Controls.SetChildIndex(this.stButton1, 0); - this.contentContainer.Controls.SetChildIndex(this.stButton2, 0); - this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0); + this.Controls.Add(this.stPanel1); // // treeView1 // @@ -81,7 +69,7 @@ this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; this.treeView1.Location = new System.Drawing.Point(0, 0); this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(179, 334); + this.treeView1.Size = new System.Drawing.Size(181, 368); this.treeView1.TabIndex = 0; this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.BeforeExpand); this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); @@ -182,7 +170,7 @@ this.listViewCustom1.Location = new System.Drawing.Point(0, 0); this.listViewCustom1.Name = "listViewCustom1"; this.listViewCustom1.OwnerDraw = true; - this.listViewCustom1.Size = new System.Drawing.Size(354, 334); + this.listViewCustom1.Size = new System.Drawing.Size(358, 368); this.listViewCustom1.TabIndex = 0; this.listViewCustom1.UseCompatibleStateImageBehavior = false; this.listViewCustom1.View = System.Windows.Forms.View.Details; @@ -201,33 +189,7 @@ // columnHeader3 // this.columnHeader3.Text = "Data"; - this.columnHeader3.Width = 136; - // - // stButton1 - // - this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.stButton1.Location = new System.Drawing.Point(462, 367); - this.stButton1.Name = "stButton1"; - this.stButton1.Size = new System.Drawing.Size(75, 23); - this.stButton1.TabIndex = 12; - this.stButton1.Text = "Cancel"; - this.stButton1.UseVisualStyleBackColor = false; - this.stButton1.Click += new System.EventHandler(this.stButton1_Click); - // - // stButton2 - // - this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.stButton2.DialogResult = System.Windows.Forms.DialogResult.OK; - this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.stButton2.Location = new System.Drawing.Point(366, 367); - this.stButton2.Name = "stButton2"; - this.stButton2.Size = new System.Drawing.Size(75, 23); - this.stButton2.TabIndex = 13; - this.stButton2.Text = "Save"; - this.stButton2.UseVisualStyleBackColor = false; - this.stButton2.Click += new System.EventHandler(this.stButton2_Click); + this.columnHeader3.Width = 151; // // splitContainer1 // @@ -242,19 +204,17 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.listViewCustom1); - this.splitContainer1.Size = new System.Drawing.Size(537, 334); - this.splitContainer1.SplitterDistance = 179; + this.splitContainer1.Size = new System.Drawing.Size(543, 368); + this.splitContainer1.SplitterDistance = 181; this.splitContainer1.TabIndex = 14; // // stPanel1 // - this.stPanel1.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.stPanel1.Controls.Add(this.splitContainer1); - this.stPanel1.Location = new System.Drawing.Point(3, 27); + this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stPanel1.Location = new System.Drawing.Point(0, 25); this.stPanel1.Name = "stPanel1"; - this.stPanel1.Size = new System.Drawing.Size(537, 334); + this.stPanel1.Size = new System.Drawing.Size(543, 368); this.stPanel1.TabIndex = 15; // // stContextMenuStrip1 @@ -303,8 +263,6 @@ this.Name = "ByamlEditor"; this.Text = "ByamlEditor"; this.Load += new System.EventHandler(this.ByamlViewer_Load); - this.Controls.SetChildIndex(this.contentContainer, 0); - this.contentContainer.ResumeLayout(false); this.contextMenuStrip1.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); @@ -330,8 +288,6 @@ private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem importFromXmlToolStripMenuItem; - private Switch_Toolbox.Library.Forms.STButton stButton2; - private Switch_Toolbox.Library.Forms.STButton stButton1; private Switch_Toolbox.Library.Forms.ListViewCustom listViewCustom1; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; diff --git a/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.cs b/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.cs index 77d03780..77e162b2 100644 --- a/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.cs +++ b/Switch_FileFormatsMain/GUI/Byaml/ByamlEditor.cs @@ -20,7 +20,7 @@ namespace FirstPlugin { //Editor from https://github.com/exelix11/EditorCore/blob/872d210f85ec0409f8a6ac3a12fc162aaf4cd90c/FileFormatPlugins/ByamlLib/Byaml/ByamlViewer.cs //Added as an editor form for saving data back via other plugins - public partial class ByamlEditor : STForm, IFIleEditor + public partial class ByamlEditor : UserControl, IFIleEditor { public IFileFormat FileFormat; @@ -44,13 +44,6 @@ namespace FirstPlugin treeView1.BackColor = FormThemes.BaseTheme.FormBackColor; treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor; - if (!IsSaveDialog) - { - stButton1.Visible = false; - stButton2.Visible = false; - stPanel1.Dock = DockStyle.Fill; - } - if (byaml.FileName == "course_muunt_debug.byaml" && useMuunt) { pathSupport = true; @@ -111,8 +104,6 @@ namespace FirstPlugin if (!IsSaveDialog) { - stButton1.Visible = false; - stButton2.Visible = false; stPanel1.Dock = DockStyle.Fill; } @@ -620,17 +611,5 @@ namespace FirstPlugin stContextMenuStrip1.Show(pt); } } - - private void stButton2_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - Close(); - } - - private void stButton1_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - Close(); - } } } \ No newline at end of file diff --git a/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.Designer.cs b/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.Designer.cs index b3c5b395..833c310f 100644 --- a/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.Designer.cs +++ b/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.Designer.cs @@ -32,16 +32,11 @@ this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.stMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip(); this.addPTCLReferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contentContainer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.stDataGridView1)).BeginInit(); this.stPanel1.SuspendLayout(); this.stMenuStrip1.SuspendLayout(); this.SuspendLayout(); - // - // contentContainer - // - this.contentContainer.Controls.Add(this.stPanel1); - this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0); + this.Controls.Add(this.stPanel1); // // stDataGridView1 // @@ -89,10 +84,8 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(549, 398); - this.MainMenuStrip = this.stMenuStrip1; this.Name = "EffectTableEditor"; this.Text = "EffectTableEditor"; - this.contentContainer.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.stDataGridView1)).EndInit(); this.stPanel1.ResumeLayout(false); this.stPanel1.PerformLayout(); diff --git a/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.cs b/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.cs index 224f902e..423b309b 100644 --- a/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.cs +++ b/Switch_FileFormatsMain/GUI/Editors/EffectTableEditor.cs @@ -12,7 +12,7 @@ using Switch_Toolbox.Library; namespace FirstPlugin.Forms { - public partial class EffectTableEditor : STForm, IFIleEditor + public partial class EffectTableEditor : UserControl, IFIleEditor { public List GetFileFormats() { diff --git a/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.Designer.cs b/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.Designer.cs index 894ca0fe..7d8c5b39 100644 --- a/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.Designer.cs +++ b/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.Designer.cs @@ -32,20 +32,11 @@ this.leBtnRadio = new System.Windows.Forms.RadioButton(); this.beBtnRadio = new System.Windows.Forms.RadioButton(); this.glControl2D1 = new Switch_Toolbox.Library.Forms.GLControl2D(); - this.contentContainer.SuspendLayout(); this.SuspendLayout(); - // - // contentContainer - // - this.contentContainer.Controls.Add(this.glControl2D1); - this.contentContainer.Controls.Add(this.beBtnRadio); - this.contentContainer.Controls.Add(this.leBtnRadio); - this.contentContainer.Controls.Add(this.stPropertyGrid1); - this.contentContainer.Size = new System.Drawing.Size(570, 397); - this.contentContainer.Controls.SetChildIndex(this.stPropertyGrid1, 0); - this.contentContainer.Controls.SetChildIndex(this.leBtnRadio, 0); - this.contentContainer.Controls.SetChildIndex(this.beBtnRadio, 0); - this.contentContainer.Controls.SetChildIndex(this.glControl2D1, 0); + this.Controls.Add(this.glControl2D1); + this.Controls.Add(this.beBtnRadio); + this.Controls.Add(this.leBtnRadio); + this.Controls.Add(this.stPropertyGrid1); // // stPropertyGrid1 // @@ -98,8 +89,6 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(576, 402); this.Name = "MK8MapCameraEditor"; - this.contentContainer.ResumeLayout(false); - this.contentContainer.PerformLayout(); this.ResumeLayout(false); } diff --git a/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.cs b/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.cs index 53aba1f2..e6983ed6 100644 --- a/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.cs +++ b/Switch_FileFormatsMain/GUI/Editors/MK8TrackEditor/MK8MapCameraEditor.cs @@ -14,7 +14,7 @@ using ByamlExt; namespace FirstPlugin.Turbo { - public partial class MK8MapCameraEditor : STForm, IFIleEditor + public partial class MK8MapCameraEditor : UserControl, IFIleEditor { public List GetFileFormats() { diff --git a/Switch_FileFormatsMain/GUI/Message/MSBTEditor.Designer.cs b/Switch_FileFormatsMain/GUI/Message/MSBTEditor.Designer.cs index 77f224ec..abb690e6 100644 --- a/Switch_FileFormatsMain/GUI/Message/MSBTEditor.Designer.cs +++ b/Switch_FileFormatsMain/GUI/Message/MSBTEditor.Designer.cs @@ -39,7 +39,6 @@ this.hexEditor1 = new Switch_Toolbox.Library.Forms.HexEditor(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer3 = new System.Windows.Forms.SplitContainer(); - this.contentContainer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -53,12 +52,7 @@ this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.SuspendLayout(); this.SuspendLayout(); - // - // contentContainer - // - this.contentContainer.Controls.Add(this.splitContainer1); - this.contentContainer.Size = new System.Drawing.Size(916, 520); - this.contentContainer.Controls.SetChildIndex(this.splitContainer1, 0); + this.Controls.Add(this.splitContainer1); // // splitContainer1 // @@ -203,7 +197,6 @@ this.ClientSize = new System.Drawing.Size(922, 525); this.Name = "MSBTEditor"; this.Text = "MSBTEditor"; - this.contentContainer.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); diff --git a/Switch_FileFormatsMain/GUI/Message/MSBTEditor.cs b/Switch_FileFormatsMain/GUI/Message/MSBTEditor.cs index 8bd06a8b..3fa26577 100644 --- a/Switch_FileFormatsMain/GUI/Message/MSBTEditor.cs +++ b/Switch_FileFormatsMain/GUI/Message/MSBTEditor.cs @@ -12,7 +12,7 @@ using Switch_Toolbox.Library; namespace FirstPlugin.Forms { - public partial class MSBTEditor : STForm, IFIleEditor + public partial class MSBTEditor : UserControl, IFIleEditor { public bool ShowPreviewText = true; diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 988c06b2..cd653cbd 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/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 95ad5fbc..4f8fd766 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/FileFormats/ASTC.cs b/Switch_Toolbox_Library/FileFormats/ASTC.cs index 5ac7a6cd..7f17beb0 100644 --- a/Switch_Toolbox_Library/FileFormats/ASTC.cs +++ b/Switch_Toolbox_Library/FileFormats/ASTC.cs @@ -9,7 +9,7 @@ using System.Drawing; namespace Switch_Toolbox.Library { - public class ASTC : STGenericTexture, IEditor, IFileFormat + public class ASTC : STGenericTexture, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Image; @@ -78,15 +78,15 @@ namespace Switch_Toolbox.Library } } - public ImageEditorForm OpenForm() + public ImageEditorBase OpenForm() { bool IsDialog = IFileInfo != null && IFileInfo.InArchive; - ImageEditorForm form = new ImageEditorForm(IsDialog); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; - form.editorBase.LoadImage(this); - form.editorBase.LoadProperties(GenericProperties); + ImageEditorBase form = new ImageEditorBase(); + form.Text = Text; + form.Dock = DockStyle.Fill; + form.LoadImage(this); + form.LoadProperties(GenericProperties); return form; } diff --git a/Switch_Toolbox_Library/FileFormats/DDS.cs b/Switch_Toolbox_Library/FileFormats/DDS.cs index a7007a43..dc9ea9be 100644 --- a/Switch_Toolbox_Library/FileFormats/DDS.cs +++ b/Switch_Toolbox_Library/FileFormats/DDS.cs @@ -18,7 +18,7 @@ using OpenTK.Graphics.OpenGL; namespace Switch_Toolbox.Library { //Data from https://github.com/jam1garner/Smash-Forge/blob/master/Smash%20Forge/Filetypes/Textures/DDS.cs - public class DDS : STGenericTexture, IEditor, IFileFormat + public class DDS : STGenericTexture, IEditor, IFileFormat { public FileType FileType { get; set; } = FileType.Image; @@ -420,15 +420,15 @@ namespace Switch_Toolbox.Library DXGI_FORMAT_FORCE_UINT = 0xFFFFFFFF } - public ImageEditorForm OpenForm() + public ImageEditorBase OpenForm() { bool IsDialog = IFileInfo != null && IFileInfo.InArchive; - ImageEditorForm form = new ImageEditorForm(IsDialog); - form.editorBase.Text = Text; - form.editorBase.Dock = DockStyle.Fill; - form.editorBase.LoadImage(this); - form.editorBase.LoadProperties(GenericProperties); + ImageEditorBase form = new ImageEditorBase(); + form.Text = Text; + form.Dock = DockStyle.Fill; + form.LoadImage(this); + form.LoadProperties(GenericProperties); return form; } diff --git a/Switch_Toolbox_Library/Forms/GenericEditorForm.Designer.cs b/Switch_Toolbox_Library/Forms/GenericEditorForm.Designer.cs new file mode 100644 index 00000000..4a048d63 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/GenericEditorForm.Designer.cs @@ -0,0 +1,98 @@ +namespace Switch_Toolbox.Library.Forms +{ + partial class GenericEditorForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); + this.stButton1 = new Switch_Toolbox.Library.Forms.STButton(); + this.stButton2 = new Switch_Toolbox.Library.Forms.STButton(); + this.contentContainer.SuspendLayout(); + this.SuspendLayout(); + // + // contentContainer + // + this.contentContainer.Controls.Add(this.stButton2); + this.contentContainer.Controls.Add(this.stButton1); + this.contentContainer.Controls.Add(this.stPanel1); + this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0); + this.contentContainer.Controls.SetChildIndex(this.stButton1, 0); + this.contentContainer.Controls.SetChildIndex(this.stButton2, 0); + // + // stPanel1 + // + this.stPanel1.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.stPanel1.Location = new System.Drawing.Point(3, 31); + this.stPanel1.Name = "stPanel1"; + this.stPanel1.Size = new System.Drawing.Size(540, 326); + this.stPanel1.TabIndex = 11; + // + // stButton1 + // + this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.stButton1.Location = new System.Drawing.Point(459, 363); + this.stButton1.Name = "stButton1"; + this.stButton1.Size = new System.Drawing.Size(75, 23); + this.stButton1.TabIndex = 12; + this.stButton1.Text = "Cancel"; + this.stButton1.UseVisualStyleBackColor = false; + // + // stButton2 + // + this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.stButton2.DialogResult = System.Windows.Forms.DialogResult.OK; + this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.stButton2.Location = new System.Drawing.Point(378, 363); + this.stButton2.Name = "stButton2"; + this.stButton2.Size = new System.Drawing.Size(75, 23); + this.stButton2.TabIndex = 13; + this.stButton2.Text = "Save"; + this.stButton2.UseVisualStyleBackColor = false; + // + // GenericEditorForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(549, 398); + this.Name = "GenericEditorForm"; + this.Text = "GenericEditorForm"; + this.contentContainer.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private STPanel stPanel1; + private STButton stButton1; + private STButton stButton2; + } +} \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/GenericEditorForm.cs b/Switch_Toolbox_Library/Forms/GenericEditorForm.cs new file mode 100644 index 00000000..3c0ec244 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/GenericEditorForm.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Switch_Toolbox.Library.Forms +{ + public partial class GenericEditorForm : STForm + { + public GenericEditorForm(bool UseSaveDialog, UserControl control) + { + control.Dock = DockStyle.Fill; + InitializeComponent(); + stPanel1.Controls.Add(control); + SetSaveDialog(UseSaveDialog); + } + + public Control GetControl() + { + return stPanel1.Controls[0]; + } + + public void SetSaveDialog(bool UseSaveDialog) + { + if (!UseSaveDialog) + { + stButton1.Visible = false; + stButton2.Visible = false; + stPanel1.Dock = DockStyle.Fill; + } + } + } +} diff --git a/Switch_Toolbox_Library/Forms/GenericEditorForm.resx b/Switch_Toolbox_Library/Forms/GenericEditorForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/Switch_Toolbox_Library/Forms/GenericEditorForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs index 8f5fca6a..fece5481 100644 --- a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs +++ b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs @@ -507,27 +507,30 @@ namespace Switch_Toolbox.Library private void OpenFormDialog(IFileFormat fileFormat) { - STForm form = GetEditorForm(fileFormat); + UserControl form = GetEditorForm(fileFormat); + form.Text = (((IFileFormat)fileFormat).FileName); + var parentForm = LibraryGUI.Instance.GetActiveForm(); - form.Text = (((IFileFormat)fileFormat).FileName); - form.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat); - form.Show(parentForm); + GenericEditorForm editorForm = new GenericEditorForm(true, form); + editorForm.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat); + if (editorForm.ShowDialog() == DialogResult.OK) + { + if (fileFormat.CanSave) + { + ArchiveFileInfo.FileData = fileFormat.Save(); + UpdateEditor(); + } + } } private void FormClosing(object sender, EventArgs args, IFileFormat fileFormat) { if (((Form)sender).DialogResult != DialogResult.OK) return; - - if (fileFormat.CanSave) - { - ArchiveFileInfo.FileData = fileFormat.Save(); - UpdateEditor(); - } } - private STForm GetEditorForm(IFileFormat fileFormat) + private UserControl GetEditorForm(IFileFormat fileFormat) { Type objectType = fileFormat.GetType(); foreach (var inter in objectType.GetInterfaces()) @@ -535,7 +538,7 @@ namespace Switch_Toolbox.Library if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>)) { System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm"); - return (STForm)method.Invoke(fileFormat, new object[0]); + return (UserControl)method.Invoke(fileFormat, new object[0]); } } return null; diff --git a/Switch_Toolbox_Library/Interfaces/IEditor.cs b/Switch_Toolbox_Library/Interfaces/IEditor.cs index 71df75e1..1b158523 100644 --- a/Switch_Toolbox_Library/Interfaces/IEditor.cs +++ b/Switch_Toolbox_Library/Interfaces/IEditor.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; namespace Switch_Toolbox.Library { - public interface IEditor where T : STForm + public interface IEditor where T : UserControl { T OpenForm(); } diff --git a/Switch_Toolbox_Library/Plugin/FileManager.cs b/Switch_Toolbox_Library/Plugin/FileManager.cs index 96053ddf..1ffc300a 100644 --- a/Switch_Toolbox_Library/Plugin/FileManager.cs +++ b/Switch_Toolbox_Library/Plugin/FileManager.cs @@ -50,9 +50,9 @@ namespace Switch_Toolbox.Library return null; } - public static IEditor[] GetEditors() + public static IEditor[] GetEditors() { - var editors = new List>(); + var editors = new List>(); foreach (var plugin in GenericPluginLoader._Plugins) { foreach (Type type in plugin.Value.Types) @@ -60,9 +60,9 @@ namespace Switch_Toolbox.Library Type[] interfaces_array = type.GetInterfaces(); for (int i = 0; i < interfaces_array.Length; i++) { - if (interfaces_array[i] == typeof(IEditor)) + if (interfaces_array[i] == typeof(IEditor)) { - editors.Add((IEditor)Activator.CreateInstance(type)); + editors.Add((IEditor)Activator.CreateInstance(type)); } } } diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj index 7f0203ad..db549dac 100644 --- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj @@ -504,6 +504,12 @@ UVEditor.cs + + Form + + + GenericEditorForm.cs + Form @@ -846,6 +852,9 @@ UVEditor2.cs + + GenericEditorForm.cs + GLControl2D.cs diff --git a/Toolbox/MainForm.cs b/Toolbox/MainForm.cs index 6ee0e939..4678ca85 100644 --- a/Toolbox/MainForm.cs +++ b/Toolbox/MainForm.cs @@ -251,7 +251,8 @@ namespace Toolbox if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>)) { MethodInfo method = objectType.GetMethod("OpenForm"); - var form = (STForm)method.Invoke(file, new object[0]); + var control = (UserControl)method.Invoke(file, new object[0]); + var form = new GenericEditorForm(false, control); TabDupeIndex = 0; form.Text = CheckTabDupes(((IFileFormat)file).FileName); form.MdiParent = this; @@ -669,7 +670,24 @@ namespace Toolbox { return ((ObjectEditor)ActiveMdiChild).GetActiveFile(); } - if (ActiveMdiChild is IFIleEditor) + else if (ActiveMdiChild is GenericEditorForm) + { + var control = ((GenericEditorForm)ActiveMdiChild).GetControl(); + if (control != null && control is IFIleEditor) + { + if (((IFIleEditor)control).GetFileFormats().Count > 0) + return ((IFIleEditor)control).GetFileFormats()[0]; + } + if (control != null && control is ImageEditorBase) + { + return (IFileFormat)((ImageEditorBase)control).ActiveTexture; + } + if (control != null && control is AudioPlayerPanel) + { + return ((AudioPlayerPanel)control).AudioFileFormats[0]; + } + } + else if (ActiveMdiChild is IFIleEditor) { if (((IFIleEditor)ActiveMdiChild).GetFileFormats().Count > 0) return ((IFIleEditor)ActiveMdiChild).GetFileFormats()[0];