UI: Upgrade to Avalonia11-preview8

This commit is contained in:
Sour 2023-05-26 14:58:17 +09:00
parent a16a4e27be
commit e2f6404c10
88 changed files with 251 additions and 1726 deletions

View file

@ -103,7 +103,7 @@ namespace Mesen.Config
}
}
if(wnd.WindowState == WindowState.Normal && (wnd.Position.X > 0 || wnd.Position.Y > 0) && wnd.PlatformImpl != null && wnd.Width != wnd.Screens.ScreenFromWindow(wnd.PlatformImpl)?.Bounds.Width) {
if(wnd.WindowState == WindowState.Normal && (wnd.Position.X > 0 || wnd.Position.Y > 0) && wnd.PlatformImpl != null && wnd.Width != wnd.Screens.ScreenFromWindow(wnd)?.Bounds.Width) {
//If window is not maximized/minimized, save current position+size
_restoreBounds = new PixelRect(wnd.Position.X, wnd.Position.Y, (int)wnd.Width, (int)wnd.Height);
}

View file

@ -15,7 +15,7 @@ namespace Mesen.Config
public EventViewerCategoryCfg(Color color)
{
Color = color.ToUint32();
Color = color.ToUInt32();
}
public static implicit operator InteropEventViewerCategoryCfg(EventViewerCategoryCfg cfg)

View file

@ -34,18 +34,18 @@ namespace Mesen.Config
[Reactive] public bool HideExecutedBytes { get; set; } = false;
[Reactive] public HighlightFadeSpeed FadeSpeed { get; set; } = HighlightFadeSpeed.Normal;
[Reactive] public HighlightConfig ReadHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Blue.ToUint32() };
[Reactive] public HighlightConfig WriteHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Red.ToUint32() };
[Reactive] public HighlightConfig ExecHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Green.ToUint32() };
[Reactive] public HighlightConfig ReadHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Blue.ToUInt32() };
[Reactive] public HighlightConfig WriteHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Red.ToUInt32() };
[Reactive] public HighlightConfig ExecHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Green.ToUInt32() };
[Reactive] public HighlightConfig LabelHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.LightPink.ToUint32() };
[Reactive] public HighlightConfig CodeHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.DarkSeaGreen.ToUint32() };
[Reactive] public HighlightConfig DataHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.LightSteelBlue.ToUint32() };
[Reactive] public HighlightConfig LabelHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.LightPink.ToUInt32() };
[Reactive] public HighlightConfig CodeHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.DarkSeaGreen.ToUInt32() };
[Reactive] public HighlightConfig DataHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.LightSteelBlue.ToUInt32() };
[Reactive] public HighlightConfig FrozenHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Magenta.ToUint32() };
[Reactive] public HighlightConfig FrozenHighlight { get; set; } = new() { Highlight = true, ColorCode = Colors.Magenta.ToUInt32() };
[Reactive] public HighlightConfig NesPcmDataHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.Khaki.ToUint32() };
[Reactive] public HighlightConfig NesDrawnChrRomHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.Thistle.ToUint32() };
[Reactive] public HighlightConfig NesPcmDataHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.Khaki.ToUInt32() };
[Reactive] public HighlightConfig NesDrawnChrRomHighlight { get; set; } = new() { Highlight = false, ColorCode = Colors.Thistle.ToUInt32() };
[Reactive] public bool HighlightBreakpoints { get; set; } = false;

View file

@ -166,19 +166,6 @@ namespace Mesen.Config
public void ApplyFontOptions()
{
if(FontAntialiasing != FontAntialiasing.SubPixelAntialias) {
Type? renderInterface = typeof(Avalonia.Skia.SkiaPlatform).Assembly.GetType("Avalonia.Skia.PlatformRenderInterface");
FieldInfo? prop = renderInterface?.GetField("s_font", BindingFlags.Static | BindingFlags.NonPublic);
if(prop?.GetValue(null) is SkiaSharp.SKFont font) {
font.Edging = FontAntialiasing switch {
FontAntialiasing.Disabled => SkiaSharp.SKFontEdging.Alias,
FontAntialiasing.Antialias => SkiaSharp.SKFontEdging.Antialias,
FontAntialiasing.SubPixelAntialias or _ => SkiaSharp.SKFontEdging.SubpixelAntialias
};
font.Subpixel = FontAntialiasing == FontAntialiasing.SubPixelAntialias;
}
}
UpdateFonts();
}

View file

@ -12,7 +12,7 @@
<ComboBox
Name="Dropdown"
HorizontalAlignment="Stretch"
Items="{CompiledBinding InternalItems, ElementName=root}"
ItemsSource="{CompiledBinding InternalItems, ElementName=root}"
SelectedItem="{CompiledBinding InternalSelectedItem, ElementName=root}"
/>
</UserControl>

View file

@ -32,7 +32,7 @@
Click="btnSelectPalette_OnClick"
>
<Button.ContextMenu>
<ContextMenu Name="Preset" PlacementMode="Bottom" Items="{CompiledBinding PalettePresets, ElementName=root}">
<ContextMenu Name="Preset" PlacementMode="Bottom" ItemsSource="{CompiledBinding PalettePresets, ElementName=root}">
<ContextMenu.Styles>
<Style Selector="MenuItem">
<Setter Property="Header" Value="{Binding Name}" />

View file

@ -95,7 +95,7 @@ namespace Mesen.Controls
bool success = await wnd.ShowCenteredDialog<bool>(this.GetVisualRoot() as Visual);
if(success) {
UInt32[] colors = (UInt32[])Palette.Clone();
colors[e.ColorIndex] = model.Color.ToUint32();
colors[e.ColorIndex] = model.Color.ToUInt32();
Palette = colors;
}
}

View file

@ -18,7 +18,6 @@ namespace Mesen.Controls
public class SimpleImageViewer : Control
{
public static readonly StyledProperty<IImage> SourceProperty = AvaloniaProperty.Register<SimpleImageViewer, IImage>(nameof(Source));
public static readonly StyledProperty<BitmapInterpolationMode> InterpolationModeProperty = AvaloniaProperty.Register<SimpleImageViewer, BitmapInterpolationMode>(nameof(InterpolationMode), BitmapInterpolationMode.Default);
public IImage Source
{
@ -26,15 +25,9 @@ namespace Mesen.Controls
set { SetValue(SourceProperty, value); }
}
public BitmapInterpolationMode InterpolationMode
{
get { return GetValue(InterpolationModeProperty); }
set { SetValue(InterpolationModeProperty, value); }
}
static SimpleImageViewer()
{
AffectsRender<SimpleImageViewer>(SourceProperty, InterpolationModeProperty);
AffectsRender<SimpleImageViewer>(SourceProperty);
}
public SimpleImageViewer()
@ -50,8 +43,7 @@ namespace Mesen.Controls
context.DrawImage(
Source,
new Rect(0, 0, (int)Source.Size.Width, (int)Source.Size.Height),
new Rect(0, 0, Bounds.Width, Bounds.Height),
InterpolationMode
new Rect(0, 0, Bounds.Width, Bounds.Height)
);
}
}

View file

@ -29,12 +29,14 @@
Source="{CompiledBinding EmuHudSurface}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
RenderOptions.TextRenderingMode="Alias"
/>
<c:SimpleImageViewer
Name="ScriptHud"
Source="{CompiledBinding ScriptHudSurface}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
RenderOptions.TextRenderingMode="Alias"
/>
</Panel>
</UserControl>

View file

