1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +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.
symbolUserCheckBox.Checked =
mMainWin.SymFilterUserLabels =
settings.GetBool(AppSettings.SYMWIN_SHOW_USER, false);
symbolAutoCheckBox.Checked =
mMainWin.SymFilterAutoLabels =
settings.GetBool(AppSettings.SYMWIN_SHOW_AUTO, false);
symbolProjectCheckBox.Checked =
mMainWin.SymFilterProjectSymbols =
settings.GetBool(AppSettings.SYMWIN_SHOW_PROJECT, false);
symbolPlatformCheckBox.Checked =
mMainWin.SymFilterPlatformSymbols =
settings.GetBool(AppSettings.SYMWIN_SHOW_PLATFORM, false);
symbolConstantCheckBox.Checked =
mMainWin.SymFilterConstants =
settings.GetBool(AppSettings.SYMWIN_SHOW_CONST, false);
symbolAddressCheckBox.Checked =
mMainWin.SymFilterAddresses =
settings.GetBool(AppSettings.SYMWIN_SHOW_ADDR, false);
#endif
// Get the configured font info. If nothing is configured, use whatever the
// code list happens to be using now.

View File

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

View File

@ -62,10 +62,7 @@ namespace SourceGenWPF.WpfGui {
/// </remarks>
public double LongCommentWidth {
get { return mLongCommentWidth; }
set {
mLongCommentWidth = value;
OnPropertyChanged();
}
set { mLongCommentWidth = value; OnPropertyChanged(); }
}
private double mLongCommentWidth;
@ -74,12 +71,74 @@ namespace SourceGenWPF.WpfGui {
/// </summary>
public bool ShowDebugMenu {
get { return mShowDebugMenu; }
set { mShowDebugMenu = value; OnPropertyChanged(); }
}
bool mShowDebugMenu;
//
// Symbols list filter options.
//
public bool SymFilterUserLabels {
get { return mSymFilterUserLabels; }
set {
mShowDebugMenu = value;
mSymFilterUserLabels = value;
AppSettings.Global.SetBool(AppSettings.SYMWIN_SHOW_USER, value);
SymbolsListFilterChanged();
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>
/// Reference to controller object.
@ -1360,12 +1419,12 @@ namespace SourceGenWPF.WpfGui {
if (sli == null) {
return;
}
if ((symUserLabels.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.User) ||
(symProjectSymbols.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Project) ||
(symPlatformSymbols.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Platform) ||
(symAutoLabels.IsChecked != true && sli.Sym.SymbolSource == Symbol.Source.Auto) ||
(symConstants.IsChecked != true && sli.Sym.SymbolType == Symbol.Type.Constant) ||
(symAddresses.IsChecked != true && sli.Sym.SymbolType != Symbol.Type.Constant))
if ((SymFilterUserLabels != true && sli.Sym.SymbolSource == Symbol.Source.User) ||
(SymFilterProjectSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Project) ||
(SymFilterPlatformSymbols != true && sli.Sym.SymbolSource == Symbol.Source.Platform) ||
(SymFilterAutoLabels != true && sli.Sym.SymbolSource == Symbol.Source.Auto) ||
(SymFilterAddresses != true && sli.Sym.SymbolType != Symbol.Type.Constant) ||
(SymFilterConstants != true && sli.Sym.SymbolType == Symbol.Type.Constant))
{
e.Accepted = false;
} else {
@ -1374,10 +1433,9 @@ namespace SourceGenWPF.WpfGui {
}
/// <summary>
/// Refreshes the symbols list when a filter option changes. Set this to be called
/// for Checked/Unchecked events on the filter option buttons.
/// Refreshes the symbols list when a filter option changes.
/// </summary>
private void SymbolsListFilter_Changed(object sender, RoutedEventArgs e) {
private void SymbolsListFilterChanged() {
// 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
CollectionViewSource.GetDefaultView(symbolsGrid.ItemsSource).Refresh();