mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Initial working AMD displayview
Have managed to get a working displayview for AMD (not working in spanned mode) and currently playing with the colours and layout. Once I have something locked in, I'll troubleshoot the ProfileDisplay file writing.
This commit is contained in:
parent
6a3068fb32
commit
99d43bc245
@ -340,6 +340,8 @@
|
||||
<None Include="Resources\Epic.png" />
|
||||
<None Include="Resources\Origin.png" />
|
||||
<None Include="Resources\GOG.png" />
|
||||
<None Include="Resources\amdblack.png" />
|
||||
<None Include="Resources\amdwhite.png" />
|
||||
<Content Include="Resources\redarrows.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
20
DisplayMagician/Properties/Resources.Designer.cs
generated
20
DisplayMagician/Properties/Resources.Designer.cs
generated
@ -60,6 +60,26 @@ namespace DisplayMagician.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap amdblack {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("amdblack", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap amdwhite {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("amdwhite", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
|
@ -154,4 +154,10 @@
|
||||
<data name="GOG" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GOG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="amdblack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\amdblack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="amdwhite" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\amdwhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
DisplayMagician/Resources/amdblack.png
Normal file
BIN
DisplayMagician/Resources/amdblack.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
DisplayMagician/Resources/amdwhite.png
Normal file
BIN
DisplayMagician/Resources/amdwhite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
BIN
DisplayMagician/Resources/nvidiablack.png
Normal file
BIN
DisplayMagician/Resources/nvidiablack.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
BIN
DisplayMagician/Resources/nvidiawhitee.png
Normal file
BIN
DisplayMagician/Resources/nvidiawhitee.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -54,11 +54,11 @@ namespace DisplayMagician.UIForms
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tt_selected = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.lbl_save_profile = new System.Windows.Forms.Label();
|
||||
this.dv_profile = new DisplayMagicianShared.UserControls.DisplayView();
|
||||
this.btn_save = new System.Windows.Forms.Button();
|
||||
this.dialog_save = new System.Windows.Forms.SaveFileDialog();
|
||||
this.btn_hotkey = new System.Windows.Forms.Button();
|
||||
this.lbl_hotkey_assigned = new System.Windows.Forms.Label();
|
||||
this.dv_profile = new DisplayMagicianShared.UserControls.DisplayView();
|
||||
this.menu_profiles.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pb_down_arrow)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -290,22 +290,6 @@ namespace DisplayMagician.UIForms
|
||||
" DisplayMagician and click \'Save As\' to save this Display Profile.";
|
||||
this.lbl_save_profile.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// dv_profile
|
||||
//
|
||||
this.dv_profile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dv_profile.BackColor = System.Drawing.Color.DimGray;
|
||||
this.dv_profile.Font = new System.Drawing.Font("Consolas", 50F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.dv_profile.ForeColor = System.Drawing.Color.MidnightBlue;
|
||||
this.dv_profile.Location = new System.Drawing.Point(0, 63);
|
||||
this.dv_profile.Margin = new System.Windows.Forms.Padding(18);
|
||||
this.dv_profile.Name = "dv_profile";
|
||||
this.dv_profile.PaddingX = 100;
|
||||
this.dv_profile.PaddingY = 100;
|
||||
this.dv_profile.Profile = null;
|
||||
this.dv_profile.Size = new System.Drawing.Size(976, 517);
|
||||
this.dv_profile.TabIndex = 4;
|
||||
//
|
||||
// btn_save
|
||||
//
|
||||
this.btn_save.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
@ -360,6 +344,22 @@ namespace DisplayMagician.UIForms
|
||||
this.lbl_hotkey_assigned.Visible = false;
|
||||
this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click);
|
||||
//
|
||||
// dv_profile
|
||||
//
|
||||
this.dv_profile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dv_profile.BackColor = System.Drawing.Color.DimGray;
|
||||
this.dv_profile.Font = new System.Drawing.Font("Consolas", 50F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.dv_profile.ForeColor = System.Drawing.Color.MidnightBlue;
|
||||
this.dv_profile.Location = new System.Drawing.Point(0, 63);
|
||||
this.dv_profile.Margin = new System.Windows.Forms.Padding(18);
|
||||
this.dv_profile.Name = "dv_profile";
|
||||
this.dv_profile.PaddingX = 100;
|
||||
this.dv_profile.PaddingY = 100;
|
||||
this.dv_profile.Profile = null;
|
||||
this.dv_profile.Size = new System.Drawing.Size(976, 517);
|
||||
this.dv_profile.TabIndex = 4;
|
||||
//
|
||||
// DisplayProfileForm
|
||||
//
|
||||
this.AcceptButton = this.btn_apply;
|
||||
|
@ -277,30 +277,30 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLMode
|
||||
{
|
||||
/// <summary> Display IDs. </summary>
|
||||
internal ADLDisplayID DisplayID;
|
||||
/// <summary> Screen refresh rate. </summary>
|
||||
internal float RefreshRate;
|
||||
/// <summary> Adapter index. </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> Display IDs. </summary>
|
||||
internal ADLDisplayID DisplayID;
|
||||
/// <summary> Screen position X coordinate. </summary>
|
||||
internal int XPos;
|
||||
/// <summary> Screen position Y coordinate. </summary>
|
||||
internal int YPos;
|
||||
/// <summary> Screen resolution Width. </summary>
|
||||
internal int XRes;
|
||||
/// <summary> Screen resolution Height. </summary>
|
||||
internal int YRes;
|
||||
/// <summary> Screen Color Depth. E.g., 16, 32. </summary>
|
||||
internal int ColourDepth;
|
||||
/// <summary> Screen refresh rate. </summary>
|
||||
internal float RefreshRate;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> Vista mode flag indicating Progressive or Interlaced mode. </summary>
|
||||
internal int ModeFlag;
|
||||
/// <summary> The bit mask identifying the number of bits this Mode is currently using. </summary>
|
||||
internal int ModeMask;
|
||||
/// <summary> The bit mask identifying the display status. </summary>
|
||||
internal int ModeValue;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> Screen position X coordinate. </summary>
|
||||
internal int XPos;
|
||||
/// <summary> Screen resolution Width. </summary>
|
||||
internal int XRes;
|
||||
/// <summary> Screen position Y coordinate. </summary>
|
||||
internal int YPos;
|
||||
/// <summary> Screen resolution Height. </summary>
|
||||
internal int YRes;
|
||||
internal int ModeValue;
|
||||
}
|
||||
|
||||
internal struct ConvertedDisplayModeFlags
|
||||
@ -457,19 +457,20 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLDisplayEDIDData
|
||||
{
|
||||
/// <summary> Size</summary>
|
||||
internal int Size;
|
||||
/// <summary> Flag</summary>
|
||||
internal int Flag;
|
||||
/// <summary> EDIDSize </summary>
|
||||
internal int EDIDSize;
|
||||
/// <summary> Block Index </summary>
|
||||
internal int BlockIndex;
|
||||
/// <summary> EDIDData [256] </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)ADL.ADL_MAX_EDIDDATA_SIZE)]
|
||||
internal string EDIDData;
|
||||
/// <summary> Block Index </summary>
|
||||
internal int BlockIndex;
|
||||
/// <summary> EDIDSize </summary>
|
||||
internal int EDIDSize;
|
||||
/// <summary> Flag</summary>
|
||||
internal int Flag;
|
||||
/// <summary> Reserved </summary>
|
||||
internal int Reserved;
|
||||
/// <summary> Size</summary>
|
||||
internal int Size;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
internal int[] Reserved;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -670,6 +671,8 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLDisplayConfig
|
||||
{
|
||||
/// <summary> Size of this data structure </summary>
|
||||
internal long Size;
|
||||
/// <summary> HDTV Connector Type </summary>
|
||||
internal long ConnectorType;
|
||||
/// <summary> HDTV Capabilities themselves </summary>
|
||||
@ -678,26 +681,25 @@ namespace ATI.ADL
|
||||
internal long OverriddedDeviceData;
|
||||
/// <summary> Reserved for future use</summary>
|
||||
internal long Reserved;
|
||||
/// <summary> Size of this data structure </summary>
|
||||
internal long Size;
|
||||
|
||||
}
|
||||
|
||||
/// <summary> ADLDisplayMap Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLDisplayMap
|
||||
{
|
||||
/// <summary> The Display Mode for the current map.</summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The current display map index. It is the OS desktop index. For example, if the OS index 1 is showing clone mode, the display map will be 1. </summary>
|
||||
internal int DisplayMapIndex;
|
||||
/// <summary> The Display Mode for the current map.</summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The number of display targets belongs to this map </summary>
|
||||
internal int NumDisplayTarget;
|
||||
/// <summary> The first target array index in the Target array </summary>
|
||||
internal int FirstDisplayTargetArrayIndex;
|
||||
/// <summary> The bit mask identifies the number of bits DisplayMap is currently using. It is the sum of all the bit definitions defined in ADL_DISPLAY_DISPLAYMAP_MANNER_xxx.</summary>
|
||||
internal int DisplayMapMask;
|
||||
/// <summary> The bit mask identifies the display status. The detailed definition is in ADL_DISPLAY_DISPLAYMAP_MANNER_xxx.</summary>
|
||||
internal int DisplayMapValue;
|
||||
/// <summary> The first target array index in the Target array </summary>
|
||||
internal int FirstDisplayTargetArrayIndex;
|
||||
/// <summary> The number of display targets belongs to this map </summary>
|
||||
internal int NumDisplayTarget;
|
||||
internal int DisplayMapValue;
|
||||
}
|
||||
|
||||
/// <summary> ADLDisplayMapArray Array</summary>
|
||||
@ -741,14 +743,14 @@ namespace ATI.ADL
|
||||
{
|
||||
/// <summary> The Adapter index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The grid column </summary>
|
||||
internal int SLSGridColumn;
|
||||
/// <summary> The grid index </summary>
|
||||
internal int SLSGridIndex;
|
||||
/// <summary> The grid bit mask identifies the number of bits DisplayMap is currently using. </summary>
|
||||
internal int SLSGridMask;
|
||||
/// <summary>The grid row. </summary>
|
||||
internal int SLSGridRow;
|
||||
/// <summary> The grid column </summary>
|
||||
internal int SLSGridColumn;
|
||||
/// <summary> The grid bit mask identifies the number of bits DisplayMap is currently using. </summary>
|
||||
internal int SLSGridMask;
|
||||
/// <summary> The grid bit value identifies the display status. </summary>
|
||||
internal int SLSGridValue;
|
||||
}
|
||||
@ -757,58 +759,59 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSMap
|
||||
{
|
||||
/// <summary> The current grid </summary>
|
||||
internal ADLSLSGrid Grid;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The first bezel mode array index in the native mode array </summary>
|
||||
internal int FirstBezelModeArrayIndex;
|
||||
/// <summary> The first bezel offset array index in the native mode array </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary>The first native mode array index in the native mode array. </summary>
|
||||
internal int FirstNativeModeArrayIndex;
|
||||
/// <summary> The first target array index in the Target array. </summary>
|
||||
internal int FirstSLSTargetArrayIndex;
|
||||
/// <summary> The number of bezel modes belongs to this map. </summary>
|
||||
internal int NumBezelMode;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The number of native modes belongs to this map. </summary>
|
||||
internal int NumNativeMode;
|
||||
/// <summary> The number of display targets belongs to this map. </summary>
|
||||
internal int NumSLSTarget;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The current grid </summary>
|
||||
internal ADLSLSGrid Grid;
|
||||
/// <summary> OS Surface Index </summary>
|
||||
internal int SurfaceMapIndex;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> The number of display targets belongs to this map. </summary>
|
||||
internal int NumSLSTarget;
|
||||
/// <summary> The first target array index in the Target array. </summary>
|
||||
internal int FirstSLSTargetArrayIndex;
|
||||
/// <summary> The number of native modes belongs to this map. </summary>
|
||||
internal int NumNativeMode;
|
||||
/// <summary>The first native mode array index in the native mode array. </summary>
|
||||
internal int FirstNativeModeArrayIndex;
|
||||
/// <summary> The number of bezel modes belongs to this map. </summary>
|
||||
internal int NumBezelMode;
|
||||
/// <summary> The first bezel mode array index in the native mode array </summary>
|
||||
internal int FirstBezelModeArrayIndex;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The first bezel offset array index in the native mode array </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary> Bitmask identifies display map status </summary>
|
||||
internal int SLSMapMask;
|
||||
/// <summary> Bitmask identifies display map status </summary>
|
||||
internal int SLSMapValue;
|
||||
/// <summary> OS Surface Index </summary>
|
||||
internal int SurfaceMapIndex;
|
||||
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSTarget Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSTarget
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLDisplayTarget DisplayTarget;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The SLS map index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLDisplayTarget DisplayTarget;
|
||||
/// <summary> Target postion X in SLS grid </summary>
|
||||
internal int SLSGridPositionX;
|
||||
/// <summary> Target postion Y in SLS grid </summary>
|
||||
internal int SLSGridPositionY;
|
||||
/// <summary> The SLS map index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The view size width, height and rotation angle per SLS Target. </summary>
|
||||
internal ADLMode ViewSize;
|
||||
/// <summary> The bit mask identifies the bits in iSLSTargetValue are currently used. </summary>
|
||||
internal int SLSTargetMask;
|
||||
/// <summary> The bit mask identifies status info. </summary>
|
||||
internal int SLSTargetValue;
|
||||
/// <summary> The view size width, height and rotation angle per SLS Target. </summary>
|
||||
internal ADLMode ViewSize;
|
||||
internal int SLSTargetValue;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSTarget Array</summary>
|
||||
@ -824,14 +827,14 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSMode
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The mode index. </summary>
|
||||
internal int SLSModeIndex;
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The bit mask identifies the number of bits Mode is currently using. </summary>
|
||||
internal int SLSNativeModeMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
@ -843,48 +846,49 @@ namespace ATI.ADL
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLBezelTransientMode
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The first bezel offset array index in the native mode array. </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The bit mask identifies the bits this structure is currently using. </summary>
|
||||
internal int SLSBezelTransientModeMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int SLSBezelTransientModeValue;
|
||||
/// <summary> SLS Map Index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> SLS Mode Index. </summary>
|
||||
internal int SLSModeIndex;
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The first bezel offset array index in the native mode array. </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary> The bit mask identifies the bits this structure is currently using. </summary>
|
||||
internal int SLSBezelTransientModeMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int SLSBezelTransientModeValue;
|
||||
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSOffset Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSOffset
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int BezelOffsetValue;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLDisplayID DisplayID;
|
||||
/// <summary> SLS Bezel Mode Index. </summary>
|
||||
internal int BezelModeIndex;
|
||||
/// <summary> The bit mask identifies the number of bits Offset is currently using. </summary>
|
||||
internal int BezelOffsetMask;
|
||||
/// <summary>SLS Bezel Offset X. </summary>
|
||||
internal int BezelOffsetX;
|
||||
/// <summary>SLS Bezel Offset Y. </summary>
|
||||
internal int BezelOffsetY;
|
||||
/// <summary> SLS Display Height. </summary>
|
||||
internal int DisplayHeight;
|
||||
/// <summary> SLS Display Width. </summary>
|
||||
internal int DisplayWidth;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> SLS Display Height. </summary>
|
||||
internal int DisplayHeight;
|
||||
/// <summary> The bit mask identifies the number of bits Offset is currently using. </summary>
|
||||
internal int BezelOffsetMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int BezelOffsetValue;
|
||||
}
|
||||
|
||||
#endregion ADLSLS
|
||||
|
@ -38,6 +38,8 @@ namespace DisplayMagicianShared.AMD
|
||||
// Struct to store the Display
|
||||
public struct AMDDisplay
|
||||
{
|
||||
internal string DisplayName;
|
||||
internal string DisplayConnector;
|
||||
internal List<ADLMode> DisplayModes;
|
||||
}
|
||||
|
||||
@ -1190,12 +1192,15 @@ namespace DisplayMagicianShared.AMD
|
||||
|
||||
SharedLogger.logger.Trace($"AMDLibrary/GetActiveProfile: AMD Adapter #{oneAdapter.AdapterIndex.ToString()} ({oneAdapter.AdapterName}) AdapterID display ID#{oneDisplayInfo.DisplayID.DisplayLogicalIndex} is connected and mapped in Windows OS");
|
||||
|
||||
// Store the Display information for later
|
||||
|
||||
ADL.ADLDisplayConnectionType displayConnector = (ADL.ADLDisplayConnectionType)oneDisplayInfo.DisplayConnector;
|
||||
|
||||
// Store the Display information for later
|
||||
AMDDisplay displayToCreate = new AMDDisplay();
|
||||
displayToCreate.DisplayModes = new List<ADLMode>();
|
||||
displayToCreate.DisplayName = oneDisplayInfo.DisplayName;
|
||||
displayToCreate.DisplayConnector = displayConnector.ToString("G");
|
||||
|
||||
ADL.ADLDisplayConnectionType displayConnector = (ADL.ADLDisplayConnectionType)oneDisplayInfo.DisplayConnector;
|
||||
|
||||
|
||||
SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: ### Display Info for Display #{oneDisplayInfo.DisplayID.DisplayLogicalIndex} on Adapter #{oneAdapter.AdapterIndex} ###");
|
||||
SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: Display Connector = {displayConnector.ToString("G")}");
|
||||
@ -1476,8 +1481,6 @@ namespace DisplayMagicianShared.AMD
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add it to the list of display identifiers so we can return it
|
||||
displayIdentifiers.Add(displayIdentifier);
|
||||
|
||||
SharedLogger.logger.Debug($"ProfileRepository/GetActiveprofile: DisplayIdentifier: {displayIdentifier}");
|
||||
}
|
||||
@ -1519,7 +1522,7 @@ namespace DisplayMagicianShared.AMD
|
||||
{
|
||||
SharedLogger.logger.Warn($"AMDLibrary/GetActiveprofile: There were no AMD adapters found by AMD ADL.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Return the profile
|
||||
return profileToCreate;
|
||||
@ -1540,13 +1543,37 @@ namespace DisplayMagicianShared.AMD
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<ScreenPosition> GenerateScreenPositions()
|
||||
/*public List<ScreenPosition> GenerateScreenPositions(AMDProfile profileToCreate)
|
||||
{
|
||||
List<ScreenPosition> screens = new List<ScreenPosition>();
|
||||
|
||||
|
||||
if (profileToCreate.Adapters.Count > 0)
|
||||
{
|
||||
foreach (var adapter in profileToCreate.Adapters)
|
||||
{
|
||||
foreach (var display in adapter.Displays)
|
||||
{
|
||||
foreach (var mode in display.DisplayModes)
|
||||
{
|
||||
ScreenPosition screen = new ScreenPosition();
|
||||
screen.Colour = Color.Red; // represents AMD
|
||||
screen.Name = mode.DisplayID.ToString();
|
||||
screen.ScreenX = mode.XPos;
|
||||
screen.ScreenY = mode.YPos;
|
||||
screen.ScreenWidth = mode.XRes;
|
||||
screen.ScreenHeight = mode.YRes;
|
||||
screen.IsSpanned = false;
|
||||
//screen.Features = mode.ModeValue;
|
||||
|
||||
screens.Add(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return screens;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@ -191,38 +191,66 @@ namespace DisplayMagicianShared.AMD
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
public override bool CreateProfileFromCurrentDisplaySettings()
|
||||
{
|
||||
|
||||
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
|
||||
if (amdLibrary.IsInstalled)
|
||||
{
|
||||
// Create the profile data from the current config
|
||||
_profileData = amdLibrary.GetActiveProfile();
|
||||
|
||||
// Now, since the ActiveProfile has changed, we need to regenerate screen positions
|
||||
_screens = GetScreenPositions();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override List<ScreenPosition> GetScreenPositions()
|
||||
{
|
||||
|
||||
if (_screens.Count == 0)
|
||||
// Now we create the screens structure from the AMD profile information
|
||||
_screens = new List<ScreenPosition>();
|
||||
|
||||
if ( _profileData.Adapters.Count > 0)
|
||||
{
|
||||
// Now we create the screens structure from the AMD profile information
|
||||
_screens = new List<ScreenPosition>();
|
||||
|
||||
if ( _profileData.Adapters.Count > 0)
|
||||
foreach ( var adapter in _profileData.Adapters)
|
||||
{
|
||||
foreach ( var adapter in _profileData.Adapters)
|
||||
foreach (var display in adapter.Displays)
|
||||
{
|
||||
foreach (var display in adapter.Displays)
|
||||
foreach (var mode in display.DisplayModes)
|
||||
{
|
||||
foreach (var mode in display.DisplayModes)
|
||||
{
|
||||
ScreenPosition screen = new ScreenPosition();
|
||||
screen.Colour = Color.Red; // represents AMD
|
||||
screen.Name = mode.DisplayID.ToString();
|
||||
screen.ScreenX = mode.XPos;
|
||||
screen.ScreenY = mode.YPos;
|
||||
screen.ScreenWidth = mode.XRes;
|
||||
screen.ScreenHeight = mode.YRes;
|
||||
screen.IsSpanned = false;
|
||||
//screen.Features = mode.ModeValue;
|
||||
ScreenPosition screen = new ScreenPosition();
|
||||
screen.Library = "AMD";
|
||||
//screen.Colour = Color.FromArgb(255,237,28,36); // represents AMD Red
|
||||
screen.Colour = Color.FromArgb(200, 237, 28, 36); // represents AMD Red
|
||||
screen.Name = display.DisplayName;
|
||||
screen.DisplayConnector = display.DisplayConnector;
|
||||
screen.ScreenX = mode.XPos;
|
||||
screen.ScreenY = mode.YPos;
|
||||
screen.ScreenWidth = mode.XRes;
|
||||
screen.ScreenHeight = mode.YRes;
|
||||
screen.IsSpanned = false;
|
||||
|
||||
|
||||
// Figure out features
|
||||
|
||||
_screens.Add(screen);
|
||||
}
|
||||
//ATI.ADL.ADL.ConvertDisplayModeFlags(mode.ModeValue);
|
||||
|
||||
//screen.Features = mode.ModeValue;
|
||||
|
||||
_screens.Add(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return _screens;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Text.RegularExpressions;
|
||||
using IWshRuntimeLibrary;
|
||||
using DisplayMagicianShared.AMD;
|
||||
//using WK.Libraries.HotkeyListenerNS;
|
||||
|
||||
namespace DisplayMagicianShared
|
||||
@ -21,6 +22,7 @@ namespace DisplayMagicianShared
|
||||
public int ScreenWidth;
|
||||
public int ScreenHeight;
|
||||
public string Name;
|
||||
public string Library;
|
||||
public bool IsPrimary;
|
||||
public Color Colour;
|
||||
public List<string> Features;
|
||||
@ -30,6 +32,7 @@ namespace DisplayMagicianShared
|
||||
public List<SpannedScreenPosition> SpannedScreens;
|
||||
public int SpannedColumns;
|
||||
public int SpannedRows;
|
||||
public string DisplayConnector;
|
||||
}
|
||||
|
||||
public struct SpannedScreenPosition
|
||||
@ -192,7 +195,7 @@ namespace DisplayMagicianShared
|
||||
|
||||
//public Topology.Path[] Paths { get; set; } = new Topology.Path[0];
|
||||
|
||||
//public VideoLibraryProfileData ProfileData { get; set; }
|
||||
//public virtual object ProfileData { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ProfileIcon ProfileIcon
|
||||
@ -360,6 +363,12 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
|
||||
|
||||
public virtual bool CreateProfileFromCurrentDisplaySettings()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// The public override for the Object.Equals
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
|
@ -567,14 +567,17 @@ namespace DisplayMagicianShared
|
||||
AMDLibrary amdLibrary = AMDLibrary.GetLibrary();
|
||||
if (amdLibrary.IsInstalled)
|
||||
{
|
||||
activeProfile = new AMDProfileItem
|
||||
AMDProfileItem amdProfile = new AMDProfileItem
|
||||
{
|
||||
Name = "Current Display Profile",
|
||||
ProfileData = amdLibrary.GetActiveProfile()
|
||||
Name = "Current Display Profile" ,
|
||||
//ProfileData = amdLibrary.GetActiveProfile(),
|
||||
//Screens = amdLibrary.GenerateScreenPositions()
|
||||
//ProfileDisplayIdentifiers = ProfileRepository.GenerateProfileDisplayIdentifiers()
|
||||
};
|
||||
//activeProfile.ProfileIcon = new ProfileIcon(activeProfile);
|
||||
//activeProfile.ProfileBitmap = activeProfile.ProfileIcon.ToBitmap(256, 256);
|
||||
amdProfile.CreateProfileFromCurrentDisplaySettings();
|
||||
activeProfile = amdProfile;
|
||||
}
|
||||
else {
|
||||
SharedLogger.logger.Debug($"ProfileRepository/UpdateActiveProfile: Trying to access things using the NVIDIA video card driver");
|
||||
|
@ -42,35 +42,37 @@ namespace DisplayMagicianShared.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawScreen(Graphics g, ScreenPosition screen)
|
||||
/*private void DrawScreen(Graphics g, ScreenPosition screen)
|
||||
{
|
||||
//var res = ProfileIcon.NormalizeResolution(screens);
|
||||
var rect = new Rectangle(screen.ScreenX, screen.ScreenY, screen.ScreenWidth, screen.ScreenHeight);
|
||||
g.FillRectangle(new SolidBrush(Color.FromArgb(15, Color.White)), rect);
|
||||
g.DrawRectangle(Pens.Black, rect);
|
||||
|
||||
/*DrawString(g, path.Position.IsEmpty ? "[Primary]" : $"[{path.Position.X}, {path.Position.Y}]", rect.Size,
|
||||
new PointF(rect.X + PaddingY / 2, rect.Y + PaddingY / 2), StringAlignment.Near, StringAlignment.Near);*/
|
||||
*//*DrawString(g, path.Position.IsEmpty ? "[Primary]" : $"[{path.Position.X}, {path.Position.Y}]", rect.Size,
|
||||
new PointF(rect.X + PaddingY / 2, rect.Y + PaddingY / 2), StringAlignment.Near, StringAlignment.Near);*//*
|
||||
|
||||
var str = $"DISPLAY {screen.Name}{Environment.NewLine}{rect.Width}×{rect.Height}";
|
||||
var strSize = DrawString(g, str, rect.Size, new PointF(rect.X - PaddingX / 2, rect.Y + PaddingY / 2),
|
||||
StringAlignment.Near, StringAlignment.Far);
|
||||
|
||||
var rows = rect.Width < rect.Height ? screen.SpannedScreens.Count : 1;
|
||||
var cols = rect.Width >= rect.Height ? screen.SpannedScreens.Count : 1;
|
||||
|
||||
for (var i = 0; i < screen.SpannedScreens.Count; i++)
|
||||
var rows = rect.Width < rect.Height ? screen.Count : 1;
|
||||
var cols = rect.Width >= rect.Height ? screen.Count : 1;
|
||||
|
||||
for (var i = 0; i < screen.Count; i++)
|
||||
{
|
||||
DrawTarget(g, screen,
|
||||
new Rectangle(rect.X + PaddingX, rect.Y + strSize.Height + PaddingY, rect.Width - 2 * PaddingX,
|
||||
rect.Height - strSize.Height - 2 * PaddingY),
|
||||
rows > 1 ? i : 0, cols > 1 ? i : 0, rows, cols);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
private Size DrawString(
|
||||
Graphics g,
|
||||
string str,
|
||||
Color colour,
|
||||
SizeF drawingSize = default(SizeF),
|
||||
PointF? drawingPoint = null,
|
||||
StringAlignment vertical = StringAlignment.Center,
|
||||
@ -80,13 +82,13 @@ namespace DisplayMagicianShared.UserControls
|
||||
{
|
||||
Alignment = horizontal,
|
||||
LineAlignment = vertical,
|
||||
FormatFlags = StringFormatFlags.NoClip
|
||||
FormatFlags = StringFormatFlags.NoClip
|
||||
};
|
||||
var stringSize = g.MeasureString(str, Font, drawingSize, format);
|
||||
|
||||
if (drawingPoint != null)
|
||||
{
|
||||
g.DrawString(str, Font, new SolidBrush(ForeColor), new RectangleF(drawingPoint.Value, drawingSize),
|
||||
g.DrawString(str, Font, new SolidBrush(colour), new RectangleF(drawingPoint.Value, drawingSize),
|
||||
format);
|
||||
}
|
||||
|
||||
@ -202,7 +204,7 @@ namespace DisplayMagicianShared.UserControls
|
||||
|
||||
break;
|
||||
}
|
||||
*/
|
||||
*//*
|
||||
if (screen.IsSpanned)
|
||||
{
|
||||
var strSize = DrawString(g, str, targetRect.Size,
|
||||
@ -218,10 +220,10 @@ namespace DisplayMagicianShared.UserControls
|
||||
else
|
||||
{
|
||||
DrawString(g, str, targetRect.Size, targetRect.Location);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void DrawView(Graphics g)
|
||||
/*private void DrawView(Graphics g)
|
||||
{
|
||||
var viewSize = ProfileIcon.CalculateViewSize(_profile.Screens, PaddingX, PaddingY);
|
||||
var factor = Math.Min(Width / viewSize.Width, Height / viewSize.Height);
|
||||
@ -235,6 +237,93 @@ namespace DisplayMagicianShared.UserControls
|
||||
{
|
||||
DrawScreen(g, screen);
|
||||
}
|
||||
}*/
|
||||
|
||||
private void DrawView(Graphics g)
|
||||
{
|
||||
var viewSize = ProfileIcon.CalculateViewSize(_profile.Screens, PaddingX, PaddingY);
|
||||
var factor = Math.Min(Width / viewSize.Width, Height / viewSize.Height);
|
||||
g.ScaleTransform(factor, factor);
|
||||
|
||||
var xOffset = (Width / factor - viewSize.Width) / 2f;
|
||||
var yOffset = (Height / factor - viewSize.Height) / 2f;
|
||||
g.TranslateTransform(-viewSize.X + xOffset, -viewSize.Y + yOffset);
|
||||
|
||||
// How wide the Bezel is on the screen graphics
|
||||
int screenBezel = 60;
|
||||
int screenWordBuffer = 30;
|
||||
|
||||
foreach (ScreenPosition screen in _profile.Screens)
|
||||
{
|
||||
|
||||
Color screenBgColour;
|
||||
Color lightTextColour = Color.White;
|
||||
Color darkTextColour = Color.Black;
|
||||
|
||||
// draw the screen
|
||||
if (screen.IsSpanned)
|
||||
{
|
||||
//g.FillRectangle(new SolidBrush(Color.FromArgb(150, 106, 185, 0)), targetRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Draw the outline of the monitor
|
||||
Rectangle outlineRect = new Rectangle(screen.ScreenX, screen.ScreenY, screen.ScreenWidth, screen.ScreenHeight);
|
||||
g.FillRectangle(new SolidBrush(Color.FromArgb(255, 33, 33, 33)), outlineRect);
|
||||
g.DrawRectangle(Pens.Black, outlineRect);
|
||||
|
||||
// Draw the screen of the monitor
|
||||
Rectangle screenRect = new Rectangle(screen.ScreenX + screenBezel, screen.ScreenY + screenBezel, screen.ScreenWidth - (screenBezel * 2), screen.ScreenHeight - (screenBezel * 2));
|
||||
if (screen.Colour != null)
|
||||
{
|
||||
screenBgColour = screen.Colour;
|
||||
}
|
||||
else
|
||||
{
|
||||
screenBgColour = Color.FromArgb(255, 155, 155, 155);
|
||||
}
|
||||
g.FillRectangle(new SolidBrush(screenBgColour), screenRect);
|
||||
g.DrawRectangle(Pens.Black, screenRect);
|
||||
|
||||
Rectangle wordRect = new Rectangle(screen.ScreenX + screenBezel + screenWordBuffer, screen.ScreenY + screenBezel + screenWordBuffer, screen.ScreenWidth - (screenBezel * 2) - (screenWordBuffer * 2), screen.ScreenHeight - (screenBezel * 2) - (screenWordBuffer * 2));
|
||||
Color wordTextColour = pickTextColorBasedOnBgColour(screenBgColour, lightTextColour, darkTextColour);
|
||||
// Draw the name of the screen and the size of it
|
||||
var str = $"{screen.Name}{Environment.NewLine}{screen.ScreenWidth}×{screen.ScreenHeight}";
|
||||
DrawString(g, str, wordTextColour, wordRect.Size, wordRect.Location);
|
||||
|
||||
// Draw the position of the screen
|
||||
str = $"[{screen.ScreenX},{screen.ScreenY}]";
|
||||
DrawString(g, str, wordTextColour, wordRect.Size, wordRect.Location, StringAlignment.Near, StringAlignment.Near);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Color pickTextColorBasedOnBgColour(Color bgColour, Color lightColour, Color darkColour)
|
||||
{
|
||||
if ((bgColour.R * 0.299 + bgColour.G * 0.587 + bgColour.B * 0.114) > 186)
|
||||
{
|
||||
return darkColour;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lightColour;
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap pickBitmapBasedOnBgColour(Color bgColour, Bitmap lightBitmap, Bitmap darkBitmap)
|
||||
{
|
||||
if ((bgColour.R * 0.299 + bgColour.G * 0.587 + bgColour.B * 0.114) > 186)
|
||||
{
|
||||
return darkBitmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lightBitmap;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawEmptyView(Graphics g)
|
||||
|
Loading…
Reference in New Issue
Block a user