[Feature] Option to choose own icon (#176), version 1.0.17.63

This commit is contained in:
Markus Hofknecht 2021-06-06 14:46:48 +02:00
parent fa12339659
commit 17079c28e6
7 changed files with 67 additions and 55 deletions

View file

@ -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")]

View file

@ -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;
}
}
}
}

View file

@ -249,15 +249,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Colors Light Mode and Dark Mode.
/// </summary>
internal static string Colors_Light_Mode_and_Dark_Mode {
get {
return ResourceManager.GetString("Colors Light Mode and Dark Mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Couldnt register the hot key..
/// </summary>
@ -276,15 +267,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Dark Mode.
/// </summary>
internal static string Dark_Mode {
get {
return ResourceManager.GetString("Dark Mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Dark Mode always active.
/// </summary>
@ -303,24 +285,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Default Dark Mode.
/// </summary>
internal static string Default_Dark_Mode {
get {
return ResourceManager.GetString("Default Dark Mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Default Light Mode.
/// </summary>
internal static string Default_Light_Mode {
get {
return ResourceManager.GetString("Default Light Mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exit.
/// </summary>
@ -682,15 +646,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to To change a color paste a HTML Color Code or double click into a field..
/// </summary>
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);
}
}
/// <summary>
/// Looks up a localized string similar to USB.
/// </summary>
@ -700,6 +655,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Use icon from folder.
/// </summary>
internal static string Use_icon_from_folder {
get {
return ResourceManager.GetString("Use icon from folder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Warning.
/// </summary>

View file

@ -318,4 +318,7 @@
<data name="Slider while mouse hovers 2" xml:space="preserve">
<value>Slider while mouse hovers 2</value>
</data>
<data name="Use icon from folder" xml:space="preserve">
<value>Use icon from folder</value>
</data>
</root>

View file

@ -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();

View file

@ -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;
}
}

View file

@ -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()
{