Skip to content

Commit

Permalink
UI for natural sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Mar 11, 2023
1 parent 6750a72 commit 58dab70
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 58 deletions.
6 changes: 6 additions & 0 deletions ARKBreedingStats/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@
<setting name="LibraryColorInfoUseFilter" serializeAs="String">
<value>False</value>
</setting>
<setting name="UseNaturalSort" serializeAs="String">
<value>True</value>
</setting>
<setting name="NaturalSortIgnoreSpaces" serializeAs="String">
<value>False</value>
</setting>
</ARKBreedingStats.Properties.Settings>
</userSettings>
</configuration>
6 changes: 6 additions & 0 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();

Expand Down
26 changes: 25 additions & 1 deletion ARKBreedingStats/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ARKBreedingStats/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -539,5 +539,11 @@
<Setting Name="LibraryColorInfoUseFilter" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="UseNaturalSort" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="NaturalSortIgnoreSpaces" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
91 changes: 59 additions & 32 deletions ARKBreedingStats/settings/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ARKBreedingStats/settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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;
}
}
}
24 changes: 0 additions & 24 deletions ARKBreedingStats/settings/Settings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,6 @@ You can also select the text of the settings and drag&amp;&amp;drop the selectio
<metadata name="aTImportFileLocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dgvFileLocation_Change.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ImportWithQuickImport.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dgvFileLocation_Delete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="aTImportFileLocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="label24.Text" xml:space="preserve">
<value>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.</value>
Expand All @@ -161,18 +149,6 @@ If you set the according files below, you can start the process automatically fr
<metadata name="aTExportFolderLocationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<metadata name="dgvExportFolderChange.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dgvExportFolderDelete.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dgvExportMakeDefault.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="aTExportFolderLocationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>262, 17</value>
</metadata>
<data name="label25.Text" xml:space="preserve">
<value>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!
Expand Down
4 changes: 3 additions & 1 deletion ARKBreedingStats/utils/CreatureListSorter.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -35,7 +37,7 @@ public class CreatureListSorter
public bool UseNaturalSort { get; set; } = false;

/// <summary>
/// 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.
/// </summary>
public bool IgnoreSpacesBetweenWords { get; set; } = false;

Expand Down

0 comments on commit 58dab70

Please sign in to comment.