Skip to content

Commit

Permalink
fixup! groups in italic
Browse files Browse the repository at this point in the history
  • Loading branch information
gerhardol committed Sep 13, 2022
1 parent f19ebe3 commit 39c0db4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
30 changes: 30 additions & 0 deletions GitUI/CommandsDialogs/BrowseDialog/MenuCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,37 @@ public static MenuCommand CreateSeparator()
return new MenuCommand { IsSeparator = true };
}

public static MenuCommand CreateGroupHeader(string text)
{
return new MenuCommand
{
IsGroupHeader = true,
Name = text,
Text = text,
};
}

public static ToolStripItem CreateToolStripItem(MenuCommand menuCommand)
{
if (menuCommand.IsSeparator)
{
return new ToolStripSeparator();
}

if (menuCommand.IsGroupHeader)
{
ToolStripMenuItem headerToolStripMenuItem = new()
{
Name = menuCommand.Name,
Text = menuCommand.Text,
Enabled = false,
};
_disabledFont ??= new Font(headerToolStripMenuItem.Font, FontStyle.Italic);
headerToolStripMenuItem.Font = _disabledFont;

return headerToolStripMenuItem;
}

ToolStripMenuItem toolStripMenuItem = new()
{
Name = menuCommand.Name,
Expand All @@ -54,12 +78,18 @@ public static ToolStripItem CreateToolStripItem(MenuCommand menuCommand)
}

private readonly List<ToolStripMenuItem> _registeredMenuItems = new();
private static Font? _disabledFont;

/// <summary>
/// if true all other properties have no meaning.
/// </summary>
public bool IsSeparator { get; set; }

/// <summary>
/// if true just text property have a meaning.
/// </summary>
public bool IsGroupHeader { get; set; }

/// <summary>
/// used for ToolStripItem and translation identification.
/// </summary>
Expand Down
18 changes: 9 additions & 9 deletions GitUI/Translation/English.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -9631,15 +9631,15 @@ See the changes in the commit form.</source>
<source>&amp;Sort commits by author date</source>
<target />
</trans-unit>
<trans-unit id="BranchesToolStripMenuItem.Text">
<trans-unit id="Branches.Text">
<source>Branches</source>
<target />
</trans-unit>
<trans-unit id="ColumnsToolStripMenuItem.Text">
<trans-unit id="Columns.Text">
<source>Columns</source>
<target />
</trans-unit>
<trans-unit id="CommitsToolStripMenuItem.Text">
<trans-unit id="Commits.Text">
<source>Commits</source>
<target />
</trans-unit>
Expand Down Expand Up @@ -9667,16 +9667,16 @@ See the changes in the commit form.</source>
<source>Go to &amp;parent commit</source>
<target />
</trans-unit>
<trans-unit id="GridInfoToolStripMenuItem.Text">
<trans-unit id="Grid info.Text">
<source>Grid info</source>
<target />
</trans-unit>
<trans-unit id="HighlightSelectedBranch.Text">
<source>Highlight selected branch (until refresh)</source>
<trans-unit id="Grid labels.Text">
<source>Grid labels</source>
<target />
</trans-unit>
<trans-unit id="LabelToolStripMenuItem.Text">
<source>Grid labels</source>
<trans-unit id="HighlightSelectedBranch.Text">
<source>Highlight selected branch (until refresh)</source>
<target />
</trans-unit>
<trans-unit id="NavigateBackward.Text">
Expand Down Expand Up @@ -9743,7 +9743,7 @@ See the changes in the commit form.</source>
<source>Show su&amp;perproject tags</source>
<target />
</trans-unit>
<trans-unit id="SortingLabel.Text">
<trans-unit id="Sorting.Text">
<source>Sorting</source>
<target />
</trans-unit>
Expand Down
42 changes: 6 additions & 36 deletions GitUI/UserControls/RevisionGrid/RevisionGridMenuCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,7 @@ Y Draw non relatives gray
//
// After refactoring the three items should be added to RevisionGrid
// as done with "ShowRemoteBranches" and not via RevisionGrid.Designer.cs
new MenuCommand
{
Name = "BranchesToolStripMenuItem",
Text = TranslatedStrings.Branches,
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader(TranslatedStrings.Branches),
new MenuCommand
{
Name = "ShowReflogReferences",
Expand Down Expand Up @@ -321,12 +316,7 @@ Y Draw non relatives gray

MenuCommand.CreateSeparator(),

new MenuCommand
{
Name = "CommitsToolStripMenuItem",
Text = "Commits",
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader("Commits"),
new MenuCommand
{
Name = "ShowArtificialCommits",
Expand All @@ -352,12 +342,7 @@ Y Draw non relatives gray

MenuCommand.CreateSeparator(),

new MenuCommand
{
Name = "LabelToolStripMenuItem",
Text = "Grid labels",
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader("Grid labels"),
new MenuCommand
{
Name = "ShowRemoteBranches",
Expand Down Expand Up @@ -398,12 +383,7 @@ Y Draw non relatives gray

MenuCommand.CreateSeparator(),

new MenuCommand
{
Name = "GridInfoToolStripMenuItem",
Text = "Grid info",
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader("Grid info"),
new MenuCommand
{
Name = "showBuildStatusIconToolStripMenuItem",
Expand Down Expand Up @@ -442,12 +422,7 @@ Y Draw non relatives gray

MenuCommand.CreateSeparator(),

new MenuCommand
{
Name = "ColumnsToolStripMenuItem",
Text = "Columns",
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader("Columns"),
new MenuCommand
{
Name = "showRevisionGraphColumnToolStripMenuItem",
Expand Down Expand Up @@ -486,12 +461,7 @@ Y Draw non relatives gray

MenuCommand.CreateSeparator(),

new MenuCommand
{
Name = "SortingLabel",
Text = "Sorting",
IsEnabledFunc = () => false
},
MenuCommand.CreateGroupHeader("Sorting"),
new MenuCommand
{
Name = "AuthorDateSort",
Expand Down

0 comments on commit 39c0db4

Please sign in to comment.