@ -16,6 +16,7 @@ using Mesen.Interop;
using Splat.ModeDetection;
using Mesen.ViewModels;
using ReactiveUI.Fody.Helpers;
using Avalonia.Media;
namespace Mesen.Controls
{
@ -71,7 +72,7 @@ namespace Mesen.Controls
UpdateSurface(frameInfo.ScriptHud, _model.ScriptHudSurface, s => _model.ScriptHudSurface = s);
Dispatcher.UIThread.Post(() => {
_frame.InterpolationMode = ConfigManager.Config.Video.UseBilinearInterpolation ? BitmapInterpolationMode.LowQuality : BitmapInterpolationMode.Default;
RenderOptions.SetBitmapInterpolationMode(_frame, ConfigManager.Config.Video.UseBilinearInterpolation ? BitmapInterpolationMode.LowQuality : BitmapInterpolationMode.None);
_frame.InvalidateVisual();
_emuHud.InvalidateVisual();
_scriptHud.InvalidateVisual();

View file

@ -35,7 +35,7 @@
</Style>
</UserControl.Styles>
<ItemsControl DataContext="{Binding ElementName=root}" Items="{Binding Items}">
<ItemsControl DataContext="{Binding ElementName=root}" ItemsSource="{Binding Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
@ -82,7 +82,7 @@
<ContextMenu
IsEnabled="{Binding SubActions, Converter={x:Static ObjectConverters.IsNotNull}}"
Name="ActionMenu"
Items="{Binding SubActions}"
ItemsSource="{Binding SubActions}"
/>
</Button.ContextMenu>
</Button>

View file

@ -55,7 +55,7 @@ namespace Mesen.Debugger.Controls
if(activeAddress >= 0) {
int position = (int)(((double)activeAddress.Value / maxAddress) * height) - 2;
SolidColorBrush brush = new(ConfigManager.Config.Debug.Debugger.CodeActiveStatementColor);
Pen pen = new Pen(Colors.Black.ToUint32());
Pen pen = new Pen(Colors.Black.ToUInt32());
context.FillRectangle(brush, new Rect(0.5, position - 0.5, width, 3));
context.DrawRectangle(pen, new Rect(0.5, position - 0.5, width, 3));
}
@ -68,7 +68,7 @@ namespace Mesen.Debugger.Controls
SolidColorBrush brush = new(bp.GetColor());
context.FillRectangle(brush, new Rect(0, position, 4, 4));
} else {
Pen pen = new Pen(bp.GetColor().ToUint32());
Pen pen = new Pen(bp.GetColor().ToUInt32());
SolidColorBrush brush = new(Colors.White);
context.FillRectangle(brush, new Rect(0, position, 4, 4));
context.DrawRectangle(pen, new Rect(0.5, position + 0.5, 3, 3));
@ -80,7 +80,7 @@ namespace Mesen.Debugger.Controls
if(activeLine >= 0) {
int position = (int)(((double)activeLine.Value / srcModel.SelectedFile.Data.Length) * height) - 2;
SolidColorBrush brush = new(ConfigManager.Config.Debug.Debugger.CodeActiveStatementColor);
Pen pen = new Pen(Colors.Black.ToUint32());
Pen pen = new Pen(Colors.Black.ToUInt32());
context.FillRectangle(brush, new Rect(0.5, position - 0.5, width, 3));
context.DrawRectangle(pen, new Rect(0.5, position - 0.5, width, 3));
}
@ -93,7 +93,7 @@ namespace Mesen.Debugger.Controls
SolidColorBrush brush = new SolidColorBrush(bp.GetColor());
context.FillRectangle(brush, new Rect(0, position, 4, 4));
} else {
Pen pen = new Pen(bp.GetColor().ToUint32());
Pen pen = new Pen(bp.GetColor().ToUInt32());
context.DrawRectangle(pen, new Rect(0.5, position + 0.5, 3, 3));
}
}

View file

@ -27,7 +27,7 @@
</Border>
<ScrollViewer AllowAutoHide="False">
<ItemsControl Items="{Binding Shortcuts}">
<ItemsControl ItemsSource="{Binding Shortcuts}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />

View file

@ -20,7 +20,7 @@ namespace Mesen.Debugger.Controls
public static readonly StyledProperty<string> SearchStringProperty = AvaloniaProperty.Register<DisassemblyViewer, string>(nameof(SearchString), string.Empty);
public static readonly StyledProperty<FontFamily> FontFamilyProperty = AvaloniaProperty.Register<DisassemblyViewer, FontFamily>(nameof(FontFamily), new FontFamily(FontManager.Current.DefaultFontFamilyName));
public static readonly StyledProperty<FontFamily> FontFamilyProperty = AvaloniaProperty.Register<DisassemblyViewer, FontFamily>(nameof(FontFamily), new FontFamily(FontManager.Current.DefaultFontFamily.Name));
public static readonly StyledProperty<double> FontSizeProperty = AvaloniaProperty.Register<DisassemblyViewer, double>(nameof(FontSize), 12);
public static readonly StyledProperty<bool> ShowByteCodeProperty = AvaloniaProperty.Register<DisassemblyViewer, bool>(nameof(ShowByteCode), false);
public static readonly StyledProperty<AddressDisplayType> AddressDisplayTypeProperty = AvaloniaProperty.Register<DisassemblyViewer, AddressDisplayType>(nameof(AddressDisplayType), AddressDisplayType.CpuAddress);
@ -309,8 +309,8 @@ namespace Mesen.Debugger.Controls
if(lineStyle.TextBgColor.HasValue || lineStyle.OutlineColor.HasValue) {
text = FormatText(GetHighlightedText(line, lineParts, out double leftMargin));
Brush? b = lineStyle.TextBgColor.HasValue ? new SolidColorBrush(lineStyle.TextBgColor.Value.ToUint32()) : null;
Pen? p = lineStyle.OutlineColor.HasValue ? new Pen(lineStyle.OutlineColor.Value.ToUint32()) : null;
Brush? b = lineStyle.TextBgColor.HasValue ? new SolidColorBrush(lineStyle.TextBgColor.Value.ToUInt32()) : null;
Pen? p = lineStyle.OutlineColor.HasValue ? new Pen(lineStyle.OutlineColor.Value.ToUInt32()) : null;
if(b != null) {
context.DrawRectangle(b, null, new Rect(Math.Round(x + codeIndent + leftMargin), Math.Round(y), Math.Round(text.WidthIncludingTrailingWhitespace), Math.Round(LetterSize.Height) - 1));
}
@ -435,12 +435,12 @@ namespace Mesen.Debugger.Controls
using var scale = context.PushTransform(Matrix.CreateScale(0.85, 0.85));
EllipseGeometry geometry = new EllipseGeometry(new Rect(0, 0, LetterSize.Height, LetterSize.Height));
IBrush? b = lineStyle.Symbol.HasFlag(LineSymbol.Circle) ? new SolidColorBrush(lineStyle.OutlineColor.Value) : null;
IPen? p = lineStyle.Symbol.HasFlag(LineSymbol.CircleOutline) ? new Pen(lineStyle.OutlineColor.Value.ToUint32()) : null;
IPen? p = lineStyle.Symbol.HasFlag(LineSymbol.CircleOutline) ? new Pen(lineStyle.OutlineColor.Value.ToUInt32()) : null;
context.DrawGeometry(b, p, geometry);
if(lineStyle.Symbol.HasFlag(LineSymbol.Plus)) {
Color c = lineStyle.Symbol.HasFlag(LineSymbol.CircleOutline) ? lineStyle.OutlineColor.Value : Colors.White;
p = new Pen(c.ToUint32(), 2);
p = new Pen(c.ToUInt32(), 2);
context.DrawLine(p, new Point(2, LetterSize.Height / 2), new Point(LetterSize.Height - 2, LetterSize.Height / 2));
context.DrawLine(p, new Point(LetterSize.Height / 2, 2), new Point(LetterSize.Height / 2, LetterSize.Height - 2));
}

View file

@ -114,5 +114,5 @@
</DataTemplate>
</UserControl.DataTemplates>
<ItemsControl DataContext="{Binding, ElementName=root}" Items="{Binding Items}" />
<ItemsControl DataContext="{Binding, ElementName=root}" ItemsSource="{Binding Items}" />
</UserControl>

View file

@ -44,7 +44,7 @@ namespace Mesen.Debugger.Controls
bool success = await wnd.ShowCenteredDialog<bool>(this);
if(success) {
Config.Color = model.Color.ToUint32();
Config.Color = model.Color.ToUInt32();
}
}
}

View file

