Skip to content

Commit e265911

Browse files
committed
Merge pull request #67 from rubberduck-vba/next
sync with main repo
2 parents 0ab7aba + cf82f30 commit e265911

File tree

9 files changed

+609
-390
lines changed

9 files changed

+609
-390
lines changed

RetailCoder.VBE/Common/Hotkeys/Hotkey.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void Attach()
5353

5454
if (key == Keys.None)
5555
{
56-
throw new InvalidOperationException("Invalid key.");
56+
throw new InvalidOperationException(Rubberduck.UI.RubberduckUI.CommonHotkey_InvalidKey);
5757
}
5858

5959
HookKey(key, shift);
@@ -63,7 +63,7 @@ public void Detach()
6363
{
6464
if (!IsAttached)
6565
{
66-
throw new InvalidOperationException("Hook is already detached.");
66+
throw new InvalidOperationException(Rubberduck.UI.RubberduckUI.CommonHotkey_HookDetached);
6767
}
6868

6969
User32.UnregisterHotKey(_hWndVbe, HotkeyInfo.HookId);
@@ -76,20 +76,20 @@ private void HookKey(Keys key, uint shift)
7676
{
7777
if (IsAttached)
7878
{
79-
throw new InvalidOperationException("Hook is already attached.");
79+
throw new InvalidOperationException(Rubberduck.UI.RubberduckUI.CommonHotkey_HookAttached);
8080
}
8181

8282
var hookId = (IntPtr)Kernel32.GlobalAddAtom(Guid.NewGuid().ToString());
8383
var success = User32.RegisterHotKey(_hWndVbe, hookId, shift, (uint)key);
8484
if (!success)
8585
{
86-
Debug.WriteLine("Hotkey ({0}) not registered.", key);
87-
//throw new Win32Exception("HotKey was not registered.");
86+
Debug.WriteLine(Rubberduck.UI.RubberduckUI.CommonHotkey_KeyNotRegistered, key);
87+
//throw new Win32Exception(Rubberduck.UI.RubberduckUI.CommonHotkey_KeyNotRegistered, key);
8888
}
8989

9090
HotkeyInfo = new HotkeyInfo(hookId, Combo);
9191
IsAttached = true;
92-
Debug.WriteLine("Hotkey '{0}' hooked successfully to command '{1}'", Key, Command.GetType());
92+
Debug.WriteLine("Hotkey '{0}' hooked successfully to command '{1}'", Key, Command.GetType()); //no translation needed for Debug.Writeline
9393
}
9494

9595
private static readonly IDictionary<char,uint> Modifiers = new Dictionary<char, uint>

RetailCoder.VBE/Settings/ConfigurationLoader.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text;
66
using System.Windows.Forms;
77
using System.Windows.Input;
8+
using Microsoft.Win32;
89
using Rubberduck.Inspections;
910
using Rubberduck.UI;
1011
using Rubberduck.UI.Command;
@@ -205,6 +206,13 @@ public CodeInspectionSetting[] GetDefaultCodeInspections()
205206

206207
public IndenterSettings GetDefaultIndenterSettings()
207208
{
209+
var tabWidth = 4;
210+
var reg = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VBA\6.0\Common", false) ??
211+
Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\VBA\7.0\Common", false);
212+
if (reg != null)
213+
{
214+
tabWidth = Convert.ToInt32(reg.GetValue("TabWidth") ?? tabWidth);
215+
}
208216
return new IndenterSettings
209217
{
210218
IndentEntireProcedureBody = true,
@@ -222,7 +230,7 @@ public IndenterSettings GetDefaultIndenterSettings()
222230
EnableUndo = true,
223231
EndOfLineCommentStyle = SmartIndenter.EndOfLineCommentStyle.AlignInColumn,
224232
EndOfLineCommentColumnSpaceAlignment = 50,
225-
IndentSpaces = 4
233+
IndentSpaces = tabWidth
226234
};
227235
}
228236
}

RetailCoder.VBE/UI/Command/MenuItems/RefactorEncapsulateFieldCommandMenuItem.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using System.Drawing;
12
using System.Windows.Input;
23
using Rubberduck.Parsing.VBA;
4+
using Rubberduck.Properties;
35
using Rubberduck.UI.Command.MenuItems.ParentMenus;
46

