From 17079c28e6e7765497116ddba8a334c08da1b383 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sun, 6 Jun 2021 14:46:48 +0200 Subject: [PATCH] [Feature] Option to choose own icon (#176), version 1.0.17.63 --- Properties/AssemblyInfo.cs | 4 +- Properties/Settings.Designer.cs | 16 ++++++++ Resources/lang.Designer.cs | 54 +++++--------------------- Resources/lang.resx | 3 ++ UserInterface/AppNotifyIcon.cs | 11 +++++- UserInterface/SettingsForm.Designer.cs | 28 +++++++++---- UserInterface/SettingsForm.cs | 6 +++ 7 files changed, 67 insertions(+), 55 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index a03eba3..f947bd4 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.17.62")] -[assembly: AssemblyFileVersion("1.0.17.62")] +[assembly: AssemblyVersion("1.0.17.63")] +[assembly: AssemblyFileVersion("1.0.17.63")] diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index e196fc9..be2b44b 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -826,5 +826,21 @@ namespace SystemTrayMenu.Properties this["ColorScrollbarBackgroundDarkMode"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool UseIconFromRootFolder + { + get + { + return ((bool)(this["UseIconFromRootFolder"])); + } + set + { + this["UseIconFromRootFolder"] = value; + } + } } } diff --git a/Resources/lang.Designer.cs b/Resources/lang.Designer.cs index b8add9c..72ec2c1 100644 --- a/Resources/lang.Designer.cs +++ b/Resources/lang.Designer.cs @@ -249,15 +249,6 @@ namespace SystemTrayMenu.Resources { } } - /// - /// Looks up a localized string similar to Colors Light Mode and Dark Mode. - /// - internal static string Colors_Light_Mode_and_Dark_Mode { - get { - return ResourceManager.GetString("Colors Light Mode and Dark Mode", resourceCulture); - } - } - /// /// Looks up a localized string similar to Couldn’t register the hot key.. /// @@ -276,15 +267,6 @@ namespace SystemTrayMenu.Resources { } } - /// - /// Looks up a localized string similar to Dark Mode. - /// - internal static string Dark_Mode { - get { - return ResourceManager.GetString("Dark Mode", resourceCulture); - } - } - /// /// Looks up a localized string similar to Dark Mode always active. /// @@ -303,24 +285,6 @@ namespace SystemTrayMenu.Resources { } } - /// - /// Looks up a localized string similar to Default Dark Mode. - /// - internal static string Default_Dark_Mode { - get { - return ResourceManager.GetString("Default Dark Mode", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Default Light Mode. - /// - internal static string Default_Light_Mode { - get { - return ResourceManager.GetString("Default Light Mode", resourceCulture); - } - } - /// /// Looks up a localized string similar to Exit. /// @@ -682,15 +646,6 @@ namespace SystemTrayMenu.Resources { } } - /// - /// Looks up a localized string similar to To change a color paste a HTML Color Code or double click into a field.. - /// - internal static string To_change_a_color_paste_a_HTML_Color_Code_or_double_click_into_a_field_ { - get { - return ResourceManager.GetString("To change a color paste a HTML Color Code or double click into a field.", resourceCulture); - } - } - /// /// Looks up a localized string similar to USB. /// @@ -700,6 +655,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Use icon from folder. + /// + internal static string Use_icon_from_folder { + get { + return ResourceManager.GetString("Use icon from folder", resourceCulture); + } + } + /// /// Looks up a localized string similar to Warning. /// diff --git a/Resources/lang.resx b/Resources/lang.resx index 8a2902a..7154862 100644 --- a/Resources/lang.resx +++ b/Resources/lang.resx @@ -318,4 +318,7 @@ Slider while mouse hovers 2 + + Use icon from folder + \ No newline at end of file diff --git a/UserInterface/AppNotifyIcon.cs b/UserInterface/AppNotifyIcon.cs index bb97a1b..9c3aaa6 100644 --- a/UserInterface/AppNotifyIcon.cs +++ b/UserInterface/AppNotifyIcon.cs @@ -17,7 +17,7 @@ namespace SystemTrayMenu.UserInterface internal class AppNotifyIcon : IDisposable { private const int Interval60FPS = 16; // 60fps=>1s/60fps=~16.6ms - private static readonly Icon SystemTrayMenu = R.SystemTrayMenu; + private static Icon SystemTrayMenu = R.SystemTrayMenu; private readonly Timer load = new Timer(); private readonly NotifyIcon notifyIcon = new NotifyIcon(); private readonly int indexLoad; @@ -40,6 +40,15 @@ namespace SystemTrayMenu.UserInterface load.Interval = Interval60FPS; notifyIcon.Text = Translator.GetText("SystemTrayMenu"); notifyIcon.Visible = true; + + if (Properties.Settings.Default.UseIconFromRootFolder) + { + SystemTrayMenu = IconReader.GetFolderIconSTA( + Config.Path, + IconReader.FolderType.Closed, + false); + } + notifyIcon.Icon = SystemTrayMenu; AppContextMenu contextMenus = new AppContextMenu(); diff --git a/UserInterface/SettingsForm.Designer.cs b/UserInterface/SettingsForm.Designer.cs index def59ac..b2335e3 100644 --- a/UserInterface/SettingsForm.Designer.cs +++ b/UserInterface/SettingsForm.Designer.cs @@ -242,6 +242,7 @@ namespace SystemTrayMenu.UserInterface this.buttonOk = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.colorDialog = new System.Windows.Forms.ColorDialog(); + this.checkBoxUseIconFromRootFolder = new System.Windows.Forms.CheckBox(); this.tableLayoutPanelMain.SuspendLayout(); this.tabControl.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); @@ -428,7 +429,7 @@ namespace SystemTrayMenu.UserInterface this.groupBoxFolder.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxFolder.Name = "groupBoxFolder"; this.groupBoxFolder.Padding = new System.Windows.Forms.Padding(3, 6, 3, 6); - this.groupBoxFolder.Size = new System.Drawing.Size(400, 81); + this.groupBoxFolder.Size = new System.Drawing.Size(400, 106); this.groupBoxFolder.TabIndex = 0; this.groupBoxFolder.TabStop = false; this.groupBoxFolder.Text = "groupBoxFolder"; @@ -441,13 +442,15 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelFolder.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanelFolder.Controls.Add(this.textBoxFolder, 0, 0); this.tableLayoutPanelFolder.Controls.Add(this.tableLayoutPanelChangeFolder, 0, 1); + this.tableLayoutPanelFolder.Controls.Add(this.checkBoxUseIconFromRootFolder, 0, 2); this.tableLayoutPanelFolder.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanelFolder.Location = new System.Drawing.Point(3, 22); this.tableLayoutPanelFolder.Name = "tableLayoutPanelFolder"; - this.tableLayoutPanelFolder.RowCount = 2; + this.tableLayoutPanelFolder.RowCount = 3; this.tableLayoutPanelFolder.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanelFolder.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanelFolder.Size = new System.Drawing.Size(394, 53); + this.tableLayoutPanelFolder.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanelFolder.Size = new System.Drawing.Size(394, 78); this.tableLayoutPanelFolder.TabIndex = 0; // // textBoxFolder @@ -501,7 +504,7 @@ namespace SystemTrayMenu.UserInterface this.groupBoxUSB.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxUSB.Controls.Add(this.tableLayoutPanelUSB); this.groupBoxUSB.Dock = System.Windows.Forms.DockStyle.Fill; - this.groupBoxUSB.Location = new System.Drawing.Point(3, 90); + this.groupBoxUSB.Location = new System.Drawing.Point(3, 115); this.groupBoxUSB.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxUSB.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxUSB.Name = "groupBoxUSB"; @@ -589,7 +592,7 @@ namespace SystemTrayMenu.UserInterface this.groupBoxAutostart.AutoSize = true; this.groupBoxAutostart.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxAutostart.Controls.Add(this.tableLayoutPanelAutostart); - this.groupBoxAutostart.Location = new System.Drawing.Point(3, 180); + this.groupBoxAutostart.Location = new System.Drawing.Point(3, 205); this.groupBoxAutostart.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxAutostart.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxAutostart.Name = "groupBoxAutostart"; @@ -630,7 +633,7 @@ namespace SystemTrayMenu.UserInterface this.groupBoxHotkey.AutoSize = true; this.groupBoxHotkey.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxHotkey.Controls.Add(this.tableLayoutPanelHotkey); - this.groupBoxHotkey.Location = new System.Drawing.Point(3, 239); + this.groupBoxHotkey.Location = new System.Drawing.Point(3, 264); this.groupBoxHotkey.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxHotkey.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxHotkey.Name = "groupBoxHotkey"; @@ -683,7 +686,7 @@ namespace SystemTrayMenu.UserInterface this.groupBoxLanguage.AutoSize = true; this.groupBoxLanguage.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.groupBoxLanguage.Controls.Add(this.tableLayoutPanelLanguage); - this.groupBoxLanguage.Location = new System.Drawing.Point(3, 304); + this.groupBoxLanguage.Location = new System.Drawing.Point(3, 329); this.groupBoxLanguage.MaximumSize = new System.Drawing.Size(400, 0); this.groupBoxLanguage.MinimumSize = new System.Drawing.Size(400, 0); this.groupBoxLanguage.Name = "groupBoxLanguage"; @@ -3195,6 +3198,16 @@ namespace SystemTrayMenu.UserInterface this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // + // checkBoxUseIconFromRootFolder + // + this.checkBoxUseIconFromRootFolder.AutoSize = true; + this.checkBoxUseIconFromRootFolder.Location = new System.Drawing.Point(3, 56); + this.checkBoxUseIconFromRootFolder.Name = "checkBoxUseIconFromRootFolder"; + this.checkBoxUseIconFromRootFolder.Size = new System.Drawing.Size(205, 19); + this.checkBoxUseIconFromRootFolder.TabIndex = 1; + this.checkBoxUseIconFromRootFolder.Text = "checkBoxUseIconFromRootFolder"; + this.checkBoxUseIconFromRootFolder.UseVisualStyleBackColor = true; + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -3614,5 +3627,6 @@ namespace SystemTrayMenu.UserInterface private System.Windows.Forms.Label labelColorDarkModeSlider; private System.Windows.Forms.Button C; private System.Windows.Forms.Button buttonColorsDefaultDarkMode; + private System.Windows.Forms.CheckBox checkBoxUseIconFromRootFolder; } } \ No newline at end of file diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index ce165dd..3b6c236 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -101,6 +101,7 @@ namespace SystemTrayMenu.UserInterface tabPageCustomize.Text = Translator.GetText("Customize"); groupBoxFolder.Text = Translator.GetText("Folder"); buttonChangeFolder.Text = Translator.GetText("Change folder"); + checkBoxUseIconFromRootFolder.Text = Translator.GetText("Use icon from folder"); groupBoxUSB.Text = Translator.GetText("USB"); buttonChangeRelativeFolder.Text = Translator.GetText("Change to relative folder"); checkBoxStoreConfigAtAssemblyLocation.Text = Translator.GetText("Store config at the assembly location"); @@ -177,6 +178,8 @@ namespace SystemTrayMenu.UserInterface void InitializeFolder() { textBoxFolder.Text = Config.Path; + checkBoxUseIconFromRootFolder.Checked = + Settings.Default.UseIconFromRootFolder; } InitializeAutostart(); @@ -439,6 +442,9 @@ namespace SystemTrayMenu.UserInterface private void ButtonOk_Click(object sender, EventArgs e) { + Settings.Default.UseIconFromRootFolder = + checkBoxUseIconFromRootFolder.Checked; + SaveAutostart(); void SaveAutostart() {