1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-02-20 06:29:04 +00:00

Save & restore symbols list filter options

This commit is contained in:
Andy McFadden 2019-07-16 14:52:08 -07:00
parent b42aa80cff
commit 310ed7649b
3 changed files with 91 additions and 35 deletions

View File

@ -441,21 +441,19 @@ namespace SourceGenWPF {
} }
} }
#if false
// Configure the Symbols window. // Configure the Symbols window.
symbolUserCheckBox.Checked = mMainWin.SymFilterUserLabels =
settings.GetBool(AppSettings.SYMWIN_SHOW_USER, false); settings.GetBool(AppSettings.SYMWIN_SHOW_USER, false);
symbolAutoCheckBox.Checked = mMainWin.SymFilterAutoLabels =
settings.GetBool(AppSettings.SYMWIN_SHOW_AUTO, false); settings.GetBool(AppSettings.SYMWIN_SHOW_AUTO, false);
symbolProjectCheckBox.Checked = mMainWin.SymFilterProjectSymbols =
settings.GetBool(AppSettings.SYMWIN_SHOW_PROJECT, false); settings.GetBool(AppSettings.SYMWIN_SHOW_PROJECT, false);
symbolPlatformCheckBox.Checked = mMainWin.SymFilterPlatformSymbols =
settings.GetBool(AppSettings.SYMWIN_SHOW_PLATFORM, false); settings.GetBool(AppSettings.SYMWIN_SHOW_PLATFORM, false);
symbolConstantCheckBox.Checked = mMainWin.SymFilterConstants =
settings.GetBool(AppSettings.SYMWIN_SHOW_CONST, false); settings.GetBool(AppSettings.SYMWIN_SHOW_CONST, false);
symbolAddressCheckBox.Checked = mMainWin.SymFilterAddresses =
settings.GetBool(AppSettings.SYMWIN_SHOW_ADDR, false); settings.GetBool(AppSettings.SYMWIN_SHOW_ADDR, false);
#endif
// Get the configured font info. If nothing is configured, use whatever the // Get the configured font info. If nothing is configured, use whatever the
// code list happens to be using now. // code list happens to be using now.

View File

@ -583,18 +583,18 @@ limitations under the License.
</Grid.RowDefinitions> </Grid.RowDefinitions>
<WrapPanel Grid.Row="0"> <WrapPanel Grid.Row="0">
<ToggleButton Name="symUserLabels" Content="User" Width="40" Margin="2,2" <ToggleButton Content="User" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterUserLabels}"/>
<ToggleButton Name="symProjectSymbols" Content="Proj" Width="40" Margin="2,2" <ToggleButton Content="Proj" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterProjectSymbols}"/>
<ToggleButton Name="symPlatformSymbols" Content="Plat" Width="40" Margin="2,2" <ToggleButton Content="Plat" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterPlatformSymbols}"/>
<ToggleButton Name="symAutoLabels" Content="Auto" Width="40" Margin="2,2" <ToggleButton Content="Auto" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterAutoLabels}"/>
<ToggleButton Name="symAddresses" Content="Addr" Width="40" Margin="2,2" <ToggleButton Content="Addr" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterAddresses}"/>
<ToggleButton Name="symConstants" Content="Cnst" Width="40" Margin="2,2" <ToggleButton Content="Cnst" Width="40" Margin="2,2"
Checked="SymbolsListFilter_Changed" Unchecked="SymbolsListFilter_Changed"/> IsChecked="{Binding SymFilterConstants}"/>
</WrapPanel> </WrapPanel>
<DataGrid Grid.Row="1" Name="symbolsGrid" <DataGrid Grid.Row="1" Name="symbolsGrid"

View File

