Skip to content

Commit

Permalink
default torpidity mutation column to 0 width
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Dec 22, 2023
1 parent 3a3033e commit c9e8b90
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using ARKBreedingStats.importExportGun;
using ARKBreedingStats.library;
using ARKBreedingStats.settings;

Expand Down Expand Up @@ -2093,8 +2094,15 @@ private void ResetColumnWidthListViewLibrary(bool mutationColumnWidthsZero)
: ci < ColumnIndexFirstStat || ci >= ColumnIndexPostColor ? 60
: ci >= ColumnIndexFirstStat + Stats.StatsCount + Stats.StatsCount ? 30 // color
: ci < ColumnIndexFirstStat + Stats.StatsCount ? statWidths[ci - ColumnIndexFirstStat] // wild levels
: ci - ColumnIndexFirstStat - Stats.StatsCount == Stats.Torpidity ? 0 // no mutations for torpidity
: (int)(statWidths[ci - ColumnIndexFirstStat - Stats.StatsCount] * 1.24); // mutated needs space for one more letter

// save in settings so it can be used when toggle the mutation columns, which use the settings
var widths = new int[listViewLibrary.Columns.Count];
for (int c = 0; c < widths.Length; c++)
widths[c] = listViewLibrary.Columns[c].Width;
Properties.Settings.Default.columnWidths = widths;

if (mutationColumnWidthsZero)
LibraryColumnsMutationsWidth(true);

Expand All @@ -2107,7 +2115,7 @@ private void ResetColumnWidthListViewLibrary(bool mutationColumnWidthsZero)
private void LibraryColumnsMutationsWidth(bool collapse)
{
listViewLibrary.BeginUpdate();
var statWidths = Stats.UsuallyVisibleStats.Select(w => !collapse && w ? 38 : 0).ToArray();
var statWidths = Stats.UsuallyVisibleStats.Select((v, i) => !collapse && v && i != Stats.Torpidity ? 37 : 0).ToArray();
for (int c = 0; c < Stats.StatsCount; c++)
{
listViewLibrary.Columns[c + ColumnIndexFirstStat + Stats.StatsCount].Width = statWidths[c];
Expand All @@ -2129,7 +2137,7 @@ private void ShowLibraryMutationLevels(bool show)
{
var widths = Properties.Settings.Default.columnWidths;
if (widths == null || widths.Length < ColumnIndexFirstStat + 2 * Stats.StatsCount) return;

listViewLibrary.BeginUpdate();
if (show)
{
Expand Down

0 comments on commit c9e8b90

Please sign in to comment.