diff options
author | Ahmad Tantowi <ahmadtantowi@outlook.com> | 2023-10-08 16:04:41 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-08 11:04:41 +0200 |
commit | ac4f2c1e70b35ad4dada0ea1f9ae93cfc7851d4b (patch) | |
tree | 7983ba8f3a3c2848b7c5750ea3957d6d5b92efce | |
parent | e40470bbe1eeed7bdc15dcf51226e374453c1942 (diff) |
Avalonia: Show aspect ratio popup options in status bar (#5780)1.1.1049
* Show aspect ratio selection popup in status bar
* Add aspect ratio tooltip
* Fix typo
-rw-r--r-- | src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs | 5 | ||||
-rw-r--r-- | src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml | 48 | ||||
-rw-r--r-- | src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs | 3 |
3 files changed, 49 insertions, 7 deletions
diff --git a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs index bd852710..7a9e4df1 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs @@ -1278,6 +1278,11 @@ namespace Ryujinx.Ava.UI.ViewModels Glyph = Glyph.Grid; } + public void SetAspectRatio(AspectRatio aspectRatio) + { + ConfigurationState.Instance.Graphics.AspectRatio.Value = aspectRatio; + } + public async Task InstallFirmwareFromFile() { var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml index 58e06a1c..32524740 100644 --- a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml @@ -6,6 +6,7 @@ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels" + xmlns:config="clr-namespace:Ryujinx.Common.Configuration;assembly=Ryujinx.Common" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ryujinx.Ava.UI.Views.Main.MainStatusBarView" x:DataType="viewModels:MainWindowViewModel"> @@ -112,15 +113,52 @@ Background="Gray" BorderThickness="1" IsVisible="{Binding !ShowLoadProgress}" /> - <TextBlock + <SplitButton Name="AspectRatioStatus" - Margin="5,0,5,0" + Padding="5,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" + Background="Transparent" + BorderThickness="0" + CornerRadius="0" IsVisible="{Binding !ShowLoadProgress}" - PointerReleased="AspectRatioStatus_PointerReleased" - Text="{Binding AspectRatioStatusText}" - TextAlignment="Left" /> + Content="{Binding AspectRatioStatusText}" + Click="AspectRatioStatus_OnClick" + ToolTip.Tip="{locale:Locale AspectRatioTooltip}"> + <SplitButton.Styles> + <Style Selector="Border#SeparatorBorder"> + <Setter Property="Opacity" Value="0" /> + </Style> + </SplitButton.Styles> + <SplitButton.Flyout> + <MenuFlyout Placement="Bottom" ShowMode="TransientWithDismissOnPointerMoveAway"> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatio4x3}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Fixed4x3}"/> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatio16x9}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Fixed16x9}"/> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatio16x10}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Fixed16x10}"/> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatio21x9}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Fixed21x9}"/> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatio32x9}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Fixed32x9}"/> + <MenuItem + Header="{locale:Locale SettingsTabGraphicsAspectRatioStretch}" + Command="{Binding SetAspectRatio}" + CommandParameter="{x:Static config:AspectRatio.Stretched}"/> + </MenuFlyout> + </SplitButton.Flyout> + </SplitButton> <Border Width="2" Height="12" diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs index a0acc277..44426295 100644 --- a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs +++ b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs @@ -43,10 +43,9 @@ namespace Ryujinx.Ava.UI.Views.Main ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value; } - private void AspectRatioStatus_PointerReleased(object sender, PointerReleasedEventArgs e) + private void AspectRatioStatus_OnClick(object sender, RoutedEventArgs e) { AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value; - ConfigurationState.Instance.Graphics.AspectRatio.Value = (int)aspectRatio + 1 > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1; } |