Skip to content

Commit f84cc65

Browse files
committed
2 parents 8980826 + 2c61342 commit f84cc65

19 files changed

+139
-42
lines changed

RetailCoder.VBE/App.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private void State_StatusMessageUpdate(object sender, RubberduckStatusMessageEve
6565
message = RubberduckUI.ParserState_LoadingReference;
6666
}
6767

68-
_stateBar.SetStatusLabelCaption(message);
68+
_stateBar.SetStatusLabelCaption(message, _parser.State.ModuleExceptions.Count);
6969
}
7070

7171
private void _hooks_MessageReceived(object sender, HookEventArgs e)
@@ -199,6 +199,7 @@ public void Startup()
199199
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
200200
_appMenus.Localize();
201201
_stateBar.SetStatusLabelCaption(ParserState.Pending);
202+
_stateBar.EvaluateCanExecute(_parser.State);
202203
UpdateLoggingLevel();
203204
}
204205

@@ -219,7 +220,7 @@ private void Parser_StateChanged(object sender, EventArgs e)
219220
Logger.Debug("App handles StateChanged ({0}), evaluating menu states...", _parser.State.Status);
220221
_appMenus.EvaluateCanExecute(_parser.State);
221222
_stateBar.EvaluateCanExecute(_parser.State);
222-
_stateBar.SetStatusLabelCaption(_parser.State.Status);
223+
_stateBar.SetStatusLabelCaption(_parser.State.Status, _parser.State.ModuleExceptions.Count);
223224
}
224225

225226
private void LoadConfig()

RetailCoder.VBE/Properties/Resources.Designer.cs

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,7 @@
412412
<data name="RD-300x250-base" type="System.Resources.ResXFileRef, System.Windows.Forms">
413413
<value>..\Resources\RD-300x250-base.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
414414
</data>
415+
<data name="circle_mask" type="System.Resources.ResXFileRef, System.Windows.Forms">
416+
<value>..\Resources\circle_mask.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
417+
</data>
415418
</root>
126 Bytes
Binary file not shown.

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,7 @@
12911291
<Resource Include="Resources\Custom\PNG\Task.png" />
12921292
<Resource Include="Resources\Custom\PNG\TestManager.png" />
12931293
<Resource Include="Resources\Custom\PNG\TestMethod.png" />
1294+
<None Include="Resources\circle_mask.bmp" />
12941295
<Content Include="Resources\Custom\attribution.txt" />
12951296
<Content Include="Resources\Custom\cc_license.txt" />
12961297
<Content Include="Resources\Custom\Mask\AddPropertyMask.bmp" />

RetailCoder.VBE/UI/Command/IMenuItem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public interface IMenuItem
99
{
1010
string Key { get; }
1111
Func<string> Caption { get; }
12+
Func<string> ToolTipText { get; }
1213
bool BeginGroup { get; }
1314
int DisplayOrder { get; }
1415
}
@@ -17,6 +18,7 @@ public interface ICommandMenuItem : IMenuItem
1718
{
1819
bool EvaluateCanExecute(RubberduckParserState state);
1920
bool HiddenWhenDisabled { get; }
21+
bool IsVisible { get; }
2022
ButtonStyle ButtonStyle { get; }
2123
CommandBase Command { get; }
2224
Image Image { get; }

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ public void Localize()
4040
foreach (var kvp in _items)
4141
{
4242
var item = kvp;
43-
UiDispatcher.Invoke(() => item.Value.Caption = item.Key.Caption.Invoke());
43+
UiDispatcher.Invoke(() =>
44+
{
45+
item.Value.Caption = item.Key.Caption.Invoke();
46+
item.Value.TooltipText = item.Key.ToolTipText.Invoke();
47+
});
4448
}
4549
}
4650

@@ -72,9 +76,11 @@ private ICommandBarControl InitializeChildControl(ICommandMenuItem item)
7276
child.Mask = item.Mask;
7377
child.ApplyIcon();
7478

79+
child.IsVisible = item.IsVisible;
7580
child.BeginsGroup = item.BeginGroup;
7681
child.Tag = item.GetType().FullName;
7782
child.Caption = item.Caption.Invoke();
83+
child.TooltipText = item.ToolTipText.Invoke();
7884

