Skip to content

Commit ffdd268

Browse files
author
SlavaRa
committed
Support for hot keys are converting to uppercase, lowercase in rename form
1 parent f0ba0d4 commit ffdd268

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed

External/Plugins/CodeRefactor/CodeRefactor.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@
7474
-->
7575
<ItemGroup>
7676
<Reference Include="System" />
77+
<Reference Include="System.Data" />
7778
<Reference Include="System.Drawing" />
7879
<Reference Include="System.Windows.Forms" />
80+
<Reference Include="System.Xml" />
7981
</ItemGroup>
8082
<ItemGroup>
8183
<Compile Include="Commands\ExtractLocalVariableCommand.cs" />
@@ -96,6 +98,9 @@
9698
<Compile Include="Controls\DividedCheckedListBox.cs">
9799
<SubType>Component</SubType>
98100
</Compile>
101+
<Compile Include="Controls\LineEntryDialog.cs">
102+
<SubType>Form</SubType>
103+
</Compile>
99104
<Compile Include="Controls\ProgressDialog.cs">
100105
<SubType>Form</SubType>
101106
</Compile>

External/Plugins/CodeRefactor/Commands/Rename.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
using ASCompletion.Completion;
66
using ASCompletion.Context;
77
using ASCompletion.Model;
8+
using CodeRefactor.Controls;
89
using CodeRefactor.Provider;
910
using PluginCore;
1011
using PluginCore.Controls;
1112
using PluginCore.FRService;
1213
using PluginCore.Helpers;
1314
using PluginCore.Localization;
1415
using PluginCore.Managers;
15-
using ProjectManager.Helpers;
1616
using ProjectManager.Projects;
1717

1818
namespace CodeRefactor.Commands
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using PluginCore;
2+
using System.Windows.Forms;
3+
4+
namespace CodeRefactor.Controls
5+
{
6+
class LineEntryDialog : ProjectManager.Helpers.LineEntryDialog
7+
{
8+
readonly Keys shortcutToLowercase;
9+
readonly Keys shortcutToUppercase;
10+
11+
public LineEntryDialog(string captionText, string labelText, string defaultLine) : base(captionText, labelText, defaultLine)
12+
{
13+
shortcutToLowercase = PluginBase.MainForm.GetShortcutItemKeys("EditMenu.ToLowercase");
14+
shortcutToUppercase = PluginBase.MainForm.GetShortcutItemKeys("EditMenu.ToUppercase");
15+
lineBox.KeyDown += OnLineBoxOnKeyDown;
16+
}
17+
18+
void OnLineBoxOnKeyDown(object sender, KeyEventArgs args)
19+
{
20+
string selectedText = lineBox.SelectedText;
21+
if (string.IsNullOrEmpty(selectedText)) return;
22+
Keys keys = args.KeyData;
23+
if (keys == shortcutToLowercase) selectedText = selectedText.ToLower();
24+
else if (keys == shortcutToUppercase) selectedText = selectedText.ToUpper();
25+
else return;
26+
int selectionStart = lineBox.SelectionStart;
27+
int selectionLength = lineBox.SelectionLength;
28+
lineBox.Paste(selectedText);
29+
SelectRange(selectionStart, selectionLength);
30+
}
31+
}
32+
}

External/Plugins/CodeRefactor/PluginMain.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using PluginCore.Managers;
1717
using PluginCore.Utilities;
1818
using ProjectManager.Actions;
19-
using ProjectManager.Helpers;
2019

2120
namespace CodeRefactor
2221
{

External/Plugins/ProjectManager/Helpers/LineEntryDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class LineEntryDialog : System.Windows.Forms.Form
1616

1717
#region Form Designer Components
1818

19-
private System.Windows.Forms.TextBox lineBox;
19+
protected System.Windows.Forms.TextBox lineBox;
2020
private System.Windows.Forms.Button btnOK;
2121
private System.Windows.Forms.Button btnCancel;
2222
/// <summary>

0 commit comments

Comments
 (0)