@ -62,9 +62,9 @@ namespace Mesen.Debugger.Controls
foreach(ByteInfo byteInfo in dataToDraw) {
if(!_skFillPaints.ContainsKey(byteInfo.BackColor)) {
_skFillPaints[byteInfo.BackColor] = new SKPaint() { Color = new SKColor(ColorHelper.GetColor(byteInfo.BackColor).ToUint32()) };
_skFillPaints[byteInfo.BackColor] = new SKPaint() { Color = new SKColor(ColorHelper.GetColor(byteInfo.BackColor).ToUInt32()) };
} else if(!_skBorderPaints.ContainsKey(byteInfo.BorderColor)) {
_skBorderPaints[byteInfo.BorderColor] = new SKPaint() { Style = SKPaintStyle.Stroke, Color = new SKColor(ColorHelper.GetColor(byteInfo.BorderColor).ToUint32()) };
_skBorderPaints[byteInfo.BorderColor] = new SKPaint() { Style = SKPaintStyle.Stroke, Color = new SKColor(ColorHelper.GetColor(byteInfo.BorderColor).ToUInt32()) };
}
}
}
@ -88,9 +88,9 @@ namespace Mesen.Debugger.Controls
public bool Equals(ICustomDrawOperation? other) => false;
public bool HitTest(Point p) => false;
public void Render(IDrawingContextImpl context)
public void Render(ImmediateDrawingContext context)
{
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
var leaseFeature = context.PlatformImpl.GetFeature<ISkiaSharpApiLeaseFeature>();
using var lease = leaseFeature?.Lease();
var canvas = lease?.SkCanvas;
if(canvas == null) {
@ -119,7 +119,7 @@ namespace Mesen.Debugger.Controls
private void DrawHexView(SKCanvas canvas, Color color)
{
SKPaint paint = new SKPaint();
paint.Color = new SKColor(ColorHelper.GetColor(color).ToUint32());
paint.Color = new SKColor(ColorHelper.GetColor(color).ToUInt32());
SKTypeface typeface = SKTypeface.FromFamilyName(_fontFamily);
SKFont font = new SKFont(typeface, _fontSize);
@ -227,7 +227,7 @@ namespace Mesen.Debugger.Controls
private void DrawStringView(SKCanvas canvas, Color color)
{
SKPaint paint = new SKPaint();
paint.Color = new SKColor(ColorHelper.GetColor(color).ToUint32());
paint.Color = new SKColor(ColorHelper.GetColor(color).ToUInt32());
SKTypeface typeface = SKTypeface.FromFamilyName(_fontFamily);
SKFont monoFont = new SKFont(typeface, _fontSize);
@ -453,9 +453,9 @@ namespace Mesen.Debugger.Controls
public bool Equals(ICustomDrawOperation? other) => false;
public bool HitTest(Point p) => false;
public void Render(IDrawingContextImpl context)
public void Render(ImmediateDrawingContext context)
{
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
var leaseFeature = context.PlatformImpl.GetFeature<ISkiaSharpApiLeaseFeature>();
using var lease = leaseFeature?.Lease();
var canvas = lease?.SkCanvas;
if(canvas == null) {
@ -466,7 +466,7 @@ namespace Mesen.Debugger.Controls
canvas.Translate(0, 0);
SKPaint paint = new SKPaint();
paint.Color = new SKColor(ColorHelper.GetColor(_headerForeground).ToUint32());
paint.Color = new SKColor(ColorHelper.GetColor(_headerForeground).ToUInt32());
SKTypeface typeface = SKTypeface.FromFamilyName(_fontFamily);
SKFont font = new SKFont(typeface, _fontSize);

View file

@ -22,7 +22,7 @@ namespace Mesen.Debugger.Controls
public static readonly StyledProperty<int> SelectionStartProperty = AvaloniaProperty.Register<HexEditor, int>(nameof(SelectionStart), 0, defaultBindingMode: Avalonia.Data.BindingMode.TwoWay);
public static readonly StyledProperty<int> SelectionLengthProperty = AvaloniaProperty.Register<HexEditor, int>(nameof(SelectionLength), 0, defaultBindingMode: Avalonia.Data.BindingMode.TwoWay);
public static readonly StyledProperty<FontFamily> FontFamilyProperty = AvaloniaProperty.Register<HexEditor, FontFamily>(nameof(FontFamily), new FontFamily(FontManager.Current.DefaultFontFamilyName));
public static readonly StyledProperty<FontFamily> FontFamilyProperty = AvaloniaProperty.Register<HexEditor, FontFamily>(nameof(FontFamily), new FontFamily(FontManager.Current.DefaultFontFamily.Name));
public static readonly StyledProperty<double> FontSizeProperty = AvaloniaProperty.Register<HexEditor, double>(nameof(FontSize), 12);
public static readonly StyledProperty<bool> ShowStringViewProperty = AvaloniaProperty.Register<HexEditor, bool>(nameof(ShowStringView), false);
@ -402,12 +402,12 @@ namespace Mesen.Debugger.Controls
}
}
Application.Current?.Clipboard?.SetTextAsync(sb.ToString());
ApplicationHelper.GetMainWindow()?.Clipboard?.SetTextAsync(sb.ToString());
}
public async void PasteSelection()
{
var clipboard = Application.Current?.Clipboard;
var clipboard = ApplicationHelper.GetMainWindow()?.Clipboard;
if(clipboard != null) {
string? text = await clipboard.GetTextAsync();
if(text != null) {
@ -808,7 +808,7 @@ namespace Mesen.Debugger.Controls
public override int GetHashCode()
{
return (int)(this.BackColor.ToUint32() ^ this.BorderColor.ToUint32() ^ this.ForeColor.ToUint32() ^ (this.Selected ? 1 : 0));
return (int)(this.BackColor.ToUInt32() ^ this.BorderColor.ToUInt32() ^ this.ForeColor.ToUInt32() ^ (this.Selected ? 1 : 0));
}
}
}

View file

@ -1,31 +0,0 @@
using Dock.Model.ReactiveUI.Controls;
using Dock.Model.Core;
using System;
using System.Collections.Generic;
using System.Windows.Input;
namespace Mesen.Debugger.Controls
{
//TODO: This is a patch to prevent performance issues when opening debugger caused by exceptions
//triggered in Dock because it expects children of DockControl to implement IDock
public class MesenProportionalDockSplitter : ProportionalDockSplitter, IDock
{
public IList<IDockable>? VisibleDockables { get => null; set => throw new NotImplementedException(); }
public IList<IDockable>? HiddenDockables { get => null; set => throw new NotImplementedException(); }
public IList<IDockable>? PinnedDockables { get => null; set => throw new NotImplementedException(); }
public IDockable? ActiveDockable { get => null; set => throw new NotImplementedException(); }
public IDockable? DefaultDockable { get => null; set => throw new NotImplementedException(); }
public IDockable? FocusedDockable { get => null; set => throw new NotImplementedException(); }
public double Proportion { get => 1.0; set => throw new NotImplementedException(); }
public DockMode Dock { get => DockMode.Top; set => throw new NotImplementedException(); }
public bool IsActive { get => false; set => throw new NotImplementedException(); }
public bool IsCollapsable { get => false; set => throw new NotImplementedException(); }
public bool CanGoBack => false;
public bool CanGoForward => false;
public ICommand GoBack => null!;
public ICommand GoForward => null!;
public ICommand Navigate => null!;
public ICommand Close => null!;
}
}

View file

@ -391,7 +391,7 @@ namespace Mesen.Debugger.Controls
int gridSizeY = (int)(gridDef.SizeY * Zoom);
double gridRestartY = (int)(gridDef.RestartY * Zoom) + 0.5;
Pen pen = new Pen(gridDef.Color.ToUint32(), 1);
Pen pen = new Pen(gridDef.Color.ToUInt32(), 1);
double offset = 0.5;
for(int i = 1; i <= width / gridSizeX; i++) {
double x = i * gridSizeX + offset;
@ -431,8 +431,7 @@ namespace Mesen.Debugger.Controls
context.DrawImage(
Source,
new Rect(0, 0, (int)Source.Size.Width, (int)Source.Size.Height),
new Rect(0, 0, width, height),
BitmapInterpolationMode.Default
new Rect(0, 0, width, height)
);
}
@ -473,7 +472,7 @@ namespace Mesen.Debugger.Controls
if(OverlayLines?.Count > 0) {
foreach(PictureViewerLine line in OverlayLines) {
Pen pen = new Pen(line.Color.ToUint32(), line.Width ?? 2, line.DashStyle);
Pen pen = new Pen(line.Color.ToUInt32(), line.Width ?? 2, line.DashStyle);
context.DrawLine(pen, line.Start * Zoom, line.End * Zoom);
}
}
@ -579,9 +578,9 @@ namespace Mesen.Debugger.Controls
);
}
public void Render(IDrawingContextImpl context)
public void Render(ImmediateDrawingContext context)
{
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
var leaseFeature = context.PlatformImpl.GetFeature<ISkiaSharpApiLeaseFeature>();
if(leaseFeature != null) {
using var lease = leaseFeature.Lease();
var canvas = lease.SkCanvas;

View file

@ -1,7 +1,6 @@
using Avalonia.Data;
using Dock.Avalonia.Controls;
using Dock.Model;
using Dock.Model.ReactiveUI.Controls;
using Dock.Model.Core;
using Mesen.Debugger.ViewModels;
using Mesen.Debugger.ViewModels.DebuggerDock;
@ -11,9 +10,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dock.Model.Controls;
using Dock.Model.ReactiveUI;
using Mesen.Debugger.StatusViews;
using Mesen.Debugger.Controls;
using Dock.Model.Mvvm;
using Dock.Model.Mvvm.Controls;
namespace Mesen.Debugger
{
@ -77,7 +77,7 @@ namespace Mesen.Debugger
Proportion = 0.60,
VisibleDockables = CreateList<IDockable>(DisassemblyTool)
},
new MesenProportionalDockSplitter(),
new ProportionalDockSplitter(),
new ProportionalDock {
Proportion = 0.40,
Orientation = Orientation.Vertical,
@ -86,7 +86,7 @@ namespace Mesen.Debugger
Proportion = 0.5,
VisibleDockables = CreateList<IDockable>(StatusTool)
},
new MesenProportionalDockSplitter(),
new ProportionalDockSplitter(),
new ToolDock {
Proportion = 0.5,
VisibleDockables = CreateList<IDockable>(LabelListTool, FunctionListTool, FindResultListTool, ControllerListTool)
@ -95,7 +95,7 @@ namespace Mesen.Debugger
}
)
},
new MesenProportionalDockSplitter(),
new ProportionalDockSplitter(),
new ProportionalDock {
Proportion = 0.25,
Orientation = Orientation.Horizontal,
@ -104,12 +104,12 @@ namespace Mesen.Debugger
Proportion = 0.33,
VisibleDockables = CreateList<IDockable>(WatchListTool)
},
new MesenProportionalDockSplitter(),
new ProportionalDockSplitter(),
new ToolDock {
Proportion = 0.33,
VisibleDockables = CreateList<IDockable>(BreakpointListTool)
},
new MesenProportionalDockSplitter(),
new ProportionalDockSplitter(),
new ToolDock {
Proportion = 0.33,
VisibleDockables = CreateList<IDockable>(CallStackTool)
@ -128,7 +128,7 @@ namespace Mesen.Debugger
public override IProportionalDockSplitter CreateProportionalDockSplitter()
{
return new MesenProportionalDockSplitter();
return new ProportionalDockSplitter();
}
public override void InitLayout(IDockable layout)

View file

@ -1,5 +1,6 @@
using Avalonia;
using Mesen.Interop;
using Mesen.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
@ -70,7 +71,7 @@ namespace Mesen.Debugger.Utilities
}
if(hdPackTile.Length > 0) {
Application.Current?.Clipboard?.SetTextAsync(hdPackTile);
ApplicationHelper.GetMainWindow()?.Clipboard?.SetTextAsync(hdPackTile);
}
}
}

