diff --git a/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/CodeChunks.db b/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/CodeChunks.db
new file mode 100644
index 0000000..ee7432a
Binary files /dev/null and b/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/CodeChunks.db differ
diff --git a/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/SemanticSymbols.db b/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/SemanticSymbols.db
new file mode 100644
index 0000000..f0c4841
Binary files /dev/null and b/.vs/dotSwitcher/CopilotIndices/18.6.39603.9996/SemanticSymbols.db differ
diff --git a/.vs/dotSwitcher/FileContentIndex/cf3a76d8-7473-4e1a-8019-642bff83afaf.vsidx b/.vs/dotSwitcher/FileContentIndex/cf3a76d8-7473-4e1a-8019-642bff83afaf.vsidx
new file mode 100644
index 0000000..060662c
Binary files /dev/null and b/.vs/dotSwitcher/FileContentIndex/cf3a76d8-7473-4e1a-8019-642bff83afaf.vsidx differ
diff --git a/.vs/dotSwitcher/v18/.suo b/.vs/dotSwitcher/v18/.suo
new file mode 100644
index 0000000..cc2b8f8
Binary files /dev/null and b/.vs/dotSwitcher/v18/.suo differ
diff --git a/.vs/dotSwitcher/v18/DocumentLayout.backup.json b/.vs/dotSwitcher/v18/DocumentLayout.backup.json
new file mode 100644
index 0000000..7eda535
--- /dev/null
+++ b/.vs/dotSwitcher/v18/DocumentLayout.backup.json
@@ -0,0 +1,12 @@
+{
+ "Version": 1,
+ "WorkspaceRootPath": "C:\\Users\\Idzumiko\\Documents\\GitHub\\dotSwitcher\\",
+ "Documents": [],
+ "DocumentGroupContainers": [
+ {
+ "Orientation": 0,
+ "VerticalTabListWidth": 256,
+ "DocumentGroups": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vs/dotSwitcher/v18/DocumentLayout.json b/.vs/dotSwitcher/v18/DocumentLayout.json
new file mode 100644
index 0000000..7eda535
--- /dev/null
+++ b/.vs/dotSwitcher/v18/DocumentLayout.json
@@ -0,0 +1,12 @@
+{
+ "Version": 1,
+ "WorkspaceRootPath": "C:\\Users\\Idzumiko\\Documents\\GitHub\\dotSwitcher\\",
+ "Documents": [],
+ "DocumentGroupContainers": [
+ {
+ "Orientation": 0,
+ "VerticalTabListWidth": 256,
+ "DocumentGroups": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/App.config b/App.config
index 3dbff35..3e0e37c 100644
--- a/App.config
+++ b/App.config
@@ -1,3 +1,3 @@
-
+
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 6a3565c..9e1c8fe 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -19,7 +19,7 @@ namespace dotSwitcher.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/Switcher/Switcher.cs b/Switcher/Switcher.cs
index e569175..fce3755 100644
--- a/Switcher/Switcher.cs
+++ b/Switcher/Switcher.cs
@@ -159,6 +159,8 @@ private void OnKeyPress(KeyboardEventArgs evtData)
if (evtData.Equals(settings.ConvertSelectionHotkey))
{
ConvertSelection();
+ evtData.Handled = true;
+ return;
}
if (this.HaveTrackingKeys(evtData))
@@ -206,6 +208,7 @@ private void ConvertSelection()
{
LowLevelAdapter.BackupClipboard();
LowLevelAdapter.SendCopy();
+ Thread.Sleep(settings.SwitchDelay);
var selection = Clipboard.GetText();
LowLevelAdapter.RestoreClipboard();
if (String.IsNullOrEmpty(selection))
@@ -213,25 +216,25 @@ private void ConvertSelection()
return;
}
-
LowLevelAdapter.ReleasePressedFnKeys();
var keys = new List(selection.Length);
- for(var i = 0; i < selection.Length; i++)
+ for (var i = 0; i < selection.Length; i++)
{
keys.Add(LowLevelAdapter.ToKey(selection[i]));
}
+
+ LowLevelAdapter.SendKeyPress(Keys.Delete, false);
LowLevelAdapter.SetNextKeyboardLayout();
+ Thread.Sleep(settings.SwitchDelay);
foreach (var key in keys)
{
- Debug.Write(key);
if (key != Keys.None)
{
LowLevelAdapter.SendKeyPress(key, (key & Keys.Shift) != Keys.None);
}
}
-
}
private void SwitchLayout()
{
diff --git a/UI/SettingsForm.Designer.cs b/UI/SettingsForm.Designer.cs
index b6eea14..b7ffa7a 100644
--- a/UI/SettingsForm.Designer.cs
+++ b/UI/SettingsForm.Designer.cs
@@ -1,4 +1,4 @@
-namespace dotSwitcher.UI
+namespace dotSwitcher.UI
{
partial class SettingsForm
{
@@ -32,6 +32,7 @@ private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
this.buttonCancelSettings = new System.Windows.Forms.Button();
this.buttonSaveSettings = new System.Windows.Forms.Button();
+ this.buttonResetSettings = new System.Windows.Forms.Button();
this.buttonExit = new System.Windows.Forms.Button();
this.checkBoxTrayIcon = new System.Windows.Forms.CheckBox();
this.checkBoxAutorun = new System.Windows.Forms.CheckBox();
@@ -47,13 +48,12 @@ private void InitializeComponent()
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.textBoxConvertHotkey = new System.Windows.Forms.TextBox();
this.textBoxSwitchHotkey = new System.Windows.Forms.TextBox();
- this.hotKeyBox1 = new dotSwitcher.UI.HotKeyBox();
this.checkBoxSmartSelection = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
- //
+ //
// buttonCancelSettings
- //
+ //
this.buttonCancelSettings.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancelSettings.Location = new System.Drawing.Point(523, 330);
this.buttonCancelSettings.Margin = new System.Windows.Forms.Padding(6);
@@ -63,9 +63,9 @@ private void InitializeComponent()
this.buttonCancelSettings.Text = "Cancel";
this.buttonCancelSettings.UseVisualStyleBackColor = true;
this.buttonCancelSettings.Click += new System.EventHandler(this.buttonCancelSettings_Click);
- //
+ //
// buttonSaveSettings
- //
+ //
this.buttonSaveSettings.Location = new System.Drawing.Point(374, 330);
this.buttonSaveSettings.Margin = new System.Windows.Forms.Padding(6);
this.buttonSaveSettings.Name = "buttonSaveSettings";
@@ -74,9 +74,20 @@ private void InitializeComponent()
this.buttonSaveSettings.Text = "Apply";
this.buttonSaveSettings.UseVisualStyleBackColor = true;
this.buttonSaveSettings.Click += new System.EventHandler(this.buttonSaveSettings_Click);
- //
+ //
+ // buttonResetSettings
+ //
+ this.buttonResetSettings.Location = new System.Drawing.Point(680, 330);
+ this.buttonResetSettings.Margin = new System.Windows.Forms.Padding(6);
+ this.buttonResetSettings.Name = "buttonResetSettings";
+ this.buttonResetSettings.Size = new System.Drawing.Size(200, 42);
+ this.buttonResetSettings.TabIndex = 34;
+ this.buttonResetSettings.Text = "Reset to defaults";
+ this.buttonResetSettings.UseVisualStyleBackColor = true;
+ this.buttonResetSettings.Click += new System.EventHandler(this.buttonResetSettings_Click);
+ //
// buttonExit
- //
+ //
this.buttonExit.Location = new System.Drawing.Point(61, 330);
this.buttonExit.Margin = new System.Windows.Forms.Padding(6);
this.buttonExit.Name = "buttonExit";
@@ -85,9 +96,9 @@ private void InitializeComponent()
this.buttonExit.Text = "Exit program";
this.buttonExit.UseVisualStyleBackColor = true;
this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click);
- //
+ //
// checkBoxTrayIcon
- //
+ //
this.checkBoxTrayIcon.AutoSize = true;
this.checkBoxTrayIcon.Location = new System.Drawing.Point(22, 83);
this.checkBoxTrayIcon.Margin = new System.Windows.Forms.Padding(6);
@@ -97,9 +108,9 @@ private void InitializeComponent()
this.checkBoxTrayIcon.Text = "Show tray icon";
this.checkBoxTrayIcon.UseVisualStyleBackColor = true;
this.checkBoxTrayIcon.CheckedChanged += new System.EventHandler(this.checkBoxTrayIcon_CheckedChanged);
- //
+ //
// checkBoxAutorun
- //
+ //
this.checkBoxAutorun.AutoSize = true;
this.checkBoxAutorun.Location = new System.Drawing.Point(22, 41);
this.checkBoxAutorun.Margin = new System.Windows.Forms.Padding(6);
@@ -109,9 +120,9 @@ private void InitializeComponent()
this.checkBoxAutorun.Text = "Start on Windows startup";
this.checkBoxAutorun.UseVisualStyleBackColor = true;
this.checkBoxAutorun.CheckedChanged += new System.EventHandler(this.checkBoxAutorun_CheckedChanged);
- //
- // label2
- //
+ //
+ // label2 (Convert-selection label, inside groupBox1)
+ //
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(11, 113);
this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@@ -119,9 +130,9 @@ private void InitializeComponent()
this.label2.Size = new System.Drawing.Size(169, 25);
this.label2.TabIndex = 23;
this.label2.Text = "Convert-selection:";
- //
- // label1
- //
+ //
+ // label1 (Convert-last-word label, inside groupBox1)
+ //
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 41);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@@ -129,18 +140,18 @@ private void InitializeComponent()
this.label1.Size = new System.Drawing.Size(169, 25);
this.label1.TabIndex = 22;
this.label1.Text = "Convert-last-word:";
- //
+ //
// textBoxDelay
- //
+ //
this.textBoxDelay.Location = new System.Drawing.Point(22, 203);
this.textBoxDelay.Margin = new System.Windows.Forms.Padding(6);
this.textBoxDelay.Name = "textBoxDelay";
this.textBoxDelay.Size = new System.Drawing.Size(83, 29);
this.textBoxDelay.TabIndex = 25;
this.textBoxDelay.TextChanged += new System.EventHandler(this.textBoxDelay_TextChanged);
- //
+ //
// label3
- //
+ //
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(18, 172);
this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@@ -148,9 +159,9 @@ private void InitializeComponent()
this.label3.Size = new System.Drawing.Size(213, 25);
this.label3.TabIndex = 26;
this.label3.Text = "Delay before switching:";
- //
+ //
// buttonGithub
- //
+ //
this.buttonGithub.Cursor = System.Windows.Forms.Cursors.Hand;
this.buttonGithub.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonGithub.Image = global::dotSwitcher.Properties.Resources.github;
@@ -164,17 +175,17 @@ private void InitializeComponent()
this.buttonGithub.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.buttonGithub.UseVisualStyleBackColor = true;
this.buttonGithub.Click += new System.EventHandler(this.buttonGithub_Click);
- //
- // textBoxSwitchLayoutHotkey
- //
- this.textBoxSwitchLayoutHotkey.Location = new System.Drawing.Point(981, 353);
+ //
+ // textBoxSwitchLayoutHotkey (inside groupBox1)
+ //
+ this.textBoxSwitchLayoutHotkey.Location = new System.Drawing.Point(240, 179);
this.textBoxSwitchLayoutHotkey.Margin = new System.Windows.Forms.Padding(6);
this.textBoxSwitchLayoutHotkey.Name = "textBoxSwitchLayoutHotkey";
- this.textBoxSwitchLayoutHotkey.Size = new System.Drawing.Size(307, 29);
+ this.textBoxSwitchLayoutHotkey.Size = new System.Drawing.Size(280, 29);
this.textBoxSwitchLayoutHotkey.TabIndex = 30;
- //
- // label4
- //
+ //
+ // label4 (Switch keyboard layout label, inside groupBox1)
+ //
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(11, 185);
this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@@ -182,26 +193,29 @@ private void InitializeComponent()
this.label4.Size = new System.Drawing.Size(219, 25);
this.label4.TabIndex = 29;
this.label4.Text = "Switch keyboard layout:";
- //
+ //
// groupBox1
- //
+ //
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.textBoxSwitchHotkey);
+ this.groupBox1.Controls.Add(this.textBoxConvertHotkey);
+ this.groupBox1.Controls.Add(this.textBoxSwitchLayoutHotkey);
this.groupBox1.Location = new System.Drawing.Point(326, 22);
this.groupBox1.Margin = new System.Windows.Forms.Padding(6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(6);
- this.groupBox1.Size = new System.Drawing.Size(334, 273);
+ this.groupBox1.Size = new System.Drawing.Size(560, 230);
this.groupBox1.TabIndex = 31;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Hotkeys";
- //
- // label5
- //
+ //
+ // label5 (? tooltip hint for Switch keyboard layout, inside groupBox1)
+ //
this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(297, 185);
+ this.label5.Location = new System.Drawing.Point(528, 185);
this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(23, 25);
@@ -209,41 +223,32 @@ private void InitializeComponent()
this.label5.Text = "?";
this.label5.MouseLeave += new System.EventHandler(this.label5_MouseLeave);
this.label5.MouseHover += new System.EventHandler(this.label5_MouseHover);
- //
+ //
// toolTip1
- //
+ //
this.toolTip1.AutoPopDelay = 5000;
this.toolTip1.InitialDelay = 100;
this.toolTip1.ReshowDelay = 100;
this.toolTip1.Popup += new System.Windows.Forms.PopupEventHandler(this.toolTip1_Popup);
- //
- // textBoxConvertHotkey
- //
- this.textBoxConvertHotkey.Location = new System.Drawing.Point(997, 194);
+ //
+ // textBoxConvertHotkey (inside groupBox1)
+ //
+ this.textBoxConvertHotkey.Location = new System.Drawing.Point(240, 107);
this.textBoxConvertHotkey.Margin = new System.Windows.Forms.Padding(6);
this.textBoxConvertHotkey.Name = "textBoxConvertHotkey";
- this.textBoxConvertHotkey.Size = new System.Drawing.Size(307, 29);
+ this.textBoxConvertHotkey.Size = new System.Drawing.Size(280, 29);
this.textBoxConvertHotkey.TabIndex = 24;
- //
- // textBoxSwitchHotkey
- //
- this.textBoxSwitchHotkey.Location = new System.Drawing.Point(997, 83);
+ //
+ // textBoxSwitchHotkey (inside groupBox1)
+ //
+ this.textBoxSwitchHotkey.Location = new System.Drawing.Point(240, 35);
this.textBoxSwitchHotkey.Margin = new System.Windows.Forms.Padding(6);
this.textBoxSwitchHotkey.Name = "textBoxSwitchHotkey";
- this.textBoxSwitchHotkey.Size = new System.Drawing.Size(307, 29);
+ this.textBoxSwitchHotkey.Size = new System.Drawing.Size(280, 29);
this.textBoxSwitchHotkey.TabIndex = 21;
- //
- // hotKeyBox1
- //
- this.hotKeyBox1.HotKey = ((dotSwitcher.Data.KeyboardEventArgs)(resources.GetObject("hotKeyBox1.HotKey")));
- this.hotKeyBox1.Location = new System.Drawing.Point(711, 537);
- this.hotKeyBox1.Margin = new System.Windows.Forms.Padding(6);
- this.hotKeyBox1.Name = "hotKeyBox1";
- this.hotKeyBox1.Size = new System.Drawing.Size(417, 29);
- this.hotKeyBox1.TabIndex = 32;
- //
+ //
// checkBoxSmartSelection
- //
+ //
this.checkBoxSmartSelection.AutoSize = true;
this.checkBoxSmartSelection.Checked = true;
this.checkBoxSmartSelection.CheckState = System.Windows.Forms.CheckState.Checked;
@@ -254,27 +259,24 @@ private void InitializeComponent()
this.checkBoxSmartSelection.Text = "Use smart convert selection";
this.checkBoxSmartSelection.UseVisualStyleBackColor = true;
this.checkBoxSmartSelection.CheckedChanged += new System.EventHandler(this.smartSelection_CheckedChanged);
- //
+ //
// SettingsForm
- //
+ //
this.AcceptButton = this.buttonSaveSettings;
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancelSettings;
- this.ClientSize = new System.Drawing.Size(1397, 827);
+ this.ClientSize = new System.Drawing.Size(920, 400);
this.Controls.Add(this.checkBoxSmartSelection);
- this.Controls.Add(this.hotKeyBox1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.buttonGithub);
- this.Controls.Add(this.textBoxSwitchLayoutHotkey);
this.Controls.Add(this.label3);
- this.Controls.Add(this.textBoxSwitchHotkey);
this.Controls.Add(this.textBoxDelay);
- this.Controls.Add(this.textBoxConvertHotkey);
this.Controls.Add(this.checkBoxTrayIcon);
this.Controls.Add(this.checkBoxAutorun);
this.Controls.Add(this.buttonExit);
this.Controls.Add(this.buttonSaveSettings);
+ this.Controls.Add(this.buttonResetSettings);
this.Controls.Add(this.buttonCancelSettings);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -294,6 +296,7 @@ private void InitializeComponent()
private System.Windows.Forms.Button buttonCancelSettings;
private System.Windows.Forms.Button buttonSaveSettings;
+ private System.Windows.Forms.Button buttonResetSettings;
private System.Windows.Forms.Button buttonExit;
private System.Windows.Forms.CheckBox checkBoxTrayIcon;
private System.Windows.Forms.CheckBox checkBoxAutorun;
@@ -309,7 +312,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.TextBox textBoxSwitchHotkey;
private System.Windows.Forms.TextBox textBoxConvertHotkey;
- private HotKeyBox hotKeyBox1;
private System.Windows.Forms.CheckBox checkBoxSmartSelection;
}
-}
\ No newline at end of file
+}
diff --git a/UI/SettingsForm.cs b/UI/SettingsForm.cs
index f5fdb94..57afdc4 100644
--- a/UI/SettingsForm.cs
+++ b/UI/SettingsForm.cs
@@ -207,6 +207,9 @@ void kbdHook_KeyboardEvent(object sender, KeyboardEventArgs e)
{
if (currentHotkeyType != HotKeyType.None)
{
+ if (e.Type == KeyboardEventType.KeyUp)
+ return;
+
var vk = e.KeyCode;
if (vk == Keys.Escape || vk == Keys.Back)
{
@@ -220,9 +223,9 @@ void kbdHook_KeyboardEvent(object sender, KeyboardEventArgs e)
&& vk != Keys.LControlKey && vk != Keys.RControlKey)
{
e.Handled = true;
+ SetCurrentHotkeyInputText(e.ToString());
+ currentHotkey = e;
}
- SetCurrentHotkeyInputText(e.ToString());
- currentHotkey = e;
}
}
// TODO: refactor this (make HotkeyInput : TextBox)
@@ -316,6 +319,17 @@ void ResetSettings()
{
settings.Reload();
}
+ void buttonResetSettings_Click(object sender, EventArgs e)
+ {
+ settings.SwitchHotkey = new KeyboardEventArgs(Keys.Pause, false);
+ settings.ConvertSelectionHotkey = new KeyboardEventArgs(Keys.Pause | Keys.Shift, false);
+ settings.SwitchLayoutHotkey = new KeyboardEventArgs(Keys.None, false);
+ settings.AutoStart = false;
+ settings.ShowTrayIcon = true;
+ settings.SmartSelection = true;
+ settings.SwitchDelay = 20;
+ UpdateUi();
+ }
/**
* OTHER INPUTS
diff --git a/dotSwitcher.csproj b/dotSwitcher.csproj
index 70586d6..e4c396a 100644
--- a/dotSwitcher.csproj
+++ b/dotSwitcher.csproj
@@ -9,7 +9,7 @@
Properties
dotSwitcher
dotSwitcher
- v4.6.1
+ v4.8
512