mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-18 23:07:15 -05:00
add Nvidia content type setting, start creating base Xaml window
This commit is contained in:
1 parent
21bd8e2080
commit
e0d1ba13f0
21 files changed
+328
-74
No files matched your search
@@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "novideo_srgb", "novideo_srg
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer", "NLogViewer\NLogViewer.csproj", "{D5E4D314-CFCD-4859-98FC-68F660AC7FB4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -61,6 +63,14 @@ Global
|
||||
{D5E4D314-CFCD-4859-98FC-68F660AC7FB4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D5E4D314-CFCD-4859-98FC-68F660AC7FB4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D5E4D314-CFCD-4859-98FC-68F660AC7FB4}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8F38D6B0-82DA-4DD1-89EB-918D8A18AEB1}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Themes\DarkTheme.xaml" />
|
||||
<None Remove="XForms\LogWindow.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -70,9 +69,6 @@
|
||||
<Content Include="LgPresets.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Resource Include="Themes\DarkTheme.xaml">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="pngbarn.ico" />
|
||||
@@ -113,6 +109,7 @@
|
||||
<ProjectReference Include="..\novideo_srgb\novideo_srgb.csproj" />
|
||||
<ProjectReference Include="..\Nspector\Nspector.csproj" />
|
||||
<ProjectReference Include="..\NvAPIWrapper\NvAPIWrapper.csproj" />
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Services\Samsung\SamsungPanel.resx">
|
||||
|
||||
@@ -1044,13 +1044,20 @@ NOTE: installing the service may cause a User Account Control popup.");
|
||||
bool CompareVersions()
|
||||
{
|
||||
var result = true;
|
||||
var aNumberIsLarger = false;
|
||||
|
||||
for (var i = 0; i < nvParts.Length; i++)
|
||||
{
|
||||
var part = nvParts[i];
|
||||
var cvPart = cvParts[i];
|
||||
var part = Utils.ParseInt(nvParts[i]);
|
||||
var cvPart = Utils.ParseInt(cvParts[i]);
|
||||
|
||||
if (Utils.ParseInt(part) >= Utils.ParseInt(cvPart))
|
||||
if (part > cvPart)
|
||||
{
|
||||
aNumberIsLarger = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (part == cvPart)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1059,7 +1066,7 @@ NOTE: installing the service may cause a User Account Control popup.");
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result && aNumberIsLarger;
|
||||
}
|
||||
|
||||
if (nvParts.Length != cvParts.Length || CompareVersions())
|
||||
|
||||
+29
-11
@@ -87,9 +87,11 @@ namespace ColorControl.Services.NVIDIA
|
||||
lvNvPresets = new System.Windows.Forms.ListView();
|
||||
mnuNvSettings = new System.Windows.Forms.ContextMenuStrip(components);
|
||||
miNvProfileInspector = new System.Windows.Forms.ToolStripMenuItem();
|
||||
miNvNovideo = new System.Windows.Forms.ToolStripMenuItem();
|
||||
miNvSettings = new System.Windows.Forms.ToolStripMenuItem();
|
||||
lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(components);
|
||||
miNvNovideo = new System.Windows.Forms.ToolStripMenuItem();
|
||||
mnuNvOtherSettings = new System.Windows.Forms.ToolStripMenuItem();
|
||||
miNvOtherIncluded = new System.Windows.Forms.ToolStripMenuItem();
|
||||
mnuNvPresets.SuspendLayout();
|
||||
mnuNvSettings.SuspendLayout();
|
||||
SuspendLayout();
|
||||
@@ -320,9 +322,9 @@ namespace ColorControl.Services.NVIDIA
|
||||
// mnuNvPresets
|
||||
//
|
||||
mnuNvPresets.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvApply, miNvPresetApplyOnStartup, tssNvPresetMenu, mnuNvDisplay, mnuNvPresetsColorSettings, mnuRefreshRate, mnuNvResolution, miNvPresetDithering, miNvHDR, mnuNvDriverSettings, mnuNvOverclocking, miNvCopyId });
|
||||
mnuNvPresets.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvApply, miNvPresetApplyOnStartup, tssNvPresetMenu, mnuNvDisplay, mnuNvPresetsColorSettings, mnuRefreshRate, mnuNvResolution, miNvPresetDithering, miNvHDR, mnuNvDriverSettings, mnuNvOtherSettings, mnuNvOverclocking, miNvCopyId });
|
||||
mnuNvPresets.Name = "mnuNvPresets";
|
||||
mnuNvPresets.Size = new System.Drawing.Size(185, 252);
|
||||
mnuNvPresets.Size = new System.Drawing.Size(185, 296);
|
||||
mnuNvPresets.Opening += mnuNvPresets_Opening;
|
||||
//
|
||||
// miNvApply
|
||||
@@ -539,7 +541,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
// miNvDriverSettingsIncluded
|
||||
//
|
||||
miNvDriverSettingsIncluded.Name = "miNvDriverSettingsIncluded";
|
||||
miNvDriverSettingsIncluded.Size = new System.Drawing.Size(120, 22);
|
||||
miNvDriverSettingsIncluded.Size = new System.Drawing.Size(180, 22);
|
||||
miNvDriverSettingsIncluded.Text = "Included";
|
||||
miNvDriverSettingsIncluded.Click += miNvDriverSettingsIncluded_Click;
|
||||
//
|
||||
@@ -553,7 +555,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
// miNvOverclockingIncluded
|
||||
//
|
||||
miNvOverclockingIncluded.Name = "miNvOverclockingIncluded";
|
||||
miNvOverclockingIncluded.Size = new System.Drawing.Size(120, 22);
|
||||
miNvOverclockingIncluded.Size = new System.Drawing.Size(180, 22);
|
||||
miNvOverclockingIncluded.Text = "Included";
|
||||
miNvOverclockingIncluded.Click += miNvOverclockingIncluded_Click;
|
||||
//
|
||||
@@ -604,7 +606,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
mnuNvSettings.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
mnuNvSettings.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvProfileInspector, miNvNovideo, miNvSettings });
|
||||
mnuNvSettings.Name = "mnuLgButtons";
|
||||
mnuNvSettings.Size = new System.Drawing.Size(202, 92);
|
||||
mnuNvSettings.Size = new System.Drawing.Size(202, 70);
|
||||
//
|
||||
// miNvProfileInspector
|
||||
//
|
||||
@@ -613,6 +615,13 @@ namespace ColorControl.Services.NVIDIA
|
||||
miNvProfileInspector.Text = "NVIDIA Profile Inspector";
|
||||
miNvProfileInspector.Click += miNvProfileInspector_Click;
|
||||
//
|
||||
// miNvNovideo
|
||||
//
|
||||
miNvNovideo.Name = "miNvNovideo";
|
||||
miNvNovideo.Size = new System.Drawing.Size(201, 22);
|
||||
miNvNovideo.Text = "Novideo sRGB";
|
||||
miNvNovideo.Click += miNvNovideo_Click;
|
||||
//
|
||||
// miNvSettings
|
||||
//
|
||||
miNvSettings.Name = "miNvSettings";
|
||||
@@ -620,12 +629,19 @@ namespace ColorControl.Services.NVIDIA
|
||||
miNvSettings.Text = "Settings";
|
||||
miNvSettings.Click += miNvSettings_Click;
|
||||
//
|
||||
// miNvNovideo
|
||||
// mnuNvOtherSettings
|
||||
//
|
||||
miNvNovideo.Name = "miNvNovideo";
|
||||
miNvNovideo.Size = new System.Drawing.Size(201, 22);
|
||||
miNvNovideo.Text = "Novideo sRGB";
|
||||
miNvNovideo.Click += miNvNovideo_Click;
|
||||
mnuNvOtherSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miNvOtherIncluded });
|
||||
mnuNvOtherSettings.Name = "mnuNvOtherSettings";
|
||||
mnuNvOtherSettings.Size = new System.Drawing.Size(184, 22);
|
||||
mnuNvOtherSettings.Text = "Other";
|
||||
//
|
||||
// miNvOtherIncluded
|
||||
//
|
||||
miNvOtherIncluded.Name = "miNvOtherIncluded";
|
||||
miNvOtherIncluded.Size = new System.Drawing.Size(180, 22);
|
||||
miNvOtherIncluded.Text = "Included";
|
||||
miNvOtherIncluded.Click += miNvOtherIncluded_Click;
|
||||
//
|
||||
// NvPanel
|
||||
//
|
||||
@@ -724,5 +740,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuNvOverclocking;
|
||||
private System.Windows.Forms.ToolStripMenuItem miNvOverclockingIncluded;
|
||||
private System.Windows.Forms.ToolStripMenuItem miNvNovideo;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuNvOtherSettings;
|
||||
private System.Windows.Forms.ToolStripMenuItem miNvOtherIncluded;
|
||||
}
|
||||
}
|
||||
@@ -326,6 +326,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
miNvDriverSettingsIncluded.Visible = presetItemsVisible;
|
||||
mnuNvDriverSettings.Enabled = preset != null;
|
||||
mnuNvOverclocking.Visible = preset != null && _nvService.Config.ShowOverclocking;
|
||||
mnuNvOtherSettings.Enabled = preset != null;
|
||||
miNvOtherIncluded.Visible = presetItemsVisible;
|
||||
|
||||
if (preset == null)
|
||||
{
|
||||
@@ -406,6 +408,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
miNvHDR.Font = _menuItemFonts[preset.applyHDR];
|
||||
mnuNvOverclocking.Font = _menuItemFonts[preset.applyOverclocking];
|
||||
|
||||
FormUtils.BuildDropDownMenu(mnuNvOtherSettings, "Content type", typeof(InfoFrameVideoContentType), preset, "contentType", nvPresetContentTypeMenuItem_Click);
|
||||
|
||||
BuildNvOverclockingMenu(preset);
|
||||
|
||||
UpdateNvPresetMenuFont();
|
||||
@@ -710,6 +714,27 @@ namespace ColorControl.Services.NVIDIA
|
||||
AddOrUpdateItem();
|
||||
}
|
||||
|
||||
private void nvPresetContentTypeMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var menuItem = (ToolStripMenuItem)sender;
|
||||
|
||||
var value = (InfoFrameVideoContentType)menuItem.Tag;
|
||||
|
||||
var preset = GetSelectedNvPreset(true);
|
||||
|
||||
if (preset.IsDisplayPreset)
|
||||
{
|
||||
_nvService.SetHDMIContentType(preset.Display, value);
|
||||
|
||||
UpdateDisplayInfoItems();
|
||||
return;
|
||||
}
|
||||
|
||||
preset.contentType = value;
|
||||
|
||||
AddOrUpdateItem();
|
||||
}
|
||||
|
||||
private void refreshRateMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var refreshRate = (uint)((ToolStripItem)sender).Tag;
|
||||
@@ -1522,5 +1547,14 @@ namespace ColorControl.Services.NVIDIA
|
||||
{
|
||||
MainWindow.CreateAndShow();
|
||||
}
|
||||
|
||||
private void miNvOtherIncluded_Click(object sender, EventArgs e)
|
||||
{
|
||||
var preset = GetSelectedNvPreset();
|
||||
|
||||
preset.applyOther = !preset.applyOther;
|
||||
|
||||
AddOrUpdateItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
public string displayName { get; set; }
|
||||
public uint ditheringBits { get; set; }
|
||||
public uint ditheringMode { get; set; }
|
||||
public bool applyOther { get; set; }
|
||||
public InfoFrameVideoContentType contentType { get; set; }
|
||||
public bool applyDriverSettings { get; set; }
|
||||
public Dictionary<uint, uint> driverSettings { get; set; }
|
||||
public bool applyOverclocking { get; set; }
|
||||
@@ -55,6 +57,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
primaryDisplay = true;
|
||||
ditheringBits = 1;
|
||||
ditheringMode = 4;
|
||||
contentType = InfoFrameVideoContentType.Auto;
|
||||
applyDriverSettings = false;
|
||||
driverSettings = new Dictionary<uint, uint>();
|
||||
ocSettings = new List<NvGpuOcSettings>();
|
||||
@@ -89,6 +92,9 @@ namespace ColorControl.Services.NVIDIA
|
||||
resolutionHeight = preset.resolutionHeight;
|
||||
applyDriverSettings = preset.applyDriverSettings;
|
||||
driverSettings = new Dictionary<uint, uint>(preset.driverSettings);
|
||||
|
||||
contentType = preset.contentType;
|
||||
applyOther = preset.applyOther;
|
||||
}
|
||||
|
||||
public NvPreset Clone()
|
||||
@@ -100,7 +106,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
public static string[] GetColumnNames()
|
||||
{
|
||||
return new[] { "Name", "Display|140", "Color settings (BPC, format, dyn. range, color space)|260", "Refresh rate|100", "Resolution|120", "Dithering", "HDR", "Driver settings|300", "Overclocking|300", "Shortcut", "Apply on startup" };
|
||||
return new[] { "Name", "Display|140", "Color settings (BPC, format, dyn. range, color space)|260", "Refresh rate|100", "Resolution|120", "Dithering", "HDR", "Driver settings|300", "Other|200", "Overclocking|300", "Shortcut", "Apply on startup" };
|
||||
}
|
||||
|
||||
public override List<string> GetDisplayValues(Config config = null)
|
||||
@@ -133,6 +139,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
values.Add(string.Format("{0}: {1}", applyDriverSettings ? "Included" : "Excluded", GetDriverSettingsDescription()));
|
||||
|
||||
values.Add(string.Format("{0}: {1}", applyOther ? "Included" : "Excluded", $"Content type: {contentType}"));
|
||||
|
||||
values.Add(string.Format("{0}: {1}", applyOverclocking ? "Included" : "Excluded", GetOverclockingSettingsDescription()));
|
||||
|
||||
values.Add(shortcut);
|
||||
|
||||
@@ -322,6 +322,11 @@ namespace ColorControl.Services.NVIDIA
|
||||
}
|
||||
}
|
||||
|
||||
if (preset.applyOther)
|
||||
{
|
||||
SetHDMIContentType(display, preset.contentType);
|
||||
}
|
||||
|
||||
if (preset.applyDithering)
|
||||
{
|
||||
if (!SetDithering(preset.ditheringEnabled ? NvDitherState.Enabled : NvDitherState.Disabled, preset: preset))
|
||||
@@ -648,7 +653,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
return GetAvailableRefreshRatesInternal(display.Name, portrait, desktopRect.Width, desktopRect.Height);
|
||||
}
|
||||
|
||||
private bool IsDisplayInPortraitMode(NvAPIWrapper.Display.Display display)
|
||||
private bool IsDisplayInPortraitMode(Display display)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -692,6 +697,30 @@ namespace ColorControl.Services.NVIDIA
|
||||
return hdr?.HDRMode == ColorDataHDRMode.UHDA;
|
||||
}
|
||||
|
||||
public void SetHDMIContentType(Display display, InfoFrameVideoContentType contentType)
|
||||
{
|
||||
var displayDevice = display.DisplayDevice;
|
||||
|
||||
var info = displayDevice.HDMIVideoFrameCurrentInformation;
|
||||
|
||||
if (info.HasValue)
|
||||
{
|
||||
var infoValue = info.Value;
|
||||
|
||||
infoValue.SetContentType(contentType);
|
||||
|
||||
displayDevice.SetHDMIVideoFrameInformation(infoValue);
|
||||
}
|
||||
}
|
||||
public InfoFrameVideoContentType GetHDMIContentType(Display display)
|
||||
{
|
||||
var displayDevice = display.DisplayDevice;
|
||||
|
||||
var info = displayDevice.HDMIVideoFrameCurrentInformation;
|
||||
|
||||
return info.HasValue ? info.Value.ContentType : InfoFrameVideoContentType.Auto;
|
||||
}
|
||||
|
||||
public Display[] GetDisplays()
|
||||
{
|
||||
return Display.GetDisplays();
|
||||
@@ -799,6 +828,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
values.Add(string.Join(", ", drsValues));
|
||||
|
||||
values.Add($"Content type: {GetHDMIContentType(display)}");
|
||||
|
||||
var infoLine = string.Format("{0}: {1}, {2}Hz, HDR: {3}", name, colorSettings, refreshRate, hdrEnabled ? "Yes" : "No");
|
||||
|
||||
var displayInfo = new NvDisplayInfo(display, values, infoLine, name);
|
||||
@@ -831,6 +862,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
preset.displayName = FormUtils.ExtendedDisplayName(display.Name);
|
||||
preset.colorData = GetCurrentColorData(display);
|
||||
preset.contentType = GetHDMIContentType(display);
|
||||
|
||||
var mode = GetCurrentMode(display.Name);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="ColorControl.XForms.LogWindow"
|
||||
<src:BaseWindow x:Class="ColorControl.XForms.LogWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -12,6 +12,7 @@
|
||||
WindowStartupLocation="CenterOwner"
|
||||
SnapsToDevicePixels="True"
|
||||
Style="{DynamicResource CustomWindowStyle}"
|
||||
xmlns:src="clr-namespace:ColorControl.Shared.XForms;assembly=Shared"
|
||||
d:DesignHeight="720" d:DesignWidth="1280" Loaded="Window_Loaded">
|
||||
<DockPanel Margin="6 0 6 6" LastChildFill="True">
|
||||
<GroupBox DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="0,6,0,0" VerticalAlignment="Bottom" Header="Log settings" Padding="6">
|
||||
@@ -46,4 +47,4 @@
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
</src:BaseWindow>
|
||||
@@ -1,6 +1,7 @@
|
||||
using ColorControl.Common;
|
||||
using ColorControl.Forms;
|
||||
using ColorControl.Native;
|
||||
using ColorControl.Shared.XForms;
|
||||
using ColorControl.Svc;
|
||||
using DJ;
|
||||
using NLog;
|
||||
@@ -15,7 +16,7 @@ using System.Windows.Navigation;
|
||||
|
||||
namespace ColorControl.XForms
|
||||
{
|
||||
public partial class LogWindow : Window
|
||||
public partial class LogWindow : BaseWindow
|
||||
{
|
||||
private static LogWindow _window;
|
||||
|
||||
@@ -77,7 +78,7 @@ namespace ColorControl.XForms
|
||||
{
|
||||
if (DarkModeUtils.UseDarkMode)
|
||||
{
|
||||
var dict = new ResourceDictionary { Source = new Uri($"Themes/DarkTheme.xaml", UriKind.Relative) };
|
||||
var dict = new ResourceDictionary { Source = new Uri($"pack://application:,,,/Shared;component/Themes/DarkTheme.xaml", UriKind.Absolute) };
|
||||
|
||||
if (Application.Current.Resources.MergedDictionaries.Any())
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using NvAPIWrapper.Native.Helpers;
|
||||
using NvAPIWrapper.Native.Helpers;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NvAPIWrapper.Native.Display.Structures
|
||||
{
|
||||
@@ -10,7 +10,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
public struct InfoFrameVideo
|
||||
{
|
||||
[FieldOffset(0)] private readonly uint _WordAt0;
|
||||
[FieldOffset(4)] private readonly uint _WordAt4;
|
||||
[FieldOffset(4)] private uint _WordAt4;
|
||||
[FieldOffset(8)] private readonly uint _WordAt8;
|
||||
[FieldOffset(12)] private readonly uint _WordAt12;
|
||||
[FieldOffset(16)] private readonly uint _WordAt16;
|
||||
@@ -62,22 +62,22 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
{
|
||||
_WordAt0 = 0u
|
||||
.SetBits(0, 8, videoIdentificationCode)
|
||||
.SetBits(8, 5, (uint) pixelRepetition)
|
||||
.SetBits(13, 3, (uint) colorFormat)
|
||||
.SetBits(16, 3, (uint) colorimetry)
|
||||
.SetBits(19, 4, (uint) extendedColorimetry)
|
||||
.SetBits(23, 3, (uint) rgbQuantization)
|
||||
.SetBits(26, 3, (uint) yccQuantization)
|
||||
.SetBits(29, 2, (uint) contentMode);
|
||||
.SetBits(8, 5, (uint)pixelRepetition)
|
||||
.SetBits(13, 3, (uint)colorFormat)
|
||||
.SetBits(16, 3, (uint)colorimetry)
|
||||
.SetBits(19, 4, (uint)extendedColorimetry)
|
||||
.SetBits(23, 3, (uint)rgbQuantization)
|
||||
.SetBits(26, 3, (uint)yccQuantization)
|
||||
.SetBits(29, 2, (uint)contentMode);
|
||||
|
||||
_WordAt4 = 0u
|
||||
.SetBits(0, 3, (uint) contentType)
|
||||
.SetBits(3, 3, (uint) scanInfo)
|
||||
.SetBits(6, 2, (uint) isActiveFormatInfoPresent)
|
||||
.SetBits(8, 5, (uint) activeFormatAspectRatio)
|
||||
.SetBits(13, 3, (uint) pictureAspectRatio)
|
||||
.SetBits(16, 3, (uint) nonUniformPictureScaling)
|
||||
.SetBits(19, 3, (uint) barInfo);
|
||||
.SetBits(0, 3, (uint)contentType)
|
||||
.SetBits(3, 3, (uint)scanInfo)
|
||||
.SetBits(6, 2, (uint)isActiveFormatInfoPresent)
|
||||
.SetBits(8, 5, (uint)activeFormatAspectRatio)
|
||||
.SetBits(13, 3, (uint)pictureAspectRatio)
|
||||
.SetBits(16, 3, (uint)nonUniformPictureScaling)
|
||||
.SetBits(19, 3, (uint)barInfo);
|
||||
|
||||
_WordAt8 = topBar == null ? 0x1FFFF : 0u.SetBits(0, 17, topBar.Value);
|
||||
_WordAt12 = bottomBar == null ? 0x1FFFF : 0u.SetBits(0, 17, bottomBar.Value);
|
||||
@@ -85,6 +85,20 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
_WordAt20 = rightBar == null ? 0x1FFFF : 0u.SetBits(0, 17, rightBar.Value);
|
||||
}
|
||||
|
||||
public void SetContentType(InfoFrameVideoContentType contentType)
|
||||
{
|
||||
var newWord = 0u
|
||||
.SetBits(0, 3, (uint)contentType)
|
||||
.SetBits(3, 3, (uint)ScanInfo)
|
||||
.SetBits(6, 2, (uint)IsActiveFormatInfoPresent)
|
||||
.SetBits(8, 5, (uint)ActiveFormatAspectRatio)
|
||||
.SetBits(13, 3, (uint)PictureAspectRatio)
|
||||
.SetBits(16, 3, (uint)NonUniformPictureScaling)
|
||||
.SetBits(19, 3, (uint)BarInfo);
|
||||
|
||||
_WordAt4 = newWord;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the video identification code (VIC)
|
||||
/// </summary>
|
||||
@@ -93,7 +107,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = (byte) _WordAt0.GetBits(0, 8);
|
||||
var value = (byte)_WordAt0.GetBits(0, 8);
|
||||
|
||||
if (value == 0xFF)
|
||||
{
|
||||
@@ -109,7 +123,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoPixelRepetition PixelRepetition
|
||||
{
|
||||
get => (InfoFrameVideoPixelRepetition) _WordAt0.GetBits(8, 5);
|
||||
get => (InfoFrameVideoPixelRepetition)_WordAt0.GetBits(8, 5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +131,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoColorFormat ColorFormat
|
||||
{
|
||||
get => (InfoFrameVideoColorFormat) _WordAt0.GetBits(13, 3);
|
||||
get => (InfoFrameVideoColorFormat)_WordAt0.GetBits(13, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -125,7 +139,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoColorimetry Colorimetry
|
||||
{
|
||||
get => (InfoFrameVideoColorimetry) _WordAt0.GetBits(16, 3);
|
||||
get => (InfoFrameVideoColorimetry)_WordAt0.GetBits(16, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -141,7 +155,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
return null;
|
||||
}
|
||||
|
||||
return (InfoFrameVideoExtendedColorimetry) _WordAt0.GetBits(19, 4);
|
||||
return (InfoFrameVideoExtendedColorimetry)_WordAt0.GetBits(19, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +164,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoRGBQuantization RGBQuantization
|
||||
{
|
||||
get => (InfoFrameVideoRGBQuantization) _WordAt0.GetBits(23, 3);
|
||||
get => (InfoFrameVideoRGBQuantization)_WordAt0.GetBits(23, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,7 +172,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoYCCQuantization YCCQuantization
|
||||
{
|
||||
get => (InfoFrameVideoYCCQuantization) _WordAt0.GetBits(26, 3);
|
||||
get => (InfoFrameVideoYCCQuantization)_WordAt0.GetBits(26, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -166,7 +180,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoITC ContentMode
|
||||
{
|
||||
get => (InfoFrameVideoITC) _WordAt0.GetBits(29, 2);
|
||||
get => (InfoFrameVideoITC)_WordAt0.GetBits(29, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -174,7 +188,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoContentType ContentType
|
||||
{
|
||||
get => (InfoFrameVideoContentType) _WordAt4.GetBits(0, 3);
|
||||
get => (InfoFrameVideoContentType)_WordAt4.GetBits(0, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -182,7 +196,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoScanInfo ScanInfo
|
||||
{
|
||||
get => (InfoFrameVideoScanInfo) _WordAt4.GetBits(3, 3);
|
||||
get => (InfoFrameVideoScanInfo)_WordAt4.GetBits(3, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -190,7 +204,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameBoolean IsActiveFormatInfoPresent
|
||||
{
|
||||
get => (InfoFrameBoolean) _WordAt4.GetBits(6, 2);
|
||||
get => (InfoFrameBoolean)_WordAt4.GetBits(6, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -198,7 +212,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoAspectRatioActivePortion ActiveFormatAspectRatio
|
||||
{
|
||||
get => (InfoFrameVideoAspectRatioActivePortion) _WordAt4.GetBits(8, 5);
|
||||
get => (InfoFrameVideoAspectRatioActivePortion)_WordAt4.GetBits(8, 5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -206,7 +220,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoAspectRatioCodedFrame PictureAspectRatio
|
||||
{
|
||||
get => (InfoFrameVideoAspectRatioCodedFrame) _WordAt4.GetBits(13, 3);
|
||||
get => (InfoFrameVideoAspectRatioCodedFrame)_WordAt4.GetBits(13, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -214,7 +228,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoNonUniformPictureScaling NonUniformPictureScaling
|
||||
{
|
||||
get => (InfoFrameVideoNonUniformPictureScaling) _WordAt4.GetBits(16, 3);
|
||||
get => (InfoFrameVideoNonUniformPictureScaling)_WordAt4.GetBits(16, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -222,7 +236,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
/// </summary>
|
||||
public InfoFrameVideoBarData BarInfo
|
||||
{
|
||||
get => (InfoFrameVideoBarData) _WordAt4.GetBits(19, 3);
|
||||
get => (InfoFrameVideoBarData)_WordAt4.GetBits(19, 3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -244,7 +258,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
return null;
|
||||
}
|
||||
|
||||
return (uint) val;
|
||||
return (uint)val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +281,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
return null;
|
||||
}
|
||||
|
||||
return (uint) val;
|
||||
return (uint)val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +304,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
return null;
|
||||
}
|
||||
|
||||
return (uint) val;
|
||||
return (uint)val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +327,7 @@ namespace NvAPIWrapper.Native.Display.Structures
|
||||
return null;
|
||||
}
|
||||
|
||||
return (uint) val;
|
||||
return (uint)val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows10.0.20348.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Themes\DarkTheme.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Themes\DarkTheme.xaml">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
File renamed without changes.
@@ -0,0 +1,45 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ColorControl.Shared.XForms
|
||||
{
|
||||
public partial class BaseWindow : Window
|
||||
{
|
||||
public BaseWindow() : base()
|
||||
{
|
||||
}
|
||||
|
||||
//protected void InitThemeAfterShow()
|
||||
//{
|
||||
// var useDarkTheme = DarkModeUtils.UseDarkMode;
|
||||
|
||||
// var handle = new WindowInteropHelper(this).Handle;
|
||||
|
||||
// var value = useDarkTheme ? 1 : 0;
|
||||
|
||||
// // Takes care of title bar
|
||||
// WinApi.DwmSetWindowAttribute(handle, DarkModeUtils.DWMWA_USE_IMMERSIVE_DARK_MODE, ref value, 4);
|
||||
//}
|
||||
|
||||
//protected void InitTheme()
|
||||
//{
|
||||
// if (DarkModeUtils.UseDarkMode)
|
||||
// {
|
||||
// var dict = new ResourceDictionary { Source = new Uri($"pack://application:,,,/Shared;component/Themes/DarkTheme.xaml", UriKind.Absolute) };
|
||||
|
||||
// if (Application.Current.Resources.MergedDictionaries.Any())
|
||||
// {
|
||||
// Application.Current.Resources.MergedDictionaries[0] = dict;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Application.Current.Resources.MergedDictionaries.Add(dict);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Application.Current.Resources.MergedDictionaries.Clear();
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="novideo_srgb.AboutWindow"
|
||||
<src:BaseWindow x:Class="novideo_srgb.AboutWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -6,6 +6,7 @@
|
||||
mc:Ignorable="d"
|
||||
Title="About"
|
||||
SizeToContent="WidthAndHeight"
|
||||
xmlns:src="clr-namespace:ColorControl.Shared.XForms;assembly=Shared"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
SnapsToDevicePixels="True">
|
||||
@@ -19,4 +20,4 @@
|
||||
<Hyperlink RequestNavigate="OnRequestNavigate" NavigateUri="https://github.com/ledoge/novideo_srgb">https://github.com/ledoge/novideo_srgb</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
</src:BaseWindow>
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Windows;
|
||||
using ColorControl.Shared.XForms;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace novideo_srgb
|
||||
{
|
||||
public partial class AboutWindow : Window
|
||||
public partial class AboutWindow : BaseWindow
|
||||
{
|
||||
public AboutWindow()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="novideo_srgb.AdvancedWindow"
|
||||
<src:BaseWindow x:Class="novideo_srgb.AdvancedWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -6,6 +6,7 @@
|
||||
mc:Ignorable="d"
|
||||
xmlns:local="clr-namespace:novideo_srgb"
|
||||
Title="Advanced"
|
||||
xmlns:src="clr-namespace:ColorControl.Shared.XForms;assembly=Shared"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="WidthAndHeight"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
@@ -163,4 +164,4 @@
|
||||
<Button Width="75" IsCancel="True">Cancel</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
</src:BaseWindow>
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.Windows;
|
||||
using ColorControl.Shared.XForms;
|
||||
using System.Windows;
|
||||
|
||||
namespace novideo_srgb
|
||||
{
|
||||
public partial class AdvancedWindow
|
||||
public partial class AdvancedWindow : BaseWindow
|
||||
{
|
||||
private AdvancedViewModel _viewModel;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Window x:Class="novideo_srgb.MainWindow"
|
||||
<src:BaseWindow x:Class="novideo_srgb.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@@ -6,6 +6,8 @@
|
||||
xmlns:local="clr-namespace:novideo_srgb"
|
||||
ResizeMode="CanMinimize"
|
||||
mc:Ignorable="d"
|
||||
Style="{DynamicResource CustomWindowStyle}"
|
||||
xmlns:src="clr-namespace:ColorControl.Shared.XForms;assembly=Shared"
|
||||
Title="Novideo sRGB" Height="320" Width="500" MinHeight="150" MinWidth="300">
|
||||
<Window.DataContext>
|
||||
<local:MainViewModel />
|
||||
@@ -70,4 +72,4 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
</src:BaseWindow>
|
||||
@@ -1,10 +1,11 @@
|
||||
using Microsoft.Win32;
|
||||
using ColorControl.Shared.XForms;
|
||||
using Microsoft.Win32;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
|
||||
namespace novideo_srgb
|
||||
{
|
||||
public partial class MainWindow
|
||||
public partial class MainWindow : BaseWindow
|
||||
{
|
||||
private readonly MainViewModel _viewModel;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NvAPIWrapper\NvAPIWrapper.csproj" />
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in new issue
Block a user