diff --git a/ColorControl/ColorControl.csproj b/ColorControl/ColorControl.csproj
index 986d732..a5aa52e 100644
--- a/ColorControl/ColorControl.csproj
+++ b/ColorControl/ColorControl.csproj
@@ -60,6 +60,9 @@
UserControl
+
+ UserControl
+
diff --git a/ColorControl/Forms/FormUtils.cs b/ColorControl/Forms/FormUtils.cs
index 91b3113..1e80bae 100644
--- a/ColorControl/Forms/FormUtils.cs
+++ b/ColorControl/Forms/FormUtils.cs
@@ -3,6 +3,7 @@ using ColorControl.Services.Common;
using NStandard;
using NWin32;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@@ -520,6 +521,33 @@ namespace ColorControl.Forms
eventHandlerList.Dispose();
}
+ public static void ListViewItemChecked(ListView listView, ItemCheckedEventArgs e) where T : PresetBase
+ {
+ var checkedPreset = (T)e.Item.Tag;
+
+ if (checkedPreset == null || checkedPreset.ShowInQuickAccess == e.Item.Checked)
+ {
+ return;
+ }
+
+ var point = listView.PointToClient(Cursor.Position);
+
+ if (point.X >= 20)
+ {
+ e.Item.Checked = !e.Item.Checked;
+ return;
+ }
+
+ checkedPreset.ShowInQuickAccess = e.Item.Checked;
+
+ var preset = listView.GetSelectedItemTag();
+
+ if (preset == checkedPreset)
+ {
+ listView.FireEvent("SelectedIndexChanged", listView, e);
+ }
+ }
+
public static string ExtendedDisplayName(string displayName)
{
var name = displayName;
@@ -531,6 +559,108 @@ namespace ColorControl.Forms
return name;
}
+
+ public static string EditShortcut(string shortcut, string label = "Shortcut", string title = null)
+ {
+ var field = new MessageForms.FieldDefinition
+ {
+ Label = label,
+ FieldType = MessageForms.FieldType.Shortcut,
+ Value = shortcut
+ };
+ var values = MessageForms.ShowDialog(title ?? "Set shortcut", new[] { field });
+ if (!values.Any())
+ {
+ return null;
+ }
+
+ return values.First().Value.ToString();
+ }
+
+ public static void ListViewSort(object sender, ColumnClickEventArgs e)
+ {
+ var listView = (ListView)sender;
+ var sorter = (ListViewColumnSorter)listView.ListViewItemSorter;
+
+ // Determine if clicked column is already the column that is being sorted.
+ if (e.Column == sorter.SortColumn)
+ {
+ //if (sorter.Order == SortOrder.None)
+ //{
+ // sorter.Order = SortOrder.Ascending;
+ //}
+ // Reverse the current sort direction for this column.
+ if (sorter.Order == SortOrder.Ascending)
+ {
+ sorter.Order = SortOrder.Descending;
+ }
+ else
+ {
+ sorter.Order = SortOrder.Ascending;
+ }
+ }
+ else
+ {
+ // Set the column number that is to be sorted; default to ascending.
+ sorter.SortColumn = e.Column;
+ sorter.Order = SortOrder.Ascending;
+ }
+
+ // Perform the sort with these new sort options.
+ listView.Sort();
+ }
+
+ public static void BuildServicePresetsMenu(ToolStripMenuItem menu, ServiceBase service, string name, EventHandler eventHandler) where T : PresetBase, new()
+ {
+ menu.DropDownItems.Clear();
+
+ foreach (var nvPreset in service?.GetPresets() ?? new List())
+ {
+ var text = nvPreset.name;
+
+ if (!string.IsNullOrEmpty(text))
+ {
+ var item = menu.DropDownItems.Add(text);
+ item.Tag = nvPreset;
+ item.Click += eventHandler;
+ }
+ }
+
+ menu.Visible = service != null;
+
+ menu.Text = menu.DropDownItems.Count > 0 ? $"{name} presets" : $"{name} presets (no named presets found)";
+ }
+
+ public static void ShowControls(Control parent, bool show = true, Control exclude = null)
+ {
+ for (var i = 0; i < parent.Controls.Count; i++)
+ {
+ var control = parent.Controls[i];
+ if (control != exclude)
+ {
+ control.Visible = show;
+ }
+ }
+ }
+
+ public static void InitSortState(ListView listView, ListViewSortState sortState)
+ {
+ var sorter = new ListViewColumnSorter();
+ sorter.SortColumn = sortState.SortIndex;
+ sorter.Order = sortState.SortOrder;
+ listView.ListViewItemSorter = sorter;
+ }
+
+ public static void SaveSortState(IComparer comparer, ListViewSortState sortState)
+ {
+ if (!(comparer is ListViewColumnSorter sorter))
+ {
+ return;
+ }
+
+ sortState.SortOrder = sorter.Order;
+ sortState.SortIndex = sorter.SortColumn;
+ }
}
public class EnumComboBoxItem
diff --git a/ColorControl/MainForm.Designer.cs b/ColorControl/MainForm.Designer.cs
index fea08e3..bf48f17 100644
--- a/ColorControl/MainForm.Designer.cs
+++ b/ColorControl/MainForm.Designer.cs
@@ -32,61 +32,6 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.tcMain = new System.Windows.Forms.TabControl();
this.tabNVIDIA = new System.Windows.Forms.TabPage();
- this.lblNvOverclock = new System.Windows.Forms.Label();
- this.edtNvOverclock = new System.Windows.Forms.TextBox();
- this.btnNvSetClocks = new System.Windows.Forms.Button();
- this.lblNvGpuInfo = new System.Windows.Forms.Label();
- this.edtNvGpuInfo = new System.Windows.Forms.TextBox();
- this.lblNvGPU = new System.Windows.Forms.Label();
- this.cbxNvGPU = new System.Windows.Forms.ComboBox();
- this.btnNvSettings = new System.Windows.Forms.Button();
- this.chkNvShowInQuickAccess = new System.Windows.Forms.CheckBox();
- this.lblNvPresetName = new System.Windows.Forms.Label();
- this.edtNvPresetName = new System.Windows.Forms.TextBox();
- this.btnAddModesNv = new System.Windows.Forms.Button();
- this.btnNvPresetDelete = new System.Windows.Forms.Button();
- this.lblError = new System.Windows.Forms.Label();
- this.btnClone = new System.Windows.Forms.Button();
- this.btnNvPresetSave = new System.Windows.Forms.Button();
- this.lblShortcut = new System.Windows.Forms.Label();
- this.edtShortcut = new System.Windows.Forms.TextBox();
- this.btnChange = new System.Windows.Forms.Button();
- this.mnuNvPresets = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.miNvApply = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPresetApplyOnStartup = new System.Windows.Forms.ToolStripMenuItem();
- this.tssNvPresetMenu = new System.Windows.Forms.ToolStripSeparator();
- this.mnuNvDisplay = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPrimaryDisplay = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvPresetsColorSettings = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPresetColorSettings = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuRefreshRate = new System.Windows.Forms.ToolStripMenuItem();
- this.miRefreshRateIncluded = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvResolution = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvResolutionIncluded = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPresetDithering = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPresetApplyDithering = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvPresetDitheringEnabled = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvDitheringBitDepth = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvDithering6bit = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvDithering8bit = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvDithering10bit = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvDitheringMode = new System.Windows.Forms.ToolStripMenuItem();
- this.spatial1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.spatial2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.spatialDynamic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.spatialStatic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.temporalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvHDR = new System.Windows.Forms.ToolStripMenuItem();
- this.miHDRIncluded = new System.Windows.Forms.ToolStripMenuItem();
- this.miToggleHDR = new System.Windows.Forms.ToolStripMenuItem();
- this.miHDREnabled = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvDriverSettings = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvDriverSettingsIncluded = new System.Windows.Forms.ToolStripMenuItem();
- this.mnuNvOverclocking = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvOverclockingIncluded = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvCopyId = new System.Windows.Forms.ToolStripMenuItem();
- this.btnApply = new System.Windows.Forms.Button();
- this.lvNvPresets = new System.Windows.Forms.ListView();
this.tabAMD = new System.Windows.Forms.TabPage();
this.btnAmdSettings = new System.Windows.Forms.Button();
this.chkAmdQuickAccess = new System.Windows.Forms.CheckBox();
@@ -267,14 +212,9 @@
this.lbPlugins = new System.Windows.Forms.ListBox();
this.label7 = new System.Windows.Forms.Label();
this.lblInfo = new System.Windows.Forms.Label();
- this.mnuNvSettings = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.miNvProfileInspector = new System.Windows.Forms.ToolStripMenuItem();
- this.miNvSettings = new System.Windows.Forms.ToolStripMenuItem();
this.btnUpdate = new System.Windows.Forms.Button();
this.lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(this.components);
this.tcMain.SuspendLayout();
- this.tabNVIDIA.SuspendLayout();
- this.mnuNvPresets.SuspendLayout();
this.tabAMD.SuspendLayout();
this.mnuAmdPresets.SuspendLayout();
this.tabLG.SuspendLayout();
@@ -299,7 +239,6 @@
this.tabInfo.SuspendLayout();
this.grpNVIDIAInfo.SuspendLayout();
this.groupBox3.SuspendLayout();
- this.mnuNvSettings.SuspendLayout();
this.SuspendLayout();
//
// tcMain
@@ -324,27 +263,6 @@
//
// tabNVIDIA
//
- this.tabNVIDIA.Controls.Add(this.lblNvOverclock);
- this.tabNVIDIA.Controls.Add(this.edtNvOverclock);
- this.tabNVIDIA.Controls.Add(this.btnNvSetClocks);
- this.tabNVIDIA.Controls.Add(this.lblNvGpuInfo);
- this.tabNVIDIA.Controls.Add(this.edtNvGpuInfo);
- this.tabNVIDIA.Controls.Add(this.lblNvGPU);
- this.tabNVIDIA.Controls.Add(this.cbxNvGPU);
- this.tabNVIDIA.Controls.Add(this.btnNvSettings);
- this.tabNVIDIA.Controls.Add(this.chkNvShowInQuickAccess);
- this.tabNVIDIA.Controls.Add(this.lblNvPresetName);
- this.tabNVIDIA.Controls.Add(this.edtNvPresetName);
- this.tabNVIDIA.Controls.Add(this.btnAddModesNv);
- this.tabNVIDIA.Controls.Add(this.btnNvPresetDelete);
- this.tabNVIDIA.Controls.Add(this.lblError);
- this.tabNVIDIA.Controls.Add(this.btnClone);
- this.tabNVIDIA.Controls.Add(this.btnNvPresetSave);
- this.tabNVIDIA.Controls.Add(this.lblShortcut);
- this.tabNVIDIA.Controls.Add(this.edtShortcut);
- this.tabNVIDIA.Controls.Add(this.btnChange);
- this.tabNVIDIA.Controls.Add(this.btnApply);
- this.tabNVIDIA.Controls.Add(this.lvNvPresets);
this.tabNVIDIA.Location = new System.Drawing.Point(4, 24);
this.tabNVIDIA.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.tabNVIDIA.Name = "tabNVIDIA";
@@ -354,548 +272,6 @@
this.tabNVIDIA.Text = "NVIDIA controller";
this.tabNVIDIA.UseVisualStyleBackColor = true;
//
- // lblNvOverclock
- //
- this.lblNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblNvOverclock.AutoSize = true;
- this.lblNvOverclock.Location = new System.Drawing.Point(578, 496);
- this.lblNvOverclock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblNvOverclock.Name = "lblNvOverclock";
- this.lblNvOverclock.Size = new System.Drawing.Size(51, 15);
- this.lblNvOverclock.TabIndex = 66;
- this.lblNvOverclock.Text = "OC info:";
- //
- // edtNvOverclock
- //
- this.edtNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.edtNvOverclock.Enabled = false;
- this.edtNvOverclock.Location = new System.Drawing.Point(648, 493);
- this.edtNvOverclock.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.edtNvOverclock.Name = "edtNvOverclock";
- this.edtNvOverclock.Size = new System.Drawing.Size(457, 23);
- this.edtNvOverclock.TabIndex = 65;
- //
- // btnNvSetClocks
- //
- this.btnNvSetClocks.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnNvSetClocks.Location = new System.Drawing.Point(868, 433);
- this.btnNvSetClocks.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnNvSetClocks.Name = "btnNvSetClocks";
- this.btnNvSetClocks.Size = new System.Drawing.Size(88, 27);
- this.btnNvSetClocks.TabIndex = 64;
- this.btnNvSetClocks.Text = "Change...";
- this.btnNvSetClocks.UseVisualStyleBackColor = true;
- this.btnNvSetClocks.Click += new System.EventHandler(this.btnNvSetClocks_Click);
- //
- // lblNvGpuInfo
- //
- this.lblNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblNvGpuInfo.AutoSize = true;
- this.lblNvGpuInfo.Location = new System.Drawing.Point(578, 469);
- this.lblNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblNvGpuInfo.Name = "lblNvGpuInfo";
- this.lblNvGpuInfo.Size = new System.Drawing.Size(31, 15);
- this.lblNvGpuInfo.TabIndex = 63;
- this.lblNvGpuInfo.Text = "Info:";
- //
- // edtNvGpuInfo
- //
- this.edtNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.edtNvGpuInfo.Enabled = false;
- this.edtNvGpuInfo.Location = new System.Drawing.Point(648, 466);
- this.edtNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.edtNvGpuInfo.Name = "edtNvGpuInfo";
- this.edtNvGpuInfo.Size = new System.Drawing.Size(457, 23);
- this.edtNvGpuInfo.TabIndex = 62;
- //
- // lblNvGPU
- //
- this.lblNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblNvGPU.AutoSize = true;
- this.lblNvGPU.Location = new System.Drawing.Point(578, 439);
- this.lblNvGPU.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblNvGPU.Name = "lblNvGPU";
- this.lblNvGPU.Size = new System.Drawing.Size(33, 15);
- this.lblNvGPU.TabIndex = 61;
- this.lblNvGPU.Text = "GPU:";
- //
- // cbxNvGPU
- //
- this.cbxNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.cbxNvGPU.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cbxNvGPU.FormattingEnabled = true;
- this.cbxNvGPU.Location = new System.Drawing.Point(648, 436);
- this.cbxNvGPU.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.cbxNvGPU.Name = "cbxNvGPU";
- this.cbxNvGPU.Size = new System.Drawing.Size(212, 23);
- this.cbxNvGPU.TabIndex = 60;
- this.cbxNvGPU.SelectedIndexChanged += new System.EventHandler(this.cbxNvGPU_SelectedIndexChanged);
- //
- // btnNvSettings
- //
- this.btnNvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnNvSettings.Location = new System.Drawing.Point(1017, 428);
- this.btnNvSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnNvSettings.Name = "btnNvSettings";
- this.btnNvSettings.Size = new System.Drawing.Size(88, 27);
- this.btnNvSettings.TabIndex = 59;
- this.btnNvSettings.Text = "Settings...";
- this.btnNvSettings.UseVisualStyleBackColor = true;
- this.btnNvSettings.Click += new System.EventHandler(this.btnNvSettings_Click);
- //
- // chkNvShowInQuickAccess
- //
- this.chkNvShowInQuickAccess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.chkNvShowInQuickAccess.AutoSize = true;
- this.chkNvShowInQuickAccess.Enabled = false;
- this.chkNvShowInQuickAccess.Location = new System.Drawing.Point(343, 465);
- this.chkNvShowInQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.chkNvShowInQuickAccess.Name = "chkNvShowInQuickAccess";
- this.chkNvShowInQuickAccess.Size = new System.Drawing.Size(141, 19);
- this.chkNvShowInQuickAccess.TabIndex = 45;
- this.chkNvShowInQuickAccess.Text = "Show in Quick Access";
- this.chkNvShowInQuickAccess.UseVisualStyleBackColor = true;
- //
- // lblNvPresetName
- //
- this.lblNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblNvPresetName.AutoSize = true;
- this.lblNvPresetName.Location = new System.Drawing.Point(7, 466);
- this.lblNvPresetName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblNvPresetName.Name = "lblNvPresetName";
- this.lblNvPresetName.Size = new System.Drawing.Size(42, 15);
- this.lblNvPresetName.TabIndex = 22;
- this.lblNvPresetName.Text = "Name:";
- //
- // edtNvPresetName
- //
- this.edtNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.edtNvPresetName.Enabled = false;
- this.edtNvPresetName.Location = new System.Drawing.Point(102, 463);
- this.edtNvPresetName.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.edtNvPresetName.Name = "edtNvPresetName";
- this.edtNvPresetName.Size = new System.Drawing.Size(233, 23);
- this.edtNvPresetName.TabIndex = 21;
- //
- // btnAddModesNv
- //
- this.btnAddModesNv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnAddModesNv.Location = new System.Drawing.Point(385, 429);
- this.btnAddModesNv.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnAddModesNv.Name = "btnAddModesNv";
- this.btnAddModesNv.Size = new System.Drawing.Size(88, 27);
- this.btnAddModesNv.TabIndex = 9;
- this.btnAddModesNv.Text = "Add modes";
- this.btnAddModesNv.UseVisualStyleBackColor = true;
- this.btnAddModesNv.Click += new System.EventHandler(this.btnAddModesNv_Click);
- //
- // btnNvPresetDelete
- //
- this.btnNvPresetDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnNvPresetDelete.Enabled = false;
- this.btnNvPresetDelete.Location = new System.Drawing.Point(290, 429);
- this.btnNvPresetDelete.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnNvPresetDelete.Name = "btnNvPresetDelete";
- this.btnNvPresetDelete.Size = new System.Drawing.Size(88, 27);
- this.btnNvPresetDelete.TabIndex = 8;
- this.btnNvPresetDelete.Text = "Delete";
- this.btnNvPresetDelete.UseVisualStyleBackColor = true;
- this.btnNvPresetDelete.Click += new System.EventHandler(this.btnNvPresetDelete_Click);
- //
- // lblError
- //
- this.lblError.AutoSize = true;
- this.lblError.Location = new System.Drawing.Point(7, 7);
- this.lblError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblError.Name = "lblError";
- this.lblError.Size = new System.Drawing.Size(53, 15);
- this.lblError.TabIndex = 7;
- this.lblError.Text = "ErrorText";
- this.lblError.Visible = false;
- //
- // btnClone
- //
- this.btnClone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnClone.Enabled = false;
- this.btnClone.Location = new System.Drawing.Point(196, 429);
- this.btnClone.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnClone.Name = "btnClone";
- this.btnClone.Size = new System.Drawing.Size(88, 27);
- this.btnClone.TabIndex = 6;
- this.btnClone.Text = "Clone";
- this.btnClone.UseVisualStyleBackColor = true;
- this.btnClone.Click += new System.EventHandler(this.btnClone_Click);
- //
- // btnNvPresetSave
- //
- this.btnNvPresetSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnNvPresetSave.Enabled = false;
- this.btnNvPresetSave.Location = new System.Drawing.Point(479, 429);
- this.btnNvPresetSave.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnNvPresetSave.Name = "btnNvPresetSave";
- this.btnNvPresetSave.Size = new System.Drawing.Size(88, 27);
- this.btnNvPresetSave.TabIndex = 5;
- this.btnNvPresetSave.Text = "Save";
- this.btnNvPresetSave.UseVisualStyleBackColor = true;
- this.btnNvPresetSave.Click += new System.EventHandler(this.btnSetShortcut_Click);
- //
- // lblShortcut
- //
- this.lblShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblShortcut.AutoSize = true;
- this.lblShortcut.Location = new System.Drawing.Point(7, 496);
- this.lblShortcut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
- this.lblShortcut.Name = "lblShortcut";
- this.lblShortcut.Size = new System.Drawing.Size(55, 15);
- this.lblShortcut.TabIndex = 4;
- this.lblShortcut.Text = "Shortcut:";
- //
- // edtShortcut
- //
- this.edtShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.edtShortcut.Enabled = false;
- this.edtShortcut.Location = new System.Drawing.Point(102, 493);
- this.edtShortcut.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.edtShortcut.Name = "edtShortcut";
- this.edtShortcut.ReadOnly = true;
- this.edtShortcut.Size = new System.Drawing.Size(233, 23);
- this.edtShortcut.TabIndex = 3;
- this.edtShortcut.TextChanged += new System.EventHandler(this.edtShortcut_TextChanged);
- this.edtShortcut.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyDown);
- this.edtShortcut.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyUp);
- //
- // btnChange
- //
- this.btnChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnChange.ContextMenuStrip = this.mnuNvPresets;
- this.btnChange.Location = new System.Drawing.Point(102, 429);
- this.btnChange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnChange.Name = "btnChange";
- this.btnChange.Size = new System.Drawing.Size(88, 27);
- this.btnChange.TabIndex = 2;
- this.btnChange.Text = "Change...";
- this.btnChange.UseVisualStyleBackColor = true;
- this.btnChange.Click += new System.EventHandler(this.btnChange_Click);
- //
- // mnuNvPresets
- //
- this.mnuNvPresets.ImageScalingSize = new System.Drawing.Size(20, 20);
- this.mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvApply,
- this.miNvPresetApplyOnStartup,
- this.tssNvPresetMenu,
- this.mnuNvDisplay,
- this.mnuNvPresetsColorSettings,
- this.mnuRefreshRate,
- this.mnuNvResolution,
- this.miNvPresetDithering,
- this.miNvHDR,
- this.mnuNvDriverSettings,
- this.mnuNvOverclocking,
- this.miNvCopyId});
- this.mnuNvPresets.Name = "mnuNvPresets";
- this.mnuNvPresets.Size = new System.Drawing.Size(185, 252);
- this.mnuNvPresets.Opening += new System.ComponentModel.CancelEventHandler(this.mnuNvPresets_Opening);
- //
- // miNvApply
- //
- this.miNvApply.Name = "miNvApply";
- this.miNvApply.Size = new System.Drawing.Size(184, 22);
- this.miNvApply.Text = "Apply";
- this.miNvApply.Click += new System.EventHandler(this.btnApply_Click);
- //
- // miNvPresetApplyOnStartup
- //
- this.miNvPresetApplyOnStartup.CheckOnClick = true;
- this.miNvPresetApplyOnStartup.Name = "miNvPresetApplyOnStartup";
- this.miNvPresetApplyOnStartup.Size = new System.Drawing.Size(184, 22);
- this.miNvPresetApplyOnStartup.Text = "Apply on startup";
- this.miNvPresetApplyOnStartup.Click += new System.EventHandler(this.miNvPresetApplyOnStartup_Click);
- //
- // tssNvPresetMenu
- //
- this.tssNvPresetMenu.Name = "tssNvPresetMenu";
- this.tssNvPresetMenu.Size = new System.Drawing.Size(181, 6);
- //
- // mnuNvDisplay
- //
- this.mnuNvDisplay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvPrimaryDisplay});
- this.mnuNvDisplay.Name = "mnuNvDisplay";
- this.mnuNvDisplay.Size = new System.Drawing.Size(184, 22);
- this.mnuNvDisplay.Text = "Display";
- //
- // miNvPrimaryDisplay
- //
- this.miNvPrimaryDisplay.Name = "miNvPrimaryDisplay";
- this.miNvPrimaryDisplay.Size = new System.Drawing.Size(155, 22);
- this.miNvPrimaryDisplay.Text = "Primary display";
- this.miNvPrimaryDisplay.Click += new System.EventHandler(this.displayMenuItem_Click);
- //
- // mnuNvPresetsColorSettings
- //
- this.mnuNvPresetsColorSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvPresetColorSettings});
- this.mnuNvPresetsColorSettings.Name = "mnuNvPresetsColorSettings";
- this.mnuNvPresetsColorSettings.Size = new System.Drawing.Size(184, 22);
- this.mnuNvPresetsColorSettings.Text = "Color Settings";
- //
- // miNvPresetColorSettings
- //
- this.miNvPresetColorSettings.Name = "miNvPresetColorSettings";
- this.miNvPresetColorSettings.Size = new System.Drawing.Size(120, 22);
- this.miNvPresetColorSettings.Text = "Included";
- this.miNvPresetColorSettings.Click += new System.EventHandler(this.miNvPresetColorSettings_Click);
- //
- // mnuRefreshRate
- //
- this.mnuRefreshRate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miRefreshRateIncluded});
- this.mnuRefreshRate.Name = "mnuRefreshRate";
- this.mnuRefreshRate.Size = new System.Drawing.Size(184, 22);
- this.mnuRefreshRate.Text = "Refresh Rate";
- //
- // miRefreshRateIncluded
- //
- this.miRefreshRateIncluded.Name = "miRefreshRateIncluded";
- this.miRefreshRateIncluded.Size = new System.Drawing.Size(120, 22);
- this.miRefreshRateIncluded.Text = "Included";
- this.miRefreshRateIncluded.Click += new System.EventHandler(this.includedToolStripMenuItem_Click);
- //
- // mnuNvResolution
- //
- this.mnuNvResolution.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvResolutionIncluded});
- this.mnuNvResolution.Name = "mnuNvResolution";
- this.mnuNvResolution.Size = new System.Drawing.Size(184, 22);
- this.mnuNvResolution.Text = "Resolution";
- //
- // miNvResolutionIncluded
- //
- this.miNvResolutionIncluded.CheckOnClick = true;
- this.miNvResolutionIncluded.Name = "miNvResolutionIncluded";
- this.miNvResolutionIncluded.Size = new System.Drawing.Size(120, 22);
- this.miNvResolutionIncluded.Text = "Included";
- this.miNvResolutionIncluded.Click += new System.EventHandler(this.miNvResolutionIncluded_Click);
- //
- // miNvPresetDithering
- //
- this.miNvPresetDithering.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvPresetApplyDithering,
- this.miNvPresetDitheringEnabled,
- this.mnuNvDitheringBitDepth,
- this.mnuNvDitheringMode});
- this.miNvPresetDithering.Name = "miNvPresetDithering";
- this.miNvPresetDithering.Size = new System.Drawing.Size(184, 22);
- this.miNvPresetDithering.Text = "Dithering";
- //
- // miNvPresetApplyDithering
- //
- this.miNvPresetApplyDithering.Name = "miNvPresetApplyDithering";
- this.miNvPresetApplyDithering.Size = new System.Drawing.Size(122, 22);
- this.miNvPresetApplyDithering.Text = "Included";
- this.miNvPresetApplyDithering.Click += new System.EventHandler(this.miNvPresetApplyDithering_Click);
- //
- // miNvPresetDitheringEnabled
- //
- this.miNvPresetDitheringEnabled.Name = "miNvPresetDitheringEnabled";
- this.miNvPresetDitheringEnabled.Size = new System.Drawing.Size(122, 22);
- this.miNvPresetDitheringEnabled.Text = "Enabled";
- this.miNvPresetDitheringEnabled.Click += new System.EventHandler(this.miNvPresetDitheringEnabled_Click);
- //
- // mnuNvDitheringBitDepth
- //
- this.mnuNvDitheringBitDepth.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvDithering6bit,
- this.miNvDithering8bit,
- this.miNvDithering10bit});
- this.mnuNvDitheringBitDepth.Name = "mnuNvDitheringBitDepth";
- this.mnuNvDitheringBitDepth.Size = new System.Drawing.Size(122, 22);
- this.mnuNvDitheringBitDepth.Text = "Bit depth";
- //
- // miNvDithering6bit
- //
- this.miNvDithering6bit.Name = "miNvDithering6bit";
- this.miNvDithering6bit.Size = new System.Drawing.Size(105, 22);
- this.miNvDithering6bit.Tag = "0";
- this.miNvDithering6bit.Text = "6-bit";
- this.miNvDithering6bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
- //
- // miNvDithering8bit
- //
- this.miNvDithering8bit.Name = "miNvDithering8bit";
- this.miNvDithering8bit.Size = new System.Drawing.Size(105, 22);
- this.miNvDithering8bit.Tag = "1";
- this.miNvDithering8bit.Text = "8-bit";
- this.miNvDithering8bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
- //
- // miNvDithering10bit
- //
- this.miNvDithering10bit.Name = "miNvDithering10bit";
- this.miNvDithering10bit.Size = new System.Drawing.Size(105, 22);
- this.miNvDithering10bit.Tag = "2";
- this.miNvDithering10bit.Text = "10-bit";
- this.miNvDithering10bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
- //
- // mnuNvDitheringMode
- //
- this.mnuNvDitheringMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.spatial1ToolStripMenuItem,
- this.spatial2ToolStripMenuItem,
- this.spatialDynamic2x2ToolStripMenuItem,
- this.spatialStatic2x2ToolStripMenuItem,
- this.temporalToolStripMenuItem});
- this.mnuNvDitheringMode.Name = "mnuNvDitheringMode";
- this.mnuNvDitheringMode.Size = new System.Drawing.Size(122, 22);
- this.mnuNvDitheringMode.Text = "Mode";
- //
- // spatial1ToolStripMenuItem
- //
- this.spatial1ToolStripMenuItem.Name = "spatial1ToolStripMenuItem";
- this.spatial1ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.spatial1ToolStripMenuItem.Tag = "0";
- this.spatial1ToolStripMenuItem.Text = "Spatial Dynamic";
- this.spatial1ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
- //
- // spatial2ToolStripMenuItem
- //
- this.spatial2ToolStripMenuItem.Name = "spatial2ToolStripMenuItem";
- this.spatial2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.spatial2ToolStripMenuItem.Tag = "1";
- this.spatial2ToolStripMenuItem.Text = "Spatial Static";
- this.spatial2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
- //
- // spatialDynamic2x2ToolStripMenuItem
- //
- this.spatialDynamic2x2ToolStripMenuItem.Name = "spatialDynamic2x2ToolStripMenuItem";
- this.spatialDynamic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.spatialDynamic2x2ToolStripMenuItem.Tag = "2";
- this.spatialDynamic2x2ToolStripMenuItem.Text = "Spatial Dynamic 2x2";
- this.spatialDynamic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
- //
- // spatialStatic2x2ToolStripMenuItem
- //
- this.spatialStatic2x2ToolStripMenuItem.Name = "spatialStatic2x2ToolStripMenuItem";
- this.spatialStatic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.spatialStatic2x2ToolStripMenuItem.Tag = "3";
- this.spatialStatic2x2ToolStripMenuItem.Text = "Spatial Static 2x2";
- this.spatialStatic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
- //
- // temporalToolStripMenuItem
- //
- this.temporalToolStripMenuItem.Name = "temporalToolStripMenuItem";
- this.temporalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.temporalToolStripMenuItem.Tag = "4";
- this.temporalToolStripMenuItem.Text = "Temporal";
- this.temporalToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
- //
- // miNvHDR
- //
- this.miNvHDR.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miHDRIncluded,
- this.miToggleHDR,
- this.miHDREnabled});
- this.miNvHDR.Name = "miNvHDR";
- this.miNvHDR.Size = new System.Drawing.Size(184, 22);
- this.miNvHDR.Text = "HDR";
- //
- // miHDRIncluded
- //
- this.miHDRIncluded.Name = "miHDRIncluded";
- this.miHDRIncluded.Size = new System.Drawing.Size(136, 22);
- this.miHDRIncluded.Text = "Included";
- this.miHDRIncluded.Click += new System.EventHandler(this.miHDRIncluded_Click);
- //
- // miToggleHDR
- //
- this.miToggleHDR.Name = "miToggleHDR";
- this.miToggleHDR.Size = new System.Drawing.Size(136, 22);
- this.miToggleHDR.Text = "Toggle HDR";
- this.miToggleHDR.Click += new System.EventHandler(this.miToggleHDR_Click);
- //
- // miHDREnabled
- //
- this.miHDREnabled.Name = "miHDREnabled";
- this.miHDREnabled.Size = new System.Drawing.Size(136, 22);
- this.miHDREnabled.Text = "Enabled";
- this.miHDREnabled.Click += new System.EventHandler(this.miHDREnabled_Click);
- //
- // mnuNvDriverSettings
- //
- this.mnuNvDriverSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvDriverSettingsIncluded});
- this.mnuNvDriverSettings.Name = "mnuNvDriverSettings";
- this.mnuNvDriverSettings.Size = new System.Drawing.Size(184, 22);
- this.mnuNvDriverSettings.Text = "Driver Settings";
- //
- // miNvDriverSettingsIncluded
- //
- this.miNvDriverSettingsIncluded.Name = "miNvDriverSettingsIncluded";
- this.miNvDriverSettingsIncluded.Size = new System.Drawing.Size(120, 22);
- this.miNvDriverSettingsIncluded.Text = "Included";
- this.miNvDriverSettingsIncluded.Click += new System.EventHandler(this.miNvDriverSettingsIncluded_Click);
- //
- // mnuNvOverclocking
- //
- this.mnuNvOverclocking.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvOverclockingIncluded});
- this.mnuNvOverclocking.Name = "mnuNvOverclocking";
- this.mnuNvOverclocking.Size = new System.Drawing.Size(184, 22);
- this.mnuNvOverclocking.Text = "Overclocking";
- //
- // miNvOverclockingIncluded
- //
- this.miNvOverclockingIncluded.Name = "miNvOverclockingIncluded";
- this.miNvOverclockingIncluded.Size = new System.Drawing.Size(120, 22);
- this.miNvOverclockingIncluded.Text = "Included";
- this.miNvOverclockingIncluded.Click += new System.EventHandler(this.miNvOverclockingIncluded_Click);
- //
- // miNvCopyId
- //
- this.miNvCopyId.Name = "miNvCopyId";
- this.miNvCopyId.Size = new System.Drawing.Size(184, 22);
- this.miNvCopyId.Text = "Copy Id to Clipboard";
- this.miNvCopyId.Click += new System.EventHandler(this.miNvCopyId_Click);
- //
- // btnApply
- //
- this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnApply.Enabled = false;
- this.btnApply.Location = new System.Drawing.Point(7, 429);
- this.btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.btnApply.Name = "btnApply";
- this.btnApply.Size = new System.Drawing.Size(88, 27);
- this.btnApply.TabIndex = 1;
- this.btnApply.Text = "Apply";
- this.btnApply.UseVisualStyleBackColor = true;
- this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
- //
- // lvNvPresets
- //
- this.lvNvPresets.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.lvNvPresets.CheckBoxes = true;
- this.lvNvPresets.ContextMenuStrip = this.mnuNvPresets;
- this.lvNvPresets.FullRowSelect = true;
- this.lvNvPresets.Location = new System.Drawing.Point(7, 7);
- this.lvNvPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.lvNvPresets.MultiSelect = false;
- this.lvNvPresets.Name = "lvNvPresets";
- this.lvNvPresets.Size = new System.Drawing.Size(1098, 415);
- this.lvNvPresets.TabIndex = 0;
- this.lvNvPresets.UseCompatibleStateImageBehavior = false;
- this.lvNvPresets.View = System.Windows.Forms.View.Details;
- this.lvNvPresets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvLgPresets_ColumnClick);
- this.lvNvPresets.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvNvPresets_ItemCheck);
- this.lvNvPresets.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvNvPresets_ItemChecked);
- this.lvNvPresets.SelectedIndexChanged += new System.EventHandler(this.lvNvPresets_SelectedIndexChanged);
- this.lvNvPresets.DoubleClick += new System.EventHandler(this.btnApply_Click);
- this.lvNvPresets.MouseLeave += new System.EventHandler(this.lvNvPresets_MouseLeave);
- this.lvNvPresets.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lvNvPresets_MouseMove);
- //
// tabAMD
//
this.tabAMD.Controls.Add(this.btnAmdSettings);
@@ -2295,7 +1671,6 @@
// btnGameAdd
//
this.btnGameAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnGameAdd.ContextMenuStrip = this.mnuNvPresets;
this.btnGameAdd.Location = new System.Drawing.Point(199, 351);
this.btnGameAdd.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.btnGameAdd.Name = "btnGameAdd";
@@ -3054,29 +2429,6 @@
this.lblInfo.TabIndex = 1;
this.lblInfo.Text = "Info";
//
- // mnuNvSettings
- //
- this.mnuNvSettings.ImageScalingSize = new System.Drawing.Size(20, 20);
- this.mnuNvSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.miNvProfileInspector,
- this.miNvSettings});
- this.mnuNvSettings.Name = "mnuLgButtons";
- this.mnuNvSettings.Size = new System.Drawing.Size(202, 48);
- //
- // miNvProfileInspector
- //
- this.miNvProfileInspector.Name = "miNvProfileInspector";
- this.miNvProfileInspector.Size = new System.Drawing.Size(201, 22);
- this.miNvProfileInspector.Text = "NVIDIA Profile Inspector";
- this.miNvProfileInspector.Click += new System.EventHandler(this.miNvProfileInspector_Click);
- //
- // miNvSettings
- //
- this.miNvSettings.Name = "miNvSettings";
- this.miNvSettings.Size = new System.Drawing.Size(201, 22);
- this.miNvSettings.Text = "Settings";
- this.miNvSettings.Click += new System.EventHandler(this.miNvSettings_Click);
- //
// btnUpdate
//
this.btnUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -3115,9 +2467,6 @@
this.Click += new System.EventHandler(this.MainForm_Click);
this.Resize += new System.EventHandler(this.MainForm_Resize);
this.tcMain.ResumeLayout(false);
- this.tabNVIDIA.ResumeLayout(false);
- this.tabNVIDIA.PerformLayout();
- this.mnuNvPresets.ResumeLayout(false);
this.tabAMD.ResumeLayout(false);
this.tabAMD.PerformLayout();
this.mnuAmdPresets.ResumeLayout(false);
@@ -3151,7 +2500,6 @@
this.grpNVIDIAInfo.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
- this.mnuNvSettings.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -3160,33 +2508,10 @@
private System.Windows.Forms.TabControl tcMain;
private System.Windows.Forms.TabPage tabLG;
- private System.Windows.Forms.ListView lvNvPresets;
- private System.Windows.Forms.Button btnApply;
- private System.Windows.Forms.Button btnChange;
- private System.Windows.Forms.Button btnNvPresetSave;
- private System.Windows.Forms.Label lblShortcut;
- private System.Windows.Forms.TextBox edtShortcut;
private System.Windows.Forms.TabPage tabOptions;
- private System.Windows.Forms.Button btnClone;
- private System.Windows.Forms.ContextMenuStrip mnuNvPresets;
- private System.Windows.Forms.ToolStripMenuItem miNvPresetDithering;
- private System.Windows.Forms.ToolStripMenuItem miNvPresetApplyDithering;
- private System.Windows.Forms.ToolStripMenuItem miNvPresetDitheringEnabled;
- private System.Windows.Forms.ToolStripMenuItem mnuRefreshRate;
- private System.Windows.Forms.ToolStripMenuItem miRefreshRateIncluded;
- private System.Windows.Forms.ToolStripMenuItem miNvHDR;
- private System.Windows.Forms.ToolStripMenuItem miHDRIncluded;
- private System.Windows.Forms.ToolStripMenuItem miToggleHDR;
- private System.Windows.Forms.ToolStripMenuItem miHDREnabled;
- private System.Windows.Forms.Label lblError;
- private System.Windows.Forms.Button btnNvPresetDelete;
- private System.Windows.Forms.Button btnAddModesNv;
- private System.Windows.Forms.ToolStripMenuItem miNvApply;
private System.Windows.Forms.GroupBox grpGeneralOptions;
private System.Windows.Forms.CheckBox chkStartMinimized;
private System.Windows.Forms.CheckBox chkStartAfterLogin;
- private System.Windows.Forms.ToolStripMenuItem mnuNvDisplay;
- private System.Windows.Forms.ToolStripMenuItem miNvPrimaryDisplay;
private System.Windows.Forms.TabPage tabLog;
private System.Windows.Forms.TextBox edtLog;
private System.Windows.Forms.TabPage tabInfo;
@@ -3198,8 +2523,6 @@
private System.Windows.Forms.TreeView tvNVIDIAInfo;
private System.Windows.Forms.Button btnRefreshNVIDIAInfo;
private System.Windows.Forms.ContextMenuStrip mnuLgButtons;
- private System.Windows.Forms.ToolStripMenuItem mnuNvPresetsColorSettings;
- private System.Windows.Forms.ToolStripMenuItem miNvPresetColorSettings;
private System.Windows.Forms.GroupBox grpLGOptions;
private System.Windows.Forms.NumericUpDown edtLgMaxPowerOnRetries;
private System.Windows.Forms.Label lblLgMaxPowerOnRetries;
@@ -3223,17 +2546,6 @@
private System.Windows.Forms.Label lblDitheringBitDepth;
private System.Windows.Forms.ComboBox cbxDitheringBitDepth;
private System.Windows.Forms.CheckBox chkDitheringEnabled;
- private System.Windows.Forms.ToolStripMenuItem mnuNvDitheringBitDepth;
- private System.Windows.Forms.ToolStripMenuItem miNvDithering6bit;
- private System.Windows.Forms.ToolStripMenuItem miNvDithering8bit;
- private System.Windows.Forms.ToolStripMenuItem miNvDithering10bit;
- private System.Windows.Forms.ToolStripMenuItem mnuNvDitheringMode;
- private System.Windows.Forms.ToolStripMenuItem spatial1ToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem spatial2ToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem spatialDynamic2x2ToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem spatialStatic2x2ToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem temporalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem miNvPresetApplyOnStartup;
private System.Windows.Forms.ToolStripMenuItem mnuLgRcButtons;
private System.Windows.Forms.ToolStripMenuItem mnuLgActions;
private System.Windows.Forms.Button btnDeleteAmd;
@@ -3262,9 +2574,6 @@
private System.Windows.Forms.ListView lvAmdPresets;
private System.Windows.Forms.Button btnAddAmd;
private System.Windows.Forms.CheckBox chkMinimizeToSystemTray;
- private System.Windows.Forms.ToolStripMenuItem miNvCopyId;
- private System.Windows.Forms.Label lblNvPresetName;
- private System.Windows.Forms.TextBox edtNvPresetName;
private System.Windows.Forms.Label lblAmdPresetName;
private System.Windows.Forms.TextBox edtAmdPresetName;
private System.Windows.Forms.ToolStripMenuItem miAmdCopyId;
@@ -3329,10 +2638,6 @@
private System.Windows.Forms.TextBox edtLgGameBarShortcut;
private System.Windows.Forms.ComboBox cbxLgPcHdmiPort;
private System.Windows.Forms.Label lblLgPcHdmiPort;
- private System.Windows.Forms.ToolStripMenuItem mnuNvResolution;
- private System.Windows.Forms.ToolStripMenuItem miNvResolutionIncluded;
- private System.Windows.Forms.ToolStripMenuItem mnuNvDriverSettings;
- private System.Windows.Forms.ToolStripMenuItem miNvDriverSettingsIncluded;
private System.Windows.Forms.ToolStripMenuItem mnuLgProgram;
private System.Windows.Forms.TabPage tabGameLauncher;
private System.Windows.Forms.Label lblGameParameters;
@@ -3361,13 +2666,8 @@
private System.Windows.Forms.ToolStripMenuItem mnuGameNvInspector;
private System.Windows.Forms.CheckBox chkGameQuickAccess;
private System.Windows.Forms.ToolStripMenuItem miGameSetQuickAccessShortcut;
- private System.Windows.Forms.CheckBox chkNvShowInQuickAccess;
- private System.Windows.Forms.Button btnNvSettings;
private System.Windows.Forms.CheckBox chkLgQuickAccess;
private System.Windows.Forms.Button btnLgSettings;
- private System.Windows.Forms.ContextMenuStrip mnuNvSettings;
- private System.Windows.Forms.ToolStripMenuItem miNvProfileInspector;
- private System.Windows.Forms.ToolStripMenuItem miNvSettings;
private System.Windows.Forms.CheckBox chkAmdQuickAccess;
private System.Windows.Forms.Button btnAmdSettings;
private System.Windows.Forms.Button btnGameOptions;
@@ -3390,16 +2690,6 @@
private System.Windows.Forms.Label lblDitheringDisplay;
private System.Windows.Forms.ComboBox cbxDitheringDisplay;
private System.Windows.Forms.ToolTip lvNvPresetsToolTip;
- private System.Windows.Forms.ToolStripSeparator tssNvPresetMenu;
- private System.Windows.Forms.Label lblNvGPU;
- private System.Windows.Forms.ComboBox cbxNvGPU;
- private System.Windows.Forms.Label lblNvGpuInfo;
- private System.Windows.Forms.TextBox edtNvGpuInfo;
- private System.Windows.Forms.Button btnNvSetClocks;
- private System.Windows.Forms.Label lblNvOverclock;
- private System.Windows.Forms.TextBox edtNvOverclock;
- private System.Windows.Forms.ToolStripMenuItem mnuNvOverclocking;
- private System.Windows.Forms.ToolStripMenuItem miNvOverclockingIncluded;
}
}
diff --git a/ColorControl/MainForm.cs b/ColorControl/MainForm.cs
index 9bca56c..2cc3af8 100644
--- a/ColorControl/MainForm.cs
+++ b/ColorControl/MainForm.cs
@@ -11,17 +11,10 @@ using ColorControl.Svc;
using LgTv;
using Microsoft.Extensions.DependencyInjection;
using NLog;
-using nspector;
-using nspector.Common;
-using nspector.Common.Meta;
using NStandard;
using NvAPIWrapper.Display;
-using NvAPIWrapper.GPU;
-using NvAPIWrapper.Native.Display;
using NWin32;
-using NWin32.NativeTypes;
using System;
-using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@@ -52,6 +45,7 @@ namespace ColorControl
private string _dataDir;
private NvService _nvService;
+ private NvPanel _nvPanel;
private string _lastDisplayRefreshRates = string.Empty;
private NotifyIcon _trayIcon;
@@ -197,14 +191,14 @@ namespace ColorControl
Logger.Debug("Initializing NVIDIA...");
var appContextProvider = Program.ServiceProvider.GetRequiredService();
_nvService = new NvService(appContextProvider);
- FillNvPresets();
Logger.Debug("Initializing NVIDIA...Done.");
- InitSortState(lvNvPresets, _config.NvPresetsSortState);
+ _nvPanel = new NvPanel(_nvService, _trayIcon, Handle);
+ _nvPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+
+ tabNVIDIA.Controls.Add(_nvPanel);
InitShortcut(SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, _nvService.ToggleQuickAccessForm);
-
- _nvService.AfterApplyPreset += NvServiceAfterApplyPreset;
}
catch (Exception ex)
{
@@ -214,11 +208,6 @@ namespace ColorControl
}
}
- private void NvServiceAfterApplyPreset(object sender, NvPreset preset)
- {
- UpdateDisplayInfoItems();
- }
-
private void InitAmdService()
{
try
@@ -227,7 +216,7 @@ namespace ColorControl
_amdService = new AmdService(appContextProvider);
FillAmdPresets();
- InitSortState(lvAmdPresets, _config.AmdPresetsSortState);
+ FormUtils.InitSortState(lvAmdPresets, _config.AmdPresetsSortState);
InitShortcut(SHORTCUTID_AMDQA, _config.AmdQuickAccessShortcut, _amdService.ToggleQuickAccessForm);
@@ -249,7 +238,7 @@ namespace ColorControl
_gameService = new GameService(appContextProvider, HandleExternalServiceForLgDevice);
FillGamePresets();
- InitSortState(lvGamePresets, _config.GamePresetsSortState);
+ FormUtils.InitSortState(lvGamePresets, _config.GamePresetsSortState);
InitShortcut(SHORTCUTID_GAMEQA, _config.GameQuickAccessShortcut, _gameService.ToggleQuickAccessForm);
}
@@ -293,7 +282,7 @@ namespace ColorControl
chkLgShowAdvancedActions.Checked = _lgService.Config.ShowAdvancedActions;
chkLgSetSelectedDeviceByPowerOn.Checked = _lgService.Config.SetSelectedDeviceByPowerOn;
- InitSortState(lvLgPresets, _config.LgPresetsSortState);
+ FormUtils.InitSortState(lvLgPresets, _config.LgPresetsSortState);
var values = Enum.GetValues(typeof(ButtonType));
foreach (var button in values)
@@ -360,14 +349,6 @@ namespace ColorControl
cbxLgDevices.SelectedIndex = cbxLgDevices.Items.IndexOf(sender);
}
- private void InitSortState(ListView listView, ListViewSortState sortState)
- {
- var sorter = new ListViewColumnSorter();
- sorter.SortColumn = sortState.SortIndex;
- sorter.Order = sortState.SortOrder;
- listView.ListViewItemSorter = sorter;
- }
-
private void Invoke()
{
BeginInvoke(() => ToggleGameBar());
@@ -480,19 +461,6 @@ namespace ColorControl
}
}
- private void FillNvPresets()
- {
- FormUtils.InitListView(lvNvPresets, NvPreset.GetColumnNames());
-
- UpdateDisplayInfoItems();
-
- foreach (var preset in _nvService.GetPresets())
- {
- AddOrUpdateItem(preset);
- Utils.RegisterShortcut(Handle, preset.id, preset.shortcut);
- }
- }
-
private void FillAmdPresets()
{
FormUtils.InitListView(lvAmdPresets, AmdPreset.GetColumnNames());
@@ -517,83 +485,6 @@ namespace ColorControl
}
}
- private void UpdateDisplayInfoItems()
- {
- var displays = _nvService?.GetDisplayInfos();
- if (displays == null || Program.IsRestarting)
- {
- return;
- }
-
- var gpus = new List();
-
- var text = Program.TS_TASKNAME;
- foreach (var displayInfo in displays)
- {
- var display = displayInfo.Display;
-
- var id = Math.Abs((int)display.Handle.MemoryAddress.ToInt64());
-
- ListViewItem item = null;
- for (var i = 0; i < lvNvPresets.Items.Count; i++)
- {
- item = lvNvPresets.Items[i];
-
- if (item.Tag == null && item.ImageIndex == id)
- {
- break;
- }
- item = null;
- }
-
- if (item == null)
- {
- item = lvNvPresets.Items.Add(display.Name);
- item.ImageIndex = id;
- item.Font = new Font(item.Font, item.Font.Style | FontStyle.Bold);
- item.BackColor = Color.LightGray;
- }
-
- var values = displayInfo.Values;
-
- item.Text = values[0];
- for (var i = 1; i < values.Count; i++)
- {
- if (item.SubItems.Count - 1 >= i)
- {
- item.SubItems[i].Text = values[i];
- }
- else
- {
- item.SubItems.Add(values[i]);
- }
- }
-
- text += "\n" + displayInfo.InfoLine;
-
- if (!gpus.Contains(displayInfo.Display.DisplayDevice.PhysicalGPU))
- {
- gpus.Add(displayInfo.Display.DisplayDevice.PhysicalGPU);
- }
- }
-
- UpdateNvGpuInfo(gpus);
-
- FormUtils.SetNotifyIconText(_trayIcon, text);
- }
-
- private void UpdateNvGpuInfo(List gpus = null)
- {
- gpus ??= _nvService.GetGPUs();
-
- cbxNvGPU.Items.Clear();
- cbxNvGPU.Items.AddRange(gpus.ToArray());
- if (cbxNvGPU.Items.Count > 0 && cbxNvGPU.SelectedIndex == -1)
- {
- cbxNvGPU.SelectedIndex = 0;
- }
- }
-
private void UpdateDisplayInfoItemsAmd()
{
var displays = _amdService?.GetDisplayInfos();
@@ -650,11 +541,6 @@ namespace ColorControl
FormUtils.SetNotifyIconText(_trayIcon, text);
}
- private void AddOrUpdateItem(NvPreset preset = null)
- {
- FormUtils.AddOrUpdateListItem(lvNvPresets, _nvService.GetPresets(), _config, preset);
- }
-
private void AddOrUpdateItemAmd(AmdPreset preset = null)
{
FormUtils.AddOrUpdateListItem(lvAmdPresets, _amdService.GetPresets(), _config, preset);
@@ -665,11 +551,6 @@ namespace ColorControl
FormUtils.AddOrUpdateListItem(lvGamePresets, _gameService.GetPresets(), _config, preset);
}
- private void btnApply_Click(object sender, EventArgs e)
- {
- ApplySelectedNvPreset();
- }
-
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (!(SystemShutdown || EndSession || UserExit) && _config.MinimizeOnClose)
@@ -699,46 +580,15 @@ namespace ColorControl
_lgService?.GlobalSave();
_gameService?.GlobalSave();
- SaveSortState(lvNvPresets.ListViewItemSorter, _config.NvPresetsSortState);
- SaveSortState(lvAmdPresets.ListViewItemSorter, _config.AmdPresetsSortState);
- SaveSortState(lvLgPresets.ListViewItemSorter, _config.LgPresetsSortState);
- SaveSortState(lvGamePresets.ListViewItemSorter, _config.GamePresetsSortState);
+ _nvPanel?.Save();
+
+ FormUtils.SaveSortState(lvAmdPresets.ListViewItemSorter, _config.AmdPresetsSortState);
+ FormUtils.SaveSortState(lvLgPresets.ListViewItemSorter, _config.LgPresetsSortState);
+ FormUtils.SaveSortState(lvGamePresets.ListViewItemSorter, _config.GamePresetsSortState);
SaveConfig();
}
- private void SaveSortState(IComparer comparer, ListViewSortState sortState)
- {
- if (!(comparer is ListViewColumnSorter sorter))
- {
- return;
- }
-
- sortState.SortOrder = sorter.Order;
- sortState.SortIndex = sorter.SortColumn;
- }
-
- private void lvNvPresets_SelectedIndexChanged(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
- var enabled = preset != null;
-
- FormUtils.EnableControls(tabNVIDIA, enabled, new List { lvNvPresets, btnAddModesNv, btnChange, edtNvGpuInfo, btnNvSetClocks, btnNvSettings, edtNvOverclock });
-
- if (enabled)
- {
- edtNvPresetName.Text = preset.name;
- edtShortcut.Text = preset.shortcut;
- chkNvShowInQuickAccess.Checked = preset.ShowInQuickAccess;
- }
- else
- {
- edtNvPresetName.Text = string.Empty;
- edtShortcut.Text = string.Empty;
- chkNvShowInQuickAccess.Checked = false;
- }
- }
-
private Control FindFocusedControl()
{
ContainerControl container = this;
@@ -843,42 +693,6 @@ namespace ColorControl
((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e);
}
- private void btnSetShortcut_Click(object sender, EventArgs e)
- {
- var shortcut = edtShortcut.Text.Trim();
-
- if (!Utils.ValidateShortcut(shortcut))
- {
- return;
- }
-
- var preset = GetSelectedNvPreset();
-
- var name = edtNvPresetName.Text.Trim();
-
- if (!string.IsNullOrEmpty(name) && _nvService.GetPresets().Any(x => x.id != preset.id && x.name != null && x.name.Equals(name, StringComparison.OrdinalIgnoreCase)))
- {
- MessageForms.WarningOk("The name must be unique.");
- return;
- }
-
- if (string.IsNullOrEmpty(name) && chkNvShowInQuickAccess.Checked)
- {
- MessageForms.WarningOk("A name must be entered before enabling Quick Access.");
- return;
- }
-
- var clear = !string.IsNullOrEmpty(preset.shortcut);
-
- preset.shortcut = shortcut;
- preset.name = name;
- preset.ShowInQuickAccess = chkNvShowInQuickAccess.Checked;
-
- AddOrUpdateItem();
-
- Utils.RegisterShortcut(Handle, preset.id, preset.shortcut, clear);
- }
-
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
{
// Hide tray icon, otherwise it will remain shown until user mouses over it
@@ -968,31 +782,19 @@ namespace ColorControl
Utils.WriteObject(Program.ConfigFilename, _config);
}
- private void ShowControls(Control parent, bool show = true, Control exclude = null)
- {
- for (var i = 0; i < parent.Controls.Count; i++)
- {
- var control = parent.Controls[i];
- if (control != exclude)
- {
- control.Visible = show;
- }
- }
- }
-
private void MainForm_Shown(object sender, EventArgs e)
{
if (_nvService == null)
{
- ShowControls(tabNVIDIA, false, lblError);
+ //FormUtils.ShowControls(tabNVIDIA, false, lblError);
- lblError.Text = "Error while initializing the NVIDIA-wrapper. You either don't have a NVIDIA GPU or it is disabled. NVIDIA controls will not be available.";
- lblError.Visible = true;
+ //lblError.Text = "Error while initializing the NVIDIA-wrapper. You either don't have a NVIDIA GPU or it is disabled. NVIDIA controls will not be available.";
+ //lblError.Visible = true;
}
if (_amdService == null)
{
- ShowControls(tabAMD, false, lblErrorAMD);
+ FormUtils.ShowControls(tabAMD, false, lblErrorAMD);
lblErrorAMD.Text = "Error while initializing the ADL-wrapper. You either don't have a AMD GPU or it is disabled. AMD controls will not be available.";
lblErrorAMD.Visible = true;
@@ -1000,7 +802,7 @@ namespace ColorControl
if (_lgService == null)
{
- ShowControls(tabLG, false, lblLgError);
+ FormUtils.ShowControls(tabLG, false, lblLgError);
lblLgError.Text = "Error while initializing the LG-controller. You either don't have a LG TV, it is disabled or a configuration file is corrupt.";
lblLgError.Visible = true;
}
@@ -1077,42 +879,6 @@ NOTE: installing the service may cause a User Account Control popup.");
Utils.HandleKeyboardShortcutUp(e);
}
- private void edtShortcut_TextChanged(object sender, EventArgs e)
- {
- var text = edtShortcut.Text;
-
- var preset = GetSelectedNvPreset();
-
- if (preset == null || string.IsNullOrEmpty(text))
- {
- edtShortcut.ForeColor = SystemColors.WindowText;
- }
- else
- {
- edtShortcut.ForeColor = ShortCutExists(text, preset.id) ? Color.Red : SystemColors.WindowText;
- }
- }
-
- private NvPreset GetSelectedNvPreset(bool currentDisplay = false)
- {
- if (lvNvPresets.SelectedItems.Count > 0)
- {
- var item = lvNvPresets.SelectedItems[0];
- var result = (NvPreset)item.Tag;
-
- if (result == null && currentDisplay)
- {
- result = _nvService.GetPresetForDisplay(item.SubItems[1].Text);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
private AmdPreset GetSelectedAmdPreset()
{
if (lvAmdPresets.SelectedItems.Count > 0)
@@ -1139,495 +905,6 @@ NOTE: installing the service may cause a User Account Control popup.");
}
}
- private void btnClone_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- var newPreset = preset.Clone();
- AddOrUpdateItem(newPreset);
- }
-
- private void miNvPresetColorSettings_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyColorData = !preset.applyColorData;
-
- AddOrUpdateItem();
- }
-
- private void miNvPresetApplyDithering_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyDithering = !preset.applyDithering;
-
- AddOrUpdateItem();
- }
-
- private void miNvPresetDitheringEnabled_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
-
- if (preset.IsDisplayPreset)
- {
- miNvPresetDitheringEnabled.Checked = !miNvPresetDitheringEnabled.Checked;
-
- _nvService.SetDithering(miNvPresetDitheringEnabled.Checked ? NvDitherState.Enabled : NvDitherState.Disabled);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.ditheringEnabled = !preset.ditheringEnabled;
-
- AddOrUpdateItem();
- }
-
- private void btnChange_Click(object sender, EventArgs e)
- {
- mnuNvPresets.Show(btnChange, btnChange.PointToClient(Cursor.Position));
- }
-
- private void includedToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyRefreshRate = !preset.applyRefreshRate;
-
- AddOrUpdateItem();
- }
-
- private Font _normalFont;
- private Font _boldFont;
- private Dictionary _menuItemFonts;
-
- private void mnuNvPresets_Opening(object sender, CancelEventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
- var isCurrentDisplay = preset?.IsDisplayPreset == true;
-
- var presetItemsVisible = preset != null && !isCurrentDisplay;
-
- miNvApply.Visible = presetItemsVisible;
- miNvPresetApplyOnStartup.Visible = presetItemsVisible;
- tssNvPresetMenu.Visible = presetItemsVisible;
- mnuNvDisplay.Visible = presetItemsVisible;
- miNvPresetColorSettings.Enabled = presetItemsVisible;
- mnuNvPresetsColorSettings.Enabled = preset != null;
- mnuRefreshRate.Enabled = preset != null;
- mnuNvResolution.Enabled = preset != null;
- miNvPresetDithering.Enabled = preset != null;
- miNvHDR.Enabled = preset != null;
- miNvCopyId.Visible = presetItemsVisible;
- miNvDriverSettingsIncluded.Visible = presetItemsVisible;
- mnuNvDriverSettings.Enabled = preset != null;
- mnuNvOverclocking.Visible = preset != null && _nvService.Config.ShowOverclocking;
-
- if (preset == null)
- {
- return;
- }
-
- _normalFont ??= new Font(mnuNvDriverSettings.Font, FontStyle.Regular);
- _boldFont ??= new Font(_normalFont, FontStyle.Bold);
- _menuItemFonts ??= new Dictionary { { false, _normalFont }, { true, _boldFont } };
-
- miNvPresetApplyOnStartup.Checked = preset.id > 0 && _config.NvPresetId_ApplyOnStartup == preset.id;
-
- miNvPresetApplyDithering.Visible = !isCurrentDisplay;
- miNvPresetColorSettings.Visible = !isCurrentDisplay;
- miNvResolutionIncluded.Visible = !isCurrentDisplay;
- miRefreshRateIncluded.Visible = !isCurrentDisplay;
- miHDRIncluded.Visible = !isCurrentDisplay;
-
- if (mnuNvDisplay.DropDownItems.Count == 1)
- {
- var displays = _nvService.GetDisplays();
- for (var i = 0; i < displays.Length; i++)
- {
- var display = displays[i];
- var name = FormUtils.ExtendedDisplayName(display.Name);
-
- var item = mnuNvDisplay.DropDownItems.Add(name);
- item.Tag = display;
- item.Click += displayMenuItem_Click;
- }
- }
-
- FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Bit depth", typeof(ColorDataDepth), preset.colorData, "ColorDepth", nvPresetColorDataMenuItem_Click);
- FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Format", typeof(ColorDataFormat), preset.colorData, "ColorFormat", nvPresetColorDataMenuItem_Click);
- FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Dynamic range", typeof(ColorDataDynamicRange), preset.colorData, "DynamicRange", nvPresetColorDataMenuItem_Click);
- FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Color space", typeof(ColorDataColorimetry), preset.colorData, "Colorimetry", nvPresetColorDataMenuItem_Click);
-
- BuildNvRefreshRateResolutionMenu(preset);
-
- miNvPrimaryDisplay.Checked = preset.primaryDisplay;
- foreach (var item in mnuNvDisplay.DropDownItems)
- {
- if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
- {
- menuItem.Checked = ((Display)menuItem.Tag).Name.Equals(preset.displayName);
- }
- }
-
- miNvPresetColorSettings.Checked = preset.applyColorData;
- miNvPresetApplyDithering.Checked = preset.applyDithering;
- miNvPresetDitheringEnabled.Checked = preset.ditheringEnabled;
-
- foreach (var item in mnuNvDitheringBitDepth.DropDownItems.OfType())
- {
- if (item.Tag != null)
- {
- item.Checked = uint.Parse(item.Tag.ToString()) == preset.ditheringBits;
- }
- }
- foreach (var item in mnuNvDitheringMode.DropDownItems.OfType())
- {
- if (item.Tag != null)
- {
- item.Checked = uint.Parse(item.Tag.ToString()) == preset.ditheringMode;
- }
- }
-
- miHDRIncluded.Checked = preset.applyHDR;
- miHDREnabled.Checked = preset.HDREnabled;
- miToggleHDR.Checked = preset.toggleHDR;
-
- miNvDriverSettingsIncluded.Checked = preset.applyDriverSettings;
-
- mnuNvPresetsColorSettings.Font = _menuItemFonts[preset.applyColorData];
- mnuRefreshRate.Font = _menuItemFonts[preset.applyRefreshRate];
- mnuNvResolution.Font = _menuItemFonts[preset.applyResolution];
- miNvPresetDithering.Font = _menuItemFonts[preset.applyDithering];
- miNvHDR.Font = _menuItemFonts[preset.applyHDR];
- mnuNvOverclocking.Font = _menuItemFonts[preset.applyOverclocking];
-
- BuildNvOverclockingMenu(preset);
-
- UpdateNvPresetMenuFont();
-
- BuildNvidiaDriverSettingsMenu(mnuNvDriverSettings, isCurrentDisplay ? null : preset.driverSettings);
-
- mnuNvDriverSettings.Font = _menuItemFonts[preset.applyDriverSettings];
- }
-
- private void BuildNvOverclockingMenu(NvPreset preset)
- {
- miNvOverclockingIncluded.Checked = preset.applyOverclocking;
-
- var gpus = _nvService.GetGPUs();
-
- foreach (var gpu in gpus)
- {
- var gpuPciId = gpu.BusInformation.PCIIdentifiers.ToString();
-
- var name = $"{mnuNvOverclocking.Name}_{gpu.GPUId}";
-
- var gpuItem = FormUtils.BuildMenuItem(mnuNvOverclocking.DropDownItems, name, gpu.FullName);
-
- var subName = $"{name}_change";
-
- var ocSettings = preset.ocSettings.FirstOrDefault(s => s.PCIIdentifier == gpuPciId) ?? new NvGpuOcSettings { PCIIdentifier = gpuPciId };
-
- var subText = $"{ocSettings} (click to change)";
-
- var subItem = FormUtils.BuildMenuItem(gpuItem.DropDownItems, subName, subText, ocSettings, nvChangeOverclockingMenuItem_Click);
- }
- }
-
- private void nvChangeOverclockingMenuItem_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- var menuItem = (ToolStripItem)sender;
-
- var currentSettings = (NvGpuOcSettings)menuItem.Tag;
-
- var gpuInfo = NvGpuInfo.GetGpuInfo(currentSettings.PCIIdentifier);
-
- var newSettings = AskNvOcSettings(gpuInfo, currentSettings);
-
- if (newSettings == null)
- {
- return;
- }
-
- preset.UpdateOverclockingSetting(newSettings);
-
- AddOrUpdateItem();
- }
-
- private void BuildNvRefreshRateResolutionMenu(NvPreset preset)
- {
- var displayName = preset.primaryDisplay ? null : preset.displayName;
-
- if (displayName != _lastDisplayRefreshRates)
- {
- while (mnuRefreshRate.DropDownItems.Count > 1)
- {
- mnuRefreshRate.DropDownItems.RemoveAt(mnuRefreshRate.DropDownItems.Count - 1);
- }
- while (mnuNvResolution.DropDownItems.Count > 1)
- {
- mnuNvResolution.DropDownItems.RemoveAt(mnuNvResolution.DropDownItems.Count - 1);
- }
- }
-
- if (mnuRefreshRate.DropDownItems.Count == 1)
- {
- var refreshRates = _nvService.GetAvailableRefreshRates(preset);
- _lastDisplayRefreshRates = displayName;
-
- foreach (var refreshRate in refreshRates)
- {
- var item = mnuRefreshRate.DropDownItems.Add(refreshRate.ToString() + "Hz");
- item.Tag = refreshRate;
- item.Click += refreshRateMenuItem_Click;
- }
- }
-
- if (mnuNvResolution.DropDownItems.Count == 1)
- {
- var modes = _nvService.GetAvailableResolutions(preset);
-
- foreach (var mode in modes)
- {
- var item = mnuNvResolution.DropDownItems.Add($"{mode.dmPelsWidth}x{mode.dmPelsHeight}");
- item.Tag = mode;
- item.Click += resolutionNvMenuItem_Click;
- }
- }
-
- miRefreshRateIncluded.Checked = preset.applyRefreshRate;
- foreach (var item in mnuRefreshRate.DropDownItems)
- {
- if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
- {
- menuItem.Checked = (uint)menuItem.Tag == preset.refreshRate;
- }
- }
-
- miNvResolutionIncluded.Checked = preset.applyResolution;
- foreach (var item in mnuNvResolution.DropDownItems)
- {
- if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
- {
- var mode = (DEVMODEA)menuItem.Tag;
- menuItem.Checked = mode.dmPelsWidth == preset.resolutionWidth && mode.dmPelsHeight == preset.resolutionHeight;
- }
- }
- }
-
- private void UpdateNvPresetMenuFont(bool updateTopItems = false)
- {
- foreach (var menu in mnuNvPresets.Items.OfType().Where(i => i != mnuNvDriverSettings))
- {
- if (updateTopItems)
- {
- menu.Font = _normalFont;
- }
-
- SetMenuFont(menu, _normalFont);
- }
- }
-
- private void SetMenuFont(ToolStripMenuItem menu, Font font)
- {
- foreach (var item in menu.DropDownItems.OfType())
- {
- item.Font = item.Checked ? _boldFont : font;
-
- SetMenuFont(item, font);
- }
- }
-
- private void BuildNvidiaDriverSettingsMenu(ToolStripDropDownItem parent, Dictionary settings = null, ContextMenuStrip contextMenuStrip = null)
- {
- var driverSettings = _nvService.GetVisibleSettings().OrderBy(s => s.GroupName);
- var handledGroupItems = new List();
- var showUnchanged = settings != null;
- var defaultValue = SettingMeta.UnsetDwordValue;
-
- foreach (var driverSetting in driverSettings)
- {
- var groupName = $"mnuNvDriverSettingGroup_{driverSetting.GroupName}";
- var groupItem = FormUtils.BuildMenuItem(contextMenuStrip?.Items ?? parent.DropDownItems, groupName, driverSetting.GroupName);
-
- var itemName = $"mnuNvDriverSettingItem_{driverSetting.SettingText}";
- var item = FormUtils.BuildMenuItem(groupItem.DropDownItems, itemName, driverSetting.SettingText, driverSetting);
- var settingMeta = _nvService.GetSettingMeta(driverSetting.SettingId);
-
- var presetSetting = defaultValue;
- var isDefault = false;
- if (settings != null)
- {
- presetSetting = settings.GetValueOrDefault(driverSetting.SettingId, defaultValue);
- isDefault = presetSetting == defaultValue;
- }
- else
- {
- (presetSetting, isDefault) = settingMeta.ToIntValue(driverSetting.ValueText);
- }
-
- item.Font = _menuItemFonts[!isDefault];
-
- if (!handledGroupItems.Contains(groupItem))
- {
- groupItem.Tag = null;
- handledGroupItems.Add(groupItem);
- }
- if (!isDefault)
- {
- groupItem.Tag = true;
- }
-
- var subItemUnchangedName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_Unchanged";
- var subItemUnchanged = FormUtils.BuildMenuItem(item.DropDownItems, subItemUnchangedName, "Unchanged", onClick: driverSettingValueNvMenuItem_Click);
- subItemUnchanged.Visible = showUnchanged;
-
- if (showUnchanged)
- {
- subItemUnchanged.Checked = presetSetting == defaultValue;
- subItemUnchanged.Font = _menuItemFonts[subItemUnchanged.Checked];
- }
-
- if (driverSetting.SettingId == NvService.DRS_FRAME_RATE_LIMITER_V3)
- {
- var value = settingMeta.DwordValues.FirstOrDefault(v => v.ValueName == driverSetting.ValueText);
-
- var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem";
- var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, "", onClick: driverSettingFrameRateNvMenuItem_Click);
-
- var metaValue = settingMeta.DwordValues.FirstOrDefault(v => v.Value == presetSetting);
- subItem.Text = $"{metaValue?.ValueName ?? "??FPS"} (click to change)";
-
- subItem.Tag = value?.Value ?? 0;
- subItem.Checked = presetSetting != defaultValue;
-
- continue;
- }
-
- if (settingMeta.SettingType == nspector.Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
- {
- foreach (var settingValue in settingMeta.DwordValues)
- {
- var text = settingValue.ValueName;
- if (text.IndexOf(" (") == 10)
- {
- text = text.Substring(0, 10);
- }
-
- var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem_{settingValue.Value}";
- var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, text, settingValue, driverSettingValueNvMenuItem_Click);
-
- subItem.Checked = presetSetting == settingValue.Value;
- subItem.Font = _menuItemFonts[subItem.Checked];
- }
- }
-
- if (settingMeta.SettingType == nspector.Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
- {
- foreach (var settingValue in settingMeta.BinaryValues)
- {
- var text = settingValue.ValueName.Substring(0, 18);
- var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem_{text}";
-
- var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, text, settingValue, driverSettingValueNvMenuItem_Click);
-
- var intValue = BitConverter.ToUInt32(settingValue.Value);
-
- subItem.Checked = presetSetting == intValue;
- subItem.Font = _menuItemFonts[subItem.Checked];
- }
- }
-
- if (item.DropDownItems.Count == 0 || item.DropDownItems.Count == 1 && item.DropDownItems[0].Text == "Unchanged")
- {
- groupItem.DropDownItems.Remove(item);
- }
- }
-
- foreach (var groupItem in handledGroupItems)
- {
- groupItem.Font = _menuItemFonts[groupItem.Tag != null];
- }
- }
-
- private void nvPresetColorDataMenuItem_Click(object sender, EventArgs e)
- {
- var menuItem = (ToolStripMenuItem)sender;
- var property = (PropertyInfo)menuItem.OwnerItem.Tag;
-
- var value = menuItem.Tag;
-
- var preset = GetSelectedNvPreset(true);
-
- var dictionary = new Dictionary
- {
- { "ColorFormat", preset.colorData.ColorFormat },
- { "ColorDepth", preset.colorData.ColorDepth },
- { "Colorimetry", preset.colorData.Colorimetry },
- { "DynamicRange", preset.colorData.DynamicRange },
- { "SelectionPolicy", preset.colorData.SelectionPolicy }
- };
-
- dictionary[property.Name] = value;
-
- var colorData = NvPreset.GenerateColorData(dictionary);
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetColorData(preset.Display, colorData);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.colorData = colorData;
-
- AddOrUpdateItem();
- }
-
- private void refreshRateMenuItem_Click(object sender, EventArgs e)
- {
- var refreshRate = (uint)((ToolStripItem)sender).Tag;
-
- var preset = GetSelectedNvPreset(true);
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetMode(refreshRate: refreshRate);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.refreshRate = refreshRate;
-
- AddOrUpdateItem();
- }
-
- private void resolutionNvMenuItem_Click(object sender, EventArgs e)
- {
- var mode = (DEVMODEA)((ToolStripItem)sender).Tag;
-
- var preset = GetSelectedNvPreset(true);
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetMode(mode.dmPelsWidth, mode.dmPelsHeight);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.resolutionWidth = mode.dmPelsWidth;
- preset.resolutionHeight = mode.dmPelsHeight;
-
- AddOrUpdateItem();
- }
-
private void refreshRateMenuItemAmd_Click(object sender, EventArgs e)
{
var refreshRate = (uint)((ToolStripItem)sender).Tag;
@@ -1639,27 +916,6 @@ NOTE: installing the service may cause a User Account Control popup.");
AddOrUpdateItemAmd();
}
- private void displayMenuItem_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- var menuItem = (ToolStripItem)sender;
- if (menuItem.Tag != null)
- {
- var display = (Display)menuItem.Tag;
-
- preset.displayName = display.Name;
- preset.primaryDisplay = false;
- }
- else
- {
- preset.primaryDisplay = true;
- preset.displayName = null;
- }
-
- AddOrUpdateItem();
- }
-
private void displayMenuItemAmd_Click(object sender, EventArgs e)
{
var preset = GetSelectedAmdPreset();
@@ -1681,56 +937,6 @@ NOTE: installing the service may cause a User Account Control popup.");
AddOrUpdateItemAmd();
}
- private void miHDRIncluded_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyHDR = !preset.applyHDR;
-
- AddOrUpdateItem();
- }
-
- private void miToggleHDR_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetHDRState(preset.Display, !_nvService.IsHDREnabled());
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.toggleHDR = !preset.toggleHDR;
-
- if (preset.toggleHDR)
- {
- preset.HDREnabled = false;
- }
-
- AddOrUpdateItem();
- }
-
- private void miHDREnabled_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
-
- if (preset.IsDisplayPreset)
- {
- miHDREnabled.Checked = !miHDREnabled.Checked;
- _nvService.SetHDRState(preset.Display, miHDREnabled.Checked);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.HDREnabled = !preset.HDREnabled;
- preset.toggleHDR = false;
-
- AddOrUpdateItem();
- }
-
private void FillLgPresets()
{
FormUtils.InitListView(lvLgPresets, LgPreset.GetColumnNames());
@@ -1923,50 +1129,6 @@ NOTE: installing the service may cause a User Account Control popup.");
}
}
- private void btnNvPresetDelete_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- if (preset == null)
- {
- return;
- }
-
- if (!string.IsNullOrEmpty(preset.shortcut))
- {
- WinApi.UnregisterHotKey(Handle, preset.id);
- }
-
- _nvService.GetPresets().Remove(preset);
-
- var item = lvNvPresets.SelectedItems[0];
- lvNvPresets.Items.Remove(item);
- }
-
- private void btnAddModesNv_Click(object sender, EventArgs e)
- {
- var presets = NvPreset.GetDefaultPresets();
- var added = false;
-
- foreach (var preset in presets)
- {
- if (!_nvService.GetPresets().Any(x => x.colorData.Equals(preset.colorData)))
- {
- AddOrUpdateItem(preset);
- added = true;
- }
- }
-
- if (added)
- {
- MessageForms.InfoOk("Missing presets added.");
- }
- else
- {
- MessageForms.InfoOk("All presets for every color setting already exist.");
- }
- }
-
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
InitSelectedTab();
@@ -1992,7 +1154,7 @@ NOTE: installing the service may cause a User Account Control popup.");
}
else if (tcMain.SelectedTab == tabNVIDIA)
{
- UpdateDisplayInfoItems();
+ _nvPanel?.UpdateInfo();
}
else if (tcMain.SelectedTab == tabGameLauncher)
{
@@ -2310,12 +1472,6 @@ NOTE: installing the service may cause a User Account Control popup.");
ApplyLgPreset(preset);
}
- private void ApplySelectedNvPreset()
- {
- var preset = GetSelectedNvPreset();
- ApplyNvPreset(preset);
- }
-
private void ApplySelectedAmdPreset()
{
var preset = GetSelectedAmdPreset();
@@ -2353,10 +1509,6 @@ NOTE: installing the service may cause a User Account Control popup.");
AddOrUpdateItemLg(_lgService.CreateNewPreset());
}
- private void edtDelayDisplaySettings_ValueChanged(object sender, EventArgs e)
- {
- }
-
private bool ApplyNvPreset(NvPreset preset)
{
if (preset == null || _nvService == null)
@@ -2800,7 +1952,7 @@ Do you want to continue?";
{
if (tcMain.SelectedTab == tabNVIDIA)
{
- UpdateDisplayInfoItems();
+ _nvPanel?.UpdateInfo();
}
else if (tcMain.SelectedTab == tabAMD)
{
@@ -2890,48 +2042,6 @@ Do you want to continue?";
ApplyDitheringOptions();
}
- private void miNvDithering6bit_Click(object sender, EventArgs e)
- {
- var item = sender as ToolStripMenuItem;
-
- var preset = GetSelectedNvPreset(true);
-
- var ditheringBits = uint.Parse(item.Tag.ToString());
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetDithering(preset.ditheringEnabled ? NvDitherState.Enabled : NvDitherState.Disabled, ditheringBits, preset.ditheringMode);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.ditheringBits = ditheringBits;
-
- AddOrUpdateItem();
- }
-
- private void spatial1ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var item = sender as ToolStripMenuItem;
-
- var preset = GetSelectedNvPreset(true);
-
- var ditheringMode = uint.Parse(item.Tag.ToString());
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetDithering(preset.ditheringEnabled ? NvDitherState.Enabled : NvDitherState.Disabled, preset.ditheringBits, ditheringMode);
-
- UpdateDisplayInfoItems();
- return;
- }
-
- preset.ditheringMode = ditheringMode;
-
- AddOrUpdateItem();
- }
-
private void AfterInitialized()
{
ApplyNvPresetOnStartup();
@@ -3113,14 +2223,6 @@ Do you want to continue?";
}
}
- private void miNvPresetApplyOnStartup_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
- _config.NvPresetId_ApplyOnStartup = miNvPresetApplyOnStartup.Checked ? preset.id : 0;
-
- AddOrUpdateItem();
- }
-
private void MainForm_Deactivate(object sender, EventArgs e)
{
GlobalSave();
@@ -3464,16 +2566,6 @@ Do you want to continue?";
}
}
- private void miNvCopyId_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- if (preset != null)
- {
- Clipboard.SetText(preset.id.ToString());
- }
- }
-
private void miAmdCopyId_Click(object sender, EventArgs e)
{
var preset = GetSelectedAmdPreset();
@@ -3559,8 +2651,8 @@ Do you want to continue?";
var device = _lgService.GetPresetDevice(preset);
BuildLgActionMenu(device, mnuLgActions.DropDownItems, mnuLgActions.Name, miLgAddAction_Click);
- BuildServicePresetsMenu(mnuLgNvPresets, _nvService, "NVIDIA", miLgAddNvPreset_Click);
- BuildServicePresetsMenu(mnuLgAmdPresets, _amdService, "AMD", miLgAddAmdPreset_Click);
+ FormUtils.BuildServicePresetsMenu(mnuLgNvPresets, _nvService, "NVIDIA", miLgAddNvPreset_Click);
+ FormUtils.BuildServicePresetsMenu(mnuLgAmdPresets, _amdService, "AMD", miLgAddAmdPreset_Click);
}
private void btnLgDeviceConvertToCustom_Click(object sender, EventArgs e)
@@ -3579,27 +2671,6 @@ Do you want to continue?"
FillLgDevices();
}
- private static void BuildServicePresetsMenu(ToolStripMenuItem menu, ServiceBase service, string name, EventHandler eventHandler) where T : PresetBase, new()
- {
- menu.DropDownItems.Clear();
-
- foreach (var nvPreset in service?.GetPresets() ?? new List())
- {
- var text = nvPreset.name;
-
- if (!string.IsNullOrEmpty(text))
- {
- var item = menu.DropDownItems.Add(text);
- item.Tag = nvPreset;
- item.Click += eventHandler;
- }
- }
-
- menu.Visible = service != null;
-
- menu.Text = menu.DropDownItems.Count > 0 ? $"{name} presets" : $"{name} presets (no named presets found)";
- }
-
private void btnLgRemoteControlShow_Click(object sender, EventArgs e)
{
}
@@ -3983,155 +3054,7 @@ The InStart and Software Update items are now visible under the Expert-button."
private void lvLgPresets_ColumnClick(object sender, ColumnClickEventArgs e)
{
- var listView = (ListView)sender;
- var sorter = (ListViewColumnSorter)listView.ListViewItemSorter;
-
- // Determine if clicked column is already the column that is being sorted.
- if (e.Column == sorter.SortColumn)
- {
- //if (sorter.Order == SortOrder.None)
- //{
- // sorter.Order = SortOrder.Ascending;
- //}
- // Reverse the current sort direction for this column.
- if (sorter.Order == SortOrder.Ascending)
- {
- sorter.Order = SortOrder.Descending;
- }
- else
- {
- sorter.Order = SortOrder.Ascending;
- }
- }
- else
- {
- // Set the column number that is to be sorted; default to ascending.
- sorter.SortColumn = e.Column;
- sorter.Order = SortOrder.Ascending;
- }
-
- // Perform the sort with these new sort options.
- listView.Sort();
- }
-
- private void miNvResolutionIncluded_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyResolution = !preset.applyResolution;
-
- AddOrUpdateItem();
- }
-
- private void miNvDriverSettingsIncluded_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyDriverSettings = !preset.applyDriverSettings;
-
- AddOrUpdateItem();
- }
-
- private void driverSettingValueNvMenuItem_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
-
- var menuItem = (ToolStripItem)sender;
- var parentMenuItem = menuItem.OwnerItem as ToolStripMenuItem;
-
- var settingItem = (SettingItem)parentMenuItem.Tag;
-
- if (menuItem.Tag == null)
- {
- if (!preset.IsDisplayPreset)
- {
- preset.ResetDriverSetting(settingItem.SettingId);
- AddOrUpdateItem();
- }
- return;
- }
-
- var intValue = menuItem.Tag is SettingValue intSettingValue ? intSettingValue.Value :
- menuItem.Tag is SettingValue byteSettingValue ? BitConverter.ToUInt32(byteSettingValue.Value) : 0;
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetDriverSetting(settingItem.SettingId, intValue);
-
- UpdateDisplayInfoItems();
-
- return;
- }
-
- preset.UpdateDriverSetting(settingItem, intValue);
-
- AddOrUpdateItem();
- }
-
- private void driverSettingFrameRateNvMenuItem_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset(true);
-
- var menuItem = (ToolStripItem)sender;
- var parentMenuItem = menuItem.OwnerItem as ToolStripMenuItem;
-
- var settingItem = (SettingItem)parentMenuItem.Tag;
-
- var settingMeta = _nvService.GetSettingMeta(settingItem.SettingId);
-
- uint presetValue;
- if (preset.IsDisplayPreset)
- {
- (presetValue, _) = settingMeta.ToIntValue(settingItem.ValueText);
- }
- else
- {
- presetValue = preset.driverSettings.GetValueOrDefault(settingItem.SettingId, settingMeta.DefaultDwordValue);
- }
-
- var settingValue = SelectNvDriverValue(settingMeta, presetValue);
-
- if (settingValue == SettingMeta.UnsetDwordValue)
- {
- return;
- }
-
-
- if (preset.IsDisplayPreset)
- {
- _nvService.SetDriverSetting(settingItem.SettingId, settingValue);
-
- UpdateDisplayInfoItems();
-
- return;
- }
-
- preset.UpdateDriverSetting(settingItem, settingValue);
-
- AddOrUpdateItem();
- }
-
- private uint SelectNvDriverValue(SettingMeta settingMeta, uint currentValue)
- {
- var field = new MessageForms.FieldDefinition
- {
- MinValue = settingMeta.DwordValues.First().Value,
- MaxValue = settingMeta.DwordValues.Last().Value,
- Label = settingMeta.SettingName,
- FieldType = MessageForms.FieldType.Numeric,
- Value = currentValue
- };
-
- var resultFields = MessageForms.ShowDialog(field.Label, new[] { field });
-
- if (!resultFields.Any())
- {
- return SettingMeta.UnsetDwordValue;
- }
-
- var settingValue = (uint)Utils.ParseInt((string)resultFields.First().Value);
-
- return settingValue;
+ FormUtils.ListViewSort(sender, e);
}
private void mnuLgProgram_Click(object sender, EventArgs e)
@@ -4321,9 +3244,9 @@ The InStart and Software Update items are now visible under the Expert-button."
private void mnuGameAddStep_Opening(object sender, CancelEventArgs e)
{
- BuildServicePresetsMenu(mnuGameNvidiaPresets, _nvService, "NVIDIA", miGameAddPreset_Click);
- BuildServicePresetsMenu(mnuGameAmdPresets, _amdService, "AMD", miGameAddPreset_Click);
- BuildServicePresetsMenu(mnuGameLgPresets, _lgService, "LG", miGameAddPreset_Click);
+ FormUtils.BuildServicePresetsMenu(mnuGameNvidiaPresets, _nvService, "NVIDIA", miGameAddPreset_Click);
+ FormUtils.BuildServicePresetsMenu(mnuGameAmdPresets, _amdService, "AMD", miGameAddPreset_Click);
+ FormUtils.BuildServicePresetsMenu(mnuGameLgPresets, _lgService, "LG", miGameAddPreset_Click);
}
private void miGameAddPreset_Click(object sender, EventArgs e)
@@ -4374,30 +3297,12 @@ The InStart and Software Update items are now visible under the Expert-button."
private void mnuGameNvInspector_Click(object sender, EventArgs e)
{
- StartNvProfileInspector();
+ _nvPanel?.StartNvProfileInspector();
}
- private string EditShortcut(string shortcut, string label = "Shortcut", string title = null)
- {
- var field = new MessageForms.FieldDefinition
- {
- Label = label,
- FieldType = MessageForms.FieldType.Shortcut,
- Value = shortcut
- };
- var values = MessageForms.ShowDialog(title ?? "Set shortcut", new[] { field });
- if (!values.Any())
- {
- return null;
- }
-
- return values.First().Value.ToString();
- }
-
-
private void miGameSetQuickAccessShortcut_Click(object sender, EventArgs e)
{
- var shortcut = EditShortcut(_config.GameQuickAccessShortcut);
+ var shortcut = FormUtils.EditShortcut(_config.GameQuickAccessShortcut);
if (shortcut == null)
{
@@ -4411,13 +3316,9 @@ The InStart and Software Update items are now visible under the Expert-button."
Utils.RegisterShortcut(Handle, SHORTCUTID_GAMEQA, _config.GameQuickAccessShortcut, clear);
}
- private void btnNvSetQuickAccessShortcut_Click(object sender, EventArgs e)
- {
- }
-
private void btnLgSettings_Click(object sender, EventArgs e)
{
- var shortcut = EditShortcut(_config.LgQuickAccessShortcut, "Quick Access shortcut", "LG controller settings");
+ var shortcut = FormUtils.EditShortcut(_config.LgQuickAccessShortcut, "Quick Access shortcut", "LG controller settings");
if (shortcut == null)
{
@@ -4436,101 +3337,14 @@ The InStart and Software Update items are now visible under the Expert-button."
mnuGameNvInspector.Visible = _nvService != null;
}
- private void miNvProfileInspector_Click(object sender, EventArgs e)
- {
- StartNvProfileInspector();
- }
-
- private void StartNvProfileInspector()
- {
- var form = new frmDrvSettings();
- form.Show();
- }
-
- private void miNvSettings_Click(object sender, EventArgs e)
- {
- EditNvSettings();
- }
-
- private void EditNvSettings()
- {
- var values = MessageForms.ShowDialog("NVIDIA controller settings", new[] {
- new MessageForms.FieldDefinition
- {
- Label = "Quick Access shortcut",
- FieldType = MessageForms.FieldType.Shortcut,
- Value = _config.NvQuickAccessShortcut
- },
- new MessageForms.FieldDefinition
- {
- Label = "Enable overclocking",
- FieldType = MessageForms.FieldType.CheckBox,
- Value = _nvService.Config.ShowOverclocking
- }
- });
- if (!values.Any())
- {
- return;
- }
-
- var shortcut = values[0].Value.ToString();
- var enableOc = (bool)values[1].Value;
-
- var clear = !string.IsNullOrEmpty(_config.NvQuickAccessShortcut);
-
- _config.NvQuickAccessShortcut = shortcut;
-
- Utils.RegisterShortcut(Handle, SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, clear);
-
- _nvService.Config.ShowOverclocking = enableOc;
- }
-
-
- private void btnNvSettings_Click(object sender, EventArgs e)
- {
- mnuNvSettings.Show(btnNvSettings, btnNvSettings.PointToClient(Cursor.Position));
- }
-
private void lvGamePresets_ItemChecked(object sender, ItemCheckedEventArgs e)
{
- ListViewItemChecked(lvGamePresets, e);
- }
-
- private void ListViewItemChecked(ListView listView, ItemCheckedEventArgs e) where T : PresetBase
- {
- var checkedPreset = (T)e.Item.Tag;
-
- if (checkedPreset == null || checkedPreset.ShowInQuickAccess == e.Item.Checked)
- {
- return;
- }
-
- var point = listView.PointToClient(Cursor.Position);
-
- if (point.X >= 20)
- {
- e.Item.Checked = !e.Item.Checked;
- return;
- }
-
- checkedPreset.ShowInQuickAccess = e.Item.Checked;
-
- var preset = listView.GetSelectedItemTag();
-
- if (preset == checkedPreset)
- {
- listView.FireEvent("SelectedIndexChanged", listView, e);
- }
- }
-
- private void lvNvPresets_ItemChecked(object sender, ItemCheckedEventArgs e)
- {
- ListViewItemChecked(lvNvPresets, e);
+ FormUtils.ListViewItemChecked(lvGamePresets, e);
}
private void lvLgPresets_ItemChecked(object sender, ItemCheckedEventArgs e)
{
- ListViewItemChecked(lvLgPresets, e);
+ FormUtils.ListViewItemChecked(lvLgPresets, e);
}
private void lvNvPresets_ItemCheck(object sender, ItemCheckEventArgs e)
@@ -4567,12 +3381,12 @@ The InStart and Software Update items are now visible under the Expert-button."
private void lvAmdPresets_ItemChecked(object sender, ItemCheckedEventArgs e)
{
- ListViewItemChecked(lvAmdPresets, e);
+ FormUtils.ListViewItemChecked(lvAmdPresets, e);
}
private void btnAmdSettings_Click(object sender, EventArgs e)
{
- var shortcut = EditShortcut(_config.AmdQuickAccessShortcut, "Quick Access shortcut", "AMD controller settings");
+ var shortcut = FormUtils.EditShortcut(_config.AmdQuickAccessShortcut, "Quick Access shortcut", "AMD controller settings");
if (shortcut == null)
{
@@ -4892,421 +3706,5 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad
UpdateDitherSettings();
}
-
- private ListViewItem _lastItem;
- private int _lastSubItemIndex;
-
- private void lvNvPresets_MouseMove(object sender, MouseEventArgs e)
- {
- var item = lvNvPresets.GetItemAt(e.X, e.Y);
- var subItem = item?.GetSubItemAt(e.X, e.Y);
-
- if (item == null || subItem == null || subItem?.Text?.Length < 20)
- {
- lvNvPresetsToolTip.Active = false;
- _lastItem = null;
-
- return;
- }
-
- var index = item.SubItems.IndexOf(subItem);
-
- lvNvPresets.ShowItemToolTips = false;
-
- if (item == _lastItem && index == _lastSubItemIndex)
- {
- return;
- }
-
- _lastItem = item;
- _lastSubItemIndex = index;
-
- var text = subItem.Text;
-
- if (index == 7)
- {
- text = text.Replace(", ", "\r\n");
- }
-
- var point = lvNvPresets.PointToClient(Cursor.Position);
- point.X += 10;
- point.Y += 0;
-
- lvNvPresetsToolTip.Active = false;
- if (index >= 0)
- {
- lvNvPresetsToolTip.Active = true;
- lvNvPresetsToolTip.Show("", lvNvPresets, point);
- lvNvPresetsToolTip.Show(text, lvNvPresets, point);
- }
- }
-
- private void lvNvPresets_MouseLeave(object sender, EventArgs e)
- {
- lvNvPresetsToolTip.Active = false;
- }
-
- private void btnNvSetClocks_Click(object sender, EventArgs e)
- {
- var gpu = cbxNvGPU.SelectedItem as PhysicalGPU;
-
- if (gpu == null)
- {
- return;
- }
-
- var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
- var currentSettings = gpuInfo.GetOverclockSettings();
-
- var newSettings = AskNvOcSettings(gpuInfo, currentSettings);
-
- if (newSettings == null)
- {
- return;
- }
-
- _nvService.ApplyOverclocking(newSettings);
-
- UpdateNvGpuInfo();
- }
-
- public NvGpuOcSettings AskNvOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
- {
- var overclockTypes = Utils.GetDescriptions();
-
- var values = MessageForms.ShowDialog("Choose desired overclock settings", new[] {
- new MessageForms.FieldDefinition
- {
- Label = "Overclock method",
- FieldType = MessageForms.FieldType.DropDown,
- Values = overclockTypes,
- Value = currentSettings.Type
- } });
- if (!values.Any())
- {
- return null;
- }
-
- var overclockType = Enum.Parse(values[0].Value.ToString());
- var newSettings = default(NvGpuOcSettings);
-
- if (overclockType == NvGpuOcType.Curve)
- {
- newSettings = AskNvCurveOcSettings(gpuInfo, currentSettings);
- }
- else if (overclockType == NvGpuOcType.Offset)
- {
- newSettings = AskNvOffsetOcSettings(gpuInfo, currentSettings);
- }
- else
- {
- newSettings = new NvGpuOcSettings
- {
- Type = overclockType,
- PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
- };
- }
-
- return newSettings;
- }
-
- public NvGpuOcSettings AskNvCurveOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
- {
- var nvOverclockSettings = new NvGpuOcSettings
- {
- Type = NvGpuOcType.Curve,
- PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
- };
-
- var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
-
- var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
-
- var minCurveFreq = curveEntries.Max(e => e.DefaultFrequencyInkHz) + graphicsDelta.Item1;
- var freqValues = curveEntries
- .Where(e => e.DefaultFrequencyInkHz == 0 || e.DefaultFrequencyInkHz >= minCurveFreq)
- .Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct()
- .OrderBy(x => x)
- .ToList();
- var voltValues = curveEntries
- .Where(e => e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq)
- .OrderBy(e => e.DefaultVoltageInMicroV)
- .Select(e => (e.DefaultVoltageInMicroV / 1000).ToString())
- .Distinct()
- .ToList();
-
- var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000;
-
- var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
- var currentGpuFreq = curveEntry.FrequencyInkHz;
-
- var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
-
- var powerLimits = gpuInfo.GetPowerLimits();
-
- var defaultPowerLimitMw = gpuInfo.DefaultPowerInMilliWatts;
-
- var powerField = defaultPowerLimitMw > 0 ?
- new MessageForms.FieldDefinition
- {
- Label = $"Power limit in milli watts. Min: {gpuInfo.MinPowerInMilliWatts}, max: {gpuInfo.MaxPowerInMilliWatts}",
- FieldType = MessageForms.FieldType.TrackBar,
- Value = (int)((decimal)defaultPowerLimitMw / 100000 * currentSettings.PowerPCM),
- MinValue = gpuInfo.MinPowerInMilliWatts,
- MaxValue = gpuInfo.MaxPowerInMilliWatts
- }
- : new MessageForms.FieldDefinition
- {
- Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
- FieldType = MessageForms.FieldType.TrackBar,
- Value = currentSettings.PowerPCM,
- MinValue = powerLimits.Item1,
- MaxValue = powerLimits.Item2
- };
-
- var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
- new MessageForms.FieldDefinition
- {
- Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = graphicsDelta.Item1 / 1000,
- MaxValue = graphicsDelta.Item2 / 1000,
- Value = currentSettings.GraphicsOffsetKHz / 1000
- },
- new MessageForms.FieldDefinition
- {
- Label = "Optional undervolt: maximum voltage in milli volt",
- FieldType = MessageForms.FieldType.DropDown,
- Value = currentSettings.MaximumVoltageUv / 1000,
- Values = voltValues,
- },
- new MessageForms.FieldDefinition
- {
- Label = "Optional undervolt: maximum core frequency in MHz",
- FieldType = MessageForms.FieldType.DropDown,
- Value = currentSettings.MaximumFrequencyKHz / 1000,
- Values = freqValues,
- },
- new MessageForms.FieldDefinition
- {
- Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = memoryDelta.Item1 / 1000,
- MaxValue = memoryDelta.Item2 / 1000,
- Value = currentSettings.MemoryOffsetKHz / 1000
- },
- new MessageForms.FieldDefinition
- {
- Label = "Voltage boost in %",
- FieldType = MessageForms.FieldType.Numeric,
- Value = currentSettings.VoltageBoostPercent,
- MinValue = 0,
- MaxValue = 100
- },
- powerField,
- });
- if (!values.Any())
- {
- return null;
- }
-
- nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000;
- nvOverclockSettings.MaximumVoltageUv = values[1].ValueAsUInt * 1000;
- nvOverclockSettings.MaximumFrequencyKHz = values[2].ValueAsUInt * 1000;
- nvOverclockSettings.MemoryOffsetKHz = values[3].ValueAsInt * 1000;
- nvOverclockSettings.VoltageBoostPercent = values[4].ValueAsUInt;
-
- var power = values[5].ValueAsUInt;
-
- nvOverclockSettings.PowerPCM = defaultPowerLimitMw > 0 ? (uint)((decimal)power / defaultPowerLimitMw * 100000) : power;
-
- return nvOverclockSettings;
- }
-
- public NvGpuOcSettings AskNvOffsetOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
- {
- var nvOverclockSettings = new NvGpuOcSettings
- {
- Type = NvGpuOcType.Offset,
- PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
- };
-
- var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
-
- var freqValues = curveEntries.Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct().ToList();
- var voltValues = curveEntries.Select(e => (e.DefaultVoltageInMicroV / 1000).ToString()).Distinct().ToList();
-
- var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000;
-
- var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
- var currentGpuFreq = curveEntry.FrequencyInkHz;
-
- var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
- var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
-
- var powerLimits = gpuInfo.GetPowerLimits();
-
- var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
- new MessageForms.FieldDefinition
- {
- Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = graphicsDelta.Item1 / 1000,
- MaxValue = graphicsDelta.Item2 / 1000,
- Value = currentSettings.GraphicsOffsetKHz / 1000
- },
- new MessageForms.FieldDefinition
- {
- Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = memoryDelta.Item1 / 1000,
- MaxValue = memoryDelta.Item2 / 1000,
- Value = currentSettings.MemoryOffsetKHz / 1000
- },
- new MessageForms.FieldDefinition
- {
- Label = "Voltage boost in %",
- FieldType = MessageForms.FieldType.Numeric,
- Value = currentSettings.VoltageBoostPercent,
- MinValue = 0,
- MaxValue = 100
- },
- new MessageForms.FieldDefinition
- {
- Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
- FieldType = MessageForms.FieldType.Numeric,
- Value = currentSettings.PowerPCM,
- MinValue = powerLimits.Item1,
- MaxValue = powerLimits.Item2
- },
- });
- if (!values.Any())
- {
- return null;
- }
-
- nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000;
- nvOverclockSettings.MemoryOffsetKHz = values[1].ValueAsInt * 1000;
- nvOverclockSettings.VoltageBoostPercent = values[2].ValueAsUInt;
- nvOverclockSettings.PowerPCM = values[3].ValueAsUInt;
-
- return nvOverclockSettings;
- }
-
- public void SetClocks()
- {
- var gpu = cbxNvGPU.SelectedItem as PhysicalGPU;
-
- var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
-
- var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
-
- var freqValues = curveEntries.Select(e => e.DefaultFrequencyInkHz.ToString()).Distinct().ToList();
- var voltValues = curveEntries.Select(e => e.DefaultVoltageInMicroV.ToString()).Distinct().ToList();
-
- var lockedGraphics = gpuInfo.GetLockedBoost(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
-
- var currentGraphicsVoltage = lockedGraphics.Item1 > 0 ? lockedGraphics.Item1 : 1050000;
-
- var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
- var currentGpuFreq = curveEntry.FrequencyInkHz;
-
- var graphicsDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
- var memoryDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
-
- var graphicsMinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000;
- var graphicsMaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000;
- var memoryMinValue = memoryDelta?.DeltaRange.Minimum ?? -502000;
- var memoryMaxValue = memoryDelta?.DeltaRange.Maximum ?? 3000000;
-
- var currentGraphicsOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
- var currentMemoryOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
-
- var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
- new MessageForms.FieldDefinition
- {
- Label = $"Core offset in MHz ({graphicsMinValue}KHz to {graphicsMaxValue}KHz)",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000,
- MaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000,
- Value = currentGraphicsOffset
- },
- new MessageForms.FieldDefinition
- {
- Label = "Voltage in micro volt",
- FieldType = MessageForms.FieldType.DropDown,
- Values = voltValues,
- //FieldType = MessageForms.FieldType.Numeric,
- //MinValue = 650000,
- //MaxValue = 1100000,
- //Value = currentGraphicsVoltage
- },
- new MessageForms.FieldDefinition
- {
- Label = "Core frequency in KHz",
- FieldType = MessageForms.FieldType.DropDown,
- Values = freqValues,
- //FieldType = MessageForms.FieldType.Numeric,
- //MinValue = 2000000,
- //MaxValue = 3200000,
- //Value = currentGpuFreq
- },
- new MessageForms.FieldDefinition
- {
- Label = $"Memory offset in KHz ({memoryMinValue}KHz to {memoryMaxValue}KHz)",
- FieldType = MessageForms.FieldType.Numeric,
- MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000,
- MaxValue = 2500000,
- Value = currentMemoryOffset
- },
- });
- if (!values.Any())
- {
- return;
- }
-
- var voltage = (uint)values[0].ValueAsInt;
- //var coreOffset = values[1].ValueAsInt;
- var coreFreq = values[1].ValueAsInt;
- var memoryOffset = values[2].ValueAsInt;
-
- var normalized = (coreFreq / 15000) * 15000;
- var newCurveEntryFreq = curveEntries.FirstOrDefault(e => e.DefaultFrequencyInkHz == normalized);
- var newCurveEntryVolt = curveEntries.FirstOrDefault(e => e.DefaultVoltageInMicroV == voltage);
-
- var coreOffset = (int)(newCurveEntryFreq.DefaultFrequencyInkHz - newCurveEntryVolt.DefaultFrequencyInkHz);
-
- gpuInfo.SetGpuClocks(voltage, coreOffset, memoryOffset);
- }
-
- private void miNvOverclockingIncluded_Click(object sender, EventArgs e)
- {
- var preset = GetSelectedNvPreset();
-
- preset.applyOverclocking = !preset.applyOverclocking;
-
- AddOrUpdateItem();
- }
-
- private void cbxNvGPU_SelectedIndexChanged(object sender, EventArgs e)
- {
- RefreshNvGpuInfo();
- }
-
- private void RefreshNvGpuInfo()
- {
- var gpu = (PhysicalGPU)cbxNvGPU.SelectedItem;
-
- if (gpu == null)
- {
- return;
- }
-
- var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
- var ocSettings = gpuInfo.GetOverclockSettings();
-
- edtNvGpuInfo.Text = gpuInfo.ToString();
- edtNvOverclock.Text = ocSettings.ToString();
- }
}
}
\ No newline at end of file
diff --git a/ColorControl/MainForm.resx b/ColorControl/MainForm.resx
index 79cba9e..3f8ac07 100644
--- a/ColorControl/MainForm.resx
+++ b/ColorControl/MainForm.resx
@@ -57,9 +57,6 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 17, 17
-
278, 17
@@ -78,9 +75,6 @@
416, 50
-
- 10, 47
-
590, 47
diff --git a/ColorControl/Services/NVIDIA/NvPanel.Designer.cs b/ColorControl/Services/NVIDIA/NvPanel.Designer.cs
new file mode 100644
index 0000000..62d85ef
--- /dev/null
+++ b/ColorControl/Services/NVIDIA/NvPanel.Designer.cs
@@ -0,0 +1,767 @@
+
+namespace ColorControl.Services.NVIDIA
+{
+ partial class NvPanel
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
+ this.lblNvOverclock = new System.Windows.Forms.Label();
+ this.edtNvOverclock = new System.Windows.Forms.TextBox();
+ this.btnNvSetClocks = new System.Windows.Forms.Button();
+ this.lblNvGpuInfo = new System.Windows.Forms.Label();
+ this.edtNvGpuInfo = new System.Windows.Forms.TextBox();
+ this.lblNvGPU = new System.Windows.Forms.Label();
+ this.cbxNvGPU = new System.Windows.Forms.ComboBox();
+ this.btnNvSettings = new System.Windows.Forms.Button();
+ this.chkNvShowInQuickAccess = new System.Windows.Forms.CheckBox();
+ this.lblNvPresetName = new System.Windows.Forms.Label();
+ this.edtNvPresetName = new System.Windows.Forms.TextBox();
+ this.btnAddModesNv = new System.Windows.Forms.Button();
+ this.btnNvPresetDelete = new System.Windows.Forms.Button();
+ this.lblError = new System.Windows.Forms.Label();
+ this.btnClone = new System.Windows.Forms.Button();
+ this.btnNvPresetSave = new System.Windows.Forms.Button();
+ this.lblShortcut = new System.Windows.Forms.Label();
+ this.edtShortcut = new System.Windows.Forms.TextBox();
+ this.btnChange = new System.Windows.Forms.Button();
+ this.mnuNvPresets = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.miNvApply = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPresetApplyOnStartup = new System.Windows.Forms.ToolStripMenuItem();
+ this.tssNvPresetMenu = new System.Windows.Forms.ToolStripSeparator();
+ this.mnuNvDisplay = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPrimaryDisplay = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvPresetsColorSettings = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPresetColorSettings = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuRefreshRate = new System.Windows.Forms.ToolStripMenuItem();
+ this.miRefreshRateIncluded = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvResolution = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvResolutionIncluded = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPresetDithering = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPresetApplyDithering = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvPresetDitheringEnabled = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvDitheringBitDepth = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvDithering6bit = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvDithering8bit = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvDithering10bit = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvDitheringMode = new System.Windows.Forms.ToolStripMenuItem();
+ this.spatial1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.spatial2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.spatialDynamic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.spatialStatic2x2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.temporalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvHDR = new System.Windows.Forms.ToolStripMenuItem();
+ this.miHDRIncluded = new System.Windows.Forms.ToolStripMenuItem();
+ this.miToggleHDR = new System.Windows.Forms.ToolStripMenuItem();
+ this.miHDREnabled = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvDriverSettings = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvDriverSettingsIncluded = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnuNvOverclocking = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvOverclockingIncluded = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvCopyId = new System.Windows.Forms.ToolStripMenuItem();
+ this.btnApply = new System.Windows.Forms.Button();
+ this.lvNvPresets = new System.Windows.Forms.ListView();
+ this.mnuNvSettings = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.miNvProfileInspector = new System.Windows.Forms.ToolStripMenuItem();
+ this.miNvSettings = new System.Windows.Forms.ToolStripMenuItem();
+ this.lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(this.components);
+
+ this.mnuNvPresets.SuspendLayout();
+ this.mnuNvSettings.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // NvPanel
+ //
+
+ this.Controls.Add(this.lblNvOverclock);
+ this.Controls.Add(this.edtNvOverclock);
+ this.Controls.Add(this.btnNvSetClocks);
+ this.Controls.Add(this.lblNvGpuInfo);
+ this.Controls.Add(this.edtNvGpuInfo);
+ this.Controls.Add(this.lblNvGPU);
+ this.Controls.Add(this.cbxNvGPU);
+ this.Controls.Add(this.btnNvSettings);
+ this.Controls.Add(this.chkNvShowInQuickAccess);
+ this.Controls.Add(this.lblNvPresetName);
+ this.Controls.Add(this.edtNvPresetName);
+ this.Controls.Add(this.btnAddModesNv);
+ this.Controls.Add(this.btnNvPresetDelete);
+ this.Controls.Add(this.lblError);
+ this.Controls.Add(this.btnClone);
+ this.Controls.Add(this.btnNvPresetSave);
+ this.Controls.Add(this.lblShortcut);
+ this.Controls.Add(this.edtShortcut);
+ this.Controls.Add(this.btnChange);
+ this.Controls.Add(this.btnApply);
+ this.Controls.Add(this.lvNvPresets);
+
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.White;
+ this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.Name = "NvPanel";
+ this.Size = new System.Drawing.Size(1114, 539);
+ this.Load += new System.EventHandler(this.RemoteControlPanel_Load);
+
+ //
+ // lblNvOverclock
+ //
+ this.lblNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lblNvOverclock.AutoSize = true;
+ this.lblNvOverclock.Location = new System.Drawing.Point(578, 496);
+ this.lblNvOverclock.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblNvOverclock.Name = "lblNvOverclock";
+ this.lblNvOverclock.Size = new System.Drawing.Size(51, 15);
+ this.lblNvOverclock.TabIndex = 66;
+ this.lblNvOverclock.Text = "OC info:";
+ //
+ // edtNvOverclock
+ //
+ this.edtNvOverclock.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.edtNvOverclock.Enabled = false;
+ this.edtNvOverclock.Location = new System.Drawing.Point(648, 493);
+ this.edtNvOverclock.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.edtNvOverclock.Name = "edtNvOverclock";
+ this.edtNvOverclock.Size = new System.Drawing.Size(457, 23);
+ this.edtNvOverclock.TabIndex = 65;
+ //
+ // btnNvSetClocks
+ //
+ this.btnNvSetClocks.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnNvSetClocks.Location = new System.Drawing.Point(868, 433);
+ this.btnNvSetClocks.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnNvSetClocks.Name = "btnNvSetClocks";
+ this.btnNvSetClocks.Size = new System.Drawing.Size(88, 27);
+ this.btnNvSetClocks.TabIndex = 64;
+ this.btnNvSetClocks.Text = "Change...";
+ this.btnNvSetClocks.UseVisualStyleBackColor = true;
+ this.btnNvSetClocks.Click += new System.EventHandler(this.btnNvSetClocks_Click);
+ //
+ // lblNvGpuInfo
+ //
+ this.lblNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lblNvGpuInfo.AutoSize = true;
+ this.lblNvGpuInfo.Location = new System.Drawing.Point(578, 469);
+ this.lblNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblNvGpuInfo.Name = "lblNvGpuInfo";
+ this.lblNvGpuInfo.Size = new System.Drawing.Size(31, 15);
+ this.lblNvGpuInfo.TabIndex = 63;
+ this.lblNvGpuInfo.Text = "Info:";
+ //
+ // edtNvGpuInfo
+ //
+ this.edtNvGpuInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.edtNvGpuInfo.Enabled = false;
+ this.edtNvGpuInfo.Location = new System.Drawing.Point(648, 466);
+ this.edtNvGpuInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.edtNvGpuInfo.Name = "edtNvGpuInfo";
+ this.edtNvGpuInfo.Size = new System.Drawing.Size(457, 23);
+ this.edtNvGpuInfo.TabIndex = 62;
+ //
+ // lblNvGPU
+ //
+ this.lblNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lblNvGPU.AutoSize = true;
+ this.lblNvGPU.Location = new System.Drawing.Point(578, 439);
+ this.lblNvGPU.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblNvGPU.Name = "lblNvGPU";
+ this.lblNvGPU.Size = new System.Drawing.Size(33, 15);
+ this.lblNvGPU.TabIndex = 61;
+ this.lblNvGPU.Text = "GPU:";
+ //
+ // cbxNvGPU
+ //
+ this.cbxNvGPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.cbxNvGPU.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cbxNvGPU.FormattingEnabled = true;
+ this.cbxNvGPU.Location = new System.Drawing.Point(648, 436);
+ this.cbxNvGPU.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.cbxNvGPU.Name = "cbxNvGPU";
+ this.cbxNvGPU.Size = new System.Drawing.Size(212, 23);
+ this.cbxNvGPU.TabIndex = 60;
+ this.cbxNvGPU.SelectedIndexChanged += new System.EventHandler(this.cbxNvGPU_SelectedIndexChanged);
+ //
+ // btnNvSettings
+ //
+ this.btnNvSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnNvSettings.Location = new System.Drawing.Point(1017, 428);
+ this.btnNvSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnNvSettings.Name = "btnNvSettings";
+ this.btnNvSettings.Size = new System.Drawing.Size(88, 27);
+ this.btnNvSettings.TabIndex = 59;
+ this.btnNvSettings.Text = "Settings...";
+ this.btnNvSettings.UseVisualStyleBackColor = true;
+ this.btnNvSettings.Click += new System.EventHandler(this.btnNvSettings_Click);
+ //
+ // chkNvShowInQuickAccess
+ //
+ this.chkNvShowInQuickAccess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.chkNvShowInQuickAccess.AutoSize = true;
+ this.chkNvShowInQuickAccess.Enabled = false;
+ this.chkNvShowInQuickAccess.Location = new System.Drawing.Point(343, 465);
+ this.chkNvShowInQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.chkNvShowInQuickAccess.Name = "chkNvShowInQuickAccess";
+ this.chkNvShowInQuickAccess.Size = new System.Drawing.Size(141, 19);
+ this.chkNvShowInQuickAccess.TabIndex = 45;
+ this.chkNvShowInQuickAccess.Text = "Show in Quick Access";
+ this.chkNvShowInQuickAccess.UseVisualStyleBackColor = true;
+ //
+ // lblNvPresetName
+ //
+ this.lblNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lblNvPresetName.AutoSize = true;
+ this.lblNvPresetName.Location = new System.Drawing.Point(7, 466);
+ this.lblNvPresetName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblNvPresetName.Name = "lblNvPresetName";
+ this.lblNvPresetName.Size = new System.Drawing.Size(42, 15);
+ this.lblNvPresetName.TabIndex = 22;
+ this.lblNvPresetName.Text = "Name:";
+ //
+ // edtNvPresetName
+ //
+ this.edtNvPresetName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.edtNvPresetName.Enabled = false;
+ this.edtNvPresetName.Location = new System.Drawing.Point(102, 463);
+ this.edtNvPresetName.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.edtNvPresetName.Name = "edtNvPresetName";
+ this.edtNvPresetName.Size = new System.Drawing.Size(233, 23);
+ this.edtNvPresetName.TabIndex = 21;
+ //
+ // btnAddModesNv
+ //
+ this.btnAddModesNv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnAddModesNv.Location = new System.Drawing.Point(385, 429);
+ this.btnAddModesNv.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnAddModesNv.Name = "btnAddModesNv";
+ this.btnAddModesNv.Size = new System.Drawing.Size(88, 27);
+ this.btnAddModesNv.TabIndex = 9;
+ this.btnAddModesNv.Text = "Add modes";
+ this.btnAddModesNv.UseVisualStyleBackColor = true;
+ this.btnAddModesNv.Click += new System.EventHandler(this.btnAddModesNv_Click);
+ //
+ // btnNvPresetDelete
+ //
+ this.btnNvPresetDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnNvPresetDelete.Enabled = false;
+ this.btnNvPresetDelete.Location = new System.Drawing.Point(290, 429);
+ this.btnNvPresetDelete.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnNvPresetDelete.Name = "btnNvPresetDelete";
+ this.btnNvPresetDelete.Size = new System.Drawing.Size(88, 27);
+ this.btnNvPresetDelete.TabIndex = 8;
+ this.btnNvPresetDelete.Text = "Delete";
+ this.btnNvPresetDelete.UseVisualStyleBackColor = true;
+ this.btnNvPresetDelete.Click += new System.EventHandler(this.btnNvPresetDelete_Click);
+ //
+ // lblError
+ //
+ this.lblError.AutoSize = true;
+ this.lblError.Location = new System.Drawing.Point(7, 7);
+ this.lblError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblError.Name = "lblError";
+ this.lblError.Size = new System.Drawing.Size(53, 15);
+ this.lblError.TabIndex = 7;
+ this.lblError.Text = "ErrorText";
+ this.lblError.Visible = false;
+ //
+ // btnClone
+ //
+ this.btnClone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnClone.Enabled = false;
+ this.btnClone.Location = new System.Drawing.Point(196, 429);
+ this.btnClone.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnClone.Name = "btnClone";
+ this.btnClone.Size = new System.Drawing.Size(88, 27);
+ this.btnClone.TabIndex = 6;
+ this.btnClone.Text = "Clone";
+ this.btnClone.UseVisualStyleBackColor = true;
+ this.btnClone.Click += new System.EventHandler(this.btnClone_Click);
+ //
+ // btnNvPresetSave
+ //
+ this.btnNvPresetSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnNvPresetSave.Enabled = false;
+ this.btnNvPresetSave.Location = new System.Drawing.Point(479, 429);
+ this.btnNvPresetSave.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnNvPresetSave.Name = "btnNvPresetSave";
+ this.btnNvPresetSave.Size = new System.Drawing.Size(88, 27);
+ this.btnNvPresetSave.TabIndex = 5;
+ this.btnNvPresetSave.Text = "Save";
+ this.btnNvPresetSave.UseVisualStyleBackColor = true;
+ this.btnNvPresetSave.Click += new System.EventHandler(this.btnSetShortcut_Click);
+ //
+ // lblShortcut
+ //
+ this.lblShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lblShortcut.AutoSize = true;
+ this.lblShortcut.Location = new System.Drawing.Point(7, 496);
+ this.lblShortcut.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblShortcut.Name = "lblShortcut";
+ this.lblShortcut.Size = new System.Drawing.Size(55, 15);
+ this.lblShortcut.TabIndex = 4;
+ this.lblShortcut.Text = "Shortcut:";
+ //
+ // edtShortcut
+ //
+ this.edtShortcut.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.edtShortcut.Enabled = false;
+ this.edtShortcut.Location = new System.Drawing.Point(102, 493);
+ this.edtShortcut.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.edtShortcut.Name = "edtShortcut";
+ this.edtShortcut.ReadOnly = true;
+ this.edtShortcut.Size = new System.Drawing.Size(233, 23);
+ this.edtShortcut.TabIndex = 3;
+ this.edtShortcut.TextChanged += new System.EventHandler(this.edtShortcut_TextChanged);
+ this.edtShortcut.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyDown);
+ this.edtShortcut.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyUp);
+ //
+ // btnChange
+ //
+ this.btnChange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnChange.ContextMenuStrip = this.mnuNvPresets;
+ this.btnChange.Location = new System.Drawing.Point(102, 429);
+ this.btnChange.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnChange.Name = "btnChange";
+ this.btnChange.Size = new System.Drawing.Size(88, 27);
+ this.btnChange.TabIndex = 2;
+ this.btnChange.Text = "Change...";
+ this.btnChange.UseVisualStyleBackColor = true;
+ this.btnChange.Click += new System.EventHandler(this.btnChange_Click);
+ //
+ // mnuNvPresets
+ //
+ this.mnuNvPresets.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvApply,
+ this.miNvPresetApplyOnStartup,
+ this.tssNvPresetMenu,
+ this.mnuNvDisplay,
+ this.mnuNvPresetsColorSettings,
+ this.mnuRefreshRate,
+ this.mnuNvResolution,
+ this.miNvPresetDithering,
+ this.miNvHDR,
+ this.mnuNvDriverSettings,
+ this.mnuNvOverclocking,
+ this.miNvCopyId});
+ this.mnuNvPresets.Name = "mnuNvPresets";
+ this.mnuNvPresets.Size = new System.Drawing.Size(185, 252);
+ this.mnuNvPresets.Opening += new System.ComponentModel.CancelEventHandler(this.mnuNvPresets_Opening);
+ //
+ // miNvApply
+ //
+ this.miNvApply.Name = "miNvApply";
+ this.miNvApply.Size = new System.Drawing.Size(184, 22);
+ this.miNvApply.Text = "Apply";
+ this.miNvApply.Click += new System.EventHandler(this.btnApply_Click);
+ //
+ // miNvPresetApplyOnStartup
+ //
+ this.miNvPresetApplyOnStartup.CheckOnClick = true;
+ this.miNvPresetApplyOnStartup.Name = "miNvPresetApplyOnStartup";
+ this.miNvPresetApplyOnStartup.Size = new System.Drawing.Size(184, 22);
+ this.miNvPresetApplyOnStartup.Text = "Apply on startup";
+ this.miNvPresetApplyOnStartup.Click += new System.EventHandler(this.miNvPresetApplyOnStartup_Click);
+ //
+ // tssNvPresetMenu
+ //
+ this.tssNvPresetMenu.Name = "tssNvPresetMenu";
+ this.tssNvPresetMenu.Size = new System.Drawing.Size(181, 6);
+ //
+ // mnuNvDisplay
+ //
+ this.mnuNvDisplay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvPrimaryDisplay});
+ this.mnuNvDisplay.Name = "mnuNvDisplay";
+ this.mnuNvDisplay.Size = new System.Drawing.Size(184, 22);
+ this.mnuNvDisplay.Text = "Display";
+ //
+ // miNvPrimaryDisplay
+ //
+ this.miNvPrimaryDisplay.Name = "miNvPrimaryDisplay";
+ this.miNvPrimaryDisplay.Size = new System.Drawing.Size(155, 22);
+ this.miNvPrimaryDisplay.Text = "Primary display";
+ this.miNvPrimaryDisplay.Click += new System.EventHandler(this.displayMenuItem_Click);
+ //
+ // mnuNvPresetsColorSettings
+ //
+ this.mnuNvPresetsColorSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvPresetColorSettings});
+ this.mnuNvPresetsColorSettings.Name = "mnuNvPresetsColorSettings";
+ this.mnuNvPresetsColorSettings.Size = new System.Drawing.Size(184, 22);
+ this.mnuNvPresetsColorSettings.Text = "Color Settings";
+ //
+ // miNvPresetColorSettings
+ //
+ this.miNvPresetColorSettings.Name = "miNvPresetColorSettings";
+ this.miNvPresetColorSettings.Size = new System.Drawing.Size(120, 22);
+ this.miNvPresetColorSettings.Text = "Included";
+ this.miNvPresetColorSettings.Click += new System.EventHandler(this.miNvPresetColorSettings_Click);
+ //
+ // mnuRefreshRate
+ //
+ this.mnuRefreshRate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miRefreshRateIncluded});
+ this.mnuRefreshRate.Name = "mnuRefreshRate";
+ this.mnuRefreshRate.Size = new System.Drawing.Size(184, 22);
+ this.mnuRefreshRate.Text = "Refresh Rate";
+ //
+ // miRefreshRateIncluded
+ //
+ this.miRefreshRateIncluded.Name = "miRefreshRateIncluded";
+ this.miRefreshRateIncluded.Size = new System.Drawing.Size(120, 22);
+ this.miRefreshRateIncluded.Text = "Included";
+ this.miRefreshRateIncluded.Click += new System.EventHandler(this.includedToolStripMenuItem_Click);
+ //
+ // mnuNvResolution
+ //
+ this.mnuNvResolution.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvResolutionIncluded});
+ this.mnuNvResolution.Name = "mnuNvResolution";
+ this.mnuNvResolution.Size = new System.Drawing.Size(184, 22);
+ this.mnuNvResolution.Text = "Resolution";
+ //
+ // miNvResolutionIncluded
+ //
+ this.miNvResolutionIncluded.CheckOnClick = true;
+ this.miNvResolutionIncluded.Name = "miNvResolutionIncluded";
+ this.miNvResolutionIncluded.Size = new System.Drawing.Size(120, 22);
+ this.miNvResolutionIncluded.Text = "Included";
+ this.miNvResolutionIncluded.Click += new System.EventHandler(this.miNvResolutionIncluded_Click);
+ //
+ // miNvPresetDithering
+ //
+ this.miNvPresetDithering.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvPresetApplyDithering,
+ this.miNvPresetDitheringEnabled,
+ this.mnuNvDitheringBitDepth,
+ this.mnuNvDitheringMode});
+ this.miNvPresetDithering.Name = "miNvPresetDithering";
+ this.miNvPresetDithering.Size = new System.Drawing.Size(184, 22);
+ this.miNvPresetDithering.Text = "Dithering";
+ //
+ // miNvPresetApplyDithering
+ //
+ this.miNvPresetApplyDithering.Name = "miNvPresetApplyDithering";
+ this.miNvPresetApplyDithering.Size = new System.Drawing.Size(122, 22);
+ this.miNvPresetApplyDithering.Text = "Included";
+ this.miNvPresetApplyDithering.Click += new System.EventHandler(this.miNvPresetApplyDithering_Click);
+ //
+ // miNvPresetDitheringEnabled
+ //
+ this.miNvPresetDitheringEnabled.Name = "miNvPresetDitheringEnabled";
+ this.miNvPresetDitheringEnabled.Size = new System.Drawing.Size(122, 22);
+ this.miNvPresetDitheringEnabled.Text = "Enabled";
+ this.miNvPresetDitheringEnabled.Click += new System.EventHandler(this.miNvPresetDitheringEnabled_Click);
+ //
+ // mnuNvDitheringBitDepth
+ //
+ this.mnuNvDitheringBitDepth.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvDithering6bit,
+ this.miNvDithering8bit,
+ this.miNvDithering10bit});
+ this.mnuNvDitheringBitDepth.Name = "mnuNvDitheringBitDepth";
+ this.mnuNvDitheringBitDepth.Size = new System.Drawing.Size(122, 22);
+ this.mnuNvDitheringBitDepth.Text = "Bit depth";
+ //
+ // miNvDithering6bit
+ //
+ this.miNvDithering6bit.Name = "miNvDithering6bit";
+ this.miNvDithering6bit.Size = new System.Drawing.Size(105, 22);
+ this.miNvDithering6bit.Tag = "0";
+ this.miNvDithering6bit.Text = "6-bit";
+ this.miNvDithering6bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
+ //
+ // miNvDithering8bit
+ //
+ this.miNvDithering8bit.Name = "miNvDithering8bit";
+ this.miNvDithering8bit.Size = new System.Drawing.Size(105, 22);
+ this.miNvDithering8bit.Tag = "1";
+ this.miNvDithering8bit.Text = "8-bit";
+ this.miNvDithering8bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
+ //
+ // miNvDithering10bit
+ //
+ this.miNvDithering10bit.Name = "miNvDithering10bit";
+ this.miNvDithering10bit.Size = new System.Drawing.Size(105, 22);
+ this.miNvDithering10bit.Tag = "2";
+ this.miNvDithering10bit.Text = "10-bit";
+ this.miNvDithering10bit.Click += new System.EventHandler(this.miNvDithering6bit_Click);
+ //
+ // mnuNvDitheringMode
+ //
+ this.mnuNvDitheringMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.spatial1ToolStripMenuItem,
+ this.spatial2ToolStripMenuItem,
+ this.spatialDynamic2x2ToolStripMenuItem,
+ this.spatialStatic2x2ToolStripMenuItem,
+ this.temporalToolStripMenuItem});
+ this.mnuNvDitheringMode.Name = "mnuNvDitheringMode";
+ this.mnuNvDitheringMode.Size = new System.Drawing.Size(122, 22);
+ this.mnuNvDitheringMode.Text = "Mode";
+ //
+ // spatial1ToolStripMenuItem
+ //
+ this.spatial1ToolStripMenuItem.Name = "spatial1ToolStripMenuItem";
+ this.spatial1ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.spatial1ToolStripMenuItem.Tag = "0";
+ this.spatial1ToolStripMenuItem.Text = "Spatial Dynamic";
+ this.spatial1ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
+ //
+ // spatial2ToolStripMenuItem
+ //
+ this.spatial2ToolStripMenuItem.Name = "spatial2ToolStripMenuItem";
+ this.spatial2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.spatial2ToolStripMenuItem.Tag = "1";
+ this.spatial2ToolStripMenuItem.Text = "Spatial Static";
+ this.spatial2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
+ //
+ // spatialDynamic2x2ToolStripMenuItem
+ //
+ this.spatialDynamic2x2ToolStripMenuItem.Name = "spatialDynamic2x2ToolStripMenuItem";
+ this.spatialDynamic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.spatialDynamic2x2ToolStripMenuItem.Tag = "2";
+ this.spatialDynamic2x2ToolStripMenuItem.Text = "Spatial Dynamic 2x2";
+ this.spatialDynamic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
+ //
+ // spatialStatic2x2ToolStripMenuItem
+ //
+ this.spatialStatic2x2ToolStripMenuItem.Name = "spatialStatic2x2ToolStripMenuItem";
+ this.spatialStatic2x2ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.spatialStatic2x2ToolStripMenuItem.Tag = "3";
+ this.spatialStatic2x2ToolStripMenuItem.Text = "Spatial Static 2x2";
+ this.spatialStatic2x2ToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
+ //
+ // temporalToolStripMenuItem
+ //
+ this.temporalToolStripMenuItem.Name = "temporalToolStripMenuItem";
+ this.temporalToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.temporalToolStripMenuItem.Tag = "4";
+ this.temporalToolStripMenuItem.Text = "Temporal";
+ this.temporalToolStripMenuItem.Click += new System.EventHandler(this.spatial1ToolStripMenuItem_Click);
+ //
+ // miNvHDR
+ //
+ this.miNvHDR.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miHDRIncluded,
+ this.miToggleHDR,
+ this.miHDREnabled});
+ this.miNvHDR.Name = "miNvHDR";
+ this.miNvHDR.Size = new System.Drawing.Size(184, 22);
+ this.miNvHDR.Text = "HDR";
+ //
+ // miHDRIncluded
+ //
+ this.miHDRIncluded.Name = "miHDRIncluded";
+ this.miHDRIncluded.Size = new System.Drawing.Size(136, 22);
+ this.miHDRIncluded.Text = "Included";
+ this.miHDRIncluded.Click += new System.EventHandler(this.miHDRIncluded_Click);
+ //
+ // miToggleHDR
+ //
+ this.miToggleHDR.Name = "miToggleHDR";
+ this.miToggleHDR.Size = new System.Drawing.Size(136, 22);
+ this.miToggleHDR.Text = "Toggle HDR";
+ this.miToggleHDR.Click += new System.EventHandler(this.miToggleHDR_Click);
+ //
+ // miHDREnabled
+ //
+ this.miHDREnabled.Name = "miHDREnabled";
+ this.miHDREnabled.Size = new System.Drawing.Size(136, 22);
+ this.miHDREnabled.Text = "Enabled";
+ this.miHDREnabled.Click += new System.EventHandler(this.miHDREnabled_Click);
+ //
+ // mnuNvDriverSettings
+ //
+ this.mnuNvDriverSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvDriverSettingsIncluded});
+ this.mnuNvDriverSettings.Name = "mnuNvDriverSettings";
+ this.mnuNvDriverSettings.Size = new System.Drawing.Size(184, 22);
+ this.mnuNvDriverSettings.Text = "Driver Settings";
+ //
+ // miNvDriverSettingsIncluded
+ //
+ this.miNvDriverSettingsIncluded.Name = "miNvDriverSettingsIncluded";
+ this.miNvDriverSettingsIncluded.Size = new System.Drawing.Size(120, 22);
+ this.miNvDriverSettingsIncluded.Text = "Included";
+ this.miNvDriverSettingsIncluded.Click += new System.EventHandler(this.miNvDriverSettingsIncluded_Click);
+ //
+ // mnuNvOverclocking
+ //
+ this.mnuNvOverclocking.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvOverclockingIncluded});
+ this.mnuNvOverclocking.Name = "mnuNvOverclocking";
+ this.mnuNvOverclocking.Size = new System.Drawing.Size(184, 22);
+ this.mnuNvOverclocking.Text = "Overclocking";
+ //
+ // miNvOverclockingIncluded
+ //
+ this.miNvOverclockingIncluded.Name = "miNvOverclockingIncluded";
+ this.miNvOverclockingIncluded.Size = new System.Drawing.Size(120, 22);
+ this.miNvOverclockingIncluded.Text = "Included";
+ this.miNvOverclockingIncluded.Click += new System.EventHandler(this.miNvOverclockingIncluded_Click);
+ //
+ // miNvCopyId
+ //
+ this.miNvCopyId.Name = "miNvCopyId";
+ this.miNvCopyId.Size = new System.Drawing.Size(184, 22);
+ this.miNvCopyId.Text = "Copy Id to Clipboard";
+ this.miNvCopyId.Click += new System.EventHandler(this.miNvCopyId_Click);
+ //
+ // btnApply
+ //
+ this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnApply.Enabled = false;
+ this.btnApply.Location = new System.Drawing.Point(7, 429);
+ this.btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.btnApply.Name = "btnApply";
+ this.btnApply.Size = new System.Drawing.Size(88, 27);
+ this.btnApply.TabIndex = 1;
+ this.btnApply.Text = "Apply";
+ this.btnApply.UseVisualStyleBackColor = true;
+ this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
+ //
+ // lvNvPresets
+ //
+ this.lvNvPresets.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.lvNvPresets.CheckBoxes = true;
+ this.lvNvPresets.ContextMenuStrip = this.mnuNvPresets;
+ this.lvNvPresets.FullRowSelect = true;
+ this.lvNvPresets.Location = new System.Drawing.Point(7, 7);
+ this.lvNvPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+ this.lvNvPresets.MultiSelect = false;
+ this.lvNvPresets.Name = "lvNvPresets";
+ this.lvNvPresets.Size = new System.Drawing.Size(1098, 415);
+ this.lvNvPresets.TabIndex = 0;
+ this.lvNvPresets.UseCompatibleStateImageBehavior = false;
+ this.lvNvPresets.View = System.Windows.Forms.View.Details;
+ this.lvNvPresets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvLgPresets_ColumnClick);
+ this.lvNvPresets.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvNvPresets_ItemCheck);
+ this.lvNvPresets.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvNvPresets_ItemChecked);
+ this.lvNvPresets.SelectedIndexChanged += new System.EventHandler(this.lvNvPresets_SelectedIndexChanged);
+ this.lvNvPresets.DoubleClick += new System.EventHandler(this.btnApply_Click);
+ this.lvNvPresets.MouseLeave += new System.EventHandler(this.lvNvPresets_MouseLeave);
+ this.lvNvPresets.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lvNvPresets_MouseMove);
+
+ //
+ // mnuNvSettings
+ //
+ this.mnuNvSettings.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.mnuNvSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.miNvProfileInspector,
+ this.miNvSettings});
+ this.mnuNvSettings.Name = "mnuLgButtons";
+ this.mnuNvSettings.Size = new System.Drawing.Size(202, 48);
+ //
+ // miNvProfileInspector
+ //
+ this.miNvProfileInspector.Name = "miNvProfileInspector";
+ this.miNvProfileInspector.Size = new System.Drawing.Size(201, 22);
+ this.miNvProfileInspector.Text = "NVIDIA Profile Inspector";
+ this.miNvProfileInspector.Click += new System.EventHandler(this.miNvProfileInspector_Click);
+ //
+ // miNvSettings
+ //
+ this.miNvSettings.Name = "miNvSettings";
+ this.miNvSettings.Size = new System.Drawing.Size(201, 22);
+ this.miNvSettings.Text = "Settings";
+ this.miNvSettings.Click += new System.EventHandler(this.miNvSettings_Click);
+
+ this.mnuNvPresets.ResumeLayout(false);
+ this.mnuNvSettings.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListView lvNvPresets;
+ private System.Windows.Forms.Button btnApply;
+ private System.Windows.Forms.Button btnChange;
+ private System.Windows.Forms.Button btnNvPresetSave;
+ private System.Windows.Forms.Label lblShortcut;
+ private System.Windows.Forms.TextBox edtShortcut;
+ private System.Windows.Forms.TabPage tabOptions;
+ private System.Windows.Forms.Button btnClone;
+ private System.Windows.Forms.ContextMenuStrip mnuNvPresets;
+ private System.Windows.Forms.ToolStripMenuItem miNvPresetDithering;
+ private System.Windows.Forms.ToolStripMenuItem miNvPresetApplyDithering;
+ private System.Windows.Forms.ToolStripMenuItem miNvPresetDitheringEnabled;
+ private System.Windows.Forms.ToolStripMenuItem mnuRefreshRate;
+ private System.Windows.Forms.ToolStripMenuItem miRefreshRateIncluded;
+ private System.Windows.Forms.ToolStripMenuItem miNvHDR;
+ private System.Windows.Forms.ToolStripMenuItem miHDRIncluded;
+ private System.Windows.Forms.ToolStripMenuItem miToggleHDR;
+ private System.Windows.Forms.ToolStripMenuItem miHDREnabled;
+ private System.Windows.Forms.Label lblError;
+ private System.Windows.Forms.Button btnNvPresetDelete;
+ private System.Windows.Forms.Button btnAddModesNv;
+ private System.Windows.Forms.ToolStripMenuItem miNvApply;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvDisplay;
+ private System.Windows.Forms.ToolStripMenuItem miNvPrimaryDisplay;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvPresetsColorSettings;
+ private System.Windows.Forms.ToolStripMenuItem miNvPresetColorSettings;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvDitheringBitDepth;
+ private System.Windows.Forms.ToolStripMenuItem miNvDithering6bit;
+ private System.Windows.Forms.ToolStripMenuItem miNvDithering8bit;
+ private System.Windows.Forms.ToolStripMenuItem miNvDithering10bit;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvDitheringMode;
+ private System.Windows.Forms.ToolStripMenuItem spatial1ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem spatial2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem spatialDynamic2x2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem spatialStatic2x2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem temporalToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem miNvPresetApplyOnStartup;
+ private System.Windows.Forms.ToolStripMenuItem miNvCopyId;
+ private System.Windows.Forms.Label lblNvPresetName;
+ private System.Windows.Forms.TextBox edtNvPresetName;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvResolution;
+ private System.Windows.Forms.ToolStripMenuItem miNvResolutionIncluded;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvDriverSettings;
+ private System.Windows.Forms.ToolStripMenuItem miNvDriverSettingsIncluded;
+ private System.Windows.Forms.CheckBox chkNvShowInQuickAccess;
+ private System.Windows.Forms.Button btnNvSettings;
+ private System.Windows.Forms.ContextMenuStrip mnuNvSettings;
+ private System.Windows.Forms.ToolStripMenuItem miNvProfileInspector;
+ private System.Windows.Forms.ToolStripMenuItem miNvSettings;
+ private System.Windows.Forms.ToolTip lvNvPresetsToolTip;
+ private System.Windows.Forms.ToolStripSeparator tssNvPresetMenu;
+ private System.Windows.Forms.Label lblNvGPU;
+ private System.Windows.Forms.ComboBox cbxNvGPU;
+ private System.Windows.Forms.Label lblNvGpuInfo;
+ private System.Windows.Forms.TextBox edtNvGpuInfo;
+ private System.Windows.Forms.Button btnNvSetClocks;
+ private System.Windows.Forms.Label lblNvOverclock;
+ private System.Windows.Forms.TextBox edtNvOverclock;
+ private System.Windows.Forms.ToolStripMenuItem mnuNvOverclocking;
+ private System.Windows.Forms.ToolStripMenuItem miNvOverclockingIncluded;
+ }
+}
diff --git a/ColorControl/Services/NVIDIA/NvPanel.cs b/ColorControl/Services/NVIDIA/NvPanel.cs
new file mode 100644
index 0000000..603bedb
--- /dev/null
+++ b/ColorControl/Services/NVIDIA/NvPanel.cs
@@ -0,0 +1,1643 @@
+using ColorControl.Common;
+using ColorControl.Forms;
+using ColorControl.Native;
+using NLog;
+using nspector;
+using nspector.Common;
+using nspector.Common.Meta;
+using NvAPIWrapper.Display;
+using NvAPIWrapper.GPU;
+using NvAPIWrapper.Native.Display;
+using NWin32.NativeTypes;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ColorControl.Services.NVIDIA
+{
+ partial class NvPanel : UserControl
+ {
+ private static int SHORTCUTID_NVQA = -200;
+
+ private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
+
+ private Config _config;
+ private NvService _nvService;
+ private IntPtr _mainHandle;
+ private string _lastDisplayRefreshRates = string.Empty;
+ private NotifyIcon _trayIcon;
+
+ public NvPanel(NvService nvService, NotifyIcon trayIcon, IntPtr handle)
+ {
+ _nvService = nvService;
+ _trayIcon = trayIcon;
+ _mainHandle = handle;
+
+ _config = AppContext.CurrentContext.Config;
+
+ InitializeComponent();
+
+ FillNvPresets();
+
+ FormUtils.InitSortState(lvNvPresets, _config.NvPresetsSortState);
+
+ _nvService.AfterApplyPreset += NvServiceAfterApplyPreset;
+ }
+
+ private void RemoteControlPanel_Load(object sender, EventArgs e)
+ {
+ }
+
+ private void lvLgPresets_ColumnClick(object sender, ColumnClickEventArgs e)
+ {
+ FormUtils.ListViewSort(sender, e);
+ }
+
+ private void lvNvPresets_ItemCheck(object sender, ItemCheckEventArgs e)
+ {
+ var listView = sender as 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;
+ }
+ }
+
+ private void NvServiceAfterApplyPreset(object sender, NvPreset preset)
+ {
+ UpdateDisplayInfoItems();
+ }
+
+ private void FillNvPresets()
+ {
+ FormUtils.InitListView(lvNvPresets, NvPreset.GetColumnNames());
+
+ UpdateDisplayInfoItems();
+
+ foreach (var preset in _nvService.GetPresets())
+ {
+ AddOrUpdateItem(preset);
+ Utils.RegisterShortcut(_mainHandle, preset.id, preset.shortcut);
+ }
+ }
+
+ private void UpdateDisplayInfoItems()
+ {
+ var displays = _nvService?.GetDisplayInfos();
+ if (displays == null || Program.IsRestarting)
+ {
+ return;
+ }
+
+ var gpus = new List();
+
+ var text = Program.TS_TASKNAME;
+ foreach (var displayInfo in displays)
+ {
+ var display = displayInfo.Display;
+
+ var id = Math.Abs((int)display.Handle.MemoryAddress.ToInt64());
+
+ ListViewItem item = null;
+ for (var i = 0; i < lvNvPresets.Items.Count; i++)
+ {
+ item = lvNvPresets.Items[i];
+
+ if (item.Tag == null && item.ImageIndex == id)
+ {
+ break;
+ }
+ item = null;
+ }
+
+ if (item == null)
+ {
+ item = lvNvPresets.Items.Add(display.Name);
+ item.ImageIndex = id;
+ item.Font = new Font(item.Font, item.Font.Style | FontStyle.Bold);
+ item.BackColor = Color.LightGray;
+ }
+
+ var values = displayInfo.Values;
+
+ item.Text = values[0];
+ for (var i = 1; i < values.Count; i++)
+ {
+ if (item.SubItems.Count - 1 >= i)
+ {
+ item.SubItems[i].Text = values[i];
+ }
+ else
+ {
+ item.SubItems.Add(values[i]);
+ }
+ }
+
+ text += "\n" + displayInfo.InfoLine;
+
+ if (!gpus.Contains(displayInfo.Display.DisplayDevice.PhysicalGPU))
+ {
+ gpus.Add(displayInfo.Display.DisplayDevice.PhysicalGPU);
+ }
+ }
+
+ UpdateNvGpuInfo(gpus);
+
+ FormUtils.SetNotifyIconText(_trayIcon, text);
+ }
+
+ private void UpdateNvGpuInfo(List gpus = null)
+ {
+ gpus ??= _nvService.GetGPUs();
+
+ cbxNvGPU.Items.Clear();
+ cbxNvGPU.Items.AddRange(gpus.ToArray());
+ if (cbxNvGPU.Items.Count > 0 && cbxNvGPU.SelectedIndex == -1)
+ {
+ cbxNvGPU.SelectedIndex = 0;
+ }
+ }
+
+ private void AddOrUpdateItem(NvPreset preset = null)
+ {
+ FormUtils.AddOrUpdateListItem(lvNvPresets, _nvService.GetPresets(), _config, preset);
+ }
+
+ private void btnApply_Click(object sender, EventArgs e)
+ {
+ ApplySelectedNvPreset();
+ }
+
+ private void lvNvPresets_ItemChecked(object sender, ItemCheckedEventArgs e)
+ {
+ FormUtils.ListViewItemChecked(lvNvPresets, e);
+ }
+
+ private void lvNvPresets_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+ var enabled = preset != null;
+
+ FormUtils.EnableControls(this, enabled, new List { lvNvPresets, btnAddModesNv, btnChange, edtNvGpuInfo, btnNvSetClocks, btnNvSettings, edtNvOverclock });
+
+ if (enabled)
+ {
+ edtNvPresetName.Text = preset.name;
+ edtShortcut.Text = preset.shortcut;
+ chkNvShowInQuickAccess.Checked = preset.ShowInQuickAccess;
+ }
+ else
+ {
+ edtNvPresetName.Text = string.Empty;
+ edtShortcut.Text = string.Empty;
+ chkNvShowInQuickAccess.Checked = false;
+ }
+ }
+
+ private void btnNvPresetDelete_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ if (preset == null)
+ {
+ return;
+ }
+
+ if (!string.IsNullOrEmpty(preset.shortcut))
+ {
+ WinApi.UnregisterHotKey(_mainHandle, preset.id);
+ }
+
+ _nvService.GetPresets().Remove(preset);
+
+ var item = lvNvPresets.SelectedItems[0];
+ lvNvPresets.Items.Remove(item);
+ }
+
+ private void btnClone_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ var newPreset = preset.Clone();
+ AddOrUpdateItem(newPreset);
+ }
+
+ private void miNvPresetColorSettings_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyColorData = !preset.applyColorData;
+
+ AddOrUpdateItem();
+ }
+
+ private void miNvPresetApplyDithering_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyDithering = !preset.applyDithering;
+
+ AddOrUpdateItem();
+ }
+
+ private void miNvPresetDitheringEnabled_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+
+ if (preset.IsDisplayPreset)
+ {
+ miNvPresetDitheringEnabled.Checked = !miNvPresetDitheringEnabled.Checked;
+
+ _nvService.SetDithering(miNvPresetDitheringEnabled.Checked ? NvDitherState.Enabled : NvDitherState.Disabled);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.ditheringEnabled = !preset.ditheringEnabled;
+
+ AddOrUpdateItem();
+ }
+
+ private void btnChange_Click(object sender, EventArgs e)
+ {
+ mnuNvPresets.Show(btnChange, btnChange.PointToClient(Cursor.Position));
+ }
+
+ private void includedToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyRefreshRate = !preset.applyRefreshRate;
+
+ AddOrUpdateItem();
+ }
+
+ private Font _normalFont;
+ private Font _boldFont;
+ private Dictionary _menuItemFonts;
+
+ private void mnuNvPresets_Opening(object sender, CancelEventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+ var isCurrentDisplay = preset?.IsDisplayPreset == true;
+
+ var presetItemsVisible = preset != null && !isCurrentDisplay;
+
+ miNvApply.Visible = presetItemsVisible;
+ miNvPresetApplyOnStartup.Visible = presetItemsVisible;
+ tssNvPresetMenu.Visible = presetItemsVisible;
+ mnuNvDisplay.Visible = presetItemsVisible;
+ miNvPresetColorSettings.Enabled = presetItemsVisible;
+ mnuNvPresetsColorSettings.Enabled = preset != null;
+ mnuRefreshRate.Enabled = preset != null;
+ mnuNvResolution.Enabled = preset != null;
+ miNvPresetDithering.Enabled = preset != null;
+ miNvHDR.Enabled = preset != null;
+ miNvCopyId.Visible = presetItemsVisible;
+ miNvDriverSettingsIncluded.Visible = presetItemsVisible;
+ mnuNvDriverSettings.Enabled = preset != null;
+ mnuNvOverclocking.Visible = preset != null && _nvService.Config.ShowOverclocking;
+
+ if (preset == null)
+ {
+ return;
+ }
+
+ _normalFont ??= new Font(mnuNvDriverSettings.Font, FontStyle.Regular);
+ _boldFont ??= new Font(_normalFont, FontStyle.Bold);
+ _menuItemFonts ??= new Dictionary { { false, _normalFont }, { true, _boldFont } };
+
+ miNvPresetApplyOnStartup.Checked = preset.id > 0 && _config.NvPresetId_ApplyOnStartup == preset.id;
+
+ miNvPresetApplyDithering.Visible = !isCurrentDisplay;
+ miNvPresetColorSettings.Visible = !isCurrentDisplay;
+ miNvResolutionIncluded.Visible = !isCurrentDisplay;
+ miRefreshRateIncluded.Visible = !isCurrentDisplay;
+ miHDRIncluded.Visible = !isCurrentDisplay;
+
+ if (mnuNvDisplay.DropDownItems.Count == 1)
+ {
+ var displays = _nvService.GetDisplays();
+ for (var i = 0; i < displays.Length; i++)
+ {
+ var display = displays[i];
+ var name = FormUtils.ExtendedDisplayName(display.Name);
+
+ var item = mnuNvDisplay.DropDownItems.Add(name);
+ item.Tag = display;
+ item.Click += displayMenuItem_Click;
+ }
+ }
+
+ FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Bit depth", typeof(ColorDataDepth), preset.colorData, "ColorDepth", nvPresetColorDataMenuItem_Click);
+ FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Format", typeof(ColorDataFormat), preset.colorData, "ColorFormat", nvPresetColorDataMenuItem_Click);
+ FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Dynamic range", typeof(ColorDataDynamicRange), preset.colorData, "DynamicRange", nvPresetColorDataMenuItem_Click);
+ FormUtils.BuildDropDownMenu(mnuNvPresetsColorSettings, "Color space", typeof(ColorDataColorimetry), preset.colorData, "Colorimetry", nvPresetColorDataMenuItem_Click);
+
+ BuildNvRefreshRateResolutionMenu(preset);
+
+ miNvPrimaryDisplay.Checked = preset.primaryDisplay;
+ foreach (var item in mnuNvDisplay.DropDownItems)
+ {
+ if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
+ {
+ menuItem.Checked = ((Display)menuItem.Tag).Name.Equals(preset.displayName);
+ }
+ }
+
+ miNvPresetColorSettings.Checked = preset.applyColorData;
+ miNvPresetApplyDithering.Checked = preset.applyDithering;
+ miNvPresetDitheringEnabled.Checked = preset.ditheringEnabled;
+
+ foreach (var item in mnuNvDitheringBitDepth.DropDownItems.OfType())
+ {
+ if (item.Tag != null)
+ {
+ item.Checked = uint.Parse(item.Tag.ToString()) == preset.ditheringBits;
+ }
+ }
+ foreach (var item in mnuNvDitheringMode.DropDownItems.OfType())
+ {
+ if (item.Tag != null)
+ {
+ item.Checked = uint.Parse(item.Tag.ToString()) == preset.ditheringMode;
+ }
+ }
+
+ miHDRIncluded.Checked = preset.applyHDR;
+ miHDREnabled.Checked = preset.HDREnabled;
+ miToggleHDR.Checked = preset.toggleHDR;
+
+ miNvDriverSettingsIncluded.Checked = preset.applyDriverSettings;
+
+ mnuNvPresetsColorSettings.Font = _menuItemFonts[preset.applyColorData];
+ mnuRefreshRate.Font = _menuItemFonts[preset.applyRefreshRate];
+ mnuNvResolution.Font = _menuItemFonts[preset.applyResolution];
+ miNvPresetDithering.Font = _menuItemFonts[preset.applyDithering];
+ miNvHDR.Font = _menuItemFonts[preset.applyHDR];
+ mnuNvOverclocking.Font = _menuItemFonts[preset.applyOverclocking];
+
+ BuildNvOverclockingMenu(preset);
+
+ UpdateNvPresetMenuFont();
+
+ BuildNvidiaDriverSettingsMenu(mnuNvDriverSettings, isCurrentDisplay ? null : preset.driverSettings);
+
+ mnuNvDriverSettings.Font = _menuItemFonts[preset.applyDriverSettings];
+ }
+
+ private void BuildNvOverclockingMenu(NvPreset preset)
+ {
+ miNvOverclockingIncluded.Checked = preset.applyOverclocking;
+
+ var gpus = _nvService.GetGPUs();
+
+ foreach (var gpu in gpus)
+ {
+ var gpuPciId = gpu.BusInformation.PCIIdentifiers.ToString();
+
+ var name = $"{mnuNvOverclocking.Name}_{gpu.GPUId}";
+
+ var gpuItem = FormUtils.BuildMenuItem(mnuNvOverclocking.DropDownItems, name, gpu.FullName);
+
+ var subName = $"{name}_change";
+
+ var ocSettings = preset.ocSettings.FirstOrDefault(s => s.PCIIdentifier == gpuPciId) ?? new NvGpuOcSettings { PCIIdentifier = gpuPciId };
+
+ var subText = $"{ocSettings} (click to change)";
+
+ var subItem = FormUtils.BuildMenuItem(gpuItem.DropDownItems, subName, subText, ocSettings, nvChangeOverclockingMenuItem_Click);
+ }
+ }
+
+ private void nvChangeOverclockingMenuItem_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ var menuItem = (ToolStripItem)sender;
+
+ var currentSettings = (NvGpuOcSettings)menuItem.Tag;
+
+ var gpuInfo = NvGpuInfo.GetGpuInfo(currentSettings.PCIIdentifier);
+
+ var newSettings = AskNvOcSettings(gpuInfo, currentSettings);
+
+ if (newSettings == null)
+ {
+ return;
+ }
+
+ preset.UpdateOverclockingSetting(newSettings);
+
+ AddOrUpdateItem();
+ }
+
+ private void BuildNvRefreshRateResolutionMenu(NvPreset preset)
+ {
+ var displayName = preset.primaryDisplay ? null : preset.displayName;
+
+ if (displayName != _lastDisplayRefreshRates)
+ {
+ while (mnuRefreshRate.DropDownItems.Count > 1)
+ {
+ mnuRefreshRate.DropDownItems.RemoveAt(mnuRefreshRate.DropDownItems.Count - 1);
+ }
+ while (mnuNvResolution.DropDownItems.Count > 1)
+ {
+ mnuNvResolution.DropDownItems.RemoveAt(mnuNvResolution.DropDownItems.Count - 1);
+ }
+ }
+
+ if (mnuRefreshRate.DropDownItems.Count == 1)
+ {
+ var refreshRates = _nvService.GetAvailableRefreshRates(preset);
+ _lastDisplayRefreshRates = displayName;
+
+ foreach (var refreshRate in refreshRates)
+ {
+ var item = mnuRefreshRate.DropDownItems.Add(refreshRate.ToString() + "Hz");
+ item.Tag = refreshRate;
+ item.Click += refreshRateMenuItem_Click;
+ }
+ }
+
+ if (mnuNvResolution.DropDownItems.Count == 1)
+ {
+ var modes = _nvService.GetAvailableResolutions(preset);
+
+ foreach (var mode in modes)
+ {
+ var item = mnuNvResolution.DropDownItems.Add($"{mode.dmPelsWidth}x{mode.dmPelsHeight}");
+ item.Tag = mode;
+ item.Click += resolutionNvMenuItem_Click;
+ }
+ }
+
+ miRefreshRateIncluded.Checked = preset.applyRefreshRate;
+ foreach (var item in mnuRefreshRate.DropDownItems)
+ {
+ if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
+ {
+ menuItem.Checked = (uint)menuItem.Tag == preset.refreshRate;
+ }
+ }
+
+ miNvResolutionIncluded.Checked = preset.applyResolution;
+ foreach (var item in mnuNvResolution.DropDownItems)
+ {
+ if (item is ToolStripMenuItem menuItem && menuItem.Tag != null)
+ {
+ var mode = (DEVMODEA)menuItem.Tag;
+ menuItem.Checked = mode.dmPelsWidth == preset.resolutionWidth && mode.dmPelsHeight == preset.resolutionHeight;
+ }
+ }
+ }
+
+ private void UpdateNvPresetMenuFont(bool updateTopItems = false)
+ {
+ foreach (var menu in mnuNvPresets.Items.OfType().Where(i => i != mnuNvDriverSettings))
+ {
+ if (updateTopItems)
+ {
+ menu.Font = _normalFont;
+ }
+
+ SetMenuFont(menu, _normalFont);
+ }
+ }
+
+ private void SetMenuFont(ToolStripMenuItem menu, Font font)
+ {
+ foreach (var item in menu.DropDownItems.OfType())
+ {
+ item.Font = item.Checked ? _boldFont : font;
+
+ SetMenuFont(item, font);
+ }
+ }
+
+ private void BuildNvidiaDriverSettingsMenu(ToolStripDropDownItem parent, Dictionary settings = null, ContextMenuStrip contextMenuStrip = null)
+ {
+ var driverSettings = _nvService.GetVisibleSettings().OrderBy(s => s.GroupName);
+ var handledGroupItems = new List();
+ var showUnchanged = settings != null;
+ var defaultValue = SettingMeta.UnsetDwordValue;
+
+ foreach (var driverSetting in driverSettings)
+ {
+ var groupName = $"mnuNvDriverSettingGroup_{driverSetting.GroupName}";
+ var groupItem = FormUtils.BuildMenuItem(contextMenuStrip?.Items ?? parent.DropDownItems, groupName, driverSetting.GroupName);
+
+ var itemName = $"mnuNvDriverSettingItem_{driverSetting.SettingText}";
+ var item = FormUtils.BuildMenuItem(groupItem.DropDownItems, itemName, driverSetting.SettingText, driverSetting);
+ var settingMeta = _nvService.GetSettingMeta(driverSetting.SettingId);
+
+ var presetSetting = defaultValue;
+ var isDefault = false;
+ if (settings != null)
+ {
+ presetSetting = settings.GetValueOrDefault(driverSetting.SettingId, defaultValue);
+ isDefault = presetSetting == defaultValue;
+ }
+ else
+ {
+ (presetSetting, isDefault) = settingMeta.ToIntValue(driverSetting.ValueText);
+ }
+
+ item.Font = _menuItemFonts[!isDefault];
+
+ if (!handledGroupItems.Contains(groupItem))
+ {
+ groupItem.Tag = null;
+ handledGroupItems.Add(groupItem);
+ }
+ if (!isDefault)
+ {
+ groupItem.Tag = true;
+ }
+
+ var subItemUnchangedName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_Unchanged";
+ var subItemUnchanged = FormUtils.BuildMenuItem(item.DropDownItems, subItemUnchangedName, "Unchanged", onClick: driverSettingValueNvMenuItem_Click);
+ subItemUnchanged.Visible = showUnchanged;
+
+ if (showUnchanged)
+ {
+ subItemUnchanged.Checked = presetSetting == defaultValue;
+ subItemUnchanged.Font = _menuItemFonts[subItemUnchanged.Checked];
+ }
+
+ if (driverSetting.SettingId == NvService.DRS_FRAME_RATE_LIMITER_V3)
+ {
+ var value = settingMeta.DwordValues.FirstOrDefault(v => v.ValueName == driverSetting.ValueText);
+
+ var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem";
+ var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, "", onClick: driverSettingFrameRateNvMenuItem_Click);
+
+ var metaValue = settingMeta.DwordValues.FirstOrDefault(v => v.Value == presetSetting);
+ subItem.Text = $"{metaValue?.ValueName ?? "??FPS"} (click to change)";
+
+ subItem.Tag = value?.Value ?? 0;
+ subItem.Checked = presetSetting != defaultValue;
+
+ continue;
+ }
+
+ if (settingMeta.SettingType == nspector.Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE)
+ {
+ foreach (var settingValue in settingMeta.DwordValues)
+ {
+ var text = settingValue.ValueName;
+ if (text.IndexOf(" (") == 10)
+ {
+ text = text.Substring(0, 10);
+ }
+
+ var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem_{settingValue.Value}";
+ var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, text, settingValue, driverSettingValueNvMenuItem_Click);
+
+ subItem.Checked = presetSetting == settingValue.Value;
+ subItem.Font = _menuItemFonts[subItem.Checked];
+ }
+ }
+
+ if (settingMeta.SettingType == nspector.Native.NVAPI2.NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE)
+ {
+ foreach (var settingValue in settingMeta.BinaryValues)
+ {
+ var text = settingValue.ValueName.Substring(0, 18);
+ var subItemName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_SubItem_{text}";
+
+ var subItem = FormUtils.BuildMenuItem(item.DropDownItems, subItemName, text, settingValue, driverSettingValueNvMenuItem_Click);
+
+ var intValue = BitConverter.ToUInt32(settingValue.Value);
+
+ subItem.Checked = presetSetting == intValue;
+ subItem.Font = _menuItemFonts[subItem.Checked];
+ }
+ }
+
+ if (item.DropDownItems.Count == 0 || item.DropDownItems.Count == 1 && item.DropDownItems[0].Text == "Unchanged")
+ {
+ groupItem.DropDownItems.Remove(item);
+ }
+ }
+
+ foreach (var groupItem in handledGroupItems)
+ {
+ groupItem.Font = _menuItemFonts[groupItem.Tag != null];
+ }
+ }
+
+ private void nvPresetColorDataMenuItem_Click(object sender, EventArgs e)
+ {
+ var menuItem = (ToolStripMenuItem)sender;
+ var property = (PropertyInfo)menuItem.OwnerItem.Tag;
+
+ var value = menuItem.Tag;
+
+ var preset = GetSelectedNvPreset(true);
+
+ var dictionary = new Dictionary
+ {
+ { "ColorFormat", preset.colorData.ColorFormat },
+ { "ColorDepth", preset.colorData.ColorDepth },
+ { "Colorimetry", preset.colorData.Colorimetry },
+ { "DynamicRange", preset.colorData.DynamicRange },
+ { "SelectionPolicy", preset.colorData.SelectionPolicy }
+ };
+
+ dictionary[property.Name] = value;
+
+ var colorData = NvPreset.GenerateColorData(dictionary);
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetColorData(preset.Display, colorData);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.colorData = colorData;
+
+ AddOrUpdateItem();
+ }
+
+ private void refreshRateMenuItem_Click(object sender, EventArgs e)
+ {
+ var refreshRate = (uint)((ToolStripItem)sender).Tag;
+
+ var preset = GetSelectedNvPreset(true);
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetMode(refreshRate: refreshRate);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.refreshRate = refreshRate;
+
+ AddOrUpdateItem();
+ }
+
+ private void resolutionNvMenuItem_Click(object sender, EventArgs e)
+ {
+ var mode = (DEVMODEA)((ToolStripItem)sender).Tag;
+
+ var preset = GetSelectedNvPreset(true);
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetMode(mode.dmPelsWidth, mode.dmPelsHeight);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.resolutionWidth = mode.dmPelsWidth;
+ preset.resolutionHeight = mode.dmPelsHeight;
+
+ AddOrUpdateItem();
+ }
+
+ private void displayMenuItem_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ var menuItem = (ToolStripItem)sender;
+ if (menuItem.Tag != null)
+ {
+ var display = (Display)menuItem.Tag;
+
+ preset.displayName = display.Name;
+ preset.primaryDisplay = false;
+ }
+ else
+ {
+ preset.primaryDisplay = true;
+ preset.displayName = null;
+ }
+
+ AddOrUpdateItem();
+ }
+
+
+ private void btnAddModesNv_Click(object sender, EventArgs e)
+ {
+ var presets = NvPreset.GetDefaultPresets();
+ var added = false;
+
+ foreach (var preset in presets)
+ {
+ if (!_nvService.GetPresets().Any(x => x.colorData.Equals(preset.colorData)))
+ {
+ AddOrUpdateItem(preset);
+ added = true;
+ }
+ }
+
+ if (added)
+ {
+ MessageForms.InfoOk("Missing presets added.");
+ }
+ else
+ {
+ MessageForms.InfoOk("All presets for every color setting already exist.");
+ }
+ }
+
+ private void miHDRIncluded_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyHDR = !preset.applyHDR;
+
+ AddOrUpdateItem();
+ }
+
+ private void miToggleHDR_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetHDRState(preset.Display, !_nvService.IsHDREnabled());
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.toggleHDR = !preset.toggleHDR;
+
+ if (preset.toggleHDR)
+ {
+ preset.HDREnabled = false;
+ }
+
+ AddOrUpdateItem();
+ }
+
+ private void miHDREnabled_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+
+ if (preset.IsDisplayPreset)
+ {
+ miHDREnabled.Checked = !miHDREnabled.Checked;
+ _nvService.SetHDRState(preset.Display, miHDREnabled.Checked);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.HDREnabled = !preset.HDREnabled;
+ preset.toggleHDR = false;
+
+ AddOrUpdateItem();
+ }
+
+ private void ApplySelectedNvPreset()
+ {
+ var preset = GetSelectedNvPreset();
+ ApplyNvPreset(preset);
+ }
+
+ private bool ApplyNvPreset(NvPreset preset)
+ {
+ if (preset == null || _nvService == null)
+ {
+ return false;
+ }
+ try
+ {
+ var result = _nvService.ApplyPreset(preset);
+ if (!result)
+ {
+ throw new Exception("Error while applying NVIDIA preset. At least one setting could not be applied. Check the log for details.");
+ }
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ MessageForms.ErrorOk($"Error applying NVIDIA-preset ({e.TargetSite.Name}): {e.Message}");
+ return false;
+ }
+ }
+
+ private NvPreset GetSelectedNvPreset(bool currentDisplay = false)
+ {
+ if (lvNvPresets.SelectedItems.Count > 0)
+ {
+ var item = lvNvPresets.SelectedItems[0];
+ var result = (NvPreset)item.Tag;
+
+ if (result == null && currentDisplay)
+ {
+ result = _nvService.GetPresetForDisplay(item.SubItems[1].Text);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private void edtShortcut_KeyDown(object sender, KeyEventArgs e)
+ {
+ ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e);
+ }
+
+ private void btnSetShortcut_Click(object sender, EventArgs e)
+ {
+ var shortcut = edtShortcut.Text.Trim();
+
+ if (!Utils.ValidateShortcut(shortcut))
+ {
+ return;
+ }
+
+ var preset = GetSelectedNvPreset();
+
+ var name = edtNvPresetName.Text.Trim();
+
+ if (!string.IsNullOrEmpty(name) && _nvService.GetPresets().Any(x => x.id != preset.id && x.name != null && x.name.Equals(name, StringComparison.OrdinalIgnoreCase)))
+ {
+ MessageForms.WarningOk("The name must be unique.");
+ return;
+ }
+
+ if (string.IsNullOrEmpty(name) && chkNvShowInQuickAccess.Checked)
+ {
+ MessageForms.WarningOk("A name must be entered before enabling Quick Access.");
+ return;
+ }
+
+ var clear = !string.IsNullOrEmpty(preset.shortcut);
+
+ preset.shortcut = shortcut;
+ preset.name = name;
+ preset.ShowInQuickAccess = chkNvShowInQuickAccess.Checked;
+
+ AddOrUpdateItem();
+
+ Utils.RegisterShortcut(_mainHandle, preset.id, preset.shortcut, clear);
+ }
+
+ private void edtShortcut_KeyUp(object sender, KeyEventArgs e)
+ {
+ Utils.HandleKeyboardShortcutUp(e);
+ }
+
+ private void edtShortcut_TextChanged(object sender, EventArgs e)
+ {
+ var text = edtShortcut.Text;
+
+ var preset = GetSelectedNvPreset();
+
+ if (preset == null || string.IsNullOrEmpty(text))
+ {
+ edtShortcut.ForeColor = SystemColors.WindowText;
+ }
+ else
+ {
+ //edtShortcut.ForeColor = ShortCutExists(text, preset.id) ? Color.Red : SystemColors.WindowText;
+ }
+ }
+
+ private void miNvResolutionIncluded_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyResolution = !preset.applyResolution;
+
+ AddOrUpdateItem();
+ }
+
+ private void miNvDriverSettingsIncluded_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyDriverSettings = !preset.applyDriverSettings;
+
+ AddOrUpdateItem();
+ }
+
+ private void driverSettingValueNvMenuItem_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+
+ var menuItem = (ToolStripItem)sender;
+ var parentMenuItem = menuItem.OwnerItem as ToolStripMenuItem;
+
+ var settingItem = (SettingItem)parentMenuItem.Tag;
+
+ if (menuItem.Tag == null)
+ {
+ if (!preset.IsDisplayPreset)
+ {
+ preset.ResetDriverSetting(settingItem.SettingId);
+ AddOrUpdateItem();
+ }
+ return;
+ }
+
+ var intValue = menuItem.Tag is SettingValue intSettingValue ? intSettingValue.Value :
+ menuItem.Tag is SettingValue byteSettingValue ? BitConverter.ToUInt32(byteSettingValue.Value) : 0;
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetDriverSetting(settingItem.SettingId, intValue);
+
+ UpdateDisplayInfoItems();
+
+ return;
+ }
+
+ preset.UpdateDriverSetting(settingItem, intValue);
+
+ AddOrUpdateItem();
+ }
+
+ private void driverSettingFrameRateNvMenuItem_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset(true);
+
+ var menuItem = (ToolStripItem)sender;
+ var parentMenuItem = menuItem.OwnerItem as ToolStripMenuItem;
+
+ var settingItem = (SettingItem)parentMenuItem.Tag;
+
+ var settingMeta = _nvService.GetSettingMeta(settingItem.SettingId);
+
+ uint presetValue;
+ if (preset.IsDisplayPreset)
+ {
+ (presetValue, _) = settingMeta.ToIntValue(settingItem.ValueText);
+ }
+ else
+ {
+ presetValue = preset.driverSettings.GetValueOrDefault(settingItem.SettingId, settingMeta.DefaultDwordValue);
+ }
+
+ var settingValue = SelectNvDriverValue(settingMeta, presetValue);
+
+ if (settingValue == SettingMeta.UnsetDwordValue)
+ {
+ return;
+ }
+
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetDriverSetting(settingItem.SettingId, settingValue);
+
+ UpdateDisplayInfoItems();
+
+ return;
+ }
+
+ preset.UpdateDriverSetting(settingItem, settingValue);
+
+ AddOrUpdateItem();
+ }
+
+ private uint SelectNvDriverValue(SettingMeta settingMeta, uint currentValue)
+ {
+ var field = new MessageForms.FieldDefinition
+ {
+ MinValue = settingMeta.DwordValues.First().Value,
+ MaxValue = settingMeta.DwordValues.Last().Value,
+ Label = settingMeta.SettingName,
+ FieldType = MessageForms.FieldType.Numeric,
+ Value = currentValue
+ };
+
+ var resultFields = MessageForms.ShowDialog(field.Label, new[] { field });
+
+ if (!resultFields.Any())
+ {
+ return SettingMeta.UnsetDwordValue;
+ }
+
+ var settingValue = (uint)Utils.ParseInt((string)resultFields.First().Value);
+
+ return settingValue;
+ }
+
+ private void miNvProfileInspector_Click(object sender, EventArgs e)
+ {
+ StartNvProfileInspector();
+ }
+
+ public void StartNvProfileInspector()
+ {
+ var form = new frmDrvSettings();
+ form.Show();
+ }
+
+ private void miNvSettings_Click(object sender, EventArgs e)
+ {
+ EditNvSettings();
+ }
+
+ private void EditNvSettings()
+ {
+ var values = MessageForms.ShowDialog("NVIDIA controller settings", new[] {
+ new MessageForms.FieldDefinition
+ {
+ Label = "Quick Access shortcut",
+ FieldType = MessageForms.FieldType.Shortcut,
+ Value = _config.NvQuickAccessShortcut
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Enable overclocking",
+ FieldType = MessageForms.FieldType.CheckBox,
+ Value = _nvService.Config.ShowOverclocking
+ }
+ });
+ if (!values.Any())
+ {
+ return;
+ }
+
+ var shortcut = values[0].Value.ToString();
+ var enableOc = (bool)values[1].Value;
+
+ var clear = !string.IsNullOrEmpty(_config.NvQuickAccessShortcut);
+
+ _config.NvQuickAccessShortcut = shortcut;
+
+ Utils.RegisterShortcut(_mainHandle, SHORTCUTID_NVQA, _config.NvQuickAccessShortcut, clear);
+
+ _nvService.Config.ShowOverclocking = enableOc;
+ }
+
+ private void btnNvSettings_Click(object sender, EventArgs e)
+ {
+ mnuNvSettings.Show(btnNvSettings, btnNvSettings.PointToClient(Cursor.Position));
+ }
+
+ private ListViewItem _lastItem;
+ private int _lastSubItemIndex;
+
+ private void lvNvPresets_MouseMove(object sender, MouseEventArgs e)
+ {
+ var item = lvNvPresets.GetItemAt(e.X, e.Y);
+ var subItem = item?.GetSubItemAt(e.X, e.Y);
+
+ if (item == null || subItem == null || subItem?.Text?.Length < 20)
+ {
+ lvNvPresetsToolTip.Active = false;
+ _lastItem = null;
+
+ return;
+ }
+
+ var index = item.SubItems.IndexOf(subItem);
+
+ lvNvPresets.ShowItemToolTips = false;
+
+ if (item == _lastItem && index == _lastSubItemIndex)
+ {
+ return;
+ }
+
+ _lastItem = item;
+ _lastSubItemIndex = index;
+
+ var text = subItem.Text;
+
+ if (index == 7)
+ {
+ text = text.Replace(", ", "\r\n");
+ }
+
+ var point = lvNvPresets.PointToClient(Cursor.Position);
+ point.X += 10;
+ point.Y += 0;
+
+ lvNvPresetsToolTip.Active = false;
+ if (index >= 0)
+ {
+ lvNvPresetsToolTip.Active = true;
+ lvNvPresetsToolTip.Show("", lvNvPresets, point);
+ lvNvPresetsToolTip.Show(text, lvNvPresets, point);
+ }
+ }
+
+ private void lvNvPresets_MouseLeave(object sender, EventArgs e)
+ {
+ lvNvPresetsToolTip.Active = false;
+ }
+
+ private void btnNvSetClocks_Click(object sender, EventArgs e)
+ {
+ var gpu = cbxNvGPU.SelectedItem as PhysicalGPU;
+
+ if (gpu == null)
+ {
+ return;
+ }
+
+ var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
+ var currentSettings = gpuInfo.GetOverclockSettings();
+
+ var newSettings = AskNvOcSettings(gpuInfo, currentSettings);
+
+ if (newSettings == null)
+ {
+ return;
+ }
+
+ _nvService.ApplyOverclocking(newSettings);
+
+ UpdateNvGpuInfo();
+ }
+
+ public NvGpuOcSettings AskNvOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
+ {
+ var overclockTypes = Utils.GetDescriptions();
+
+ var values = MessageForms.ShowDialog("Choose desired overclock settings", new[] {
+ new MessageForms.FieldDefinition
+ {
+ Label = "Overclock method",
+ FieldType = MessageForms.FieldType.DropDown,
+ Values = overclockTypes,
+ Value = currentSettings.Type
+ } });
+ if (!values.Any())
+ {
+ return null;
+ }
+
+ var overclockType = Enum.Parse(values[0].Value.ToString());
+ var newSettings = default(NvGpuOcSettings);
+
+ if (overclockType == NvGpuOcType.Curve)
+ {
+ newSettings = AskNvCurveOcSettings(gpuInfo, currentSettings);
+ }
+ else if (overclockType == NvGpuOcType.Offset)
+ {
+ newSettings = AskNvOffsetOcSettings(gpuInfo, currentSettings);
+ }
+ else
+ {
+ newSettings = new NvGpuOcSettings
+ {
+ Type = overclockType,
+ PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
+ };
+ }
+
+ return newSettings;
+ }
+
+ public NvGpuOcSettings AskNvCurveOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
+ {
+ var nvOverclockSettings = new NvGpuOcSettings
+ {
+ Type = NvGpuOcType.Curve,
+ PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
+ };
+
+ var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
+
+ var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
+
+ var minCurveFreq = curveEntries.Max(e => e.DefaultFrequencyInkHz) + graphicsDelta.Item1;
+ var freqValues = curveEntries
+ .Where(e => e.DefaultFrequencyInkHz == 0 || e.DefaultFrequencyInkHz >= minCurveFreq)
+ .Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct()
+ .OrderBy(x => x)
+ .ToList();
+ var voltValues = curveEntries
+ .Where(e => e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq)
+ .OrderBy(e => e.DefaultVoltageInMicroV)
+ .Select(e => (e.DefaultVoltageInMicroV / 1000).ToString())
+ .Distinct()
+ .ToList();
+
+ var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000;
+
+ var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
+ var currentGpuFreq = curveEntry.FrequencyInkHz;
+
+ var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
+
+ var powerLimits = gpuInfo.GetPowerLimits();
+
+ var defaultPowerLimitMw = gpuInfo.DefaultPowerInMilliWatts;
+
+ var powerField = defaultPowerLimitMw > 0 ?
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Power limit in milli watts. Min: {gpuInfo.MinPowerInMilliWatts}, max: {gpuInfo.MaxPowerInMilliWatts}",
+ FieldType = MessageForms.FieldType.TrackBar,
+ Value = (int)((decimal)defaultPowerLimitMw / 100000 * currentSettings.PowerPCM),
+ MinValue = gpuInfo.MinPowerInMilliWatts,
+ MaxValue = gpuInfo.MaxPowerInMilliWatts
+ }
+ : new MessageForms.FieldDefinition
+ {
+ Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
+ FieldType = MessageForms.FieldType.TrackBar,
+ Value = currentSettings.PowerPCM,
+ MinValue = powerLimits.Item1,
+ MaxValue = powerLimits.Item2
+ };
+
+ var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = graphicsDelta.Item1 / 1000,
+ MaxValue = graphicsDelta.Item2 / 1000,
+ Value = currentSettings.GraphicsOffsetKHz / 1000
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Optional undervolt: maximum voltage in milli volt",
+ FieldType = MessageForms.FieldType.DropDown,
+ Value = currentSettings.MaximumVoltageUv / 1000,
+ Values = voltValues,
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Optional undervolt: maximum core frequency in MHz",
+ FieldType = MessageForms.FieldType.DropDown,
+ Value = currentSettings.MaximumFrequencyKHz / 1000,
+ Values = freqValues,
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = memoryDelta.Item1 / 1000,
+ MaxValue = memoryDelta.Item2 / 1000,
+ Value = currentSettings.MemoryOffsetKHz / 1000
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Voltage boost in %",
+ FieldType = MessageForms.FieldType.Numeric,
+ Value = currentSettings.VoltageBoostPercent,
+ MinValue = 0,
+ MaxValue = 100
+ },
+ powerField,
+ });
+ if (!values.Any())
+ {
+ return null;
+ }
+
+ nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000;
+ nvOverclockSettings.MaximumVoltageUv = values[1].ValueAsUInt * 1000;
+ nvOverclockSettings.MaximumFrequencyKHz = values[2].ValueAsUInt * 1000;
+ nvOverclockSettings.MemoryOffsetKHz = values[3].ValueAsInt * 1000;
+ nvOverclockSettings.VoltageBoostPercent = values[4].ValueAsUInt;
+
+ var power = values[5].ValueAsUInt;
+
+ nvOverclockSettings.PowerPCM = defaultPowerLimitMw > 0 ? (uint)((decimal)power / defaultPowerLimitMw * 100000) : power;
+
+ return nvOverclockSettings;
+ }
+
+ public NvGpuOcSettings AskNvOffsetOcSettings(NvGpuInfo gpuInfo, NvGpuOcSettings currentSettings)
+ {
+ var nvOverclockSettings = new NvGpuOcSettings
+ {
+ Type = NvGpuOcType.Offset,
+ PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
+ };
+
+ var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
+
+ var freqValues = curveEntries.Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct().ToList();
+ var voltValues = curveEntries.Select(e => (e.DefaultVoltageInMicroV / 1000).ToString()).Distinct().ToList();
+
+ var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000;
+
+ var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
+ var currentGpuFreq = curveEntry.FrequencyInkHz;
+
+ var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
+ var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
+
+ var powerLimits = gpuInfo.GetPowerLimits();
+
+ var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = graphicsDelta.Item1 / 1000,
+ MaxValue = graphicsDelta.Item2 / 1000,
+ Value = currentSettings.GraphicsOffsetKHz / 1000
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = memoryDelta.Item1 / 1000,
+ MaxValue = memoryDelta.Item2 / 1000,
+ Value = currentSettings.MemoryOffsetKHz / 1000
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Voltage boost in %",
+ FieldType = MessageForms.FieldType.Numeric,
+ Value = currentSettings.VoltageBoostPercent,
+ MinValue = 0,
+ MaxValue = 100
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
+ FieldType = MessageForms.FieldType.Numeric,
+ Value = currentSettings.PowerPCM,
+ MinValue = powerLimits.Item1,
+ MaxValue = powerLimits.Item2
+ },
+ });
+ if (!values.Any())
+ {
+ return null;
+ }
+
+ nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000;
+ nvOverclockSettings.MemoryOffsetKHz = values[1].ValueAsInt * 1000;
+ nvOverclockSettings.VoltageBoostPercent = values[2].ValueAsUInt;
+ nvOverclockSettings.PowerPCM = values[3].ValueAsUInt;
+
+ return nvOverclockSettings;
+ }
+
+ public void SetClocks()
+ {
+ var gpu = cbxNvGPU.SelectedItem as PhysicalGPU;
+
+ var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
+
+ var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
+
+ var freqValues = curveEntries.Select(e => e.DefaultFrequencyInkHz.ToString()).Distinct().ToList();
+ var voltValues = curveEntries.Select(e => e.DefaultVoltageInMicroV.ToString()).Distinct().ToList();
+
+ var lockedGraphics = gpuInfo.GetLockedBoost(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
+
+ var currentGraphicsVoltage = lockedGraphics.Item1 > 0 ? lockedGraphics.Item1 : 1050000;
+
+ var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
+ var currentGpuFreq = curveEntry.FrequencyInkHz;
+
+ var graphicsDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
+ var memoryDelta = gpuInfo.GetDeltaClockLimits(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
+
+ var graphicsMinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000;
+ var graphicsMaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000;
+ var memoryMinValue = memoryDelta?.DeltaRange.Minimum ?? -502000;
+ var memoryMaxValue = memoryDelta?.DeltaRange.Maximum ?? 3000000;
+
+ var currentGraphicsOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
+ var currentMemoryOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
+
+ var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Core offset in MHz ({graphicsMinValue}KHz to {graphicsMaxValue}KHz)",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000,
+ MaxValue = graphicsDelta?.DeltaRange.Maximum ?? 1000000,
+ Value = currentGraphicsOffset
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Voltage in micro volt",
+ FieldType = MessageForms.FieldType.DropDown,
+ Values = voltValues,
+ //FieldType = MessageForms.FieldType.Numeric,
+ //MinValue = 650000,
+ //MaxValue = 1100000,
+ //Value = currentGraphicsVoltage
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = "Core frequency in KHz",
+ FieldType = MessageForms.FieldType.DropDown,
+ Values = freqValues,
+ //FieldType = MessageForms.FieldType.Numeric,
+ //MinValue = 2000000,
+ //MaxValue = 3200000,
+ //Value = currentGpuFreq
+ },
+ new MessageForms.FieldDefinition
+ {
+ Label = $"Memory offset in KHz ({memoryMinValue}KHz to {memoryMaxValue}KHz)",
+ FieldType = MessageForms.FieldType.Numeric,
+ MinValue = graphicsDelta?.DeltaRange.Minimum ?? -502000,
+ MaxValue = 2500000,
+ Value = currentMemoryOffset
+ },
+ });
+ if (!values.Any())
+ {
+ return;
+ }
+
+ var voltage = (uint)values[0].ValueAsInt;
+ //var coreOffset = values[1].ValueAsInt;
+ var coreFreq = values[1].ValueAsInt;
+ var memoryOffset = values[2].ValueAsInt;
+
+ var normalized = (coreFreq / 15000) * 15000;
+ var newCurveEntryFreq = curveEntries.FirstOrDefault(e => e.DefaultFrequencyInkHz == normalized);
+ var newCurveEntryVolt = curveEntries.FirstOrDefault(e => e.DefaultVoltageInMicroV == voltage);
+
+ var coreOffset = (int)(newCurveEntryFreq.DefaultFrequencyInkHz - newCurveEntryVolt.DefaultFrequencyInkHz);
+
+ gpuInfo.SetGpuClocks(voltage, coreOffset, memoryOffset);
+ }
+
+ private void miNvOverclockingIncluded_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ preset.applyOverclocking = !preset.applyOverclocking;
+
+ AddOrUpdateItem();
+ }
+
+ private void cbxNvGPU_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ RefreshNvGpuInfo();
+ }
+
+ private void RefreshNvGpuInfo()
+ {
+ var gpu = (PhysicalGPU)cbxNvGPU.SelectedItem;
+
+ if (gpu == null)
+ {
+ return;
+ }
+
+ var gpuInfo = NvGpuInfo.GetGpuInfo(gpu);
+ var ocSettings = gpuInfo.GetOverclockSettings();
+
+ edtNvGpuInfo.Text = gpuInfo.ToString();
+ edtNvOverclock.Text = ocSettings.ToString();
+ }
+
+ private void miNvCopyId_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+
+ if (preset != null)
+ {
+ Clipboard.SetText(preset.id.ToString());
+ }
+ }
+
+ private void miNvPresetApplyOnStartup_Click(object sender, EventArgs e)
+ {
+ var preset = GetSelectedNvPreset();
+ _config.NvPresetId_ApplyOnStartup = miNvPresetApplyOnStartup.Checked ? preset.id : 0;
+
+ AddOrUpdateItem();
+ }
+
+ private void ApplyNvPresetOnStartup(int attempts = 5)
+ {
+ var startUpParams = AppContext.CurrentContext.StartUpParams;
+
+ var presetIdOrName = !string.IsNullOrEmpty(startUpParams.NvidiaPresetIdOrName) ? startUpParams.NvidiaPresetIdOrName : _config.NvPresetId_ApplyOnStartup.ToString();
+
+ if (!string.IsNullOrEmpty(presetIdOrName))
+ {
+ var preset = _nvService?.GetPresetByIdOrName(presetIdOrName);
+ if (preset == null)
+ {
+ if (string.IsNullOrEmpty(startUpParams.NvidiaPresetIdOrName))
+ {
+ _config.NvPresetId_ApplyOnStartup = 0;
+ }
+ }
+ else if (_nvService != null)
+ {
+ if (_nvService.HasDisplaysAttached())
+ {
+ ApplyNvPreset(preset);
+ }
+ else
+ {
+ attempts--;
+ if (attempts > 0)
+ {
+ Task.Run(async () =>
+ {
+ await Task.Delay(2000);
+ BeginInvoke(() => ApplyNvPresetOnStartup(attempts));
+ });
+ }
+ }
+ }
+ }
+ }
+
+ private void miNvDithering6bit_Click(object sender, EventArgs e)
+ {
+ var item = sender as ToolStripMenuItem;
+
+ var preset = GetSelectedNvPreset(true);
+
+ var ditheringBits = uint.Parse(item.Tag.ToString());
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetDithering(preset.ditheringEnabled ? NvDitherState.Enabled : NvDitherState.Disabled, ditheringBits, preset.ditheringMode);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.ditheringBits = ditheringBits;
+
+ AddOrUpdateItem();
+ }
+
+ private void spatial1ToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var item = sender as ToolStripMenuItem;
+
+ var preset = GetSelectedNvPreset(true);
+
+ var ditheringMode = uint.Parse(item.Tag.ToString());
+
+ if (preset.IsDisplayPreset)
+ {
+ _nvService.SetDithering(preset.ditheringEnabled ? NvDitherState.Enabled : NvDitherState.Disabled, preset.ditheringBits, ditheringMode);
+
+ UpdateDisplayInfoItems();
+ return;
+ }
+
+ preset.ditheringMode = ditheringMode;
+
+ AddOrUpdateItem();
+ }
+
+ public void AfterInitialized()
+ {
+ ApplyNvPresetOnStartup();
+ }
+
+ internal void Save()
+ {
+ FormUtils.SaveSortState(lvNvPresets.ListViewItemSorter, _config.NvPresetsSortState);
+ }
+
+ internal void UpdateInfo()
+ {
+ UpdateDisplayInfoItems();
+ }
+ }
+}
diff --git a/ColorControl/Services/NVIDIA/NvPanel.resx b/ColorControl/Services/NVIDIA/NvPanel.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ColorControl/Services/NVIDIA/NvPanel.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file