From 7bed043869025a6d88d2b7b80ef367a06adf98f8 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sun, 12 May 2019 16:27:28 -0700 Subject: [PATCH] Tweak code list view Still not right, but it's at least you can tell which lines are selected now. I never thought I'd miss owner-drawn ListViews. I was mistaken. Yay WPF. --- SourceGenWPF/DisplayList.cs | 8 +- SourceGenWPF/ProjWin/MainWindow.xaml | 128 +++++++++++++----------- SourceGenWPF/ProjWin/MainWindow.xaml.cs | 4 + 3 files changed, 76 insertions(+), 64 deletions(-) diff --git a/SourceGenWPF/DisplayList.cs b/SourceGenWPF/DisplayList.cs index 3a9f8c3..bb88081 100644 --- a/SourceGenWPF/DisplayList.cs +++ b/SourceGenWPF/DisplayList.cs @@ -284,7 +284,7 @@ namespace SourceGenWPF { return FormattedParts.Create("off" + index, "addr" + index, "12 34", "vncidmx", "", "yup:", "LDA", "$1234", "a & b"); } else { - return FormattedParts.Create("offN This is a long comment line"); + return FormattedParts.Create("yup: This is a long comment line"); } } @@ -298,7 +298,7 @@ namespace SourceGenWPF { public string Opcode { get; private set; } public string Operand { get; private set; } public string Comment { get; private set; } - public bool SingleLine { get; private set; } + public bool IsSingleLine { get; private set; } // Construct with factory methods. private FormattedParts() { } @@ -316,7 +316,7 @@ namespace SourceGenWPF { parts.Opcode = opcode; parts.Operand = operand; parts.Comment = comment; - parts.SingleLine = false; + parts.IsSingleLine = false; return parts; } @@ -324,7 +324,7 @@ namespace SourceGenWPF { public static FormattedParts Create(string longComment) { FormattedParts parts = new FormattedParts(); parts.Comment = longComment; - parts.SingleLine = true; + parts.IsSingleLine = true; return parts; } diff --git a/SourceGenWPF/ProjWin/MainWindow.xaml b/SourceGenWPF/ProjWin/MainWindow.xaml index 9fad321..d18a222 100644 --- a/SourceGenWPF/ProjWin/MainWindow.xaml +++ b/SourceGenWPF/ProjWin/MainWindow.xaml @@ -38,6 +38,72 @@ limitations under the License. + + + @@ -215,27 +281,11 @@ limitations under the License. - + VirtualizingStackPanel.VirtualizationMode="Recycling" + ItemContainerStyle="{StaticResource codeListViewItemStyle}" SelectionChanged="CodeListView_SelectionChanged"> @@ -250,48 +300,6 @@ limitations under the License. - - - - - diff --git a/SourceGenWPF/ProjWin/MainWindow.xaml.cs b/SourceGenWPF/ProjWin/MainWindow.xaml.cs index 81cd93e..487758e 100644 --- a/SourceGenWPF/ProjWin/MainWindow.xaml.cs +++ b/SourceGenWPF/ProjWin/MainWindow.xaml.cs @@ -121,5 +121,9 @@ namespace SourceGenWPF.ProjWin { Debug.WriteLine("Recent project #" + recentIndex); mUI.OpenRecentProject(recentIndex); } + + private void CodeListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { + Debug.WriteLine("SEL: add " + e.AddedItems.Count + ", rem " + e.RemovedItems.Count); + } } }