diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 312d4945..293dd77b 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -569,6 +569,8 @@ LAYOUT Horizontal Vertical + OPTIONS + Show Tags in Graph COMMITS ORDER Commit Date Topologically diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index aae292f3..b8dcf417 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -573,6 +573,8 @@ 布局方式 水平排布 竖直排布 + 其它设置 + 在提交路线图中显示标签 提交列表排序规则 按提交时间 按拓扑排序 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 97c96c6c..1d2cee7c 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -572,6 +572,8 @@ 版面配置 橫向顯示 縱向顯示 + 其它設定 + 在路線圖中顯示標籤 提交顯示順序 依時間排序 依拓撲排序 diff --git a/src/Resources/Themes.axaml b/src/Resources/Themes.axaml index 6326023a..ff4c0374 100644 --- a/src/Resources/Themes.axaml +++ b/src/Resources/Themes.axaml @@ -10,7 +10,6 @@ #FFFAFAFA #FFB0CEE8 #FF1F1F1F - DarkGreen #FF836C2E #FFFFFFFF #FFCFCFCF @@ -37,7 +36,6 @@ #FF1C1C1C #FF8F8F8F #FFDDDDDD - #84c88a #FFFAFAD2 #FF252525 #FF181818 @@ -64,7 +62,6 @@ - diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index 0b1d841e..cad6c224 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -183,6 +183,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _showTagsAsTree, value); } + public bool ShowTagsInGraph + { + get => _showTagsInGraph; + set => SetProperty(ref _showTagsInGraph, value); + } + public bool UseTwoColumnsLayoutInHistories { get => _useTwoColumnsLayoutInHistories; @@ -643,6 +649,7 @@ namespace SourceGit.ViewModels private string _ignoreUpdateTag = string.Empty; private bool _showTagsAsTree = false; + private bool _showTagsInGraph = true; private bool _useTwoColumnsLayoutInHistories = false; private bool _displayTimeAsPeriodInHistories = false; private bool _useSideBySideDiff = false; diff --git a/src/Views/CommitBaseInfo.axaml b/src/Views/CommitBaseInfo.axaml index 06d10fe7..f83b43fc 100644 --- a/src/Views/CommitBaseInfo.axaml +++ b/src/Views/CommitBaseInfo.axaml @@ -173,8 +173,7 @@ - SetValue(UseGraphColorProperty, value); } - public static readonly StyledProperty TagBackgroundProperty = - AvaloniaProperty.Register(nameof(TagBackground), Brushes.White); - - public IBrush TagBackground - { - get => GetValue(TagBackgroundProperty); - set => SetValue(TagBackgroundProperty, value); - } - public static readonly StyledProperty AllowWrapProperty = AvaloniaProperty.Register(nameof(AllowWrap)); @@ -82,6 +73,15 @@ namespace SourceGit.Views set => SetValue(AllowWrapProperty, value); } + public static readonly StyledProperty ShowTagsProperty = + AvaloniaProperty.Register(nameof(ShowTags), true); + + public bool ShowTags + { + get => GetValue(ShowTagsProperty); + set => SetValue(ShowTagsProperty, value); + } + static CommitRefsPresenter() { AffectsMeasure( @@ -89,8 +89,8 @@ namespace SourceGit.Views FontSizeProperty, ForegroundProperty, UseGraphColorProperty, - TagBackgroundProperty, - BackgroundProperty); + BackgroundProperty, + ShowTagsProperty); } public override void Render(DrawingContext context) @@ -171,15 +171,18 @@ namespace SourceGit.Views var typefaceBold = new Typeface(FontFamily, FontStyle.Normal, FontWeight.Bold); var fg = Foreground; var normalBG = UseGraphColor ? commit.Brush : Brushes.Gray; - var tagBG = UseGraphColor ? TagBackground : Brushes.Gray; var labelSize = FontSize; var requiredWidth = 0.0; var requiredHeight = 16.0; var x = 0.0; var allowWrap = AllowWrap; + var showTags = ShowTags; foreach (var decorator in refs) { + if (!showTags && decorator.Type == Models.DecoratorType.Tag) + continue; + var isHead = decorator.Type == Models.DecoratorType.CurrentBranchHead || decorator.Type == Models.DecoratorType.CurrentCommitHead; @@ -209,7 +212,7 @@ namespace SourceGit.Views geo = this.FindResource("Icons.Remote") as StreamGeometry; break; case Models.DecoratorType.Tag: - item.Brush = tagBG; + item.Brush = Brushes.Gray; geo = this.FindResource("Icons.Tag") as StreamGeometry; break; default: diff --git a/src/Views/Conflict.axaml b/src/Views/Conflict.axaml index 9a056f9e..2dce264e 100644 --- a/src/Views/Conflict.axaml +++ b/src/Views/Conflict.axaml @@ -46,7 +46,6 @@ diff --git a/src/Views/Repository.axaml.cs b/src/Views/Repository.axaml.cs index 00218a85..e98adf70 100644 --- a/src/Views/Repository.axaml.cs +++ b/src/Views/Repository.axaml.cs @@ -447,6 +447,20 @@ namespace SourceGit.Views ev.Handled = true; }; + var others = new MenuItem(); + others.Header = App.Text("Repository.HistoriesOptions"); + others.IsEnabled = false; + + var showTagsInGraph = new MenuItem(); + showTagsInGraph.Header = App.Text("Repository.HistoriesOptions.ShowTagsInGraph"); + if (ViewModels.Preferences.Instance.ShowTagsInGraph) + showTagsInGraph.Icon = App.CreateMenuIcon("Icons.Check"); + showTagsInGraph.Click += (_, ev) => + { + ViewModels.Preferences.Instance.ShowTagsInGraph = !ViewModels.Preferences.Instance.ShowTagsInGraph; + ev.Handled = true; + }; + var menu = new ContextMenu(); menu.Items.Add(layout); menu.Items.Add(horizontal); @@ -455,6 +469,9 @@ namespace SourceGit.Views menu.Items.Add(order); menu.Items.Add(dateOrder); menu.Items.Add(topoOrder); + menu.Items.Add(new MenuItem() { Header = "-" }); + menu.Items.Add(others); + menu.Items.Add(showTagsInGraph); menu.Open(button); }