diff --git a/Src/BlueDotBrigade.Weevil.Common/IRegionManager.cs b/Src/BlueDotBrigade.Weevil.Common/IRegionManager.cs
index 72129523..fd42d615 100644
--- a/Src/BlueDotBrigade.Weevil.Common/IRegionManager.cs
+++ b/Src/BlueDotBrigade.Weevil.Common/IRegionManager.cs
@@ -15,5 +15,11 @@ public interface IRegionManager
void MarkEnd(int lineNumber);
void MarkStart(int lineNumber);
+
+ bool StartsWith(int lineNumber);
+
+ bool EndsWith(int lineNumber);
+
+ public bool Contains(int lineNumber);
}
}
\ No newline at end of file
diff --git a/Src/BlueDotBrigade.Weevil.Core/RegionManager.cs b/Src/BlueDotBrigade.Weevil.Core/RegionManager.cs
index ae755a5c..ba2e3169 100644
--- a/Src/BlueDotBrigade.Weevil.Core/RegionManager.cs
+++ b/Src/BlueDotBrigade.Weevil.Core/RegionManager.cs
@@ -103,6 +103,21 @@ public void MarkEnd(int lineNumber)
}
}
+ public bool StartsWith(int lineNumber)
+ {
+ return _regions.Any(r => r.Minimum.LineNumber == lineNumber);
+ }
+
+ public bool EndsWith(int lineNumber)
+ {
+ return _regions.Any(r => r.Maximum.LineNumber == lineNumber);
+ }
+
+ public bool Contains(int lineNumber)
+ {
+ return _regions.Any(r => r.Contains(lineNumber));
+ }
+
public void Clear()
{
_regions.Clear();
diff --git a/Src/BlueDotBrigade.Weevil.Gui/Converters/RegionConverter.cs b/Src/BlueDotBrigade.Weevil.Gui/Converters/RegionConverter.cs
new file mode 100644
index 00000000..bd743629
--- /dev/null
+++ b/Src/BlueDotBrigade.Weevil.Gui/Converters/RegionConverter.cs
@@ -0,0 +1,73 @@
+namespace BlueDotBrigade.Weevil.Gui.Converters
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+ using BlueDotBrigade.Weevil.Data;
+ using System.Windows.Data;
+ using System.Windows;
+ using BlueDotBrigade.Weevil.Gui.Filter;
+
+ using System;
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Data;
+
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ public class RegionStringConverter : IMultiValueConverter
+ {
+ ///
+ /// Expects:
+ /// values[0]: The current IRecord (the item in the ListView)
+ /// values[1]: The parent FilterViewModel (the DataContext of the UserControl/Window)
+ /// Returns a string indicating the record's region status:
+ /// - "Start of Region"
+ /// - "In Region"
+ /// - "End of Region"
+ /// - string.Empty (when the record isn't in any region)
+ ///
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values?.Length < 2)
+ return string.Empty;
+
+ var record = values[0] as IRecord;
+ var viewModel = values[1] as FilterViewModel;
+
+ if (record == null || viewModel == null)
+ return string.Empty;
+
+ // You can define your own logic:
+ // e.g., if region is a single continuous block, you might define:
+ // - starts with a region if ...
+ // - ends with a region if ...
+ // - or "in region" otherwise
+ if (viewModel.RegionStartsWith(record))
+ {
+ return "Start of Region";
+ }
+ else if (viewModel.RegionEndsWith(record))
+ {
+ return "End of Region";
+ }
+ else if (viewModel.RegionContains(record))
+ {
+ return "In Region";
+ }
+
+ return string.Empty;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Src/BlueDotBrigade.Weevil.Gui/Filter/FilterView.xaml b/Src/BlueDotBrigade.Weevil.Gui/Filter/FilterView.xaml
index 21639307..bbc1b317 100644
--- a/Src/BlueDotBrigade.Weevil.Gui/Filter/FilterView.xaml
+++ b/Src/BlueDotBrigade.Weevil.Gui/Filter/FilterView.xaml
@@ -20,6 +20,7 @@
+