Skip to content

Commit

Permalink
Win+Shift Handling (Multi Monitor Setup)
Browse files Browse the repository at this point in the history
Search As You Type
  • Loading branch information
Sebastian Gmeiner committed Oct 29, 2018
1 parent ab42fb2 commit 9cf0816
Show file tree
Hide file tree
Showing 15 changed files with 335 additions and 161 deletions.
7 changes: 5 additions & 2 deletions SuperPutty.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
# Visual Studio 15
VisualStudioVersion = 15.0.27428.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperPutty", "SuperPutty\SuperPutty.csproj", "{E03FA8D9-555B-4AD6-A310-6A72B20024D1}"
EndProject
Expand Down Expand Up @@ -61,4 +61,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6159CA09-1052-4B8B-881D-F809B5D4E2DA}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions SuperPutty/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
<setting name="Action_RenameTab_Shortcut" serializeAs="String">
<value>None</value>
</setting>
<setting name="FilterSessionsOnChange" serializeAs="String">
<value>False</value>
</setting>
</SuperPutty.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
14 changes: 13 additions & 1 deletion SuperPutty/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SuperPutty/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,8 @@
<Setting Name="Action_RenameTab_Shortcut" Provider="SuperPutty.Utils.PortableSettingsProvider" Type="System.Windows.Forms.Keys" Scope="User">
<Value Profile="(Default)">None</Value>
</Setting>
<Setting Name="FilterSessionsOnChange" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
35 changes: 18 additions & 17 deletions SuperPutty/SessionTreeview.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 21 additions & 3 deletions SuperPutty/SessionTreeview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,14 @@ private void txtSearch_KeyDown(object sender, KeyEventArgs e)
switch (e.KeyCode)
{
case Keys.Enter:
this.ApplySearch(this.txtSearch.Text);
if (SuperPuTTY.Settings.FilterSessionsOnChange)
{
treeView1.Focus();
}
else
{
this.ApplySearch(this.txtSearch.Text);
}
e.Handled = true;
e.SuppressKeyPress = true;
break;
Expand Down Expand Up @@ -1084,7 +1091,9 @@ public bool IsMatch(SessionData s)
{
if (this.Mode == SearchMode.CaseInSensitive)
{
return s.SessionName.ToLower().Contains(this.Filter.ToLower());
return
(s.SessionName.ToLower().Contains(this.Filter.ToLower())) ||
(s.Host.ToLower().Contains(this.Filter.ToLower()));
}
else if (this.Mode == SearchMode.Regex)
{
Expand All @@ -1093,7 +1102,9 @@ public bool IsMatch(SessionData s)
else
{
// case sensitive
return s.SessionName.Contains(this.Filter);
return
s.SessionName.Contains(this.Filter) ||
s.Host.Contains(this.Filter);
}
}
public SearchMode Mode { get; set; }
Expand Down Expand Up @@ -1133,6 +1144,13 @@ private void fileZillaToolStripMenuItem_Click(object sender, EventArgs e)
ExternalApplications.openFileZilla(session);
}

private void txtSearch_TextChanged(object sender, EventArgs e)
{
if (SuperPuTTY.Settings.FilterSessionsOnChange)
{
this.ApplySearch(this.txtSearch.Text);
}
}
}

}
18 changes: 9 additions & 9 deletions SuperPutty/SessionTreeview.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>237, 17</value>
</metadata>
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAk
CQAAAk1TRnQBSQFMAgEBAgEAARwBAQEcAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CQAAAk1TRnQBSQFMAgEBAgEAASwBAQEsAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down Expand Up @@ -167,16 +167,16 @@
A/8FAAs=
</value>
</data>
<metadata name="contextMenuStripAddTreeItem.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="contextMenuStripAddTreeItem.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStripFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="contextMenuStripFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>347, 17</value>
</metadata>
<metadata name="timerDelayedSave.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="timerDelayedSave.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>530, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAMAEBAQAAEABAAoAQAANgAAABAQAAABAAgAaAUAAF4BAAAQEAAAAQAgAGgEAADGBgAAKAAAABAA
Expand Down
1 change: 0 additions & 1 deletion SuperPutty/ToolWindowEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ protected override void OnFormClosed(FormClosedEventArgs e)
}
}


public ToolWindowDocument PreviousPanel { get; set; }
public ToolWindowDocument NextPanel { get; set; }
}
Expand Down
29 changes: 26 additions & 3 deletions SuperPutty/Utils/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class NativeMethods
{

#region Win32 Constants/Enums
public const int KEY_TOGGLED = 0x1;
public const int KEY_PRESSED = 0x80;

public const int WM_CLOSE = 0x10;
public const int WM_DESTROY = 0x02;
Expand All @@ -30,21 +32,23 @@ public const int

public const int
SC_MAXIMIZE = 0xF030,
SC_RESTORE = 0xF120;
SC_RESTORE = 0xF120,
SWP_NOZORDER = 0x0004;

public const int
ERROR_FILE_NOT_FOUND = 2,
ERROR_ACCESS_DENIED = 5,
GWL_STYLE = -16;

public const uint
WH_KEYBOARD_LL = 0x000d,
WH_MOUSE_LL = 0x000e,
WS_CAPTION = 0x00C00000,
WS_BORDER = 0x00800000,
WS_VSCROLL = 0x00200000,
WS_THICKFRAME = 0x00040000,
WS_EX_APPWINDOW= 0x00040000,
WS_MAXIMIZE = 0x01000000,
WS_EX_APPWINDOW = 0x00040000,
WS_EX_TOOLWINDOW = 0x00000080,
WS_EX_NOACTIVATE = 0x08000000;

Expand Down Expand Up @@ -132,6 +136,19 @@ public enum WindowShowStyle : uint
/// <remarks>See SW_FORCEMINIMIZE</remarks>
ForceMinimized = 11
}

[StructLayout(LayoutKind.Sequential)]
public struct WINDOWPLACEMENT
{
public int length;
public int flags;
public WindowShowStyle showCmd;
public System.Drawing.Point ptMinPosition;
public System.Drawing.Point ptMaxPosition;
public System.Drawing.Rectangle rcNormalPosition;
public System.Drawing.Rectangle rcDevice;
}

#region Windows Messages Enum
/// <summary>
/// Windows Messages
Expand Down Expand Up @@ -1067,6 +1084,12 @@ public static class HotKeysConstants

#region Pinvoke/Win32 Methods

[DllImport("user32.dll")]
public static extern bool SetWindowPlacement(IntPtr hWnd, [In] ref WINDOWPLACEMENT lpwndpl);

[DllImport("user32.dll")]
public static extern short GetKeyState(int nVirtKey);

[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);

Expand Down

0 comments on commit 9cf0816

Please sign in to comment.