diff --git a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj index 33bde4080b..a4b5d72635 100644 --- a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj +++ b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj @@ -148,6 +148,7 @@ + Designer diff --git a/src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyMatrix.cs b/src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyMatrix.cs index 2ef6acc958..a8bc4dff7f 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyMatrix.cs +++ b/src/AddIns/Analysis/CodeQuality/Src/Controls/DependencyMatrix.cs @@ -9,7 +9,7 @@ using ICSharpCode.CodeQualityAnalysis.Utility; namespace ICSharpCode.CodeQualityAnalysis.Controls { - public class DependencyMatrix : Matrix + public class DependencyMatrix : VisibleMatrix { protected override Relationship GetCellValue(int rowIndex, int columnIndex) { diff --git a/src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs b/src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs index d0224072cd..217307a0bd 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs +++ b/src/AddIns/Analysis/CodeQuality/Src/Controls/MatrixControl.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using ICSharpCode.CodeQualityAnalysis.Utility; using System.Drawing.Drawing2D; using System.Windows; +using System.Linq; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; @@ -44,8 +45,8 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls { matrix = value; - matrixHeight = Matrix.HeaderRows.Count - 1; - matrixWidth = Matrix.HeaderColumns.Count - 1; + // matrixHeight = matrix.HeaderRows.Count - 1; + // matrixWidth = matrix.HeaderColumns.Count - 1; } } @@ -62,8 +63,8 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls public MatrixControl() { CellHeight = CellWidth = 18; - matrixWidth = 20; - matrixHeight = 20; + matrixWidth = 0; + matrixHeight = 0; fontSize = CellHeight / 3; penSize = 1; font = "Verdana"; @@ -71,6 +72,20 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls HoveredCell = new HoveredCell(); } + public void SetVisibleItems(HeaderType tree, ICollection visibleItems) + { + var items = tree == HeaderType.Columns ? matrix.HeaderColumns : matrix.HeaderRows; + + foreach (var item in items) + { + var foundItem = visibleItems.Where(n => n.Equals(item.Value)).SingleOrDefault(); + item.Visible = foundItem != null; + } + + matrixHeight = matrix.HeaderRows.Count - 1; + matrixWidth = matrix.HeaderColumns.Count - 1; + } + protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e) { base.OnMouseMove(e); @@ -181,10 +196,10 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls CellHeight); SolidColorBrush brush = null; - if ((i * CellWidth - offsetDiffX) == currentXLine || - ((i * CellWidth - offsetDiffX) == currentXLine)) - brush = Colorizer.GetColorBrushMixedWith(Colors.GreenYellow, value); - else +// if ((i * CellWidth - offsetDiffX) == currentXLine || +// ((i * CellWidth - offsetDiffX) == currentXLine)) +// brush = Brushes.Pink; //Colorizer.GetColorBrushMixedWith(Colors.GreenYellow, value); +// else brush = Colorizer.GetColorBrush(value); drawingContext.DrawRectangle(brush, null, rect); @@ -449,4 +464,10 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls HoveredCell = cell; } } + + public enum HeaderType + { + Columns, + Rows + } } diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Matrix.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Matrix.cs index 519f297b09..bebc762674 100644 --- a/src/AddIns/Analysis/CodeQuality/Src/Utility/Matrix.cs +++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Matrix.cs @@ -56,6 +56,7 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility public class Cell { public TItem Value { get; set; } + public bool Visible { get; set; } public Cell(TItem value) { diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/VisibleMatrix.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/VisibleMatrix.cs new file mode 100644 index 0000000000..da9617f5b4 --- /dev/null +++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/VisibleMatrix.cs @@ -0,0 +1,41 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ICSharpCode.CodeQualityAnalysis.Utility +{ + /// + /// Description of VisibleMatrix. + /// + public abstract class VisibleMatrix : Matrix + { + public new List> HeaderRows + { + get + { + return base.HeaderRows.Where(c => c.Visible).ToList(); + } + + set + { + base.HeaderRows = value; + } + } + + public new List> HeaderColumns + { + get + { + return base.HeaderColumns.Where(c => c.Visible).ToList(); + } + + set + { + base.HeaderColumns = value; + } + } + } +}