View file

@ -1,5 +1,4 @@
using Dock.Model.ReactiveUI.Controls;
using Mesen.Debugger.Labels;
using Mesen.Debugger.Labels;
using Mesen.Interop;
using Mesen.ViewModels;
using ReactiveUI;

View file

@ -1,5 +1,4 @@
using Dock.Model.ReactiveUI.Controls;
using ReactiveUI.Fody.Helpers;
using ReactiveUI.Fody.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

View file

@ -3,7 +3,6 @@ using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
using Avalonia.Media;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Config;
using Mesen.Debugger.Labels;
using Mesen.Debugger.Utilities;

View file

@ -3,7 +3,6 @@ using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
using Avalonia.Media;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Config;
using Mesen.Debugger.Labels;
using Mesen.Debugger.Utilities;

View file

@ -1,5 +1,5 @@
using Dock.Model.Core;
using Dock.Model.ReactiveUI.Controls;
using Dock.Model.Mvvm.Controls;
namespace Mesen.Debugger.ViewModels.DebuggerDock
{

View file

@ -1,4 +1,4 @@
using Dock.Model.ReactiveUI.Controls;
using Dock.Model.Mvvm.Controls;
using Mesen.Debugger.Utilities;
using ReactiveUI.Fody.Helpers;
using System;

View file

@ -3,7 +3,7 @@ using Avalonia.Media.Imaging;
using Avalonia.Threading;
using Dock.Model.Controls;
using Dock.Model.Core;
using Dock.Model.ReactiveUI.Controls;
using Dock.Model.Mvvm.Controls;
using Mesen.Config;
using Mesen.Debugger.Disassembly;
using Mesen.Debugger.Integration;

View file

@ -2,13 +2,13 @@
using Avalonia.Controls;
using Avalonia.Threading;
using Dock.Model.Core;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Config;
using Mesen.Debugger.Controls;
using Mesen.Debugger.Disassembly;
using Mesen.Debugger.Utilities;
using Mesen.Debugger.Views;
using Mesen.Interop;
using Mesen.Utilities;
using Mesen.ViewModels;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
@ -313,7 +313,7 @@ namespace Mesen.Debugger.ViewModels
{
DebuggerConfig cfg = Config.Debugger;
string code = GetSelection(cfg.CopyAddresses, cfg.CopyByteCode, cfg.CopyComments, cfg.CopyBlockHeaders, out _, false);
Application.Current?.Clipboard?.SetTextAsync(code);
ApplicationHelper.GetMainWindow()?.Clipboard?.SetTextAsync(code);
}
public string GetSelection(bool getAddresses, bool getByteCode, bool getComments, bool getHeaders, out int byteCount, bool skipGeneratedJmpSubLabels)

View file

@ -1,5 +1,4 @@
using Dock.Model.ReactiveUI.Controls;
using ReactiveUI.Fody.Helpers;
using ReactiveUI.Fody.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

View file

@ -4,7 +4,6 @@ using Avalonia.Controls;
using Avalonia.Controls.Selection;
using Avalonia.Media;
using DataBoxControl;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Config;
using Mesen.Debugger.Labels;
using Mesen.Debugger.Utilities;

View file

@ -1,5 +1,4 @@
using Avalonia.Controls;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Debugger.Labels;
using Mesen.Interop;
using Mesen.Localization;

View file

@ -4,7 +4,6 @@ using Avalonia.Controls;
using Avalonia.Controls.Selection;
using Avalonia.Media;
using DataBoxControl;
using Dock.Model.ReactiveUI.Controls;
using Mesen.Config;
using Mesen.Debugger.Labels;
using Mesen.Debugger.Utilities;

View file

@ -153,7 +153,7 @@ namespace Mesen.Debugger.ViewModels
ColorPickerWindow colorPicker = new ColorPickerWindow() { DataContext = model };
bool success = await colorPicker.ShowCenteredDialog<bool>(wnd);
if(success) {
DebugApi.SetPaletteColor(CpuType, selectedPalette, model.Color.ToUint32());
DebugApi.SetPaletteColor(CpuType, selectedPalette, model.Color.ToUInt32());
RefreshData();
}
} else {

View file

@ -14,6 +14,7 @@ using Mesen.Debugger.Disassembly;
using Mesen.Debugger.Utilities;
using System.Text;
using Mesen.Debugger.Controls;
using Mesen.Utilities;
namespace Mesen.Debugger.ViewModels;
@ -193,7 +194,7 @@ public class SourceViewViewModel : DisposableViewModel, ISelectableModel
for(int i = SelectionStart; i <= SelectionEnd; i++) {
sb.AppendLine(SelectedFile.Data[i]);
}
Application.Current?.Clipboard?.SetTextAsync(sb.ToString());
ApplicationHelper.GetMainWindow()?.Clipboard?.SetTextAsync(sb.ToString());
}
}

View file

@ -376,7 +376,7 @@ namespace Mesen.Debugger.ViewModels
string addrFormat = "X" + lines[i].CpuType.GetAddressSize();
sb.AppendLine(lines[i].GetAddressText(AddressDisplayType.CpuAddress, addrFormat).PadRight(6) + " " + lines[i].Text);
}
Application.Current?.Clipboard?.SetTextAsync(sb.ToString());
ApplicationHelper.GetMainWindow()?.Clipboard?.SetTextAsync(sb.ToString());
}
private bool IsRowVisible(int rowNumber)

