Merge pull request #247 from ghiboz/develop

Graph Tickness
This commit is contained in:
leo 2024-07-08 15:30:28 +08:00 committed by GitHub
commit af388bad60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Reflection; using System.Reflection;
@ -188,6 +189,22 @@ namespace SourceGit
Models.CommitGraph.SetPenColors(penColors); 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.Resources.MergedDictionaries.Add(resDic);
app._colorOverrides = resDic; app._colorOverrides = resDic;
} }

View file

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

View file

@ -6,5 +6,6 @@ namespace SourceGit.Models
{ {
public Dictionary<string, string> Basic { get; set; } = new Dictionary<string, string>(); public Dictionary<string, string> Basic { get; set; } = new Dictionary<string, string>();
public List<string> Graph { get; set; } = new List<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 geo = new StreamGeometry();
var pen = Models.CommitGraph.Pens[line.Color]; var pen = Models.CommitGraph.Pens[line.Color];
pen.Thickness = Models.CommitGraph.GetPenThickness();
using (var ctx = geo.Open()) using (var ctx = geo.Open())
{ {
var started = false; var started = false;