1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 05:40:11 +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> <AssemblyName>FsConnector</AssemblyName>
<PackageId>MSFS 2020 Popout Panel Manager FsConnector</PackageId> <PackageId>MSFS 2020 Popout Panel Manager FsConnector</PackageId>
<Product>MSFS 2020 Popout Panel Manager FsConnector</Product> <Product>MSFS 2020 Popout Panel Manager FsConnector</Product>
<Version>3.3.2.0</Version> <Version>3.3.3.0</Version>
<Authors>Stanley Kwok</Authors> <Authors>Stanley Kwok</Authors>
<Company>Stanley Kwok</Company> <Company>Stanley Kwok</Company>
<Copyright>Stanley Kwok 2021</Copyright> <Copyright>Stanley Kwok 2021</Copyright>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl>
<RootNamespace>MSFSPopoutPanelManager.FsConnector</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.FsConnector</RootNamespace>
<Platforms>x64;AnyCPU</Platforms> <Platforms>x64;AnyCPU</Platforms>
<AssemblyVersion>3.3.2.0</AssemblyVersion> <AssemblyVersion>3.3.3.0</AssemblyVersion>
<FileVersion>3.3.2.0</FileVersion> <FileVersion>3.3.3.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

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

View file

@ -47,8 +47,17 @@ namespace MSFSPopoutPanelManager.Provider
PInvoke.keybd_event(Convert.ToByte(VK_RMENU), 0, KEYEVENTF_KEYUP, 0); 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); PInvoke.SetForegroundWindow(hwnd);
LeftClick(x, y); LeftClick(x, y);
@ -105,6 +114,7 @@ namespace MSFSPopoutPanelManager.Provider
Thread.Sleep(200); Thread.Sleep(200);
PInvoke.keybd_event(Convert.ToByte(customViewKey), 0, KEYEVENTF_KEYUP, 0); PInvoke.keybd_event(Convert.ToByte(customViewKey), 0, KEYEVENTF_KEYUP, 0);
PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0); PInvoke.keybd_event(Convert.ToByte(VK_LMENU), 0, KEYEVENTF_KEYUP, 0);
} }
public static void ToggleFullScreenPanel(IntPtr hwnd) public static void ToggleFullScreenPanel(IntPtr hwnd)

View file