View file

@ -18,7 +18,7 @@
</Design.DataContext>
<ScrollViewer AllowAutoHide="False">
<ItemsControl Items="{CompiledBinding Controllers}" VerticalAlignment="Center">
<ItemsControl ItemsSource="{CompiledBinding Controllers}" VerticalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />

View file

@ -126,7 +126,7 @@
<TextBlock DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center">Columns: </TextBlock>
<ComboBox
SelectedItem="{CompiledBinding Config.BytesPerRow}"
Items="{CompiledBinding AvailableWidths}"
ItemsSource="{CompiledBinding AvailableWidths}"
/>
</StackPanel>
<CheckBox

View file

@ -36,21 +36,21 @@
<TextBlock Text="Parameters" TextDecorations="Underline" Margin="0 10 0 0" />
<Grid IsVisible="{CompiledBinding Parameters.Count}" ColumnDefinitions="Auto,Auto,Auto" RowDefinitions="Auto" Margin="5 3 0 0" >
<ItemsControl Items="{CompiledBinding Parameters}" Grid.Column="0">
<ItemsControl ItemsSource="{CompiledBinding Parameters}" Grid.Column="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{CompiledBinding Name}" FontWeight="Bold" Padding="2 0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl Items="{CompiledBinding Parameters}" Grid.Column="1">
<ItemsControl ItemsSource="{CompiledBinding Parameters}" Grid.Column="1">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{CompiledBinding CalculatedType}" FontStyle="Italic" Margin="5 0" Padding="5 0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl Items="{CompiledBinding Parameters}" Grid.Column="2">
<ItemsControl ItemsSource="{CompiledBinding Parameters}" Grid.Column="2">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
@ -76,14 +76,14 @@
<StackPanel IsVisible="{CompiledBinding EnumValues.Count}">
<TextBlock Text="Values" TextDecorations="Underline" Margin="0 10 0 0" />
<Grid IsVisible="{CompiledBinding EnumValues.Count}" ColumnDefinitions="Auto,Auto" RowDefinitions="Auto" Margin="5 3 0 0" >
<ItemsControl Items="{CompiledBinding EnumValues}" Grid.Column="0">
<ItemsControl ItemsSource="{CompiledBinding EnumValues}" Grid.Column="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{CompiledBinding Name}" FontWeight="Bold" Padding="2 0" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl Items="{CompiledBinding EnumValues}" Grid.Column="1">
<ItemsControl ItemsSource="{CompiledBinding EnumValues}" Grid.Column="1">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{CompiledBinding Description}" Padding="5 0" />

View file

@ -21,7 +21,7 @@
<DockPanel>
<DockPanel DockPanel.Dock="Top" Margin="2">
<TextBlock Text="{l:Translate lblFile}" VerticalAlignment="Center" DockPanel.Dock="Left" Margin="3 0" />
<ComboBox Items="{CompiledBinding SourceFiles}" SelectedItem="{CompiledBinding SelectedFile}" HorizontalAlignment="Stretch" />
<ComboBox ItemsSource="{CompiledBinding SourceFiles}" SelectedItem="{CompiledBinding SelectedFile}" HorizontalAlignment="Stretch" />
</DockPanel>
<Border BorderBrush="{StaticResource MesenGrayBorderColor}" BorderThickness="0 1 0 0">

View file

@ -34,8 +34,8 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuOptions}" Items="{CompiledBinding OptionsMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuOptions}" ItemsSource="{CompiledBinding OptionsMenuActions}" />
</c:MesenMenu>
<Grid Classes="main" ColumnDefinitions="1*, 300" RowDefinitions="3*,100" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

View file

@ -61,10 +61,10 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" Items="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" Items="{CompiledBinding SearchMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" Items="{CompiledBinding OptionMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" ItemsSource="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" ItemsSource="{CompiledBinding SearchMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" ItemsSource="{CompiledBinding OptionMenuItems}" />
</c:MesenMenu>
<DockPanel DockPanel.Dock="Top">
<c:IconButton

View file

@ -49,9 +49,9 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" Items="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" ItemsSource="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuItems}" />
</c:MesenMenu>
<c:IconButton
HorizontalAlignment="Right"

View file

@ -72,7 +72,7 @@
<ListBox
Name="lstResults"
Background="Transparent"
Items="{CompiledBinding SearchResults}"
ItemsSource="{CompiledBinding SearchResults}"
Selection="{CompiledBinding SelectionModel}"
ScrollViewer.AllowAutoHide="False"
>

View file

@ -32,9 +32,9 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" Items="{CompiledBinding SearchMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" ItemsSource="{CompiledBinding SearchMenuItems}" />
</c:MesenMenu>
<DockPanel DockPanel.Dock="Top" Margin="3 2">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">

View file

@ -26,8 +26,8 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
</c:MesenMenu>
<c:IconButton
HorizontalAlignment="Right"

View file

@ -30,7 +30,7 @@
</Style>
</Window.Styles>
<TabControl Items="{CompiledBinding ProfilerTabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1">
<TabControl ItemsSource="{CompiledBinding ProfilerTabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TabName}" />

View file

@ -32,13 +32,13 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
</c:MesenMenu>
<dv:RefreshTimingView DataContext="{CompiledBinding RefreshTiming}" DockPanel.Dock="Bottom" />
<TabControl Items="{CompiledBinding Tabs}" Padding="1">
<TabControl ItemsSource="{CompiledBinding Tabs}" Padding="1">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TabName}" />

View file

@ -31,9 +31,9 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuScript}" Items="{CompiledBinding ScriptMenuActions}" />
<MenuItem Header="{l:Translate mnuHelp}" Items="{CompiledBinding HelpMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuScript}" ItemsSource="{CompiledBinding ScriptMenuActions}" />
<MenuItem Header="{l:Translate mnuHelp}" ItemsSource="{CompiledBinding HelpMenuActions}" />
</c:MesenMenu>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top">

View file

@ -36,8 +36,8 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
</c:MesenMenu>
<c:IconButton
HorizontalAlignment="Right"

View file

@ -27,9 +27,9 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuTools}" Items="{CompiledBinding ToolsMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuTools}" ItemsSource="{CompiledBinding ToolsMenuActions}" />
</c:MesenMenu>
</Panel>

View file

@ -45,8 +45,8 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
</c:MesenMenu>
<c:IconButton
HorizontalAlignment="Right"
@ -64,10 +64,10 @@
<Grid ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto">
<TextBlock Text="{l:Translate lblPresets}" Margin="0 5 0 0 " VerticalAlignment="Top" />
<Panel Grid.Column="1" MaxWidth="160" HorizontalAlignment="Left">
<ItemsControl Items="{CompiledBinding ConfigPresetRows}">
<ItemsControl ItemsSource="{CompiledBinding ConfigPresetRows}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ItemsControl Items="{Binding}">
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />

View file

@ -33,8 +33,8 @@
<DockPanel>
<Panel DockPanel.Dock="Top">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuActions}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuActions}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuActions}" />
</c:MesenMenu>
<c:IconButton
HorizontalAlignment="Right"
@ -86,7 +86,7 @@
</ScrollViewer>
<TabControl
Items="{CompiledBinding Tabs}"
ItemsSource="{CompiledBinding Tabs}"
SelectedItem="{CompiledBinding SelectedTab}"
IsVisible="{CompiledBinding ShowTabs}"
Padding="1"

View file

@ -36,10 +36,10 @@
<DockPanel Margin="2">
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" Items="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" Items="{CompiledBinding SearchMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" Items="{CompiledBinding ViewMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuDebug}" ItemsSource="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuSearch}" ItemsSource="{CompiledBinding SearchMenuItems}" />
<MenuItem Header="{l:Translate mnuView}" ItemsSource="{CompiledBinding ViewMenuItems}" />
</c:MesenMenu>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" IsVisible="{CompiledBinding Config.ShowToolbar}">
@ -78,7 +78,7 @@
/>
</Grid>
<TabControl Items="{CompiledBinding Tabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1" DockPanel.Dock="Bottom">
<TabControl ItemsSource="{CompiledBinding Tabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1" DockPanel.Dock="Bottom">
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">

