From 6dfb21b5d4ef80e8492f2eaedb64bd6e4c4a4004 Mon Sep 17 00:00:00 2001 From: hawkeye Date: Tue, 31 May 2022 11:45:35 -0400 Subject: [PATCH] Version 3.3.3 --- FsConnector/FsConnector.csproj | 6 +++--- Model/Model.csproj | 5 +++-- Provider/InputEmulationManager.cs | 12 ++++++++++- Provider/PanelConfigurationManager.cs | 4 ++-- Provider/PanelPopoutManager.cs | 29 +++++++++++++++------------ Provider/Provider.csproj | 2 +- Provider/SimConnectManager.cs | 4 +++- Shared/Shared.csproj | 3 ++- VERSION.md | 4 ++++ WpfApp/UserControlPanelSelection.xaml | 2 +- WpfApp/WpfApp.csproj | 2 +- 11 files changed, 47 insertions(+), 26 deletions(-) diff --git a/FsConnector/FsConnector.csproj b/FsConnector/FsConnector.csproj index ab33836..f5bc613 100644 --- a/FsConnector/FsConnector.csproj +++ b/FsConnector/FsConnector.csproj @@ -5,15 +5,15 @@ FsConnector MSFS 2020 Popout Panel Manager FsConnector MSFS 2020 Popout Panel Manager FsConnector - 3.3.2.0 + 3.3.3.0 Stanley Kwok Stanley Kwok Stanley Kwok 2021 https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.FsConnector x64;AnyCPU - 3.3.2.0 - 3.3.2.0 + 3.3.3.0 + 3.3.3.0 diff --git a/Model/Model.csproj b/Model/Model.csproj index d8f1034..397c4f8 100644 --- a/Model/Model.csproj +++ b/Model/Model.csproj @@ -5,14 +5,15 @@ MSFSPopoutPanelManager.Model Model MSFS 2020 Popout Panel Manager Model - 3.3.2.0 + 3.3.3.0 Stanley Kwok Stanley Kwok Stanley Kwok 2021 MSFS 2020 Popout Panel Manager Model https://github.com/hawkeye-stan/msfs-popout-panel-manager x64;AnyCPU - 3.3.2.0 + 3.3.3.0 + 3.3.3.0 diff --git a/Provider/InputEmulationManager.cs b/Provider/InputEmulationManager.cs index e3af01a..790553f 100644 --- a/Provider/InputEmulationManager.cs +++ b/Provider/InputEmulationManager.cs @@ -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) diff --git a/Provider/PanelConfigurationManager.cs b/Provider/PanelConfigurationManager.cs index 53975ca..a344e4f 100644 --- a/Provider/PanelConfigurationManager.cs +++ b/Provider/PanelConfigurationManager.cs @@ -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); diff --git a/Provider/PanelPopoutManager.cs b/Provider/PanelPopoutManager.cs index 1e65138..1465688 100644 --- a/Provider/PanelPopoutManager.cs +++ b/Provider/PanelPopoutManager.cs @@ -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; diff --git a/Provider/Provider.csproj b/Provider/Provider.csproj index 4546485..5de1d98 100644 --- a/Provider/Provider.csproj +++ b/Provider/Provider.csproj @@ -7,7 +7,7 @@ MSFSPopoutPanelManager.Provider MSFS 2020 Popout Panel Manager Provider MSFS 2020 Popout Panel Manager Provider - 3.3.2.0 + 3.3.3.0 Stanley Kwok Stanley Kwok 2021 https://github.com/hawkeye-stan/msfs-popout-panel-manager diff --git a/Provider/SimConnectManager.cs b/Provider/SimConnectManager.cs index f0112ee..39b6a08 100644 --- a/Provider/SimConnectManager.cs +++ b/Provider/SimConnectManager.cs @@ -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); } diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index adf3174..9d161e7 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -9,9 +9,10 @@ Stanley Kwok Stanley Kwok 2021 https://github.com/hawkeye-stan/msfs-popout-panel-manager - 3.3.2.0 + 3.3.3.0 AnyCPU;x64 true + 3.3.3.0 diff --git a/VERSION.md b/VERSION.md index 820de2a..8d97c3d 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,6 +1,10 @@ # Version History
+## 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. diff --git a/WpfApp/UserControlPanelSelection.xaml b/WpfApp/UserControlPanelSelection.xaml index 5dd6ff5..fe77524 100644 --- a/WpfApp/UserControlPanelSelection.xaml +++ b/WpfApp/UserControlPanelSelection.xaml @@ -92,7 +92,7 @@