@@ -91,43 +91,14 @@ public object SelectedView
9191 set => SetProperty ( ref _selectedView , value ) ;
9292 }
9393
94- public bool SimplifyByDecoration
94+ public Models . HistoryShowFlags HistoryShowFlags
9595 {
96- get => _settings . SimplifyByDecoration ;
96+ get => _settings . HistoryShowFlags ;
9797 set
9898 {
99- if ( value != _settings . SimplifyByDecoration )
99+ if ( value != _settings . HistoryShowFlags )
100100 {
101- _settings . SimplifyByDecoration = value ;
102- OnPropertyChanged ( ) ;
103- Task . Run ( RefreshCommits ) ;
104- }
105- }
106- }
107-
108- public bool EnableReflog
109- {
110- get => _settings . EnableReflog ;
111- set
112- {
113- if ( value != _settings . EnableReflog )
114- {
115- _settings . EnableReflog = value ;
116- OnPropertyChanged ( ) ;
117- Task . Run ( RefreshCommits ) ;
118- }
119- }
120- }
121-
122- public bool EnableFirstParentInHistories
123- {
124- get => _settings . EnableFirstParentInHistories ;
125- set
126- {
127- if ( value != _settings . EnableFirstParentInHistories )
128- {
129- _settings . EnableFirstParentInHistories = value ;
130- OnPropertyChanged ( ) ;
101+ _settings . HistoryShowFlags = value ;
131102 Task . Run ( RefreshCommits ) ;
132103 }
133104 }
@@ -1281,12 +1252,13 @@ public void RefreshCommits()
12811252 else
12821253 builder . Append ( "--date-order " ) ;
12831254
1284- if ( _settings . EnableReflog )
1255+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . Reflog ) )
12851256 builder . Append ( "--reflog " ) ;
1286- if ( _settings . EnableFirstParentInHistories )
1257+
1258+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) )
12871259 builder . Append ( "--first-parent " ) ;
1288- // only show commits with decorators
1289- if ( _settings . SimplifyByDecoration )
1260+
1261+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) )
12901262 builder . Append ( "--simplify-by-decoration " ) ;
12911263
12921264 var filters = _settings . BuildHistoriesFilter ( ) ;
@@ -1296,7 +1268,7 @@ public void RefreshCommits()
12961268 builder . Append ( filters ) ;
12971269
12981270 var commits = new Commands . QueryCommits ( _fullpath , builder . ToString ( ) ) . GetResultAsync ( ) . Result ;
1299- var graph = Models . CommitGraph . Parse ( commits , _settings . EnableFirstParentInHistories ) ;
1271+ var graph = Models . CommitGraph . Parse ( commits , _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) ) ;
13001272
13011273 Dispatcher . UIThread . Invoke ( ( ) =>
13021274 {
@@ -1822,7 +1794,7 @@ public ContextMenu CreateContextMenuForCustomAction()
18221794 return menu ;
18231795 }
18241796
1825- public ContextMenu CreateContextMenuForHistoriesPage ( )
1797+ public ContextMenu CreateContextMenuForHistoryAdvancedOption ( )
18261798 {
18271799 var layout = new MenuItem ( ) ;
18281800 layout . Header = App . Text ( "Repository.HistoriesLayout" ) ;
@@ -1849,6 +1821,43 @@ public ContextMenu CreateContextMenuForHistoriesPage()
18491821 ev . Handled = true ;
18501822 } ;
18511823
1824+ var showFlags = new MenuItem ( ) ;
1825+ showFlags . Header = App . Text ( "Repository.ShowFlags" ) ;
1826+ showFlags . IsEnabled = false ;
1827+
1828+ var reflog = new MenuItem ( ) ;
1829+ reflog . Header = App . Text ( "Repository.ShowLostCommits" ) ;
1830+ reflog . Tag = "--reflog" ;
1831+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . Reflog ) )
1832+ reflog . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1833+ reflog . Click += ( _ , e ) =>
1834+ {
1835+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . Reflog ) ;
1836+ e . Handled = true ;
1837+ } ;
1838+
1839+ var firstParentOnly = new MenuItem ( ) ;
1840+ firstParentOnly . Header = App . Text ( "Repository.ShowFirstParentOnly" ) ;
1841+ firstParentOnly . Tag = "--first-parent" ;
1842+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . FirstParentOnly ) )
1843+ firstParentOnly . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1844+ firstParentOnly . Click += ( _ , e ) =>
1845+ {
1846+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . FirstParentOnly ) ;
1847+ e . Handled = true ;
1848+ } ;
1849+
1850+ var simplifyByDecoration = new MenuItem ( ) ;
1851+ simplifyByDecoration . Header = App . Text ( "Repository.ShowDecoratedCommitsOnly" ) ;
1852+ simplifyByDecoration . Tag = "--simplify-by-decoration" ;
1853+ if ( _settings . HistoryShowFlags . HasFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) )
1854+ simplifyByDecoration . Icon = App . CreateMenuIcon ( "Icons.Check" ) ;
1855+ simplifyByDecoration . Click += ( _ , e ) =>
1856+ {
1857+ ToggleHistoryShowFlag ( Models . HistoryShowFlags . SimplifyByDecoration ) ;
1858+ e . Handled = true ;
1859+ } ;
1860+
18521861 var order = new MenuItem ( ) ;
18531862 order . Header = App . Text ( "Repository.HistoriesOrder" ) ;
18541863 order . IsEnabled = false ;
@@ -1890,6 +1899,11 @@ public ContextMenu CreateContextMenuForHistoriesPage()
18901899 menu . Items . Add ( horizontal ) ;
18911900 menu . Items . Add ( vertical ) ;
18921901 menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1902+ menu . Items . Add ( showFlags ) ;
1903+ menu . Items . Add ( reflog ) ;
1904+ menu . Items . Add ( firstParentOnly ) ;
1905+ menu . Items . Add ( simplifyByDecoration ) ;
1906+ menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
18931907 menu . Items . Add ( order ) ;
18941908 menu . Items . Add ( dateOrder ) ;
18951909 menu . Items . Add ( topoOrder ) ;
@@ -3091,6 +3105,14 @@ private void CalcMatchedFilesForSearching()
30913105 MatchedFilesForSearching = matched ;
30923106 }
30933107
3108+ private void ToggleHistoryShowFlag ( Models . HistoryShowFlags flag )
3109+ {
3110+ if ( _settings . HistoryShowFlags . HasFlag ( flag ) )
3111+ HistoryShowFlags -= flag ;
3112+ else
3113+ HistoryShowFlags |= flag ;
3114+ }
3115+
30943116 private async void AutoFetchImpl ( object sender )
30953117 {
30963118 try
0 commit comments