View file

@ -32,7 +32,7 @@
</Window.Styles>
<Panel>
<TabControl Items="{CompiledBinding WatchTabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1">
<TabControl ItemsSource="{CompiledBinding WatchTabs}" SelectedItem="{CompiledBinding SelectedTab}" Padding="1">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding TabName}" />

View file

@ -1,10 +1,48 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Media;
using Avalonia.VisualTree;
using Mesen.Config;
using System;
namespace Mesen;
public class MesenWindow : Window
{
static MesenWindow()
{
PopupRoot.ClientSizeProperty.Changed.AddClassHandler<PopupRoot>((s, e) => {
foreach(var v in s.GetVisualChildren()) {
SetTextRenderingMode(v);
}
});
}
protected override void OnInitialized()
{
base.OnInitialized();
SetTextRenderingMode(this);
}
private static void SetTextRenderingMode(Visual v)
{
switch(ConfigManager.Config.Preferences.FontAntialiasing) {
case FontAntialiasing.Disabled:
RenderOptions.SetTextRenderingMode(v, TextRenderingMode.Alias);
break;
case FontAntialiasing.Antialias:
RenderOptions.SetTextRenderingMode(v, TextRenderingMode.Antialias);
break;
default:
case FontAntialiasing.SubPixelAntialias:
RenderOptions.SetTextRenderingMode(v, TextRenderingMode.SubpixelAntialias);
break;
};
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);

View file

@ -137,6 +137,7 @@
Placement="BottomEdgeAlignedLeft"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
IsLightDismissEnabled="True"
RenderOptions.TextRenderingMode="Alias"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
OverlayInputPassThroughElement="{Binding $parent[Menu]}">
<Border Background="{DynamicResource MenuFlyoutPresenterBackground}"

View file

@ -11,48 +11,41 @@
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="*,Auto" RowDefinitions="*,Auto">
<c:MesenScrollContentPresenter Name="PART_ContentPresenter"
<ScrollContentPresenter Name="PART_ContentPresenter"
Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="1"
Grid.ColumnSpan="1"
Background="{TemplateBinding Background}"
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"
CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}"
Content="{TemplateBinding Content}"
Extent="{TemplateBinding Extent, Mode=TwoWay}"
Margin="{TemplateBinding Padding}"
Offset="{TemplateBinding Offset, Mode=TwoWay}"
Viewport="{TemplateBinding Viewport, Mode=TwoWay}">
HorizontalSnapPointsType="{TemplateBinding HorizontalSnapPointsType}"
VerticalSnapPointsType="{TemplateBinding VerticalSnapPointsType}"
HorizontalSnapPointsAlignment="{TemplateBinding HorizontalSnapPointsAlignment}"
VerticalSnapPointsAlignment="{TemplateBinding VerticalSnapPointsAlignment}"
Padding="{TemplateBinding Padding}"
ScrollViewer.IsScrollInertiaEnabled="{TemplateBinding IsScrollInertiaEnabled}">
<ScrollContentPresenter.GestureRecognizers>
<ScrollGestureRecognizer
CanHorizontallyScroll="{TemplateBinding CanHorizontallyScroll}"
CanVerticallyScroll="{TemplateBinding CanVerticallyScroll}" />
<ScrollGestureRecognizer CanHorizontallyScroll="{Binding CanHorizontallyScroll, ElementName=PART_ContentPresenter}"
CanVerticallyScroll="{Binding CanVerticallyScroll, ElementName=PART_ContentPresenter}"
IsScrollInertiaEnabled="{Binding (ScrollViewer.IsScrollInertiaEnabled), ElementName=PART_ContentPresenter}"/>
</ScrollContentPresenter.GestureRecognizers>
</c:MesenScrollContentPresenter>
</ScrollContentPresenter>
<ScrollBar Name="PART_HorizontalScrollBar"
AllowAutoHide="{TemplateBinding AllowAutoHide}"
Orientation="Horizontal"
LargeChange="{Binding LargeChange.Width, RelativeSource={RelativeSource TemplatedParent}}"
SmallChange="{Binding SmallChange.Width, RelativeSource={RelativeSource TemplatedParent}}"
Maximum="{TemplateBinding HorizontalScrollBarMaximum}"
Value="{TemplateBinding HorizontalScrollBarValue, Mode=TwoWay}"
ViewportSize="{TemplateBinding HorizontalScrollBarViewportSize}"
Visibility="{TemplateBinding HorizontalScrollBarVisibility}"
Grid.Row="1"
Focusable="False" />
Grid.Row="1" />
<ScrollBar Name="PART_VerticalScrollBar"
AllowAutoHide="{TemplateBinding AllowAutoHide}"
Orientation="Vertical"
LargeChange="{Binding LargeChange.Height, RelativeSource={RelativeSource TemplatedParent}}"
SmallChange="{Binding SmallChange.Height, RelativeSource={RelativeSource TemplatedParent}}"
Maximum="{TemplateBinding VerticalScrollBarMaximum}"
Value="{TemplateBinding VerticalScrollBarValue, Mode=TwoWay}"
ViewportSize="{TemplateBinding VerticalScrollBarViewportSize}"
Visibility="{TemplateBinding VerticalScrollBarVisibility}"
Grid.Column="1"
Focusable="False" />
<Panel x:Name="PART_ScrollBarsSeparator" Grid.Row="1" Grid.Column="1" Background="{DynamicResource ScrollViewerScrollBarsSeparatorBackground}" />
Grid.Column="1" />
<Panel x:Name="PART_ScrollBarsSeparator"
Grid.Row="1"
Grid.Column="1"
Background="{DynamicResource ScrollViewerScrollBarsSeparatorBackground}"
Opacity="0">
<Panel.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.1" />
</Transitions>
</Panel.Transitions>
</Panel>
</Grid>
</ControlTemplate>
</Setter>

View file

@ -10,11 +10,18 @@
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="ToolControl /template/ Border#PART_Border">
<Setter Property="BorderThickness" Value="1 0 1 0" />
<Setter Property="BorderThickness" Value="1 0 1 1" />
</Style>
<Style Selector="ToolControl /template/ Border#PART_BorderFill">
<Setter Property="BorderThickness" Value="0 0 0 0" />
</Style>
<Style Selector="ToolControl /template/ DockPanel#PART_DockPanel">
<Setter Property="Margin" Value="0 0 0 1" />
</Style>
<Style Selector="ToolControl /template/ ToolTabStrip#PART_TabStrip">
<Setter Property="Margin" Value="0 -1 0 0" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
</Style>
<Style Selector="ToolControl /template/ ToolTabStrip#PART_TabStrip ToolTabStripItem:pointerover">
<Setter Property="Background" Value="{DynamicResource MesenDockTabPointerOverBrush}" />
</Style>
@ -66,8 +73,7 @@
Command="{Binding Owner.Factory.CloseDockable}"
CommandParameter="{Binding ActiveDockable}"
IsVisible="{Binding ActiveDockable.CanClose, FallbackValue=False}"
DockPanel.Dock="Right"
x:CompileBindings="False">
DockPanel.Dock="Right">
<Viewbox>
<Path x:Name="PART_ClosePath" />
</Viewbox>
@ -76,8 +82,7 @@
Command="{Binding Owner.Factory.PinDockable}"
CommandParameter="{Binding ActiveDockable}"
IsVisible="{Binding ActiveDockable.CanPin, FallbackValue=False}"
DockPanel.Dock="Right"
x:CompileBindings="False">
DockPanel.Dock="Right">
<Viewbox>
<Path x:Name="PART_PinPath" />
</Viewbox>

View file

@ -156,7 +156,7 @@
<Setter Property="IsVisible" Value="{Binding Visible}" />
<Setter Property="IsEnabled" Value="{Binding Enabled}" />
<Setter Property="Tag" Value="{Binding ShortcutText}" />
<Setter Property="Items" Value="{Binding SubActions}" />
<Setter Property="ItemsSource" Value="{Binding SubActions}" />
<Setter Property="Command" Value="{Binding ClickCommand}" />
</Style>
@ -504,7 +504,10 @@
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="0 0 -5 0" />
</Style>
<Style Selector="ToolChromeControl > Grid > Border Button Path">
<Setter Property="Fill" Value="{DynamicResource ThemeForegroundBrush}" />
</Style>
<Style Selector="TabControl[TabStripPlacement=Left] TabControl[TabStripPlacement=Top]">
<Setter Property="Template">
<ControlTemplate>

