1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-01-31 13:30:08 +00:00

Make the codeListView column-width setting work like the others

Don't serialize on every column change, just mark app settings as
"dirty" and box it up before writing the settings file.
This commit is contained in:
Andy McFadden 2018-10-11 17:19:09 -07:00
parent 2b6a76fad0
commit e8d7057c2f
2 changed files with 4 additions and 7 deletions

View File

@ -82,7 +82,7 @@ namespace SourceGen.AppForms {
mInitialTab = initialTab;
// Make a work copy, so we can discard changes if the user cancels out of the dialog.
projectView.SaveCodeListColumnWidths();
projectView.SerializeCodeListColumnWidths();
mSettings = AppSettings.Global.GetCopy();
// Put buttons in an array.

View File

@ -402,6 +402,7 @@ namespace SourceGen.AppForms {
AppSettings.Global.SetBool(AppSettings.MAIN_WINDOW_MAXIMIZED, false);
}
SerializeCodeListColumnWidths();
SerializeReferencesColumnWidths();
SerializeNotesColumnWidths();
SerializeSymbolColumnWidths();
@ -3369,7 +3370,7 @@ namespace SourceGen.AppForms {
/// Saves the code list column widths into AppSettings.
/// </summary>
/// <returns></returns>
public void SaveCodeListColumnWidths() {
public void SerializeCodeListColumnWidths() {
CodeListColumnWidths widths = new CodeListColumnWidths();
for (int i = 0; i < CodeListColumnWidths.NUM_COLUMNS; i++) {
widths.Width[i] = codeListView.Columns[i].Width;
@ -3391,11 +3392,7 @@ namespace SourceGen.AppForms {
private void codeListView_ColumnWidthChanged(object sender,
ColumnWidthChangedEventArgs e) {
//Debug.WriteLine("Column width changed: " + e.ColumnIndex);
// This fires during initial setup when things don't have widths. A little
// risky to save the widths off now; would be safer to do it right before we write
// the settings file.
SaveCodeListColumnWidths();
AppSettings.Global.Dirty = true;
}
private void codeListView_DrawColumnHeader(object sender,