Skip to content

Commit

Permalink
Revert "replaced -1 default value with a nullable int parameter"
Browse files Browse the repository at this point in the history
This reverts commit a14a05b.
  • Loading branch information
retailcoder committed Aug 5, 2015
1 parent 53d9ddc commit 6332045
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion RetailCoder.VBE/UI/Commands/IRubberduckMenuCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IRubberduckMenuCommand
/// <param name="beforeIndex">Optionally specifies the index of the UI element in the parent collection.</param>
/// <param name="image">An optional icon to represent the command.</param>
/// <param name="mask">A transparency mask for the command's icon. Required if <see cref="image"/> is not null.</param>
void AddCommandBarButton(CommandBarControls parent, string caption, bool beginGroup = false, int? beforeIndex = null, Image image = null, Image mask = null);
void AddCommandBarButton(CommandBarControls parent, string caption, bool beginGroup = false, int beforeIndex = -1, Image image = null, Image mask = null);

/// <summary>
/// Destroys all UI elements associated to the command.
Expand Down
8 changes: 4 additions & 4 deletions RetailCoder.VBE/UI/Commands/RubberduckMenuCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public RubberduckMenuCommand()
_buttons = new List<CommandBarButton>();
}

public void AddCommandBarButton(CommandBarControls parent, string caption, bool beginGroup = false, int? beforeIndex = null, Image image = null, Image mask = null)
public void AddCommandBarButton(CommandBarControls parent, string caption, bool beginGroup = false, int beforeIndex = -1, Image image = null, Image mask = null)
{
if (image != null && mask == null)
{
Expand All @@ -31,9 +31,9 @@ public void AddCommandBarButton(CommandBarControls parent, string caption, bool
throw new ArgumentNullException("'mask' cannot be null if 'image' is non-null.");
}

var button = (CommandBarButton) (beforeIndex.HasValue
? parent.Add(MsoControlType.msoControlButton, Before: beforeIndex.Value, Temporary: true)
: parent.Add(MsoControlType.msoControlButton, Temporary: true));
var button = (CommandBarButton) (beforeIndex == -1
? parent.Add(MsoControlType.msoControlButton, Temporary: true)
: parent.Add(MsoControlType.msoControlButton, Before: beforeIndex, Temporary: true));

button.BeginGroup = beginGroup;
button.Caption = caption;
Expand Down

0 comments on commit 6332045

Please sign in to comment.