From ceb128b7022ccab2c6061bd47ae0a367e3a4d46f Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Tue, 26 Oct 2021 22:09:40 +0200 Subject: [PATCH] [Feature] Stay open when 'Enter' pressed and reactivated within 200ms (#226), version 1.0.24.3 --- Business/KeyboardInput.cs | 2 +- Business/Menus.cs | 33 +++-- Properties/AssemblyInfo.cs | 4 +- Properties/Settings.Designer.cs | 32 +++++ Resources/lang.Designer.cs | 27 ++++ Resources/lang.cs-CZ.resx | 9 ++ Resources/lang.de-DE.resx | 9 ++ Resources/lang.es-ES.resx | 9 ++ Resources/lang.fr-FR.resx | 9 ++ Resources/lang.it-IT.resx | 9 ++ Resources/lang.ja-JP.resx | 9 ++ Resources/lang.ko-KR.resx | 9 ++ Resources/lang.nl-NL.resx | 9 ++ Resources/lang.pt-BR.resx | 9 ++ Resources/lang.resx | 9 ++ Resources/lang.ru-RU.resx | 9 ++ Resources/lang.tr-TR.resx | 9 ++ Resources/lang.vi-VN.resx | 9 ++ Resources/lang.zh-CN.resx | 9 ++ UserInterface/SettingsForm.Designer.cs | 173 +++++++++++++++++++++---- UserInterface/SettingsForm.cs | 68 ++++++---- 21 files changed, 404 insertions(+), 61 deletions(-) diff --git a/Business/KeyboardInput.cs b/Business/KeyboardInput.cs index bbdd562..793e680 100644 --- a/Business/KeyboardInput.cs +++ b/Business/KeyboardInput.cs @@ -53,7 +53,7 @@ namespace SystemTrayMenu.Handler try { hook.RegisterHotKey(); - hook.KeyPressed += (s, e) => HotKeyPressed?.Invoke(); + hook.KeyPressed += (sender, e) => HotKeyPressed?.Invoke(); } catch (InvalidOperationException ex) { diff --git a/Business/Menus.cs b/Business/Menus.cs index 9cad9b9..44759d9 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -244,10 +244,10 @@ namespace SystemTrayMenu.Business menu.AdjustScrollbar(); } - timerShowProcessStartedAsLoadingIcon.Interval = 250; + timerShowProcessStartedAsLoadingIcon.Interval = Properties.Settings.Default.TimeUntilClosesAfterEnterPressed; timerStillActiveCheck.Interval = 1000; - timerStillActiveCheck.Tick += StillActiveTick; - void StillActiveTick(object senderTimer, EventArgs eTimer) + timerStillActiveCheck.Tick += (sender, e) => StillActiveTick(); + void StillActiveTick() { if (!IsActive()) { @@ -668,20 +668,24 @@ namespace SystemTrayMenu.Business menu.Deactivate += Deactivate; void Deactivate(object sender, EventArgs e) { - FadeHalfOrOutIfNeeded(); - if (!IsActive()) + if (!Properties.Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed || + !timerStillActiveCheck.Enabled) { - deactivatedTime = DateTime.Now; + FadeHalfOrOutIfNeeded(); + if (!IsActive()) + { + deactivatedTime = DateTime.Now; + } } } - menu.Activated += Activated; - void Activated(object sender, EventArgs e) + menu.Activated += (sender, e) => Activated(); + void Activated() { - if (IsActive() && - menus[0].IsUsable) + if (IsActive() && menus[0].IsUsable) { AsList.ForEach(m => m.ShowWithFade()); + timerStillActiveCheck.Stop(); timerStillActiveCheck.Start(); } } @@ -881,9 +885,18 @@ namespace SystemTrayMenu.Business row.Cells[0].Value = rowData.ReadLoadedIcon(); timerShowProcessStartedAsLoadingIcon.Tick -= Tick; timerShowProcessStartedAsLoadingIcon.Stop(); + + if (Properties.Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed) + { + timerStillActiveCheck.Stop(); + FadeHalfOrOutIfNeeded(); + } } + timerShowProcessStartedAsLoadingIcon.Stop(); timerShowProcessStartedAsLoadingIcon.Start(); + timerStillActiveCheck.Stop(); + timerStillActiveCheck.Start(); } } } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 1769fab..80b211d 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.24.2")] -[assembly: AssemblyFileVersion("1.0.24.2")] +[assembly: AssemblyVersion("1.0.24.3")] +[assembly: AssemblyFileVersion("1.0.24.3")] diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 4d8cb12..a69b3fe 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -283,6 +283,38 @@ namespace SystemTrayMenu.Properties } } + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("true")] + public bool StaysOpenWhenFocusLostAfterEnterPressed + { + get + { + return ((bool)(this["StaysOpenWhenFocusLostAfterEnterPressed"])); + } + set + { + this["StaysOpenWhenFocusLostAfterEnterPressed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("200")] + public int TimeUntilClosesAfterEnterPressed + { + get + { + return ((int)(this["TimeUntilClosesAfterEnterPressed"])); + } + set + { + this["TimeUntilClosesAfterEnterPressed"] = value; + } + } + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] diff --git a/Resources/lang.Designer.cs b/Resources/lang.Designer.cs index 4b3c94c..aa93802 100644 --- a/Resources/lang.Designer.cs +++ b/Resources/lang.Designer.cs @@ -321,6 +321,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Expert. + /// + internal static string Expert { + get { + return ResourceManager.GetString("Expert", resourceCulture); + } + } + /// /// Looks up a localized string similar to Folder. /// @@ -402,6 +411,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to If the focus is lost and the Enter key was pressed. + /// + internal static string If_the_focus_is_lost_and_the_Enter_key_was_pressed { + get { + return ResourceManager.GetString("If the focus is lost and the Enter key was pressed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Language. /// @@ -474,6 +492,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Milliseconds until the menu closes if in this case the menu is not reactivated. + /// + internal static string Milliseconds_until_the_menu_closes_if_in_this_case_the_menu_is_not_reactivated { + get { + return ResourceManager.GetString("Milliseconds until the menu closes if in this case the menu is not reactivated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Milliseconds until the menu closes if in this case the mouse then leaves the menu. /// diff --git a/Resources/lang.cs-CZ.resx b/Resources/lang.cs-CZ.resx index 885d3a8..e84a3b0 100644 --- a/Resources/lang.cs-CZ.resx +++ b/Resources/lang.cs-CZ.resx @@ -354,4 +354,13 @@ Správce úloh + + Expert + + + Pokud dojde ke ztrátě fokusu a byla stisknuta klávesa Enter + + + Milisekundy, než se nabídka zavře, pokud v tomto případě není nabídka znovu aktivována + \ No newline at end of file diff --git a/Resources/lang.de-DE.resx b/Resources/lang.de-DE.resx index 48d6f55..7b1e238 100644 --- a/Resources/lang.de-DE.resx +++ b/Resources/lang.de-DE.resx @@ -354,4 +354,13 @@ Taskmanager + + Experte + + + Wenn der Fokus verloren geht und die Eingabetaste gedrückt wurde + + + Millisekunden bis das Menü schließt, wenn in diesem Fall das Menü nicht wieder aktiviert wird + \ No newline at end of file diff --git a/Resources/lang.es-ES.resx b/Resources/lang.es-ES.resx index c4253ee..eba0529 100644 --- a/Resources/lang.es-ES.resx +++ b/Resources/lang.es-ES.resx @@ -354,4 +354,13 @@ Administrador de tareas + + Experto + + + Si se pierde el enfoque y se presionó la tecla Enter + + + Milisegundos hasta que se cierre el menú si en este caso no se reactiva el menú + \ No newline at end of file diff --git a/Resources/lang.fr-FR.resx b/Resources/lang.fr-FR.resx index 81e02fe..863b752 100644 --- a/Resources/lang.fr-FR.resx +++ b/Resources/lang.fr-FR.resx @@ -354,4 +354,13 @@ Gestionnaire des tâches + + Expert + + + Si le focus est perdu et que la touche Entrée a été enfoncée + + + Millisecondes jusqu'à la fermeture du menu si dans ce cas le menu n'est pas réactivé + \ No newline at end of file diff --git a/Resources/lang.it-IT.resx b/Resources/lang.it-IT.resx index 9a4dfeb..6cab65b 100644 --- a/Resources/lang.it-IT.resx +++ b/Resources/lang.it-IT.resx @@ -354,4 +354,13 @@ Task Manger + + Esperto + + + Se la messa a fuoco è persa ed è stato premuto il tasto Invio + + + Millisecondi alla chiusura del menu se in questo caso il menu non viene riattivato + \ No newline at end of file diff --git a/Resources/lang.ja-JP.resx b/Resources/lang.ja-JP.resx index 2d0143b..967775f 100644 --- a/Resources/lang.ja-JP.resx +++ b/Resources/lang.ja-JP.resx @@ -354,4 +354,13 @@ タスクマネージャー + + エキスパート + + + フォーカスが失われ、Enterキーが押された場合 + + + この場合、メニューが再度アクティブ化されない場合、メニューが閉じるまでのミリ秒 + \ No newline at end of file diff --git a/Resources/lang.ko-KR.resx b/Resources/lang.ko-KR.resx index a6a06d4..f8e56bf 100644 --- a/Resources/lang.ko-KR.resx +++ b/Resources/lang.ko-KR.resx @@ -354,4 +354,13 @@ 작업 관리자 + + 전문가 + + + 초점을 잃고 Enter 키를 누른 경우 + + + 이 경우 메뉴가 다시 활성화되지 않으면 메뉴가 닫힐 때까지의 시간(밀리초) + \ No newline at end of file diff --git a/Resources/lang.nl-NL.resx b/Resources/lang.nl-NL.resx index 4de0147..84871d3 100644 --- a/Resources/lang.nl-NL.resx +++ b/Resources/lang.nl-NL.resx @@ -354,4 +354,13 @@ Taakbeheer + + Deskundige + + + Als de focus verloren is gegaan en de Enter-toets is ingedrukt + + + Milliseconden totdat het menu wordt gesloten als het menu in dit geval niet opnieuw wordt geactiveerd + \ No newline at end of file diff --git a/Resources/lang.pt-BR.resx b/Resources/lang.pt-BR.resx index b093c9a..a963cf0 100644 --- a/Resources/lang.pt-BR.resx +++ b/Resources/lang.pt-BR.resx @@ -354,4 +354,13 @@ Gerenciador de tarefas + + Especialista + + + Se o foco foi perdido e a tecla Enter foi pressionada + + + Milissegundos até o menu fechar se, neste caso, o menu não for reativado + \ No newline at end of file diff --git a/Resources/lang.resx b/Resources/lang.resx index f45bf0d..c851fda 100644 --- a/Resources/lang.resx +++ b/Resources/lang.resx @@ -354,4 +354,13 @@ Activated + + Expert + + + If the focus is lost and the Enter key was pressed + + + Milliseconds until the menu closes if in this case the menu is not reactivated + \ No newline at end of file diff --git a/Resources/lang.ru-RU.resx b/Resources/lang.ru-RU.resx index 799ed20..41810f6 100644 --- a/Resources/lang.ru-RU.resx +++ b/Resources/lang.ru-RU.resx @@ -354,4 +354,13 @@ Диспетчер задач + + Эксперт + + + Если фокус потерян и была нажата клавиша Enter + + + Миллисекунды до закрытия меню, если в этом случае меню не активируется повторно. + \ No newline at end of file diff --git a/Resources/lang.tr-TR.resx b/Resources/lang.tr-TR.resx index 2df471a..0aaa003 100644 --- a/Resources/lang.tr-TR.resx +++ b/Resources/lang.tr-TR.resx @@ -354,4 +354,13 @@ Görev Yöneticisi + + Uzman + + + Odak kaybolursa ve Enter tuşuna basıldıysa + + + Bu durumda menü yeniden etkinleştirilmezse menü kapanana kadar milisaniye + \ No newline at end of file diff --git a/Resources/lang.vi-VN.resx b/Resources/lang.vi-VN.resx index 03e536a..a2aaa31 100644 --- a/Resources/lang.vi-VN.resx +++ b/Resources/lang.vi-VN.resx @@ -354,4 +354,13 @@ Quản lý công việc + + Thạo + + + Nếu mất tiêu điểm và nhấn phím Enter + + + Mili giây cho đến khi menu đóng lại nếu trong trường hợp này, menu chưa được kích hoạt lại + \ No newline at end of file diff --git a/Resources/lang.zh-CN.resx b/Resources/lang.zh-CN.resx index 2bdc186..30d7a63 100644 --- a/Resources/lang.zh-CN.resx +++ b/Resources/lang.zh-CN.resx @@ -354,4 +354,13 @@ 任务管理器 + + 专家 + + + 如果失去焦点并且按下了 Enter 键 + + + 如果在这种情况下菜单未重新激活,则菜单关闭前的毫秒数 + \ No newline at end of file diff --git a/UserInterface/SettingsForm.Designer.cs b/UserInterface/SettingsForm.Designer.cs index bfae80d..7658940 100644 --- a/UserInterface/SettingsForm.Designer.cs +++ b/UserInterface/SettingsForm.Designer.cs @@ -77,18 +77,25 @@ namespace SystemTrayMenu.UserInterface this.numericUpDownMenuWidth = new System.Windows.Forms.NumericUpDown(); this.labelMaxMenuWidth = new System.Windows.Forms.Label(); this.checkBoxAppearAtMouseLocation = new System.Windows.Forms.CheckBox(); + this.buttonAdvancedDefault = new System.Windows.Forms.Button(); + this.tabPageExpert = new System.Windows.Forms.TabPage(); + this.tableLayoutPanelExpert = new System.Windows.Forms.TableLayoutPanel(); + this.buttonExpertDefault = new System.Windows.Forms.Button(); this.groupBoxStaysOpen = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelStaysOpen = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.labelTimeUntilClosesAfterEnterPressed = new System.Windows.Forms.Label(); + this.numericUpDownTimeUntilClosesAfterEnterPressed = new System.Windows.Forms.NumericUpDown(); this.checkBoxStayOpenWhenItemClicked = new System.Windows.Forms.CheckBox(); this.checkBoxStayOpenWhenFocusLost = new System.Windows.Forms.CheckBox(); this.tableLayoutPanelTimeUntilCloses = new System.Windows.Forms.TableLayoutPanel(); this.labelTimeUntilCloses = new System.Windows.Forms.Label(); this.numericUpDownTimeUntilClose = new System.Windows.Forms.NumericUpDown(); + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed = new System.Windows.Forms.CheckBox(); this.groupBoxOpenSubmenus = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelTimeUntilOpen = new System.Windows.Forms.TableLayoutPanel(); this.numericUpDownTimeUntilOpens = new System.Windows.Forms.NumericUpDown(); this.labelTimeUntilOpen = new System.Windows.Forms.Label(); - this.buttonAdvancedDefault = new System.Windows.Forms.Button(); this.tabPageCustomize = new System.Windows.Forms.TabPage(); this.tableLayoutPanelCustomize = new System.Windows.Forms.TableLayoutPanel(); this.groupBoxColorsLightMode = new System.Windows.Forms.GroupBox(); @@ -294,8 +301,12 @@ namespace SystemTrayMenu.UserInterface ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMenuHeight)).BeginInit(); this.tableLayoutPanelMaxMenuWidth.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMenuWidth)).BeginInit(); + this.tabPageExpert.SuspendLayout(); + this.tableLayoutPanelExpert.SuspendLayout(); this.groupBoxStaysOpen.SuspendLayout(); this.tableLayoutPanelStaysOpen.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeUntilClosesAfterEnterPressed)).BeginInit(); this.tableLayoutPanelTimeUntilCloses.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeUntilClose)).BeginInit(); this.groupBoxOpenSubmenus.SuspendLayout(); @@ -410,6 +421,7 @@ namespace SystemTrayMenu.UserInterface // this.tabControl.Controls.Add(this.tabPageGeneral); this.tabControl.Controls.Add(this.tabPageAdvanced); + this.tabControl.Controls.Add(this.tabPageExpert); this.tabControl.Controls.Add(this.tabPageCustomize); this.tabControl.Location = new System.Drawing.Point(6, 3); this.tabControl.Margin = new System.Windows.Forms.Padding(6, 3, 6, 3); @@ -838,18 +850,16 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelAdvanced.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanelAdvanced.Controls.Add(this.groupBoxClick, 0, 0); this.tableLayoutPanelAdvanced.Controls.Add(this.groupBoxSizeAndLocation, 0, 1); - this.tableLayoutPanelAdvanced.Controls.Add(this.groupBoxStaysOpen, 0, 2); - this.tableLayoutPanelAdvanced.Controls.Add(this.groupBoxOpenSubmenus, 0, 3); - this.tableLayoutPanelAdvanced.Controls.Add(this.buttonAdvancedDefault, 0, 4); + this.tableLayoutPanelAdvanced.Controls.Add(this.buttonAdvancedDefault, 0, 2); this.tableLayoutPanelAdvanced.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanelAdvanced.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanelAdvanced.Name = "tableLayoutPanelAdvanced"; - this.tableLayoutPanelAdvanced.RowCount = 5; - this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelAdvanced.RowCount = 3; this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanelAdvanced.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanelAdvanced.Size = new System.Drawing.Size(408, 407); this.tableLayoutPanelAdvanced.TabIndex = 0; // @@ -1054,17 +1064,75 @@ namespace SystemTrayMenu.UserInterface this.checkBoxAppearAtMouseLocation.Text = "checkBoxAppearAtMouseLocation"; this.checkBoxAppearAtMouseLocation.UseVisualStyleBackColor = true; // + // buttonAdvancedDefault + // + this.buttonAdvancedDefault.AutoSize = true; + this.buttonAdvancedDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.buttonAdvancedDefault.Location = new System.Drawing.Point(9, 205); + this.buttonAdvancedDefault.Margin = new System.Windows.Forms.Padding(9, 9, 3, 9); + this.buttonAdvancedDefault.MinimumSize = new System.Drawing.Size(75, 25); + this.buttonAdvancedDefault.Name = "buttonAdvancedDefault"; + this.buttonAdvancedDefault.Size = new System.Drawing.Size(144, 25); + this.buttonAdvancedDefault.TabIndex = 0; + this.buttonAdvancedDefault.Text = "buttonAdvancedDefault"; + this.buttonAdvancedDefault.UseVisualStyleBackColor = true; + this.buttonAdvancedDefault.Click += new System.EventHandler(this.ButtonAdvancedDefault_Click); + // + // tabPageExpert + // + this.tabPageExpert.Controls.Add(this.tableLayoutPanelExpert); + this.tabPageExpert.Location = new System.Drawing.Point(4, 24); + this.tabPageExpert.Name = "tabPageExpert"; + this.tabPageExpert.Padding = new System.Windows.Forms.Padding(3); + this.tabPageExpert.Size = new System.Drawing.Size(414, 413); + this.tabPageExpert.TabIndex = 1; + this.tabPageExpert.Text = "tabPageExpert"; + this.tabPageExpert.UseVisualStyleBackColor = true; + // + // tableLayoutPanelExpert + // + this.tableLayoutPanelExpert.AutoSize = true; + this.tableLayoutPanelExpert.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanelExpert.ColumnCount = 1; + this.tableLayoutPanelExpert.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelExpert.Controls.Add(this.buttonExpertDefault, 0, 2); + this.tableLayoutPanelExpert.Controls.Add(this.groupBoxStaysOpen, 0, 1); + this.tableLayoutPanelExpert.Controls.Add(this.groupBoxOpenSubmenus, 0, 0); + this.tableLayoutPanelExpert.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanelExpert.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanelExpert.Name = "tableLayoutPanelExpert"; + this.tableLayoutPanelExpert.RowCount = 3; + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelExpert.Size = new System.Drawing.Size(408, 407); + this.tableLayoutPanelExpert.TabIndex = 1; + // + // buttonExpertDefault + // + this.buttonExpertDefault.AutoSize = true; + this.buttonExpertDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.buttonExpertDefault.Location = new System.Drawing.Point(9, 233); + this.buttonExpertDefault.Margin = new System.Windows.Forms.Padding(9, 9, 3, 9); + this.buttonExpertDefault.MinimumSize = new System.Drawing.Size(75, 25); + this.buttonExpertDefault.Name = "buttonExpertDefault"; + this.buttonExpertDefault.Size = new System.Drawing.Size(124, 25); + this.buttonExpertDefault.TabIndex = 0; + this.buttonExpertDefault.Text = "buttonExpertDefault"; + this.buttonExpertDefault.UseVisualStyleBackColor = true; + this.buttonExpertDefault.Click += new System.EventHandler(this.ButtonExpertDefault_Click); + // // groupBoxStaysOpen // this.groupBoxStaysOpen.AutoSize = true; this.groupBoxStaysOpen.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxStaysOpen.Controls.Add(this.tableLayoutPanelStaysOpen); - this.groupBoxStaysOpen.Location = new System.Drawing.Point(3, 199); + this.groupBoxStaysOpen.Location = new System.Drawing.Point(3, 63); this.groupBoxStaysOpen.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxStaysOpen.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxStaysOpen.Name = "groupBoxStaysOpen"; this.groupBoxStaysOpen.Padding = new System.Windows.Forms.Padding(3, 3, 3, 6); - this.groupBoxStaysOpen.Size = new System.Drawing.Size(400, 104); + this.groupBoxStaysOpen.Size = new System.Drawing.Size(400, 158); this.groupBoxStaysOpen.TabIndex = 0; this.groupBoxStaysOpen.TabStop = false; this.groupBoxStaysOpen.Text = "groupBoxStaysOpen"; @@ -1075,19 +1143,59 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelStaysOpen.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanelStaysOpen.ColumnCount = 1; this.tableLayoutPanelStaysOpen.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanelStaysOpen.Controls.Add(this.tableLayoutPanel4, 0, 4); this.tableLayoutPanelStaysOpen.Controls.Add(this.checkBoxStayOpenWhenItemClicked, 0, 0); this.tableLayoutPanelStaysOpen.Controls.Add(this.checkBoxStayOpenWhenFocusLost, 0, 1); this.tableLayoutPanelStaysOpen.Controls.Add(this.tableLayoutPanelTimeUntilCloses, 0, 2); + this.tableLayoutPanelStaysOpen.Controls.Add(this.checkBoxStayOpenWhenFocusLostAfterEnterPressed, 0, 3); this.tableLayoutPanelStaysOpen.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanelStaysOpen.Location = new System.Drawing.Point(3, 19); this.tableLayoutPanelStaysOpen.Name = "tableLayoutPanelStaysOpen"; - this.tableLayoutPanelStaysOpen.RowCount = 3; + this.tableLayoutPanelStaysOpen.RowCount = 5; this.tableLayoutPanelStaysOpen.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelStaysOpen.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelStaysOpen.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelStaysOpen.Size = new System.Drawing.Size(394, 79); + this.tableLayoutPanelStaysOpen.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelStaysOpen.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelStaysOpen.Size = new System.Drawing.Size(394, 133); this.tableLayoutPanelStaysOpen.TabIndex = 0; // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel4.AutoSize = true; + this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel4.ColumnCount = 2; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.labelTimeUntilClosesAfterEnterPressed, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.numericUpDownTimeUntilClosesAfterEnterPressed, 0, 0); + this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 104); + this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 1; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.Size = new System.Drawing.Size(394, 29); + this.tableLayoutPanel4.TabIndex = 2; + // + // labelTimeUntilClosesAfterEnterPressed + // + this.labelTimeUntilClosesAfterEnterPressed.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.labelTimeUntilClosesAfterEnterPressed.AutoSize = true; + this.labelTimeUntilClosesAfterEnterPressed.Location = new System.Drawing.Point(64, 7); + this.labelTimeUntilClosesAfterEnterPressed.MaximumSize = new System.Drawing.Size(330, 0); + this.labelTimeUntilClosesAfterEnterPressed.Name = "labelTimeUntilClosesAfterEnterPressed"; + this.labelTimeUntilClosesAfterEnterPressed.Size = new System.Drawing.Size(210, 15); + this.labelTimeUntilClosesAfterEnterPressed.TabIndex = 0; + this.labelTimeUntilClosesAfterEnterPressed.Text = "labelTimeUntilClosesAfterEnterPressed"; + // + // numericUpDownTimeUntilClosesAfterEnterPressed + // + this.numericUpDownTimeUntilClosesAfterEnterPressed.Location = new System.Drawing.Point(3, 3); + this.numericUpDownTimeUntilClosesAfterEnterPressed.Name = "numericUpDownTimeUntilClosesAfterEnterPressed"; + this.numericUpDownTimeUntilClosesAfterEnterPressed.Size = new System.Drawing.Size(55, 23); + this.numericUpDownTimeUntilClosesAfterEnterPressed.TabIndex = 1; + // // checkBoxStayOpenWhenItemClicked // this.checkBoxStayOpenWhenItemClicked.AutoSize = true; @@ -1151,12 +1259,25 @@ namespace SystemTrayMenu.UserInterface this.numericUpDownTimeUntilClose.KeyDown += new System.Windows.Forms.KeyEventHandler(this.StopPlayingDingSoundEnterKeyPressed_KeyDown); this.numericUpDownTimeUntilClose.KeyUp += new System.Windows.Forms.KeyEventHandler(this.StopPlayingDingSoundEnterKeyPressed_KeyUp); // + // checkBoxStayOpenWhenFocusLostAfterEnterPressed + // + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.AutoSize = true; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked = true; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.Location = new System.Drawing.Point(3, 82); + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.Name = "checkBoxStayOpenWhenFocusLostAfterEnterPressed"; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.Size = new System.Drawing.Size(305, 19); + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.TabIndex = 1; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.Text = "checkBoxStayOpenWhenFocusLostAfterEnterPressed"; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.UseVisualStyleBackColor = true; + this.checkBoxStayOpenWhenFocusLostAfterEnterPressed.CheckedChanged += new System.EventHandler(this.CheckBoxStayOpenWhenFocusLostAfterEnterPressed_CheckedChanged); + // // groupBoxOpenSubmenus // this.groupBoxOpenSubmenus.AutoSize = true; this.groupBoxOpenSubmenus.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxOpenSubmenus.Controls.Add(this.tableLayoutPanelTimeUntilOpen); - this.groupBoxOpenSubmenus.Location = new System.Drawing.Point(3, 309); + this.groupBoxOpenSubmenus.Location = new System.Drawing.Point(3, 3); this.groupBoxOpenSubmenus.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxOpenSubmenus.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxOpenSubmenus.Name = "groupBoxOpenSubmenus"; @@ -1203,20 +1324,6 @@ namespace SystemTrayMenu.UserInterface this.labelTimeUntilOpen.TabIndex = 0; this.labelTimeUntilOpen.Text = "labelTimeUntilOpen"; // - // buttonAdvancedDefault - // - this.buttonAdvancedDefault.AutoSize = true; - this.buttonAdvancedDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.buttonAdvancedDefault.Location = new System.Drawing.Point(9, 375); - this.buttonAdvancedDefault.Margin = new System.Windows.Forms.Padding(9, 9, 3, 9); - this.buttonAdvancedDefault.MinimumSize = new System.Drawing.Size(75, 25); - this.buttonAdvancedDefault.Name = "buttonAdvancedDefault"; - this.buttonAdvancedDefault.Size = new System.Drawing.Size(144, 25); - this.buttonAdvancedDefault.TabIndex = 0; - this.buttonAdvancedDefault.Text = "buttonAdvancedDefault"; - this.buttonAdvancedDefault.UseVisualStyleBackColor = true; - this.buttonAdvancedDefault.Click += new System.EventHandler(this.ButtonAdvancedDefault_Click); - // // tabPageCustomize // this.tabPageCustomize.AutoScroll = true; @@ -3744,10 +3851,17 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelMaxMenuWidth.ResumeLayout(false); this.tableLayoutPanelMaxMenuWidth.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMenuWidth)).EndInit(); + this.tabPageExpert.ResumeLayout(false); + this.tabPageExpert.PerformLayout(); + this.tableLayoutPanelExpert.ResumeLayout(false); + this.tableLayoutPanelExpert.PerformLayout(); this.groupBoxStaysOpen.ResumeLayout(false); this.groupBoxStaysOpen.PerformLayout(); this.tableLayoutPanelStaysOpen.ResumeLayout(false); this.tableLayoutPanelStaysOpen.PerformLayout(); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeUntilClosesAfterEnterPressed)).EndInit(); this.tableLayoutPanelTimeUntilCloses.ResumeLayout(false); this.tableLayoutPanelTimeUntilCloses.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTimeUntilClose)).EndInit(); @@ -4135,5 +4249,12 @@ namespace SystemTrayMenu.UserInterface private System.Windows.Forms.Button buttonOpenFolder; private System.Windows.Forms.Button buttonAddTaskManagerStartupTask; private System.Windows.Forms.Label labelStartupTaskStatus; + private System.Windows.Forms.TabPage tabPageExpert; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelExpert; + private System.Windows.Forms.Button buttonExpertDefault; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.Label labelTimeUntilClosesAfterEnterPressed; + private System.Windows.Forms.NumericUpDown numericUpDownTimeUntilClosesAfterEnterPressed; + private System.Windows.Forms.CheckBox checkBoxStayOpenWhenFocusLostAfterEnterPressed; } } \ No newline at end of file diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index 0568b3e..2dd95f9 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -106,6 +106,7 @@ namespace SystemTrayMenu.UserInterface Text = Translator.GetText("Settings"); tabPageGeneral.Text = Translator.GetText("General"); tabPageAdvanced.Text = Translator.GetText("Advanced"); + tabPageExpert.Text = Translator.GetText("Expert"); tabPageCustomize.Text = Translator.GetText("Customize"); groupBoxFolder.Text = Translator.GetText("Folder"); buttonChangeFolder.Text = Translator.GetText("Change folder"); @@ -134,13 +135,16 @@ namespace SystemTrayMenu.UserInterface labelMaxMenuWidth.Text = Translator.GetText("Pixels maximum menu width"); labelMaxMenuHeight.Text = Translator.GetText("Pixels maximum menu height"); checkBoxAppearAtMouseLocation.Text = Translator.GetText("Appear at mouse location"); + buttonAdvancedDefault.Text = Translator.GetText("Default"); groupBoxStaysOpen.Text = Translator.GetText("Stays open"); checkBoxStayOpenWhenItemClicked.Text = Translator.GetText("If an item was clicked"); checkBoxStayOpenWhenFocusLost.Text = Translator.GetText("If the focus is lost and if the mouse is still on the menu"); labelTimeUntilCloses.Text = Translator.GetText("Milliseconds until the menu closes if in this case the mouse then leaves the menu"); groupBoxOpenSubmenus.Text = Translator.GetText("Time until a menu opens"); labelTimeUntilOpen.Text = Translator.GetText("Milliseconds until a menu opens when the mouse is on it"); - buttonAdvancedDefault.Text = Translator.GetText("Default"); + checkBoxStayOpenWhenFocusLostAfterEnterPressed.Text = Translator.GetText("If the focus is lost and the Enter key was pressed"); + labelTimeUntilClosesAfterEnterPressed.Text = Translator.GetText("Milliseconds until the menu closes if in this case the menu is not reactivated"); + buttonExpertDefault.Text = Translator.GetText("Default"); groupBoxColorsLightMode.Text = Translator.GetText("Colors Light Mode"); groupBoxColorsDarkMode.Text = Translator.GetText("Colors Dark Mode"); labelMenuLightMode.Text = Translator.GetText("Menu"); @@ -317,6 +321,13 @@ namespace SystemTrayMenu.UserInterface numericUpDownTimeUntilOpens.Increment = 10; numericUpDownTimeUntilOpens.Value = Settings.Default.TimeUntilOpens; + checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked = Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed; + + numericUpDownTimeUntilClosesAfterEnterPressed.Minimum = 20; + numericUpDownTimeUntilClosesAfterEnterPressed.Maximum = 1000; + numericUpDownTimeUntilClosesAfterEnterPressed.Increment = 10; + numericUpDownTimeUntilClosesAfterEnterPressed.Value = Settings.Default.TimeUntilClosesAfterEnterPressed; + checkBoxDarkModeAlwaysOn.Checked = Settings.Default.IsDarkModeAlwaysOn; textBoxColorSelectedItem.Text = Settings.Default.ColorSelectedItem; textBoxColorSelecetedItemDarkMode.Text = Settings.Default.ColorDarkModeSelecetedItem; @@ -583,7 +594,7 @@ namespace SystemTrayMenu.UserInterface tabControl.Size = new Size( tabControl.Size.Width, - tableLayoutPanelAdvanced.Size.Height + (int)(50 * Scaling.Factor)); + tableLayoutPanelGeneral.Size.Height + (int)(50 * Scaling.Factor)); } private void ButtonOk_Click(object sender, EventArgs e) @@ -631,6 +642,8 @@ namespace SystemTrayMenu.UserInterface Settings.Default.StaysOpenWhenFocusLost = checkBoxStayOpenWhenFocusLost.Checked; Settings.Default.TimeUntilCloses = (int)numericUpDownTimeUntilClose.Value; Settings.Default.TimeUntilOpens = (int)numericUpDownTimeUntilOpens.Value; + Settings.Default.StaysOpenWhenFocusLostAfterEnterPressed = checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked; + Settings.Default.TimeUntilClosesAfterEnterPressed = (int)numericUpDownTimeUntilClosesAfterEnterPressed.Value; Settings.Default.IsDarkModeAlwaysOn = checkBoxDarkModeAlwaysOn.Checked; @@ -726,26 +739,6 @@ namespace SystemTrayMenu.UserInterface textBoxHotkey.SetHotkey("Ctrl+LWin"); } - private void ButtonAdvancedDefault_Click(object sender, EventArgs e) - { - checkBoxOpenItemWithOneClick.Checked = true; - checkBoxAppearAtMouseLocation.Checked = false; - numericUpDownSizeInPercentage.Value = 100; - numericUpDownMenuWidth.Value = 300; - numericUpDownMenuHeight.Value = 600; - checkBoxStayOpenWhenItemClicked.Checked = true; - checkBoxStayOpenWhenFocusLost.Checked = true; - numericUpDownTimeUntilClose.Value = 1000; - numericUpDownTimeUntilOpens.Value = 100; - } - - private void ButtonCancel_Click(object sender, EventArgs e) - { - Settings.Default.Reload(); - DialogResult = DialogResult.Cancel; - Close(); - } - private void ButtonChange_Click(object sender, EventArgs e) { Config.SetFolderByUser(false); @@ -785,11 +778,35 @@ namespace SystemTrayMenu.UserInterface inHotkey = false; } + private void ButtonAdvancedDefault_Click(object sender, EventArgs e) + { + checkBoxOpenItemWithOneClick.Checked = true; + checkBoxAppearAtMouseLocation.Checked = false; + numericUpDownSizeInPercentage.Value = 100; + numericUpDownMenuWidth.Value = 300; + numericUpDownMenuHeight.Value = 600; + } + private void CheckBoxStayOpenWhenFocusLost_CheckedChanged(object sender, EventArgs e) { numericUpDownTimeUntilClose.Enabled = checkBoxStayOpenWhenFocusLost.Checked; } + private void CheckBoxStayOpenWhenFocusLostAfterEnterPressed_CheckedChanged(object sender, EventArgs e) + { + numericUpDownTimeUntilClosesAfterEnterPressed.Enabled = checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked; + } + + private void ButtonExpertDefault_Click(object sender, EventArgs e) + { + checkBoxStayOpenWhenItemClicked.Checked = true; + checkBoxStayOpenWhenFocusLost.Checked = true; + numericUpDownTimeUntilClose.Value = 1000; + numericUpDownTimeUntilOpens.Value = 100; + checkBoxStayOpenWhenFocusLostAfterEnterPressed.Checked = true; + numericUpDownTimeUntilClosesAfterEnterPressed.Value = 200; + } + private void TextBoxColorsChanged(object sender, EventArgs e) { TextBox textBox = (TextBox)sender; @@ -942,5 +959,12 @@ namespace SystemTrayMenu.UserInterface e.Handled = e.SuppressKeyPress = true; } } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + Settings.Default.Reload(); + DialogResult = DialogResult.Cancel; + Close(); + } } }