mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Mostly working NVIDIAProfileItem
NVIDIA Profiles can be created, JSON file saved ok, and the bitmaps and icons are drawn correctly and showin in the Display Profile window. The problem comes when the DisplayProfiles_2.0.json file is loaded. JsonConvert causes an exception trying to populate ProfileBitmap, and I can't figure out why!
This commit is contained in:
parent
508f3751b9
commit
ddbd6431c5
@ -260,7 +260,15 @@ namespace DisplayMagician.UIForms
|
||||
lbl_profile_shown.Text = _selectedProfile.Name;
|
||||
|
||||
// And show the logo for the driver
|
||||
if (_selectedProfile.VideoMode == VIDEO_MODE.AMD)
|
||||
if (_selectedProfile.VideoMode == VIDEO_MODE.NVIDIA)
|
||||
{
|
||||
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite);
|
||||
}
|
||||
else if (_selectedProfile.VideoMode == VIDEO_MODE.AMD)
|
||||
{
|
||||
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite);
|
||||
}
|
||||
else
|
||||
{
|
||||
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using DisplayMagicianShared.Resources;
|
||||
using Newtonsoft.Json;
|
||||
using System.Drawing;
|
||||
using DisplayMagicianShared.Windows;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace DisplayMagicianShared.AMD
|
||||
{
|
||||
@ -26,7 +27,6 @@ namespace DisplayMagicianShared.AMD
|
||||
private bool _isPossible = false;
|
||||
private Keys _hotkey = Keys.None;
|
||||
|
||||
|
||||
public AMDProfileItem()
|
||||
{
|
||||
}
|
||||
@ -67,8 +67,6 @@ namespace DisplayMagicianShared.AMD
|
||||
|
||||
public override string Name { get; set; }
|
||||
|
||||
//public Topology.Path[] Paths { get; set; } = new Topology.Path[0];
|
||||
|
||||
[JsonRequired]
|
||||
public AMD_DISPLAY_CONFIG AMDDisplayConfig
|
||||
{
|
||||
@ -132,8 +130,7 @@ namespace DisplayMagicianShared.AMD
|
||||
|
||||
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
@ -158,8 +155,8 @@ namespace DisplayMagicianShared.AMD
|
||||
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
public override Bitmap ProfileTightestBitmap
|
||||
|
||||
/*public override Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -176,7 +173,7 @@ namespace DisplayMagicianShared.AMD
|
||||
_profileShortcutBitmap = value;
|
||||
}
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
|
||||
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public new Bitmap ProfileBitmap
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -288,12 +288,13 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
ScreenPosition screen = new ScreenPosition();
|
||||
screen.Library = "NVIDIA";
|
||||
|
||||
UInt32 sourceId = path.SourceInfo.Id;
|
||||
UInt32 targetId = path.TargetInfo.Id;
|
||||
|
||||
foreach (DISPLAYCONFIG_MODE_INFO displayMode in _windowsDisplayConfig.DisplayConfigModes)
|
||||
{
|
||||
// Find the matching Display Config Source Mode
|
||||
if (displayMode.InfoType != DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE && displayMode.Id == targetId)
|
||||
if (displayMode.InfoType == DISPLAYCONFIG_MODE_INFO_TYPE.DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE && displayMode.Id == sourceId)
|
||||
{
|
||||
screen.Name = targetId.ToString();
|
||||
//screen.DisplayConnector = displayMode.DisplayConnector;
|
||||
@ -307,6 +308,8 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
{
|
||||
screen.IsPrimary = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +337,7 @@ namespace DisplayMagicianShared.NVIDIA
|
||||
screen.HDRSupported = false;
|
||||
screen.HDREnabled = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ namespace DisplayMagicianShared
|
||||
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[JsonRequired]
|
||||
public virtual List<ScreenPosition> Screens
|
||||
{
|
||||
get
|
||||
@ -256,8 +256,7 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
}
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public virtual Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
@ -277,8 +276,8 @@ namespace DisplayMagicianShared
|
||||
|
||||
}
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
//[JsonIgnore]
|
||||
public virtual Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
|
@ -147,7 +147,7 @@ namespace DisplayMagicianShared.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTarget(
|
||||
/* private void DrawTarget(
|
||||
Graphics g,
|
||||
ScreenPosition screen,
|
||||
Rectangle rect,
|
||||
@ -181,7 +181,7 @@ namespace DisplayMagicianShared.UserControls
|
||||
|
||||
g.DrawRectangle(Pens.Black, targetRect);
|
||||
var str = $"{screen.Name}{Environment.NewLine}{screen.ScreenWidth}×{screen.ScreenHeight}";
|
||||
|
||||
*/
|
||||
/* switch (target.Rotation)
|
||||
{
|
||||
case Rotation.Rotate90:
|
||||
@ -220,23 +220,8 @@ namespace DisplayMagicianShared.UserControls
|
||||
{
|
||||
DrawString(g, str, targetRect.Size, targetRect.Location);
|
||||
}*/
|
||||
}
|
||||
//}
|
||||
|
||||
/*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);
|
||||
|
||||
foreach (ScreenPosition screen in _profile.Screens)
|
||||
{
|
||||
DrawScreen(g, screen);
|
||||
}
|
||||
}*/
|
||||
|
||||
private void DrawView(Graphics g)
|
||||
{
|
||||
@ -287,7 +272,7 @@ namespace DisplayMagicianShared.UserControls
|
||||
}
|
||||
else
|
||||
{
|
||||
screenBgColour = Color.FromArgb(255, 155, 155, 155);
|
||||
screenBgColour = Color.FromArgb(255, 195, 195, 195);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ using System.Windows.Forms;
|
||||
using DisplayMagicianShared.Resources;
|
||||
using Newtonsoft.Json;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace DisplayMagicianShared.Windows
|
||||
{
|
||||
@ -24,7 +25,6 @@ namespace DisplayMagicianShared.Windows
|
||||
private bool _isPossible = false;
|
||||
private Keys _hotkey = Keys.None;
|
||||
|
||||
|
||||
public WinProfileItem()
|
||||
{
|
||||
}
|
||||
@ -96,7 +96,7 @@ namespace DisplayMagicianShared.Windows
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[JsonRequired]
|
||||
public override List<ScreenPosition> Screens
|
||||
{
|
||||
get
|
||||
@ -115,8 +115,7 @@ namespace DisplayMagicianShared.Windows
|
||||
|
||||
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileBitmap
|
||||
{
|
||||
get
|
||||
@ -140,8 +139,7 @@ namespace DisplayMagicianShared.Windows
|
||||
}
|
||||
|
||||
|
||||
//[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
[JsonIgnore]
|
||||
/*[JsonConverter(typeof(CustomBitmapConverter))]
|
||||
public override Bitmap ProfileTightestBitmap
|
||||
{
|
||||
get
|
||||
@ -159,7 +157,7 @@ namespace DisplayMagicianShared.Windows
|
||||
_profileShortcutBitmap = value;
|
||||
}
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user