Skip to content

Commit

Permalink
UI: NES - Fixed missing "Hardware buttons" list in the input settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed Jun 24, 2024
1 parent 6d020e0 commit 88e60a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion UI/Views/NesInputConfigView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
</Grid>
</c:OptionSection>
<c:OptionSection Header="{l:Translate grpHardware}">
<v:ShortcutKeysTabView HeaderMargin="0 0 0 0" Margin="0 0 10 0" />
<v:ShortcutKeysTabView HeaderMargin="0 0 0 0" Margin="0 0 10 0" ShortcutKeys="{Binding ShortcutKeys}" />
</c:OptionSection>
</StackPanel>
</ScrollViewer>
Expand Down
2 changes: 1 addition & 1 deletion UI/Views/PreferencesConfigView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</TabItem>

<TabItem Header="{l:Translate tpgShortcuts}">
<v:ShortcutKeysTabView />
<v:ShortcutKeysTabView ShortcutKeys="{Binding ShortcutKeys}" />
</TabItem>

<TabItem Header="{l:Translate tpgFiles}">
Expand Down
10 changes: 3 additions & 7 deletions UI/Views/ShortcutKeysTabView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
xmlns:vm="using:Mesen.ViewModels"
xmlns:c="using:Mesen.Controls"
xmlns:cfg="using:Mesen.Config"
xmlns:cs="using:Mesen.Config.Shortcuts"
xmlns:l="using:Mesen.Localization"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="450"
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
x:Name="root"
x:DataType="vm:PreferencesConfigViewModel"
x:Class="Mesen.Views.ShortcutKeysTabView"
>
<Design.DataContext>
<vm:PreferencesConfigViewModel />
</Design.DataContext>

<UserControl.Resources>
<l:EnumConverter x:Key="EnumConverter" />
</UserControl.Resources>
Expand All @@ -32,9 +28,9 @@
</Border>

<ScrollViewer AllowAutoHide="False">
<ItemsControl ItemsSource="{Binding ShortcutKeys}">
<ItemsControl ItemsSource="{Binding ShortcutKeys, ElementName=root}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DataTemplate DataType="{x:Type cs:ShortcutKeyInfo}">
<StackPanel>
<Border BorderBrush="{StaticResource MesenGrayBorderColor}" BorderThickness="1" Margin="0 -1 0 0">
<Grid ColumnDefinitions="3*, 1*, 1*" Margin="5 0 0 0">
Expand Down
13 changes: 10 additions & 3 deletions UI/Views/ShortcutKeysTabView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Mesen.Utilities;
using Mesen.Config;
using Mesen.Config.Shortcuts;
using System.Collections.Generic;

namespace Mesen.Views
{
public class ShortcutKeysTabView : UserControl
{
public static readonly StyledProperty<Thickness> HeaderMarginProperty = AvaloniaProperty.Register<ShortcutKeysTabView, Thickness>(nameof(HeaderMargin), new Thickness(5, 5, 16, 5));

public static readonly StyledProperty<List<ShortcutKeyInfo>> ShortcutKeysProperty = AvaloniaProperty.Register<ShortcutKeysTabView, List<ShortcutKeyInfo>>(nameof(ShortcutKeys), new List<ShortcutKeyInfo>());

public Thickness HeaderMargin
{
get { return GetValue(HeaderMarginProperty); }
set { SetValue(HeaderMarginProperty, value); }
}

public List<ShortcutKeyInfo> ShortcutKeys
{
get { return GetValue(ShortcutKeysProperty); }
set { SetValue(ShortcutKeysProperty, value); }
}

public ShortcutKeysTabView()
{
InitializeComponent();
Expand Down

0 comments on commit 88e60a4

Please sign in to comment.