Skip to content

Commit 5cb7ba0

Browse files
authored
Merge pull request #146 from rubberduck-vba/next
sync with main repo
2 parents 8966dc2 + 393c10d commit 5cb7ba0

File tree

117 files changed

+3480
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+3480
-432
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Which basically means it's a reimplementation of Git in C. It also [happens to b
8585

8686
This library makes localizing WPF applications at runtime using resx files a breeze. Thank you [Grant Frisken](http://www.codeproject.com/script/Membership/View.aspx?mid=1079060)!
8787

88-
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx).
88+
> Licensed under [The Code Project Open License](http://www.codeproject.com/info/cpol10.aspx) with the [author's permission](http://www.codeproject.com/Messages/5272045/Re-License.aspx) to re-release under the GPLv3.
8989
9090
###[Using Raw Input from C# to handle multiple keyboards](http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard)
9191

RetailCoder.VBE/Common/Hotkeys/HotkeyInfo.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Text;
33
using System.Windows.Forms;
4+
using Rubberduck.UI;
45

56
namespace Rubberduck.Common.Hotkeys
67
{
@@ -25,20 +26,21 @@ public override string ToString()
2526
var builder = new StringBuilder();
2627
if (_keys.HasFlag(Keys.Alt))
2728
{
28-
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyAlt);
29+
builder.Append(RubberduckUI.GeneralSettings_HotkeyAlt);
2930
builder.Append('+');
3031
}
3132
if (_keys.HasFlag(Keys.Control))
3233
{
33-
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyCtrl);
34+
builder.Append(RubberduckUI.GeneralSettings_HotkeyCtrl);
3435
builder.Append('+');
3536
}
3637
if (_keys.HasFlag(Keys.Shift))
3738
{
38-
builder.Append(Rubberduck.UI.RubberduckUI.GeneralSettings_HotkeyShift);
39+
builder.Append(RubberduckUI.GeneralSettings_HotkeyShift);
3940
builder.Append('+');
4041
}
41-
builder.Append(_keys & ~Modifiers);
42+
43+
builder.Append(HotkeyDisplayConverter.Convert(_keys & ~Modifiers));
4244
return builder.ToString();
4345
}
4446
}

RetailCoder.VBE/Common/RubberduckHooks.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Rubberduck.UI.Command;
1414
using Rubberduck.UI.Command.Refactorings;
1515
using NLog;
16+
using Rubberduck.UI;
1617

1718
namespace Rubberduck.Common
1819
{

RetailCoder.VBE/Common/WinAPI/RawInput.cs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,41 @@ protected override void WndProc(ref Message message)
3939
switch ((WM)message.Msg)
4040
{
4141
case WM.INPUT:
42+
{
43+
if (message.LParam == IntPtr.Zero)
44+
{
45+
break;
46+
}
47+
InputData rawBuffer;
48+
var dwSize = 0;
49+
var res = User32.GetRawInputData(message.LParam, DataCommand.RID_INPUT, IntPtr.Zero, ref dwSize, Marshal.SizeOf(typeof(RawInputHeader)));
50+
if (res != 0)
51+
{
52+
var ex = new Win32Exception(Marshal.GetLastWin32Error());
53+
Logger.Error(ex, "Error sizing the rawinput buffer: {0}", ex.Message);
54+
break;
55+
}
56+
57+
res = User32.GetRawInputData(message.LParam, DataCommand.RID_INPUT, out rawBuffer, ref dwSize, Marshal.SizeOf(typeof(RawInputHeader)));
58+
if (res == -1)
59+
{
60+
var ex = new Win32Exception(Marshal.GetLastWin32Error());
61+
Logger.Error(ex, "Error getting the rawinput buffer: {0}", ex.Message);
62+
break;
63+
}
64+
if (res == dwSize)
4265
{
43-
InputData _rawBuffer;
44-
var dwSize = 0;
45-
User32.GetRawInputData(message.LParam, DataCommand.RID_INPUT, IntPtr.Zero, ref dwSize, Marshal.SizeOf(typeof(RawInputHeader)));
46-
int res = User32.GetRawInputData(message.LParam, DataCommand.RID_INPUT, out _rawBuffer, ref dwSize, Marshal.SizeOf(typeof(RawInputHeader)));
47-
if (dwSize != res)
48-
{
49-
var ex = new Win32Exception(Marshal.GetLastWin32Error());
50-
Logger.Error(ex, "Error getting the rawinput buffer: {0}", ex.Message);
51-
return;
52-
}
5366
foreach (var device in _devices)
5467
{
55-
device.ProcessRawInput(_rawBuffer);
68+
device.ProcessRawInput(rawBuffer);
5669
}
5770
}
58-
break;
71+
else
72+
{
73+
//Something is seriously f'd up with Windows - the number of bytes copied does not match the reported buffer size.
74+
}
75+
}
76+
break;
5977
}
6078
base.WndProc(ref message);
6179
}

