From c219d34fa3de1abd6dfe45dd033b737bc24c6726 Mon Sep 17 00:00:00 2001 From: Riley McArdle Date: Thu, 12 May 2011 19:57:43 -0500 Subject: [PATCH] Revert Ctrl+Tab and Ctrl+Shift+Tab related commits. --- mRemoteV1/App/App.Native.vb | 16 ----- mRemoteV1/App/App.Runtime.vb | 89 ---------------------------- mRemoteV1/Forms/frmMain.vb | 2 - mRemoteV1/UI/UI.Window.Connection.vb | 29 --------- 4 files changed, 136 deletions(-) diff --git a/mRemoteV1/App/App.Native.vb b/mRemoteV1/App/App.Native.vb index 39aaf65c..e04e1253 100644 --- a/mRemoteV1/App/App.Native.vb +++ b/mRemoteV1/App/App.Native.vb @@ -98,22 +98,6 @@ Namespace App _ Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Long End Function - - _ - Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer, ByVal Modifier As Integer, ByVal Key As Integer) As Integer - End Function - - _ - Public Shared Function UnregisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer) As Integer - End Function - - _ - Public Shared Function GlobalAddAtom(ByVal lpString As String) As Integer - End Function - - _ - Public Shared Function GlobalDeleteAtom(ByVal nAtom As Integer) As Integer - End Function #End Region #Region "Constants" diff --git a/mRemoteV1/App/App.Runtime.vb b/mRemoteV1/App/App.Runtime.vb index 3e2b0f5f..3dda2258 100644 --- a/mRemoteV1/App/App.Runtime.vb +++ b/mRemoteV1/App/App.Runtime.vb @@ -3,12 +3,10 @@ Imports System.IO Imports Crownwood Imports System.Threading Imports System.Xml -Imports mRemoteNG.App.Native Imports System.Environment Namespace App Public Class Runtime - #Region "Public Declarations" Public Shared sL As Config.Settings.Load Public Shared sS As Config.Settings.Save @@ -41,43 +39,8 @@ Namespace App Public Shared DefaultInheritance As mRemoteNG.Connection.Info.Inheritance Public Shared ExtApps As New ArrayList() - - 'HotKeys - Public Shared HotKey_CtrlTab As clsHotKeyRegister - Public Shared HotKey_ShiftTab As clsHotKeyRegister #End Region - Public NotInheritable Class clsHotKeyRegister : Inherits NativeWindow - Private atomID As Integer - - Event Pressed(ByVal ID As Integer) - - Sub New(ByVal Modifier As ModifierKey, ByVal Key As Keys) - CreateHandle(New CreateParams) - atomID = GlobalAddAtom(GetHashCode()) - RegisterHotKey(Handle, atomID, Modifier, Key) - End Sub - - Sub Unregister() - UnregisterHotKey(Handle, atomID) - End Sub - - Protected Overrides Sub WndProc(ByRef M As Message) - If M.Msg = 786 Then 'W_HOTKEY - If ForegroundWindowRealtedToAppInstance() Then - RaiseEvent Pressed(M.WParam.ToInt32) - End If - End If - MyBase.WndProc(M) - End Sub - - Public Enum ModifierKey - 'None = 0 'Not a good idea to use, commenting out - Alt = 1 - Ctrl = 2 - Shift = 4 - End Enum - End Class Public Class Windows Public Shared treeForm As UI.Window.Tree Public Shared treePanel As New DockContent @@ -288,15 +251,6 @@ Namespace App log = log4net.LogManager.GetLogger("mRemoteNG.Log") End Sub - Public Shared Sub RegisterHotKeys() - ' This causes Ctrl-Tab and Ctrl-Shift-Tab to not work in any other applications. Not good. Disabled for now. - ' 'Register HotKey - ' 'Ctrl-Tab | Advance one tab - ' HotKey_CtrlTab = New clsHotKeyRegister(clsHotKeyRegister.ModifierKey.Ctrl, Keys.Tab) - ' 'Shift-Tab | Reverse one tab - ' HotKey_ShiftTab = New clsHotKeyRegister(clsHotKeyRegister.ModifierKey.Ctrl + clsHotKeyRegister.ModifierKey.Shift, Keys.Tab) - End Sub - Public Shared Sub UpdateCheck() If My.Settings.CheckForUpdatesAsked And My.Settings.CheckForUpdatesOnStartup Then If My.Settings.UpdatePending Or My.Settings.CheckForUpdatesLastCheck < Date.Now.Subtract(TimeSpan.FromDays(My.Settings.CheckForUpdatesFrequencyDays)) Then @@ -460,11 +414,7 @@ Namespace App ' ToDo: Change Report.log location File.Delete(My.Application.Info.DirectoryPath & "\Report.log") End If - End If - ' 'Unregister Hotkeys - ' HotKey_CtrlTab.Unregister() - ' HotKey_ShiftTab.Unregister() sS.Save() Catch ex As Exception @@ -1715,45 +1665,6 @@ Namespace App End If Next End Sub - - 'Determine if the Foreground window is current instance of mRemoteNG, Contained Putty instance or Contained External App instance - Public Shared Function ForegroundWindowRealtedToAppInstance() As Boolean - If GetForegroundWindow() = frmMain.Handle Then - Return True - End If - - For Each conns As Connection.Info In cL - For Each openCon As Connection.Protocol.Base In conns.OpenConnections - Select Case openCon.InterfaceControl.Info.Protocol - Case Connection.Protocol.Protocols.SSH1 - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then - Return True - End If - Case Connection.Protocol.Protocols.SSH2 - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then - Return True - End If - Case Connection.Protocol.Protocols.RAW - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then - Return True - End If - Case Connection.Protocol.Protocols.Rlogin - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then - Return True - End If - Case Connection.Protocol.Protocols.Telnet - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then - Return True - End If - Case Connection.Protocol.Protocols.IntApp - If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.IntApp).IntAppHandle = GetForegroundWindow() Then - Return True - End If - End Select - Next - Next - Return False - End Function #End Region #Region "SQL Watcher" diff --git a/mRemoteV1/Forms/frmMain.vb b/mRemoteV1/Forms/frmMain.vb index 1aa134fa..3df6653f 100644 --- a/mRemoteV1/Forms/frmMain.vb +++ b/mRemoteV1/Forms/frmMain.vb @@ -28,8 +28,6 @@ Public Class frmMain Startup.CreateLogger() - Startup.RegisterHotKeys() - ' Load GUI Configuration sL.Load() diff --git a/mRemoteV1/UI/UI.Window.Connection.vb b/mRemoteV1/UI/UI.Window.Connection.vb index f7737877..eaddf8bc 100644 --- a/mRemoteV1/UI/UI.Window.Connection.vb +++ b/mRemoteV1/UI/UI.Window.Connection.vb @@ -226,37 +226,8 @@ Namespace UI Me.InitializeComponent() Me.Text = FormText Me.TabText = FormText - - 'AddHandler mRemoteNG.App.Runtime.HotKey_CtrlTab.Pressed, AddressOf CtrlTabHK_Press - 'AddHandler mRemoteNG.App.Runtime.HotKey_ShiftTab.Pressed, AddressOf ShiftTabHK_Press End Sub - Protected Sub CtrlTabHK_Press(ByVal sender As Integer) - With Me.TabController - If .TabPages.Count > 1 And Me.Visible Then - If .TabPages.Count = .SelectedIndex + 1 Then - .SelectedIndex = 0 - Else - .SelectedIndex = .SelectedIndex + 1 - End If - FocusIC() - RefreshIC() - End If - End With - End Sub - Protected Sub ShiftTabHK_Press(ByVal sender As Integer) - With Me.TabController - If .TabPages.Count > 1 And Me.Visible Then - If .SelectedIndex = 0 Then - .SelectedIndex = .TabPages.Count - 1 - Else - .SelectedIndex = .SelectedIndex - 1 - End If - FocusIC() - RefreshIC() - End If - End With - End Sub Public Function AddConnectionTab(ByVal conI As mRemoteNG.Connection.Info) As Magic.Controls.TabPage Try Dim nTab As New Magic.Controls.TabPage