mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Color Temp Controls
This commit is contained in:
@@ -39,7 +39,7 @@ namespace GHelper.Display
|
||||
|
||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(100);
|
||||
|
||||
|
||||
public const int DefaultColorTemp = 50;
|
||||
static VisualControl()
|
||||
{
|
||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||
@@ -98,6 +98,20 @@ namespace GHelper.Display
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<int, string> GetTemperatures()
|
||||
{
|
||||
return new Dictionary<int, string>
|
||||
{
|
||||
{ 0, "Warmest"},
|
||||
{ 15, "Warmer"},
|
||||
{ 30, "Warm"},
|
||||
{ 50, "Neutral"},
|
||||
{ 70, "Cold"},
|
||||
{ 85, "Colder"},
|
||||
{ 100, "Coldest"},
|
||||
};
|
||||
}
|
||||
|
||||
public static void SetGamut(int mode = 50)
|
||||
{
|
||||
if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return;
|
||||
@@ -110,11 +124,13 @@ namespace GHelper.Display
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = 50, bool init = false)
|
||||
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
|
||||
{
|
||||
if (mode == SplendidCommand.None) return;
|
||||
if (mode == SplendidCommand.Default && init) return; // Skip default setting on init
|
||||
|
||||
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
||||
|
||||
int balance = mode == SplendidCommand.Eyecare ? 2 : whiteBalance;
|
||||
if (RunSplendid(mode, 0, balance)) return;
|
||||
|
||||
|
||||
21
app/Settings.Designer.cs
generated
21
app/Settings.Designer.cs
generated
@@ -131,6 +131,7 @@ namespace GHelper
|
||||
labelGamma = new Label();
|
||||
pictureGamma = new PictureBox();
|
||||
labelGammaTitle = new Label();
|
||||
comboColorTemp = new RComboBox();
|
||||
panelMatrix.SuspendLayout();
|
||||
panelMatrixAuto.SuspendLayout();
|
||||
tableLayoutMatrix.SuspendLayout();
|
||||
@@ -1694,6 +1695,7 @@ namespace GHelper
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
tableVisual.Controls.Add(comboColorTemp, 0, 0);
|
||||
tableVisual.Controls.Add(comboVisual, 0, 0);
|
||||
tableVisual.Controls.Add(comboGamut, 0, 0);
|
||||
tableVisual.Dock = DockStyle.Top;
|
||||
@@ -1715,7 +1717,6 @@ namespace GHelper
|
||||
comboVisual.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboVisual.FormattingEnabled = true;
|
||||
comboVisual.ItemHeight = 32;
|
||||
comboVisual.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboVisual.Location = new Point(266, 11);
|
||||
comboVisual.Margin = new Padding(4, 11, 4, 8);
|
||||
comboVisual.Name = "comboVisual";
|
||||
@@ -1732,7 +1733,6 @@ namespace GHelper
|
||||
comboGamut.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboGamut.FormattingEnabled = true;
|
||||
comboGamut.ItemHeight = 32;
|
||||
comboGamut.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
|
||||
comboGamut.Location = new Point(4, 11);
|
||||
comboGamut.Margin = new Padding(4, 11, 4, 8);
|
||||
comboGamut.Name = "comboGamut";
|
||||
@@ -1800,6 +1800,22 @@ namespace GHelper
|
||||
labelGammaTitle.TabIndex = 37;
|
||||
labelGammaTitle.Text = "Flicker-free Dimming";
|
||||
//
|
||||
// comboColorTemp
|
||||
//
|
||||
comboColorTemp.BorderColor = Color.White;
|
||||
comboColorTemp.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboColorTemp.Dock = DockStyle.Top;
|
||||
comboColorTemp.FlatStyle = FlatStyle.Flat;
|
||||
comboColorTemp.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
comboColorTemp.FormattingEnabled = true;
|
||||
comboColorTemp.ItemHeight = 32;
|
||||
comboColorTemp.Location = new Point(528, 11);
|
||||
comboColorTemp.Margin = new Padding(4, 11, 4, 8);
|
||||
comboColorTemp.Name = "comboColorTemp";
|
||||
comboColorTemp.Size = new Size(255, 40);
|
||||
comboColorTemp.TabIndex = 15;
|
||||
comboColorTemp.Visible = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||
@@ -1996,5 +2012,6 @@ namespace GHelper
|
||||
private TableLayoutPanel tableVisual;
|
||||
private RComboBox comboVisual;
|
||||
private RComboBox comboGamut;
|
||||
private RComboBox comboColorTemp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +286,7 @@ namespace GHelper
|
||||
tableVisual.Visible = true;
|
||||
|
||||
var visualValue = (SplendidCommand)AppConfig.Get("visual", (int)SplendidCommand.Default);
|
||||
var colorTempValue = AppConfig.Get("color_temp", VisualControl.DefaultColorTemp);
|
||||
|
||||
comboVisual.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboVisual.DataSource = new BindingSource(VisualControl.GetVisualModes(), null);
|
||||
@@ -293,11 +294,20 @@ namespace GHelper
|
||||
comboVisual.ValueMember = "Key";
|
||||
comboVisual.SelectedValue = visualValue;
|
||||
|
||||
VisualControl.SetVisual(mode : visualValue, init : true);
|
||||
comboColorTemp.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboColorTemp.DataSource = new BindingSource(VisualControl.GetTemperatures(), null);
|
||||
comboColorTemp.DisplayMember = "Value";
|
||||
comboColorTemp.ValueMember = "Key";
|
||||
comboColorTemp.SelectedValue = colorTempValue;
|
||||
|
||||
VisualControl.SetVisual(visualValue, colorTempValue, true);
|
||||
|
||||
comboVisual.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
||||
comboVisual.Visible = true;
|
||||
|
||||
comboColorTemp.SelectedValueChanged += ComboVisual_SelectedValueChanged;
|
||||
comboColorTemp.Visible = true;
|
||||
|
||||
if (gamuts.Count <= 1) return;
|
||||
|
||||
comboGamut.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
@@ -320,7 +330,8 @@ namespace GHelper
|
||||
private void ComboVisual_SelectedValueChanged(object? sender, EventArgs e)
|
||||
{
|
||||
AppConfig.Set("visual", (int)comboVisual.SelectedValue);
|
||||
VisualControl.SetVisual((SplendidCommand)comboVisual.SelectedValue);
|
||||
AppConfig.Set("color_temp", (int)comboColorTemp.SelectedValue);
|
||||
VisualControl.SetVisual((SplendidCommand)comboVisual.SelectedValue, (int)comboColorTemp.SelectedValue);
|
||||
}
|
||||
|
||||
public void VisualiseBrightness()
|
||||
|
||||
Reference in New Issue
Block a user