Skip to content

Commit

Permalink
Add Icons, On-Screen Display with config items
Browse files Browse the repository at this point in the history
  • Loading branch information
infra223 committed Sep 25, 2020
1 parent 1b1d61a commit a2770b8
Show file tree
Hide file tree
Showing 17 changed files with 1,835 additions and 47 deletions.
27 changes: 27 additions & 0 deletions LogiLockLED/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@
<setting name="EnableKeyLockLEDs" serializeAs="String">
<value>True</value>
</setting>
<setting name="OsdFont" serializeAs="String">
<value>Arial, 48pt, style=Bold, Italic</value>
</setting>
<setting name="OsdPosition" serializeAs="String">
<value>Centre</value>
</setting>
<setting name="OsdPadding" serializeAs="String">
<value>8</value>
</setting>
<setting name="OsdMargin" serializeAs="String">
<value>8</value>
</setting>
<setting name="OsdRoundedCorners" serializeAs="String">
<value>True</value>
</setting>
<setting name="OsdEnabled" serializeAs="String">
<value>True</value>
</setting>
<setting name="OsdTextColour" serializeAs="String">
<value>White</value>
</setting>
<setting name="OsdBackColour" serializeAs="String">
<value>3, 3, 3</value>
</setting>
<setting name="OsdOpacity" serializeAs="String">
<value>75</value>
</setting>
</LogiLockLED.Properties.Settings>
</userSettings>
</configuration>
254 changes: 247 additions & 7 deletions LogiLockLED/ConfigurationForm.Designer.cs

Large diffs are not rendered by default.

41 changes: 40 additions & 1 deletion LogiLockLED/ConfigurationForm.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace LogiLockLED
{
public enum OSDPosition { Centre = 1, Top_Left, Top_Right, Bottom_Left, Bottom_Right }
public partial class ConfigurationForm : Form
{
private readonly LedSettings ledSettings;
public event EventHandler SettingsUpdated;



public ConfigurationForm(ref LedSettings settings)
{
InitializeComponent();
ledSettings = settings;
cbOSDPosition.DataSource = Enum.GetValues(typeof(OSDPosition));
cbOSDPosition.SelectedIndex = 0;

PopulateSettingsToUI();
}

Expand Down Expand Up @@ -44,6 +51,12 @@ private void SetSettingValue(object sender, Color color)
ledSettings.ScrollOffColour = color;
if (sender == btnScrollOnColour)
ledSettings.ScrollOnColour = color;

if (sender == btnOsdTxtColour)
ledSettings.OsdTextColour = color == Color.Black ? Color.FromArgb(3, 3, 3) : color;
if (sender == btnOsdBkColour)
ledSettings.OsdBackColour = color == Color.Black ? Color.FromArgb(3, 3, 3) : color;

}

private void PopulateSettingsToUI()
Expand All @@ -63,11 +76,28 @@ private void PopulateSettingsToUI()
btnScrollOnColour.BackColor = ledSettings.ScrollOnColour;

cbAutoStartApp.Checked = ledSettings.AutoStartApp;


cbOsdEnabled.Checked = ledSettings.OsdEnabled;
cbOSDPosition.SelectedItem = ledSettings.OsdPosition;
btnOsdFont.Text = ledSettings.OsdFont.SizeInPoints.ToString() + ", " + ledSettings.OsdFont.FontFamily.Name;
fontDialog.Font = ledSettings.OsdFont;
cbOsdPadding.Value = ledSettings.OsdPadding;
cbOsdMargin.Value = ledSettings.OsdMargin;
cbOsdRoundedCorners.Checked = ledSettings.OsdRoundedCorners;
btnOsdTxtColour.BackColor = ledSettings.OsdTextColour;
btnOsdBkColour.BackColor = ledSettings.OsdBackColour;
cbOsdOpacity.Value = ledSettings.OsdOpacity;
}

private void ApplySettings()
{
ledSettings.OsdEnabled = cbOsdEnabled.Checked;
ledSettings.OsdPosition = (OSDPosition)cbOSDPosition.SelectedItem;
ledSettings.OsdPadding = (int)cbOsdPadding.Value;
ledSettings.OsdMargin = (int)cbOsdMargin.Value;
ledSettings.OsdRoundedCorners = cbOsdRoundedCorners.Checked;
ledSettings.OsdOpacity = (int)cbOsdOpacity.Value;

ledSettings.SaveSettings();
SettingsUpdated?.Invoke(this, new EventArgs());
}
Expand Down Expand Up @@ -114,5 +144,14 @@ private void cbAutoStartApp_CheckedChanged(object sender, EventArgs e)
{
ledSettings.AutoStartApp = cbAutoStartApp.Checked;
}

private void btnFont_Click(object sender, EventArgs e)
{
if( fontDialog.ShowDialog(this) == DialogResult.OK)
{
ledSettings.OsdFont = fontDialog.Font;
btnOsdFont.Text = ledSettings.OsdFont.SizeInPoints.ToString() + ", " + ledSettings.OsdFont.FontFamily.Name;
}
}
}
}
Loading

0 comments on commit a2770b8

Please sign in to comment.