move Nvidia dithering test to separate panel

This commit is contained in:
Vincent Maas committed 2023-03-04 19:35:39 +01:00
1 parent dbf5670bc3
commit 4b6d687e4c
10 files changed
+395 -325

No files matched your search

-150
View File
@@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.tcMain = new System.Windows.Forms.TabControl();
this.tabNVIDIA = new System.Windows.Forms.TabPage();
@@ -36,15 +35,6 @@
this.tabLG = new System.Windows.Forms.TabPage();
this.tabGameLauncher = new System.Windows.Forms.TabPage();
this.tabOptions = new System.Windows.Forms.TabPage();
this.grpNvidiaOptions = new System.Windows.Forms.GroupBox();
this.lblDitheringDisplay = new System.Windows.Forms.Label();
this.cbxDitheringDisplay = new System.Windows.Forms.ComboBox();
this.lblDitheringMode = new System.Windows.Forms.Label();
this.cbxDitheringMode = new System.Windows.Forms.ComboBox();
this.lblDitheringBitDepth = new System.Windows.Forms.Label();
this.cbxDitheringBitDepth = new System.Windows.Forms.ComboBox();
this.chkDitheringEnabled = new System.Windows.Forms.CheckBox();
this.pbGradient = new System.Windows.Forms.PictureBox();
this.grpMiscellaneousOptions = new System.Windows.Forms.GroupBox();
this.btnSetShortcutScreenSaver = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
@@ -94,8 +84,6 @@
this.btnUpdate = new System.Windows.Forms.Button();
this.tcMain.SuspendLayout();
this.tabOptions.SuspendLayout();
this.grpNvidiaOptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbGradient)).BeginInit();
this.grpMiscellaneousOptions.SuspendLayout();
this.grpLGOptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.edtLgOptionShutdownDelay)).BeginInit();
@@ -172,7 +160,6 @@
//
// tabOptions
//
this.tabOptions.Controls.Add(this.grpNvidiaOptions);
this.tabOptions.Controls.Add(this.grpMiscellaneousOptions);
this.tabOptions.Controls.Add(this.grpLGOptions);
this.tabOptions.Controls.Add(this.grpGeneralOptions);
@@ -185,120 +172,6 @@
this.tabOptions.Text = "Options";
this.tabOptions.UseVisualStyleBackColor = true;
//
// grpNvidiaOptions
//
this.grpNvidiaOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpNvidiaOptions.Controls.Add(this.lblDitheringDisplay);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringDisplay);
this.grpNvidiaOptions.Controls.Add(this.lblDitheringMode);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringMode);
this.grpNvidiaOptions.Controls.Add(this.lblDitheringBitDepth);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringBitDepth);
this.grpNvidiaOptions.Controls.Add(this.chkDitheringEnabled);
this.grpNvidiaOptions.Controls.Add(this.pbGradient);
this.grpNvidiaOptions.Location = new System.Drawing.Point(537, 7);
this.grpNvidiaOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.grpNvidiaOptions.Name = "grpNvidiaOptions";
this.grpNvidiaOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.grpNvidiaOptions.Size = new System.Drawing.Size(569, 365);
this.grpNvidiaOptions.TabIndex = 6;
this.grpNvidiaOptions.TabStop = false;
this.grpNvidiaOptions.Text = "NVIDIA options - test dithering";
//
// lblDitheringDisplay
//
this.lblDitheringDisplay.AutoSize = true;
this.lblDitheringDisplay.Location = new System.Drawing.Point(7, 23);
this.lblDitheringDisplay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringDisplay.Name = "lblDitheringDisplay";
this.lblDitheringDisplay.Size = new System.Drawing.Size(48, 15);
this.lblDitheringDisplay.TabIndex = 9;
this.lblDitheringDisplay.Text = "Display:";
//
// cbxDitheringDisplay
//
this.cbxDitheringDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringDisplay.FormattingEnabled = true;
this.cbxDitheringDisplay.Location = new System.Drawing.Point(75, 17);
this.cbxDitheringDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringDisplay.Name = "cbxDitheringDisplay";
this.cbxDitheringDisplay.Size = new System.Drawing.Size(212, 23);
this.cbxDitheringDisplay.TabIndex = 8;
this.cbxDitheringDisplay.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringDisplay_SelectedIndexChanged);
//
// lblDitheringMode
//
this.lblDitheringMode.AutoSize = true;
this.lblDitheringMode.Location = new System.Drawing.Point(7, 105);
this.lblDitheringMode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringMode.Name = "lblDitheringMode";
this.lblDitheringMode.Size = new System.Drawing.Size(41, 15);
this.lblDitheringMode.TabIndex = 7;
this.lblDitheringMode.Text = "Mode:";
//
// cbxDitheringMode
//
this.cbxDitheringMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringMode.FormattingEnabled = true;
this.cbxDitheringMode.Location = new System.Drawing.Point(75, 99);
this.cbxDitheringMode.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringMode.Name = "cbxDitheringMode";
this.cbxDitheringMode.Size = new System.Drawing.Size(136, 23);
this.cbxDitheringMode.TabIndex = 6;
this.cbxDitheringMode.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringMode_SelectedIndexChanged);
//
// lblDitheringBitDepth
//
this.lblDitheringBitDepth.AutoSize = true;
this.lblDitheringBitDepth.Location = new System.Drawing.Point(7, 74);
this.lblDitheringBitDepth.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringBitDepth.Name = "lblDitheringBitDepth";
this.lblDitheringBitDepth.Size = new System.Drawing.Size(60, 15);
this.lblDitheringBitDepth.TabIndex = 5;
this.lblDitheringBitDepth.Text = "Bit-depth:";
//
// cbxDitheringBitDepth
//
this.cbxDitheringBitDepth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringBitDepth.FormattingEnabled = true;
this.cbxDitheringBitDepth.Location = new System.Drawing.Point(75, 68);
this.cbxDitheringBitDepth.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringBitDepth.Name = "cbxDitheringBitDepth";
this.cbxDitheringBitDepth.Size = new System.Drawing.Size(136, 23);
this.cbxDitheringBitDepth.TabIndex = 4;
this.cbxDitheringBitDepth.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringBitDepth_SelectedIndexChanged);
//
// chkDitheringEnabled
//
this.chkDitheringEnabled.AutoSize = true;
this.chkDitheringEnabled.Checked = true;
this.chkDitheringEnabled.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkDitheringEnabled.Location = new System.Drawing.Point(7, 46);
this.chkDitheringEnabled.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.chkDitheringEnabled.Name = "chkDitheringEnabled";
this.chkDitheringEnabled.Size = new System.Drawing.Size(120, 19);
this.chkDitheringEnabled.TabIndex = 3;
this.chkDitheringEnabled.Text = "Dithering enabled";
this.chkDitheringEnabled.ThreeState = true;
this.chkDitheringEnabled.UseVisualStyleBackColor = true;
this.chkDitheringEnabled.CheckStateChanged += new System.EventHandler(this.chkDitheringEnabled_CheckStateChanged);
//
// pbGradient
//
this.pbGradient.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pbGradient.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbGradient.Location = new System.Drawing.Point(7, 128);
this.pbGradient.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.pbGradient.Name = "pbGradient";
this.pbGradient.Size = new System.Drawing.Size(555, 228);
this.pbGradient.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbGradient.TabIndex = 0;
this.pbGradient.TabStop = false;
//
// grpMiscellaneousOptions
//
this.grpMiscellaneousOptions.Controls.Add(this.btnSetShortcutScreenSaver);
@@ -921,9 +794,6 @@
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.tcMain.ResumeLayout(false);
this.tabOptions.ResumeLayout(false);
this.grpNvidiaOptions.ResumeLayout(false);
this.grpNvidiaOptions.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbGradient)).EndInit();
this.grpMiscellaneousOptions.ResumeLayout(false);
this.grpMiscellaneousOptions.PerformLayout();
this.grpLGOptions.ResumeLayout(false);
@@ -960,7 +830,6 @@
private System.Windows.Forms.GroupBox grpNVIDIAInfo;
private System.Windows.Forms.TreeView tvNVIDIAInfo;
private System.Windows.Forms.Button btnRefreshNVIDIAInfo;
private System.Windows.Forms.ContextMenuStrip mnuLgButtons;
private System.Windows.Forms.GroupBox grpLGOptions;
private System.Windows.Forms.NumericUpDown edtLgMaxPowerOnRetries;
private System.Windows.Forms.Label lblLgMaxPowerOnRetries;
@@ -976,23 +845,7 @@
private System.Windows.Forms.TabPage tabNVIDIA;
private System.Windows.Forms.TabPage tabAMD;
private System.Windows.Forms.Button btnClearLog;
private System.Windows.Forms.GroupBox grpNvidiaOptions;
private System.Windows.Forms.PictureBox pbGradient;
private System.Windows.Forms.Label lblDitheringMode;
private System.Windows.Forms.ComboBox cbxDitheringMode;
private System.Windows.Forms.Label lblDitheringBitDepth;
private System.Windows.Forms.ComboBox cbxDitheringBitDepth;
private System.Windows.Forms.CheckBox chkDitheringEnabled;
private System.Windows.Forms.ToolStripMenuItem mnuLgRcButtons;
private System.Windows.Forms.ToolStripMenuItem mnuLgActions;
private System.Windows.Forms.CheckBox chkMinimizeToSystemTray;
private System.Windows.Forms.ContextMenuStrip mnuLgExpert;
private System.Windows.Forms.ToolStripMenuItem mnuLgOLEDMotionPro;
private System.Windows.Forms.ToolStripMenuItem miLgEnableMotionPro;
private System.Windows.Forms.ToolStripMenuItem miLgDisableMotionPro;
private System.Windows.Forms.ToolStripSeparator miLgExpertSeparator1;
private System.Windows.Forms.ToolStripMenuItem mnuLgNvPresets;
private System.Windows.Forms.ToolStripMenuItem mnuLgAmdPresets;
private System.Windows.Forms.CheckBox chkCheckForUpdates;
private System.Windows.Forms.CheckBox chkLgShowAdvancedActions;
private System.Windows.Forms.CheckBox chkGdiScaling;
@@ -1001,7 +854,6 @@
private System.Windows.Forms.Label lblLgOptionShutdownDelay;
private System.Windows.Forms.Label lblGameBarShortcut;
private System.Windows.Forms.TextBox edtLgGameBarShortcut;
private System.Windows.Forms.ToolStripMenuItem mnuLgProgram;
private System.Windows.Forms.TabPage tabGameLauncher;
private System.Windows.Forms.RadioButton rbElevationService;
private System.Windows.Forms.RadioButton rbElevationProcess;
@@ -1015,8 +867,6 @@
private System.Windows.Forms.CheckBox chkAutoInstallUpdates;
private System.Windows.Forms.CheckBox chkLgSetSelectedDeviceByPowerOn;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.Label lblDitheringDisplay;
private System.Windows.Forms.ComboBox cbxDitheringDisplay;
}
}
+17 -129
View File
@@ -29,11 +29,6 @@ namespace ColorControl
private static bool EndSession = false;
private static bool UserExit = false;
private static int SHORTCUTID_SCREENSAVER = -100;
private static int SHORTCUTID_GAMEBAR = -101;
private static int SHORTCUTID_NVQA = -200;
private static int SHORTCUTID_AMDQA = -201;
private static int SHORTCUTID_LGQA = -202;
private static int SHORTCUTID_GAMEQA = -203;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -41,10 +36,10 @@ namespace ColorControl
private NvService _nvService;
private NvPanel _nvPanel;
private NvDitherPanel _nvDitherPanel;
private NotifyIcon _trayIcon;
private bool _initialized = false;
private bool _disableEvents = false;
private Config _config;
private bool _setVisibleCalled = false;
@@ -65,11 +60,8 @@ namespace ColorControl
private FileVersionInfo _currentVersionInfo;
private bool _checkedForUpdates = false;
private string _updateHtmlUrl;
private bool _updatingDitherSettings;
private string _downloadUrl;
private LgGameBar _gameBarForm;
private GameService _gameService;
private GamePanel _gamePanel;
@@ -195,7 +187,7 @@ namespace ColorControl
tabNVIDIA.Controls.Add(_nvPanel);
InitShortcut(SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, _nvService.ToggleQuickAccessForm);
InitShortcut(NvPanel.SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, _nvService.ToggleQuickAccessForm);
}
catch (Exception ex)
{
@@ -217,7 +209,7 @@ namespace ColorControl
tabAMD.Controls.Add(_amdPanel);
InitShortcut(SHORTCUTID_AMDQA, _config.AmdQuickAccessShortcut, _amdService.ToggleQuickAccessForm);
InitShortcut(AmdPanel.SHORTCUTID_AMDQA, _config.AmdQuickAccessShortcut, _amdService.ToggleQuickAccessForm);
}
catch (Exception)
{
@@ -239,7 +231,7 @@ namespace ColorControl
tabGameLauncher.Controls.Add(_gamePanel);
InitShortcut(SHORTCUTID_GAMEQA, _config.GameQuickAccessShortcut, _gameService.ToggleQuickAccessForm);
InitShortcut(GamePanel.SHORTCUTID_GAMEQA, _config.GameQuickAccessShortcut, _gameService.ToggleQuickAccessForm);
}
catch (Exception e)
{
@@ -271,14 +263,16 @@ namespace ColorControl
tabLG.Controls.Add(_lgPanel);
_lgPanel.Init();
edtLgMaxPowerOnRetries.Value = _lgService.Config.PowerOnRetries;
edtLgOptionShutdownDelay.Value = _lgService.Config.ShutdownDelay;
chkLgShowAdvancedActions.Checked = _lgService.Config.ShowAdvancedActions;
chkLgSetSelectedDeviceByPowerOn.Checked = _lgService.Config.SetSelectedDeviceByPowerOn;
LgDevice.ExternalServiceHandler = HandleExternalServiceForLgDevice;
InitShortcut(SHORTCUTID_GAMEBAR, _lgService.Config.GameBarShortcut, _lgPanel.ToggleGameBar);
InitShortcut(SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, _lgService.ToggleQuickAccessForm);
InitShortcut(LgPanel.SHORTCUTID_GAMEBAR, _lgService.Config.GameBarShortcut, _lgPanel.ToggleGameBar);
InitShortcut(LgPanel.SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, _lgService.ToggleQuickAccessForm);
if (!string.IsNullOrEmpty(_lgService.Config.GameBarShortcut))
{
@@ -768,29 +762,17 @@ NOTE: installing the service may cause a User Account Control popup.");
private void InitOptionsTab()
{
grpNvidiaOptions.Visible = _nvService != null;
if (grpNvidiaOptions.Visible)
if (_nvService != null && _nvDitherPanel == null)
{
if (cbxDitheringBitDepth.Items.Count == 0)
{
cbxDitheringBitDepth.Items.AddRange(Utils.GetDescriptions<NvDitherBits>().ToArray());
cbxDitheringMode.Items.AddRange(Utils.GetDescriptions<NvDitherMode>().ToArray());
FillGradient();
}
_nvDitherPanel = new NvDitherPanel(_nvService);
if (cbxDitheringDisplay.Items.Count == 0)
{
var displays = _nvService.GetDisplayInfos();
var primaryDisplay = _nvService.GetPrimaryDisplay();
var primaryDisplayInfo = displays.FirstOrDefault(d => d.Display == primaryDisplay);
var index = primaryDisplayInfo != null ? displays.IndexOf(primaryDisplayInfo) : 0;
tabOptions.Controls.Add(_nvDitherPanel);
cbxDitheringDisplay.Items.AddRange(displays.ToArray());
_nvDitherPanel.Top = grpGeneralOptions.Top;
_nvDitherPanel.Left = grpGeneralOptions.Left + grpGeneralOptions.Width + 4;
_nvDitherPanel.Width = tabOptions.Width - _nvDitherPanel.Left - 4;
cbxDitheringDisplay.SelectedIndex = index;
}
UpdateDitherSettings();
_nvDitherPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
}
_initialized = false;
@@ -813,35 +795,6 @@ NOTE: installing the service may cause a User Account Control popup.");
UpdateServiceInfo();
}
private void UpdateDitherSettings()
{
var display = ((NvDisplayInfo)cbxDitheringDisplay.SelectedItem)?.Display;
var ditherInfo = _nvService.GetDithering(display);
if (ditherInfo.state == -1)
{
MessageForms.ErrorOk("Error retrieving dithering settings. See log for details.");
return;
}
var state = (NvDitherState)ditherInfo.state;
_updatingDitherSettings = true;
try
{
chkDitheringEnabled.CheckState = state switch { NvDitherState.Enabled => CheckState.Checked, NvDitherState.Disabled => CheckState.Unchecked, _ => CheckState.Indeterminate };
cbxDitheringBitDepth.SelectedIndex = ditherInfo.bits;
cbxDitheringMode.SelectedIndex = ditherInfo.mode;
cbxDitheringBitDepth.Enabled = state == NvDitherState.Enabled;
cbxDitheringMode.Enabled = state == NvDitherState.Enabled;
}
finally
{
_updatingDitherSettings = false;
}
}
private void UpdateTrayMenu(ToolStripMenuItem menu, IEnumerable<PresetBase> presets, EventHandler eventHandler)
{
menu.DropDownItems.Clear();
@@ -1083,42 +1036,6 @@ Do you want to continue?";
edtLog.Clear();
}
private void FillGradient()
{
if (pbGradient.Image == null)
{
pbGradient.Image = Utils.GenerateGradientBitmap(pbGradient.Width, pbGradient.Height);
}
}
private void ApplyDitheringOptions()
{
if (_updatingDitherSettings)
{
return;
}
var state = chkDitheringEnabled.CheckState switch { CheckState.Checked => NvDitherState.Enabled, CheckState.Unchecked => NvDitherState.Disabled, _ => NvDitherState.Auto };
var bitDepth = cbxDitheringBitDepth.SelectedIndex;
var mode = cbxDitheringMode.SelectedIndex;
var display = ((NvDisplayInfo)cbxDitheringDisplay.SelectedItem)?.Display;
if (_nvService.SetDithering(state, (uint)bitDepth, (uint)(mode > -1 ? mode : (int)NvDitherMode.Temporal), currentDisplay: display) && state == NvDitherState.Auto)
{
UpdateDitherSettings();
}
}
private void cbxDitheringBitDepth_SelectedIndexChanged(object sender, EventArgs e)
{
ApplyDitheringOptions();
}
private void cbxDitheringMode_SelectedIndexChanged(object sender, EventArgs e)
{
ApplyDitheringOptions();
}
private void AfterInitialized()
{
_nvPanel?.AfterInitialized();
@@ -1305,25 +1222,6 @@ The InStart and Software Update items are now visible under the Expert-button."
ResumeLayout(true);
}
private void chkDitheringEnabled_CheckStateChanged(object sender, EventArgs e)
{
cbxDitheringBitDepth.Enabled = chkDitheringEnabled.CheckState == CheckState.Checked;
cbxDitheringMode.Enabled = chkDitheringEnabled.CheckState == CheckState.Checked;
ApplyDitheringOptions();
}
private void btnLgDeviceOptionsHelp_Click(object sender, EventArgs e)
{
MessageForms.InfoOk(
@"Notes:
- power on after startup requires ""Automatically start after login"" - see Options
- power on after resume from standby may need some retries for waking TV - see Options
- power off on shutdown: because this app cannot detect a restart, restarting could also trigger this. Hold down Ctrl on restart to prevent power off.
- Use Windows power settings: powering on/off of TV will follow Windows settings. If activated, it's better to disable all other power options except power off on shutdown.
");
}
private void edtLgOptionShutdownDelay_ValueChanged(object sender, EventArgs e)
{
_lgService.Config.ShutdownDelay = (int)edtLgOptionShutdownDelay.Value;
@@ -1507,16 +1405,6 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad
_trayIcon.Visible = false;
}
private void cbxDitheringDisplay_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_initialized)
{
return;
}
UpdateDitherSettings();
}
private void edtLgPowerOnAfterResumeDelay_ValueChanged(object sender, EventArgs e)
{
_lgService.Config.PowerOnRetries = (int)edtLgMaxPowerOnRetries.Value;
@@ -1571,11 +1459,11 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad
if (string.IsNullOrEmpty(text))
{
WinApi.UnregisterHotKey(Handle, SHORTCUTID_GAMEBAR);
WinApi.UnregisterHotKey(Handle, LgPanel.SHORTCUTID_GAMEBAR);
}
else
{
Utils.RegisterShortcut(Handle, SHORTCUTID_GAMEBAR, text);
Utils.RegisterShortcut(Handle, LgPanel.SHORTCUTID_GAMEBAR, text);
}
}
}
-6
View File
@@ -57,12 +57,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mnuLgExpert.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>583, 17</value>
</metadata>
<metadata name="mnuLgButtons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>147, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
+1 -1
View File
@@ -15,7 +15,7 @@ namespace ColorControl.Services.AMD
{
public partial class AmdPanel : UserControl
{
private static int SHORTCUTID_AMDQA = -201;
public static readonly int SHORTCUTID_AMDQA = -201;
private AmdService _amdService;
private NotifyIcon _trayIcon;
@@ -19,7 +19,7 @@ namespace ColorControl.Services.GameLauncher
{
public partial class GamePanel : UserControl
{
private static int SHORTCUTID_GAMEQA = -203;
public static readonly int SHORTCUTID_GAMEQA = -203;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
+3 -37
View File
@@ -19,8 +19,8 @@ namespace ColorControl.Services.LG
{
public partial class LgPanel : UserControl
{
private static int SHORTCUTID_LGQA = -202;
private static int SHORTCUTID_GAMEBAR = -101;
public static readonly int SHORTCUTID_LGQA = -202;
public static readonly int SHORTCUTID_GAMEBAR = -101;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -69,11 +69,9 @@ namespace ColorControl.Services.LG
var item = mnuLgRcButtons.DropDownItems.Add(text);
item.Click += miLgAddButton_Click;
}
Load += LgPanel_Load;
}
private void LgPanel_Load(object sender, EventArgs e)
public void Init()
{
_lgService.RefreshDevices(afterStartUp: true).ContinueWith((_) => BeginInvoke(() => AfterLgServiceRefreshDevices()));
@@ -1163,37 +1161,5 @@ Do you want to continue?"
{
FormUtils.ListViewItemChecked<LgPreset>(lvLgPresets, e);
}
private void lvNvPresets_ItemCheck(object sender, ItemCheckEventArgs e)
{
var listView = sender as System.Windows.Forms.ListView;
if (!listView.Focused)
{
return;
}
var point = listView.PointToClient(Cursor.Position);
if (point.X >= 20)
{
return;
}
var listItem = listView.Items[e.Index];
if (listItem.Tag == null)
{
MessageForms.WarningOk("Quick Access cannot be enabled for this item.");
e.NewValue = e.CurrentValue;
}
if (e.NewValue == CheckState.Checked && string.IsNullOrEmpty(listItem.Text))
{
MessageForms.WarningOk("A name must be entered before enabling Quick Access.");
e.NewValue = e.CurrentValue;
}
}
}
}
+184
View File
@@ -0,0 +1,184 @@
namespace ColorControl.Services.NVIDIA
{
partial class NvDitherPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpNvidiaOptions = new System.Windows.Forms.GroupBox();
this.lblDitheringDisplay = new System.Windows.Forms.Label();
this.cbxDitheringDisplay = new System.Windows.Forms.ComboBox();
this.lblDitheringMode = new System.Windows.Forms.Label();
this.cbxDitheringMode = new System.Windows.Forms.ComboBox();
this.lblDitheringBitDepth = new System.Windows.Forms.Label();
this.cbxDitheringBitDepth = new System.Windows.Forms.ComboBox();
this.chkDitheringEnabled = new System.Windows.Forms.CheckBox();
this.pbGradient = new System.Windows.Forms.PictureBox();
this.grpNvidiaOptions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbGradient)).BeginInit();
this.SuspendLayout();
//
// grpNvidiaOptions
//
this.grpNvidiaOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpNvidiaOptions.Controls.Add(this.lblDitheringDisplay);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringDisplay);
this.grpNvidiaOptions.Controls.Add(this.lblDitheringMode);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringMode);
this.grpNvidiaOptions.Controls.Add(this.lblDitheringBitDepth);
this.grpNvidiaOptions.Controls.Add(this.cbxDitheringBitDepth);
this.grpNvidiaOptions.Controls.Add(this.chkDitheringEnabled);
this.grpNvidiaOptions.Controls.Add(this.pbGradient);
this.grpNvidiaOptions.Location = new System.Drawing.Point(4, 3);
this.grpNvidiaOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.grpNvidiaOptions.Name = "grpNvidiaOptions";
this.grpNvidiaOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.grpNvidiaOptions.Size = new System.Drawing.Size(856, 479);
this.grpNvidiaOptions.TabIndex = 6;
this.grpNvidiaOptions.TabStop = false;
this.grpNvidiaOptions.Text = "NVIDIA options - test dithering";
//
// lblDitheringDisplay
//
this.lblDitheringDisplay.AutoSize = true;
this.lblDitheringDisplay.Location = new System.Drawing.Point(8, 23);
this.lblDitheringDisplay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringDisplay.Name = "lblDitheringDisplay";
this.lblDitheringDisplay.Size = new System.Drawing.Size(48, 15);
this.lblDitheringDisplay.TabIndex = 9;
this.lblDitheringDisplay.Text = "Display:";
//
// cbxDitheringDisplay
//
this.cbxDitheringDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringDisplay.FormattingEnabled = true;
this.cbxDitheringDisplay.Location = new System.Drawing.Point(75, 17);
this.cbxDitheringDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringDisplay.Name = "cbxDitheringDisplay";
this.cbxDitheringDisplay.Size = new System.Drawing.Size(212, 23);
this.cbxDitheringDisplay.TabIndex = 8;
this.cbxDitheringDisplay.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringDisplay_SelectedIndexChanged);
//
// lblDitheringMode
//
this.lblDitheringMode.AutoSize = true;
this.lblDitheringMode.Location = new System.Drawing.Point(8, 105);
this.lblDitheringMode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringMode.Name = "lblDitheringMode";
this.lblDitheringMode.Size = new System.Drawing.Size(41, 15);
this.lblDitheringMode.TabIndex = 7;
this.lblDitheringMode.Text = "Mode:";
//
// cbxDitheringMode
//
this.cbxDitheringMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringMode.FormattingEnabled = true;
this.cbxDitheringMode.Location = new System.Drawing.Point(75, 99);
this.cbxDitheringMode.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringMode.Name = "cbxDitheringMode";
this.cbxDitheringMode.Size = new System.Drawing.Size(136, 23);
this.cbxDitheringMode.TabIndex = 6;
this.cbxDitheringMode.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringMode_SelectedIndexChanged);
//
// lblDitheringBitDepth
//
this.lblDitheringBitDepth.AutoSize = true;
this.lblDitheringBitDepth.Location = new System.Drawing.Point(8, 74);
this.lblDitheringBitDepth.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDitheringBitDepth.Name = "lblDitheringBitDepth";
this.lblDitheringBitDepth.Size = new System.Drawing.Size(60, 15);
this.lblDitheringBitDepth.TabIndex = 5;
this.lblDitheringBitDepth.Text = "Bit-depth:";
//
// cbxDitheringBitDepth
//
this.cbxDitheringBitDepth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxDitheringBitDepth.FormattingEnabled = true;
this.cbxDitheringBitDepth.Location = new System.Drawing.Point(75, 68);
this.cbxDitheringBitDepth.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbxDitheringBitDepth.Name = "cbxDitheringBitDepth";
this.cbxDitheringBitDepth.Size = new System.Drawing.Size(136, 23);
this.cbxDitheringBitDepth.TabIndex = 4;
this.cbxDitheringBitDepth.SelectedIndexChanged += new System.EventHandler(this.cbxDitheringBitDepth_SelectedIndexChanged);
//
// chkDitheringEnabled
//
this.chkDitheringEnabled.AutoSize = true;
this.chkDitheringEnabled.Checked = true;
this.chkDitheringEnabled.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkDitheringEnabled.Location = new System.Drawing.Point(8, 46);
this.chkDitheringEnabled.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.chkDitheringEnabled.Name = "chkDitheringEnabled";
this.chkDitheringEnabled.Size = new System.Drawing.Size(120, 19);
this.chkDitheringEnabled.TabIndex = 3;
this.chkDitheringEnabled.Text = "Dithering enabled";
this.chkDitheringEnabled.ThreeState = true;
this.chkDitheringEnabled.UseVisualStyleBackColor = true;
this.chkDitheringEnabled.CheckStateChanged += new System.EventHandler(this.chkDitheringEnabled_CheckStateChanged);
//
// pbGradient
//
this.pbGradient.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pbGradient.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbGradient.Location = new System.Drawing.Point(8, 128);
this.pbGradient.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.pbGradient.Name = "pbGradient";
this.pbGradient.Size = new System.Drawing.Size(840, 345);
this.pbGradient.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbGradient.TabIndex = 0;
this.pbGradient.TabStop = false;
//
// NvDitherPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpNvidiaOptions);
this.Name = "NvDitherPanel";
this.Size = new System.Drawing.Size(864, 485);
this.grpNvidiaOptions.ResumeLayout(false);
this.grpNvidiaOptions.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbGradient)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpNvidiaOptions;
private System.Windows.Forms.PictureBox pbGradient;
private System.Windows.Forms.Label lblDitheringMode;
private System.Windows.Forms.ComboBox cbxDitheringMode;
private System.Windows.Forms.Label lblDitheringBitDepth;
private System.Windows.Forms.ComboBox cbxDitheringBitDepth;
private System.Windows.Forms.CheckBox chkDitheringEnabled;
private System.Windows.Forms.Label lblDitheringDisplay;
private System.Windows.Forms.ComboBox cbxDitheringDisplay;
}
}
@@ -0,0 +1,128 @@
using ColorControl.Common;
using ColorControl.Forms;
using System;
using System.Linq;
using System.Windows.Forms;
namespace ColorControl.Services.NVIDIA
{
public partial class NvDitherPanel : UserControl
{
private NvService _nvService;
private bool _updatingDitherSettings;
private bool _initialized;
internal NvDitherPanel(NvService nvService)
{
_nvService = nvService;
InitializeComponent();
if (cbxDitheringBitDepth.Items.Count == 0)
{
cbxDitheringBitDepth.Items.AddRange(Utils.GetDescriptions<NvDitherBits>().ToArray());
cbxDitheringMode.Items.AddRange(Utils.GetDescriptions<NvDitherMode>().ToArray());
FillGradient();
}
if (cbxDitheringDisplay.Items.Count == 0)
{
var displays = _nvService.GetDisplayInfos();
var primaryDisplay = _nvService.GetPrimaryDisplay();
var primaryDisplayInfo = displays.FirstOrDefault(d => d.Display == primaryDisplay);
var index = primaryDisplayInfo != null ? displays.IndexOf(primaryDisplayInfo) : 0;
cbxDitheringDisplay.Items.AddRange(displays.ToArray());
cbxDitheringDisplay.SelectedIndex = index;
}
UpdateDitherSettings();
_initialized = true;
}
private void UpdateDitherSettings()
{
var display = ((NvDisplayInfo)cbxDitheringDisplay.SelectedItem)?.Display;
var ditherInfo = _nvService.GetDithering(display);
if (ditherInfo.state == -1)
{
MessageForms.ErrorOk("Error retrieving dithering settings. See log for details.");
return;
}
var state = (NvDitherState)ditherInfo.state;
_updatingDitherSettings = true;
try
{
chkDitheringEnabled.CheckState = state switch { NvDitherState.Enabled => CheckState.Checked, NvDitherState.Disabled => CheckState.Unchecked, _ => CheckState.Indeterminate };
cbxDitheringBitDepth.SelectedIndex = ditherInfo.bits;
cbxDitheringMode.SelectedIndex = ditherInfo.mode;
cbxDitheringBitDepth.Enabled = state == NvDitherState.Enabled;
cbxDitheringMode.Enabled = state == NvDitherState.Enabled;
}
finally
{
_updatingDitherSettings = false;
}
}
private void FillGradient()
{
if (pbGradient.Image == null)
{
pbGradient.Image = Utils.GenerateGradientBitmap(pbGradient.Width, pbGradient.Height);
}
}
private void ApplyDitheringOptions()
{
if (_updatingDitherSettings)
{
return;
}
var state = chkDitheringEnabled.CheckState switch { CheckState.Checked => NvDitherState.Enabled, CheckState.Unchecked => NvDitherState.Disabled, _ => NvDitherState.Auto };
var bitDepth = cbxDitheringBitDepth.SelectedIndex;
var mode = cbxDitheringMode.SelectedIndex;
var display = ((NvDisplayInfo)cbxDitheringDisplay.SelectedItem)?.Display;
if (_nvService.SetDithering(state, (uint)bitDepth, (uint)(mode > -1 ? mode : (int)NvDitherMode.Temporal), currentDisplay: display) && state == NvDitherState.Auto)
{
UpdateDitherSettings();
}
}
private void cbxDitheringBitDepth_SelectedIndexChanged(object sender, EventArgs e)
{
ApplyDitheringOptions();
}
private void cbxDitheringMode_SelectedIndexChanged(object sender, EventArgs e)
{
ApplyDitheringOptions();
}
private void chkDitheringEnabled_CheckStateChanged(object sender, EventArgs e)
{
cbxDitheringBitDepth.Enabled = chkDitheringEnabled.CheckState == CheckState.Checked;
cbxDitheringMode.Enabled = chkDitheringEnabled.CheckState == CheckState.Checked;
ApplyDitheringOptions();
}
private void cbxDitheringDisplay_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_initialized)
{
return;
}
UpdateDitherSettings();
}
}
}
@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+1 -1
View File
@@ -22,7 +22,7 @@ namespace ColorControl.Services.NVIDIA
{
partial class NvPanel : UserControl
{
private static int SHORTCUTID_NVQA = -200;
public static readonly int SHORTCUTID_NVQA = -200;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();