1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-12-28 07:11:59 +00:00

Version 3.3.3

This commit is contained in:
hawkeye 2022-05-31 11:45:35 -04:00
parent 367a0bb9e2
commit 6dfb21b5d4
11 changed files with 47 additions and 26 deletions

View file

@ -5,15 +5,15 @@
<AssemblyName>FsConnector</AssemblyName>
<PackageId>MSFS 2020 Popout Panel Manager FsConnector</PackageId>
<Product>MSFS 2020 Popout Panel Manager FsConnector</Product>
<Version>3.3.2.0</Version>
<Version>3.3.3.0</Version>
<Authors>Stanley Kwok</Authors>
<Company>Stanley Kwok</Company>
<Copyright>Stanley Kwok 2021</Copyright>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.FsConnector</RootNamespace>
<Platforms>x64;AnyCPU</Platforms>
<AssemblyVersion>3.3.2.0</AssemblyVersion>
<FileVersion>3.3.2.0</FileVersion>
<AssemblyVersion>3.3.3.0</AssemblyVersion>
<FileVersion>3.3.3.0</FileVersion>
</PropertyGroup>
<ItemGroup>

View file

@ -5,14 +5,15 @@
<RootNamespace>MSFSPopoutPanelManager.Model</RootNamespace>
<AssemblyName>Model</AssemblyName>
<PackageId>MSFS 2020 Popout Panel Manager Model</PackageId>
<Version>3.3.2.0</Version>
<Version>3.3.3.0</Version>
<Authors>Stanley Kwok</Authors>
<Company>Stanley Kwok</Company>
<Copyright>Stanley Kwok 2021</Copyright>
<Product>MSFS 2020 Popout Panel Manager Model</Product>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<Platforms>x64;AnyCPU</Platforms>
<AssemblyVersion>3.3.2.0</AssemblyVersion>
<AssemblyVersion>3.3.3.0</AssemblyVersion>
<FileVersion>3.3.3.0</FileVersion>
</PropertyGroup>
<ItemGroup>

View file

@ -47,8 +47,17 @@ namespace MSFSPopoutPanelManager.Provider
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYUP, 0);
}
public static void CenterView(IntPtr hwnd, int x, int y)
public static void CenterView(IntPtr hwnd)
{
Rectangle rectangle;
PInvoke.GetWindowRect(hwnd, out rectangle);
Rectangle clientRectangle;
PInvoke.GetClientRect(hwnd, out clientRectangle);
var x = Convert.ToInt32(rectangle.X + (clientRectangle.Width) * 0.5);
var y = Convert.ToInt32(rectangle.Y + (clientRectangle.Height) * 0.5);
PInvoke.SetForegroundWindow(hwnd);
LeftClick(x, y);
@ -105,6 +114,7 @@ namespace MSFSPopoutPanelManager.Provider
Thread.Sleep(200);
PInvoke.keybd_event(Convert.ToByte(customViewKey), 0, KEYEVENTF_KEYUP, 0);
PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0);
}
public static void ToggleFullScreenPanel(IntPtr hwnd)

View file

