Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of AH-64D Glass Opacity to MFDs, TEDAC, and EUFDs #790

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion Aircraft AH-64D Plugin/Gauges/EUFD/EUFD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace GadrocsWorkshop.Helios.Gauges.AH64D.EUFD
using System.Xml;
using System.Windows;
using System.Windows.Media;
using System.Globalization;

[HeliosControl("Helios.AH64D.EUFD", "Enhanced Up Front Display", "AH-64D", typeof(BackgroundImageRenderer), HeliosControlFlags.NotShownInUI)]
public class EUFD : CompositeVisualWithBackgroundImage
Expand All @@ -35,6 +36,8 @@ public class EUFD : CompositeVisualWithBackgroundImage
private bool _includeViewport = true;
private string _vpName = "";
private const string Panel_Image = "{AH-64D}/Images/EUFD/EUFD.png";
public const double GLASS_REFLECTION_OPACITY_DEFAULT = 0.30d;
private double _glassReflectionOpacity = GLASS_REFLECTION_OPACITY_DEFAULT;

public EUFD(string interfaceDevice)
: base(interfaceDevice, new Size(1004, 348))
Expand All @@ -55,7 +58,7 @@ public EUFD(string interfaceDevice)
}
if (_includeViewport) AddViewport(_vpName);
_frameGlassPanel = AddPanel("EUFD Glass", new Point(Left + (173), Top + (25)), new Size(600d, 300d), "{AH-64D}/Images/MFD/MFD_glass.png", _interfaceDevice);
_frameGlassPanel.Opacity = 0.3d;
_frameGlassPanel.Opacity = _glassReflectionOpacity;
_frameGlassPanel.DrawBorder = false;
_frameGlassPanel.FillBackground=false;

Expand Down Expand Up @@ -324,6 +327,25 @@ protected override void OnBackgroundImageChange()
{
_frameBezelPanel.BackgroundImage = BackgroundImageIsCustomized ? null : Panel_Image;
}
public double GlassReflectionOpacity
{
get
{
return _glassReflectionOpacity;
}
set
{
double oldValue = _glassReflectionOpacity;
if (value != oldValue)
{
_glassReflectionOpacity = value;
OnPropertyChanged("GlassReflectionOpacity", oldValue, value, true);
_frameGlassPanel.IsHidden = _glassReflectionOpacity == 0d ? true : false;
_frameGlassPanel.Opacity = _glassReflectionOpacity;

}
}
}

public override bool HitTest(Point location)
{
Expand Down Expand Up @@ -356,6 +378,11 @@ public override void WriteXml(XmlWriter writer)
{
writer.WriteElementString("EmbeddedViewportName", "");
}
if (_glassReflectionOpacity > 0d)
{
writer.WriteElementString("GlassReflectionOpacity", GlassReflectionOpacity.ToString(CultureInfo.InvariantCulture));
}

}

public override void ReadXml(XmlReader reader)
Expand All @@ -372,6 +399,8 @@ public override void ReadXml(XmlReader reader)
_includeViewport = false;
RemoveViewport("");
}
GlassReflectionOpacity = reader.Name.Equals("GlassReflectionOpacity") ? double.Parse(reader.ReadElementString("GlassReflectionOpacity"), CultureInfo.InvariantCulture) : 0d;

}
}
}
30 changes: 28 additions & 2 deletions Aircraft AH-64D Plugin/Gauges/MFD/MFD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace GadrocsWorkshop.Helios.Gauges.AH64D.MFD
using GadrocsWorkshop.Helios.Controls;
using NLog.Filters;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
using System.Xml;
Expand All @@ -36,7 +37,8 @@ public class MFD : CompositeVisualWithBackgroundImage
private bool _includeViewport = true;
private string _vpName = "";
private const string PANEL_IMAGE = "{AH-64D}/Images/MFD/MFD_Frame.png";

public const double GLASS_REFLECTION_OPACITY_DEFAULT = 0.30d;
private double _glassReflectionOpacity = GLASS_REFLECTION_OPACITY_DEFAULT;

public MFD(string interfaceDevice)
: base(interfaceDevice, new Size(1469 / 2, 1381 / 2))
Expand All @@ -62,7 +64,7 @@ public MFD(string interfaceDevice)
}
if (_vpName != "" && _includeViewport) AddViewport(_vpName);
_frameGlassPanel = AddPanel("MFD Glass", new Point(Left + (109), Top + (88)), new Size(500d, 500d), "{AH-64D}/Images/MFD/MFD_glass.png", _interfaceDevice);
_frameGlassPanel.Opacity = 0.3d;
_frameGlassPanel.Opacity = _glassReflectionOpacity;
_frameGlassPanel.DrawBorder = false;
_frameGlassPanel.FillBackground = false;