@ -43,7 +43,7 @@ namespace MSFSPopoutPanelManager.Provider
public void PanelConfigPropertyUpdated(PanelConfigItem panelConfigItem) public void PanelConfigPropertyUpdated(PanelConfigItem panelConfigItem)
{ {
if (!AllowEdit || UserProfile.IsLocked) if (panelConfigItem == null || !AllowEdit || UserProfile.IsLocked)
return; return;
var panelConfig = UserProfile.PanelConfigs.ToList().Find(p => p.PanelIndex == panelConfigItem.PanelIndex); 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) 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; return;
var index = UserProfile.PanelConfigs.ToList().FindIndex(p => p.PanelIndex == panelConfigItem.PanelIndex); var index = UserProfile.PanelConfigs.ToList().FindIndex(p => p.PanelIndex == panelConfigItem.PanelIndex);

View file

@ -51,6 +51,9 @@ namespace MSFSPopoutPanelManager.Provider
var simualatorProcess = DiagnosticManager.GetSimulatorProcess(); var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
if (simualatorProcess != null) 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); InputEmulationManager.LoadCustomView(simualatorProcess.Handle, AppSetting.AutoPanningKeyBinding);
Thread.Sleep(500); Thread.Sleep(500);
} }
@ -81,7 +84,7 @@ namespace MSFSPopoutPanelManager.Provider
var simualatorProcess = DiagnosticManager.GetSimulatorProcess(); var simualatorProcess = DiagnosticManager.GetSimulatorProcess();
if (simualatorProcess != null && UserProfile.PanelSourceCoordinates.Count > 0) 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(); _userProfileManager.WriteUserProfiles();
@ -110,7 +113,7 @@ namespace MSFSPopoutPanelManager.Provider
_panels.Clear(); _panels.Clear();
if(_simulatorHandle != IntPtr.Zero) if (_simulatorHandle != IntPtr.Zero)
PInvoke.SetForegroundWindow(_simulatorHandle); PInvoke.SetForegroundWindow(_simulatorHandle);
try try
@ -127,9 +130,9 @@ namespace MSFSPopoutPanelManager.Provider
var handle = PInvoke.FindWindow("AceApp", String.Empty); 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."); 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."); 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); var panelInfo = GetPanelWindowInfo(handle);
@ -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."); 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 // 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); PInvoke.EnumWindows(new PInvoke.CallBack(EnumBuiltinPopoutCallBack), 0);
// Add the MSFS Touch Panel (My other github project) windows to the panel list // Add the MSFS Touch Panel (My other github project) windows to the panel list
@ -416,7 +419,7 @@ namespace MSFSPopoutPanelManager.Provider
return Point.Empty; return Point.Empty;
var panelMenubarBottom = GetPanelMenubarBottom(sourceImage, rectangle); var panelMenubarBottom = GetPanelMenubarBottom(sourceImage, rectangle);
if (panelMenubarTop > sourceImage.Height) if (panelMenubarBottom > sourceImage.Height)
return Point.Empty; return Point.Empty;
var panelsStartingLeft = GetPanelMenubarStartingLeft(sourceImage, rectangle, panelMenubarTop + 5); var panelsStartingLeft = GetPanelMenubarStartingLeft(sourceImage, rectangle, panelMenubarTop + 5);
@ -474,8 +477,8 @@ namespace MSFSPopoutPanelManager.Provider
private int GetPanelMenubarBottom(Bitmap sourceImage, Rectangle rectangle) 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 // 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.25); // look at around 25% from the left var left = Convert.ToInt32((rectangle.Width) * 0.7); // look at around 70% from the left
var top = sourceImage.Height - rectangle.Height; var top = sourceImage.Height - rectangle.Height;
if (top < 0 || left < 0) if (top < 0 || left < 0)
@ -501,7 +504,7 @@ namespace MSFSPopoutPanelManager.Provider
int green = currentLine[x + 1]; int green = currentLine[x + 1];
int blue = currentLine[x]; 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 // found the top of menu bar
menubarBottom = y + top; menubarBottom = y + top;
@ -540,7 +543,7 @@ namespace MSFSPopoutPanelManager.Provider
int green = currentLine[y + 1]; int green = currentLine[y + 1];
int blue = currentLine[y]; 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); sourceImage.UnlockBits(stripData);
return sourceImage.Width - x; return sourceImage.Width - x;

View file

@ -7,7 +7,7 @@
<RootNamespace>MSFSPopoutPanelManager.Provider</RootNamespace> <RootNamespace>MSFSPopoutPanelManager.Provider</RootNamespace>
<PackageId>MSFS 2020 Popout Panel Manager Provider</PackageId> <PackageId>MSFS 2020 Popout Panel Manager Provider</PackageId>
<Product>MSFS 2020 Popout Panel Manager Provider</Product> <Product>MSFS 2020 Popout Panel Manager Provider</Product>
<Version>3.3.2.0</Version> <Version>3.3.3.0</Version>
<Authors>Stanley Kwok</Authors> <Authors>Stanley Kwok</Authors>
<Copyright>Stanley Kwok 2021</Copyright> <Copyright>Stanley Kwok 2021</Copyright>
<PackageProjectUrl>https://github.com/hawkeye-stan/msfs-popout-panel-manager</PackageProjectUrl> <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) // It is prop3 in SimConnectStruct (by DataDefinitions.cs)
SimConnectStruct simConnectStruct = new SimConnectStruct(); 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); _simConnector.SetDataObject(simConnectStruct);
} }

View file

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

View file

@ -1,6 +1,10 @@
# Version History # Version History
<hr/> <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 ## Version 3.3.2
* Hotfix: Fixed application crash when performing panel selections when MSFS is not running. * 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}"/> <Button Content="-" ToolTip="Delete Binding" Margin="10,0,0,0" Width="40" Click="DeleteBinding_Click" Style="{StaticResource ProfileDeletePlaneBindingDependency}"/>
</WrapPanel> </WrapPanel>
<CheckBox Margin="10,5,0,0" IsChecked="{Binding Path=DataStore.ActiveUserProfile.PowerOnRequiredForColdStart}" IsEnabled="{Binding Path=DataStore.HasActiveUserProfileId}" Command="{Binding Path=SetPowerOnRequiredCommand}"> <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> </CheckBox>
</WrapPanel> </WrapPanel>
<Separator Margin="5,10,5,5"/> <Separator Margin="5,10,5,5"/>

View file

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