mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-07 14:31:00 +00:00
Refactor DisplayList to support data virtualization
In WinForms, if you want a virtual ListView, you set the "virtual" property and define a couple of callbacks. In WPF, there are separate notions of "UI virtualization" and "data virtualization". The former is done automatically (usually) by the ListView. The latter requires creating an implementation of IList, and relies on behavior that I'm having trouble finding in official documentation. Yay WPF. This splits the source-generation stuff out into DisplayListGen, leaving DisplayList as a list of stuff to display that can be bound to WPF as a ListView ItemsSource. The DisplayList instance will have a hook back into DisplayListGen to perform the on-demand string rendering. (For now it's just generating test patterns.)
This commit is contained in:
parent
d830605f5e
commit
f3f4c44633
File diff suppressed because it is too large
Load Diff
1223
SourceGenWPF/DisplayListGen.cs
Normal file
1223
SourceGenWPF/DisplayListGen.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -65,7 +65,7 @@ namespace SourceGenWPF {
|
||||
/// <summary>
|
||||
/// Data backing the codeListView.
|
||||
/// </summary>
|
||||
private DisplayList mDisplayList;
|
||||
private DisplayListGen mDisplayList;
|
||||
|
||||
#endregion Project state
|
||||
|
||||
@ -519,7 +519,7 @@ namespace SourceGenWPF {
|
||||
proj.Initialize(fileData.Length);
|
||||
proj.PrepForNew(fileData, Path.GetFileName(dataPathName));
|
||||
|
||||
proj.LongComments.Add(DisplayList.Line.HEADER_COMMENT_OFFSET,
|
||||
proj.LongComments.Add(DisplayListGen.Line.HEADER_COMMENT_OFFSET,
|
||||
new MultiLineComment("6502bench SourceGen v" + App.ProgramVersion));
|
||||
|
||||
// The system definition provides a set of defaults that can be overridden.
|
||||
@ -540,7 +540,7 @@ namespace SourceGenWPF {
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
mDisplayList = new DisplayList(mProject, mOutputFormatter, mPseudoOpNames);
|
||||
mDisplayList = new DisplayListGen(mProject, mOutputFormatter, mPseudoOpNames);
|
||||
|
||||
// Prep the symbol table subset object. Replace the old one with a new one.
|
||||
//mSymbolSubset = new SymbolTableSubset(mProject.SymbolTable);
|
||||
@ -625,7 +625,7 @@ namespace SourceGenWPF {
|
||||
int topItem = 0;
|
||||
#endif
|
||||
int topOffset = mDisplayList[topItem].FileOffset;
|
||||
DisplayList.SavedSelection savedSel = DisplayList.SavedSelection.Generate(
|
||||
DisplayListGen.SavedSelection savedSel = DisplayListGen.SavedSelection.Generate(
|
||||
mDisplayList, mCodeViewSelection, topOffset);
|
||||
//savedSel.DebugDump();
|
||||
mReanalysisTimer.EndTask("Save selection");
|
||||
|
@ -220,15 +220,15 @@ limitations under the License.
|
||||
Visibility="{Binding Path=CodeListVisibility}">
|
||||
<ListView.View>
|
||||
<GridView AllowsColumnReorder="False">
|
||||
<GridViewColumn Header="Offset"/>
|
||||
<GridViewColumn Header="Addr"/>
|
||||
<GridViewColumn Header="Bytes"/>
|
||||
<GridViewColumn Header="Flags"/>
|
||||
<GridViewColumn Header="Attr"/>
|
||||
<GridViewColumn Header="Label"/>
|
||||
<GridViewColumn Header="Opcode"/>
|
||||
<GridViewColumn Header="Operand"/>
|
||||
<GridViewColumn Header="Comment"/>
|
||||
<GridViewColumn Header="Offset" DisplayMemberBinding="{Binding Offset}"/>
|
||||
<GridViewColumn Header="Addr" DisplayMemberBinding="{Binding Addr}"/>
|
||||
<GridViewColumn Header="Bytes" DisplayMemberBinding="{Binding Bytes}"/>
|
||||
<GridViewColumn Header="Flags" DisplayMemberBinding="{Binding Flags}"/>
|
||||
<GridViewColumn Header="Attr" DisplayMemberBinding="{Binding Attr}"/>
|
||||
<GridViewColumn Header="Label" DisplayMemberBinding="{Binding Label}"/>
|
||||
<GridViewColumn Header="Opcode" DisplayMemberBinding="{Binding Opcode}"/>
|
||||
<GridViewColumn Header="Operand" DisplayMemberBinding="{Binding Operand}"/>
|
||||
<GridViewColumn Header="Comment" DisplayMemberBinding="{Binding Comment}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
@ -45,6 +45,8 @@ namespace SourceGenWPF.ProjWin {
|
||||
|
||||
this.DataContext = this;
|
||||
mUI = new MainController(this);
|
||||
|
||||
codeListView.ItemsSource = new DisplayList(500);
|
||||
}
|
||||
|
||||
|
||||
|
@ -721,7 +721,7 @@ namespace SourceGenWPF {
|
||||
// Shouldn't allow DisplayList.Line.HEADER_COMMENT_OFFSET on anything but
|
||||
// LongComment. Maybe "bool allowNegativeKeys"?
|
||||
if (intKey < fileLen &&
|
||||
(intKey >= 0 || intKey == DisplayList.Line.HEADER_COMMENT_OFFSET)) {
|
||||
(intKey >= 0 || intKey == DisplayListGen.Line.HEADER_COMMENT_OFFSET)) {
|
||||
return true;
|
||||
} else {
|
||||
report.Add(FileLoadItem.Type.Warning,
|
||||
|
@ -62,6 +62,7 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DisplayList.cs" />
|
||||
<Compile Include="MainController.cs" />
|
||||
<Compile Include="ProjWin\DataFileLoadIssue.xaml.cs">
|
||||
<DependentUpon>DataFileLoadIssue.xaml</DependentUpon>
|
||||
@ -96,7 +97,7 @@
|
||||
<Compile Include="DataAnalysis.cs" />
|
||||
<Compile Include="DefSymbol.cs" />
|
||||
<Compile Include="DisasmProject.cs" />
|
||||
<Compile Include="DisplayList.cs" />
|
||||
<Compile Include="DisplayListGen.cs" />
|
||||
<Compile Include="ExternalFile.cs" />
|
||||
<Compile Include="FormatDescriptor.cs" />
|
||||
<Compile Include="HelpAccess.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user