Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions VSRAD.Package/DebugVisualizer/ColumnStylingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public sealed class ColumnStylingOptions : DefaultNotifyPropertyChanged
private string _visibleColumns = "0:1-8191";
public string VisibleColumns { get => _visibleColumns; set => SetField(ref _visibleColumns, value); }

private VisibleColumnsRange _range = new VisibleColumnsRange("0:1-8191");
public VisibleColumnsRange Range { get => _range; set => SetField(ref _range, value); }

private string _backgroundColors;
public string BackgroundColors { get => _backgroundColors; set => SetField(ref _backgroundColors, value); }

Expand Down
4 changes: 3 additions & 1 deletion VSRAD.Package/DebugVisualizer/ComputedColumnStyling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public void Recompute(VisualizerOptions options, VisualizerAppearance appearance

Array.Resize(ref _columnState, (int)groupSize);
Array.Clear(_columnState, 0, _columnState.Length);
foreach (int i in ColumnSelector.ToIndexes(styling.VisibleColumns, (int)groupSize))
if (styling.Range == null) // TODO
styling.Range = new Utils.VisibleColumnsRange("0:1-8191");
foreach (int i in styling.Range.GetRangeRepresentation(groupSize))
ColumnState[i] |= ColumnStates.Visible;

ComputeInactiveLanes(options, system);
Expand Down
14 changes: 10 additions & 4 deletions VSRAD.Package/DebugVisualizer/ContextMenus/SubgroupContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ private void HideColumns(object sender, EventArgs e)

private void SelectPartialSubgroups(uint subgroupSize, uint displayedCount, bool displayLast)
{
string subgroupsSelector = ColumnSelector.PartialSubgroups(_getGroupSize(), subgroupSize, displayedCount, displayLast);
string newSelector = ColumnSelector.GetSelectorMultiplication(_stylingOptions.VisibleColumns, subgroupsSelector, _table.DataColumnCount);
SetColumnSelector(newSelector);
//string subgroupsSelector = ColumnSelector.PartialSubgroups(_getGroupSize(), subgroupSize, displayedCount, displayLast);
//string newSelector = ColumnSelector.GetSelectorMultiplication(_stylingOptions.VisibleColumns, subgroupsSelector, _table.DataColumnCount);
//SetColumnSelector(newSelector);
_stylingOptions.Range = new Utils.VisibleColumnsRange(displayLast ? Utils.SelectorType.Last : Utils.SelectorType.First,
(int)displayedCount, (int)subgroupSize);
_stylingOptions.VisibleColumns = _stylingOptions.Range.GetStringRepresentation(_getGroupSize());
_table.ClearSelection();
}

private void SetBackgroundColor(DataHighlightColor color)
Expand All @@ -109,7 +113,9 @@ private void SetForegroundColor(DataHighlightColor color)

private void SetColumnSelector(string newSelector)
{
_stylingOptions.VisibleColumns = newSelector;
//_stylingOptions.VisibleColumns = newSelector;
//_table.ClearSelection();
_stylingOptions.Range = new Utils.VisibleColumnsRange(newSelector);
_table.ClearSelection();
}

Expand Down
4 changes: 4 additions & 0 deletions VSRAD.Package/DebugVisualizer/VisualizerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ private void OptionsChanged(object sender, PropertyChangedEventArgs e)
_table.SetScalingMode(_context.Options.VisualizerAppearance.ScalingMode);
break;
case nameof(Options.DebuggerOptions.GroupSize):
_context.Options.VisualizerColumnStyling.VisibleColumns
= _context.Options.VisualizerColumnStyling.Range.GetStringRepresentation(_context.Options.DebuggerOptions.GroupSize);
RefreshDataStyling();
break;
case nameof(Options.VisualizerOptions.MaskLanes):
case nameof(Options.VisualizerOptions.CheckMagicNumber):
case nameof(Options.VisualizerAppearance.LaneGrouping):
Expand Down
61 changes: 61 additions & 0 deletions VSRAD.Package/Utils/VisibleColumnsRange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VSRAD.Package.DebugVisualizer;

namespace VSRAD.Package.Utils
{
public enum SelectorType
{
First, Last, Custom
}

public class VisibleColumnsRange
{
public SelectorType Type;
public int X;
public int Y;
public string Custom;

public VisibleColumnsRange(SelectorType type, int x, int y)
{
Type = type; X = x; Y = y;
}

public VisibleColumnsRange(string custom)
{
Type = SelectorType.Custom;
Custom = custom;
}

public string GetStringRepresentation(uint groupSize)
{
if (Type == SelectorType.Custom) return Custom;

int cur = Type == SelectorType.First ? 0 : Y - X;
var sb = new StringBuilder();
while (cur < groupSize)
{
sb.Append($"{cur}-{cur+X-1}:");
cur += Y;
}
return sb.ToString();
}

public IEnumerable<int> GetRangeRepresentation(uint groupSize)
{
if (Type == SelectorType.Custom) return ColumnSelector.ToIndexes(Custom, (int)groupSize);

int cur = Type == SelectorType.First ? 0 : Y - X;
var res = new List<int>();
while (cur < groupSize)
{
res.AddRange(Enumerable.Range(cur, X));
cur += Y;
}
return res;
}
}
}
1 change: 1 addition & 0 deletions VSRAD.Package/VSRAD.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<Compile Include="Utils\CollectionExtensions.cs" />
<Compile Include="Utils\MruCollection.cs" />
<Compile Include="Utils\OleCommandText.cs" />
<Compile Include="Utils\VisibleColumnsRange.cs" />
<Compile Include="Utils\VsEditor.cs" />
<Compile Include="Utils\VsStatusBarWriter.cs" />
<Compile Include="Utils\WpfConverters.cs" />
Expand Down
19 changes: 19 additions & 0 deletions VSRAD.PackageTests/Utils/VisibleColumnsRangeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using VSRAD.Package.Utils;
using Xunit;

namespace VSRAD.PackageTests.Utils
{
public class VisibleColumnsRangeTests
{
[Fact]
public void TestString()
{
var range = new VisibleColumnsRange(SelectorType.First, 16, 64);
Assert.Equal("0-15:64-79:128-143:192-207:256-271:320-335:384-399:448-463:512-527:576-591:", range.GetStringRepresentation(640));

range = new VisibleColumnsRange(SelectorType.Last, 16, 64);
Assert.Equal("48-63:112-127:176-191:240-255:304-319:368-383:432-447:496-511:560-575:624-639:", range.GetStringRepresentation(640));
}
}
}
1 change: 1 addition & 0 deletions VSRAD.PackageTests/VSRAD.PackageTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<Compile Include="Server\BreakStateTests.cs" />
<Compile Include="TestHelper.cs" />
<Compile Include="Utils\ArrayRangeTests.cs" />
<Compile Include="Utils\VisibleColumnsRangeTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
Expand Down