diff --git a/GitUI/Translation/English.xlf b/GitUI/Translation/English.xlf index b215f20ac3d..94b144255f6 100644 --- a/GitUI/Translation/English.xlf +++ b/GitUI/Translation/English.xlf @@ -3191,6 +3191,10 @@ Do you want to continue? &Diff contains (SLOW) + + Disable filters + + &Favourite Repositories diff --git a/GitUI/UserControls/FilterToolBar.Designer.cs b/GitUI/UserControls/FilterToolBar.Designer.cs index bd54f87fb99..0c8d6317cef 100644 --- a/GitUI/UserControls/FilterToolBar.Designer.cs +++ b/GitUI/UserControls/FilterToolBar.Designer.cs @@ -21,7 +21,8 @@ private void InitializeComponent() this.tsmiHash = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiDiffContainsFilter = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); - this.tsbtnAdvancedFilter = new System.Windows.Forms.ToolStripButton(); + this.tsbtnAdvancedFilter = new System.Windows.Forms.ToolStripSplitButton(); + this.tsmiDisableFilters = new System.Windows.Forms.ToolStripMenuItem(); this.tssbtnShowBranches = new System.Windows.Forms.ToolStripSplitButton(); this.tsmiShowBranchesAll = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiShowBranchesCurrent = new System.Windows.Forms.ToolStripMenuItem(); @@ -78,11 +79,21 @@ private void InitializeComponent() // tsbtnAdvancedFilter // this.tsbtnAdvancedFilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.tsbtnAdvancedFilter.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tsmiDisableFilters}); this.tsbtnAdvancedFilter.Image = global::GitUI.Properties.Images.FunnelPencil; this.tsbtnAdvancedFilter.Name = "tsbtnAdvancedFilter"; - this.tsbtnAdvancedFilter.Size = new System.Drawing.Size(23, 22); + this.tsbtnAdvancedFilter.Size = new System.Drawing.Size(32, 22); this.tsbtnAdvancedFilter.ToolTipText = "Advanced filter"; - this.tsbtnAdvancedFilter.Click += new System.EventHandler(this.tsbtnAdvancedFilter_Click); + this.tsbtnAdvancedFilter.ButtonClick += new System.EventHandler(this.tsbtnAdvancedFilter_ButtonClick); + this.tsbtnAdvancedFilter.DropDownOpening += new System.EventHandler(this.toolStripButtonLevelUp_DropDownOpening); + // + // tsmiDisableFilters + // + this.tsmiDisableFilters.Name = "tsmiDisableFilters"; + this.tsmiDisableFilters.Size = new System.Drawing.Size(259, 22); + this.tsmiDisableFilters.Text = "Disable filters"; + this.tsmiDisableFilters.Click += new System.EventHandler(this.tsmiDisableFilters_Click); // // menuCommitInfoPosition // @@ -269,7 +280,8 @@ private void InitializeComponent() private ToolStripTextBox tstxtRevisionFilter; private ToolStripLabel tslblRevisionFilter; private ToolStripSeparator toolStripSeparator19; - private ToolStripButton tsbtnAdvancedFilter; + private ToolStripSplitButton tsbtnAdvancedFilter; + private ToolStripMenuItem tsmiDisableFilters; private ToolStripSplitButton tssbtnShowBranches; private ToolStripMenuItem tsmiShowBranchesAll; private ToolStripMenuItem tsmiShowBranchesCurrent; diff --git a/GitUI/UserControls/FilterToolBar.cs b/GitUI/UserControls/FilterToolBar.cs index 9c57014ace5..50058aa576d 100644 --- a/GitUI/UserControls/FilterToolBar.cs +++ b/GitUI/UserControls/FilterToolBar.cs @@ -1,13 +1,11 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using GitCommands; -using GitExtUtils.GitUI; using GitUI.UserControls.RevisionGrid; using GitUIPluginInterfaces; using Microsoft.VisualStudio.Threading; @@ -299,9 +297,9 @@ private void revisionGridFilter_FilterChanged(object? sender, FilterChangedEvent tsmiShowFirstParent.Checked = e.ShowFirstParent; tsmiShowReflogs.Checked = e.ShowReflogReferences; InitBranchSelectionFilter(e); - tsbtnAdvancedFilter.Checked = e.HasFilter; tsbtnAdvancedFilter.AutoToolTip = e.HasFilter; tsbtnAdvancedFilter.ToolTipText = e.FilterSummary; + tsmiDisableFilters.Enabled = e.HasFilter; } private static void ToolStripSplitButtonDropDownClosed(object sender, EventArgs e) @@ -318,9 +316,16 @@ private static void ToolStripSplitButtonDropDownClosed(object sender, EventArgs } } - private void tsbtnAdvancedFilter_Click(object sender, EventArgs e) + private void tsbtnAdvancedFilter_ButtonClick(object sender, EventArgs e) { - RevisionGridFilter.ShowRevisionFilterDialog(); + if (!tsmiDisableFilters.Enabled) + { + RevisionGridFilter.ShowRevisionFilterDialog(); + } + else + { + tsbtnAdvancedFilter.ShowDropDown(); + } } private void tscboBranchFilter_Click(object sender, EventArgs e) @@ -357,6 +362,13 @@ private void tscboBranchFilter_TextUpdate(object sender, EventArgs e) UpdateBranchFilterItems(); } + private void toolStripButtonLevelUp_DropDownOpening(object sender, EventArgs e) + { + PreventToolStripSplitButtonClosing(sender as ToolStripSplitButton); + } + + private void tsmiDisableFilters_Click(object sender, EventArgs e) => RevisionGridFilter.DisableRevisionFilter(); + private void tsmiShowBranchesAll_Click(object sender, EventArgs e) => ApplyPresetBranchesFilter(RevisionGridFilter.ShowAllBranches); private void tsmiShowBranchesCurrent_Click(object sender, EventArgs e) => ApplyPresetBranchesFilter(RevisionGridFilter.ShowCurrentBranchOnly); @@ -393,7 +405,7 @@ public TestAccessor(FilterToolBar control) public ToolStripButton tsmiShowReflogs => _control.tsmiShowReflogs; public ToolStripTextBox tstxtRevisionFilter => _control.tstxtRevisionFilter; public ToolStripLabel tslblRevisionFilter => _control.tslblRevisionFilter; - public ToolStripButton tsbtnAdvancedFilter => _control.tsbtnAdvancedFilter; + public ToolStripSplitButton tsbtnAdvancedFilter => _control.tsbtnAdvancedFilter; public ToolStripSplitButton tssbtnShowBranches => _control.tssbtnShowBranches; public ToolStripMenuItem tsmiShowBranchesAll => _control.tsmiShowBranchesAll; public ToolStripMenuItem tsmiShowBranchesCurrent => _control.tsmiShowBranchesCurrent; diff --git a/GitUI/UserControls/RevisionGrid/IRevisionGridFilter.cs b/GitUI/UserControls/RevisionGrid/IRevisionGridFilter.cs index 4293d71b26d..7b296ad2b46 100644 --- a/GitUI/UserControls/RevisionGrid/IRevisionGridFilter.cs +++ b/GitUI/UserControls/RevisionGrid/IRevisionGridFilter.cs @@ -26,6 +26,11 @@ public interface IRevisionGridFilter /// Invalid 'diff contains' filter. void SetAndApplyRevisionFilter(RevisionFilter filter); + /// + /// Disables all filters. + /// + void DisableRevisionFilter(); + void ShowAllBranches(); void ShowCurrentBranchOnly();