7985
if (item.Command != null)
8086
{
@@ -109,7 +115,7 @@ public void RemoveChildren()
109115
{
110116
child.Click -= child_Click;
111117
child.Delete();
112-
child.Release(true);
118+
//child.Release();
113119
}
114120
}
115121

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/ContextSelectionLabelMenuItem.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ public void SetCaption(string caption)
1717
_caption = caption;
1818
}
1919

20+
private string _tooltip;
21+
public void SetToolTip(string tooltip)
22+
{
23+
_tooltip = tooltip;
24+
}
25+
public override Func<string> ToolTipText { get { return () => _tooltip; } }
26+
2027
public override bool EvaluateCanExecute(RubberduckParserState state)
2128
{
2229
return false;

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/ReparseCommandMenuItem.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Drawing;
23
using Rubberduck.Properties;
34
using Rubberduck.VBEditor.SafeComWrappers.MSForms;
@@ -10,8 +11,21 @@ public ReparseCommandMenuItem(CommandBase command) : base(command)
1011
{
1112
}
1213

13-
public override ButtonStyle ButtonStyle { get { return ButtonStyle.Icon; } }
14+
private string _caption;
15+
public void SetCaption(string caption)
16+
{
17+
_caption = caption;
18+
}
19+
public override Func<string> Caption { get { return () => _caption; } }
20+
21+
private string _tooltip;
22+
public void SetToolTip(string tooltip)
23+
{
24+
_tooltip = tooltip;
25+
}
26+
public override Func<string> ToolTipText { get { return () => _tooltip; } }
1427

28+
public override ButtonStyle ButtonStyle { get { return ButtonStyle.IconAndCaption; } }
1529
public override string Key { get { return "HotkeyDescription_ParseAll"; } }
1630
public override Image Image { get { return Resources.arrow_circle_double; } }
1731
public override Image Mask { get { return Resources.arrow_circle_double_mask; } }

RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,29 @@ public RubberduckCommandBar(IEnumerable<ICommandMenuItem> items)
1212
{
1313
}
1414

15-
public void SetStatusLabelCaption(ParserState state)
15+
public void SetStatusLabelCaption(ParserState state, int? errorCount = null)
1616
{
1717
var caption = RubberduckUI.ResourceManager.GetString("ParserState_" + state, Settings.Settings.Culture);
18-
SetStatusLabelCaption(caption);
18+
SetStatusLabelCaption(caption, errorCount);
1919
}
2020

21-
public void SetStatusLabelCaption(string caption)
21+
public void SetStatusLabelCaption(string caption, int? errorCount = null)
2222
{
23-
var child = FindChildByTag(typeof(ShowParserErrorsCommandMenuItem).FullName) as ShowParserErrorsCommandMenuItem;
24-
if (child == null) { return; }
23+
var reparseCommandButton = FindChildByTag(typeof(ReparseCommandMenuItem).FullName) as ReparseCommandMenuItem;
24+
if (reparseCommandButton == null) { return; }
25+
26+
var showErrorsCommandButton = FindChildByTag(typeof(ShowParserErrorsCommandMenuItem).FullName) as ShowParserErrorsCommandMenuItem;
27+
if (showErrorsCommandButton == null) { return; }
2528

26-
UiDispatcher.Invoke(() => child.SetCaption(caption));
29+
UiDispatcher.Invoke(() =>
30+
{
31+
reparseCommandButton.SetCaption(caption);
32+
reparseCommandButton.SetToolTip(string.Format(RubberduckUI.ReparseToolTipText, caption));
33+
if (errorCount.HasValue && errorCount.Value > 0)
34+
{
35+
showErrorsCommandButton.SetToolTip(string.Format(RubberduckUI.ParserErrorToolTipText, errorCount.Value));
36+
}
37+
});
2738
Localize();
2839
}
2940

@@ -32,7 +43,11 @@ public void SetContextSelectionCaption(string caption)
3243
var child = FindChildByTag(typeof(ContextSelectionLabelMenuItem).FullName) as ContextSelectionLabelMenuItem;
3344
if (child == null) { return; }
3445

35-
UiDispatcher.Invoke(() => child.SetCaption(caption));
46+
UiDispatcher.Invoke(() =>
47+
{
48+
child.SetCaption(caption);
49+
//child.SetToolTip(?);
50+
});
3651
Localize();
3752
}
3853

0 commit comments

Comments
 (0)