Expand Down Expand Up @@ -338,6 +340,25 @@ protected override void OnBackgroundImageChange()
{
_frameBezelPanel.BackgroundImage = BackgroundImageIsCustomized ? null : PANEL_IMAGE;
}
public double GlassReflectionOpacity
{
get
{
return _glassReflectionOpacity;
}
set
{
double oldValue = _glassReflectionOpacity;
if (value != oldValue)
{
_glassReflectionOpacity = value;
OnPropertyChanged("GlassReflectionOpacity", oldValue, value, true);
_frameGlassPanel.IsHidden = _glassReflectionOpacity == 0d ? true : false;
_frameGlassPanel.Opacity = _glassReflectionOpacity;

}
}
}
public override bool HitTest(Point location)
{
if (_scaledScreenRect.Contains(location))
Expand Down Expand Up @@ -371,6 +392,10 @@ public override void WriteXml(XmlWriter writer)
{
writer.WriteElementString("EmbeddedViewportName", "");
}
if (_glassReflectionOpacity > 0d)
{
writer.WriteElementString("GlassReflectionOpacity", GlassReflectionOpacity.ToString(CultureInfo.InvariantCulture));
}
}

public override void ReadXml(XmlReader reader)
Expand All @@ -387,6 +412,7 @@ public override void ReadXml(XmlReader reader)
_includeViewport = false;
RemoveViewport("");
}
GlassReflectionOpacity = reader.Name.Equals("GlassReflectionOpacity") ? double.Parse(reader.ReadElementString("GlassReflectionOpacity"), CultureInfo.InvariantCulture) : 0d;
}
}
}
28 changes: 27 additions & 1 deletion Aircraft AH-64D Plugin/Gauges/TEDAC/TEDAC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace GadrocsWorkshop.Helios.Gauges.AH64D.TEDAC
using System.Xml;
using System.Windows;
using System.Windows.Media;
using System.Globalization;


[HeliosControl("Helios.AH64D.TEDAC", "TADS Electronic Display and Control", "AH-64D", typeof(BackgroundImageRenderer),HeliosControlFlags.NotShownInUI)]
Expand All @@ -36,6 +37,8 @@ public class TEDAC : CompositeVisualWithBackgroundImage
private bool _includeViewport = true;
private string _vpName = "";
private const string Panel_Image = "{AH-64D}/Images/TEDAC/TEDAC_frame.png";
public const double GLASS_REFLECTION_OPACITY_DEFAULT = 0.30d;
private double _glassReflectionOpacity = GLASS_REFLECTION_OPACITY_DEFAULT;

public TEDAC()
: base("TEDAC", new Size(1089, 1080))
Expand All @@ -45,7 +48,7 @@ public TEDAC()
_vpName = "AH_64D_TEDAC";
if (_includeViewport) AddViewport(_vpName);
_frameGlassPanel = AddPanel("TEDAC Glass", new Point(142, 150), new Size(800d, 800d), "{AH-64D}/Images/MFD/MFD_glass.png", _interfaceDevice);
_frameGlassPanel.Opacity = 0.3d;
_frameGlassPanel.Opacity = _glassReflectionOpacity;
_frameGlassPanel.DrawBorder = false;
_frameGlassPanel.FillBackground=false;

Expand Down Expand Up @@ -374,7 +377,25 @@ protected override void OnBackgroundImageChange()
{
_frameBezelPanel.BackgroundImage = BackgroundImageIsCustomized ? null : Panel_Image;
}
public double GlassReflectionOpacity
{
get
{
return _glassReflectionOpacity;
}
set
{
double oldValue = _glassReflectionOpacity;
if (value != oldValue)
{
_glassReflectionOpacity = value;
OnPropertyChanged("GlassReflectionOpacity", oldValue, value, true);
_frameGlassPanel.IsHidden = _glassReflectionOpacity == 0d ? true : false;
_frameGlassPanel.Opacity = _glassReflectionOpacity;

}
}
}
public override bool HitTest(Point location)
{
if (_scaledScreenRect.Contains(location))
Expand Down Expand Up @@ -407,6 +428,10 @@ public override void WriteXml(XmlWriter writer)
{
writer.WriteElementString("EmbeddedViewportName", "");
}
if (_glassReflectionOpacity > 0d)
{
writer.WriteElementString("GlassReflectionOpacity", GlassReflectionOpacity.ToString(CultureInfo.InvariantCulture));
}

}
public override void ReadXml(XmlReader reader)
Expand All @@ -430,6 +455,7 @@ public override void ReadXml(XmlReader reader)
}
}
}
GlassReflectionOpacity = reader.Name.Equals("GlassReflectionOpacity") ? double.Parse(reader.ReadElementString("GlassReflectionOpacity"), CultureInfo.InvariantCulture) : 0d;
}
}
}
8 changes: 7 additions & 1 deletion Helios/Controls/GlassOpacityAppearanceEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@
[HeliosPropertyEditor("Helios.M2000C.ADI.Backup", "Appearance")]
[HeliosPropertyEditor("Helios.M2000C.Accelerometer", "Appearance")]
[HeliosPropertyEditor("Helios.M2000C.Instruments.VVI", "Appearance")]

[HeliosPropertyEditor("Helios.AH64D.MFD.CPGLEFT", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.MFD.CPGRIGHT", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.MFD.PLTLEFT", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.MFD.PLTRIGHT", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.TEDAC", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.EUFD.CPG", "Appearance")]
[HeliosPropertyEditor("Helios.AH64D.EUFD.PILOT", "Appearance")]

public partial class GlassOpacityAppearanceEditor : HeliosPropertyEditor
{
Expand Down