Skip to content

Commit

Permalink
Apply experimental grid/list layout
Browse files Browse the repository at this point in the history
(cherry picked from commit 534c0b6)
  • Loading branch information
ivangrek authored and RussKie committed Mar 7, 2021
1 parent 3f4032b commit 5572115
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 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.Green },
{ AppColor.RemoteBranch, Color.DarkRed },
{ AppColor.Branch, Color.FromArgb(34, 166, 57) },
{ AppColor.RemoteBranch, Color.FromArgb(230, 99, 99) },
{ AppColor.DiffSection, Color.FromArgb(230, 230, 230) },
{ AppColor.DiffRemoved, Color.FromArgb(255, 200, 200) },
{ AppColor.DiffRemovedExtra, Color.FromArgb(255, 165, 165) },
Expand Down
4 changes: 2 additions & 2 deletions GitUI/Themes/invariant.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
.HighlightAllOccurences { color: #ffffe0; }
.Tag { color: #00008b; }
.Graph { color: #8b0000; }
.Branch { color: #008000; }
.RemoteBranch { color: #8b0000; }
.Branch { color: #22a639; }
.RemoteBranch { color: #e66363; }
.DiffSection { color: #e6e6e6; }
.DiffRemoved { color: #ffc8c8; }
.DiffRemovedExtra { color: #ffa5a5; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ public override bool TryGetToolTip(DataGridViewCellMouseEventArgs e, GitRevision
RefArrowType.None,
messageBounds,
e.Graphics,
dashedLine: false,
fill: true);
dashedLine: false);

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

private void DrawImage(
Expand Down
20 changes: 7 additions & 13 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, bool fill = 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)
{
var paddingLeftRight = DpiUtil.Scale(4);
var paddingTopBottom = DpiUtil.Scale(2);
var marginRight = DpiUtil.Scale(7);

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

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, fill);
radius: 3, arrowType, dashedLine);

var textBounds = new Rectangle(
rect.X + arrowWidth + paddingLeftRight,
Expand All @@ -60,28 +60,22 @@ 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, bool fill)
private static void DrawRefBackground(bool isRowSelected, Graphics graphics, Color color, Rectangle bounds, int radius, RefArrowType arrowType, bool dashedLine)
{
var oldMode = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;

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

if (isRowSelected)
{
graphics.FillPath(SystemBrushes.Window, path);
}

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

0 comments on commit 5572115

Please sign in to comment.