From 58dab700781753bf7edc93ee206d7d1b4ba1fd98 Mon Sep 17 00:00:00 2001 From: cadon Date: Sat, 11 Mar 2023 17:24:04 +0100 Subject: [PATCH] UI for natural sorting --- ARKBreedingStats/App.config | 6 ++ ARKBreedingStats/Form1.cs | 6 ++ .../Properties/Settings.Designer.cs | 26 +++++- ARKBreedingStats/Properties/Settings.settings | 6 ++ .../settings/Settings.Designer.cs | 91 ++++++++++++------- ARKBreedingStats/settings/Settings.cs | 13 +++ ARKBreedingStats/settings/Settings.resx | 24 ----- ARKBreedingStats/utils/CreatureListSorter.cs | 4 +- 8 files changed, 118 insertions(+), 58 deletions(-) diff --git a/ARKBreedingStats/App.config b/ARKBreedingStats/App.config index 7b4c66d36..62136c7f9 100644 --- a/ARKBreedingStats/App.config +++ b/ARKBreedingStats/App.config @@ -481,6 +481,12 @@ False + + True + + + False + diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index ba9011654..38d3a5af0 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -222,6 +222,9 @@ private void Form1_Load(object sender, EventArgs e) LoadListViewSettings(tribesControl1.ListViewPlayers, "PlayerListColumnWidths", "PlayerListColumnDisplayIndices", "PlayerListSortColumn", "PlayerListSortAsc"); + _creatureListSorter.UseNaturalSort = Properties.Settings.Default.UseNaturalSort; + _creatureListSorter.IgnoreSpacesBetweenWords = Properties.Settings.Default.NaturalSortIgnoreSpaces; + CbLibraryInfoUseFilter.Checked = Properties.Settings.Default.LibraryColorInfoUseFilter; // load stat weights @@ -1949,6 +1952,9 @@ private void OpenSettingsDialog(SettingsTabPages page = SettingsTabPages.Unknown CreatureColored.InitializeSpeciesImageLocation(); creatureBoxListView.CreatureCollection = _creatureCollection; + _creatureListSorter.UseNaturalSort = Properties.Settings.Default.UseNaturalSort; + _creatureListSorter.IgnoreSpacesBetweenWords = Properties.Settings.Default.NaturalSortIgnoreSpaces; + SetupAutoLoadFileWatcher(); SetupExportFileWatcher(); diff --git a/ARKBreedingStats/Properties/Settings.Designer.cs b/ARKBreedingStats/Properties/Settings.Designer.cs index 77ef1643b..5ba6ad619 100644 --- a/ARKBreedingStats/Properties/Settings.Designer.cs +++ b/ARKBreedingStats/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace ARKBreedingStats.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -2147,5 +2147,29 @@ public bool LibraryColorInfoUseFilter { this["LibraryColorInfoUseFilter"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool UseNaturalSort { + get { + return ((bool)(this["UseNaturalSort"])); + } + set { + this["UseNaturalSort"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool NaturalSortIgnoreSpaces { + get { + return ((bool)(this["NaturalSortIgnoreSpaces"])); + } + set { + this["NaturalSortIgnoreSpaces"] = value; + } + } } } diff --git a/ARKBreedingStats/Properties/Settings.settings b/ARKBreedingStats/Properties/Settings.settings index 4ce4281e2..5cad00e38 100644 --- a/ARKBreedingStats/Properties/Settings.settings +++ b/ARKBreedingStats/Properties/Settings.settings @@ -539,5 +539,11 @@ False + + True + + + False + \ No newline at end of file diff --git a/ARKBreedingStats/settings/Settings.Designer.cs b/ARKBreedingStats/settings/Settings.Designer.cs index 597697e57..9d51de510 100644 --- a/ARKBreedingStats/settings/Settings.Designer.cs +++ b/ARKBreedingStats/settings/Settings.Designer.cs @@ -45,9 +45,9 @@ private void InitializeComponent() this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.nudTamedDinoCharacterFoodDrain = new ARKBreedingStats.uiControls.Nud(); this.nudTamedDinoCharacterFoodDrainEvent = new ARKBreedingStats.uiControls.Nud(); this.label64 = new System.Windows.Forms.Label(); - this.nudTamedDinoCharacterFoodDrain = new ARKBreedingStats.uiControls.Nud(); this.nudBabyImprintAmountEvent = new ARKBreedingStats.uiControls.Nud(); this.label49 = new System.Windows.Forms.Label(); this.nudBabyImprintAmount = new ARKBreedingStats.uiControls.Nud(); @@ -326,10 +326,12 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); + this.CbNaturalSorting = new System.Windows.Forms.CheckBox(); + this.CbNaturalSortIgnoreSpaces = new System.Windows.Forms.CheckBox(); this.groupBoxMultiplier.SuspendLayout(); this.groupBox2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrainEvent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrain)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrainEvent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudBabyImprintAmountEvent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudBabyImprintAmount)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMatingSpeed)).BeginInit(); @@ -608,6 +610,30 @@ private void InitializeComponent() this.groupBox2.TabStop = false; this.groupBox2.Text = "Breeding-Multiplier"; // + // nudTamedDinoCharacterFoodDrain + // + this.nudTamedDinoCharacterFoodDrain.DecimalPlaces = 6; + this.nudTamedDinoCharacterFoodDrain.ForeColor = System.Drawing.SystemColors.WindowText; + this.nudTamedDinoCharacterFoodDrain.Location = new System.Drawing.Point(183, 227); + this.nudTamedDinoCharacterFoodDrain.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.nudTamedDinoCharacterFoodDrain.Name = "nudTamedDinoCharacterFoodDrain"; + this.nudTamedDinoCharacterFoodDrain.NeutralNumber = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nudTamedDinoCharacterFoodDrain.Size = new System.Drawing.Size(72, 20); + this.nudTamedDinoCharacterFoodDrain.TabIndex = 21; + this.nudTamedDinoCharacterFoodDrain.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // // nudTamedDinoCharacterFoodDrainEvent // this.nudTamedDinoCharacterFoodDrainEvent.DecimalPlaces = 6; @@ -641,30 +667,6 @@ private void InitializeComponent() this.label64.TabIndex = 22; this.label64.Text = "TamedDinoCharacterFoodDrainMult"; // - // nudTamedDinoCharacterFoodDrain - // - this.nudTamedDinoCharacterFoodDrain.DecimalPlaces = 6; - this.nudTamedDinoCharacterFoodDrain.ForeColor = System.Drawing.SystemColors.WindowText; - this.nudTamedDinoCharacterFoodDrain.Location = new System.Drawing.Point(183, 227); - this.nudTamedDinoCharacterFoodDrain.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this.nudTamedDinoCharacterFoodDrain.Name = "nudTamedDinoCharacterFoodDrain"; - this.nudTamedDinoCharacterFoodDrain.NeutralNumber = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.nudTamedDinoCharacterFoodDrain.Size = new System.Drawing.Size(72, 20); - this.nudTamedDinoCharacterFoodDrain.TabIndex = 21; - this.nudTamedDinoCharacterFoodDrain.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // // nudBabyImprintAmountEvent // this.nudBabyImprintAmountEvent.DecimalPlaces = 6; @@ -2277,6 +2279,8 @@ private void InitializeComponent() // // groupBox9 // + this.groupBox9.Controls.Add(this.CbNaturalSortIgnoreSpaces); + this.groupBox9.Controls.Add(this.CbNaturalSorting); this.groupBox9.Controls.Add(this.CbConsiderWastedStatsForTopCreatures); this.groupBox9.Controls.Add(this.CbPauseGrowingTimerAfterAdding); this.groupBox9.Controls.Add(this.CbLibrarySelectSelectedSpeciesOnLoad); @@ -2285,7 +2289,7 @@ private void InitializeComponent() this.groupBox9.Controls.Add(this.cbCreatureColorsLibrary); this.groupBox9.Location = new System.Drawing.Point(6, 509); this.groupBox9.Name = "groupBox9"; - this.groupBox9.Size = new System.Drawing.Size(317, 161); + this.groupBox9.Size = new System.Drawing.Size(317, 184); this.groupBox9.TabIndex = 4; this.groupBox9.TabStop = false; this.groupBox9.Text = "Library"; @@ -3453,7 +3457,7 @@ private void InitializeComponent() this.customSCCustom.Location = new System.Drawing.Point(6, 139); this.customSCCustom.Name = "customSCCustom"; this.customSCCustom.Size = new System.Drawing.Size(401, 23); - this.customSCCustom.SoundFile = null; + this.customSCCustom.SoundFile = ""; this.customSCCustom.TabIndex = 4; // // customSCWakeup @@ -3461,7 +3465,7 @@ private void InitializeComponent() this.customSCWakeup.Location = new System.Drawing.Point(6, 81); this.customSCWakeup.Name = "customSCWakeup"; this.customSCWakeup.Size = new System.Drawing.Size(401, 23); - this.customSCWakeup.SoundFile = ""; + this.customSCWakeup.SoundFile = null; this.customSCWakeup.TabIndex = 2; // // customSCBirth @@ -3469,7 +3473,7 @@ private void InitializeComponent() this.customSCBirth.Location = new System.Drawing.Point(6, 110); this.customSCBirth.Name = "customSCBirth"; this.customSCBirth.Size = new System.Drawing.Size(401, 23); - this.customSCBirth.SoundFile = ""; + this.customSCBirth.SoundFile = null; this.customSCBirth.TabIndex = 3; // // customSCStarving @@ -3477,7 +3481,7 @@ private void InitializeComponent() this.customSCStarving.Location = new System.Drawing.Point(6, 52); this.customSCStarving.Name = "customSCStarving"; this.customSCStarving.Size = new System.Drawing.Size(401, 23); - this.customSCStarving.SoundFile = null; + this.customSCStarving.SoundFile = ""; this.customSCStarving.TabIndex = 1; // // label20 @@ -4128,6 +4132,27 @@ private void InitializeComponent() this.panel1.Size = new System.Drawing.Size(758, 30); this.panel1.TabIndex = 12; // + // CbNaturalSorting + // + this.CbNaturalSorting.AutoSize = true; + this.CbNaturalSorting.Location = new System.Drawing.Point(6, 157); + this.CbNaturalSorting.Name = "CbNaturalSorting"; + this.CbNaturalSorting.Size = new System.Drawing.Size(155, 17); + this.CbNaturalSorting.TabIndex = 6; + this.CbNaturalSorting.Text = "Natural sort (e.g. 10 after 2)"; + this.CbNaturalSorting.UseVisualStyleBackColor = true; + this.CbNaturalSorting.CheckedChanged += new System.EventHandler(this.CbNaturalSorting_CheckedChanged); + // + // CbNaturalSortIgnoreSpaces + // + this.CbNaturalSortIgnoreSpaces.AutoSize = true; + this.CbNaturalSortIgnoreSpaces.Location = new System.Drawing.Point(181, 157); + this.CbNaturalSortIgnoreSpaces.Name = "CbNaturalSortIgnoreSpaces"; + this.CbNaturalSortIgnoreSpaces.Size = new System.Drawing.Size(93, 17); + this.CbNaturalSortIgnoreSpaces.TabIndex = 7; + this.CbNaturalSortIgnoreSpaces.Text = "Ignore spaces"; + this.CbNaturalSortIgnoreSpaces.UseVisualStyleBackColor = true; + // // Settings // this.AcceptButton = this.buttonOK; @@ -4148,8 +4173,8 @@ private void InitializeComponent() this.groupBoxMultiplier.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrainEvent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrain)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudTamedDinoCharacterFoodDrainEvent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudBabyImprintAmountEvent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudBabyImprintAmount)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMatingSpeed)).EndInit(); @@ -4585,5 +4610,7 @@ private void InitializeComponent() private uiControls.Nud nudTamedDinoCharacterFoodDrainEvent; private System.Windows.Forms.Label label64; private uiControls.Nud nudTamedDinoCharacterFoodDrain; + private System.Windows.Forms.CheckBox CbNaturalSortIgnoreSpaces; + private System.Windows.Forms.CheckBox CbNaturalSorting; } } \ No newline at end of file diff --git a/ARKBreedingStats/settings/Settings.cs b/ARKBreedingStats/settings/Settings.cs index 255fbf2d1..a1ccea34b 100644 --- a/ARKBreedingStats/settings/Settings.cs +++ b/ARKBreedingStats/settings/Settings.cs @@ -327,6 +327,9 @@ private void LoadSettings(CreatureCollection cc) CbLibrarySelectSelectedSpeciesOnLoad.Checked = Properties.Settings.Default.LibrarySelectSelectedSpeciesOnLoad; cbLibraryHighlightTopCreatures.Checked = Properties.Settings.Default.LibraryHighlightTopCreatures; CbConsiderWastedStatsForTopCreatures.Checked = Properties.Settings.Default.ConsiderWastedStatsForTopCreatures; + CbNaturalSorting.Checked = Properties.Settings.Default.UseNaturalSort; + CbNaturalSortIgnoreSpaces.Enabled = Properties.Settings.Default.UseNaturalSort; + CbNaturalSortIgnoreSpaces.Checked = Properties.Settings.Default.NaturalSortIgnoreSpaces; #endregion @@ -560,6 +563,8 @@ private void SaveSettings() Properties.Settings.Default.LibrarySelectSelectedSpeciesOnLoad = CbLibrarySelectSelectedSpeciesOnLoad.Checked; Properties.Settings.Default.LibraryHighlightTopCreatures = cbLibraryHighlightTopCreatures.Checked; Properties.Settings.Default.ConsiderWastedStatsForTopCreatures = CbConsiderWastedStatsForTopCreatures.Checked; + Properties.Settings.Default.UseNaturalSort = CbNaturalSorting.Checked; + Properties.Settings.Default.NaturalSortIgnoreSpaces = CbNaturalSortIgnoreSpaces.Checked; #endregion @@ -1505,5 +1510,13 @@ private void CbbInfoGraphicFontName_SelectedIndexChanged(object sender, EventArg } #endregion + + private void CbNaturalSorting_CheckedChanged(object sender, EventArgs e) + { + var isChecked = ((CheckBox)sender).Checked; + if (!isChecked) + CbNaturalSortIgnoreSpaces.Checked = false; + CbNaturalSortIgnoreSpaces.Enabled = isChecked; + } } } diff --git a/ARKBreedingStats/settings/Settings.resx b/ARKBreedingStats/settings/Settings.resx index 21260f88c..f1fb305ab 100644 --- a/ARKBreedingStats/settings/Settings.resx +++ b/ARKBreedingStats/settings/Settings.resx @@ -133,18 +133,6 @@ You can also select the text of the settings and drag&&drop the selectio 17, 17 - - True - - - True - - - True - - - 17, 17 - The creature data can be directly imported from the save-game, if you have access to that. This is also possible via an ftp-adress. If you set the according files below, you can start the process automatically from the file-menu. @@ -161,18 +149,6 @@ If you set the according files below, you can start the process automatically fr 262, 17 - - True - - - True - - - True - - - 262, 17 - In ARK you can export a creature (hold use while looking at a creature, then choose "Options" - "Export" from the wheel). Note: Parents and the mutations count are only exported and imported if you have opened the ancestor tab of the creature before the export! diff --git a/ARKBreedingStats/utils/CreatureListSorter.cs b/ARKBreedingStats/utils/CreatureListSorter.cs index 5556c4263..c05c31d68 100644 --- a/ARKBreedingStats/utils/CreatureListSorter.cs +++ b/ARKBreedingStats/utils/CreatureListSorter.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using System.Text; using System.Windows.Forms; using ARKBreedingStats.Library; using ARKBreedingStats.species; @@ -35,7 +37,7 @@ public class CreatureListSorter public bool UseNaturalSort { get; set; } = false; /// - /// Whether to ignore spaces between words. This option is only relevant whern using natural sort. + /// Whether to ignore spaces between words. This option is only relevant when using natural sort. /// public bool IgnoreSpacesBetweenWords { get; set; } = false;