57
namespace Rubberduck.UI.Command.MenuItems
@@ -13,6 +15,7 @@ public RefactorEncapsulateFieldCommandMenuItem(ICommand command)
1315

1416
public override string Key { get { return "RefactorMenu_EncapsulateField"; } }
1517
public override int DisplayOrder { get { return (int)RefactoringsMenuItemDisplayOrder.EncapsulateField; } }
18+
public override Image Image { get { return Resources.AddProperty_5538_32; } }
1619

1720
public override bool EvaluateCanExecute(RubberduckParserState state)
1821
{

RetailCoder.VBE/UI/Command/MenuItems/RefactorExtractInterfaceCommandMenuItem.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using System.Drawing;
12
using System.Windows.Input;
23
using Rubberduck.Parsing.VBA;
4+
using Rubberduck.Properties;
35
using Rubberduck.UI.Command.MenuItems.ParentMenus;
46

57
namespace Rubberduck.UI.Command.MenuItems
@@ -13,6 +15,7 @@ public RefactorExtractInterfaceCommandMenuItem(ICommand command)
1315

1416
public override string Key { get { return "RefactorMenu_ExtractInterface"; } }
1517
public override int DisplayOrder { get { return (int)RefactoringsMenuItemDisplayOrder.ExtractInterface; } }
18+
public override Image Image { get { return Resources.ExtractInterface_6778_32; } }
1619

1720
public override bool EvaluateCanExecute(RubberduckParserState state)
1821
{

RetailCoder.VBE/UI/Command/MenuItems/RefactorImplementInterfaceCommandMenuItem.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using System.Drawing;
12
using System.Windows.Input;
23
using Rubberduck.Parsing.VBA;
4+
using Rubberduck.Properties;
35
using Rubberduck.UI.Command.MenuItems.ParentMenus;
46

57
namespace Rubberduck.UI.Command.MenuItems
@@ -13,6 +15,7 @@ public RefactorImplementInterfaceCommandMenuItem(ICommand command)
1315

1416
public override string Key { get { return "RefactorMenu_ImplementInterface"; } }
1517
public override int DisplayOrder { get { return (int)RefactoringsMenuItemDisplayOrder.ImplementInterface; } }
18+
public override Image Image { get { return Resources.ImplementInterface_5540_32; } }
1619

1720
public override bool EvaluateCanExecute(RubberduckParserState state)
1821
{

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

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

RetailCoder.VBE/UI/RubberduckUI.de.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,4 +1459,16 @@ Allen Sternguckern, Likern &amp; Followern, für das warme Kribbeln
14591459
<data name="UnitTest_NewMethod_ErrorNotRaised" xml:space="preserve">
14601460
<value>Der erwartete Fehler wurde nicht gefunden</value>
14611461
</data>
1462+
<data name="CommonHotkey_InvalidKey" xml:space="preserve">
1463+
<value>Ungültiges Zeichen.</value>
1464+
</data>
1465+
<data name="CommonHotkey_HookDetached" xml:space="preserve">
1466+
<value>Hook ist nicht mehr aktiv.</value>
1467+
</data>
1468+
<data name="CommonHotkey_HookAttached" xml:space="preserve">
1469+
<value>Hook ist schon hinzugefügt.</value>
1470+
</data>
1471+
<data name="CommonHotkey_KeyNotRegistered" xml:space="preserve">
1472+
<value>Hotkey ({0}) ist nicht registriert.</value>
1473+
</data>
14621474
</root>

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,4 +1477,16 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
14771477
<data name="UnitTest_NewMethod_ErrorNotRaised" xml:space="preserve">
14781478
<value>Expected error was not raised</value>
14791479
</data>
1480+
<data name="CommonHotkey_InvalidKey" xml:space="preserve">
1481+
<value>Invalid key.</value>
1482+
</data>
1483+
<data name="CommonHotkey_HookDetached" xml:space="preserve">
1484+
<value>Hook is already detached.</value>
1485+
</data>
1486+
<data name="CommonHotkey_HookAttached" xml:space="preserve">
1487+
<value>Hook is already attached.</value>
1488+
</data>
1489+
<data name="CommonHotkey_KeyNotRegistered" xml:space="preserve">
1490+
<value>Hotkey ({0}) not registered.</value>
1491+
</data>
14801492
</root>

0 commit comments

Comments
 (0)