Skip to content

Commit

Permalink
Added option to disable auto-sort
Browse files Browse the repository at this point in the history
Added a "more settings" group box and  a textbox do disable auto-sort.
  • Loading branch information
DasSkelett committed Apr 2, 2018
1 parent a02a3b1 commit 71ffb5c
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 62 deletions.
2 changes: 2 additions & 0 deletions GUI/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Configuration
public bool RefreshOnStartup = true; // Defaults to true, so everyone is forced to refresh on first start
public bool RefreshOnStartupNoNag = false;

public bool AutoSortByUpdate = true;

public int ActiveFilter = 0;

// Sort by the mod name (index = 2) column by default
Expand Down
29 changes: 18 additions & 11 deletions GUI/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,20 +477,27 @@ private void MarkAllUpdatesToolButton_Click(object sender, EventArgs e)
}
}

// set new sort column
var new_sort_column = ModList.Columns[1];
var current_sort_column = ModList.Columns[configuration.SortByColumnIndex];

// Reset the glyph.
current_sort_column.HeaderCell.SortGlyphDirection = SortOrder.None;
configuration.SortByColumnIndex = new_sort_column.Index;
UpdateFilters(this);
// only sort by Update column if checkbox in settings checked
if (Main.Instance.configuration.AutoSortByUpdate)
{
// set new sort column
var new_sort_column = ModList.Columns[1];
var current_sort_column = ModList.Columns[configuration.SortByColumnIndex];

// Reset the glyph.
current_sort_column.HeaderCell.SortGlyphDirection = SortOrder.None;
configuration.SortByColumnIndex = new_sort_column.Index;
UpdateFilters(this);

// Selects the top row and scrolls the list to it.
DataGridViewCell cell = ModList.Rows[0].Cells[2];
ModList.CurrentCell = cell;

}

ModList.Refresh();

// Selects the top/bottom row and scrolls the list to it.
DataGridViewCell cell = ModList.Rows[0].Cells[2];
ModList.CurrentCell = cell;

}

public void UpdateModContentsTree(CkanModule module, bool force = false)
Expand Down
131 changes: 80 additions & 51 deletions GUI/SettingsDialog.Designer.cs

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

Loading

0 comments on commit 71ffb5c

Please sign in to comment.