private IEnumerable <MenuCommand> CreateViewMenuCommands() { var resultList = new List <MenuCommand>(); // the next three MenuCommands just reuse (the currently rather // convoluted) logic from RevisionGrid. // After refactoring the three items should be added to RevisionGrid // as done with "ShowRemoteBranches" and not via RevisionGrid.Designer.cs { var menuCommand = new MenuCommand(); menuCommand.Name = "ShowAllBranches"; menuCommand.Text = "Show all branches"; menuCommand.ExecuteAction = () => _revisionGrid.ShowAllBranchesToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => _revisionGrid.ShowAllBranchesToolStripMenuItemChecked; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "ShowCurrentBranchOnly"; menuCommand.Text = "Show current branch only"; menuCommand.ExecuteAction = () => _revisionGrid.ShowCurrentBranchOnlyToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => _revisionGrid.ShowCurrentBranchOnlyToolStripMenuItemChecked; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "ShowFilteredBranches"; menuCommand.Text = "Show filtered branches"; menuCommand.ExecuteAction = () => _revisionGrid.ShowFilteredBranchesToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => _revisionGrid.ShowFilteredBranchesToolStripMenuItemChecked; resultList.Add(menuCommand); } resultList.Add(MenuCommand.CreateSeparator()); { var menuCommand = new MenuCommand(); menuCommand.Name = "ShowRemoteBranches"; menuCommand.Text = "Show remote branches"; menuCommand.ExecuteAction = () => ShowRemoteBranches = !ShowRemoteBranches; menuCommand.IsCheckedFunc = () => ShowRemoteBranches; resultList.Add(menuCommand); } resultList.Add(MenuCommand.CreateSeparator()); { var menuCommand = new MenuCommand(); menuCommand.Name = "showRevisionGraphToolStripMenuItem"; menuCommand.Text = "Show revision graph"; menuCommand.ExecuteAction = () => _revisionGrid.ShowRevisionGraphToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => _revisionGrid.IsGraphLayout(); resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "drawNonrelativesGrayToolStripMenuItem"; menuCommand.Text = "Draw non relatives gray"; menuCommand.ExecuteAction = () => _revisionGrid.DrawNonrelativesGrayToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => AppSettings.RevisionGraphDrawNonRelativesGray; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "orderRevisionsByDateToolStripMenuItem"; menuCommand.Text = "Order revisions by date"; menuCommand.ExecuteAction = () => _revisionGrid.OrderRevisionsByDateToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => AppSettings.OrderRevisionByDate; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showAuthorDateToolStripMenuItem"; menuCommand.Text = "Show author date"; menuCommand.ExecuteAction = () => _revisionGrid.ShowAuthorDateToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => AppSettings.ShowAuthorDate; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showRelativeDateToolStripMenuItem"; menuCommand.Text = "Show relative date"; menuCommand.ExecuteAction = () => _revisionGrid.ShowRelativeDateToolStripMenuItemClick(null, null); menuCommand.IsCheckedFunc = () => AppSettings.RelativeDate; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showMergeCommitsToolStripMenuItem"; menuCommand.Text = "Show merge commits"; menuCommand.ExecuteAction = () => _revisionGrid.ShowMergeCommitsToolStripMenuItem_Click(null, null); menuCommand.IsCheckedFunc = () => AppSettings.ShowMergeCommits; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showTagsToolStripMenuItem"; menuCommand.Text = "Show tags"; menuCommand.ExecuteAction = () => _revisionGrid.ShowTagsToolStripMenuItem_Click(null, null); menuCommand.IsCheckedFunc = () => AppSettings.ShowTags; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showGitNotesToolStripMenuItem"; menuCommand.Text = "Show git notes"; menuCommand.ExecuteAction = () => _revisionGrid.ShowGitNotesToolStripMenuItem_Click(null, null); menuCommand.IsCheckedFunc = () => AppSettings.ShowGitNotes; resultList.Add(menuCommand); } { var menuCommand = new MenuCommand(); menuCommand.Name = "showIsMessageMultilineToolStripMenuItem"; menuCommand.Text = "Show indicator for multiline message"; menuCommand.ExecuteAction = () => { AppSettings.ShowIndicatorForMultilineMessage = !AppSettings.ShowIndicatorForMultilineMessage; _revisionGrid.ForceRefreshRevisions(); }; menuCommand.IsCheckedFunc = () => AppSettings.ShowIndicatorForMultilineMessage; resultList.Add(menuCommand); } resultList.Add(MenuCommand.CreateSeparator()); { var menuCommand = new MenuCommand(); menuCommand.Name = "ToggleHighlightSelectedBranch"; menuCommand.Text = "Highlight selected branch (until refresh)"; menuCommand.ShortcutKeyDisplayString = GetShortcutKeyDisplayStringFromRevisionGridIfAvailable(GitUI.RevisionGrid.Commands.ToggleHighlightSelectedBranch); menuCommand.ExecuteAction = () => _revisionGrid.ExecuteCommand(GitUI.RevisionGrid.Commands.ToggleHighlightSelectedBranch); resultList.Add(menuCommand); } resultList.Add(MenuCommand.CreateSeparator()); { var menuCommand = new MenuCommand(); menuCommand.Name = "filterToolStripMenuItem"; menuCommand.Text = "Set advanced filter"; menuCommand.Image = global::GitUI.Properties.Resources.IconFilter; menuCommand.ExecuteAction = () => _revisionGrid.FilterToolStripMenuItemClick(null, null); resultList.Add(menuCommand); } return(resultList); }