View file

@ -25,7 +25,7 @@ namespace ThemeEditor.Controls.ColorPicker
public static string ToHexColor(Color color)
{
return "#" + (color.ToUint32() & 0xFFFFFF).ToString("X6");
return "#" + (color.ToUInt32() & 0xFFFFFF).ToString("X6");
}
public static Color FromHexColor(string hex)

View file

@ -9,7 +9,7 @@ using DataBoxControl.Primitives.Layout;
namespace DataBoxControl.Controls;
public class DataBoxPanel : MesenVirtualizingStackPanel, IStyleable
public class DataBoxPanel : VirtualizingStackPanel, IStyleable
{
Type IStyleable.StyleKey => typeof(DataBoxPanel);

View file

@ -231,7 +231,7 @@ public class DataBox : TemplatedControl
{
_rowsPresenter.DataBox = this;
_rowsPresenter[!!ItemsControl.ItemsProperty] = this[!!ItemsProperty];
_rowsPresenter[!!ItemsControl.ItemsSourceProperty] = this[!!ItemsProperty];
_rowsPresenter[!!ListBox.SelectionProperty] = this[!!SelectionProperty];
_rowsPresenter.TemplateApplied += (_, _) =>

File diff suppressed because it is too large Load diff

View file

@ -15,8 +15,8 @@ public class DataBoxRowsPresenter : ListBox, IStyleable
internal DataBox? DataBox { get; set; }
Type IStyleable.StyleKey => typeof(DataBoxRowsPresenter);
protected override Control CreateContainerForItemOverride()
protected override Control CreateContainerForItemOverride(object? item, int index, object? recycleKey)
{
return new DataBoxRow {
DataBox = DataBox

View file

@ -123,7 +123,7 @@
<Style Selector="DataBoxPanel">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Orientation" Value="Vertical" />
<Setter Property="Margin" Value="-1 0 0 0" />
</Style>

View file

@ -82,15 +82,14 @@
<None Remove="Utilities\DipSwitchDefinitions.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview6" />
<PackageReference Include="Dock.Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Dock.Model.Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Dock.Model.ReactiveUI" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.0-preview8" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.0-preview8" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview8" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview8" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview8" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview8" />
<PackageReference Include="Dock.Avalonia" Version="11.0.0-preview8.2" />
<PackageReference Include="Dock.Model.Mvvm" Version="11.0.0-preview8.2" />
<PackageReference Include="Dotnet.Bundle" Version="*" />
<PackageReference Include="Microsoft.Win32.Registry" Version="6.0.0-preview.5.21301.5" />
<PackageReference Include="ReactiveUI.Fody" Version="18.4.1" />

View file

@ -19,7 +19,7 @@ namespace Mesen.Utilities
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if(value is SolidColorBrush b && targetType == typeof(UInt32)) {
return b.Color.ToUint32();
return b.Color.ToUInt32();
}
return AvaloniaProperty.UnsetValue;
}

View file

@ -11,7 +11,7 @@ public class GlobalMouseX11Impl : IGlobalMouseImpl
public GlobalMouseX11Impl()
{
_mainWindow = ApplicationHelper.GetMainWindow()?.PlatformImpl?.Handle.Handle ?? IntPtr.Zero;
_mainWindow = ApplicationHelper.GetMainWindow()?.TryGetPlatformHandle()?.Handle ?? IntPtr.Zero;
_x11 = new X11Info();
}

View file

@ -15,7 +15,7 @@ namespace Mesen.Utilities.Json
public override void Write(Utf8JsonWriter writer, Color value, JsonSerializerOptions options)
{
writer.WriteNumberValue(value.ToUint32());
writer.WriteNumberValue(value.ToUInt32());
}
}
}

View file

@ -45,8 +45,8 @@ namespace Mesen.Utilities
}
if(menu.Items != null) {
foreach(MenuItem item in menu.Items) {
if(IsPointerInItem(item)) {
foreach(MenuItem? item in menu.Items) {
if(item != null && IsPointerInItem(item)) {
return true;
}
}

View file

@ -44,7 +44,7 @@
Name="AudioDevice"
Grid.Row="0"
Grid.Column="1"
Items="{CompiledBinding AudioDevices}"
ItemsSource="{CompiledBinding AudioDevices}"
SelectedItem="{CompiledBinding Config.AudioDevice}"
Width="200"
/>

View file

@ -17,7 +17,7 @@
<Border MaxWidth="500" MaxHeight="300" BorderBrush="Gray" BorderThickness="1" Margin="5">
<ScrollViewer>
<ItemsControl Items="{CompiledBinding CustomKeys}">
<ItemsControl ItemsSource="{CompiledBinding CustomKeys}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>

View file

@ -53,7 +53,7 @@ namespace Mesen.Views
{
Color color = await SelectColor(e.Color);
UInt32[] colors = (UInt32[])_model.Config.BgColors.Clone();
colors[e.ColorIndex] = color.ToUint32();
colors[e.ColorIndex] = color.ToUInt32();
_model.Config.BgColors = colors;
}
@ -61,7 +61,7 @@ namespace Mesen.Views
{
Color color = await SelectColor(e.Color);
UInt32[] colors = (UInt32[])_model.Config.Obj0Colors.Clone();
colors[e.ColorIndex] = color.ToUint32();
colors[e.ColorIndex] = color.ToUInt32();
_model.Config.Obj0Colors = colors;
}
@ -69,7 +69,7 @@ namespace Mesen.Views
{
Color color = await SelectColor(e.Color);
UInt32[] colors = (UInt32[])_model.Config.Obj1Colors.Clone();
colors[e.ColorIndex] = color.ToUint32();
colors[e.ColorIndex] = color.ToUInt32();
_model.Config.Obj1Colors = colors;
}
@ -100,9 +100,9 @@ namespace Mesen.Views
private void SetPalette(Color color0, Color color1, Color color2, Color color3)
{
_model.Config.BgColors = new UInt32[] { color0.ToUint32(), color1.ToUint32(), color2.ToUint32(), color3.ToUint32() };
_model.Config.Obj0Colors = new UInt32[] { color0.ToUint32(), color1.ToUint32(), color2.ToUint32(), color3.ToUint32() };
_model.Config.Obj1Colors = new UInt32[] { color0.ToUint32(), color1.ToUint32(), color2.ToUint32(), color3.ToUint32() };
_model.Config.BgColors = new UInt32[] { color0.ToUInt32(), color1.ToUInt32(), color2.ToUInt32(), color3.ToUInt32() };
_model.Config.Obj0Colors = new UInt32[] { color0.ToUInt32(), color1.ToUInt32(), color2.ToUInt32(), color3.ToUInt32() };
_model.Config.Obj1Colors = new UInt32[] { color0.ToUInt32(), color1.ToUInt32(), color2.ToUInt32(), color3.ToUInt32() };
}
}
}

View file

@ -17,11 +17,11 @@
</Design.DataContext>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuGame}" Items="{CompiledBinding GameMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" Items="{CompiledBinding OptionsMenuItems}" />
<MenuItem Header="{l:Translate mnuTools}" Items="{CompiledBinding ToolsMenuItems}" SubmenuOpened="mnuTools_Opened" />
<MenuItem Header="{l:Translate mnuDebug}" Items="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuHelp}" Items="{CompiledBinding HelpMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuGame}" ItemsSource="{CompiledBinding GameMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" ItemsSource="{CompiledBinding OptionsMenuItems}" />
<MenuItem Header="{l:Translate mnuTools}" ItemsSource="{CompiledBinding ToolsMenuItems}" SubmenuOpened="mnuTools_Opened" />
<MenuItem Header="{l:Translate mnuDebug}" ItemsSource="{CompiledBinding DebugMenuItems}" />
<MenuItem Header="{l:Translate mnuHelp}" ItemsSource="{CompiledBinding HelpMenuItems}" />
</c:MesenMenu>
</UserControl>

View file

@ -169,7 +169,7 @@
</c:OptionSection>
<c:OptionSection Header="{l:Translate lblFontSettings}">
<Grid ColumnDefinitions="Auto,Auto" RowDefinitions="Auto" Margin="0 0 0 5" IsVisible="False">
<Grid ColumnDefinitions="Auto,Auto" RowDefinitions="Auto" Margin="0 0 0 5">
<TextBlock Text="{l:Translate lblFontAntialiasing}" />
<StackPanel Orientation="Horizontal" Grid.Column="1" >
<c:EnumComboBox

View file

@ -31,7 +31,7 @@
</Border>
<ScrollViewer AllowAutoHide="False">
<ItemsControl Items="{Binding ShortcutKeys}">
<ItemsControl ItemsSource="{Binding ShortcutKeys}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>

View file

@ -64,14 +64,14 @@
<ComboBox
Grid.Row="1" Grid.Column="1"
SelectedItem="{CompiledBinding Config.ExclusiveFullscreenRefreshRateNtsc}"
Items="{CompiledBinding AvailableRefreshRates}"
ItemsSource="{CompiledBinding AvailableRefreshRates}"
/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="{l:Translate lblRequestedRefreshRatePal}" />
<ComboBox
Grid.Row="2" Grid.Column="1"
SelectedItem="{CompiledBinding Config.ExclusiveFullscreenRefreshRatePal}"
Items="{CompiledBinding AvailableRefreshRates}"
ItemsSource="{CompiledBinding AvailableRefreshRates}"
/>
</Grid>
</StackPanel>

View file

@ -88,7 +88,7 @@
<TextBlock Text="{l:Translate lblAcknowledgeList}" Margin="0 5 0 5" TextWrapping="Wrap" />
<Border BorderBrush="Gray" BorderThickness="1">
<ListBox
Items="{CompiledBinding AcknowledgeList, ElementName=root}"
ItemsSource="{CompiledBinding AcknowledgeList, ElementName=root}"
Background="Transparent"
ScrollViewer.AllowAutoHide="False"
/>
@ -99,7 +99,7 @@
<TextBlock Text="{l:Translate lblUsedSoftware}" Margin="0 15 0 5" />
<Border BorderBrush="Gray" BorderThickness="1">
<ListBox
Items="{CompiledBinding LibraryList, ElementName=root}"
ItemsSource="{CompiledBinding LibraryList, ElementName=root}"
Height="130"
Background="Transparent"
ScrollViewer.AllowAutoHide="False"

View file

@ -35,7 +35,7 @@
<Border BorderThickness="1" BorderBrush="{StaticResource MesenGrayBorderColor}" Margin="2">
<ListBox
Name="ListBox"
Items="{CompiledBinding FilteredEntries}"
ItemsSource="{CompiledBinding FilteredEntries}"
Selection="{CompiledBinding SelectionModel}"
DoubleTapped="OnDoubleTapped"
PointerReleased="OnPointerReleased"

View file

@ -30,7 +30,7 @@
/>
</StackPanel>
<TabControl Items="{CompiledBinding HelpTabs, ElementName=root}">
<TabControl ItemsSource="{CompiledBinding HelpTabs, ElementName=root}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />

View file

@ -43,13 +43,13 @@
</TabItem>
<TabItem Header="{l:Translate tabDipSwitches}" IsVisible="{CompiledBinding DipSwitches.DipSwitches.Count}">
<ScrollViewer>
<ItemsControl Items="{CompiledBinding DipSwitches.DipSwitches}">
<ItemsControl ItemsSource="{CompiledBinding DipSwitches.DipSwitches}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="1*, 1*" RowDefinitions="Auto">
<TextBlock Text="{Binding Name}" />
<ComboBox
Items="{Binding Options}"
ItemsSource="{Binding Options}"
SelectedIndex="{Binding SelectedOption}"
Grid.Column="2"
HorizontalAlignment="Stretch"

View file

@ -33,11 +33,11 @@
<c:OptionSection Grid.Row="1" Grid.ColumnSpan="2" Header="{l:Translate grpOptions}">
<Grid ColumnDefinitions="Auto,150,Auto" RowDefinitions="Auto,Auto">
<TextBlock VerticalAlignment="Center" Text="{l:Translate lblScale}" />
<ComboBox Grid.Column="1" HorizontalAlignment="Stretch" Items="{CompiledBinding Filters}" SelectedItem="{CompiledBinding SelectedFilter}" />
<ComboBox Grid.Column="1" HorizontalAlignment="Stretch" ItemsSource="{CompiledBinding Filters}" SelectedItem="{CompiledBinding SelectedFilter}" />
<Image Grid.Column="2" Stretch="None" Margin="5 0" Source="/Assets/Help.png" ToolTip.Tip="{l:Translate lblScaleHelp}" ToolTip.Placement="Right" ToolTip.ShowDelay="100" />
<TextBlock Grid.Row="1" VerticalAlignment="Center" Text="{l:Translate lblBankSize}" IsVisible="{CompiledBinding IsBankSizeVisible}" />
<ComboBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" Items="{CompiledBinding BankSizes}" SelectedItem="{CompiledBinding SelectedBankSize}" IsVisible="{CompiledBinding IsBankSizeVisible}" />
<ComboBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" ItemsSource="{CompiledBinding BankSizes}" SelectedItem="{CompiledBinding SelectedBankSize}" IsVisible="{CompiledBinding IsBankSizeVisible}" />
<Image Grid.Column="2" Grid.Row="1" Stretch="None" Margin="5 0" Source="/Assets/Help.png" ToolTip.Tip="{l:Translate lblBankSizeHelp}" ToolTip.Placement="Right" ToolTip.ShowDelay="100" IsVisible="{CompiledBinding IsBankSizeVisible}" />
</Grid>
<WrapPanel>

View file

@ -22,8 +22,8 @@
<DockPanel>
<c:MesenMenu DockPanel.Dock="Top" Name="ActionMenu">
<MenuItem Header="{l:Translate mnuFile}" Items="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" Items="{CompiledBinding OptionsMenuItems}" />
<MenuItem Header="{l:Translate mnuFile}" ItemsSource="{CompiledBinding FileMenuItems}" />
<MenuItem Header="{l:Translate mnuOptions}" ItemsSource="{CompiledBinding OptionsMenuItems}" />
</c:MesenMenu>
<Border Name="ControlBar" BorderBrush="{StaticResource MesenGrayBorderColor}" BorderThickness="0 1 0 0" DockPanel.Dock="Bottom">

View file

@ -105,7 +105,7 @@ namespace Mesen.Windows
return;
}
HistoryApi.HistoryViewerInitialize(PlatformImpl?.Handle.Handle ?? IntPtr.Zero, _renderer.Handle);
HistoryApi.HistoryViewerInitialize(TryGetPlatformHandle()?.Handle ?? IntPtr.Zero, _renderer.Handle);
_model.SetCoreOptions();
_model.Update();
_model.InitActions(this);

