mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-26 03:58:45 +08:00
Merge pull request #1332 from wangxuepeng/develop
Add show/hide main menu function to connection tree toolbar.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace mRemoteNG.App
|
||||
{
|
||||
public static class ProgramRoot
|
||||
{
|
||||
private static Mutex mutex;
|
||||
private static Mutex _mutex;
|
||||
|
||||
/// <summary>
|
||||
/// 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()
|
||||
|
||||
BIN
mRemoteV1/Documentation/images/menus_hide_menu_strip.png
Normal file
BIN
mRemoteV1/Documentation/images/menus_hide_menu_strip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -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
|
||||
|
||||
@@ -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::
|
||||
@@ -5511,6 +5511,15 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show/Hide Menu Strip.
|
||||
/// </summary>
|
||||
internal static string ShowHideMenu {
|
||||
get {
|
||||
return ResourceManager.GetString("ShowHideMenu", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show logon information on tab names.
|
||||
/// </summary>
|
||||
|
||||
@@ -2108,4 +2108,7 @@ Development umfasst Alphas, Betas und Release Candidates.</value>
|
||||
<data name="PropertyDescriptionDisableFullWindowDrag" xml:space="preserve">
|
||||
<value>Legt fest, ob der Fensterinhalt angezeigt wird, wenn Sie das Fenster an eine neue Position ziehen.</value>
|
||||
</data>
|
||||
<data name="ShowHideMenu" xml:space="preserve">
|
||||
<value>Verstecke/Zeige Menü</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2270,4 +2270,7 @@ Development Channel includes Alphas, Betas & Release Candidates.</value>
|
||||
<data name="HttpFailedUrlBuild" xml:space="preserve">
|
||||
<value>Failed to contruct the URL to load</value>
|
||||
</data>
|
||||
<data name="ShowHideMenu" xml:space="preserve">
|
||||
<value>Show/Hide Menu Strip</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
4
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
@@ -14,8 +14,8 @@
|
||||
if(components != null)
|
||||
components.Dispose();
|
||||
|
||||
if(_screenSystemMenu != null)
|
||||
_screenSystemMenu.Dispose();
|
||||
if(_advancedWindowMenu != null)
|
||||
_advancedWindowMenu.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<IMessageWriter> _messageWriters = new List<IMessageWriter>();
|
||||
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
|
||||
|
||||
@@ -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()
|
||||
@@ -650,7 +650,7 @@
|
||||
<Compile Include="Tools\Tools.LocalizedAttributes.cs" />
|
||||
<Compile Include="Tools\MiscTools.cs" />
|
||||
<Compile Include="Tools\PortScanner.cs" />
|
||||
<Compile Include="Tools\Tools.SystemMenu.cs" />
|
||||
<Compile Include="Tools\WindowMenu.cs" />
|
||||
<Compile Include="Tools\Tools.WindowPlacement.cs" />
|
||||
<Compile Include="UI\Forms\TextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
@@ -669,7 +669,7 @@
|
||||
<Compile Include="UI\Menu\MainFileMenu.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Menu\ScreenSelectionSystemMenu.cs" />
|
||||
<Compile Include="UI\Menu\AdvancedWindowMenu.cs" />
|
||||
<Compile Include="UI\Menu\ToolsMenu.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -1095,7 +1095,7 @@
|
||||
<None Include="Documentation\troubleshooting.rst" />
|
||||
<None Include="Documentation\user_interface\connections.rst" />
|
||||
<None Include="Documentation\user_interface\options.rst" />
|
||||
<None Include="Documentation\user_interface\menus.rst" />
|
||||
<None Include="Documentation\user_interface\menu_container.rst" />
|
||||
<None Include="Documentation\user_interface\ssh_file_transfer.rst" />
|
||||
<None Include="Documentation\sql_configuration.rst" />
|
||||
<None Include="Documentation\known_issues.rst" />
|
||||
@@ -1147,6 +1147,7 @@
|
||||
<None Include="Documentation\images\connections_top_bar.png" />
|
||||
<None Include="Documentation\images\import_export_dialog.png" />
|
||||
<None Include="Documentation\images\menus_main_menu.png" />
|
||||
<None Include="Documentation\images\menus_hide_menu_strip.png" />
|
||||
<None Include="Documentation\images\notifications_panel.png" />
|
||||
<None Include="Documentation\images\notifications_popup.png" />
|
||||
<None Include="Documentation\images\folders_and_inheritance_01.png" />
|
||||
|
||||
Reference in New Issue
Block a user