@ -43,7 +43,7 @@ namespace MSFSPopoutPanelManager.Provider
public void PanelConfigPropertyUpdated(PanelConfigItem panelConfigItem)
{
if (!AllowEdit || UserProfile.IsLocked)
if (panelConfigItem == null || !AllowEdit || UserProfile.IsLocked)
return;
var panelConfig = UserProfile.PanelConfigs.ToList().Find(p => p.PanelIndex == panelConfigItem.PanelIndex);
@ -99,7 +99,7 @@ namespace MSFSPopoutPanelManager.Provider
public void PanelConfigIncreaseDecrease(PanelConfigItem panelConfigItem, int changeAmount)
{
if (!AllowEdit || UserProfile.IsLocked || UserProfile.PanelConfigs == null || UserProfile.PanelConfigs.Count == 0)
if (panelConfigItem == null || !AllowEdit || UserProfile.IsLocked || UserProfile.PanelConfigs == null || UserProfile.PanelConfigs.Count == 0)
return;
var index = UserProfile.PanelConfigs.ToList().FindIndex(p => p.PanelIndex == panelConfigItem.PanelIndex);

View file

@ -51,6 +51,9 @@ namespace MSFSPopoutPanelManager.Provider
var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
if (simualatorProcess != null)
{
// First center view to make sure recalling custom camera works on the first press
InputEmulationManager.CenterView(simualatorProcess.Handle);
InputEmulationManager.LoadCustomView(simualatorProcess.Handle, AppSetting.AutoPanningKeyBinding);
Thread.Sleep(500);
}
@ -81,7 +84,7 @@ namespace MSFSPopoutPanelManager.Provider
var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
if (simualatorProcess != null && UserProfile.PanelSourceCoordinates.Count > 0)
{
InputEmulationManager.CenterView(simualatorProcess.Handle, UserProfile.PanelSourceCoordinates[0].X, UserProfile.PanelSourceCoordinates[0].Y);
InputEmulationManager.CenterView(simualatorProcess.Handle);
}
_userProfileManager.WriteUserProfiles();
@ -110,8 +113,8 @@ namespace MSFSPopoutPanelManager.Provider
_panels.Clear();
if(_simulatorHandle != IntPtr.Zero)
PInvoke.SetForegroundWindow(_simulatorHandle);
if (_simulatorHandle != IntPtr.Zero)
PInvoke.SetForegroundWindow(_simulatorHandle);
try
{
@ -127,18 +130,18 @@ namespace MSFSPopoutPanelManager.Provider
var handle = PInvoke.FindWindow("AceApp", String.Empty);
if(handle == IntPtr.Zero && i == 1)
if (handle == IntPtr.Zero && i == 1)
throw new PopoutManagerException("Unable to pop out the first panel. Please check the first panel's number circle is positioned inside the panel, check for panel obstruction, and check if panel can be popped out. Pop out process stopped.");
else if(handle == IntPtr.Zero)
else if (handle == IntPtr.Zero)
throw new PopoutManagerException($"Unable to pop out panel number {i}. Please check panel's number circle is positioned inside the panel, check for panel obstruction, and check if panel can be popped out. Pop out process stopped.");
var panelInfo = GetPanelWindowInfo(handle);
panelInfo.PanelIndex = i;
panelInfo.PanelIndex = i;
panelInfo.PanelName = $"Panel{i}";
_panels.Add(panelInfo);
PInvoke.SetWindowText(panelInfo.PanelHandle, panelInfo.PanelName + " (Custom)");
if (i > 1)
PInvoke.MoveWindow(panelInfo.PanelHandle, 0, 0, 800, 600, true);
}
@ -150,7 +153,7 @@ namespace MSFSPopoutPanelManager.Provider
throw new PopoutManagerException("Unable to pop out all panels. Please align all panel number circles with in-game panel locations.");
// Add the built-in pop outs (ie. ATC, VFR Map) to the panel list
if(AppSetting.IncludeBuiltInPanel)
if (AppSetting.IncludeBuiltInPanel)
PInvoke.EnumWindows(new PInvoke.CallBack(EnumBuiltinPopoutCallBack), 0);
// Add the MSFS Touch Panel (My other github project) windows to the panel list
@ -416,7 +419,7 @@ namespace MSFSPopoutPanelManager.Provider
return Point.Empty;
var panelMenubarBottom = GetPanelMenubarBottom(sourceImage, rectangle);
if (panelMenubarTop > sourceImage.Height)
if (panelMenubarBottom > sourceImage.Height)
return Point.Empty;
var panelsStartingLeft = GetPanelMenubarStartingLeft(sourceImage, rectangle, panelMenubarTop + 5);
@ -474,8 +477,8 @@ namespace MSFSPopoutPanelManager.Provider
private int GetPanelMenubarBottom(Bitmap sourceImage, Rectangle rectangle)
{
// Get a snippet of 1 pixel wide vertical strip of windows. We will choose the strip about 25% from the left of the window
var left = Convert.ToInt32((rectangle.Width) * 0.25); // look at around 25% from the left
// Get a snippet of 1 pixel wide vertical strip of windows. We will choose the strip about 70% from the left of the window
var left = Convert.ToInt32((rectangle.Width) * 0.7); // look at around 70% from the left
var top = sourceImage.Height - rectangle.Height;
if (top < 0 || left < 0)
@ -501,7 +504,7 @@ namespace MSFSPopoutPanelManager.Provider
int green = currentLine[x + 1];
int blue = currentLine[x];
if (red == 255 && green == 255 && blue == 255)
if (red > 250 && green > 250 && blue > 250) // allows the color to be a little off white (ie. Fenix A30 EFB)
{
// found the top of menu bar
menubarBottom = y + top;
@ -540,7 +543,7 @@ namespace MSFSPopoutPanelManager.Provider
int green = currentLine[y + 1];
int blue = currentLine[y];
if (red == 255 && green == 255 && blue == 255)
if (red > 250 && green > 250 && blue > 250) // allows the color to be a little off white (ie. Fenix A30 EFB)
{
sourceImage.UnlockBits(stripData);
return sourceImage.Width - x;

View file

@ -7,7 +7,7 @@
<RootNamespace>MSFSPopoutPanelManager.Provider</RootNamespace>
<PackageId>MSFS 2020 Popout Panel Manager Provider</PackageId>
<Product>MSFS 2020 Popout Panel Manager Provider</Product>
<Version>3.3.2.0</Version>
<Version>3.3.3.0</Version>
<Authors>Stanley Kwok</Authors>
<Copyright>Stanley Kwok 2021</Copyright>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>

View file

@ -113,7 +113,9 @@ namespace MSFSPopoutPanelManager.Provider
{
// It is prop3 in SimConnectStruct (by DataDefinitions.cs)
SimConnectStruct simConnectStruct = new SimConnectStruct();
simConnectStruct.Prop03 = enable ? Convert.ToDouble(1): Convert.ToDouble(0);
simConnectStruct.Prop01 = _simData.Title; // must set "Title" for TrackIR variable to write correctly
simConnectStruct.Prop02 = _simData.ElectricalMasterBattery ? Convert.ToDouble(1) : Convert.ToDouble(0); // must set "ElectricalMasterBattery" for TrackIR variable to write correctly
simConnectStruct.Prop03 = enable ? Convert.ToDouble(1): Convert.ToDouble(0); // this is the TrackIR variable
_simConnector.SetDataObject(simConnectStruct);
}

View file

@ -9,9 +9,10 @@
<Company>Stanley Kwok</Company>
<Copyright>Stanley Kwok 2021</Copyright>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<Version>3.3.2.0</Version>
<Version>3.3.3.0</Version>
<Platforms>AnyCPU;x64</Platforms>
<UseWPF>true</UseWPF>
<AssemblyVersion>3.3.3.0</AssemblyVersion>
</PropertyGroup>
<ItemGroup>

View file

@ -1,6 +1,10 @@
# Version History
<hr/>
## Version 3.3.3
* Fixed issue when clicking on "Show/Edit Panel Location Overlay" or setting auto TrackIR disabling option will cause PFD/MFD panels to be turned off when performing auto pop out in cold start for G1000 equipped planes.
* Fixed issue where auto panning of cockpit view does not pan to previously saved camera view during pop out process.
## Version 3.3.2
* Hotfix: Fixed application crash when performing panel selections when MSFS is not running.

View file

@ -92,7 +92,7 @@
<Button Content="-" ToolTip="Delete Binding" Margin="10,0,0,0" Width="40" Click="DeleteBinding_Click" Style="{StaticResource ProfileDeletePlaneBindingDependency}"/>
</WrapPanel>
<CheckBox Margin="10,5,0,0" IsChecked="{Binding Path=DataStore.ActiveUserProfile.PowerOnRequiredForColdStart}" IsEnabled="{Binding Path=DataStore.HasActiveUserProfileId}" Command="{Binding Path=SetPowerOnRequiredCommand}">
<TextBlock Text="Power on required to pop out panels on cold start" TextWrapping="Wrap" Margin="5,0,0,3"/>
<TextBlock Text="Power on required to pop out panels on cold start (G1000 Only)" TextWrapping="Wrap" Margin="5,0,0,3"/>
</CheckBox>
</WrapPanel>
<Separator Margin="5,10,5,5"/>

View file

@ -4,7 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<Version>3.3.2.0</Version>
<Version>3.3.3.0</Version>
<PackageId>MSFS 2020 Popout Panel Manager</PackageId>
<Authors>Stanley Kwok</Authors>
<Product>MSFS 2020 Popout Panel Manager</Product>