RetailCoder.VBE/Inspections/AssignedByValParameterInspectionResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ public class AssignedByValParameterInspectionResult : InspectionResultBase
1313
public AssignedByValParameterInspectionResult(IInspection inspection, Declaration target)
1414
: base(inspection, target)
1515
{
16-
_quickFixes = new[]
16+
_quickFixes = new CodeInspectionQuickFix[]
1717
{
1818
new PassParameterByReferenceQuickFix(target.Context, QualifiedSelection),
19+
new IgnoreOnceQuickFix(Context, QualifiedSelection, inspection.AnnotationName)
1920
};
2021
}
2122

RetailCoder.VBE/Inspections/CodeInspectionQuickFix.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Antlr4.Runtime;
1+
using System.Windows.Threading;
2+
using Antlr4.Runtime;
23
using Rubberduck.VBEditor;
34

45
namespace Rubberduck.Inspections
@@ -11,6 +12,9 @@ public abstract class CodeInspectionQuickFix
1112

1213
public CodeInspectionQuickFix(ParserRuleContext context, QualifiedSelection selection, string description)
1314
{
15+
Dispatcher.CurrentDispatcher.Thread.CurrentCulture = UI.Settings.Settings.Culture;
16+
Dispatcher.CurrentDispatcher.Thread.CurrentUICulture = UI.Settings.Settings.Culture;
17+
1418
_context = context;
1519
_selection = selection;
1620
_description = description;

RetailCoder.VBE/Inspections/EmptyStringLiteralInspection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2626
{
2727
return new InspectionResultBase[] { };
2828
}
29-
return ParseTreeResults.EmptyStringLiterals.Select(
30-
context => new EmptyStringLiteralInspectionResult(this,
29+
return ParseTreeResults.EmptyStringLiterals
30+
.Where(s => !IsInspectionDisabled(s.ModuleName.Component, s.Context.Start.Line))
31+
.Select(context => new EmptyStringLiteralInspectionResult(this,
3132
new QualifiedContext<ParserRuleContext>(context.ModuleName, context.Context)));
3233
}
3334

RetailCoder.VBE/Inspections/EmptyStringLiteralInspectionResult.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ public class EmptyStringLiteralInspectionResult : InspectionResultBase
1313
public EmptyStringLiteralInspectionResult(IInspection inspection, QualifiedContext<ParserRuleContext> qualifiedContext)
1414
: base(inspection, qualifiedContext.ModuleName, qualifiedContext.Context)
1515
{
16-
_quickFixes = new[]
16+
_quickFixes = new CodeInspectionQuickFix[]
1717
{
18-
new RepaceEmptyStringLiteralStatementQuickFix(Context, QualifiedSelection),
18+
new RepaceEmptyStringLiteralStatementQuickFix(Context, QualifiedSelection),
19+
new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName)
1920
};
2021
}
2122

RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ public class EncapsulatePublicFieldInspectionResult : InspectionResultBase
1616
public EncapsulatePublicFieldInspectionResult(IInspection inspection, Declaration target, RubberduckParserState state)
1717
: base(inspection, target)
1818
{
19-
_quickFixes = new[]
19+
_quickFixes = new CodeInspectionQuickFix[]
2020
{
2121
new EncapsulateFieldQuickFix(target.Context, target.QualifiedSelection, target, state),
22+
new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName)
2223
};
2324
}
2425

RetailCoder.VBE/Inspections/FunctionReturnValueNotUsedInspectionResult.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ public FunctionReturnValueNotUsedInspectionResult(
3434
var root = new ConvertToProcedureQuickFix(context, QualifiedSelection, returnStatements);
3535
var compositeFix = new CompositeCodeInspectionFix(root);
3636
children.ToList().ForEach(child => compositeFix.AddChild(new ConvertToProcedureQuickFix(child.Item1, child.Item2, child.Item3)));
37-
_quickFixes = new[]
37+
_quickFixes = new CodeInspectionQuickFix[]
3838
{
39-
compositeFix
39+
compositeFix,
40+
new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName)
4041
};
4142
}
4243

0 commit comments

Comments
 (0)