View file

@ -205,7 +205,7 @@ namespace Mesen.Windows
CommandLineHelper cmdLine = new CommandLineHelper(Program.CommandLineArgs, true);
_cmdLine = cmdLine;
EmuApi.InitializeEmu(ConfigManager.HomeFolder, PlatformImpl?.Handle.Handle ?? IntPtr.Zero, _renderer.Handle, cmdLine.NoAudio, cmdLine.NoVideo, cmdLine.NoInput);
EmuApi.InitializeEmu(ConfigManager.HomeFolder, TryGetPlatformHandle()?.Handle ?? IntPtr.Zero, _renderer.Handle, cmdLine.NoAudio, cmdLine.NoVideo, cmdLine.NoInput);
ConfigManager.Config.RemoveObsoleteConfig();
@ -490,7 +490,7 @@ namespace Mesen.Windows
WindowState = WindowState.FullScreen;
Task.Run(() => {
EmuApi.SetExclusiveFullscreenMode(true, PlatformImpl?.Handle.Handle ?? IntPtr.Zero);
EmuApi.SetExclusiveFullscreenMode(true, TryGetPlatformHandle()?.Handle ?? IntPtr.Zero);
_preventFullscreenToggle = false;
});
} else {

View file

@ -32,7 +32,7 @@
<ListBox
Name="ListBox"
Items="{CompiledBinding FilteredEntries}"
ItemsSource="{CompiledBinding FilteredEntries}"
SelectedItem="{CompiledBinding SelectedEntry}"
DoubleTapped="OnDoubleTapped"
PointerReleased="OnPointerReleased"