From a40f66fc944644fe4282082578c3d2f43af887b1 Mon Sep 17 00:00:00 2001 From: Leaskovski Date: Mon, 3 Dec 2018 15:46:14 +0000 Subject: [PATCH] Added a new option to the Appearance and Tabs configuration page to allow the user to toggle if connection windows display tabs or not as per #1171. --- mRemoteV1/Properties/Settings.Designer.cs | 18 +++++--- mRemoteV1/Properties/Settings.settings | 3 ++ .../Resources/Language/Language.Designer.cs | 11 ++++- mRemoteV1/Resources/Language/Language.resx | 3 ++ .../OptionsPages/TabsPanelsPage.Designer.cs | 44 ++++++++++++------- .../UI/Forms/OptionsPages/TabsPanelsPage.cs | 9 ++-- mRemoteV1/UI/Forms/frmMain.cs | 20 ++++++++- mRemoteV1/UI/Window/ConnectionWindow.cs | 5 ++- mRemoteV1/app.config | 3 ++ 9 files changed, 90 insertions(+), 26 deletions(-) diff --git a/mRemoteV1/Properties/Settings.Designer.cs b/mRemoteV1/Properties/Settings.Designer.cs index 0f631838..2375b7e4 100644 --- a/mRemoteV1/Properties/Settings.Designer.cs +++ b/mRemoteV1/Properties/Settings.Designer.cs @@ -12,11 +12,7 @@ namespace mRemoteNG { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - - - - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -2750,5 +2746,17 @@ namespace mRemoteNG { this["StartUpPanelName"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool AlwaysShowConnectionTabs { + get { + return ((bool)(this["AlwaysShowConnectionTabs"])); + } + set { + this["AlwaysShowConnectionTabs"] = value; + } + } } } diff --git a/mRemoteV1/Properties/Settings.settings b/mRemoteV1/Properties/Settings.settings index 7ee752fe..7b8314d4 100644 --- a/mRemoteV1/Properties/Settings.settings +++ b/mRemoteV1/Properties/Settings.settings @@ -683,5 +683,8 @@ General + + True + \ No newline at end of file diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index 1a9d0d0b..561720df 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -19,7 +19,7 @@ namespace mRemoteNG { // 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", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Language { @@ -375,6 +375,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Always show connection tabs. + /// + internal static string strAlwaysShowConnectionTabs { + get { + return ResourceManager.GetString("strAlwaysShowConnectionTabs", resourceCulture); + } + } + /// /// Looks up a localized string similar to Always show panel selection dialog when opening connections. /// diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index 40e61522..4b2faf18 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -2721,4 +2721,7 @@ This page will walk you through the process of upgrading your connections file o Copy Hostname + + Always show connection tabs + \ No newline at end of file diff --git a/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.Designer.cs b/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.Designer.cs index 1969b466..e24c0751 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.Designer.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.Designer.cs @@ -32,7 +32,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TabsPanelsPage)); this.chkAlwaysShowPanelTabs = new mRemoteNG.UI.Controls.Base.NGCheckBox(); - this.chkIdentifyQuickConnectTabs = new mRemoteNG.UI.Controls.Base.NGCheckBox(); + this.chkAlwaysShowConnectionTabs = new mRemoteNG.UI.Controls.Base.NGCheckBox(); + this.chkIdentifyQuickConnectTabs = new mRemoteNG.UI.Controls.Base.NGCheckBox(); this.chkOpenNewTabRightOfSelected = new mRemoteNG.UI.Controls.Base.NGCheckBox(); this.chkAlwaysShowPanelSelectionDlg = new mRemoteNG.UI.Controls.Base.NGCheckBox(); this.chkShowLogonInfoOnTabs = new mRemoteNG.UI.Controls.Base.NGCheckBox(); @@ -53,12 +54,23 @@ namespace mRemoteNG.UI.Forms.OptionsPages this.chkAlwaysShowPanelTabs.TabIndex = 0; this.chkAlwaysShowPanelTabs.Text = "Always show panel tabs"; this.chkAlwaysShowPanelTabs.UseVisualStyleBackColor = true; - // - // chkIdentifyQuickConnectTabs - // - this.chkIdentifyQuickConnectTabs._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; + // + // chkAlwaysShowConnectionTabs + // + this.chkAlwaysShowConnectionTabs._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; + this.chkAlwaysShowConnectionTabs.AutoSize = true; + this.chkAlwaysShowConnectionTabs.Location = new System.Drawing.Point(3, 26); + this.chkAlwaysShowConnectionTabs.Name = "chkAlwaysShowConnectionTabs"; + this.chkAlwaysShowConnectionTabs.Size = new System.Drawing.Size(200, 17); + this.chkAlwaysShowConnectionTabs.TabIndex = 0; + this.chkAlwaysShowConnectionTabs.Text = "Always show connection tabs"; + this.chkAlwaysShowConnectionTabs.UseVisualStyleBackColor = true; + // + // chkIdentifyQuickConnectTabs + // + this.chkIdentifyQuickConnectTabs._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkIdentifyQuickConnectTabs.AutoSize = true; - this.chkIdentifyQuickConnectTabs.Location = new System.Drawing.Point(3, 95); + this.chkIdentifyQuickConnectTabs.Location = new System.Drawing.Point(3, 118); this.chkIdentifyQuickConnectTabs.Name = "chkIdentifyQuickConnectTabs"; this.chkIdentifyQuickConnectTabs.Size = new System.Drawing.Size(293, 17); this.chkIdentifyQuickConnectTabs.TabIndex = 4; @@ -69,7 +81,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkOpenNewTabRightOfSelected._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkOpenNewTabRightOfSelected.AutoSize = true; - this.chkOpenNewTabRightOfSelected.Location = new System.Drawing.Point(3, 26); + this.chkOpenNewTabRightOfSelected.Location = new System.Drawing.Point(3, 49); this.chkOpenNewTabRightOfSelected.Name = "chkOpenNewTabRightOfSelected"; this.chkOpenNewTabRightOfSelected.Size = new System.Drawing.Size(280, 17); this.chkOpenNewTabRightOfSelected.TabIndex = 1; @@ -80,7 +92,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkAlwaysShowPanelSelectionDlg._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkAlwaysShowPanelSelectionDlg.AutoSize = true; - this.chkAlwaysShowPanelSelectionDlg.Location = new System.Drawing.Point(3, 141); + this.chkAlwaysShowPanelSelectionDlg.Location = new System.Drawing.Point(3, 164); this.chkAlwaysShowPanelSelectionDlg.Name = "chkAlwaysShowPanelSelectionDlg"; this.chkAlwaysShowPanelSelectionDlg.Size = new System.Drawing.Size(317, 17); this.chkAlwaysShowPanelSelectionDlg.TabIndex = 6; @@ -91,7 +103,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkShowLogonInfoOnTabs._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkShowLogonInfoOnTabs.AutoSize = true; - this.chkShowLogonInfoOnTabs.Location = new System.Drawing.Point(3, 49); + this.chkShowLogonInfoOnTabs.Location = new System.Drawing.Point(3, 72); this.chkShowLogonInfoOnTabs.Name = "chkShowLogonInfoOnTabs"; this.chkShowLogonInfoOnTabs.Size = new System.Drawing.Size(203, 17); this.chkShowLogonInfoOnTabs.TabIndex = 2; @@ -102,7 +114,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkDoubleClickClosesTab._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkDoubleClickClosesTab.AutoSize = true; - this.chkDoubleClickClosesTab.Location = new System.Drawing.Point(3, 118); + this.chkDoubleClickClosesTab.Location = new System.Drawing.Point(3, 141); this.chkDoubleClickClosesTab.Name = "chkDoubleClickClosesTab"; this.chkDoubleClickClosesTab.Size = new System.Drawing.Size(159, 17); this.chkDoubleClickClosesTab.TabIndex = 5; @@ -113,7 +125,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkShowProtocolOnTabs._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkShowProtocolOnTabs.AutoSize = true; - this.chkShowProtocolOnTabs.Location = new System.Drawing.Point(3, 72); + this.chkShowProtocolOnTabs.Location = new System.Drawing.Point(3, 95); this.chkShowProtocolOnTabs.Name = "chkShowProtocolOnTabs"; this.chkShowProtocolOnTabs.Size = new System.Drawing.Size(166, 17); this.chkShowProtocolOnTabs.TabIndex = 3; @@ -124,7 +136,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // this.chkCreateEmptyPanelOnStart._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER; this.chkCreateEmptyPanelOnStart.AutoSize = true; - this.chkCreateEmptyPanelOnStart.Location = new System.Drawing.Point(3, 164); + this.chkCreateEmptyPanelOnStart.Location = new System.Drawing.Point(3, 187); this.chkCreateEmptyPanelOnStart.Name = "chkCreateEmptyPanelOnStart"; this.chkCreateEmptyPanelOnStart.Size = new System.Drawing.Size(253, 17); this.chkCreateEmptyPanelOnStart.TabIndex = 7; @@ -134,7 +146,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // // txtBoxPanelName // - this.txtBoxPanelName.Location = new System.Drawing.Point(43, 200); + this.txtBoxPanelName.Location = new System.Drawing.Point(43, 223); this.txtBoxPanelName.Name = "txtBoxPanelName"; this.txtBoxPanelName.Size = new System.Drawing.Size(213, 20); this.txtBoxPanelName.TabIndex = 8; @@ -142,7 +154,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages // lblPanelName // this.lblPanelName.AutoSize = true; - this.lblPanelName.Location = new System.Drawing.Point(40, 184); + this.lblPanelName.Location = new System.Drawing.Point(40, 207); this.lblPanelName.Name = "lblPanelName"; this.lblPanelName.Size = new System.Drawing.Size(66, 13); this.lblPanelName.TabIndex = 9; @@ -156,7 +168,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages this.Controls.Add(this.txtBoxPanelName); this.Controls.Add(this.chkCreateEmptyPanelOnStart); this.Controls.Add(this.chkAlwaysShowPanelTabs); - this.Controls.Add(this.chkIdentifyQuickConnectTabs); + this.Controls.Add(this.chkAlwaysShowConnectionTabs); + this.Controls.Add(this.chkIdentifyQuickConnectTabs); this.Controls.Add(this.chkOpenNewTabRightOfSelected); this.Controls.Add(this.chkAlwaysShowPanelSelectionDlg); this.Controls.Add(this.chkShowLogonInfoOnTabs); @@ -170,6 +183,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages } internal Controls.Base.NGCheckBox chkAlwaysShowPanelTabs; + internal Controls.Base.NGCheckBox chkAlwaysShowConnectionTabs; internal Controls.Base.NGCheckBox chkIdentifyQuickConnectTabs; internal Controls.Base.NGCheckBox chkOpenNewTabRightOfSelected; internal Controls.Base.NGCheckBox chkAlwaysShowPanelSelectionDlg; diff --git a/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.cs b/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.cs index 24a5e22b..7652e542 100644 --- a/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.cs +++ b/mRemoteV1/UI/Forms/OptionsPages/TabsPanelsPage.cs @@ -19,7 +19,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages base.ApplyLanguage(); chkAlwaysShowPanelTabs.Text = Language.strAlwaysShowPanelTabs; - chkOpenNewTabRightOfSelected.Text = Language.strOpenNewTabRight; + chkAlwaysShowConnectionTabs.Text = Language.strAlwaysShowConnectionTabs; + chkOpenNewTabRightOfSelected.Text = Language.strOpenNewTabRight; chkShowLogonInfoOnTabs.Text = Language.strShowLogonInfoOnTabs; chkShowProtocolOnTabs.Text = Language.strShowProtocolOnTabs; chkIdentifyQuickConnectTabs.Text = Language.strIdentifyQuickConnectTabs; @@ -34,7 +35,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages base.SaveSettings(); chkAlwaysShowPanelTabs.Checked = Settings.Default.AlwaysShowPanelTabs; - chkOpenNewTabRightOfSelected.Checked = Settings.Default.OpenTabsRightOfSelected; + chkAlwaysShowConnectionTabs.Checked = Settings.Default.AlwaysShowConnectionTabs; + chkOpenNewTabRightOfSelected.Checked = Settings.Default.OpenTabsRightOfSelected; chkShowLogonInfoOnTabs.Checked = Settings.Default.ShowLogonInfoOnTabs; chkShowProtocolOnTabs.Checked = Settings.Default.ShowProtocolOnTabs; chkIdentifyQuickConnectTabs.Checked = Settings.Default.IdentifyQuickConnectTabs; @@ -50,7 +52,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages base.SaveSettings(); Settings.Default.AlwaysShowPanelTabs = chkAlwaysShowPanelTabs.Checked; - FrmMain.Default.ShowHidePanelTabs(); + Settings.Default.AlwaysShowConnectionTabs = chkAlwaysShowConnectionTabs.Checked; + FrmMain.Default.ShowHidePanelTabs(); Settings.Default.OpenTabsRightOfSelected = chkOpenNewTabRightOfSelected.Checked; Settings.Default.ShowLogonInfoOnTabs = chkShowLogonInfoOnTabs.Checked; diff --git a/mRemoteV1/UI/Forms/frmMain.cs b/mRemoteV1/UI/Forms/frmMain.cs index bb213821..a973e4c1 100644 --- a/mRemoteV1/UI/Forms/frmMain.cs +++ b/mRemoteV1/UI/Forms/frmMain.cs @@ -27,6 +27,7 @@ using mRemoteNG.UI.Panels; using mRemoteNG.UI.TaskDialog; using mRemoteNG.UI.Window; using WeifenLuo.WinFormsUI.Docking; +using TabControl = Crownwood.Magic.Controls.TabControl; // ReSharper disable MemberCanBePrivate.Global @@ -587,7 +588,24 @@ namespace mRemoteNG.UI.Forms newDocumentStyle = nonConnectionPanelCount == 0 ? DocumentStyle.DockingSdi : DocumentStyle.DockingWindow; } - if (pnlDock.DocumentStyle == newDocumentStyle) return; + foreach (var dockContent in pnlDock.Documents) + { + var document = (DockContent)dockContent; + if (document is ConnectionWindow) + { + var connectionWindow = (ConnectionWindow)document; + if (Settings.Default.AlwaysShowConnectionTabs == false) + { + connectionWindow.TabController.HideTabsMode = TabControl.HideTabsModes.HideAlways; + } + else + { + connectionWindow.TabController.HideTabsMode = TabControl.HideTabsModes.ShowAlways; + } + } + } + + if (pnlDock.DocumentStyle == newDocumentStyle) return; pnlDock.DocumentStyle = newDocumentStyle; pnlDock.Size = new Size(1, 1); } diff --git a/mRemoteV1/UI/Window/ConnectionWindow.cs b/mRemoteV1/UI/Window/ConnectionWindow.cs index 2af0c072..f5354b10 100644 --- a/mRemoteV1/UI/Window/ConnectionWindow.cs +++ b/mRemoteV1/UI/Window/ConnectionWindow.cs @@ -140,7 +140,10 @@ namespace mRemoteNG.UI.Window else TabController.TabPages.Add(nTab); - nTab.Selected = true; + if (Settings.Default.AlwaysShowConnectionTabs == false) + TabController.HideTabsMode = TabControl.HideTabsModes.HideAlways; + + nTab.Selected = true; _ignoreChangeSelectedTabClick = false; return nTab; diff --git a/mRemoteV1/app.config b/mRemoteV1/app.config index bf6ccc79..12b1665b 100644 --- a/mRemoteV1/app.config +++ b/mRemoteV1/app.config @@ -708,6 +708,9 @@ General + + True +