diff --git a/DisplayMagician/UIForms/DisplayProfileForm.Designer.cs b/DisplayMagician/UIForms/DisplayProfileForm.Designer.cs index 9784dd7..ddec1e1 100644 --- a/DisplayMagician/UIForms/DisplayProfileForm.Designer.cs +++ b/DisplayMagician/UIForms/DisplayProfileForm.Designer.cs @@ -60,8 +60,11 @@ namespace DisplayMagician.UIForms this.lbl_hotkey_assigned = new System.Windows.Forms.Label(); this.dv_profile = new DisplayMagicianShared.UserControls.DisplayView(); this.panel1 = new System.Windows.Forms.Panel(); + this.pbLogo = new System.Windows.Forms.PictureBox(); this.menu_profiles.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pb_down_arrow)).BeginInit(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit(); this.SuspendLayout(); // // btn_apply @@ -364,11 +367,22 @@ namespace DisplayMagician.UIForms // panel1 // this.panel1.BackColor = System.Drawing.Color.DimGray; + this.panel1.Controls.Add(this.pbLogo); this.panel1.Location = new System.Drawing.Point(0, 61); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(976, 521); this.panel1.TabIndex = 37; // + // pbLogo + // + this.pbLogo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pbLogo.Location = new System.Drawing.Point(854, 14); + this.pbLogo.Name = "pbLogo"; + this.pbLogo.Size = new System.Drawing.Size(100, 49); + this.pbLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pbLogo.TabIndex = 0; + this.pbLogo.TabStop = false; + // // DisplayProfileForm // this.AcceptButton = this.btn_apply; @@ -407,6 +421,8 @@ namespace DisplayMagician.UIForms this.Load += new System.EventHandler(this.DisplayProfileForm_Load); this.menu_profiles.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pb_down_arrow)).EndInit(); + this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -440,6 +456,7 @@ namespace DisplayMagician.UIForms private System.Windows.Forms.Button btn_hotkey; private System.Windows.Forms.Label lbl_hotkey_assigned; private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.PictureBox pbLogo; } } diff --git a/DisplayMagician/UIForms/DisplayProfileForm.cs b/DisplayMagician/UIForms/DisplayProfileForm.cs index 281ddfe..5307740 100644 --- a/DisplayMagician/UIForms/DisplayProfileForm.cs +++ b/DisplayMagician/UIForms/DisplayProfileForm.cs @@ -259,6 +259,12 @@ namespace DisplayMagician.UIForms // We also need to load the saved profile name to show the user lbl_profile_shown.Text = _selectedProfile.Name; + // And show the logo for the driver + if (_selectedProfile.Driver == "AMD") + { + pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite); + } + // And update the save/rename textbox txt_profile_save_name.Text = _selectedProfile.Name; @@ -467,6 +473,18 @@ namespace DisplayMagician.UIForms } } + 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 btn_hotkey_Click(object sender, EventArgs e) { Keys testHotkey; diff --git a/DisplayMagicianShared/AMD/AMDLibrary.cs b/DisplayMagicianShared/AMD/AMDLibrary.cs index 7b36e6e..f6acbb0 100644 --- a/DisplayMagicianShared/AMD/AMDLibrary.cs +++ b/DisplayMagicianShared/AMD/AMDLibrary.cs @@ -1181,7 +1181,6 @@ namespace DisplayMagicianShared.AMD displayToCreate.HDRSupported = false; displayToCreate.HDREnabled = false; - 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")}"); SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: Display Controller Index = {oneDisplayInfo.DisplayControllerIndex}"); @@ -1252,6 +1251,9 @@ namespace DisplayMagicianShared.AMD SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: DisplayMode X Resolution = {oneDisplayMode.XRes}"); SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: DisplayMode Y Position = {oneDisplayMode.YPos}"); SharedLogger.logger.Trace($"AMDLibrary/GetActiveprofile: DisplayMode Y Resolution = {oneDisplayMode.YRes}"); + + + } } else @@ -1576,6 +1578,14 @@ namespace DisplayMagicianShared.AMD // Set the display mode timing override configuration //ADL.ADL2_Display_ModeTimingOverride_Set + // Validate the display map config we want to set + //ADL.ADL2_Display_DisplayMapConfig_Validate + + // Figure out which display targets need to be added or removed in the display map config + //ADL.ADL2_Display_DisplayMapConfig_PossibleAddAndRemove + + // Set the display map config + //ADL.ADL2_Display_DisplayMapConfig_Set // Set the HDR function if needed if (storedAMDDisplay.HDREnabled) diff --git a/DisplayMagicianShared/AMD/AMDProfileItem.cs b/DisplayMagicianShared/AMD/AMDProfileItem.cs index 67974c1..5c6f4e3 100644 --- a/DisplayMagicianShared/AMD/AMDProfileItem.cs +++ b/DisplayMagicianShared/AMD/AMDProfileItem.cs @@ -200,7 +200,7 @@ namespace DisplayMagicianShared.AMD _profileShortcutBitmap = value; } - } + } #endregion @@ -343,6 +343,12 @@ namespace DisplayMagicianShared.AMD screen.ScreenWidth = mode.XRes; screen.ScreenHeight = mode.YRes; + // If we're at the 0,0 coordinate then we're the primary monitor + if (screen.ScreenX == 0 && screen.ScreenY == 0) + { + screen.IsPrimary = true; + } + // HDR information if (display.HDRSupported) { @@ -589,33 +595,91 @@ namespace DisplayMagicianShared.AMD // We need to exclude the name as the name is solely for saving to disk // and displaying to the user. // Two profiles are equal only when they have the same viewport data - int foundPathsCount = 0; - int foundOtherPathsCount = 0; + int foundDisplayCount = 0; + int foundOtherDisplayCount = 0; - // TODO: Fix this so it finds compares ProfileData - /*foreach (Topology.Path profilePath in x.Paths) + foreach (AMDAdapter xadapter in x.ProfileData.Adapters) { - if (y.Paths.Contains(profilePath)) + foreach (AMDDisplay xdisplay in xadapter.Displays) { - foundPathsCount++; - continue; + foreach (AMDAdapter yadapter in y.ProfileData.Adapters) + { + foreach (AMDDisplay ydisplay in yadapter.Displays) + { + if (ydisplay.Equals(xdisplay)) + { + foreach (var ydisplaymode in ydisplay.DisplayModes) + { + foreach (var xdisplaymode in xdisplay.DisplayModes) + { + if (ydisplaymode.Equals(xdisplaymode)) + { + foundDisplayCount++; + continue; + } + } + } + + } + } + } } - } - foreach (Topology.Path otherPath in y.Paths) + + foreach (AMDAdapter yadapter in y.ProfileData.Adapters) { - if (x.Paths.Contains(otherPath)) + foreach (AMDDisplay ydisplay in yadapter.Displays) { - foundOtherPathsCount++; - continue; + foreach (AMDAdapter xadapter in x.ProfileData.Adapters) + { + foreach (AMDDisplay xdisplay in xadapter.Displays) + { + if (xdisplay.Equals(ydisplay)) + { + foreach (var xdisplaymode in xdisplay.DisplayModes) + { + foreach (var ydisplaymode in ydisplay.DisplayModes) + { + if (xdisplaymode.Equals(ydisplaymode)) + { + foundOtherDisplayCount++; + continue; + } + } + } + + } + } + } + } + } + + /*foreach (AMDAdapter yadapter in y.ProfileData.Adapters) + { + foreach (AMDDisplay ydisplay in yadapter.Displays) + { + foreach (AMDAdapter xadapter in x.ProfileData.Adapters) + { + if (xadapter.Displays.Contains(ydisplay)) + { + foundOtherDisplayCount++; + continue; + } + } + + } }*/ - - if (foundPathsCount == foundOtherPathsCount) - return true; - else + // If this matches then there are an additional screen or not enough screens + if (foundDisplayCount != foundOtherDisplayCount) return false; + + // Now we need to check the location of the screens + if (!x.ProfileData.Equals(y.ProfileData)) + return false; + + return true; } // If Equals() returns true for a pair of objects diff --git a/DisplayMagicianShared/DisplayMagicianShared.csproj b/DisplayMagicianShared/DisplayMagicianShared.csproj index 6f5477d..86e3f24 100644 --- a/DisplayMagicianShared/DisplayMagicianShared.csproj +++ b/DisplayMagicianShared/DisplayMagicianShared.csproj @@ -90,6 +90,8 @@ DisplayView.cs + + @@ -156,8 +158,18 @@ True + - + + + + + + + + + +