1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +00:00

Work around minor column width update issue

If you changed the width of a column, and then clicked the "toggle
display of cycle counts" button in the toolbar, the column width
would revert.  The problem appears unique to that toolbar button,
so for now the fix is localized there.  The more general fix is to
ensure that column width changes don't get stomped, but that's a
larger change.
This commit is contained in:
Andy McFadden 2021-06-03 15:03:22 -07:00
parent 6db18cc1df
commit 011181d848

View File

@ -94,6 +94,13 @@ namespace SourceGen.WpfGui {
// avoid an infinite loop. We need to be called to keep the toolbar in sync.
bool curVal = AppSettings.Global.GetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, false);
if (curVal != value) {
// TODO: this works around a bug where, if you change the column widths and
// then click the toolbar button, the widths revert. The basic problem is
// that we don't pull the widths into the settings object until we try to
// save the settings file, so ApplyAppSettings() is restoring the values from
// the AppSettings object. Need to fix this more robustly.
CaptureColumnWidths();
AppSettings.Global.SetBool(AppSettings.FMT_SHOW_CYCLE_COUNTS, value);
mMainCtrl.ApplyAppSettings();
}
@ -181,15 +188,16 @@ namespace SourceGen.WpfGui {
heightDesc.AddValueChanged(leftPanel.RowDefinitions[0], GridSizeChanged);
heightDesc.AddValueChanged(rightPanel.RowDefinitions[0], GridSizeChanged);
// Add events that fire when column headers change size. We want this for
// the DataGrids and the main ListView.
// Add events that fire when column headers change size. Set this up for
// the DataGrids in the side windows.
PropertyDescriptor pd = DependencyPropertyDescriptor.FromProperty(
DataGridColumn.ActualWidthProperty, typeof(DataGridColumn));
AddColumnWidthChangeCallback(pd, referencesGrid);
AddColumnWidthChangeCallback(pd, notesGrid);
AddColumnWidthChangeCallback(pd, symbolsGrid);
// Same for the ListView. cf. https://stackoverflow.com/a/56694219/294248
// Also set this up for the column headers in the main ListView.
// cf. https://stackoverflow.com/a/56694219/294248
pd = DependencyPropertyDescriptor.FromProperty(
GridViewColumn.WidthProperty, typeof(GridViewColumn));
AddColumnWidthChangeCallback(pd, (GridView)codeListView.View);