diff --git a/PCK-Studio/App.config b/PCK-Studio/App.config index f3cb4efa..c3b1b2f6 100644 --- a/PCK-Studio/App.config +++ b/PCK-Studio/App.config @@ -77,9 +77,6 @@ False - - False - diff --git a/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.Designer.cs b/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.Designer.cs index 78eb47ae..7da3b34f 100644 --- a/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.Designer.cs @@ -35,7 +35,6 @@ this.ValueTextBox = new MetroFramework.Controls.MetroTextBox(); this.CancelBtn = new MetroFramework.Controls.MetroButton(); this.ConfirmBtn = new MetroFramework.Controls.MetroButton(); - this.availableComboBox = new MetroFramework.Controls.MetroComboBox(); metroLabel1 = new MetroFramework.Controls.MetroLabel(); metroLabel2 = new MetroFramework.Controls.MetroLabel(); this.SuspendLayout(); @@ -46,7 +45,7 @@ metroLabel1.Location = new System.Drawing.Point(18, 27); metroLabel1.Name = "metroLabel1"; metroLabel1.Size = new System.Drawing.Size(48, 19); - metroLabel1.TabIndex = 0; + metroLabel1.TabIndex = 4; metroLabel1.Text = "Name:"; metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // @@ -56,12 +55,14 @@ metroLabel2.Location = new System.Drawing.Point(17, 56); metroLabel2.Name = "metroLabel2"; metroLabel2.Size = new System.Drawing.Size(42, 19); - metroLabel2.TabIndex = 1; + metroLabel2.TabIndex = 5; metroLabel2.Text = "Value:"; metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; // // NameTextBox // + this.NameTextBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.NameTextBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; // // // @@ -86,7 +87,7 @@ this.NameTextBox.ShortcutsEnabled = true; this.NameTextBox.Size = new System.Drawing.Size(165, 23); this.NameTextBox.Style = MetroFramework.MetroColorStyle.White; - this.NameTextBox.TabIndex = 2; + this.NameTextBox.TabIndex = 0; this.NameTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; this.NameTextBox.UseSelectable = true; this.NameTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); @@ -117,8 +118,7 @@ this.ValueTextBox.SelectionStart = 0; this.ValueTextBox.ShortcutsEnabled = true; this.ValueTextBox.Size = new System.Drawing.Size(165, 23); - this.ValueTextBox.Style = MetroFramework.MetroColorStyle.White; - this.ValueTextBox.TabIndex = 3; + this.ValueTextBox.TabIndex = 1; this.ValueTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; this.ValueTextBox.UseSelectable = true; this.ValueTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); @@ -131,7 +131,7 @@ this.CancelBtn.Name = "CancelBtn"; this.CancelBtn.Size = new System.Drawing.Size(95, 23); this.CancelBtn.Style = MetroFramework.MetroColorStyle.White; - this.CancelBtn.TabIndex = 4; + this.CancelBtn.TabIndex = 2; this.CancelBtn.Text = "Cancel"; this.CancelBtn.Theme = MetroFramework.MetroThemeStyle.Dark; this.CancelBtn.UseSelectable = true; @@ -142,33 +142,18 @@ this.ConfirmBtn.Name = "ConfirmBtn"; this.ConfirmBtn.Size = new System.Drawing.Size(96, 23); this.ConfirmBtn.Style = MetroFramework.MetroColorStyle.White; - this.ConfirmBtn.TabIndex = 5; + this.ConfirmBtn.TabIndex = 3; this.ConfirmBtn.Text = "Confirm"; this.ConfirmBtn.Theme = MetroFramework.MetroThemeStyle.Dark; this.ConfirmBtn.UseSelectable = true; this.ConfirmBtn.Click += new System.EventHandler(this.ConfirmButton_Click); // - // availableComboBox - // - this.availableComboBox.FormattingEnabled = true; - this.availableComboBox.ItemHeight = 23; - this.availableComboBox.Location = new System.Drawing.Point(72, 21); - this.availableComboBox.Name = "availableComboBox"; - this.availableComboBox.Size = new System.Drawing.Size(165, 29); - this.availableComboBox.Style = MetroFramework.MetroColorStyle.Silver; - this.availableComboBox.TabIndex = 6; - this.availableComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.availableComboBox.UseSelectable = true; - this.availableComboBox.Visible = false; - this.availableComboBox.SelectedIndexChanged += new System.EventHandler(this.availableComboBox_SelectedIndexChanged); - // // AddParameter // this.AcceptButton = this.ConfirmBtn; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(264, 126); - this.Controls.Add(this.availableComboBox); this.Controls.Add(this.ConfirmBtn); this.Controls.Add(this.CancelBtn); this.Controls.Add(this.ValueTextBox); @@ -192,6 +177,5 @@ private MetroFramework.Controls.MetroButton CancelBtn; private MetroFramework.Controls.MetroButton ConfirmBtn; private MetroFramework.Controls.MetroTextBox NameTextBox; - private MetroFramework.Controls.MetroComboBox availableComboBox; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.cs b/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.cs index ee5795d6..58ca66d0 100644 --- a/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.cs +++ b/PCK-Studio/Forms/Additional-Popups/Grf/AddParameter.cs @@ -1,7 +1,6 @@ using System; using System.Windows.Forms; using OMI.Formats.GameRule; -using PckStudio.Properties; namespace PckStudio.Forms.Additional_Popups.Grf { @@ -10,25 +9,12 @@ namespace PckStudio.Forms.Additional_Popups.Grf public string ParameterName => NameTextBox.Text; public string ParameterValue => ValueTextBox.Text; - private bool _useComboBox - { - get - { - return availableComboBox.Visible && !NameTextBox.Visible; - } - set - { - NameTextBox.Visible = !value; - availableComboBox.Visible = value; - } - } public AddParameter() { InitializeComponent(); - availableComboBox.Items.Clear(); - availableComboBox.Items.AddRange(GameRuleFile.GameRule.ValidParameters); - _useComboBox = Settings.Default.UseComboBoxForGRFParameter; + NameTextBox.AutoCompleteCustomSource = new AutoCompleteStringCollection(); + NameTextBox.AutoCompleteCustomSource.AddRange(GameRuleFile.GameRule.ValidParameters); } public AddParameter(string parameterName, string parameterValue, bool isKeyReadonly = true) : this() @@ -36,23 +22,16 @@ namespace PckStudio.Forms.Additional_Popups.Grf NameTextBox.Text = parameterName; ValueTextBox.Text = parameterValue; NameTextBox.Enabled = isKeyReadonly; - availableComboBox.Enabled = isKeyReadonly; - availableComboBox.SelectedItem = parameterName; } private void ConfirmButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(ParameterName) || string.IsNullOrWhiteSpace(ParameterValue)) { - MessageBox.Show(this, "Name and Value need valid values"); + MessageBox.Show(this, "Name or value can't be empty.", "Empty value", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } DialogResult = DialogResult.OK; } - - private void availableComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - NameTextBox.Text = availableComboBox.SelectedItem.ToString(); - } } } diff --git a/PCK-Studio/Forms/AppSettingsForm.cs b/PCK-Studio/Forms/AppSettingsForm.cs index 8d1927bb..f9aa41d5 100644 --- a/PCK-Studio/Forms/AppSettingsForm.cs +++ b/PCK-Studio/Forms/AppSettingsForm.cs @@ -33,7 +33,6 @@ namespace PckStudio.Forms ["AutoUpdate"] = "Auto Update", ["LoadSubPcks"] = "Load Sub Pcks", ["UsePrerelease"] = "Use Prerelease", - ["UseComboBoxForGRFParameter"] = "Easy Grf Param", }; private void CheckBox_CheckedChanged(object sender, EventArgs e) diff --git a/PCK-Studio/Properties/Settings.Designer.cs b/PCK-Studio/Properties/Settings.Designer.cs index 8acf7cc9..0f286e3c 100644 --- a/PCK-Studio/Properties/Settings.Designer.cs +++ b/PCK-Studio/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace PckStudio.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -104,18 +104,6 @@ namespace PckStudio.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool UseComboBoxForGRFParameter { - get { - return ((bool)(this["UseComboBoxForGRFParameter"])); - } - set { - this["UseComboBoxForGRFParameter"] = value; - } - } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public global::System.Collections.Specialized.StringCollection RecentFiles { diff --git a/PCK-Studio/Properties/Settings.settings b/PCK-Studio/Properties/Settings.settings index 1003231b..a32cf0c7 100644 --- a/PCK-Studio/Properties/Settings.settings +++ b/PCK-Studio/Properties/Settings.settings @@ -23,9 +23,6 @@ False - - False -