diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo
index 71452e6f..a2ecf520 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 870b6e09..eacd1e45 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-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal
index 76a75f23..43ed3014 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/BFRES/Bfres Structs/SubFiles/FMDL/FMAT.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FMAT.cs
index 30ad6b0c..cd1f8a8f 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FMAT.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL/FMAT.cs
@@ -25,12 +25,17 @@ namespace Bfres.Structs
ContextMenuStrip = new STContextMenuStrip();
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Import Material", null, Import, Keys.Control | Keys.I));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Import Material", null, ImportAction, Keys.Control | Keys.I));
ContextMenuStrip.Items.Add(new ToolStripSeparator());
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export All Materials", null, ExportAll, Keys.Control | Keys.A));
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace (From Folder)",null, ReplaceBatch, Keys.Control | Keys.R));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export All Materials", null, ExportAllAction, Keys.Control | Keys.A));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace (From Folder)",null, ReplaceBatchAction, Keys.Control | Keys.R));
}
- public void ExportAll(object sender, EventArgs args)
+
+ public void ExportAllAction(object sender, EventArgs args) { ExportAll(); }
+ public void ReplaceBatchAction(object sender, EventArgs args) { ReplaceBatch(); }
+ public void ImportAction(object sender, EventArgs args) { Import(); }
+
+ public void ExportAll()
{
FolderSelectDialog sfd = new FolderSelectDialog();
@@ -44,7 +49,7 @@ namespace Bfres.Structs
}
}
}
- public void ReplaceBatch(object sender, EventArgs args)
+ public void ReplaceBatch()
{
FolderSelectDialog ofd = new FolderSelectDialog();
@@ -65,7 +70,7 @@ namespace Bfres.Structs
LibraryGUI.Instance.UpdateViewport();
}
- public void Import(object sender, EventArgs args)
+ public void Import()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Bfres Material |*.bfmat;";
@@ -91,14 +96,71 @@ namespace Bfres.Structs
ContextMenuStrip = new STContextMenuStrip();
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export", null, Export, Keys.Control | Keys.E));
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Replace, Keys.Control | Keys.R));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export", null, ExportAction, Keys.Control | Keys.E));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, ReplaceAction, Keys.Control | Keys.R));
ContextMenuStrip.Items.Add(new ToolStripSeparator());
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Copy", null, Copy, Keys.Control | Keys.C));
- ContextMenuStrip.Items.Add(new ToolStripMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Copy", null, CopyAction, Keys.Control | Keys.C));
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Rename", null, RenameAction, Keys.Control | Keys.N));
+ ContextMenuStrip.Items.Add(new ToolStripSeparator());
+ ContextMenuStrip.Items.Add(new ToolStripMenuItem("Delete", null, DeleteAction, Keys.Control | Keys.N));
}
+ protected void ExportAction(object sender, EventArgs args) { Export(); }
+ protected void ReplaceAction(object sender, EventArgs args) { Replace(); }
+ protected void CopyAction(object sender, EventArgs args) { Copy(); }
+ protected void RenameAction(object sender, EventArgs args) { Rename(); }
+ protected void DeleteAction(object sender, EventArgs args) { Delete(); }
+
+ public void Delete()
+ {
+ string MappedNames = "";
+ var model = GetParentModel();
+
+ int CurrentIndex = Parent.Nodes.IndexOf(this);
+
+ if (model.materials.Count == 1 && model.shapes.Count > 0)
+ {
+ MessageBox.Show("A single material must exist if any objects exist!", "Material Delete",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+
+ return;
+ }
+
+ foreach (var shape in model.shapes)
+ {
+ if (shape.GetMaterial() == this)
+ {
+ MappedNames += $"{shape.Text}\n";
+ }
+ }
+ if (MappedNames != "")
+ {
+ var result = STOptionsDialog.Show("Shapes are mapped to this material. Are you sure you want to remove this? (Will default to first material)",
+ "Material Delete", MappedNames);
+
+ if (result == DialogResult.Yes)
+ {
+ //Adjust all the indices properly based on this current index
+ foreach (var shape in model.shapes)
+ {
+ //If there are indices higher than this index, shift them
+ if (shape.MaterialIndex > CurrentIndex)
+ {
+ shape.MaterialIndex -= 1;
+ }
+ }
+
+ model.materials.Remove(Text);
+ Parent.Nodes.Remove(this);
+ }
+ }
+ }
+
+ public FMDL GetParentModel()
+ {
+ return ((FMDL)Parent.Parent);
+ }
public ResFile GetResFile()
{
@@ -152,7 +214,7 @@ namespace Bfres.Structs
else
Runtime.activeGame = Runtime.ActiveGame.KSA;
}
- private void Rename(object sender, EventArgs args)
+ private void Rename()
{
RenameDialog dialog = new RenameDialog();
dialog.SetString(Text);
@@ -164,11 +226,11 @@ namespace Bfres.Structs
((FMDL)Parent.Parent).materials.Add(Text, this);
}
}
- private void Copy(object sender, EventArgs args)
+ private void Copy()
{
((FMDL)Parent.Parent).CopyMaterial(this);
}
- private void Export(object sender, EventArgs args)
+ private void Export()
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Supported Formats|*.bfmat;";
@@ -188,7 +250,7 @@ namespace Bfres.Structs
else
Material.Export(path, GetResFile());
}
- private void Replace(object sender, EventArgs args)
+ private void Replace()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Supported Formats|*.bfmat;";
diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache
index eb58982e..6aaf746b 100644
Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ
diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll
index f0a56763..99e176a8 100644
Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb
index 97375308..a3ad8e43 100644
Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb differ
diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache
index 45e1b045..ee67cc31 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/Forms/Dialogs/STErrorDialog.Designer.cs b/Switch_Toolbox_Library/Forms/Dialogs/STErrorDialog.Designer.cs
index c4054f5b..a657b56f 100644
--- a/Switch_Toolbox_Library/Forms/Dialogs/STErrorDialog.Designer.cs
+++ b/Switch_Toolbox_Library/Forms/Dialogs/STErrorDialog.Designer.cs
@@ -41,7 +41,7 @@
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnClose.Location = new System.Drawing.Point(267, 47);
+ this.btnClose.Location = new System.Drawing.Point(267, 52);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(75, 23);
this.btnClose.TabIndex = 0;
@@ -55,7 +55,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.btnDetails.Enabled = false;
this.btnDetails.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnDetails.Location = new System.Drawing.Point(12, 47);
+ this.btnDetails.Location = new System.Drawing.Point(12, 52);
this.btnDetails.Name = "btnDetails";
this.btnDetails.Size = new System.Drawing.Size(75, 23);
this.btnDetails.TabIndex = 1;
@@ -68,7 +68,7 @@
this.btnCopy.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnCopy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnCopy.Location = new System.Drawing.Point(93, 47);
+ this.btnCopy.Location = new System.Drawing.Point(93, 52);
this.btnCopy.Name = "btnCopy";
this.btnCopy.Size = new System.Drawing.Size(102, 23);
this.btnCopy.TabIndex = 4;
@@ -90,16 +90,16 @@
// tbDetails
//
this.tbDetails.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
- this.tbDetails.Location = new System.Drawing.Point(12, 78);
+ this.tbDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.tbDetails.Location = new System.Drawing.Point(12, 83);
this.tbDetails.MaximumSize = new System.Drawing.Size(328, 100);
this.tbDetails.Name = "tbDetails";
this.tbDetails.ReadOnly = true;
this.tbDetails.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
- this.tbDetails.Size = new System.Drawing.Size(328, 300);
+ this.tbDetails.Size = new System.Drawing.Size(328, 100);
this.tbDetails.TabIndex = 6;
this.tbDetails.Text = "";
this.tbDetails.Visible = false;
- this.tbDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
//
// pictureBox1
//
@@ -115,7 +115,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(354, 82);
+ this.ClientSize = new System.Drawing.Size(354, 87);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.tbDetails);
this.Controls.Add(this.lblMessage);
diff --git a/Switch_Toolbox_Library/Forms/Dialogs/STExceptionDialog.cs b/Switch_Toolbox_Library/Forms/Dialogs/STExceptionDialog.cs
deleted file mode 100644
index b7b2e579..00000000
--- a/Switch_Toolbox_Library/Forms/Dialogs/STExceptionDialog.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-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 STExceptionDialog : Form
- {
- #region designer
-
- ///
- /// 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()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(STExceptionDialog));
- this.btnContinue = new System.Windows.Forms.Button();
- this.btnDetails = new System.Windows.Forms.Button();
- this.btnQuit = new System.Windows.Forms.Button();
- this.detailsBox = new System.Windows.Forms.RichTextBox();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.errorMessageLabel = new System.Windows.Forms.RichTextBox();
- this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.stPanel1.SuspendLayout();
- this.SuspendLayout();
- //
- // btnContinue
- //
- this.btnContinue.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.btnContinue.Location = new System.Drawing.Point(203, 102);
- this.btnContinue.Name = "btnContinue";
- this.btnContinue.Size = new System.Drawing.Size(87, 23);
- this.btnContinue.TabIndex = 0;
- this.btnContinue.Text = "Continue";
- this.btnContinue.UseVisualStyleBackColor = true;
- //
- // btnDetails
- //
- this.btnDetails.Location = new System.Drawing.Point(12, 102);
- this.btnDetails.Name = "btnDetails";
- this.btnDetails.Size = new System.Drawing.Size(93, 23);
- this.btnDetails.TabIndex = 1;
- this.btnDetails.Text = "Details";
- this.btnDetails.UseVisualStyleBackColor = true;
- this.btnDetails.Click += new System.EventHandler(this.btnDetails_Click);
- //
- // btnQuit
- //
- this.btnQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnQuit.Location = new System.Drawing.Point(291, 102);
- this.btnQuit.Name = "btnQuit";
- this.btnQuit.Size = new System.Drawing.Size(87, 23);
- this.btnQuit.TabIndex = 2;
- this.btnQuit.Text = "Quit";
- this.btnQuit.UseVisualStyleBackColor = true;
- this.btnQuit.Click += new System.EventHandler(this.btnQuit_Click);
- //
- // detailsBox
- //
- this.detailsBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70)))));
- this.detailsBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.detailsBox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.detailsBox.ForeColor = System.Drawing.Color.White;
- this.detailsBox.Location = new System.Drawing.Point(0, 0);
- this.detailsBox.Name = "detailsBox";
- this.detailsBox.Size = new System.Drawing.Size(386, 219);
- this.detailsBox.TabIndex = 3;
- this.detailsBox.Text = "";
- this.detailsBox.TextChanged += new System.EventHandler(this.detailsBox_TextChanged);
- //
- // pictureBox1
- //
- this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
- this.pictureBox1.Location = new System.Drawing.Point(12, 12);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(32, 32);
- this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
- this.pictureBox1.TabIndex = 4;
- this.pictureBox1.TabStop = false;
- //
- // errorMessageLabel
- //
- this.errorMessageLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.errorMessageLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.errorMessageLabel.ForeColor = System.Drawing.Color.White;
- this.errorMessageLabel.Location = new System.Drawing.Point(67, 12);
- this.errorMessageLabel.Name = "errorMessageLabel";
- this.errorMessageLabel.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
- this.errorMessageLabel.Size = new System.Drawing.Size(289, 73);
- this.errorMessageLabel.TabIndex = 5;
- this.errorMessageLabel.Text = "";
- //
- // stPanel1
- //
- this.stPanel1.Controls.Add(this.detailsBox);
- this.stPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.stPanel1.Location = new System.Drawing.Point(0, 131);
- this.stPanel1.Name = "stPanel1";
- this.stPanel1.Size = new System.Drawing.Size(386, 219);
- this.stPanel1.TabIndex = 6;
- //
- // STErrorDialog
- //
- this.AcceptButton = this.btnContinue;
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.AutoSize = true;
- this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.CancelButton = this.btnQuit;
- this.ClientSize = new System.Drawing.Size(386, 350);
- this.Controls.Add(this.stPanel1);
- this.Controls.Add(this.errorMessageLabel);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.btnQuit);
- this.Controls.Add(this.btnDetails);
- this.Controls.Add(this.btnContinue);
- this.Name = "STErrorDialog";
- this.ShowIcon = false;
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Error";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.stPanel1.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Button btnContinue;
- private System.Windows.Forms.Button btnDetails;
- private System.Windows.Forms.Button btnQuit;
- private System.Windows.Forms.RichTextBox detailsBox;
- private System.Windows.Forms.PictureBox pictureBox1;
- private STPanel stPanel1;
- private System.Windows.Forms.RichTextBox errorMessageLabel;
-
- #endregion
-
- public STExceptionDialog()
- {
- InitializeComponent();
- detailsBox.Multiline = true;
-
- // no smaller than design time size
- MinimumSize = new System.Drawing.Size(this.Width, this.Height);
-
- // no larger than screen size
- MaximumSize = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
-
- AutoSize = true;
- AutoSizeMode = AutoSizeMode.GrowAndShrink;
- }
- public static void Show(string ErrorMessage, string Details)
- {
- STExceptionDialog dlg = new STExceptionDialog();
- dlg.errorMessageLabel.Text = ErrorMessage;
- dlg.detailsBox.Text = Details;
-
- if (dlg.ShowDialog() == DialogResult.OK)
- {
- dlg.Close();
- }
- }
- private void AutoSizeTextBox(TextBox txt)
- {
- const int x_margin = 0;
- const int y_margin = 2;
- Size size = TextRenderer.MeasureText(txt.Text, txt.Font);
- txt.ClientSize =
- new Size(size.Width + x_margin, size.Height + y_margin);
- }
-
- private void detailsBox_TextChanged(object sender, EventArgs e)
- {
- AutoSizeTextBox(sender as TextBox);
- }
-
- private void btnQuit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
-
- private void btnDetails_Click(object sender, EventArgs e)
- {
-
- }
- }
-}
diff --git a/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.Designer.cs b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.Designer.cs
new file mode 100644
index 00000000..f69cbf62
--- /dev/null
+++ b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.Designer.cs
@@ -0,0 +1,147 @@
+namespace Switch_Toolbox.Library.Forms
+{
+ partial class STOptionsDialog
+ {
+ ///
+ /// 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.btnClose = new Switch_Toolbox.Library.Forms.STButton();
+ this.btnDetails = new Switch_Toolbox.Library.Forms.STButton();
+ this.lblMessage = new Switch_Toolbox.Library.Forms.STLabel();
+ this.tbDetails = new System.Windows.Forms.RichTextBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnClose
+ //
+ this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnClose.DialogResult = System.Windows.Forms.DialogResult.No;
+ this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnClose.Location = new System.Drawing.Point(267, 76);
+ this.btnClose.Name = "btnClose";
+ this.btnClose.Size = new System.Drawing.Size(75, 23);
+ this.btnClose.TabIndex = 0;
+ this.btnClose.Text = "No";
+ this.btnClose.UseVisualStyleBackColor = true;
+ this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
+ //
+ // btnDetails
+ //
+ this.btnDetails.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnDetails.Enabled = false;
+ this.btnDetails.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnDetails.Location = new System.Drawing.Point(12, 76);
+ this.btnDetails.Name = "btnDetails";
+ this.btnDetails.Size = new System.Drawing.Size(75, 23);
+ this.btnDetails.TabIndex = 1;
+ this.btnDetails.Text = "Details";
+ this.btnDetails.UseVisualStyleBackColor = true;
+ this.btnDetails.Click += new System.EventHandler(this.btnDetails_Click);
+ //
+ // lblMessage
+ //
+ this.lblMessage.AutoSize = true;
+ this.lblMessage.Location = new System.Drawing.Point(68, 18);
+ this.lblMessage.MaximumSize = new System.Drawing.Size(310, 0);
+ this.lblMessage.Name = "lblMessage";
+ this.lblMessage.Size = new System.Drawing.Size(35, 13);
+ this.lblMessage.TabIndex = 5;
+ this.lblMessage.Text = "label1";
+ //
+ // tbDetails
+ //
+ this.tbDetails.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
+ this.tbDetails.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.tbDetails.Location = new System.Drawing.Point(12, 107);
+ this.tbDetails.MaximumSize = new System.Drawing.Size(328, 100);
+ this.tbDetails.Name = "tbDetails";
+ this.tbDetails.ReadOnly = true;
+ this.tbDetails.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
+ this.tbDetails.Size = new System.Drawing.Size(328, 100);
+ this.tbDetails.TabIndex = 6;
+ this.tbDetails.Text = "";
+ this.tbDetails.Visible = false;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Image = global::Switch_Toolbox.Library.Properties.Resources.QuestionCheck;
+ this.pictureBox1.Location = new System.Drawing.Point(12, 12);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(50, 37);
+ this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.pictureBox1.TabIndex = 7;
+ this.pictureBox1.TabStop = false;
+ //
+ // stButton1
+ //
+ this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Yes;
+ this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.stButton1.Location = new System.Drawing.Point(186, 76);
+ this.stButton1.Name = "stButton1";
+ this.stButton1.Size = new System.Drawing.Size(75, 23);
+ this.stButton1.TabIndex = 8;
+ this.stButton1.Text = "Yes";
+ this.stButton1.UseVisualStyleBackColor = true;
+ //
+ // STOptionsDialog
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(354, 111);
+ this.Controls.Add(this.stButton1);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.tbDetails);
+ this.Controls.Add(this.lblMessage);
+ this.Controls.Add(this.btnDetails);
+ this.Controls.Add(this.btnClose);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "STOptionsDialog";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Switch_Toolbox.Library.Forms.STButton btnClose;
+ private Switch_Toolbox.Library.Forms.STButton btnDetails;
+ private Switch_Toolbox.Library.Forms.STLabel lblMessage;
+ private System.Windows.Forms.RichTextBox tbDetails;
+ private System.Windows.Forms.PictureBox pictureBox1;
+ private STButton stButton1;
+ }
+}
\ No newline at end of file
diff --git a/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.cs b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.cs
new file mode 100644
index 00000000..03c65760
--- /dev/null
+++ b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.cs
@@ -0,0 +1,108 @@
+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
+{
+ //Based from https://stackoverflow.com/questions/8653430/how-can-i-show-a-message-box-with-details-in-winforms/40469355#40469355
+
+ ///
+ /// A dialog-style form with optional colapsable details section
+ ///
+ public partial class STOptionsDialog : Form
+ {
+ private const string DetailsFormat = "Details {0}";
+
+ public STOptionsDialog(string message, string title, string details = null)
+ {
+ InitializeComponent();
+
+ lblMessage.Text = message;
+ this.Text = title;
+
+ if (details != null)
+ {
+ btnDetails.Enabled = true;
+ btnDetails.Text = DownArrow;
+ tbDetails.Text = details;
+ }
+ BackColor = FormThemes.BaseTheme.FormBackColor;
+ ForeColor = FormThemes.BaseTheme.FormForeColor;
+
+ tbDetails.BackColor = FormThemes.BaseTheme.FormBackColor;
+ tbDetails.ForeColor = FormThemes.BaseTheme.FormForeColor;
+ }
+
+ private string UpArrow
+ {
+ get
+ {
+ return string.Format(DetailsFormat, char.ConvertFromUtf32(0x25B4));
+ }
+ }
+
+ private string DownArrow
+ {
+ get
+ {
+ return string.Format(DetailsFormat, char.ConvertFromUtf32(0x25BE));
+ }
+ }
+
+ ///
+ /// Meant to give the look and feel of a regular MessageBox
+ ///
+ public static DialogResult Show(string message, string title, string details = null)
+ {
+ return new STOptionsDialog(message, title, details).ShowDialog();
+ }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+
+ // Change these properties now so the label is rendered so we get its real height
+ var height = lblMessage.Height;
+ SetMessageBoxHeight(height);
+ }
+
+ private void SetMessageBoxHeight(int heightChange)
+ {
+ this.Height = this.Height + heightChange;
+ if (this.Height < 150)
+ {
+ this.Height = 150;
+ }
+ }
+
+ private void btnClose_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void btnDetails_Click(object sender, EventArgs e)
+ {
+ // Re-anchoring the controls so they stay in their place while the form is resized
+ btnClose.Anchor = AnchorStyles.Top;
+ btnDetails.Anchor = AnchorStyles.Top;
+ tbDetails.Anchor = AnchorStyles.Top;
+
+ tbDetails.Visible = !tbDetails.Visible;
+
+ btnDetails.Text = tbDetails.Visible ? UpArrow : DownArrow;
+
+ SetMessageBoxHeight(tbDetails.Visible ? tbDetails.Height + 10 : -tbDetails.Height - 10);
+ }
+
+ private void btnCopy_Click(object sender, EventArgs e)
+ {
+ Clipboard.SetText(tbDetails.Text);
+ }
+ }
+}
diff --git a/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.resx b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/Switch_Toolbox_Library/Forms/Dialogs/STOptionsDialog.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/Properties/Resources.Designer.cs b/Switch_Toolbox_Library/Properties/Resources.Designer.cs
index 55836128..fc9472df 100644
--- a/Switch_Toolbox_Library/Properties/Resources.Designer.cs
+++ b/Switch_Toolbox_Library/Properties/Resources.Designer.cs
@@ -430,6 +430,16 @@ namespace Switch_Toolbox.Library.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap InfoCheck {
+ get {
+ object obj = ResourceManager.GetObject("InfoCheck", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -650,6 +660,16 @@ namespace Switch_Toolbox.Library.Properties {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap QuestionCheck {
+ get {
+ object obj = ResourceManager.GetObject("QuestionCheck", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
diff --git a/Switch_Toolbox_Library/Properties/Resources.resx b/Switch_Toolbox_Library/Properties/Resources.resx
index a76a560e..2cb2614f 100644
--- a/Switch_Toolbox_Library/Properties/Resources.resx
+++ b/Switch_Toolbox_Library/Properties/Resources.resx
@@ -148,8 +148,8 @@
..\Resources\maximized.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Bfres.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Playback\RewindArrows2L.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\DataTyypes\IconInt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -193,9 +193,6 @@
..\Resources\arrowL.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\DataTyypes\IconCurve.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Forms\Toolbar\images\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -220,9 +217,6 @@
..\Resources\Byaml.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\CheckBox\Init_false.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\Cubemaps\diffuseSDR.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
@@ -241,6 +235,9 @@
..\Resources\Cubemaps\specularSDR.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\Resources\InjectTexErrored.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
..\Resources\normalsSphere.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -253,8 +250,8 @@
..\Resources\DataTyypes\IconList.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\DataTyypes\IconBool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\CheckBox\Init_false.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\DataTyypes\IconBuffer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -277,9 +274,15 @@
..\Forms\Toolbar\images\close_sele.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\InfoCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\Playback\PlayArrowR.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\NumbericUpDownArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Forms\Toolbar\images\minimize_sele.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -292,14 +295,17 @@
..\Resources\brsf.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\Forms\Toolbar\images\maximize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\DataTyypes\IconBool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\LoadingImage.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\InjectTexErrored.dds;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\Resources\Bfres.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\DataTyypes\IconCurve.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\Bnsh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -316,9 +322,6 @@
..\Resources\CheckerBackground.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Playback\RewindArrows2L.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\skeletonAnimation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -340,10 +343,13 @@
..\Resources\Bntx.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Forms\Toolbar\images\maximize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\NumbericUpDownArrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\QuestionCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
\ No newline at end of file
diff --git a/Switch_Toolbox_Library/Resources/ErrorCheck.png b/Switch_Toolbox_Library/Resources/ErrorCheck.png
index 0592c970..b3747c11 100644
Binary files a/Switch_Toolbox_Library/Resources/ErrorCheck.png and b/Switch_Toolbox_Library/Resources/ErrorCheck.png differ
diff --git a/Switch_Toolbox_Library/Resources/InfoCheck.png b/Switch_Toolbox_Library/Resources/InfoCheck.png
new file mode 100644
index 00000000..25fb18c0
Binary files /dev/null and b/Switch_Toolbox_Library/Resources/InfoCheck.png differ
diff --git a/Switch_Toolbox_Library/Resources/QuestionCheck.png b/Switch_Toolbox_Library/Resources/QuestionCheck.png
new file mode 100644
index 00000000..f5b35040
Binary files /dev/null and b/Switch_Toolbox_Library/Resources/QuestionCheck.png differ
diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
index 96b57c7e..7432e1e6 100644
--- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
+++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
@@ -234,6 +234,12 @@
STNumericBox.cs
+
+ Form
+
+
+ STOptionsDialog.cs
+
Form
@@ -463,9 +469,6 @@
CubeMapFaceCreator.cs
-
- Form
-
Form
@@ -615,6 +618,9 @@
STTextBox.cs
+
+ STOptionsDialog.cs
+
STErrorDialog.cs
@@ -958,6 +964,12 @@
+
+
+
+
+
+