diff --git a/PCK-Studio/Features/CemuPanel.cs b/PCK-Studio/Features/CemuPanel.cs index 2031d78c..296d65c9 100644 --- a/PCK-Studio/Features/CemuPanel.cs +++ b/PCK-Studio/Features/CemuPanel.cs @@ -251,9 +251,9 @@ namespace PckStudio.Features private void addCustomPckToolStripMenuItem_Click(object sender, EventArgs e) { - TextPrompt prompt = new TextPrompt(string.Empty); - prompt.OKButton.Text = "OK"; - prompt.TextLabel.Text = "Folder:"; + TextPrompt prompt = new TextPrompt(); + prompt.OKButtonText = "OK"; + prompt.LabelText = "Folder:"; if (prompt.ShowDialog(this) != DialogResult.OK) return; diff --git a/PCK-Studio/Forms/Additional-Popups/TextPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/TextPrompt.Designer.cs index 1728cc6f..7383e95e 100644 --- a/PCK-Studio/Forms/Additional-Popups/TextPrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/TextPrompt.Designer.cs @@ -28,92 +28,92 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TextPrompt)); - this.TextLabel = new System.Windows.Forms.Label(); - this.OKButton = new System.Windows.Forms.Button(); - this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); - this.contextLabel = new MetroFramework.Controls.MetroLabel(); - this.SuspendLayout(); - // - // TextLabel - // - resources.ApplyResources(this.TextLabel, "TextLabel"); - this.TextLabel.ForeColor = System.Drawing.Color.White; - this.TextLabel.Name = "TextLabel"; - // - // OKButton - // - resources.ApplyResources(this.OKButton, "OKButton"); - this.OKButton.ForeColor = System.Drawing.Color.White; - this.OKButton.Name = "OKButton"; - this.OKButton.UseVisualStyleBackColor = true; - this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); - // - // InputTextBox - // - resources.ApplyResources(this.InputTextBox, "InputTextBox"); - // - // - // - this.InputTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image"))); - this.InputTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode"))); - this.InputTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location"))); - this.InputTextBox.CustomButton.Name = ""; - this.InputTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size"))); - this.InputTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; - this.InputTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex"))); - this.InputTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; - this.InputTextBox.CustomButton.UseSelectable = true; - this.InputTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible"))); - this.InputTextBox.Lines = new string[0]; - this.InputTextBox.MaxLength = 255; - this.InputTextBox.Name = "InputTextBox"; - this.InputTextBox.PasswordChar = '\0'; - this.InputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.InputTextBox.SelectedText = ""; - this.InputTextBox.SelectionLength = 0; - this.InputTextBox.SelectionStart = 0; - this.InputTextBox.ShortcutsEnabled = true; - this.InputTextBox.Style = MetroFramework.MetroColorStyle.White; - this.InputTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.InputTextBox.UseSelectable = true; - this.InputTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); - this.InputTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); - // - // contextLabel - // - resources.ApplyResources(this.contextLabel, "contextLabel"); - this.contextLabel.FontSize = MetroFramework.MetroLabelSize.Small; - this.contextLabel.Name = "contextLabel"; - this.contextLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - this.contextLabel.WrapToLine = true; - // - // TextPrompt - // - this.AcceptButton = this.OKButton; - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.contextLabel); - this.Controls.Add(this.InputTextBox); - this.Controls.Add(this.OKButton); - this.Controls.Add(this.TextLabel); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "TextPrompt"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.Load += new System.EventHandler(this.RenamePrompt_Load); - this.ResumeLayout(false); - this.PerformLayout(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TextPrompt)); + this.TextLabel = new System.Windows.Forms.Label(); + this.OKButton = new System.Windows.Forms.Button(); + this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); + this.contextLabel = new MetroFramework.Controls.MetroLabel(); + this.SuspendLayout(); + // + // TextLabel + // + resources.ApplyResources(this.TextLabel, "TextLabel"); + this.TextLabel.ForeColor = System.Drawing.Color.White; + this.TextLabel.Name = "TextLabel"; + // + // OKButton + // + resources.ApplyResources(this.OKButton, "OKButton"); + this.OKButton.ForeColor = System.Drawing.Color.White; + this.OKButton.Name = "OKButton"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); + // + // InputTextBox + // + resources.ApplyResources(this.InputTextBox, "InputTextBox"); + // + // + // + this.InputTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image"))); + this.InputTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode"))); + this.InputTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location"))); + this.InputTextBox.CustomButton.Name = ""; + this.InputTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size"))); + this.InputTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; + this.InputTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex"))); + this.InputTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; + this.InputTextBox.CustomButton.UseSelectable = true; + this.InputTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible"))); + this.InputTextBox.Lines = new string[0]; + this.InputTextBox.MaxLength = 255; + this.InputTextBox.Name = "InputTextBox"; + this.InputTextBox.PasswordChar = '\0'; + this.InputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.InputTextBox.SelectedText = ""; + this.InputTextBox.SelectionLength = 0; + this.InputTextBox.SelectionStart = 0; + this.InputTextBox.ShortcutsEnabled = true; + this.InputTextBox.Style = MetroFramework.MetroColorStyle.White; + this.InputTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.InputTextBox.UseSelectable = true; + this.InputTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); + this.InputTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); + // + // contextLabel + // + resources.ApplyResources(this.contextLabel, "contextLabel"); + this.contextLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.contextLabel.Name = "contextLabel"; + this.contextLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.contextLabel.WrapToLine = true; + // + // TextPrompt + // + this.AcceptButton = this.OKButton; + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.contextLabel); + this.Controls.Add(this.InputTextBox); + this.Controls.Add(this.OKButton); + this.Controls.Add(this.TextLabel); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "TextPrompt"; + this.Resizable = false; + this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.Load += new System.EventHandler(this.RenamePrompt_Load); + this.ResumeLayout(false); + this.PerformLayout(); } #endregion - public System.Windows.Forms.Button OKButton; - public System.Windows.Forms.Label TextLabel; private MetroFramework.Controls.MetroTextBox InputTextBox; public MetroFramework.Controls.MetroLabel contextLabel; - } + private System.Windows.Forms.Button OKButton; + private System.Windows.Forms.Label TextLabel; + } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/TextPrompt.cs b/PCK-Studio/Forms/Additional-Popups/TextPrompt.cs index 318fe9ef..cb7c3f3e 100644 --- a/PCK-Studio/Forms/Additional-Popups/TextPrompt.cs +++ b/PCK-Studio/Forms/Additional-Popups/TextPrompt.cs @@ -11,19 +11,32 @@ namespace PckStudio /// public string NewText => InputTextBox.Text; - public TextPrompt(string InitialText) : this(InitialText, -1) + public string OKButtonText + { + set => OKButton.Text = value; + } + + public string LabelText + { + set => TextLabel.Text = value; + } + + public TextPrompt() : this(string.Empty, -1) { } - public TextPrompt(string InitialText, int maxChar) + public TextPrompt(string initialText) : this(initialText, -1) + { } + + public TextPrompt(string initialText, int maxTextLength) { InitializeComponent(); - InputTextBox.Text = InitialText; - InputTextBox.MaxLength = maxChar < 0 ? short.MaxValue : maxChar; + InputTextBox.Text = initialText; + InputTextBox.MaxLength = maxTextLength < 0 ? short.MaxValue : maxTextLength; } private void OKBtn_Click(object sender, EventArgs e) { - if (String.IsNullOrEmpty(InputTextBox.Text)) + if (string.IsNullOrEmpty(InputTextBox.Text)) { MessageBox.Show(this, "Please insert a value in the text box.", "Empty string"); } @@ -32,7 +45,7 @@ namespace PckStudio private void RenamePrompt_Load(object sender, EventArgs e) { - if(String.IsNullOrEmpty(contextLabel.Text)) + if(string.IsNullOrEmpty(contextLabel.Text)) { contextLabel.Visible = false; Size = new System.Drawing.Size(264, 85); diff --git a/PCK-Studio/Forms/Editor/ANIMEditor.cs b/PCK-Studio/Forms/Editor/ANIMEditor.cs index d700077f..7193d4bc 100644 --- a/PCK-Studio/Forms/Editor/ANIMEditor.cs +++ b/PCK-Studio/Forms/Editor/ANIMEditor.cs @@ -247,8 +247,8 @@ namespace PckStudio.Forms.Editor { if (!string.IsNullOrWhiteSpace(value)) MessageBox.Show($"The following value \"{value}\" is not valid. Please try again."); TextPrompt diag = new TextPrompt(value); - diag.TextLabel.Text = "ANIM"; - diag.OKButton.Text = "Ok"; + diag.LabelText = "ANIM"; + diag.OKButtonText = "Ok"; if (diag.ShowDialog() == DialogResult.OK) { value = diag.NewText; diff --git a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs index 31a5c17e..28136324 100644 --- a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs +++ b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs @@ -205,9 +205,9 @@ namespace PckStudio.Forms.Editor ? GrfTreeView.SelectedNode.Nodes : GrfTreeView.Nodes; - using (TextPrompt prompt = new TextPrompt("")) + using (TextPrompt prompt = new TextPrompt()) { - prompt.OKButton.Text = "Add"; + prompt.OKButtonText = "Add"; if (MessageBox.Show($"Add Game Rule to {parentRule.Name}", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes && prompt.ShowDialog() == DialogResult.OK && diff --git a/PCK-Studio/Forms/Editor/LOCEditor.cs b/PCK-Studio/Forms/Editor/LOCEditor.cs index f6d2c20f..70525e00 100644 --- a/PCK-Studio/Forms/Editor/LOCEditor.cs +++ b/PCK-Studio/Forms/Editor/LOCEditor.cs @@ -61,9 +61,9 @@ namespace PckStudio.Forms.Editor private void addDisplayIDToolStripMenuItem_Click(object sender, EventArgs e) { if (treeViewLocKeys.SelectedNode is TreeNode) - using (TextPrompt prompt = new TextPrompt("")) + using (TextPrompt prompt = new TextPrompt()) { - prompt.OKButton.Text = "Add"; + prompt.OKButtonText = "Add"; if (prompt.ShowDialog() == DialogResult.OK && !currentLoc.LocKeys.ContainsKey(prompt.NewText) && currentLoc.AddLocKey(prompt.NewText, "")) diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index a6cd3ef0..efca37ee 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -1064,7 +1064,7 @@ namespace PckStudio using TextPrompt diag = new TextPrompt(node.Tag is null ? Path.GetFileName(node.FullPath) : node.FullPath); diag.contextLabel.Text = $"Creating a clone of \"{path}\". Ensure that the path isn't yet."; - diag.OKButton.Text = "Clone"; + diag.OKButtonText = "Clone"; if (diag.ShowDialog(this) == DialogResult.OK) { @@ -1296,8 +1296,8 @@ namespace PckStudio private void skinPackToolStripMenuItem_Click(object sender, EventArgs e) { checkSaveState(); - TextPrompt namePrompt = new TextPrompt(""); - namePrompt.OKButton.Text = "Ok"; + TextPrompt namePrompt = new TextPrompt(); + namePrompt.OKButtonText = "Ok"; if (namePrompt.ShowDialog() == DialogResult.OK) { currentPCK = InitializePack(new Random().Next(8000, int.MaxValue), 0, namePrompt.NewText, true); @@ -1647,9 +1647,9 @@ namespace PckStudio private void folderToolStripMenuItem_Click(object sender, EventArgs e) { - TextPrompt folderNamePrompt = new TextPrompt(""); + TextPrompt folderNamePrompt = new TextPrompt(); if(treeViewMain.SelectedNode is not null) folderNamePrompt.contextLabel.Text = $"New folder at the location of \"{treeViewMain.SelectedNode.FullPath}\""; - folderNamePrompt.OKButton.Text = "Add"; + folderNamePrompt.OKButtonText = "Add"; if (folderNamePrompt.ShowDialog() == DialogResult.OK) { TreeNode folerNode = CreateNode(folderNamePrompt.NewText); @@ -1921,7 +1921,7 @@ namespace PckStudio if (fileDialog.ShowDialog() == DialogResult.OK) { using TextPrompt renamePrompt = new TextPrompt(Path.GetFileName(fileDialog.FileName)); - renamePrompt.TextLabel.Text = "Path"; + renamePrompt.LabelText = "Path"; if (renamePrompt.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(renamePrompt.NewText)) { var file = currentPCK.CreateNewFile(renamePrompt.NewText, PckFile.FileData.FileType.TextureFile);