set pen thickness

"General": {
    "Pen.Thickness": "4.4"
  }
This commit is contained in:
ghiboz 2024-07-05 14:02:30 +02:00
parent 1c524cf310
commit c0348b73bd
4 changed files with 30 additions and 0 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Reflection;
@ -188,6 +189,22 @@ namespace SourceGit
Models.CommitGraph.SetPenColors(penColors);
}
foreach (var kv in schema.General)
{
if (kv.Key.Equals("Pen.Thickness", StringComparison.Ordinal))
{
double thick = Models.CommitGraph.GetPenThickness();
try
{
thick = double.Parse(kv.Value, CultureInfo.InvariantCulture);
}
catch
{
}
Models.CommitGraph.SetPenThickness(thick);
}
}
app.Resources.MergedDictionaries.Add(resDic);
app._colorOverrides = resDic;
}

View file

@ -123,6 +123,15 @@ namespace SourceGit.Models
_penCount = colors.Count;
}
public static void SetPenThickness(double value)
{
_penThickness = value;
}
public static double GetPenThickness()
{
return _penThickness;
}
public static CommitGraph Parse(List<Commit> commits)
{
double UNIT_WIDTH = 12;
@ -268,6 +277,7 @@ namespace SourceGit.Models
return temp;
}
private static double _penThickness = 1;
private static int _penCount = 0;
private static readonly List<Color> _defaultPenColors = [
Colors.Orange,

View file

@ -6,5 +6,6 @@ namespace SourceGit.Models
{
public Dictionary<string, string> Basic { get; set; } = new Dictionary<string, string>();
public List<string> Graph { get; set; } = new List<string>();
public Dictionary<string,string> General { get; set; } = new Dictionary<string, string>();
}
}

View file

@ -158,6 +158,8 @@ namespace SourceGit.Views
var geo = new StreamGeometry();
var pen = Models.CommitGraph.Pens[line.Color];
pen.Thickness = Models.CommitGraph.GetPenThickness();
using (var ctx = geo.Open())
{
var started = false;