From 65f32c1ccc0ba27c50ab86709acc37e7c5336c0c Mon Sep 17 00:00:00 2001 From: hawkeye Date: Fri, 8 Sep 2023 11:12:47 -0400 Subject: [PATCH] Update camera logic --- DomainModel/DomainModel.csproj | 6 +++--- MainApp/MainApp.csproj | 6 +++--- MainApp/UserControl/PreferenceDrawer.xaml | 4 ++-- Orchestration/Orchestration.csproj | 6 +++--- Orchestration/PanelPopOutOrchestrator.cs | 14 -------------- Orchestration/PanelSourceOrchestrator.cs | 1 - RELEASENOTES.md | 10 ++++++++-- Shared/Shared.csproj | 6 +++--- SimconnectAgent/SimconnectAgent.csproj | 6 +++--- VERSION.md | 10 ++++++++-- WindowsAgent/WindowEventManager.cs | 16 ++++++++++++++++ WindowsAgent/WindowsAgent.csproj | 6 +++--- 12 files changed, 52 insertions(+), 39 deletions(-) diff --git a/DomainModel/DomainModel.csproj b/DomainModel/DomainModel.csproj index 1813d63..9720642 100644 --- a/DomainModel/DomainModel.csproj +++ b/DomainModel/DomainModel.csproj @@ -11,9 +11,9 @@ https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.DomainModel x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 win-x64 Embedded Debug;Release;Local diff --git a/MainApp/MainApp.csproj b/MainApp/MainApp.csproj index 442d35e..93a3882 100644 --- a/MainApp/MainApp.csproj +++ b/MainApp/MainApp.csproj @@ -14,9 +14,9 @@ MSFSPopoutPanelManager.MainApp logo.ico x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 embedded en diff --git a/MainApp/UserControl/PreferenceDrawer.xaml b/MainApp/UserControl/PreferenceDrawer.xaml index b469f3d..5268e81 100644 --- a/MainApp/UserControl/PreferenceDrawer.xaml +++ b/MainApp/UserControl/PreferenceDrawer.xaml @@ -381,7 +381,7 @@ - Enable Panel Reset When Profile Is Locked + Enable Tracking of Panels When Profile Is Locked - Enable panel to go back to its original location when move if the profile is locked. Disable this setting will allow panel to be moved when profile is locked + Enable tracking of panels to allow panel to go back to its original location when move if the profile is locked. Disable this setting will allow panel to be moved when profile is locked but the profile setting will be unchanged. With this setting disable, Pop Out Panel Manager will no longer detect pop out panel's movement when profile is locked which may save some CPU cycles. diff --git a/Orchestration/Orchestration.csproj b/Orchestration/Orchestration.csproj index f60f28b..7250403 100644 --- a/Orchestration/Orchestration.csproj +++ b/Orchestration/Orchestration.csproj @@ -11,9 +11,9 @@ https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.Orchestration x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 win-x64 Embedded Debug;Release;Local diff --git a/Orchestration/PanelPopOutOrchestrator.cs b/Orchestration/PanelPopOutOrchestrator.cs index f8a38e3..eb013d6 100644 --- a/Orchestration/PanelPopOutOrchestrator.cs +++ b/Orchestration/PanelPopOutOrchestrator.cs @@ -21,7 +21,6 @@ namespace MSFSPopoutPanelManager.Orchestration private ProfileData _profileData; private AppSettingData _appSettingData; private FlightSimData _flightSimData; - private int _prePopOutCockpitZoomLevel = 50; public PanelPopOutOrchestrator(ProfileData profileData, AppSettingData appSettingData, FlightSimData flightSimData) { @@ -207,9 +206,6 @@ namespace MSFSPopoutPanelManager.Orchestration } else { - // Remember current game's zoom level to be recall after pop out - _prePopOutCockpitZoomLevel = _flightSimData.CockpitCameraZoom; - WorkflowStepWithMessage.Execute("Resetting camera view", () => { ResetCockpitView(); @@ -553,11 +549,6 @@ namespace MSFSPopoutPanelManager.Orchestration ResetCockpitView(); }, true); - WorkflowStepWithMessage.Execute("Setting camera zoom level", () => - { - SetCockpitZoomLevel(_prePopOutCockpitZoomLevel); - }, true); - break; case AfterPopOutCameraViewType.CustomCameraView: WorkflowStepWithMessage.Execute("Resetting camera view", () => @@ -570,11 +561,6 @@ namespace MSFSPopoutPanelManager.Orchestration return LoadCustomView(AppSetting.PopOutSetting.AfterPopOutCameraView.KeyBinding); }, true); - WorkflowStepWithMessage.Execute("Setting camera zoom level", () => - { - SetCockpitZoomLevel(_prePopOutCockpitZoomLevel); - }, true); - break; } } diff --git a/Orchestration/PanelSourceOrchestrator.cs b/Orchestration/PanelSourceOrchestrator.cs index dc130a5..9653b37 100644 --- a/Orchestration/PanelSourceOrchestrator.cs +++ b/Orchestration/PanelSourceOrchestrator.cs @@ -129,7 +129,6 @@ namespace MSFSPopoutPanelManager.Orchestration { Thread.Sleep(500); // wait for custom view save to be completed - FlightSimOrchestrator.ResetCameraView(); WindowActionManager.BringWindowToForeground(ApplicationHandle); // Turn TrackIR back on diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0d169c7..d43a022 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,7 +1,7 @@ ## Version 4.0.2 * Added new logic (not based on timing) to detect when flight session is ready to initiate pop out process for auto pop out panel. You can also set Auto Pop Out Panel Delay in preferences to 0 seconds if you have a fast PC. -* Fixed camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view. +* Added failure state when custom camera view fails to load. Pop Out Panel Manager will try to load the user specified custom camera (Ctrl-Alt-X/Alt-X where X is the camera defined in preference setting) for 10 seconds and when it fails, POPM will no longer try to pop out panels. * Added workaround for MSFS bug when using cockpit camera zoom setting (POV) is set to value other than 50 in MSFS general options. Now, camera POV (zoom, height, horizontal position) can be freely adjusted without affecting how panel source definitions are configured. @@ -11,4 +11,10 @@ * Added configurable keyboard shortcut to initiate pop out process (default is Ctrl-Shift-O). This keyboard shortcut can be configured in preference setting. This setting can be disabled to improve computing resource needed to constantly detect keyboard inputs. -* Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration. \ No newline at end of file +* Updated camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view. + +* Fixed an issue where full screen mode for pop out panel does not work on certain aircraft configuration. + +* Fixed an issue when manually closing pop out will reset profile panel configuration's width and height to 0 when the profile is unlocked. + +* Fixed logic where after panel source selection is completed, Pop Out Panel Manager will no longer recenter camera view. This is to remove confusion since Pop Out Manager has no way to tell the previous camera view you're on when panel source selection started. \ No newline at end of file diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index ad4f5c5..1b30d1d 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -11,9 +11,9 @@ https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.Shared x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 win-x64 Embedded Debug;Release;Local diff --git a/SimconnectAgent/SimconnectAgent.csproj b/SimconnectAgent/SimconnectAgent.csproj index 40baa61..f18e531 100644 --- a/SimconnectAgent/SimconnectAgent.csproj +++ b/SimconnectAgent/SimconnectAgent.csproj @@ -11,9 +11,9 @@ https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.SimConnectAgent x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 win-x64 Embedded Debug;Release;Local diff --git a/VERSION.md b/VERSION.md index b8f6e39..00130a7 100644 --- a/VERSION.md +++ b/VERSION.md @@ -4,7 +4,7 @@ ## Version 4.0.2 * Added new logic (not based on timing) to detect when flight session is ready to initiate pop out process for auto pop out panel. You can also set Auto Pop Out Panel Delay in preferences to 0 seconds if you have a fast PC. -* Fixed camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view. +* Added failure state when custom camera view fails to load. Pop Out Panel Manager will try to load the user specified custom camera (Ctrl-Alt-X/Alt-X where X is the camera defined in preference setting) for 10 seconds and when it fails, POPM will no longer try to pop out panels. * Added workaround for MSFS bug when using cockpit camera zoom setting (POV) is set to value other than 50 in MSFS general options. Now, camera POV (zoom, height, horizontal position) can be freely adjusted without affecting how panel source definitions are configured. @@ -14,7 +14,13 @@ * Added configurable keyboard shortcut to initiate pop out process (default is Ctrl-Shift-O). This keyboard shortcut can be configured in preference setting. This setting can be disabled to improve computing resource needed to constantly detect keyboard inputs. -* Fixed issue where full screen mode for pop out panel does not work on certain aircraft configuration. +* Updated camera logic to save and load custom camera view used by Pop Out Panel Manager. This is to work around camera issue since AAU2. Also, pop out progress messages will now show steps being taken when adjusting camera view. + +* Fixed an issue where full screen mode for pop out panel does not work on certain aircraft configuration. + +* Fixed an issue when manually closing pop out will reset profile panel configuration's width and height to 0 when the profile is unlocked. + +* Fixed logic where after panel source selection is completed, Pop Out Panel Manager will no longer recenter camera view. This is to remove confusion since Pop Out Manager has no way to tell the previous camera view you're on when panel source selection started. ## Version 4.0.1.2 * Hotfix - Fixed issue where using touch panel feature may freeze computer and the application. diff --git a/WindowsAgent/WindowEventManager.cs b/WindowsAgent/WindowEventManager.cs index 3cb5efa..406e7c0 100644 --- a/WindowsAgent/WindowEventManager.cs +++ b/WindowsAgent/WindowEventManager.cs @@ -117,6 +117,15 @@ namespace MSFSPopoutPanelManager.WindowsAgent } else { + // Pop out is closed + var rect = WindowActionManager.GetWindowRectangle(panelConfig.PanelHandle); + if (rect.Width == 0 && rect.Height == 0) + { + panelConfig.PanelHandle = IntPtr.MaxValue; + _prevShowWinCmd = null; + return; + } + WINDOWPLACEMENT wp = new WINDOWPLACEMENT(); wp.length = System.Runtime.InteropServices.Marshal.SizeOf(wp); PInvoke.GetWindowPlacement(hwnd, ref wp); @@ -164,6 +173,13 @@ namespace MSFSPopoutPanelManager.WindowsAgent private static void UpdatePanelCoordinates(PanelConfig panelConfig) { var rect = WindowActionManager.GetWindowRectangle(panelConfig.PanelHandle); + + if (rect.Width == 0 && rect.Height == 0) // don't set if width and height = 0 + { + panelConfig.PanelHandle = IntPtr.MaxValue; + return; + } + panelConfig.Left = rect.Left; panelConfig.Top = rect.Top; diff --git a/WindowsAgent/WindowsAgent.csproj b/WindowsAgent/WindowsAgent.csproj index e577559..30dc69f 100644 --- a/WindowsAgent/WindowsAgent.csproj +++ b/WindowsAgent/WindowsAgent.csproj @@ -11,9 +11,9 @@ https://github.com/hawkeye-stan/msfs-popout-panel-manager MSFSPopoutPanelManager.WindowsAgent x64 - 4.0.2.6 - 4.0.2.6 - 4.0.2.6 + 4.0.2.7 + 4.0.2.7 + 4.0.2.7 win-x64 Embedded Debug;Release;Local