mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 04:23:09 +00:00
Rework form editors a bit for later loading docked for archives
This commit is contained in:
parent
0c11a29e03
commit
add182f902
41 changed files with 430 additions and 288 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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;
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BCSTM : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BCSTM : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BCWAV : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BCWAV : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BFSTM : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BFSTM : VGAdudioFile, IEditor<AudioPlayerPanel>, 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;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BFWAV : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BFWAV : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BRSTM : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BRSTM : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BRWAV : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class BRWAV : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class HPS : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class HPS : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class IDSP : VGAdudioFile, IEditor<AudioPlayer>, IFileFormat
|
||||
public class IDSP : VGAdudioFile, IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -14,7 +14,7 @@ using CSCore.Codecs;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class MP3 : IEditor<AudioPlayer>, IFileFormat
|
||||
public class MP3 : IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -14,7 +14,7 @@ using CSCore.Codecs;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class OGG : IEditor<AudioPlayer>, IFileFormat
|
||||
public class OGG : IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using VGAudio.Containers.NintendoWare;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class WAV : IEditor<AudioPlayer>, IFileFormat
|
||||
public class WAV : IEditor<AudioPlayerPanel>, 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);
|
||||
|
|
|
@ -12,7 +12,7 @@ using Bfres.Structs;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BCLIM : STGenericTexture, IEditor<ImageEditorForm>, IFileFormat
|
||||
public class BCLIM : STGenericTexture, IEditor<ImageEditorBase>, 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using Bfres.Structs;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BFLIM : STGenericTexture, IEditor<ImageEditorForm>, IFileFormat
|
||||
public class BFLIM : STGenericTexture, IEditor<ImageEditorBase>, 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();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ using Switch_Toolbox.Library.IO;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class TEX3DS : STGenericTexture, IEditor<ImageEditorForm>, IFileFormat
|
||||
public class TEX3DS : STGenericTexture, IEditor<ImageEditorBase>, 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
|
@ -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<IFileFormat> GetFileFormats()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ using ByamlExt;
|
|||
|
||||
namespace FirstPlugin.Turbo
|
||||
{
|
||||
public partial class MK8MapCameraEditor : STForm, IFIleEditor
|
||||
public partial class MK8MapCameraEditor : UserControl, IFIleEditor
|
||||
{
|
||||
public List<IFileFormat> GetFileFormats()
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -9,7 +9,7 @@ using System.Drawing;
|
|||
|
||||
namespace Switch_Toolbox.Library
|
||||
{
|
||||
public class ASTC : STGenericTexture, IEditor<ImageEditorForm>, IFileFormat
|
||||
public class ASTC : STGenericTexture, IEditor<ImageEditorBase>, 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<ImageEditorForm>, IFileFormat
|
||||
public class DDS : STGenericTexture, IEditor<ImageEditorBase>, 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;
|
||||
}
|
||||
|
||||
|
|
98
Switch_Toolbox_Library/Forms/GenericEditorForm.Designer.cs
generated
Normal file
98
Switch_Toolbox_Library/Forms/GenericEditorForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,98 @@
|
|||
namespace Switch_Toolbox.Library.Forms
|
||||
{
|
||||
partial class GenericEditorForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
38
Switch_Toolbox_Library/Forms/GenericEditorForm.cs
Normal file
38
Switch_Toolbox_Library/Forms/GenericEditorForm.cs
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Switch_Toolbox_Library/Forms/GenericEditorForm.resx
Normal file
120
Switch_Toolbox_Library/Forms/GenericEditorForm.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -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;
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace Switch_Toolbox.Library
|
||||
{
|
||||
public interface IEditor<T> where T : STForm
|
||||
public interface IEditor<T> where T : UserControl
|
||||
{
|
||||
T OpenForm();
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ namespace Switch_Toolbox.Library
|
|||
return null;
|
||||
}
|
||||
|
||||
public static IEditor<Forms.STForm>[] GetEditors()
|
||||
public static IEditor<System.Windows.Forms.UserControl>[] GetEditors()
|
||||
{
|
||||
var editors = new List<IEditor<Forms.STForm>>();
|
||||
var editors = new List<IEditor<System.Windows.Forms.UserControl>>();
|
||||
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<Forms.STForm>))
|
||||
if (interfaces_array[i] == typeof(IEditor<System.Windows.Forms.UserControl>))
|
||||
{
|
||||
editors.Add((IEditor<Forms.STForm>)Activator.CreateInstance(type));
|
||||
editors.Add((IEditor<System.Windows.Forms.UserControl>)Activator.CreateInstance(type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,6 +504,12 @@
|
|||
<Compile Include="Forms\Editors\UV\UVEditor.Designer.cs">
|
||||
<DependentUpon>UVEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\GenericEditorForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\GenericEditorForm.Designer.cs">
|
||||
<DependentUpon>GenericEditorForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\GL\GLControl2D.cs" />
|
||||
<Compile Include="Forms\HintHelpDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -846,6 +852,9 @@
|
|||
<EmbeddedResource Include="Forms\Editors\UV\UVEditor2.resx">
|
||||
<DependentUpon>UVEditor2.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\GenericEditorForm.resx">
|
||||
<DependentUpon>GenericEditorForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\GL\GLControl2D.resx">
|
||||
<DependentUpon>GLControl2D.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue