diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c0e8fbe1..d91ad0223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] ### Added - #1770: Added missing RDP performance settings +- #1332: Added option to hide menu strip container - #545: Option to minimize to system tray on closing - #420: SSH tunneling implemented - #283: Support for native PowerShell remoting as new protocol diff --git a/mRemoteV1/App/ProgramRoot.cs b/mRemoteV1/App/ProgramRoot.cs index 251b98e17..47523b573 100644 --- a/mRemoteV1/App/ProgramRoot.cs +++ b/mRemoteV1/App/ProgramRoot.cs @@ -8,7 +8,7 @@ namespace mRemoteNG.App { public static class ProgramRoot { - private static Mutex mutex; + private static Mutex _mutex; /// /// The main entry point for the application. @@ -34,14 +34,13 @@ namespace mRemoteNG.App public static void CloseSingletonInstanceMutex() { - mutex?.Close(); + _mutex?.Close(); } private static void StartApplicationAsSingleInstance() { const string mutexID = "mRemoteNG_SingleInstanceMutex"; - bool newInstanceCreated; - mutex = new Mutex(false, mutexID, out newInstanceCreated); + _mutex = new Mutex(false, mutexID, out var newInstanceCreated); if (!newInstanceCreated) { SwitchToCurrentInstance(); @@ -49,7 +48,7 @@ namespace mRemoteNG.App } StartApplication(); - GC.KeepAlive(mutex); + GC.KeepAlive(_mutex); } private static void SwitchToCurrentInstance() diff --git a/mRemoteV1/Documentation/images/menus_hide_menu_strip.png b/mRemoteV1/Documentation/images/menus_hide_menu_strip.png new file mode 100644 index 000000000..e659cc855 Binary files /dev/null and b/mRemoteV1/Documentation/images/menus_hide_menu_strip.png differ diff --git a/mRemoteV1/Documentation/user_interface.rst b/mRemoteV1/Documentation/user_interface.rst index 61a85abeb..67d20949c 100644 --- a/mRemoteV1/Documentation/user_interface.rst +++ b/mRemoteV1/Documentation/user_interface.rst @@ -9,7 +9,7 @@ User Interface user_interface/main_window.rst user_interface/panels.rst - user_interface/menus.rst + user_interface/menu_container.rst user_interface/connections.rst user_interface/default_connection_properties.rst user_interface/quick_connect.rst diff --git a/mRemoteV1/Documentation/user_interface/menus.rst b/mRemoteV1/Documentation/user_interface/menu_container.rst similarity index 93% rename from mRemoteV1/Documentation/user_interface/menus.rst rename to mRemoteV1/Documentation/user_interface/menu_container.rst index 45eee60d6..c6c64a78a 100644 --- a/mRemoteV1/Documentation/user_interface/menus.rst +++ b/mRemoteV1/Documentation/user_interface/menu_container.rst @@ -1,16 +1,26 @@ -***** -Menus -***** +************** +Menu Container +************** -.. figure:: /images/menus_main_menu.png +Hide Menu Container +=================== -In this section we are going to explain the menus located in mRemoteNG. The above screenshot shows the main menu with colors. +You can hide the Menu Container when right-clicking the mRemoteNG title bar. + +.. figure:: /images/menus_hide_menu_strip.png + +Main Menu +========= + +In this section we are going to explain the menus located in mRemoteNG. - **Red** - Anchor to move menu around the interface - **Green** - The menu items +.. figure:: /images/menus_main_menu.png + File Menu -========= +--------- Contains standard commands for the application. .. list-table:: @@ -43,7 +53,7 @@ Contains standard commands for the application. - Exit mRemoteNG application View Menu -========= +--------- Menu for additional dialogs for mRemoteNG. .. list-table:: @@ -80,7 +90,7 @@ Menu for additional dialogs for mRemoteNG. - Fullscreen mRemoteNG (will not fullscreen connection window but only the mRemoteNG application) Tools Menu -========== +---------- Additional tools that can be used and triggered in mRemoteNG. .. list-table:: @@ -99,7 +109,7 @@ Additional tools that can be used and triggered in mRemoteNG. - Opens mRemoteNG global settings and options dialog Help Menu -========= +--------- Get more information for the application. .. list-table:: diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index 9f94c948f..d8d30b5b1 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -5511,6 +5511,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Show/Hide Menu Strip. + /// + internal static string ShowHideMenu { + get { + return ResourceManager.GetString("ShowHideMenu", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show logon information on tab names. /// diff --git a/mRemoteV1/Resources/Language/Language.de.resx b/mRemoteV1/Resources/Language/Language.de.resx index 77759707f..ef665d187 100644 --- a/mRemoteV1/Resources/Language/Language.de.resx +++ b/mRemoteV1/Resources/Language/Language.de.resx @@ -2108,4 +2108,7 @@ Development umfasst Alphas, Betas und Release Candidates. Legt fest, ob der Fensterinhalt angezeigt wird, wenn Sie das Fenster an eine neue Position ziehen. + + Verstecke/Zeige MenĂ¼ + \ No newline at end of file diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index 7ef3abd07..5b7b728d2 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -2270,4 +2270,7 @@ Development Channel includes Alphas, Betas & Release Candidates. Failed to contruct the URL to load + + Show/Hide Menu Strip + \ No newline at end of file diff --git a/mRemoteV1/Tools/Tools.SystemMenu.cs b/mRemoteV1/Tools/WindowMenu.cs similarity index 93% rename from mRemoteV1/Tools/Tools.SystemMenu.cs rename to mRemoteV1/Tools/WindowMenu.cs index fc7a8d637..74776eb14 100644 --- a/mRemoteV1/Tools/Tools.SystemMenu.cs +++ b/mRemoteV1/Tools/WindowMenu.cs @@ -7,7 +7,7 @@ using Microsoft.Win32.SafeHandles; namespace mRemoteNG.Tools { - public sealed class SystemMenu : SafeHandleZeroOrMinusOneIsInvalid, IDisposable + public sealed class WindowMenu : SafeHandleZeroOrMinusOneIsInvalid, IDisposable { [Flags] public enum Flags @@ -20,11 +20,11 @@ namespace mRemoteNG.Tools WM_SYSCOMMAND = NativeMethods.WM_SYSCOMMAND } - private bool disposed; + private bool _disposed; internal IntPtr SystemMenuHandle; private readonly IntPtr FormHandle; - public SystemMenu(IntPtr Handle) : base(true) + public WindowMenu(IntPtr Handle) : base(true) { FormHandle = Handle; SystemMenuHandle = NativeMethods.GetSystemMenu(FormHandle, false); @@ -85,12 +85,12 @@ namespace mRemoteNG.Tools protected override void Dispose(bool disposing) { - if (disposed) return; + if (_disposed) return; if (disposing) return; ReleaseHandle(); - disposed = true; + _disposed = true; } } } \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/frmMain.Designer.cs b/mRemoteV1/UI/Forms/frmMain.Designer.cs index ea5190f98..bf41252a9 100644 --- a/mRemoteV1/UI/Forms/frmMain.Designer.cs +++ b/mRemoteV1/UI/Forms/frmMain.Designer.cs @@ -14,8 +14,8 @@ if(components != null) components.Dispose(); - if(_screenSystemMenu != null) - _screenSystemMenu.Dispose(); + if(_advancedWindowMenu != null) + _advancedWindowMenu.Dispose(); } } diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index eee6c2bff..5d7a63196 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -47,7 +47,7 @@ namespace mRemoteNG.UI.Forms private bool _usingSqlServer; private string _connectionsFileName; private bool _showFullPathInTitle; - private readonly ScreenSelectionSystemMenu _screenSystemMenu; + private readonly AdvancedWindowMenu _advancedWindowMenu; private ConnectionInfo _selectedConnection; private readonly IList _messageWriters = new List(); private readonly ThemeManager _themeManager; @@ -69,7 +69,7 @@ namespace mRemoteNG.UI.Forms vsToolStripExtender.DefaultRenderer = _toolStripProfessionalRenderer; ApplyTheme(); - _screenSystemMenu = new ScreenSelectionSystemMenu(this); + _advancedWindowMenu = new AdvancedWindowMenu(this); } #region Properties @@ -221,8 +221,8 @@ namespace mRemoteNG.UI.Forms Startup.Instance.CreateConnectionsProvider(messageCollector); - _screenSystemMenu.BuildScreenList(); - SystemEvents.DisplaySettingsChanged += _screenSystemMenu.OnDisplayChanged; + _advancedWindowMenu.BuildAdditionalMenuItems(); + SystemEvents.DisplaySettingsChanged += _advancedWindowMenu.OnDisplayChanged; ApplyLanguage(); Opacity = 1; @@ -535,12 +535,7 @@ namespace mRemoteNG.UI.Forms case NativeMethods.WM_ACTIVATEAPP: var candidateTabToFocus = FromChildHandle(NativeMethods.WindowFromPoint(MousePosition)) ?? GetChildAtPoint(MousePosition); - - if (candidateTabToFocus is InterfaceControl) - { - candidateTabToFocus.Parent.Focus(); - } - + if (candidateTabToFocus is InterfaceControl) candidateTabToFocus.Parent.Focus(); _inMouseActivate = false; break; case NativeMethods.WM_ACTIVATE: @@ -578,7 +573,6 @@ namespace mRemoteNG.UI.Forms } } } - break; case NativeMethods.WM_WINDOWPOSCHANGED: // Ignore this message if the window wasn't activated @@ -589,12 +583,16 @@ namespace mRemoteNG.UI.Forms if (!_inMouseActivate && !_inSizeMove) ActivateConnection(); } - break; case NativeMethods.WM_SYSCOMMAND: - var screen = _screenSystemMenu.GetScreenById(m.WParam.ToInt32()); + if (m.WParam == new IntPtr(0)) + ShowHideMenu(); + var screen = _advancedWindowMenu.GetScreenById(m.WParam.ToInt32()); if (screen != null) + { Screens.SendFormToScreen(screen); + Console.WriteLine(_advancedWindowMenu.GetScreenById(m.WParam.ToInt32()).ToString()); + } break; case NativeMethods.WM_DRAWCLIPBOARD: NativeMethods.SendMessage(_fpChainedWindowHandle, m.Msg, m.LParam, m.WParam); @@ -751,6 +749,8 @@ namespace mRemoteNG.UI.Forms pnlDock.Visible = true; } + public void ShowHideMenu() => tsContainer.TopToolStripPanelVisible = !tsContainer.TopToolStripPanelVisible; + #endregion #region Events diff --git a/mRemoteV1/UI/Menu/ScreenSelectionSystemMenu.cs b/mRemoteV1/UI/Menu/AdvancedWindowMenu.cs similarity index 53% rename from mRemoteV1/UI/Menu/ScreenSelectionSystemMenu.cs rename to mRemoteV1/UI/Menu/AdvancedWindowMenu.cs index 27b25f797..eb43d314f 100644 --- a/mRemoteV1/UI/Menu/ScreenSelectionSystemMenu.cs +++ b/mRemoteV1/UI/Menu/AdvancedWindowMenu.cs @@ -5,14 +5,14 @@ using mRemoteNG.Tools; namespace mRemoteNG.UI.Menu { // This class creates new menu items to menu that appears when you right click the top of the app (where the window title is) - public class ScreenSelectionSystemMenu : IDisposable + public class AdvancedWindowMenu : IDisposable { - private readonly SystemMenu _systemMenu; + private readonly WindowMenu _windowMenu; private readonly int[] _sysMenSubItems = new int[51]; - public ScreenSelectionSystemMenu(IWin32Window boundControl) + public AdvancedWindowMenu(IWin32Window boundControl) { - _systemMenu = new SystemMenu(boundControl.Handle); + _windowMenu = new WindowMenu(boundControl.Handle); } public Screen GetScreenById(int id) @@ -29,30 +29,34 @@ namespace mRemoteNG.UI.Menu public void OnDisplayChanged(object sender, EventArgs e) { ResetScreenList(); - BuildScreenList(); + BuildAdditionalMenuItems(); } private void ResetScreenList() { - _systemMenu.Reset(); + _windowMenu.Reset(); } - public void BuildScreenList() + public void BuildAdditionalMenuItems() { - var popMen = _systemMenu.CreatePopupMenuItem(); - + // option to send main form to another screen + var popMen = _windowMenu.CreatePopupMenuItem(); for (var i = 0; i <= Screen.AllScreens.Length - 1; i++) { _sysMenSubItems[i] = 200 + i; - _systemMenu.AppendMenuItem(popMen, SystemMenu.Flags.MF_STRING, new IntPtr(_sysMenSubItems[i]), + _windowMenu.AppendMenuItem(popMen, WindowMenu.Flags.MF_STRING, new IntPtr(_sysMenSubItems[i]), Language.Screen + " " + Convert.ToString(i + 1)); } - - _systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 0, - SystemMenu.Flags.MF_POPUP | SystemMenu.Flags.MF_BYPOSITION, popMen, - Language.SendTo); - _systemMenu.InsertMenuItem(_systemMenu.SystemMenuHandle, 1, - SystemMenu.Flags.MF_BYPOSITION | SystemMenu.Flags.MF_SEPARATOR, IntPtr.Zero, + _windowMenu.InsertMenuItem(_windowMenu.SystemMenuHandle, 0, + WindowMenu.Flags.MF_POPUP | WindowMenu.Flags.MF_BYPOSITION, popMen, + Language.SendTo); + // option to show/hide menu strips + _windowMenu.InsertMenuItem(_windowMenu.SystemMenuHandle, 1, + WindowMenu.Flags.MF_BYPOSITION, new IntPtr(0), + Language.ShowHideMenu); + // separator + _windowMenu.InsertMenuItem(_windowMenu.SystemMenuHandle, 2, + WindowMenu.Flags.MF_BYPOSITION | WindowMenu.Flags.MF_SEPARATOR, IntPtr.Zero, null); } @@ -60,8 +64,7 @@ namespace mRemoteNG.UI.Menu { if (!disposing) return; - if(_systemMenu != null) - _systemMenu.Dispose(); + _windowMenu?.Dispose(); } public void Dispose() diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index d1ba776c7..50c69e0f6 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -650,7 +650,7 @@ - + Component @@ -669,7 +669,7 @@ Component - + Component @@ -1095,7 +1095,7 @@ - + @@ -1147,6 +1147,7 @@ +