mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
optimize<CommitGraph>: remove unused polyline mode
This commit is contained in:
parent
ade45732f2
commit
7c44c0a840
6 changed files with 20 additions and 88 deletions
|
@ -130,11 +130,6 @@ namespace SourceGit.Models {
|
|||
/// </summary>
|
||||
public double Height { get; set; } = 600;
|
||||
|
||||
/// <summary>
|
||||
/// 在提交列表视图中是否使用折线代替曲线
|
||||
/// </summary>
|
||||
public bool UsePolylineInGraph { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 将提交信息面板与提交记录左右排布
|
||||
/// </summary>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
<Geometry x:Key="Icon.Grid">M30 271l241 0 0-241-241 0 0 241zM392 271l241 0 0-241-241 0 0 241zM753 30l0 241 241 0 0-241-241 0zM30 632l241 0 0-241-241 0 0 241zM392 632l241 0 0-241-241 0 0 241zM753 632l241 0 0-241-241 0 0 241zM30 994l241 0 0-241-241 0 0 241zM392 994l241 0 0-241-241 0 0 241zM753 994l241 0 0-241-241 0 0 241z</Geometry>
|
||||
|
||||
<Geometry x:Key="Icon.Curve">M1017 598c0-25-25-50-50-50c-30 0-50 25-50 50c0 35-10 136-55 186c-25 25-55 35-95 35c-70 0-121-191-161-326c-50-196-100-377-231-377c-186 0-271 286-326 472c-10 40-20 75-30 95c-10 25 5 55 30 65c25 10 55-5 65-30c10-25 20-60 35-105c35-136 116-397 226-397c55 0 105 181 141 301c55 196 110 402 256 402c65 0 121-20 161-65c90-95 85-251 85-256z</Geometry>
|
||||
<Geometry x:Key="Icon.Polyline">M341 475 147 675 65 593l271-284 281 265 254-295 89 77-336 387z</Geometry>
|
||||
|
||||
<Geometry x:Key="Icon.DarkTheme">M512 768c-38 0-74-9-107-23C493 704 555 615 555 512c0-103-61-192-149-233C438 265 474 256 512 256a256 256 0 01256 256a256 256 0 01-256 256m341-397V171h-200L512 29 371 171H171v200L29 512 171 653V853h200L512 995 653 853H853v-200L995 512 853 371z</Geometry>
|
||||
<Geometry x:Key="Icon.LightTheme">M853 653l141-141-141-141 0-200-200 0-141-141-141 141-200 0 0 200-141 141 141 141 0 200 200 0 141 141 141-141 200 0 0-200zM512 768c-141 0-256-115-256-256s115-256 256-256s256 115 256 256s-115 256-256 256z</Geometry>
|
||||
|
|
|
@ -254,11 +254,7 @@ namespace SourceGit.Views.Controls {
|
|||
var bottom = startY + ActualHeight;
|
||||
|
||||
// 绘制线
|
||||
if (Models.Preference.Instance.Window.UsePolylineInGraph) {
|
||||
DrawPolyLines(dc, top, bottom);
|
||||
} else {
|
||||
DrawCurves(dc, top, bottom);
|
||||
}
|
||||
|
||||
// 绘制点
|
||||
var dotFill = FindResource("Brush.Contents") as Brush;
|
||||
|
@ -341,51 +337,5 @@ namespace SourceGit.Views.Controls {
|
|||
dc.DrawGeometry(null, PENS[link.Color], geo);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPolyLines(DrawingContext dc, double top, double bottom) {
|
||||
foreach (var line in data.Paths) {
|
||||
var last = line.Points[0];
|
||||
var size = line.Points.Count;
|
||||
|
||||
if (line.Points[size - 1].Y < top) continue;
|
||||
if (last.Y > bottom) continue;
|
||||
|
||||
var geo = new StreamGeometry();
|
||||
var pen = PENS[line.Color];
|
||||
using (var ctx = geo.Open()) {
|
||||
var started = false;
|
||||
var ended = false;
|
||||
for (int i = 1; i < size; i++) {
|
||||
var cur = line.Points[i];
|
||||
if (cur.Y < top) {
|
||||
last = cur;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!started) {
|
||||
ctx.BeginFigure(last, false, false);
|
||||
}
|
||||
|
||||
if (cur.Y > bottom) {
|
||||
cur.Y = bottom;
|
||||
ended = true;
|
||||
}
|
||||
|
||||
ctx.LineTo(cur, true, false);
|
||||
if (ended) break;
|
||||
last = cur;
|
||||
}
|
||||
}
|
||||
|
||||
geo.Freeze();
|
||||
dc.DrawGeometry(null, pen, geo);
|
||||
}
|
||||
|
||||
foreach (var link in data.Links) {
|
||||
if (link.End.Y < top) continue;
|
||||
if (link.Start.Y > bottom) break;
|
||||
dc.DrawLine(PENS[link.Color], link.Start, link.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,24 +192,16 @@
|
|||
</Border>
|
||||
|
||||
<!-- Right Top Button -->
|
||||
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,6,8,0" Orientation="Horizontal">
|
||||
<ToggleButton
|
||||
Style="{StaticResource Style.ToggleButton.CommitGraphMode}"
|
||||
Foreground="{DynamicResource Brush.FG2}"
|
||||
Width="16" Height="16"
|
||||
ToolTip="{DynamicResource Text.Histories.GraphMode}"
|
||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.UsePolylineInGraph, Mode=TwoWay}"
|
||||
Checked="ChangeGraphMode" Unchecked="ChangeGraphMode"/>
|
||||
|
||||
<ToggleButton
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource Style.ToggleButton.SplitDirection}"
|
||||
Foreground="{DynamicResource Brush.FG2}"
|
||||
Width="16" Height="16"
|
||||
Margin="8,0,0,0"
|
||||
Margin="0,6,8,0"
|
||||
ToolTip="{DynamicResource Text.Histories.DisplayMode}"
|
||||
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Window.MoveCommitInfoRight, Mode=TwoWay, Converter={StaticResource InverseBool}}"
|
||||
Checked="ChangeOrientation" Unchecked="ChangeOrientation"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -145,11 +145,6 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
layout.InvalidateArrange();
|
||||
}
|
||||
|
||||
public void ChangeGraphMode(object sender, RoutedEventArgs e) {
|
||||
graph.InvalidateVisual();
|
||||
e.Handled = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SEARCH_BAR
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls="clr-namespace:SourceGit.Views.Controls"
|
||||
xmlns:models="clr-namespace:SourceGit.Models"
|
||||
xmlns:widgets="clr-namespace:SourceGit.Views.Widgets"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
@ -15,11 +16,11 @@
|
|||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="48"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="48"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="48"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
|
@ -48,11 +49,11 @@
|
|||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" x:Name="txtStartSHA" Foreground="DarkOrange"/>
|
||||
<TextBlock Grid.Column="1" x:Name="txtStartTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="0" x:Name="txtStartSHA" Foreground="DarkOrange" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
||||
<TextBlock Grid.Column="1" x:Name="txtStartTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" x:Name="txtStartSubject" FontSize="10pt" VerticalAlignment="Bottom"/>
|
||||
<TextBlock Grid.Row="1" x:Name="txtStartSubject" VerticalAlignment="Bottom" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="10pt"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
@ -94,11 +95,11 @@
|
|||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" x:Name="txtEndSHA" Foreground="DarkOrange"/>
|
||||
<TextBlock Grid.Column="1" x:Name="txtEndTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Column="0" x:Name="txtEndSHA" Foreground="DarkOrange" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" />
|
||||
<TextBlock Grid.Column="1" x:Name="txtEndTime" Foreground="{DynamicResource Brush.FG2}" HorizontalAlignment="Right" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" x:Name="txtEndSubject" FontSize="10pt" VerticalAlignment="Bottom"/>
|
||||
<TextBlock Grid.Row="1" x:Name="txtEndSubject" VerticalAlignment="Bottom" FontFamily="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}" FontSize="10pt"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
|
Loading…
Reference in a new issue