Skip to content

Commit

Permalink
Revert "Apply experimental grid/list layout"
Browse files Browse the repository at this point in the history
This reverts commit 534c0b6.
  • Loading branch information
mstv committed Sep 24, 2021
1 parent fb4bcd6 commit b9bede0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions GitExtUtils/GitUI/Theming/AppColorDefaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public static class AppColorDefaults
{ AppColor.HighlightAllOccurences, Color.LightYellow },
{ AppColor.Tag, Color.DarkBlue },
{ AppColor.Graph, Color.DarkRed },
{ AppColor.Branch, Color.FromArgb(0x00, 0x80, 0x00) },
{ AppColor.RemoteBranch, Color.FromArgb(0x8b, 0x00, 0x09) },
{ AppColor.Branch, Color.Green },
{ AppColor.RemoteBranch, Color.DarkRed },
{ AppColor.DiffSection, Color.FromArgb(230, 230, 230) },
{ AppColor.DiffRemoved, Color.FromArgb(255, 200, 200) },
{ AppColor.DiffRemovedExtra, Color.FromArgb(255, 165, 165) },
Expand Down
2 changes: 1 addition & 1 deletion GitUI/Themes/invariant.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.Tag { color: #00008b; }
.Graph { color: #8b0000; }
.Branch { color: #008000; }
.RemoteBranch { color: #8b0009; }
.RemoteBranch { color: #8b0000; }
.DiffSection { color: #e6e6e6; }
.DiffRemoved { color: #ffc8c8; }
.DiffRemovedExtra { color: #ffa5a5; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ public override bool TryGetToolTip(DataGridViewCellMouseEventArgs e, GitRevision
RefArrowType.None,
messageBounds,
e.Graphics,
dashedLine: false);
dashedLine: false,
fill: true);

var max = Math.Max(
TextRenderer.MeasureText(ResourceManager.TranslatedStrings.Workspace, style.NormalFont).Width,
Expand Down Expand Up @@ -314,7 +315,8 @@ void DrawSuperProjectRef(string label, ref int currentOffset)
arrowType,
messageBounds,
e.Graphics,
dashedLine: superprojectRef is not null);
dashedLine: superprojectRef is not null,
fill: true);
}

private void DrawImage(
Expand Down
20 changes: 13 additions & 7 deletions GitUI/UserControls/RevisionGrid/RevisionGridRefRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ internal static class RevisionGridRefRenderer
private static readonly float[] _dashPattern = { 4, 4 };
private static readonly PointF[] _arrowPoints = new PointF[4];

public static void DrawRef(bool isRowSelected, Font font, ref int offset, string name, Color headColor, RefArrowType arrowType, in Rectangle bounds, Graphics graphics, bool dashedLine = false)
public static void DrawRef(bool isRowSelected, Font font, ref int offset, string name, Color headColor, RefArrowType arrowType, in Rectangle bounds, Graphics graphics, bool dashedLine = false, bool fill = false)
{
var paddingLeftRight = DpiUtil.Scale(4);
var paddingTopBottom = DpiUtil.Scale(2);
var marginRight = DpiUtil.Scale(7);

var textColor = ColorHelper.Lerp(headColor, Color.Black, 0.25F);
var textColor = fill ? headColor : ColorHelper.Lerp(headColor, Color.White, 0.5f);

var textSize = TextRenderer.MeasureText(graphics, name, font, Size.Empty, TextFormatFlags.NoPadding);

Expand All @@ -47,7 +47,7 @@ public static void DrawRef(bool isRowSelected, Font font, ref int offset, string
graphics,
headColor,
rect,
radius: 3, arrowType, dashedLine);
radius: 3, arrowType, dashedLine, fill);

Rectangle textBounds = new(
rect.X + arrowWidth + paddingLeftRight,
Expand All @@ -60,22 +60,28 @@ public static void DrawRef(bool isRowSelected, Font font, ref int offset, string
offset += rect.Width + marginRight;
}

private static void DrawRefBackground(bool isRowSelected, Graphics graphics, Color color, Rectangle bounds, int radius, RefArrowType arrowType, bool dashedLine)
private static void DrawRefBackground(bool isRowSelected, Graphics graphics, Color color, Rectangle bounds, int radius, RefArrowType arrowType, bool dashedLine, bool fill)
{
var oldMode = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;

try
{
using var path = CreateRoundRectPath(bounds, radius);

if (isRowSelected)
if (fill)
{
var color1 = ColorHelper.Lerp(color, SystemColors.Window, 0.92F);
var color2 = ColorHelper.Lerp(color1, SystemColors.Window, 0.9f);
using var brush = new LinearGradientBrush(bounds, color1, color2, angle: 90);
graphics.FillPath(brush, path);
}
else if (isRowSelected)
{
graphics.FillPath(SystemBrushes.Window, path);
}

// frame
using Pen pen = new(ColorHelper.Lerp(color, SystemColors.Window, 0.5F));
using Pen pen = new(ColorHelper.Lerp(color, SystemColors.Window, 0.83F));
if (dashedLine)
{
pen.DashPattern = _dashPattern;
Expand Down

0 comments on commit b9bede0

Please sign in to comment.