Skip to content

Commit

Permalink
AdvancedFilter: Disable filters button dropdown
Browse files Browse the repository at this point in the history
Change Advanced filter to a split button and add "Disable filters"
to the dropdown.
  • Loading branch information
gerhardol committed Jan 7, 2022
1 parent 487f5f1 commit ed2aead
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
20 changes: 16 additions & 4 deletions GitUI/UserControls/FilterToolBar.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions GitUI/UserControls/FilterToolBar.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions GitUI/UserControls/RevisionGrid/IRevisionGridFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public interface IRevisionGridFilter
/// <exception cref="InvalidOperationException">Invalid 'diff contains' filter.</exception>
void SetAndApplyRevisionFilter(RevisionFilter filter);

/// <summary>
/// Disables all filters.
/// </summary>
void DisableRevisionFilter();

void ShowAllBranches();

void ShowCurrentBranchOnly();
Expand Down

0 comments on commit ed2aead

Please sign in to comment.