@ -62,10 +62,7 @@ namespace SourceGenWPF.WpfGui {
/// </remarks> /// </remarks>
public double LongCommentWidth { public double LongCommentWidth {
get { return mLongCommentWidth; } get { return mLongCommentWidth; }
set { set { mLongCommentWidth = value; OnPropertyChanged(); }
mLongCommentWidth = value;
OnPropertyChanged();
}
} }
private double mLongCommentWidth; private double mLongCommentWidth;
@ -74,12 +71,74 @@ namespace SourceGenWPF.WpfGui {
/// </summary> /// </summary>
public bool ShowDebugMenu { public bool ShowDebugMenu {
get { return mShowDebugMenu; } get { return mShowDebugMenu; }
set { mShowDebugMenu = value; OnPropertyChanged(); }
}
bool mShowDebugMenu;
//
// Symbols list filter options.
//
public bool SymFilterUserLabels {
get { return mSymFilterUserLabels; }
set { set {
mShowDebugMenu = value; mSymFilterUserLabels = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_USER, value);
SymbolsListFilterChanged();
OnPropertyChanged(); OnPropertyChanged();
} }
} }
bool mShowDebugMenu; private bool mSymFilterUserLabels;
public bool SymFilterProjectSymbols {
get { return mSymFilterProjectSymbols; }
set {
mSymFilterProjectSymbols = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_PROJECT, value);
SymbolsListFilterChanged();
OnPropertyChanged();
}
}
private bool mSymFilterProjectSymbols;
public bool SymFilterPlatformSymbols {
get { return mSymFilterPlatformSymbols; }
set {
mSymFilterPlatformSymbols = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_PLATFORM, value);
SymbolsListFilterChanged();
OnPropertyChanged();
}
}
private bool mSymFilterPlatformSymbols;
public bool SymFilterAutoLabels {
get { return mSymFilterAutoLabels; }
set {
mSymFilterAutoLabels = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_AUTO, value);
SymbolsListFilterChanged();
OnPropertyChanged();
}
}
private bool mSymFilterAutoLabels;
public bool SymFilterAddresses {
get { return mSymFilterAddresses; }
set {
mSymFilterAddresses = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_ADDR, value);
SymbolsListFilterChanged();
OnPropertyChanged();
}
}
private bool mSymFilterAddresses;
public bool SymFilterConstants {
get { return mSymFilterConstants; }
set {
mSymFilterConstants = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_CONST, value);
SymbolsListFilterChanged();
OnPropertyChanged();
}
}
private bool mSymFilterConstants;
/// <summary> /// <summary>
/// Reference to controller object. /// Reference to controller object.
@ -1360,12 +1419,12 @@ namespace SourceGenWPF.WpfGui {
if (sli == null) { if (sli == null) {
return; return;
} }
if ((symUserLabels.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.User) || if ((SymFilterUserLabels != true && sli.Sym.SymbolSource == Symbol.Source.User) ||
(symProjectSymbols.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Project) || (SymFilterProjectSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Project) ||
(symPlatformSymbols.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Platform) || (SymFilterPlatformSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Platform) ||
(symAutoLabels.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Auto) || (SymFilterAutoLabels != true && sli.Sym.SymbolSource == Symbol.Source.Auto) ||
(symConstants.IsChecked != true && sli.Sym.SymbolType == Symbol.Type.Constant) || (SymFilterAddresses != true && sli.Sym.SymbolType != Symbol.Type.Constant) ||
(symAddresses.IsChecked != true && sli.Sym.SymbolType != Symbol.Type.Constant)) (SymFilterConstants != true && sli.Sym.SymbolType == Symbol.Type.Constant))
{ {
e.Accepted = false; e.Accepted = false;
} else { } else {
@ -1374,10 +1433,9 @@ namespace SourceGenWPF.WpfGui {
} }
/// <summary> /// <summary>
/// Refreshes the symbols list when a filter option changes. Set this to be called /// Refreshes the symbols list when a filter option changes.
/// for Checked/Unchecked events on the filter option buttons.
/// </summary> /// </summary>
private void SymbolsListFilter_Changed(object sender, RoutedEventArgs e) { private void SymbolsListFilterChanged() {
// This delightfully obscure call causes the list to refresh. See // This delightfully obscure call causes the list to refresh. See
// https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control // https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control
CollectionViewSource.GetDefaultView(symbolsGrid.ItemsSource).Refresh(); CollectionViewSource.GetDefaultView(symbolsGrid.ItemsSource).Refresh();